Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Refresh the max height set on the element. This may be useful if resizing the window and the content height changes.
function refresh() { element.style.maxHeight = element.scrollHeight + 'px'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateHeight () {\n const height = document.body.scrollHeight\n if (height === this._lastHeight) {\n return\n }\n \n this._lastHeight = height\n this._sendMessage('height', { height: height })\n }", "function setHeight() {\n $('.voyage').css('height', 'auto');\n var maxHeight = Math.max.apply(null, $(\".voyage\").map(function() {\n return $(this).height();\n }).get());\n $('.voyage').height(maxHeight);\n }", "setMaxHeight(valueNew){let t=e.ValueConverter.toNumber(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"MaxHeight\")),t!==this.__maxHeight&&(this.__maxHeight=t,e.EventProvider.raise(this.__id+\".onPropertyChanged\",{propertyName:\"MaxHeight\"}),this.__processMaxHeight())}", "function resizeMyHeight(elem) {\n\t\tvar scrollHeight = getScrollHeight(elem);\n\t\tvar\tnewHeight = Math.max(scrollHeight, elemParams.menueHeight);\n\t\t\n\t\telem.style.height = newHeight + \"px\";\n \t}", "updateElementsHeight() {\n const me = this;\n me.rowManager.storeKnownHeight(me.id, me.height); // prevent unnecessary style updates\n\n if (me.lastHeight !== me.height) {\n const elements = me._elementsArray;\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].style.height = `${me.offsetHeight}px`;\n }\n\n me.lastHeight = me.height;\n }\n }", "updateHeight(){\n var contentHeight = this.$editable.outerHeight();\n\n if(contentHeight != this.iframe.offsetHeight) {\n this.iframe.style.height = Math.max(contentHeight, this.MIN_HEIGHT) + 'px';\n }\n /*var body = this.doc.body;\n\n if(body.scrollHeight != this.iframe.offsetHeight) {\n this.iframe.style.height = Math.max(body.scrollHeight, this.MIN_HEIGHT) + 'px';\n }*/\n }", "_setHeight() {\n var max = 0,\n _this = this; // Lock down the `this` value for the root tabs object\n\n this.$tabContent\n .find(`.${this.options.panelClass}`)\n .css('height', '')\n .each(function() {\n\n var panel = $(this),\n isActive = panel.hasClass(`${_this.options.panelActiveClass}`); // get the options from the parent instead of trying to get them from the child\n\n if (!isActive) {\n panel.css({'visibility': 'hidden', 'display': 'block'});\n }\n\n var temp = this.getBoundingClientRect().height;\n\n if (!isActive) {\n panel.css({\n 'visibility': '',\n 'display': ''\n });\n }\n\n max = temp > max ? temp : max;\n })\n .css('height', `${max}px`);\n }", "getMaxHeight(){return this.__maxHeight}", "updateElementsHeight() {\n const me = this;\n // prevent unnecessary style updates\n if (me.lastHeight !== me.height) {\n const elements = me._elementsArray;\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].style.height = `${me.offsetHeight}px`;\n }\n me.lastHeight = me.height;\n }\n }", "function setHeight() {\n let innerHeight = $(window).height() - 250\n $('.card-data').css('max-height', innerHeight)\n }", "set maxHeight(value) {}", "function setHeight() {\n\n\n $('.js-head-height').css('height', 'auto');\n var maxHeight2 = Math.max.apply(null, $(\".js-head-height\").map(function() {\n return $(this).height();\n }).get());\n $('.js-head-height').height(maxHeight2);\n\n\n }", "function changeHeight() {\n var profileBox = $('.profile__item');\n var max = 0;\n profileBox.each(function() {\n if (max < $(this).outerHeight()) {\n max = $(this).outerHeight();\n }\n })\n profileBox.height(max);\n }", "_setMaxHeight() {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }", "function adaptiveHeight() {\n\t\tlet takeHeihgt = [];\n\t\t$('.header_slider__item').each(function(item, index) {\n\t\t\ttakeHeihgt.push($(this).outerHeight());\n\t\t});\n\t\t$('.header_slider__item').css('height', Math.max.apply(null, takeHeihgt));\n\t}", "updateWindowHeight() {\n var self = this;\n\n // There needs to be a slight delay before updating the window height\n // because in some cases the last entry can get cut off without a timeout\n // if the entries height is dynamically changed after appending\n setTimeout(function() {\n var zoomFactor = config.get(\"window.zoomFactor\");\n var height = $(\".container\").height() * zoomFactor;\n ipcRenderer.send(\"resize\", 300 * zoomFactor, height);\n }, 50);\n }", "setHeight(valueNew){let t=e.ValueConverter.toNumber(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"Height\")),t!==this.__height&&(this.__height=t,e.EventProvider.raise(this.__id+\".onPropertyChanged\",{propertyName:\"Height\"}),this.__processHeight())}", "function handleDynamicHeight (value) {\n $element.toggleClass('md-dynamic-height', value);\n }", "function handleDynamicHeight (value) {\n $element.toggleClass('md-dynamic-height', value);\n }", "function handleDynamicHeight (value) {\n $element.toggleClass('md-dynamic-height', value);\n }", "setMaxHeightUnit(valueNew){let t=e.ValueConverter.toDimensionUnit(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"MaxHeightUnit\")),t!==this.__maxHeightUnit&&(this.__maxHeightUnit=t,e.EventProvider.raise(this.__id+\".onPropertyChanged\",{propertyName:\"MaxHeightUnit\"}),this.__processMaxHeightUnit())}", "updateHeight_() {\n const estScrollHeight = this.items.length > 0 ?\n this.items.length * this.domItemAverageHeight_() :\n 0;\n this.$.container.style.height = estScrollHeight + 'px';\n }", "handleResize() {\n if (this.scrollHeight !== this.contentNode.scrollHeight || this.clientHeight !== this.contentNode.clientHeight) {\n this.adjustHeight();\n }\n this.forceUpdate();\n }", "function autoAdjustHeight() {\n // Figure out the new height\n var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight;\n var headerHeight = grid.options.showHeader ? grid.options.headerRowHeight : 0;\n var footerHeight = grid.calcFooterHeight();\n \n var scrollbarHeight = 0;\n if (grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS) {\n scrollbarHeight = gridUtil.getScrollbarWidth();\n }\n\n var maxNumberOfFilters = 0;\n // Calculates the maximum number of filters in the columns\n angular.forEach(grid.options.columnDefs, function(col) {\n if (col.hasOwnProperty('filter')) {\n if (maxNumberOfFilters < 1) {\n maxNumberOfFilters = 1;\n }\n }\n else if (col.hasOwnProperty('filters')) {\n if (maxNumberOfFilters < col.filters.length) {\n maxNumberOfFilters = col.filters.length;\n }\n }\n });\n\n if (grid.options.enableFiltering) {\n var allColumnsHaveFilteringTurnedOff = grid.options.columnDefs.every(function(col) {\n return col.enableFiltering === false;\n });\n\n if (!allColumnsHaveFilteringTurnedOff) {\n maxNumberOfFilters++;\n }\n }\n\n var filterHeight = maxNumberOfFilters * headerHeight;\n\n var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight + filterHeight;\n\n $elm.css('height', newHeight + 'px');\n\n grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm);\n }", "function setHeight(value){\n var val = value || Math.min(textarea.scrollHeight, settings.maxHeight);\n textarea.style.height = val + 'px';\n\n //we store the height locally so that other pages can adjust to this height\n localStorage.setItem('height', val);\n }", "function setWindowHeight(element){\n $(element).height( getWindowHeight() );\n}", "function onElementHeightChange(elm, callback){\n var lastHeight = elm.scrollHeight, newHeight;\n (function run(){\n newHeight = elm.scrollHeight;\n if( lastHeight != newHeight )\n callback();\n lastHeight = newHeight;\n\n elm.onElementHeightChangeTimer = setTimeout(run, 10);\n })();\n}", "function resizeHeightPage() {\n\t\tvar newSizeH = sizeWin-recalculPadding(pages);\n\t\tconsole.log(newSizeH);\n\t\tpages.css({\"min-height\":sizeWin});\n\t}", "function setModalMaxHeight(element) {\r\r\n this.$element = $(element);\r\r\n this.$content = this.$element.find('.modal-content');\r\r\n var borderWidth = this.$content.outerHeight() - this.$content.innerHeight();\r\r\n var dialogMargin = $(window).width() < 768 ? 20 : 60;\r\r\n var contentHeight = $(window).height() - (dialogMargin + borderWidth);\r\r\n var headerHeight = this.$element.find('.modal-header').outerHeight() || 0;\r\r\n var footerHeight = this.$element.find('.modal-footer').outerHeight() || 0;\r\r\n var maxHeight = contentHeight - (headerHeight + footerHeight);\r\r\n\r\r\n this.$content.css({\r\r\n overflow: 'hidden',\r\r\n });\r\r\n\r\r\n this.$element.find('.modal-body').css({\r\r\n 'max-height': maxHeight,\r\r\n 'overflow-y': 'auto',\r\r\n });\r\r\n}", "function getHeight(v) {\n self = v;\n self.prompt({\n type: 'input',\n name: 'height',\n default: false,\n message: 'Max height? ',\n },\n function(result){\n if (result.height)\n height = result.height;\n doResize(self);\n });\n}", "setHeight () {\n if (!this.props.list.length || !this.refs.item0) {\n return;\n }\n\n const node = ReactDom.findDOMNode(this);\n const computedStyle = getComputedStyle(node);\n const itemHeight = ReactDom.findDOMNode(this.refs.item0).offsetHeight;\n const height = ACList.heightAddenums.reduce((heightParts, prop) => {\n return heightParts + parseInt(computedStyle[prop], 10);\n }, itemHeight * this.props.itemsCount);\n\n node.style.maxHeight = height + 'px';\n }", "getMaxHeightUnit(){return this.__maxHeightUnit}", "function setModalMaxHeight(element) {\n this.$element = $(element);\n this.$content = this.$element.find('.modal-content');\n var borderWidth = this.$content.outerHeight() - this.$content.innerHeight();\n var dialogMargin = $(window).width() < 768 ? 20 : 60;\n var contentHeight = $(window).height() - (dialogMargin + borderWidth);\n var headerHeight = this.$element.find('.modal-header').outerHeight() || 0;\n var footerHeight = this.$element.find('.modal-footer').outerHeight() || 0;\n var maxHeight = contentHeight - (headerHeight + footerHeight);\n\n this.$content.css({\n 'overflow': 'hidden'\n });\n\n this.$element\n .find('.modal-body').css({\n 'max-height': maxHeight,\n 'overflow-y': 'auto'\n });\n}", "function resize() {\n\t\t\t\tvar d = ed.getDoc(), DOM = tinymce.DOM, resizeHeight, myHeight;\n\n\t\t\t\t// Get height differently depending on the browser used\n\t\t\t\tif ( tinymce.isWebKit )\n\t\t\t\t\tmyHeight = d.body.offsetHeight;\n\t\t\t\telse\n\t\t\t\t\tmyHeight = d.body.scrollHeight;\n\n\t\t\t\t// Don't make it smaller than 300px\n\t\t\t\tresizeHeight = (myHeight > 300) ? myHeight : 300;\n\n\t\t\t\t// Resize content element\n\t\t\t\tif ( oldHeight != resizeHeight ) {\n\t\t\t\t\tDOM.setStyle(DOM.get(ed.id + '_ifr'), 'height', resizeHeight + 'px');\n\t\t\t\t\toldHeight = resizeHeight;\n\t\t\t\t\ted.getWin().scrollTo(0,0);\n\t\t\t\t}\n\t\t\t}", "function setBoxHeight() {\n var maxHeight = -1;\n\n $('.home_box').each(function() {\n maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();\n });\n $('.home_box').each(function() {\n $(this).height(maxHeight);\n });\n }", "function handleDynamicHeight(value){$element.toggleClass('md-dynamic-height',value);}", "set height(value) {\n if (value === this.heightIn) {\n return;\n }\n this.heightIn = value;\n this.notifyPropertyChanged('height');\n }", "autoIFrameHeight() {\n let iframe = $(parent.document).find('iframe.bsw-iframe-modal');\n if (iframe.length === 0) {\n return;\n }\n\n let minHeight = parseInt(iframe.data('min-height'));\n let maxHeight = parseInt(iframe.data('max-height'));\n let overOffset = iframe.data('over-offset');\n let debugHeight = iframe.data('debug-height');\n\n minHeight = minHeight ? minHeight : 0;\n maxHeight = maxHeight ? maxHeight : 0;\n if (!minHeight && !maxHeight) {\n return;\n }\n\n let content = $('.bsw-content');\n let height = content.height() + bsw.pam(content.parent(), content).column;\n height = Math.ceil(height);\n if (debugHeight) {\n bsw.info(`Real iframe height: ${height}`);\n }\n\n if (!maxHeight) {\n maxHeight = bsw.popupCosySize(false, parent.document).height;\n }\n if (minHeight > maxHeight) {\n minHeight = maxHeight;\n }\n\n let latest = height;\n if (height < minHeight) {\n latest = minHeight;\n } else if (height > maxHeight) {\n latest = maxHeight;\n }\n\n if (overOffset === 'no' && Math.abs(height - latest) > bsw.cnf.autoHeightOffset) {\n return;\n }\n\n iframe.animate({height: latest}, bsw.cnf.autoHeightDuration);\n }", "_adaptViewHeight() {\n let actualHeight = this._calcDisplayedItemsMaxHeight();\n this._viewLimiter.style.height = actualHeight + 'px';\n }", "function updateHeightOfAllPanel() {\n\n if(window.innerWidth > 480) {\n for(let i = 0; i < allPanel.length; i++)\n allPanel[i].style.maxHeight = allPanel[i].scrollHeight + 'px';\n }else {\n for(let i = 0; i < allPanel.length; i++) {\n if(!(allPanel[i].classList.contains(AccordianClasses.ACCORDIAN_ANSWER_OPEN)))\n allPanel[i].style.maxHeight = 0;\n else\n allPanel[i].style.maxHeight = allPanel[i].scrollHeight + 'px';\n }\n }\n }", "function freezeContentHeight() {\n content.css({\n width: '100%',\n height: content.height(),\n overflow: 'hidden'\n });\n }", "_setSlideHeight(height) {\n this.$slides.each(function() {\n $(this).css('max-height', height);\n });\n }", "function updateHeight() {\n $('#packageList').css('height', window.innerHeight - $('#packageList').offset().top + 'px');\n $('ul.nodes').css('height', ( window.innerHeight - $('ul.nodes').offset().top) + 'px');\n\n Stroll.bind( $( 'ul#packageList' ) );\n Stroll.bind( $('ul.nodes'), { live: true } );\n }", "function freezeContentHeight() {\n\t\tcontent.css({\n\t\t\twidth: '100%',\n\t\t\theight: content.height(),\n\t\t\toverflow: 'hidden'\n\t\t});\n\t}", "height(value = '') {\n if (this._overlayRef) {\n this._overlayRef.updateSize({ height: value });\n }\n else {\n this._height = value;\n }\n return this;\n }", "setHeightIfBigger(height) {\n if (height > this.height) this.height = height;\n }", "function maxHeightElement( element ) { // function which find max height in element\n var heightElement = 0;\n $(element).each(function() {\n if ( $(this).height() > heightElement ) {\n heightElement = $(this).height();\n }\n });\n return heightElement\n }", "function adjustHeight() {\n var img = slides[currentSlide].img;\n if(img.height() < wSettings.image_max_height) {\n img.parent().css('height', img.height());\n }\n }", "setHeight(height) {\n this.height = height;\n }", "function OnMaxPageHeightChanged(/*DependencyObject*/ d, /*DependencyPropertyChangedEventArgs*/ e)\r\n {\r\n d.CoerceValue(PageHeightProperty);\r\n }", "function postHeight() {\n setTimeout(function () {\n var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined);\n if (typeof target != \"undefined\") {\n //Added \"billboard\" to postMessage so the component will know the messages origin.\n target.postMessage(document.getElementById(\"wrapper\").scrollHeight + \" billboard\", \"*\");\n }\n }, 100);\n}", "setFullHeight() {\n this.fullHeight = `${window.innerHeight - this.$el.getBoundingClientRect().top}px`;\n }", "function _updateEditorSize() {\n // The editor itself will call refresh() when it gets the window resize event.\n if (_currentEditor) {\n $(_currentEditor.getScrollerElement()).height(_editorHolder.height());\n }\n }", "function updateWorldHeight() {\n const unit = document.querySelector(\"#options-height-unit\").value;\n const value = Math.max(0.000000001, document.querySelector(\"#options-height-value\").value);\n const oldHeight = config.height;\n\n setWorldHeight(oldHeight, math.unit(value, unit));\n}", "function setPopupMaxHeight() {\n var maxHeight = \"max-height\";\n var marginTop = \"margin-top\";\n var body = \"body\";\n $(modalPopupContent).css(maxHeight, ($(body).height() - ($(body).height() / 100 * 30)));\n $(modalPopupContainer).css(marginTop, (-($(modalPopupContainer).height() / 2)));\n}", "function resize () {\n\tvar height = $interactive.outerHeight(true);\n\n\tupdateHeight(height);\n}", "function autoResize() {\nthis.style.height = 'auto'; \nthis.style.height = this.scrollHeight + 'px'; \n}", "function recalcHeight() {\n\t\t\t\t\t\tvar headerHeight, helperHeight;\n\n\t\t\t\t\t\tif ( $element.parent().is( \".flex-row\" ) ) {\n\t\t\t\t\t\t\t// Se estamos dentro de um flex-row as coisas são diferentes\n\t\t\t\t\t\t\theaderHeight = components.header.height();\n\t\t\t\t\t\t\thelperHeight = components.helper.height();\n\n\t\t\t\t\t\t\tcomponents.bodyWrapper.css(\n\t\t\t\t\t\t\t\t\"height\",\n\t\t\t\t\t\t\t\t\"calc(100% - \" + Math.max( headerHeight + helperHeight, 0 ) + \"px)\"\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcomponents.body.css(\n\t\t\t\t\t\t\t\t\"height\",\n\t\t\t\t\t\t\t\t\"calc(100% - \" + Math.max( helperHeight, 0 ) + \"px)\"\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Faz o overflow herdar do max-height do tbody, se disponível\n\t\t\t\t\t\t\tmaxHeight = $.style( $tbody[ 0 ], \"max-height\" ) || null;\n\t\t\t\t\t\t\tcomponents.bodyWrapper.css( \"max-height\", maxHeight );\n\n\t\t\t\t\t\t\t// Remove o helper de dentro do body wrapper quando não estamos dentro de um flex-row\n\t\t\t\t\t\t\tcomponents.helper.appendTo( $element );\n\t\t\t\t\t\t}\n\t\t\t\t\t}", "_setHeight() {\n return new Promise((resolve) => {\n this.dom.overhead = 2;\n if (this.config.hasHeader)\n this.dom.overhead += 38;\n if (this.config.hasFilterRow)\n this.dom.overhead += 49;\n if (this.config.hasLabelRow)\n this.dom.overhead += 45;\n if (!this.config.height)\n this.config.height = PopTemplate.getContentHeight(false, 270);\n let tabColumnHeight = this.dom.repo.getComponentHeight('PopEntityTabColumnComponent', this.position);\n if (!tabColumnHeight)\n tabColumnHeight = this.dom.repo.getComponentHeight('PopTabMenuComponent', 1);\n if (tabColumnHeight && tabColumnHeight.inner) {\n this.dom.height.default = tabColumnHeight.inner - 20;\n }\n else {\n this.dom.height.default = PopTemplate.getContentHeight(false, this.dom.overhead);\n }\n if (this.config.parentClassName) {\n this.dom.overhead = this.dom.overhead + (Math.abs(this.el.nativeElement.offsetTop) + 100);\n this.dom.setHeightWithParent(this.config.parentClassName, this.dom.overhead, this.dom.height.default).then((res) => {\n this.log.info(`setHeight with ${this.config.parentClassName}`);\n return resolve(true);\n });\n }\n else {\n if (this.config.height) {\n // if( this.config.height < ( this.dom.overhead * 2 ) ) this.config.height = this.dom.overhead * 2;\n this.dom.setHeight(this.config.height, this.dom.overhead);\n this.log.info(`setHeight with config.height:${this.config.height} - overhead:${this.dom.overhead}`);\n }\n else if (this.config.bucketHeight) {\n this.config.height = this.config.bucketHeight + this.dom.overhead;\n this.dom.setHeight(+this.config.height, this.dom.overhead);\n this.log.info(`setHeight with config.bucketHeight:${this.config.bucketHeight} - overhead:${this.dom.overhead}`);\n }\n else if (this.config.bucketLimit) {\n this.config.bucketLimit = this.config.bucketLimit > this.config.options.values.length ? this.config.options.values.length : this.config.bucketLimit;\n this.config.bucketHeight = (this.config.bucketLimit * 30.5);\n this.config.height = this.config.bucketHeight + this.dom.overhead;\n this.dom.setHeight(+this.config.height, this.dom.overhead);\n this.log.info(`setHeight with config.bucketLimit:${this.config.bucketLimit} - overhead:${this.dom.overhead}`);\n }\n else {\n this.log.info(`setHeight with defaultHeight:${this.dom.height.default} - overhead:${this.dom.overhead}`);\n this.dom.setHeight(this.dom.height.default, this.dom.overhead);\n }\n return resolve(true);\n }\n });\n }", "function auto_grow(element) {\n element.style.height = (element.scrollHeight) + \"px\";\n}", "get maxHeight() {}", "get dynamicHeight() { return this._dynamicHeight; }", "function updateInnerWrapperHeight () {\n var maxHeight = autoHeight ? getMaxSlideHeight(index, items) : getMaxSlideHeight(cloneCount, slideCount),\n wp = middleWrapper ? middleWrapper : innerWrapper;\n\n if (wp.style.height !== maxHeight) { wp.style.height = maxHeight + 'px'; }\n }", "function getHeight(){\n let height = $('.accountOverview-content').height();\n $('.verticalMenu').css('height', height);\n}", "function setGridHeight(resultFrameHeight) {\n\ttry {\n\t\tif (haasGrid !=null) {\n\t\t\tvar id=haasGrid.entBox.id;\n\t\t\tvar griDiv = document.getElementById(id);\n\t\t\tgriDiv.style.height = resultFrameHeight-30 + \"px\";\n\t\t}\n\t}\n\tcatch(ex) {\n //alert(\"THis means the grid was not initialized\");\n\t}\n}", "function equalHeight(element) {\n\t\tvar max = 0;\n\t\telement.css('height', 'auto');\n\t\tjQuery(element).each(function() {\n\t\t\tmax = Math.max(jQuery(this).innerHeight(), max);\n\t\t}).css('min-height', max);\n\t}", "function calcPanMaxHeight(api, initHeight) {\n\t if(windowObj.width() <= 768) { $('.scroll-pane').height(initHeight); return; }\n\t var scrollMaxHeight = calcScrollMaxHeight();\t\t\t\n\t if (initHeight > scrollMaxHeight) {\n\t \t$('.scroll-pane').height(scrollMaxHeight);\t\n\t } \n\t else {\n\t $('.scroll-pane').height(initHeight);\t\n\t }\n\t api.reinitialise();\n}", "function setPopupMaxHeight() {\n $(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));\n $(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));\n}", "setHeight(_height) {\n this.bottom = this.top + _height;\n this.updateSecondaryValues();\n return this;\n }", "function checkHeightAndReturn() {\n const iframe = d3Select(this.root).selectAll('iframe');\n lastHeight = height;\n height = parseInt(iframe.node().style.height.replace(\"px\", \"\"));\n if(height > 0 && heightStableSince > 3) {\n this.props.onLoadSuccess(height, this.props.item);\n window.clearInterval(this.heightCheckInterval);\n }\n\n if(height === lastHeight) \n heightStableSince += 1;\n else\n heightStableSince = 0;\n }", "setElementHeights () {\n var imgHeight = el_flickrImg.height;\n var screenSize = document.documentElement.clientHeight;\n\n this.maxheightWikiContentElement((screenSize - imgHeight) + 'px');\n }", "onChangeTotalHeight() {\n if (this.client.isEngineReady) {\n // redraw all dependencies if the height changes. Could be caused by resource add/remove.\n // in reality not all deps needs to be redrawn, those fully above the row which changed height could be left\n // as is, but determining that would likely require more processing than redrawing\n this.scheduleDraw(true);\n }\n }", "_setSliderHeight() {\n // If fullscreen, do nothing\n if (!this.$el.hasClass('fullscreen')) {\n if (this.options.indicators) {\n // Add height if indicators are present\n this.$el.css('height', (this.options.height + 40) + 'px');\n }\n else {\n this.$el.css('height', this.options.height + 'px');\n }\n this.$slider.css('height', this.options.height + 'px');\n }\n }", "doPanelResize(forConfigHeight: boolean = false) {\n const paneContainer = getPaneContainer(this)\n let minimumHeight: number | null = null\n const paneContainerView = atom.views.getView(paneContainer)\n if (paneContainerView && this.alwaysTakeMinimumSpace) {\n // NOTE: Super horrible hack but the only possible way I could find :((\n const dockNamesElement = paneContainerView.querySelector('.list-inline.tab-bar.inset-panel')\n const dockNamesRects = dockNamesElement ? dockNamesElement.getClientRects()[0] : null\n const tableElement = this.element.querySelector('table')\n const panelRects = tableElement ? tableElement.getClientRects()[0] : null\n if (dockNamesRects && panelRects) {\n minimumHeight = dockNamesRects.height + panelRects.height + 1\n }\n }\n\n if (paneContainer) {\n let updateConfigHeight: number | null = null\n const heightSet =\n minimumHeight !== null && !forConfigHeight ? Math.min(minimumHeight, this.panelHeight) : this.panelHeight\n\n // Person resized the panel, save new resized value to config\n if (this.lastSetPaneHeight !== null && paneContainer.state.size !== this.lastSetPaneHeight && !forConfigHeight) {\n updateConfigHeight = paneContainer.state.size\n }\n\n this.lastSetPaneHeight = heightSet\n paneContainer.state.size = heightSet\n paneContainer.render(paneContainer.state)\n\n if (updateConfigHeight !== null) {\n atom.config.set('linter-ui-default.panelHeight', updateConfigHeight)\n }\n }\n }", "function expandResize() {\n const allPanels = document.querySelectorAll('[x-ref=\"panel\"]');\n allPanels.forEach((panel) => {\n const panelStatus = panel.parentElement.getAttribute('x-data');\n if (panelStatus === '{ selected: true }') {\n panel.style.setProperty('max-height', `${panel.scrollHeight}px`);\n }\n });\n}", "function resizeDiv() {\n\n var panel = document.getElementById(\"imgUploaderPanel\");\n panel.style.maxHeight = panel.scrollHeight + \"px\"; // recalculate height\n}", "function adjustVizHeight(){\n viz.style(\"height\", function(){\n w = parseInt(viz.style(\"width\"), 10);\n h = w*heightRatio;\n return h;\n })\n}", "function setMainSliderHeight(){\n if (!isMobile) {\n var width = $('.b-main-slider-cont').width();\n $('.b-main-slider-cont').css('max-height', width/2);\n }\n }", "setHeightMode(valueNew){let t=e.ValueConverter.toSizeMode(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"HeightMode\")),t!==this.__heightMode&&(this.__heightMode=t,e.EventProvider.raise(this.__id+\".onPropertyChanged\",{propertyName:\"HeightMode\"}),this.__processHeightMode())}", "setLayout() {\n const {\n container,\n state,\n } = this\n const {\n heights,\n } = state\n var element = document.querySelector('.masonry-panel'),\n elements = document.querySelectorAll('.masonry-panel'),\n style = window.getComputedStyle(element),\n width = style.getPropertyValue('width');\n width = width.replace('px', '');\n width = width/window.innerWidth;\n var cols = Math.ceil(1/width) - 1;\n var number = (Math.ceil(elements.length/cols) + 1);\n this.state.maxHeight = (Math.max(...heights));\n var targetHeight = this.state.maxHeight + (17 * number);\n container.style.height = `${targetHeight}px`\n }", "set pageHeight(value) {\n this.pageHeightIn = value;\n this.notifyPropertyChanged('pageHeight');\n }", "function getElemHeight(elem) {\n return Math.max(elem.scrollHeight, elem.offsetHeight, elem.clientHeight);\n }", "height(height) {\n return this.attr('height', height);\n }", "function resizeApplication(id, value) {\n\tvar el = DocumentManager.get(id);\n\tel.style.height = value;\n\treturn true;\n}", "resizeUntilFits() {\n if (!this.iframe || this.resizeCompleted) {\n return;\n }\n const maxResizes = this.products.length;\n let resizes = 0;\n\n this.height = this.outerHeight;\n this.resize();\n const productSetResize = setInterval(() => {\n const currentHeight = this.outerHeight;\n if (parseInt(currentHeight, 10) > parseInt(this.height, 10)) {\n resizes++;\n this.height = currentHeight;\n this.resize(currentHeight);\n }\n if (resizes > maxResizes) {\n this.resizeCompleted = true;\n clearInterval(productSetResize);\n }\n }, pollInterval);\n }", "function calcHeight()\n{\n\t //Cojo la altura en nuestra página\n\t var the_height=\n\t document.getElementById\n\t('iframe').contentWindow.\n\t document.body.scrollHeight;\n\t//Cambio la altura del iframe\n\t document.getElementById('iframe')\n\t.height= the_height;\n}", "get autoHeight() {\n return this._autoHeight;\n }", "get autoHeight() {\n return this._autoHeight;\n }", "function storeContentHeight(itemContent){\n itemContent.css('display','block').css('height','auto');\n itemHeight = itemContent.outerHeight();\n itemContent.attr(\"data-itemheight\", itemHeight );\n itemContent.css('height','0').css('overflow','hidden');\n }", "function resizeTextarea (id) {\r\n var a = document.getElementById(id);\r\n a.style.height = 'auto';\r\n a.style.height = (a.scrollHeight+5)+'px';\r\n}", "function resizeElements() {\n\t// Compute the max height so that the settings fit on the screen\n\t$('#song-list').height($(window).height() - $('#settings-container-inner').height() - 200);\n}", "function autoResize(target) {\n target.style.height = (target.scrollHeight + 15) + 'px';\n }", "set height(height) {\n this.instance.setHeight(height);\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }", "function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }" ]
[ "0.7306204", "0.71844196", "0.7093979", "0.69578004", "0.68034196", "0.67750686", "0.6749046", "0.668914", "0.6688762", "0.6638899", "0.66354924", "0.66154706", "0.6495037", "0.64909416", "0.647521", "0.6473164", "0.6432447", "0.64289296", "0.64289296", "0.64289296", "0.6405658", "0.63924927", "0.6343696", "0.63366157", "0.6335615", "0.62839127", "0.6263361", "0.62551886", "0.6246901", "0.62338907", "0.6207661", "0.61801064", "0.61711824", "0.6166767", "0.61589146", "0.61476934", "0.6142082", "0.6137327", "0.61264086", "0.61262673", "0.61243075", "0.61126447", "0.6090199", "0.6077753", "0.60601807", "0.6048005", "0.6043754", "0.6043493", "0.6031805", "0.60187674", "0.6007762", "0.6007407", "0.60029733", "0.59762275", "0.59714663", "0.5970637", "0.59672105", "0.59642136", "0.5958698", "0.595743", "0.59282935", "0.59207225", "0.5912016", "0.59028757", "0.59000486", "0.5896509", "0.58870524", "0.5872244", "0.5868702", "0.58616006", "0.5856506", "0.58361715", "0.5827345", "0.58240694", "0.5821397", "0.58197176", "0.5818547", "0.5807571", "0.5806135", "0.58046407", "0.5804157", "0.57994086", "0.579466", "0.5793735", "0.5780116", "0.57693255", "0.5765133", "0.5765133", "0.57640624", "0.57591707", "0.57580966", "0.57544136", "0.5745136", "0.5744768", "0.5744768", "0.5744768", "0.5744768", "0.5744768", "0.5744768", "0.5744768" ]
0.79652953
0
Pick the first defined of two or three arguments. dfl comes from default.
function dfl(a, b, c) { switch (arguments.length) { case 2: return a != null ? a : b; case 3: return a != null ? a : b != null ? b : c; default: throw new Error('Implement me'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dfl(a, b, c) {\n\t\tswitch (arguments.length) {\n\t\t\tcase 2:\n\t\t\t\treturn a != null ? a : b;\n\t\t\tcase 3:\n\t\t\t\treturn a != null ? a : b != null ? b : c;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Implement me');\n\t\t}\n\t}", "function dfl(a, b, c) {\n\t switch (arguments.length) {\n\t case 2:\n\t return a != null ? a : b;\n\t case 3:\n\t return a != null ? a : b != null ? b : c;\n\t default:\n\t throw new Error('Implement me');\n\t }\n\t }", "function dfl(a, b, c) {\n\t switch (arguments.length) {\n\t case 2: return a != null ? a : b;\n\t case 3: return a != null ? a : b != null ? b : c;\n\t default: throw new Error('Implement me');\n\t }\n\t }", "function dfl(a, b, c) {\n switch (arguments.length) {\n case 2: return a != null ? a : b;\n case 3: return a != null ? a : b != null ? b : c;\n default: throw new Error('Implement me');\n }\n }", "function dfl(a, b, c) {\n switch (arguments.length) {\n case 2: return a != null ? a : b;\n case 3: return a != null ? a : b != null ? b : c;\n default: throw new Error(\"Implement me\");\n }\n }", "function dfl(a, b, c) {\n switch (arguments.length) {\n case 2: return a != null ? a : b;\n case 3: return a != null ? a : b != null ? b : c;\n default: throw new Error(\"Implement me\");\n }\n }", "function dfl(a, b, c) {\n switch (arguments.length) {\n case 2: return a != null ? a : b;\n case 3: return a != null ? a : b != null ? b : c;\n default: throw new Error(\"Implement me\");\n }\n }", "function getFirstDefined() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n for (var _i3 = 0, _args = args; _i3 < _args.length; _i3++) {\n var arg = _args[_i3];\n\n if (arg !== undefined) {\n return arg;\n }\n }\n\n return undefined;\n } // variable used to generate id", "function firstArg() {\n\treturn arguments != \"\" ? [...arguments].shift() : undefined;\n}", "function pick() {\n\tvar args = arguments,\n\t\ti,\n\t\targ,\n\t\tlength = args.length;\n\tfor (i = 0; i < length; i++) {\n\t\targ = args[i];\n\t\tif (typeof arg !== 'undefined' && arg !== null) {\n\t\t\treturn arg;\n\t\t}\n\t}\n}", "function getFirstDefined(...args) {\n\t for (const arg of args) {\n\t if (arg !== undefined) {\n\t return arg;\n\t }\n\t }\n\t return undefined;\n\t}", "function pick() {\n\t\tvar args = arguments,\n\t\t\ti,\n\t\t\targ,\n\t\t\tlength = args.length;\n\t\tfor (i = 0; i < length; i++) {\n\t\t\targ = args[i];\n\t\t\tif (arg !== UNDEFINED && arg !== null) {\n\t\t\t\treturn arg;\n\t\t\t}\n\t\t}\n\t}", "function pick() {\n var args = arguments,\n i,\n arg,\n length = args.length;\n for (i = 0; i < length; i++) {\n arg = args[i];\n if (arg !== UNDEFINED && arg !== null) {\n return arg;\n }\n }\n }", "function myOtherFunction (first_argument = second_argument, second_argument) {}", "function firstDefined() {\n var i = -1;\n while (++i < arguments.length) {\n if (arguments[i] !== undefined) {\n return arguments[i];\n }\n }\n return undefined;\n }", "function f(a, b, c, d, e, f) {\n let sixthArg = arguments[5];\n let thirdArg = arguments[2];\n\n return sixthArg;\n}", "function argumentOrDefault(key){var args=customizations; return args[key]===undefined ? _defaultParams2.default[key] : args[key];}", "function v1() {\r\n for (var args = arguments, i = 0, l = args.length; i < l && args[i] == undefined; i++);\r\n return has(args, i) ? args[i] : args[l - 1];\r\n }", "function twoArgsWithDefault (x, y = 'default') {\n console.log(`x: ${x}, y: ${y}`)\n}", "function $pick() {\r\n\t\tfor (var i=0,l=arguments.length; i<l; i++) {\r\n\t\t\tif ($chk(arguments[i])) return arguments[i];\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName];}else if(arguments.length===3){return aDefaultValue;}else{throw new Error('\"'+aName+'\" is a required argument.');}}", "function mrcPick(arg, def) {\n return (typeof arg !== \"undefined\" ? arg : def);\n}", "function oneArgWithDefaut (x = 'default') {\n console.log(`x: ${x}`)\n}", "function or() {\r\n\t\t\tvar remain = _.without(arguments, undefined); \r\n\t\t\tif (remain.length === 0)\r\n\t\t\t\treturn undefined;\r\n\t\t\treturn remain[0];\r\n\t\t}", "function f (x, y=2, z = 3) {\n console.log(x,y,z); //1 2 3\n return x + y + z;\n}", "function opt(x, z) { return x !== undefined ? x : z }", "function f(x) {\n let firstArg = arguments[0];\n\n return firstArg;\n}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t }", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t }", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t }", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function def(arg, val) { return (typeof arg !== 'undefined') ? arg : val; }", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function getArg(aArgs, aName, aDefaultValue) {\n\t\t if (aName in aArgs) {\n\t\t return aArgs[aName];\n\t\t } else if (arguments.length === 3) {\n\t\t return aDefaultValue;\n\t\t } else {\n\t\t throw new Error('\"' + aName + '\" is a required argument.');\n\t\t }\n\t\t}", "function argumentOrDefault(key) {\n\t var args = customizations;\n\t return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n\t }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}", "function DEF( x, y ){\n return x !== undefined ? x : y;\n }", "function DEF( x, y ){\n return x !== undefined ? x : y;\n }", "function argumentOrDefault(key) {\n var args = customizations;\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n }", "function argumentOrDefault(key) {\n var args = customizations;\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n }", "function argumentOrDefault(key) {\n var args = customizations;\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n }", "function argumentOrDefault(key) {\n var args = customizations;\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n }", "function argumentOrDefault(key) {\r\n var args = customizations;\r\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\r\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName]\n } else if (arguments.length === 3) {\n return aDefaultValue\n } else {\n throw new Error('\"' + aName + '\" is a required argument.')\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }", "function getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n }" ]
[ "0.70769256", "0.7032066", "0.69990873", "0.6994567", "0.6947289", "0.6947289", "0.6947289", "0.6729991", "0.6694637", "0.6657053", "0.6616081", "0.65729797", "0.6436335", "0.6371848", "0.6368675", "0.6322258", "0.62222874", "0.6210064", "0.6180764", "0.61663306", "0.6148511", "0.6135913", "0.61319816", "0.6111283", "0.60320544", "0.6009244", "0.5979143", "0.5953601", "0.5953601", "0.5953601", "0.5953601", "0.59188527", "0.5906308", "0.59017336", "0.59017336", "0.59017336", "0.58823335", "0.5847249", "0.5844007", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5831579", "0.5830199", "0.5830199", "0.5823086", "0.5823086", "0.5823086", "0.5823086", "0.58217704", "0.5817322", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794", "0.5803794" ]
0.69394195
23
left zero fill a number see for performance comparison
function leftZeroFill(number, targetLength, forceSign) { var output = '' + Math.abs(number), sign = number >= 0; while (output.length < targetLength) { output = '0' + output; } return (sign ? (forceSign ? '+' : '') : '-') + output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zeroFill(number) {\n\treturn (number < 10 ? ('0' + number) : number.toString());\n}", "function leftZeroFill(number, targetLength, forceSign) {\n var output = '' + Math.abs(number),\n sign = number >= 0;\n \n while (output.length < targetLength) {\n output = '0' + output;\n }\n return (sign ? (forceSign ? '+' : '') : '-') + output;\n }", "function fillZeros(num) {\n if (num < 10) {\n num = \"0\" + num.toString();\n } else {\n num.toString();\n }\n return num;\n}", "function ZeroFill (number){\r\n var f_tamano= number.length;\r\n var Zsalida='';\r\n var diference=0;\r\n if (number=='0'){\r\n Zsalida='00000000';\r\n return Zsalida;\r\n } else if (f_tamano<8){\r\n diference=8-f_tamano;\r\n for( var i =0; i< diference; i++){\r\n Zsalida=Zsalida+'0';\r\n \r\n }\r\n }\r\n return Zsalida+number;\r\n }", "function leftZeroFill(number, targetLength, forceSign) {\n\t var output = '' + Math.abs(number),\n\t sign = number >= 0;\n\n\t while (output.length < targetLength) {\n\t output = '0' + output;\n\t }\n\t return (sign ? (forceSign ? '+' : '') : '-') + output;\n\t }", "function leftZeroFill(number, targetLength, forceSign) {\n\t var output = '' + Math.abs(number),\n\t sign = number >= 0;\n\n\t while (output.length < targetLength) {\n\t output = '0' + output;\n\t }\n\t return (sign ? forceSign ? '+' : '' : '-') + output;\n\t }", "function zeroFill (i) {\n return (i < 10 ? '0' : '') + i\n }", "function zeroFill(i) {\n return (i < 10 ? '0' : '') + i\n }", "function leftZeroFill(number, targetLength, forceSign) {\n\t\tvar output = '' + Math.abs(number), sign = number >= 0;\n\n\t\twhile (output.length < targetLength) {\n\t\t\toutput = '0' + output;\n\t\t}\n\t\treturn (sign ? (forceSign ? '+' : '') : '-') + output;\n\t}", "function zfill(number, size) {\n number = number.toString();\n while (number.length < size) {\n number = '0' + number;\n }\n return number;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function zeroFill(i) {\n\treturn (i < 10 ? '0' : '') + i;\n}", "function leftZeroFill(number, targetLength, forceSign) {\n var output = Math.abs(number) + '',\n sign = number >= 0;\n\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return (sign ? (forceSign ? '+' : '') : '-') + output;\n }", "function fillZero(number, size) {\r\n var str = '000000000' + number;\r\n return str.slice(str.length - size);\r\n}", "function zeroPadded(val) {\n if (val >= 10)\n return val;\n else\n return '0' + val;\n }", "static completeLeftWithZeros(value, n) {\n value = this.completeWithChar(value, '0', n);\n return value;\n }", "function zeroFill( number, width ) {\n width -= number.toString().length;\n if ( width > 0 )\n {\n return new Array( width + (/\\./.test( number ) ? 2 : 1) ).join( '0' ) + number;\n }\n return number + \"\"; // always return a string\n}", "function zeroFill(number, width) {\n width -= number.toString().length;\n if (width > 0) {\n return new Array(width + (/\\./.test(number) ? 2 : 1)).join('0') + number;\n }\n return number + \"\"; // always return a string\n}", "function zeroIt(a) { return( a < 10 ? \"0\"+a : a ); }", "function addzero(i){\n if(i<10){\n i=\"0\"+i;\n}\nreturn i;\n}", "function zerofill(n) {\n n = n.toString();\n return \"0\".repeat(2 - n.length) + n;\n}", "function padzero(n) {\n return n < 10 ? '0' + n : n;\n }", "function zeroFill(num, mag) {\n var result = '' + num;\n mag -= result.length;\n while(mag > 0) {\n result = '0' + result;\n mag--;\n }\n return result;\n}", "function zero(n){\n if(n<10){return \"0\"+n;}\n return n;\n}", "function zeroFill(i){\n\n //check if the i is more or equal to than 10, if so just return the same int.\n if(i>=10){\n return i;\n }\n\n //if less than 10, then zero fill.\n if(i<10){\n\n //add a 0 to the string and return it.\n return 0 + i.toString();\n }\n}", "function leadingZeroes(time){\n if(time<=9){\n time=\"0\"+time;\n }\n return time;\n}", "function zerolead(value) {\n\treturn (value < 10) ? '0' + value : value;\n}", "function zerolead(value) {\n\treturn (value < 10) ? '0' + value : value;\n}", "function appendLeadingZeroes(n){\n if(n <= 9){\n return \"0\" + n;\n }\n return n\n}", "leadingZero(num) {\n return num < 10 ? `0${num}` : num;\n }", "function _prefixZero(num, n) {\n num = num || 0;\n n = n || 2;\n return (Array(n).join(0) + num).slice(-n);\n}", "function leftZeroPad(value, zeroes) {\n let sZeroes = '';\n for (let x = 0; x < zeroes; x++) {\n sZeroes += '0';\n }\n return (sZeroes + value).slice(-(sZeroes.length));\n}", "function pad0(num, len){\r\n\t\t\t\treturn ('0000'+num).split('').reverse().splice(0,len).reverse().join('');\r\n\t\t\t}", "function zeroLeft(num) {\n return num <= 10 ? `0${num}` : num\n }", "function add_zero(i) {\n\t\treturn (i < 10) ? (i = \"0\" + i) : i;\n\t}", "function addZero (val){\n\treturn (val <= 9) ? (\"0\" + val) : val;\n}", "function addZero (val){\n\treturn (val <= 9) ? (\"0\" + val) : val;\n}", "function numToStringWithPadZero() {\n\tvar num = arguments[0];\n\tvar digit = arguments[1];\n\tvar val1 = \"\" + num\n\tvar val2 = (\"0000000000\" + num).slice(-digit);\n\tval2 = (val2.length < val1.length) ? val1 : val2;\n\treturn val2;\n}", "function prefixUnitZero(val) {\n let newVal = val;\n if(val < 0) {\n newVal = val / -1;\n }\n newVal = newVal < 10 ? `0${newVal}` : newVal;\n if(val < 0) {\n newVal = `-${newVal}`;\n }\n return newVal;\n}", "function leadingZero(nr)\n{\n\tif (nr < 10) nr = \"0\" + nr;\n\treturn nr;\n}", "leadingZero(number) {\n return number < 10 ? '0' + number : number;\n }", "function addLeadingZero(num) {\n\treturn (num <= 9) ? (\"0\" + num) : num;\n}", "function pad(n) { return (\"0\" + n).slice(-2); }", "function addLeadingZero(n) {\r\n\t\t\tn = parseInt(n, 10);\r\n\t\t return (n < 10) ? (\"0\" + n) : n;\r\n\t\t}", "function padWithZero(number) {\n\tif (eval(number) < 10) {\n\t\treturn '0' + number;\n\t}\n\treturn number;\n}", "function padWithZero(num) {\n return num < 10 ? '0' + num : '' + num;\n}", "function padWithZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n}", "function zeroPad(nr,base){\n\t var len = (String(base).length - String(nr).length)+1;\n\t return len > 0? new Array(len).join('0')+nr : nr;\n\t}", "function addZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n }", "function addZero(value) {\n if (value < 10) {\n return value = '0' + value;\n } else {\n return value;\n }\n }", "function zeroPad(val, base)\n{\n\tif (val < base)\n\t\treturn '0' + val;\n\telse\n\t\treturn val;\n}", "function addZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n }", "function addZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n }", "function addLeadingZero(i) {\n if (i<10) {\n i = \"0\" + i;\n }\n return i;\n}", "function zeroPadder(number,zerosToFill){\n var numberAsString = number+'';\n while (numberAsString.length<zerosToFill){\n numberAsString = '0'+numberAsString;\n }\n return numberAsString;\n}", "function padLeft(val, num, str) {\n return '00000'.replace(/0/g, str).slice(0, num - val.length) + val;\n}", "function zeroAEsquerda(num) {\n return num >= 10 ? num : `0${num}`;\n}", "function toAddZero(n) {\n return ('0' + n).slice(-2);\n}", "function pad0(i,w) { return (\"000\" + String(i)).slice(-w); }" ]
[ "0.74372625", "0.7363078", "0.7321577", "0.7318851", "0.72658306", "0.725381", "0.72353715", "0.7233668", "0.7227976", "0.7224416", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7146016", "0.7142262", "0.7121028", "0.70872843", "0.7032733", "0.70281386", "0.6991003", "0.6986924", "0.69076407", "0.6865691", "0.68593526", "0.68533605", "0.6848689", "0.6832352", "0.6756887", "0.67505455", "0.67505455", "0.6748904", "0.6734637", "0.6718836", "0.6714788", "0.67022294", "0.66641045", "0.66557604", "0.6644812", "0.6644812", "0.6638388", "0.66370976", "0.6620569", "0.6619356", "0.6603348", "0.6601321", "0.6584112", "0.65781975", "0.6577261", "0.65756065", "0.656515", "0.6562037", "0.65613055", "0.65534717", "0.65458804", "0.6539929", "0.6526854", "0.6518173", "0.6512837", "0.6508144", "0.6507367", "0.649355" ]
0.7176291
52
TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = moment.duration(val, period); addOrSubtractDurationFromMoment(this, dur, direction); return this; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setName(name) { }", "constructor(name) {\n super(name);\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this._name = name;\n }", "constructor(name) {\n this._name = name;\n }", "constructor(name) {\n this._name = name;\n }", "constructor(name){\n this._name = name;\n }", "setName( name ) {\n this.name = name;\n }", "getName(newName) {\n this.name = newName;\n }", "setName(name) {\n\t\tthis.name = name;\n\t}", "constructor(name){\n this.name = name\n }", "constructor(name){\n this.name = name;\n }", "setName(name) {\n this.name = name;\n }", "setName(name) {\n this._name = name;\n }", "set type(name) {\n console.warn(\"prototype.type = 'ModelName' is deprecated, use static __name__ instead\");\n this.constructor.__name__ = name;\n }", "set name(x) { this._name = x; }", "get name() {return this._name;}", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "get name() { return this._name; }", "setName(name){\n this.name = name;\n }", "set name(value) { this._name = value || \"unknown\"; }", "constructor({ name }) { // { name } is bringing in a object and deconstructing/ unpacking the object into the class \n this.name = name // name is the object you bring in, and this.name is this specific instance of the class is the name of it \n }", "getName() {}", "function getName() { return name; }", "get name() {\n return this.use().name;\n }", "function name(name) {\n return name;\n }", "setName(value){\n\t\tthis.name = value;\n\t}", "constructor(name='test') {\n this.name = name;\n }", "constructor() {\n super();\n this.name = 'none';\n }", "set setName(name){\n _name=name;\n }", "set name(newName) {\n this.setName(newName);\n }", "get name(): string { throw new Error(\"Member class not implemented\"); }", "set name(value) {\n\t\tthis._name = value;\n\t}", "name(name) {\n\t\tthis._name = name;\n\t\treturn this;\n\t}", "get name() {\r\n\t\treturn this._name;\r\n\t}", "name() { }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "getName() {\r\n return this.name;\r\n }", "name(str) {\n this._name = str;\n return this;\n }", "constructor(name) { // méthode constructor avec pour paramètre name\n super(name); // utiliser super pour appeler name\n this.name = \"Kuma\"; // le name devient Kuma\n }", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name() {\n\t\treturn this.__name;\n\t}", "get name () {\n console.warn(\n 'Deprecation warning: \"channel.name\" is deprecated, use channel.channelName instead'\n )\n return this.channelName\n }", "get name() {\n \treturn 'Stephanie';\n }", "get name() {\r\n return this._name;\r\n }", "get name() {\n\t return this._name;\n\t }", "function getName() {\n\treturn name;\n}", "setName(namePicked) {\n this.name = namePicked; //refer to the object itself using 'this'\n }", "set name(newName) {\n if (newName) {\n this._name = newName;\n }\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "set name(newName) {\n this.setName(newName);\n }", "get name() {\n\t\treturn this._name;\n\t}", "get name() {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "get name () {\n\t\treturn this._name;\n\t}", "_$name() {\n super._$name();\n this._value.name = this._node.key.name;\n }", "function getName(name) {\n return name\n}", "constructor(transport, name) {\n super(transport);\n this.name = name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "get name() {\n return this._name;\n }", "function ensureNameField(desc) {\n desc.name = '';\n }", "get getName() {\n return this._name;\n }", "get name () {\n return this._name;\n }", "['@_name']() {\n super['@_name']();\n if (this._value.name) return;\n\n this._value.name = this._node.declarations[0].id.name;\n }", "function name() {}", "set name(newName) {\n\t this.setName(newName);\n\t }", "constructor () {\n this._name = 'u1';\n }", "get name() {}", "get name() {}", "get name() {}", "get name() {}" ]
[ "0.67782986", "0.6759405", "0.67381084", "0.67381084", "0.67381084", "0.67381084", "0.6733258", "0.6733258", "0.67120683", "0.66484624", "0.6612438", "0.6540716", "0.65202653", "0.65195", "0.6489472", "0.6465985", "0.6462259", "0.6415414", "0.6381141", "0.6297654", "0.6276111", "0.6276111", "0.6276111", "0.6276111", "0.6276111", "0.6276111", "0.6276111", "0.6276111", "0.6185439", "0.6112878", "0.60964316", "0.60552776", "0.6050006", "0.60477877", "0.60141873", "0.5992784", "0.5989703", "0.5979093", "0.5960276", "0.59392995", "0.5917421", "0.5909178", "0.5909035", "0.59078485", "0.59005576", "0.5888179", "0.5888179", "0.5888179", "0.5888179", "0.58705187", "0.58636767", "0.5862385", "0.5862183", "0.5862183", "0.5862183", "0.5862183", "0.5862183", "0.5862183", "0.5862183", "0.58525527", "0.58471906", "0.5845746", "0.58370185", "0.58324045", "0.5831436", "0.5828061", "0.5827184", "0.5827184", "0.58205706", "0.5813581", "0.5813581", "0.5809684", "0.5809684", "0.5809684", "0.5809684", "0.5809684", "0.5809684", "0.5802686", "0.58016807", "0.57931566", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.57724303", "0.5757861", "0.575781", "0.5756826", "0.5755341", "0.57532394", "0.5749995", "0.57188797", "0.5716756", "0.5716756", "0.5716756", "0.5716756" ]
0.0
-1
check if is an array
function isArray(input) { return Object.prototype.toString.call(input) === '[object Array]'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_array(input) {\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return true;\n }\n return false;\n}", "function isArray(input) {\n return Object.prototype.toString.call(input) === '[object Array]';\n }", "function isArray(arr) {\n\t\treturn Object.prototype.toString.call(arr) === \"[object Array]\";\n\t}", "function is_array(x)\r\n{\r\n return Array.isArray(x) ;\r\n}", "function isArray(input) {\n\t return Object.prototype.toString.call(input) === '[object Array]';\n\t }", "function isArray(input) {\n\t return Object.prototype.toString.call(input) === '[object Array]';\n\t }", "function BOT_isArray(x) {\r\n\tif( typeof(x) == \"object\") return (x.constructor.toString().indexOf(\"Array\") != -1);\r\n\telse return false;\r\n}", "function isArray(input){\n return typeof(input)=='object'&&(input instanceof Array);\n}", "function isArray(val){return(val instanceof Array);}", "function isArray(a)\n{\n\t//http://studiokoi.com/blog/article/typechecking_arrays_in_javascript\n\treturn Object.prototype.toString.apply(a) === '[object Array]';\n}", "function isArrayish (arr) {\n return /Array\\]$/.test(Object.prototype.toString.call(arr))\n}", "function isArray(arr) {\n\t\t\treturn arr instanceof Array;\n\t\t}", "function isArray(arr) {\n\t\t\treturn arr instanceof Array;\n\t\t}", "is_array(val) {\n return Array.isArray(val);\n }", "function isArray(arr) {\n return arr instanceof Array || _.isArray(arr);\n }", "function isArray(a) {\n return Object.prototype.toString.call(a) === \"[object Array]\";\n }", "function checkIfArray(arr) {\n return Array.isArray(arr);\n}", "function isArrayish(arr) {\n return (/Array\\]$/.test(Object.prototype.toString.call(arr))\n );\n}", "function isArray(input) {\n\t\treturn Object.prototype.toString.call(input) === '[object Array]';\n\t}", "function isArray(ar){return Array.isArray(ar);}", "function isArray(ar){return Array.isArray(ar);}", "function isArray(ar){return Array.isArray(ar);}", "function isArray(ar){return Array.isArray(ar);}", "function isArray(ar){return Array.isArray(ar);}", "function isArray(ar){return Array.isArray(ar);}", "function array (data) {\n return Array.isArray(data);\n }", "function isArray(arry) {\n if ( typeof arry !== 'object' ) return false;\n\n return Object.prototype.toString.call(arry) === '[object Array]';\n}", "function is_array(ip) {\n return Array.isArray(ip);\n}", "function isArray(a) {\r\n\treturn (a && a.constructor == Array);\r\n }", "function isArray(array)\n{\n\treturn !!(array && array.constructor == Array);\n}", "function isArray(a) {\n return (a && a.constructor == Array);\n}", "function isArray(array)\n{\n return isObject(array) && array.constructor == Array;\n}", "function isArray(a) {\n\treturn (a && a.constructor == Array);\n}", "function isArray(a) {\n\treturn (a && a.constructor == Array);\n}", "function isArray(arr) {\n return Array.isArray(arr);\n }", "function isArray(arr) {\n return Array.isArray(arr);\n }", "function isAnArray(input) {\n\t// create a result variable\n\tlet result;\n\t// assign it to a call to the applicable method\n\tresult = Array.isArray(input);\n\t// return the result variable\n\treturn result;\n}", "function array (data) {\n return isArray(data);\n }", "function isDataArray(x) {\n return Array.isArray(x);\n}", "function isDataArray(x) {\n return Array.isArray(x);\n}", "function isDataArray(x) {\n return Array.isArray(x);\n}", "function isArray (arr) {\n if (typeof arr === \"undefined\")\n {\n return false;\n } else if (arr === null) {\n return false;\n } else {\n return arr.constructor === Array;\n }\n}", "function isArray(ar) {\n return Array.isArray(ar) ||\n (typeof ar === 'object' && objectToString(ar) === '[object Array]');\n }", "function validArray(A) {\n if (A) {\n return A.constructor === Array;\n }\n return false;\n}", "isArray(value) {\n return value && typeof value === 'object' && value.constructor === Array;\n }", "function arr_isArray(array){\n\t\treturn array != null\n\t\t\t&& typeof array.length === 'number'\n\t\t\t&& typeof array.splice === 'function';\n\t}", "function isArray(input) {\n return true;\n}", "function _isArray(obj) {\n\t\treturn Object.prototype.toString.call(obj) === \"[object Array]\";\n\t}", "function isArray(a) {\n if(Array.isArray) return Array.isArray(a);\n return Object.prototype.toString.call(a) === \"[object Array]\";\n }", "function isArray(arr) {\n return Array.isArray(arr);\n }", "function isArray(arr) {\n return Array.isArray(arr);\n }", "function isArray(item) {\n return item instanceof Array;\n }", "function $FX3H$var$isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n\n return $FX3H$var$objectToString(arg) === '[object Array]';\n}", "function isArray(xs) {\n\t return toString.call(xs) === '[object Array]';\n\t}", "function isArray(xs) {\n\t return toString.call(xs) === '[object Array]';\n\t}", "function isArray(arr) {\n if (typeof arr === \"undefined\") {\n return false;\n } else if (arr === null) {\n return false;\n } else {\n return arr.constructor === Array;\n }\n}", "function isArray(ar) {\n return Array.isArray(ar) ||\n (typeof ar === 'object' && objectToString(ar) === '[object Array]');\n}" ]
[ "0.82666445", "0.7871224", "0.7838033", "0.783727", "0.78280234", "0.78280234", "0.7826276", "0.7820225", "0.7797053", "0.7787967", "0.7781514", "0.77701086", "0.77701086", "0.7746139", "0.7726031", "0.77094805", "0.7692416", "0.76890206", "0.76872563", "0.7686692", "0.7686692", "0.7686692", "0.7686692", "0.7686692", "0.7686692", "0.7684029", "0.767678", "0.7617821", "0.7608152", "0.76073086", "0.7600145", "0.7593023", "0.75538766", "0.75538766", "0.75518143", "0.75518143", "0.7550744", "0.75367606", "0.75151885", "0.75151885", "0.75151885", "0.7506686", "0.7497543", "0.7470538", "0.74681044", "0.745739", "0.7454956", "0.7452273", "0.74518055", "0.744288", "0.744288", "0.74374473", "0.7419777", "0.7409128", "0.7409128", "0.739685", "0.7389535" ]
0.7681993
64
compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function countDifferences(a, b) {\n let diffs = 0;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) {\n ++diffs;\n }\n }\n return diffs;\n}", "function howmany_diff(ary1, ary2){\n for (var i = 0; i < ary1.length; i++){\n var a = ary1[i]\n var b = ary2[i]\n if (a != b){\n diff++\n }\n }\n }", "function howmany_diff(ary1, ary2) {\n for (var i = 0; i < ary1.length; i++) {\n var a = ary1[i]\n var b = ary2[i]\n if (a != b) {\n diff++\n }\n }\n }", "function arrayDiff(a1, a2) {\n\tvar totalDiff = 0;\n\ta2.forEach((elem, index) => {\n\t\ttotalDiff += Math.abs(elem - a1[index]);\n\t});\n\treturn totalDiff;\n}", "function compatibility(arr1, arr2) {\n var totalDiff = 0;\n for (let i in arr1) {\n totalDiff = totalDiff + difference(arr1[i], arr2[i])\n }\n return totalDiff\n}", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length);\n var lengthDiff = Math.abs(array1.length - array2.length);\n var diffs = 0;\n var i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i])\n || (!dontConvert && Object(__WEBPACK_IMPORTED_MODULE_0__type_checks__[\"k\" /* toInt */])(array1[i]) !== Object(__WEBPACK_IMPORTED_MODULE_0__type_checks__[\"k\" /* toInt */])(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n}", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t}", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n\t var len = Math.min(array1.length, array2.length),\n\t lengthDiff = Math.abs(array1.length - array2.length),\n\t diffs = 0,\n\t i;\n\t for (i = 0; i < len; i++) {\n\t if ((dontConvert && array1[i] !== array2[i]) ||\n\t (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n\t diffs++;\n\t }\n\t }\n\t return diffs + lengthDiff;\n\t }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }", "function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if ((dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }" ]
[ "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.79984933", "0.79866725", "0.79537725", "0.7922521", "0.77097225", "0.75572866", "0.75463253", "0.75318825", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.7503132", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.749946", "0.7497887", "0.7497887", "0.7497887", "0.74965256", "0.74871886" ]
0.0
-1
pick the locale from the array try ['enau', 'engb'] as 'enau', 'engb', 'en', as in move through the list trying each substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n \n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n }", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return null;\n}", "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n}" ]
[ "0.70799595", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70713127" ]
0.0
-1
Return a moment from input, that is local/utc/utcOffset equivalent to model.
function makeAs(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (moment.isMoment(input) || isDate(input) ? +input : +moment(input)) - (+res); // Use low-level api, because this fn is low-level api. res._d.setTime(+res._d + diff); moment.updateOffset(res, false); return res; } else { return moment(input).local(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeAs(input, model) {\n\t return model._isUTC ? moment(input).zone(model._offset || 0) :\n\t moment(input).local();\n\t }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "function makeAs(input, model) {\n\t var res, diff;\n\t if (model._isUTC) {\n\t res = model.clone();\n\t diff = (moment.isMoment(input) || isDate(input) ? +input : +moment(input)) - +res;\n\t // Use low-level api, because this fn is low-level api.\n\t res._d.setTime(+res._d + diff);\n\t moment.updateOffset(res, false);\n\t return res;\n\t } else {\n\t return moment(input).local();\n\t }\n\t }", "function makeAs(input, model) {\n\t\tvar res, diff;\n\t\tif (model._isUTC) {\n\t\t\tres = model.clone();\n\t\t\tdiff = (moment.isMoment(input) || isDate(input) ? +input : +moment(input)) - (+res);\n\t\t\t// Use low-level api, because this fn is low-level api.\n\t\t\tres._d.setTime(+res._d + diff);\n\t\t\tmoment.updateOffset(res, false);\n\t\t\treturn res;\n\t\t} else {\n\t\t\treturn moment(input).local();\n\t\t}\n\t}", "function makeAs(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (moment.isMoment(input) || isDate(input) ?\n +input : +moment(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n moment.updateOffset(res, false);\n return res;\n } else {\n return moment(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(+res._d + diff);\n utils_hooks__hooks.updateOffset(res, false);\n return res;\n } else {\n return local__createLocal(input).local();\n }\n return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();\n }", "function cloneWithOffset(input, model) {\n\tvar res, diff;\n\tif (model._isUTC) {\n\t\tres = model.clone();\n\t\tdiff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n\t\t// Use low-level api, because this fn is low-level api.\n\t\tres._d.setTime(res._d.valueOf() + diff);\n\t\thooks.updateOffset(res, false);\n\t\treturn res;\n\t} else {\n\t\treturn createLocal(input).local();\n\t}\n}", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (constructor_1.isMoment(input) || is_date_1.default(input) ? input.valueOf() : local_1.createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks_1.hooks.updateOffset(res, false);\n return res;\n }\n else {\n return local_1.createLocal(input).local();\n }\n}", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }", "function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }" ]
[ "0.84117454", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.78674024", "0.7862978", "0.7836228", "0.7158956", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.71213925", "0.70696354", "0.7069008", "0.7069008", "0.706581", "0.7042258", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954", "0.70396954" ]
0.7805456
34
format date using native date object
function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); if (!formatFunctions[format]) { formatFunctions[format] = makeFormatFunction(format); } return formatFunctions[format](m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toISOString()).substr(0, 10).split('-');\n return dateFns.format(new Date(\n year,\n (month - 1),\n day,\n ), format);\n }", "function formatDate(obj) {\n const date = new Date(obj.date).toLocaleString(\"default\", {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n });\n obj.date = date;\n return obj;\n}", "function formatDate(date) {\n return format(new Date(date), 'yyyy-MM-dd')\n}", "getFormattedDate(date) {\n return dayjs(date).format(\"MMM MM, YYYY\");\n }", "function formatDate(date) {\n var d = new Date(date);\n d = d.toLocaleString();\n return d;\n }", "function formatDate(d) {\n return `${d.year}-${d.month}-${d.day}`\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "function _getFormattedDate(date) {\n var year = date.getFullYear();\n var month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : '0' + month;\n var day = date.getDate().toString();\n day = day.length > 1 ? day : '0' + day;\n return month + '/' + day + '/' + year;\n }", "function formatDate(date, format) {\n return format\n .replace(/yyyy/i, util_toString(date.getFullYear()))\n .replace(/MM/i, lpad(date.getMonth() + 1))\n .replace(/M/i, util_toString(date.getMonth()))\n .replace(/dd/i, lpad(date.getDate()))\n .replace(/d/i, util_toString(date.getDate()));\n}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth() + 1; //Months are zero based\n var year = date.getFullYear();\n var formattedDate = year + \"-\" + month + \"-\" + day;\n return formattedDate;\n }", "function formatDate(date) {\n\tif (date == null) {\n\t\treturn null;\n\t}\n\tvar d = date.getDate();\n\tvar m = date.getMonth() + 1;\n\tvar y = date.getFullYear();\n\treturn '' + (d <= 9 ? '0' + d : d) + '-' + (m <= 9 ? '0' + m : m) + '-' + y;\n}", "function formatDate(date) {\n let source = new Date(date);\n let day = source.getDate();\n let month = source.getMonth() + 1;\n let year = source.getFullYear();\n\n return `${day}/${month}/${year}`;\n }", "function formatDate(date) {\n\treturn new Date(date.split(' ').join('T'))\n}", "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n }", "getFormattedDate(date) {\n const year = date.getFullYear();\n const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');\n const day = (date.getUTCDate()).toString().padStart(2, '0');\n // Logger.log(`Day: ${day}, Month: ${month}, Year:${year}`)\n const dateFormatted = `${year}-${month}-${day}`;\n return dateFormatted;\n }", "function formatDate(date) {\n \n var dd = date.getDate();\n if (dd < 10) {\n dd = '0' + dd;\n }\n \n var mm = date.getMonth() + 1;\n if (mm < 10) {\n mm = '0' + mm;\n }\n \n var yy = date.getFullYear();\n if (yy < 10) {\n yy = '0' + yy;\n }\n \n return mm + '/' + dd + '/' + yy;\n }", "function formatDate(date) {\r\n\r\n let dd = date.getDate();\r\n if (dd < 10) dd = '0' + dd;\r\n\r\n let mm = date.getMonth() + 1;\r\n if (mm < 10) mm = '0' + mm;\r\n\r\n let yy = date.getFullYear() % 100;\r\n if (yy < 10) yy = '0' + yy;\r\n\r\n return dd + '.' + mm + '.' + yy;\r\n}", "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n}", "function formatDate(date){\n\t\tvar formatted = {\n\t\t\tdate:date,\n\t\t\tyear:date.getFullYear().toString().slice(2),\n\t\t\tmonth:s.months[date.getMonth()],\n\t\t\tmonthAbv:s.monthsAbv[date.getMonth()],\n\t\t\tmonthNum:date.getMonth() + 1,\n\t\t\tday:date.getDate(),\n\t\t\tslashDate:undefined,\n\t\t\ttime:formatTime(date)\n\t\t}\n\t\tformatted.slashDate = formatted.monthNum + '/' + formatted.day + '/' + formatted.year;\n\t\treturn formatted;\n\t}", "function formatDate(date) {\n var day = (\"0\" + date.getDate()).slice(-2);\n var month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n var year = date.getFullYear().toString().slice(-2);\n return day + month + year;\n}", "function formatDate(date)\n{\n g_date=date.getDate();\n if(g_date <=9)\n {\n g_date=\"0\"+g_date;\n }\n g_month=date.getMonth();\n g_year=date.getFullYear();\n if (g_year < 2000) g_year += 1900;\n return todaysMonthName(date)+\" \"+g_date+\", \"+g_year;\n}", "function formatDate(date,formatStr){return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString,date);}", "function getFormattedDate(date) {\n return $filter('date')(date, 'yyyy-MM-dd');\n }", "_stringify(date){\n date = date.toLocaleDateString();\n return date;\n }", "function formatDate(date, format){\n if(!date){\n return '0000-00-00';\n }\n var dd = date.substring(0, 2);\n var mm = date.substring(3, 5);\n var yy = date.substring(6);\n if (format == 'dmy') {\n return dd + '-' + mm + '-' + yy;\n } else {\n return yy + '-' + mm + '-' + dd;\n }\n }", "function formatDate(date) {\n var day = date.getDate();\n if (day < 10) {\n day = \"0\" + day;\n }\n\n var month = date.getMonth() + 1;\n if (month < 10) {\n month = \"0\" + month;\n }\n\n var year = date.getFullYear();\n\n return day + \".\" + month + \".\" + year;\n}", "formatDate (date){\n var d = new Date(date),\n month = (d.getMonth() + 1),\n day = d.getDate(),\n year = d.getFullYear();\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n return [year, month, day].join('-');\n }", "function convertToFormat (dateObj, dateFormat) {\r\n var month = dateObj.getMonth() + 1;\r\n var date = dateObj.getDate();\r\n var year = dateObj.getFullYear();\r\n var dateString;\r\n switch (dateFormat) {\r\n case 'yyyy.m.d':\r\n dateString = year + '.' + month + '.' + date;\r\n break;\r\n case 'yyyy-m-d':\r\n dateString = year + '-' + month + '-' + date;\r\n break;\r\n case 'yyyy/m/d':\r\n dateString = year + '/' + month + '/' + date;\r\n break;\r\n case 'yyyy/mm/dd':\r\n dateString = year + '/' + _makeTwoDigits(month) + '/' + _makeTwoDigits(date);\r\n break;\r\n case 'dd/mm/yyyy':\r\n dateString = _makeTwoDigits(date) + '/' + _makeTwoDigits(month) + '/' + year;\r\n break;\r\n case 'dd-mm-yyyy':\r\n dateString = _makeTwoDigits(date) + '-' + _makeTwoDigits(month) + '-' + year;\r\n break;\r\n case 'd-m-yyyy':\r\n dateString = date + '-' + month + '-' + year;\r\n break;\r\n case 'd/m/yyyy':\r\n dateString = date + '/' + month + '/' + year;\r\n break;\r\n case 'd/mm/yyyy':\r\n dateString = date + '/' + _makeTwoDigits(month) + '/' + year;\r\n break;\r\n case 'dd.mm.yyyy':\r\n dateString = _makeTwoDigits(date) + '.' + _makeTwoDigits(month) + '.' + year;\r\n break;\r\n case 'm/d/yyyy':\r\n dateString = month + '/' + date + '/' + year;\r\n break;\r\n default:\r\n dateString = _makeTwoDigits(date) + '.' + _makeTwoDigits(month) + '.' + year;\r\n }\r\n return dateString;\r\n }", "function formatDate(){\n if (!Date.prototype.toISODate) {\n Date.prototype.toISODate = function() {\n return this.getFullYear() + '-' +\n ('0'+ (this.getMonth()+1)).slice(-2) + '-' +\n ('0'+ this.getDate()).slice(-2);\n }\n }\n }", "function formatDate(date) {\n const d = new Date(date);\n return d.getFullYear() + \"-\" + twoDigits(d.getMonth() + 1) + \"-\" + twoDigits(d.getDate());\n}", "function formatDate(d) {\n if (d === undefined){\n d = (new Date()).toISOString()\n }\n let currDate = new Date(d);\n let year = currDate.getFullYear();\n let month = currDate.getMonth() + 1;\n let dt = currDate.getDate();\n let time = currDate.toLocaleTimeString('en-SG')\n\n if (dt < 10) {\n dt = '0' + dt;\n }\n if (month < 10) {\n month = '0' + month;\n }\n\n return dt + \"/\" + month + \"/\" + year + \" \" + time ;\n }", "function formattedDate(d) {\n let month = String(d.getMonth() + 1);\n let day = String(d.getDate());\n const year = String(d.getFullYear());\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return `${year}-${month}-${day}`;\n }", "function formattedDate(date) {\r\n\t\t\t\t\tvar d = new Date(date),\r\n\t\t\t\t\t\tmonth = '' + (d.getMonth() + 1),\r\n\t\t\t\t\t\tday = '' + d.getDate(),\r\n\t\t\t\t\t\tyear = d.getFullYear();\r\n\r\n\t\t\t\t\tif (month.length < 2) month = '0' + month;\r\n\t\t\t\t\tif (day.length < 2) day = '0' + day;\r\n\t\t\t\t\treturn [year, month, day].join('-');\r\n\t\t\t\t}", "function formatDate(date) {\r\n var d = date ? new Date(date) : new Date()\r\n month = '' + (d.getMonth() + 1),\r\n day = '' + d.getDate(),\r\n year = d.getFullYear();\r\n if (month.length < 2)\r\n month = '0' + month;\r\n if (day.length < 2)\r\n day = '0' + day;\r\n\r\n return `${day}${month}${year}`;\r\n}", "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "function _formatDate(date) {\n\t//remove timezone GMT otherwise move time\n\tvar offset = date.getTimezoneOffset() * 60000;\n\tvar dateFormatted = new Date(date - offset);\n dateFormatted = dateFormatted.toISOString();\n if (dateFormatted.indexOf(\"T\") > 0)\n dateFormatted = dateFormatted.split('T')[0];\n return dateFormatted;\n}", "function formatDate(date) {\n const month = date.getMonth() + 1;\n const day = date.getDate();\n const year = date.getFullYear();\n \n return `${month}/${day}/${year}`;\n }", "function formatDate(date) {\r\n return date.getFullYear().toString() + (date.getMonth() + 1).toString().padStart(2, '0') + date.getDate().toString() \r\n + date.getHours().toString().padStart(2, '0') + date.getMinutes().toString().padStart(2, '0');\r\n }", "function formatDate(date) {\n var dd = date.getDate()\n if (dd < 10) dd = '0' + dd;\n var mm = date.getMonth() + 1\n if (mm < 10) mm = '0' + mm;\n var yy = date.getFullYear();\n if (yy < 10) yy = '0' + yy;\n return dd + '.' + mm + '.' + yy;\n}", "formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n return [year, month, day].join('-');\n }", "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'short', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleString('en-US', options);\n}", "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleDateString('en-US', options);\n}", "function _date(obj) {\n return exports.PREFIX.date + ':' + obj.toISOString();\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [year, month, day].join('-');\n }", "function get_formatted_date(date) {\n function get_formatted_num(num, expected_length) {\n var str = \"\";\n var num_str = num.toString();\n var num_zeros = expected_length - num_str.length;\n for (var i = 0; i < num_zeros; ++i) {\n str += '0';\n }\n str += num_str;\n return str;\n }\n var msg = get_formatted_num(date.getFullYear(), 4) + \"-\";\n msg += get_formatted_num(date.getMonth() + 1, 2) + \"-\";\n msg += get_formatted_num(date.getDate(), 2) + \" \";\n msg += get_formatted_num(date.getHours(), 2) + \":\";\n msg += get_formatted_num(date.getMinutes(), 2) + \":\";\n msg += get_formatted_num(date.getSeconds(), 2);\n return msg;\n}", "function formattedDate(date) {\n\n // Récupération\n var month = String(date.getMonth() + 1);\n var day = String(date.getDate());\n var year = String(date.getFullYear());\n\n // Ajout du 0\n if (month.length < 2) \n month = '0' + month;\n\n // Ajout du 0\n if (day.length < 2) \n day = '0' + day;\n\n return day+'/'+month+'/'+year;\n }", "function formatDate(date,format) {\n if (!format){\n format = \"yyyy-MM-dd\";\n }\n if (date === null){\n return null;\n }\n if (!(date instanceof Date)){\n date = new Date(date);\n }\n let day = date.getDate();\n let month = date.getMonth();\n let year = date.getFullYear();\n let hour = date.getHours();\n let min = date.getMinutes();\n let sec = date.getSeconds();\n\n let str = format.replace(\"yyyy\",year)\n .replace(\"MM\",fillString(month+1,2,-1,\"0\"))\n .replace(\"dd\",fillString(day,2,-1,\"0\"))\n .replace(\"HH\",fillString(hour,2,-1,\"0\"))\n .replace(\"mm\",fillString(min,2,-1,\"0\"))\n .replace(\"ss\",fillString(sec,2,-1,\"0\"))\n ;\n return str;\n }", "function prettyFormatDate(date) {\n return Utilities.formatDate(new Date(date), \"GMT-7\", \"MM/dd/yy\").toString();\n}", "function formatDate(date) {\n var newDate = new Date(date);\n var dd = newDate.getDate();\n var mm = newDate.getMonth() + 1; // January is 0!\n\n var yyyy = newDate.getFullYear();\n\n if (dd < 10) {\n dd = \"0\".concat(dd);\n }\n\n if (mm < 10) {\n mm = \"0\".concat(mm);\n }\n\n var formatedDate = \"\".concat(dd, \"/\").concat(mm, \"/\").concat(yyyy);\n return formatedDate;\n}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth();\n var year = date.getFullYear();\n month++;\n if (month < 10)\n month = '0' + month;\n if (day < 10)\n day = '0' + day;\n return [year, month, day].join('-').toString();\n}", "formatDate(date) {\n return date.toISOString().replaceAll(\"-\", \"\").substring(0, 8);\n }", "function formatDate(date) {\n\t\tvar day = date.getDate();\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(day / 10) == 0) {\n\t\t\tday = \"0\" + day;\n\t\t}\n\t\t\n\t\tvar month = date.getMonth() + 1; // months start at 0\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(month / 10) == 0) {\n\t\t\tmonth = \"0\" + month;\n\t\t}\n\t\t\n\t\tvar year = date.getFullYear();\n\t\t\n\t\treturn day + \"/\" + month + \"/\" + year;\n\t}", "function formatDate(date) {\n\t\treturn (date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear() + ' - ' + formatTime([date.getHours(), date.getMinutes()]));\n\t}", "function formatDate(date)\n{\n date = new Date(date * 1000);\n return '' + date.getFullYear() + '/' + lpad(date.getMonth(), 2, '0') + '/' + lpad(date.getDate(), 2, '0') + ' ' + lpad(date.getHours(), 2, '0') + ':' + lpad(date.getMinutes(), 2, '0');\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) {\n month = '0' + month;\n }\n if (day.length < 2) {\n day = '0' + day;\n }\n\n return [year, month, day].join('-');\n}", "_convertDateObjToString(obj) {\n\n let date = \"\";\n\n if (obj && obj.day && obj.month && obj.year) {\n let month = String(obj.month);\n let day = String(obj.day);\n let year = String(obj.year);\n\n if (month.length < 2) {\n month = \"0\" + month;\n }\n\n if (day.length < 2) {\n day = \"0\" + day;\n }\n\n if (year.length < 4) {\n var l = 4 - year.length;\n for (var i = 0; i < l; i++) {\n year = \"0\" + year;\n }\n }\n date = year + \"-\" + month + \"-\" + day;\n }\n\n return date;\n }", "formatDate(x) {\n let date = new Date(x)\n let _month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1\n let _date = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()\n let _hour = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours()\n let _minute = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes()\n let _second = date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds()\n let dateStr = `${date.getFullYear()}-${_month}-${_date} ${_hour}:${_minute}:${_second}`\n return dateStr\n }", "returnDateFormat(date){\n var day = new Date(date);\n return day.toDateString();\n }", "function formatDate (date) {\n if (date) {\n const year = date.getFullYear()\n const month = date.getMonth() + 1\n const day = date.getDate()\n return year + '-' + month.toString().padStart(2, '0') + '-' + day.toString().padStart(2, '0')\n } else {\n return ''\n }\n}", "formatDateTime(date, format) {\n date = new Date(date);\n var result = format || 'y-m-d h:i:s';\n result = result.replace('y', date.getFullYear());\n result = result.replace('m', this.pad(date.getMonth() + 1, 2));\n result = result.replace('d', this.pad(date.getDate(), 2));\n result = result.replace('h', this.pad(date.getHours(), 2));\n result = result.replace('i', this.pad(date.getMinutes(), 2));\n result = result.replace('s', this.pad(date.getSeconds(), 2));\n return result;\n }", "function formatDate(date) {\n var date = new Date(date * 1000);\n return `${date.getMonth() + 1}/${date.getDate()}/${date.getUTCFullYear()}`;\n}", "function formatDate(date) {\n var year = date.getFullYear()\n var month = (1 + date.getMonth()).toString()\n var day = date.getUTCDate()\n return month + \"/\" + day + \"/\" + year\n}", "static formatDate(date) {\n let formattedDate = '';\n\n formattedDate += date.getUTCFullYear();\n formattedDate += '-' + ('0' + (date.getUTCMonth() + 1)).substr(-2);\n formattedDate += '-' + ('0' + date.getUTCDate()).substr(-2);\n\n return formattedDate;\n }", "formatted_date() {\n return this.created_at.toLocaleDateString()\n }", "function formatDate(date){\n var yr = date.getFullYear();\n var mnth = date.getMonth()+1;\n if(mnth < 10){\n mnth = `0${mnth}`;\n }\n var day = date.getDate()\n if(day < 10){\n day = `0${day}`;\n }\n return yr+\"-\"+mnth+\"-\"+day;\n}", "function formatDate(date){\n var dd = date.getDate(),\n mm = date.getMonth()+1, //January is 0!\n yyyy = date.getFullYear();\n\n if(dd<10) dd='0'+dd;\n if(mm<10) mm='0'+mm;\n\n return yyyy+'-'+mm+'-'+dd;\n}", "function dateformat(date) {\n \n // Main array that will be used to sort out the date.\n let dateArray = date.split('-');\n // Sorts days\n let dayArray = dateArray[2].split('T');\n let day = dayArray[0];\n // Sets up month and year months\n let month = dateArray[1];\n let year = dateArray[0];\n // Using the global standard or writing DOB\n let formatedDOB = [day, month, year].join('-');\n // Retuns the data from the formatted DOB.\n return formatedDOB;\n }", "function formatDate ( date ) {\n return date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n}", "function formatDate(date) {\n if (date) {\n var formattedDate = new Date(date);\n return formattedDate.toLocaleDateString();\n } else {\n return null;\n }\n}", "function formatDate(date) {\n return date.getFullYear() + '-' +\n (date.getMonth() < 9 ? '0' : '') + (date.getMonth()+1) + '-' +\n (date.getDate() < 10 ? '0' : '') + date.getDate();\n}", "function formatDate(date, formatStr) {\n\t\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n\t}", "function formatDate(date) {\n\t\t\t\treturn date.getDate() + \"-\" + (date.getMonth()+1) + \"-\" + date.getFullYear();\n\t\t\t}", "function pgFormatDate(date) {\n /* Via http://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date */\n return String(date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()); \n}", "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "function formatDate(date, format, options) {\n\treturn formatDates(date, null, format, options);\n}", "function setFormatoDate(data) {\n let dd = (\"0\" + (data.getDate())).slice(-2);\n let mm = (\"0\" + (data.getMonth() + 1)).slice(-2);\n let yyyy = data.getFullYear();\n return dd + '/' + mm + '/' + yyyy;\n}", "prettyBirthday() {//Can be put in method\n return dayjs(this.person.dob.date)\n .format('DD MMMM YYYY')//change in assignment to different format not default\n }", "function dateFormatter(date){\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n var day = date.getDate();\n return year + '-' + ('0' + month).slice(-2) + '-' + day; // the '0' and the slicing is for left padding\n}", "static formatDate (date, format) {\n let year = date.getFullYear(),\n month = Timer.zero(date.getMonth()+1),\n day = Timer.zero(date.getDate()),\n hours = Timer.zero(date.getHours()),\n minute = Timer.zero(date.getMinutes()),\n second = Timer.zero(date.getSeconds()),\n week = date.getDay();\n return format.replace(/yyyy/g, year)\n .replace(/MM/g, month)\n .replace(/dd/g, day)\n .replace(/hh/g, hours)\n .replace(/mm/g, minute)\n .replace(/ss/g, second)\n .replace(/ww/g, Timer.weekName(week));\n }", "function formatDate(date){\n var yyyy = date.getFullYear();\n var mm = date.getMonth() + 1;\n var dd = date.getDate();\n //console.log(\"This is dd\" + dd);\n if(dd<10){\n dd='0'+ dd;\n }\n if(mm<10){\n mm='0'+mm;\n } \n return ( mm + '/' + dd + '/' + yyyy);\n \n }", "function formatDate(dateToConvert) {\n\treturn format(new Date(dateToConvert));\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n return [year, month, day].join('-');\n }", "function format(d) {\n const month = d.getMonth() >= 9 ? d.getMonth() + 1 : `0${d.getMonth() + 1}`;\n const day = d.getDate() >= 10 ? d.getDate() : `0${d.getDate()}`;\n const year = d.getFullYear();\n return `${month}/${day}/${year}`;\n}", "function formatDate(date) {\n let year = date.getFullYear();\n let month = date.getMonth() + 1;\n let day = date.getDate();\n return [year, month, day].join('-');\n}", "dateFormate(d) {\n const date = new Date(d)\n const j = date.getDate()\n const m = (date.getUTCMonth() + 1)\n const a = date.getUTCFullYear()\n return (\"0\" + j).slice(-2) + '/' + (\"0\" + m).slice(-2) + '/' + a\n }", "function formatDate(date) {\n result = \"\";\n if (date) {\n result += date.getDate() + \"/\"; // Day\n result += (date.getMonth() + 1) + \"/\";\n result += (date.getYear() + 1900);\n }\n return result;\n}", "formatDate(value, format) {\n format = format || '';\n if (value) {\n return window.moment(value)\n .format(format);\n }\n return \"n/a\";\n }", "formatDate(d) {\n return moment(d).format('DD/MM/YYYY')\n }", "function formattedDate(d = new Date()) {\n return [d.getDate(), d.getMonth() + 1, d.getFullYear()]\n .map((n) => (n < 10 ? `0${n}` : `${n}`))\n .join(\"/\")\n .concat(` at ${getTime(d)}`);\n }", "_formatDate(date, tzOffset) {\n let str = window.iotlg.dateFormat;\n let actualDate = new Date();\n actualDate.setTime(date.getTime() + this._getMilliseconds(tzOffset, UNIT_HOUR));\n let hours = (actualDate.getUTCHours());\n let day = (actualDate.getUTCDate());\n\n str = str.replace(\"yyyy\", actualDate.getUTCFullYear());\n str = str.replace(\"mm\", this._fillUp(actualDate.getUTCMonth() + 1, 2));\n str = str.replace(\"dd\", this._fillUp(day, 2));\n str = str.replace(\"hh\", this._fillUp(hours, 2));\n str = str.replace(\"MM\", this._fillUp(actualDate.getUTCMinutes(), 2));\n str = str.replace(\"ss\", this._fillUp(actualDate.getUTCSeconds(), 2));\n str = str.replace(\" \", \"\\n\");\n return str;\n }", "function formatDate(rawDate) {\n return rawDate.replace(/(\\d{4})[-/](\\d{2})[-/](\\d{2})/, '$3.$2.$1');\n}", "function formatDate(val) {\n var d = new Date(val),\n day = d.getDate(),\n month = d.getMonth() + 1,\n year = d.getFullYear();\n\n if (day < 10) {\n day = \"0\" + day;\n }\n if (month < 10) {\n month = \"0\" + month;\n }\n return month + \"/\" + day + \"/\" + year;\n}", "function formattedDate(d = new Date) {\n\treturn [d.getDate(), d.getMonth()+1, d.getFullYear()]\n\t\t.map(n => n < 10 ? `0${n}` : `${n}`).join('/');\n }", "getDateFormated(date) {\n const formatDate = new Intl.DateTimeFormat('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n }).format;\n return formatDate(date);\n }", "function reFormatDate(date) {\n const d= new Date(Date.parse(date));\n let mm = d.getMonth() + 1;\n const yyyy = d.getFullYear();\n let dd = d.getDate();\n\n if (dd < 10) {\n dd = `0${dd}`;\n }\n if (mm < 10) {\n mm = `0${mm}`;\n }\n return `${yyyy}-${mm}-${dd}`;\n }" ]
[ "0.75340456", "0.74220204", "0.73882395", "0.73852545", "0.7351628", "0.73369396", "0.7306578", "0.73013055", "0.72933567", "0.72933567", "0.72933567", "0.72215754", "0.72151476", "0.7212694", "0.71899515", "0.71846557", "0.7180238", "0.7170007", "0.716869", "0.715949", "0.71378785", "0.7136842", "0.7117016", "0.7095881", "0.70630413", "0.70610964", "0.7049743", "0.70481277", "0.7034786", "0.7028141", "0.7027084", "0.70147675", "0.7003046", "0.6996137", "0.69859654", "0.69856715", "0.69855577", "0.6979688", "0.6979591", "0.6979591", "0.69788754", "0.6977267", "0.6971408", "0.69650656", "0.6962428", "0.69588095", "0.6958678", "0.695223", "0.6951216", "0.6950626", "0.69438344", "0.6943485", "0.69429666", "0.6940697", "0.6936805", "0.69354546", "0.693499", "0.6924585", "0.6916808", "0.69166994", "0.6913247", "0.69097507", "0.68972266", "0.68905085", "0.6889404", "0.6876217", "0.68721336", "0.68719363", "0.6870906", "0.68696827", "0.68669003", "0.68637353", "0.6853008", "0.68487805", "0.6846504", "0.6839833", "0.68364084", "0.6835987", "0.68268216", "0.68268216", "0.68268216", "0.6826179", "0.6823686", "0.6819357", "0.68176067", "0.6815723", "0.68117166", "0.681163", "0.68113303", "0.68106574", "0.6809888", "0.68027425", "0.68026423", "0.6793767", "0.6792775", "0.6790127", "0.6787706", "0.6785947", "0.6785088", "0.6784688", "0.6780064" ]
0.0
-1
Parsing get the regex to find the next token
function getParseRegexForToken(token, config) { var a, strict = config._strict; switch (token) { case 'Q': return parseTokenOneDigit; case 'DDDD': return parseTokenThreeDigits; case 'YYYY': case 'GGGG': case 'gggg': return strict ? parseTokenFourDigits : parseTokenOneToFourDigits; case 'Y': case 'G': case 'g': return parseTokenSignedNumber; case 'YYYYYY': case 'YYYYY': case 'GGGGG': case 'ggggg': return strict ? parseTokenSixDigits : parseTokenOneToSixDigits; case 'S': if (strict) { return parseTokenOneDigit; } /* falls through */ case 'SS': if (strict) { return parseTokenTwoDigits; } /* falls through */ case 'SSS': if (strict) { return parseTokenThreeDigits; } /* falls through */ case 'DDD': return parseTokenOneToThreeDigits; case 'MMM': case 'MMMM': case 'dd': case 'ddd': case 'dddd': return parseTokenWord; case 'a': case 'A': return config._locale._meridiemParse; case 'x': return parseTokenOffsetMs; case 'X': return parseTokenTimestampMs; case 'Z': case 'ZZ': return parseTokenTimezone; case 'T': return parseTokenT; case 'SSSS': return parseTokenDigits; case 'MM': case 'DD': case 'YY': case 'GG': case 'gg': case 'HH': case 'hh': case 'mm': case 'ss': case 'ww': case 'WW': return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits; case 'M': case 'D': case 'd': case 'H': case 'h': case 'm': case 's': case 'w': case 'W': case 'e': case 'E': return parseTokenOneOrTwoDigits; case 'Do': return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient; default : a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i')); return a; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "regexToken() {\r\n\t\t\t\tvar body, closed, comment, commentIndex, commentOpts, commentTokens, comments, delimiter, end, flags, fullMatch, index, leadingWhitespace, match, matchedComment, origin, prev, ref, ref1, regex, tokens;\r\n\t\t\t\tswitch (false) {\r\n\t\t\t\t\tcase !(match = REGEX_ILLEGAL.exec(this.chunk)):\r\n\t\t\t\t\t\tthis.error(`regular expressions cannot begin with ${match[2]}`, {\r\n\t\t\t\t\t\t\toffset: match.index + match[1].length\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(match = this.matchWithInterpolations(HEREGEX, '///')):\r\n\t\t\t\t\t\t({tokens, index} = match);\r\n\t\t\t\t\t\tcomments = [];\r\n\t\t\t\t\t\twhile (matchedComment = HEREGEX_COMMENT.exec(this.chunk.slice(0, index))) {\r\n\t\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\t\tindex: commentIndex\r\n\t\t\t\t\t\t\t} = matchedComment);\r\n\t\t\t\t\t\t\t[fullMatch, leadingWhitespace, comment] = matchedComment;\r\n\t\t\t\t\t\t\tcomments.push({\r\n\t\t\t\t\t\t\t\tcomment,\r\n\t\t\t\t\t\t\t\toffsetInChunk: commentIndex + leadingWhitespace.length\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcommentTokens = flatten((function() {\r\n\t\t\t\t\t\t\tvar j, len, results;\r\n\t\t\t\t\t\t\tresults = [];\r\n\t\t\t\t\t\t\tfor (j = 0, len = comments.length; j < len; j++) {\r\n\t\t\t\t\t\t\t\tcommentOpts = comments[j];\r\n\t\t\t\t\t\t\t\tresults.push(this.commentToken(commentOpts.comment, Object.assign(commentOpts, {\r\n\t\t\t\t\t\t\t\t\theregex: true,\r\n\t\t\t\t\t\t\t\t\treturnCommentTokens: true\r\n\t\t\t\t\t\t\t\t})));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn results;\r\n\t\t\t\t\t\t}).call(this));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(match = REGEX.exec(this.chunk)):\r\n\t\t\t\t\t\t[regex, body, closed] = match;\r\n\t\t\t\t\t\tthis.validateEscapes(body, {\r\n\t\t\t\t\t\t\tisRegex: true,\r\n\t\t\t\t\t\t\toffsetInChunk: 1\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tindex = regex.length;\r\n\t\t\t\t\t\tprev = this.prev();\r\n\t\t\t\t\t\tif (prev) {\r\n\t\t\t\t\t\t\tif (prev.spaced && (ref = prev[0], indexOf.call(CALLABLE, ref) >= 0)) {\r\n\t\t\t\t\t\t\t\tif (!closed || POSSIBLY_DIVISION.test(regex)) {\r\n\t\t\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else if (ref1 = prev[0], indexOf.call(NOT_REGEX, ref1) >= 0) {\r\n\t\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!closed) {\r\n\t\t\t\t\t\t\tthis.error('missing / (unclosed regex)');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\t[flags] = REGEX_FLAGS.exec(this.chunk.slice(index));\r\n\t\t\t\tend = index + flags.length;\r\n\t\t\t\torigin = this.makeToken('REGEX', null, {\r\n\t\t\t\t\tlength: end\r\n\t\t\t\t});\r\n\t\t\t\tswitch (false) {\r\n\t\t\t\t\tcase !!VALID_FLAGS.test(flags):\r\n\t\t\t\t\t\tthis.error(`invalid regular expression flags ${flags}`, {\r\n\t\t\t\t\t\t\toffset: index,\r\n\t\t\t\t\t\t\tlength: flags.length\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase !(regex || tokens.length === 1):\r\n\t\t\t\t\t\tdelimiter = body ? '/' : '///';\r\n\t\t\t\t\t\tif (body == null) {\r\n\t\t\t\t\t\t\tbody = tokens[0][1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.validateUnicodeCodePointEscapes(body, {delimiter});\r\n\t\t\t\t\t\tthis.token('REGEX', `/${body}/${flags}`, {\r\n\t\t\t\t\t\t\tlength: end,\r\n\t\t\t\t\t\t\torigin,\r\n\t\t\t\t\t\t\tdata: {delimiter}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tthis.token('REGEX_START', '(', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\torigin,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('IDENTIFIER', 'RegExp', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('CALL_START', '(', {\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.mergeInterpolationTokens(tokens, {\r\n\t\t\t\t\t\t\tdouble: true,\r\n\t\t\t\t\t\t\theregex: {flags},\r\n\t\t\t\t\t\t\tendOffset: end - flags.length,\r\n\t\t\t\t\t\t\tquote: '///'\r\n\t\t\t\t\t\t}, (str) => {\r\n\t\t\t\t\t\t\treturn this.validateUnicodeCodePointEscapes(str, {delimiter});\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tif (flags) {\r\n\t\t\t\t\t\t\tthis.token(',', ',', {\r\n\t\t\t\t\t\t\t\toffset: index - 1,\r\n\t\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tthis.token('STRING', '\"' + flags + '\"', {\r\n\t\t\t\t\t\t\t\toffset: index,\r\n\t\t\t\t\t\t\t\tlength: flags.length\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.token(')', ')', {\r\n\t\t\t\t\t\t\toffset: end,\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tthis.token('REGEX_END', ')', {\r\n\t\t\t\t\t\t\toffset: end,\r\n\t\t\t\t\t\t\tlength: 0,\r\n\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t// Explicitly attach any heregex comments to the REGEX/REGEX_END token.\r\n\t\t\t\tif (commentTokens != null ? commentTokens.length : void 0) {\r\n\t\t\t\t\taddTokenData(this.tokens[this.tokens.length - 1], {\r\n\t\t\t\t\t\theregexCommentTokens: commentTokens\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\treturn end;\r\n\t\t\t}", "function nextToken() {\n\t\tstartLooking();\n\t\tif (lookahead.length) {\n\t\t\tvar r = lookahead.shift();\n\t\t\ttokensState = r.state;\n\t\t\treturn r.token;\n\t\t} else {\n\t\t\tvar out = tokens.next();\n\t\t\ttokensState = tokens.state();\n\t\t\treturn out;\n\t\t}\n\t}", "function readRegexp() {\n var content = \"\", escaped, inClass, start = tokPos;\n for (; ;) {\n if (tokPos >= inputLen) raise(start, \"Unterminated regular expression\");\n var ch = input.charAt(tokPos);\n if (newline.test(ch)) raise(start, \"Unterminated regular expression\");\n if (!escaped) {\n if (ch === \"[\") inClass = true;\n else if (ch === \"]\" && inClass) inClass = false;\n else if (ch === \"/\" && !inClass) break;\n escaped = ch === \"\\\\\";\n } else escaped = false;\n ++tokPos;\n }\n var content = input.slice(start, tokPos);\n ++tokPos;\n // Need to use `readWord1` because '\\uXXXX' sequences are allowed\n // here (don't ask).\n var mods = readWord1();\n if (mods && !/^[gmsiy]*$/.test(mods)) raise(start, \"Invalid regexp flag\");\n return finishToken(_regexp, new RegExp(content, mods));\n }", "match(input) {\n var pos = input.pos\n if(!this.match_one(input)) return this.error(input, input.pos)\n var c = input.current()\n if(c!='-') return this.error(input, input.pos)\n input.next()\n if(!this.match_one(input)) return this.error(input, input.pos)\n return this.token(input,pos,input.substring(pos, input.pos)) \n }", "function getParseRegexForToken(token, config) {\n var a;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return parseTokenFourDigits;\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'ww':\n case 'W':\n case 'WW':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return parseTokenFourDigits;\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'ww':\n case 'W':\n case 'WW':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'dd':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n case 'a':\n case 'A':\n return parseTokenWord;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token, config) {\n\t var a, strict = config._strict;\n\t switch (token) {\n\t case 'Q':\n\t return parseTokenOneDigit;\n\t case 'DDDD':\n\t return parseTokenThreeDigits;\n\t case 'YYYY':\n\t case 'GGGG':\n\t case 'gggg':\n\t return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n\t case 'Y':\n\t case 'G':\n\t case 'g':\n\t return parseTokenSignedNumber;\n\t case 'YYYYYY':\n\t case 'YYYYY':\n\t case 'GGGGG':\n\t case 'ggggg':\n\t return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n\t case 'S':\n\t if (strict) {\n\t return parseTokenOneDigit;\n\t }\n\t /* falls through */\n\t case 'SS':\n\t if (strict) {\n\t return parseTokenTwoDigits;\n\t }\n\t /* falls through */\n\t case 'SSS':\n\t if (strict) {\n\t return parseTokenThreeDigits;\n\t }\n\t /* falls through */\n\t case 'DDD':\n\t return parseTokenOneToThreeDigits;\n\t case 'MMM':\n\t case 'MMMM':\n\t case 'dd':\n\t case 'ddd':\n\t case 'dddd':\n\t return parseTokenWord;\n\t case 'a':\n\t case 'A':\n\t return config._locale._meridiemParse;\n\t case 'X':\n\t return parseTokenTimestampMs;\n\t case 'Z':\n\t case 'ZZ':\n\t return parseTokenTimezone;\n\t case 'T':\n\t return parseTokenT;\n\t case 'SSSS':\n\t return parseTokenDigits;\n\t case 'MM':\n\t case 'DD':\n\t case 'YY':\n\t case 'GG':\n\t case 'gg':\n\t case 'HH':\n\t case 'hh':\n\t case 'mm':\n\t case 'ss':\n\t case 'ww':\n\t case 'WW':\n\t return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n\t case 'M':\n\t case 'D':\n\t case 'd':\n\t case 'H':\n\t case 'h':\n\t case 'm':\n\t case 's':\n\t case 'w':\n\t case 'W':\n\t case 'e':\n\t case 'E':\n\t return parseTokenOneOrTwoDigits;\n\t case 'Do':\n\t return parseTokenOrdinal;\n\t default :\n\t a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n\t return a;\n\t }\n\t }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "nextToken() {\n let c1 = this.la(0);\n if(c1 < 128) {\n let t = this.map[c1];\n if(t >= 0) {\n return this.acceptToken(t, 1);\n } else {\n t = -t;\n if(t < this.Literal.$Literal) {\n return this.lexKnownToken(t);\n } else {\n return this.lexUnknownToken(t);\n }\n }\n } else if(Number.isNaN(c1)) {\n return this.acceptToken(this.Token.$EOF, 0);\n } else {\n return this.lexNonAsciiToken(c1);\n }\n }", "function getParseRegexForToken(token, config) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token, config) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token, config) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token, config) {\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n return parseTokenFourDigits;\n case 'YYYYY':\n return parseTokenSixDigits;\n case 'S':\n case 'SS':\n case 'SSS':\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n return parseTokenOneOrTwoDigits;\n default :\n return new RegExp(token.replace('\\\\', ''));\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default:\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "match(input) {\n if(this.startsWith(input.current())) {\n var c = input.current()\n input.next()\n return this.token(input,input.pos-1,c)\n }\n else return this.error(input,input.pos)\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'x':\n return parseTokenOffsetMs;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "advance() {\n this.lastToken = this.token;\n const token = (this.token = this.lookahead());\n return token;\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'Q':\n return parseTokenOneDigit;\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) {\n return parseTokenOneDigit;\n }\n /* falls through */\n case 'SS':\n if (strict) {\n return parseTokenTwoDigits;\n }\n /* falls through */\n case 'SSS':\n if (strict) {\n return parseTokenThreeDigits;\n }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return config._locale._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n case 'Do':\n return parseTokenOrdinal;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n return a;\n }\n }", "function look() {\n\t\ttry {\n\t\t\tif (lookahead.length > lookaheadIndex) {\n\t\t\t\treturn lookahead[lookaheadIndex++].token;\n\t\t\t} else {\n\t\t\t\tlookahead.push({token: tokens.next(), state: tokens.state()});\n\t\t\t\treturn look();\n\t\t\t}\n\t\t} catch (e) {}\n\t}", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n case 'DDD':\n return strict ? parseTokenThreeDigits : parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return strict ? parseTokenOneDigit : parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n var a, strict = config._strict;\n switch (token) {\n case 'DDDD':\n return parseTokenThreeDigits;\n case 'YYYY':\n case 'GGGG':\n case 'gggg':\n return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n case 'Y':\n case 'G':\n case 'g':\n return parseTokenSignedNumber;\n case 'YYYYYY':\n case 'YYYYY':\n case 'GGGGG':\n case 'ggggg':\n return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n case 'S':\n if (strict) { return parseTokenOneDigit; }\n /* falls through */\n case 'SS':\n if (strict) { return parseTokenTwoDigits; }\n /* falls through */\n case 'SSS':\n if (strict) { return parseTokenThreeDigits; }\n /* falls through */\n case 'DDD':\n return parseTokenOneToThreeDigits;\n case 'MMM':\n case 'MMMM':\n case 'dd':\n case 'ddd':\n case 'dddd':\n return parseTokenWord;\n case 'a':\n case 'A':\n return getLangDefinition(config._l)._meridiemParse;\n case 'X':\n return parseTokenTimestampMs;\n case 'Z':\n case 'ZZ':\n return parseTokenTimezone;\n case 'T':\n return parseTokenT;\n case 'SSSS':\n return parseTokenDigits;\n case 'MM':\n case 'DD':\n case 'YY':\n case 'GG':\n case 'gg':\n case 'HH':\n case 'hh':\n case 'mm':\n case 'ss':\n case 'ww':\n case 'WW':\n return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n case 'M':\n case 'D':\n case 'd':\n case 'H':\n case 'h':\n case 'm':\n case 's':\n case 'w':\n case 'W':\n case 'e':\n case 'E':\n return parseTokenOneOrTwoDigits;\n default :\n a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), \"i\"));\n return a;\n }\n }", "function getParseRegexForToken(token, config) {\n\t var a,\n\t strict = config._strict;\n\t switch (token) {\n\t case 'Q':\n\t return parseTokenOneDigit;\n\t case 'DDDD':\n\t return parseTokenThreeDigits;\n\t case 'YYYY':\n\t case 'GGGG':\n\t case 'gggg':\n\t return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n\t case 'Y':\n\t case 'G':\n\t case 'g':\n\t return parseTokenSignedNumber;\n\t case 'YYYYYY':\n\t case 'YYYYY':\n\t case 'GGGGG':\n\t case 'ggggg':\n\t return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n\t case 'S':\n\t if (strict) {\n\t return parseTokenOneDigit;\n\t }\n\t /* falls through */\n\t case 'SS':\n\t if (strict) {\n\t return parseTokenTwoDigits;\n\t }\n\t /* falls through */\n\t case 'SSS':\n\t if (strict) {\n\t return parseTokenThreeDigits;\n\t }\n\t /* falls through */\n\t case 'DDD':\n\t return parseTokenOneToThreeDigits;\n\t case 'MMM':\n\t case 'MMMM':\n\t case 'dd':\n\t case 'ddd':\n\t case 'dddd':\n\t return parseTokenWord;\n\t case 'a':\n\t case 'A':\n\t return config._locale._meridiemParse;\n\t case 'x':\n\t return parseTokenOffsetMs;\n\t case 'X':\n\t return parseTokenTimestampMs;\n\t case 'Z':\n\t case 'ZZ':\n\t return parseTokenTimezone;\n\t case 'T':\n\t return parseTokenT;\n\t case 'SSSS':\n\t return parseTokenDigits;\n\t case 'MM':\n\t case 'DD':\n\t case 'YY':\n\t case 'GG':\n\t case 'gg':\n\t case 'HH':\n\t case 'hh':\n\t case 'mm':\n\t case 'ss':\n\t case 'ww':\n\t case 'WW':\n\t return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n\t case 'M':\n\t case 'D':\n\t case 'd':\n\t case 'H':\n\t case 'h':\n\t case 'm':\n\t case 's':\n\t case 'w':\n\t case 'W':\n\t case 'e':\n\t case 'E':\n\t return parseTokenOneOrTwoDigits;\n\t case 'Do':\n\t return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient;\n\t default:\n\t a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n\t return a;\n\t }\n\t }", "match(input, start, end) {\n this.init(input,start,end)\n var list = []\n var t;\n while((t=this.next())!=null && t.type!=Token.ERROR) { list.push(t) }\n if(t==null) \n return new Token(input, start, list[list.length-1].end, list, TOKEN_LIST)\n else \n return t\n }", "function _match(tok) {\n var match, length, c, endIndex;\n\n // Non-terminal\n if (tok instanceof Function) {\n return tok.call(parser.parsers);\n // Terminal\n // Either match a single character in the input,\n // or match a regexp in the current chunk (chunk[j]).\n } else if (typeof(tok) === 'string') {\n match = input.charAt(i) === tok ? tok : null;\n length = 1;\n sync();\n } else {\n sync();\n\n match = tok.exec(chunks[j]);\n if (match) {\n length = match[0].length;\n } else {\n return null;\n }\n }\n\n // The match is confirmed, add the match length to `i`,\n // and consume any extra white-space characters (' ' || '\\n')\n // which come after that. The reason for this is that LeSS's\n // grammar is mostly white-space insensitive.\n if (match) {\n var mem = i += length;\n endIndex = i + chunks[j].length - length;\n\n while (i < endIndex) {\n c = input.charCodeAt(i);\n if (!(c === 32 || c === 10 || c === 9)) {\n break;\n }\n i++;\n }\n chunks[j] = chunks[j].slice(length + (i - mem));\n current = i;\n\n if (chunks[j].length === 0 && j < chunks.length - 1) {\n j++;\n }\n\n if (typeof(match) === 'string') {\n return match;\n } else {\n return match.length === 1 ? match[0] : match;\n }\n }\n }", "match(input) {\n var start = input.pos\n var c = input.current()\n if(!this.startsWith(c)) return this.error(input, input.pos)\n while(this.startsWith(input.next())){}\n return this.token(input,start,\" \")\n }", "function getParseRegexForToken(token, config) {\n\t\tvar a, strict = config._strict;\n\t\tswitch (token) {\n\t\t\tcase 'Q':\n\t\t\t\treturn parseTokenOneDigit;\n\t\t\tcase 'DDDD':\n\t\t\t\treturn parseTokenThreeDigits;\n\t\t\tcase 'YYYY':\n\t\t\tcase 'GGGG':\n\t\t\tcase 'gggg':\n\t\t\t\treturn strict ? parseTokenFourDigits : parseTokenOneToFourDigits;\n\t\t\tcase 'Y':\n\t\t\tcase 'G':\n\t\t\tcase 'g':\n\t\t\t\treturn parseTokenSignedNumber;\n\t\t\tcase 'YYYYYY':\n\t\t\tcase 'YYYYY':\n\t\t\tcase 'GGGGG':\n\t\t\tcase 'ggggg':\n\t\t\t\treturn strict ? parseTokenSixDigits : parseTokenOneToSixDigits;\n\t\t\tcase 'S':\n\t\t\t\tif (strict) {\n\t\t\t\t\treturn parseTokenOneDigit;\n\t\t\t\t}\n\t\t\t\t/* falls through */\n\t\t\tcase 'SS':\n\t\t\t\tif (strict) {\n\t\t\t\t\treturn parseTokenTwoDigits;\n\t\t\t\t}\n\t\t\t\t/* falls through */\n\t\t\tcase 'SSS':\n\t\t\t\tif (strict) {\n\t\t\t\t\treturn parseTokenThreeDigits;\n\t\t\t\t}\n\t\t\t\t/* falls through */\n\t\t\tcase 'DDD':\n\t\t\t\treturn parseTokenOneToThreeDigits;\n\t\t\tcase 'MMM':\n\t\t\tcase 'MMMM':\n\t\t\tcase 'dd':\n\t\t\tcase 'ddd':\n\t\t\tcase 'dddd':\n\t\t\t\treturn parseTokenWord;\n\t\t\tcase 'a':\n\t\t\tcase 'A':\n\t\t\t\treturn config._locale._meridiemParse;\n\t\t\tcase 'x':\n\t\t\t\treturn parseTokenOffsetMs;\n\t\t\tcase 'X':\n\t\t\t\treturn parseTokenTimestampMs;\n\t\t\tcase 'Z':\n\t\t\tcase 'ZZ':\n\t\t\t\treturn parseTokenTimezone;\n\t\t\tcase 'T':\n\t\t\t\treturn parseTokenT;\n\t\t\tcase 'SSSS':\n\t\t\t\treturn parseTokenDigits;\n\t\t\tcase 'MM':\n\t\t\tcase 'DD':\n\t\t\tcase 'YY':\n\t\t\tcase 'GG':\n\t\t\tcase 'gg':\n\t\t\tcase 'HH':\n\t\t\tcase 'hh':\n\t\t\tcase 'mm':\n\t\t\tcase 'ss':\n\t\t\tcase 'ww':\n\t\t\tcase 'WW':\n\t\t\t\treturn strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;\n\t\t\tcase 'M':\n\t\t\tcase 'D':\n\t\t\tcase 'd':\n\t\t\tcase 'H':\n\t\t\tcase 'h':\n\t\t\tcase 'm':\n\t\t\tcase 's':\n\t\t\tcase 'w':\n\t\t\tcase 'W':\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\t\treturn parseTokenOneOrTwoDigits;\n\t\t\tcase 'Do':\n\t\t\t\treturn strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient;\n\t\t\tdefault:\n\t\t\t\ta = new RegExp(regexpEscape(unescapeFormat(token.replace('\\\\', '')), 'i'));\n\t\t\t\treturn a;\n\t\t}\n\t}", "lookahead() {\n let token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n if (token.next) {\n token = token.next;\n } else {\n // Read the next token and form a link in the token linked-list.\n const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing.\n\n token.next = nextToken; // @ts-expect-error prev is only mutable during parsing.\n\n nextToken.prev = token;\n token = nextToken;\n }\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n }", "next() {\n // Keep reading until we either read a token or reach the end of the input.\n this.value = null;\n for (;;) {\n // Skip whitespace.\n while (this.ch == 32 || // space\n this.ch == 9 || // tab\n this.ch == 13 || // return\n this.ch == 10) { // newline\n this.read();\n }\n\n // Check for end of input.\n if (this.end()) {\n this.token = -1;\n return;\n }\n\n // Parse next token (or comment).\n switch (this.ch) {\n case 58: case 43: // ':' '+'\n case 44: case 61: // ',' '='\n case 91: case 93: // '[' ']'\n case 123: case 125: // '{' '}'\n case 64: // @\n this.token = this.ch;\n this.read();\n return;\n\n case 34: // '\"'\n // Parse string.\n this.parse_string();\n return;\n\n case 48: case 49: case 50: case 51: case 52: // '0' '1' '2' '3' '4'\n case 53: case 54: case 55: case 56: case 57: // '5' '6' '7' '8' '9'\n case 46: case 45: // '.' '-'\n // Parse number.\n this.parse_number();\n return;\n\n case 35: // '#'\n // Parse index reference.\n this.read();\n this.parse_index();\n return;\n\n case 59: // ';'\n // Skip comment.\n this.read();\n while (this.ch != -1 && this.ch != 10) this.read();\n break;\n\n case 36: // '$'\n // Quoted symbol.\n this.read();\n this.parse_string();\n this.token = -8;\n return;\n\n default:\n // Parse keyword or symbol.\n this.parse_name();\n return;\n }\n }\n }", "function token1(r) {\n\t\tfor (var j = 0; j < r.length; j++) {\n\t\t\t//if (r[j].match(srr[0], \"g\")) {\n\t\t\tvar re = new RegExp(srr[0],\"g\");\n\t\t\tif (r[j].match(re)) {\n\t\t\t\t$('<p>').html(r[j]).appendTo(\"#demo-1\");\n\t\t\t\tscnt++;\t\n\t\t\t} \n\t\t} \n\t\tsearchql = true;\n\t\thlsSyntax(srr[0]);\n\t\tresultCall();\n\t}", "lookaheadToken(index) {\n\t\t\treturn this.lookahead(index)[1];\n\t\t}", "match(input){\n var t = this.tokenizer.match(input) \n if( t.isError() ) return t\n this.lexer = new TokenSource(t.value)\n t = this.analyze()\n if(!this.leftover && this.lexer.current()!=null) t = this.lexer.current().toError()\n return t\n }", "nextToken() {\r\n\r\n console.log('in next token');\r\n if(this.position >= this.input.length){\r\n return new Token(TokenType.EndOfInput, 'END', this.line, this.column);\r\n }\r\n\r\n // we skip all the whitespaces and new lines in the input;\r\n console.log('Before removing whitespaces position: '+this.position);\r\n this.skipWhitespacesAndNewLines();\r\n console.log('After removing whitespaces position: '+this.position);\r\n let character = this.input.charAt(this.position);\r\n console.log('character: '+ character);\r\n \r\n if(CharUtils.isOperator(character)){\r\n return this.recognizeOperator();\r\n }\r\n \r\n if(CharUtils.isLetter(character)) {\r\n return this.recognizeIdentifier();\r\n }\r\n\r\n if(CharUtils.isDigit(character)) {\r\n return this.recognizeNumber();\r\n }\r\n if(CharUtils.isParenthesis(character)){\r\n return this.recognizeParenthesis();\r\n }\r\n\r\n // throw an error if the current character does not match\r\n // any production rule of the lexical grammar.\r\n\r\n throw new Error('Unrecognized character ' + character + ' at line ' +\r\n + this.line + ' and column ' + this.column );\r\n\r\n }", "function next()\n {\n // Skip leading whitespace and comments\n let save = p;\n while (true)\n {\n // Skip leading line space\n while (textUtils.isWhitespace(str[p]))\n p++;\n\n // Comment\n if (str[p] == '-' && str[p+1] == '-')\n {\n p = textUtils.findNextLine(str, p);\n continue;\n }\n break;\n }\n if (p > save && whitespaceMode)\n {\n return { pos: save, token: \" \" };\n }\n\n // Eof of file?\n if (str[p]=='\\0' || p==str.length)\n {\n return { pos: p, token: 'eof' }\n }\n\n // Is it an identifier?\n if (textUtils.isIdentifierLeadChar(str[p]))\n {\n // Skip it\n let start = p;\n while (textUtils.isIdentifierChar(str[p]))\n p++;\n\n // Extract it\n let identifier = str.substr(start, p-start);\n\n // Return token\n return {\n pos: start,\n token: 'identifier',\n value: identifier,\n }\n }\n\n // Characters\n switch (str[p])\n {\n case '(':\n case ')':\n case ',':\n case ';':\n case '.':\n let ch = str[p];\n p++;\n return {\n pos: p-1,\n token: ch\n }\n\n case ':':\n p++;\n if (str[p] == '=')\n {\n p++;\n return { pos: p-2, token: \":=\"}\n }\n return { pos: p-1, token: \":\" }\n\n case '<':\n p++;\n if (str[p] == '=')\n {\n p++;\n return { pos: p-2, token: \"<=\"}\n }\n return { pos: p-1, token: \":\" }\n\n case '=':\n p++;\n if (str[p] == '>')\n {\n p++;\n return { pos: p-2, token: \"=>\"}\n }\n return { pos: p-1, token: \"=\" }\n }\n\n // String?\n if (str[p] == '\\\"' || str[p] == '\\'')\n {\n let delim = str[p];\n let start = p;\n p++;\n\n while (str[p] != delim)\n {\n if (str[p] == '\\0')\n throw new Error(\"Unterminated string literal\");\n\n p++;\n }\n\n // Skip trailing delimiter\n p++;\n\n // Extract the raw string\n let raw = str.substr(start, p-start);\n\n // Return as a literal\n return {\n pos: start,\n token: 'other',\n raw\n }\n }\n\n // Some other unexpected character\n p++;\n return {\n pos: p-1,\n token: 'other',\n raw: str[p-1]\n }\n }", "function GenTokenParser(){}", "match(input) {\n if(input.eoi()) return this.error(input, input.pos)\n var count = 0\n var pos = input.pos\n while(this.match_one(input)) count++\n if(count == 0 ) return this.error(input, input.pos)\n return this.token(input,pos,input.substring(pos, input.pos))\n }", "function next() {\n\t\tvar out = nextToken();\n\t\t// if we're in a pattern, apply the \"pattern\" style\n\t\tif (inPattern) out.style += \" pattern\";\n\t\tif (out.content == \"\\n\") {\n\t\t\tif (tabstop == null) tabstop = 0;\n\t\t\tvar _tabstop = tabstop;\n\t\t\tout.indentation = function (start) {\n\t\t\t\treturn _tabstop;\n\t\t\t};\n\t\t\ttabstop = null;\n\t\t} else {\n\t\t\t// if the variable is in function call position,\n\t\t\t// change it to a \"site\"\n\t\t\tif (out.type == \"variable\") {\n\t\t\t\tstartLooking();\n var tmp;\n\t\t\t\tdo {\n\t\t\t\t\ttmp = look();\n\t\t\t\t\tif (!tmp) break;\n\t\t\t\t\tif (tmp.type == \"(\" || tmp.type == \"[\") {\n\t\t\t\t\t\tout.style = \"site\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} while (tmp.type == \"whitespace\");\n\t\t\t}\n\t\t\t// if no tabstop has been set yet, use the\n\t\t\t// length of the first whitespace token\n\t\t\tif (tabstop == null) {\n\t\t\t\tif (out.type == \"whitespace\") {\n\t\t\t\t\ttabstop = out.value.length;\n\t\t\t\t} else {\n\t\t\t\t\ttabstop = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tinWhitespace = (out.type == \"whitespace\");\n\t\treturn out;\n\t}", "_tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n var input = this._input,\n outputComments = this._comments;\n\n while (true) {\n // Count and skip whitespace lines\n var whiteSpaceMatch, comment;\n\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (outputComments && (comment = this._comment.exec(whiteSpaceMatch[0]))) callback(null, {\n line: this._line,\n type: 'comment',\n value: comment[1],\n prefix: ''\n }); // Advance the input\n\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n this._line++;\n } // Skip whitespace on current line\n\n\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input))) input = input.substr(whiteSpaceMatch[0].length, input.length); // Stop for now if we're at the end\n\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (outputComments && (comment = this._comment.exec(input))) callback(null, {\n line: this._line,\n type: 'comment',\n value: comment[1],\n prefix: ''\n });\n callback(input = null, {\n line: this._line,\n type: 'eof',\n value: '',\n prefix: ''\n });\n }\n\n return this._input = input;\n } // Look for specific token types based on the first character\n\n\n var line = this._line,\n type = '',\n value = '',\n prefix = '',\n firstChar = input[0],\n match = null,\n matchLength = 0,\n inconclusive = false;\n\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^<IRI> and ^^pre:fixed\n if (input.length < 3) break; // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^'; // Move to type IRI or prefixed name\n\n input = input.substr(2);\n\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n } // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n\n break;\n }\n // Fall through in case the type is an IRI\n\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input)) type = 'IRI', value = match[1]; // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value)) return reportSyntaxError(this);\n type = 'IRI';\n } // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=') type = 'inverse', matchLength = 2, value = '>';\n break;\n\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) || inputFinished && (match = this._blank.exec(input + ' '))) type = 'blank', prefix = '_', value = match[1];\n break;\n\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input)) value = match[1]; // Try to find a literal wrapped in three pairs of quotes\n else {\n ({\n value,\n matchLength\n } = this._parseLiteral(input));\n if (value === null) return reportSyntaxError(this);\n }\n\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n\n break;\n\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input)) value = match[1]; // Try to find a literal wrapped in three pairs of quotes\n else {\n ({\n value,\n matchLength\n } = this._parseLiteral(input));\n if (value === null) return reportSyntaxError(this);\n }\n\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n\n break;\n\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input))) type = 'var', value = match[0];\n break;\n\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input))) type = 'langcode', value = match[1]; // Try to find a keyword\n else if (match = this._keyword.exec(input)) type = match[0];\n break;\n\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : input[1] < '0' || input[1] > '9') {\n type = '.';\n matchLength = 1;\n break;\n }\n\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) || inputFinished && (match = this._number.exec(input + ' '))) {\n type = 'literal', value = match[0];\n prefix = match[1] ? xsd.double : /^[+\\-]?\\d+$/.test(match[0]) ? xsd.integer : xsd.decimal;\n }\n\n break;\n\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input)) type = match[0].toUpperCase();else inconclusive = true;\n break;\n\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input)) type = 'literal', value = match[0], prefix = xsd.boolean;else inconclusive = true;\n break;\n\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input)) type = 'abbreviation', value = 'a';else inconclusive = true;\n break;\n\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>') matchLength = 1, value = '=';else matchLength = 2, value = '>';\n }\n\n break;\n\n case '!':\n if (!this._n3Mode) break;\n\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '{':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n\n break;\n\n default:\n inconclusive = true;\n } // Some first characters do not allow an immediate decision, so inspect more\n\n\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') && (match = this._prefix.exec(input))) type = 'prefix', value = match[1] || ''; // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) || inputFinished && (match = this._prefixed.exec(input + ' '))) type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n } // A type token is special: it can only be emitted after an IRI or prefixed name is read\n\n\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed':\n type = 'type';\n break;\n\n case 'IRI':\n type = 'typeIRI';\n break;\n\n default:\n type = '';\n }\n } // What if nothing of the above was found?\n\n\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || !/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)) return reportSyntaxError(this);else return this._input = input;\n } // Emit the parsed token\n\n\n var token = {\n line: line,\n type: type,\n value: value,\n prefix: prefix\n };\n callback(null, token);\n this.previousToken = token;\n this._previousMarker = type; // Advance to next part to tokenize\n\n input = input.substr(matchLength || match[0].length, input.length);\n } // Signals the syntax error through the callback\n\n\n function reportSyntaxError(self) {\n callback(self._syntaxError(/^\\S*/.exec(input)[0]));\n }\n }", "next() {\n for (let off = this.matchPos - this.curLineStart;;) {\n this.re.lastIndex = off;\n let match = this.matchPos <= this.to && this.re.exec(this.curLine);\n if (match) {\n let from = this.curLineStart + match.index, to = from + match[0].length;\n this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));\n if (from == this.curLineStart + this.curLine.length)\n this.nextLine();\n if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {\n this.value = { from, to, match };\n return this;\n }\n off = this.matchPos - this.curLineStart;\n }\n else if (this.curLineStart + this.curLine.length < this.to) {\n this.nextLine();\n off = 0;\n }\n else {\n this.done = true;\n return this;\n }\n }\n }", "_tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n let input = this._input;\n let currentLineLength = input.length;\n while (true) {\n // Count and skip whitespace lines\n let whiteSpaceMatch, comment;\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0]))) emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);\n // Advance the input\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n currentLineLength = input.length;\n this._line++;\n }\n // Skip whitespace on current line\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input))) input = input.substr(whiteSpaceMatch[0].length, input.length);\n\n // Stop for now if we're at the end\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (this._comments && (comment = this._comment.exec(input))) emitToken('comment', comment[1], '', this._line, input.length);\n input = null;\n emitToken('eof', '', '', this._line, 0);\n }\n return this._input = input;\n }\n\n // Look for specific token types based on the first character\n const line = this._line,\n firstChar = input[0];\n let type = '',\n value = '',\n prefix = '',\n match = null,\n matchLength = 0,\n inconclusive = false;\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^<IRI> and ^^pre:fixed\n if (input.length < 3) break;\n // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^';\n // Move to type IRI or prefixed name\n input = input.substr(2);\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n }\n // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n break;\n }\n // Fall through in case the type is an IRI\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input)) type = 'IRI', value = match[1];\n // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value)) return reportSyntaxError(this);\n type = 'IRI';\n }\n // Try to find a nested triple\n else if (input.length > 1 && input[1] === '<') type = '<<', matchLength = 2;\n // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=') type = 'inverse', matchLength = 2, value = '>';\n break;\n case '>':\n if (input.length > 1 && input[1] === '>') type = '>>', matchLength = 2;\n break;\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) || inputFinished && (match = this._blank.exec(`${input} `))) type = 'blank', prefix = '_', value = match[1];\n break;\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input)) value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({\n value,\n matchLength\n } = this._parseLiteral(input));\n if (value === null) return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n break;\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input)) value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({\n value,\n matchLength\n } = this._parseLiteral(input));\n if (value === null) return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n break;\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input))) type = 'var', value = match[0];\n break;\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input))) type = 'langcode', value = match[1];\n // Try to find a keyword\n else if (match = this._keyword.exec(input)) type = match[0];\n break;\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : input[1] < '0' || input[1] > '9') {\n type = '.';\n matchLength = 1;\n break;\n }\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) || inputFinished && (match = this._number.exec(`${input} `))) {\n type = 'literal', value = match[0];\n prefix = typeof match[1] === 'string' ? xsd.double : typeof match[2] === 'string' ? xsd.decimal : xsd.integer;\n }\n break;\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input)) type = match[0].toUpperCase();else inconclusive = true;\n break;\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input)) type = 'literal', value = match[0], prefix = xsd.boolean;else inconclusive = true;\n break;\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input)) type = 'abbreviation', value = 'a';else inconclusive = true;\n break;\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>') matchLength = 1, value = '=';else matchLength = 2, value = '>';\n }\n break;\n case '!':\n if (!this._n3Mode) break;\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '{':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n break;\n default:\n inconclusive = true;\n }\n\n // Some first characters do not allow an immediate decision, so inspect more\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') && (match = this._prefix.exec(input))) type = 'prefix', value = match[1] || '';\n // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) || inputFinished && (match = this._prefixed.exec(`${input} `))) type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n }\n\n // A type token is special: it can only be emitted after an IRI or prefixed name is read\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed':\n type = 'type';\n break;\n case 'IRI':\n type = 'typeIRI';\n break;\n default:\n type = '';\n }\n }\n\n // What if nothing of the above was found?\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || !/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)) return reportSyntaxError(this);else return this._input = input;\n }\n\n // Emit the parsed token\n const length = matchLength || match[0].length;\n const token = emitToken(type, value, prefix, line, length);\n this.previousToken = token;\n this._previousMarker = type;\n\n // Advance to next part to tokenize\n input = input.substr(length, input.length);\n }\n\n // Emits the token through the callback\n function emitToken(type, value, prefix, line, length) {\n const start = input ? currentLineLength - input.length : currentLineLength;\n const end = start + length;\n const token = {\n type,\n value,\n prefix,\n line,\n start,\n end\n };\n callback(null, token);\n return token;\n }\n // Signals the syntax error through the callback\n function reportSyntaxError(self) {\n callback(self._syntaxError(/^\\S*/.exec(input)[0]));\n }\n }", "next() {\n while(this.pos < this.src.length) {\n let c = this.src.charAt(this.pos);\n switch(c) {\n case \" \": case \"\\r\": case \"\\b\": case \"\\t\":\n ++this.pos;\n ++this.posCount;\n break;\n case \"\\n\":\n ++this.pos;\n ++this.posLine;\n this.posCount = 1;\n break;\n case \"#\":\n this._lexComment(); break;\n case \"=\": return this._yield(Token.tkAssign,1,1);\n case \"+\": return this._yield(Token.tkAdd,1,1);\n case \"-\": return this._yield(Token.tkSub,1,1);\n case \"*\": return this._yield(Token.tkMul,1,1);\n case \"(\": return this._yield(Token.tkLPar,1,1);\n case \")\": return this._yield(Token.tkRPar,1,1);\n case \"{\": return this._yield(Token.tkLBra,1,1);\n case \"}\": return this._yield(Token.tkRBra,1,1);\n case \"[\": return this._yield(Token.tkLSqr,1,1);\n case \"]\": return this._yield(Token.tkRSqr,1,1);\n case \";\": return this._yield(Token.tkSemicolon,1,1);\n case \",\": return this._yield(Token.tkComma,1,1);\n case \"0\": case \"1\": case \"2\": case \"3\": case \"4\":\n case \"5\": case \"6\": case \"7\": case \"8\": case \"9\":\n return this._lexNumber(c);\n default:\n return this._lexVar(c);\n }\n }\n\n return this._yield(Token.tkEof,0,0);\n }", "findToken() {\n let t;\n if(this.peekTokens.length) {\n return this.peekedToken();\n }\n do {\n t = this.nextToken();\n } while(!t);\n return t;\n }", "function makeRegexParser(regex) {\n return regex.exec;\n}", "function token() {\n if (re.lastIndex >= text.length) return EOF; // special case: end of file\n if (eol) { eol = false; return EOL; } // special case: end of line\n\n // special case: quotes\n var j = re.lastIndex;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < text.length) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n i++;\n }\n }\n re.lastIndex = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) re.lastIndex++;\n } else if (c === 10) {\n eol = true;\n }\n return text.substring(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case\n var m = re.exec(text);\n if (m) {\n eol = m[0].charCodeAt(0) !== 44;\n return text.substring(j, m.index);\n }\n re.lastIndex = text.length;\n return text.substring(j);\n }", "function readTokenToBuffer() {\n\t\t\t// init local variables\n\t\t\tvar startPos, matchPos, matchStr, match, length;\n\n\t\t\tfor (;;) if (tokenRegExp.lastIndex !== inputLength) {\n\t\t\t\tstartPos = tokenRegExp.lastIndex;\n\t\t\t\tif (match = tokenRegExp.exec(inputString)) {\n\t\t\t\t\tmatchStr = match[0], matchPos = match.index;\n\n\t\t\t\t\t// check if we have T_ERR token\n\t\t\t\t\tif (length = matchPos - startPos) {\n\t\t\t\t\t\ttokenBuffer.push({\n\t\t\t\t\t\t\ttype: T_ERR,\n\t\t\t\t\t\t\tpos: startPos,\n\t\t\t\t\t\t\tvalue: inputString.substr(startPos, length)\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tlength = match.length;\n\n\t\t\t\t\t// find matched group index\n\t\t\t\t\twhile (match[length--] === undefined);\n\n\t\t\t\t\t// obtain token info\n\t\t\t\t\tmatch = tokenIds[length];\n\t\t\t\t\t// match next token in case if this one is ignored\n\t\t\t\t\tif (match === IGNORE_START) continue;\n\t\t\t\t\t// return matched token\n\t\t\t\t\treturn tokenBuffer.push({\n\t\t\t\t\t\ttype: match,\n\t\t\t\t\t\tpos: matchPos,\n\t\t\t\t\t\tvalue: matchStr\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// return T_ERR token in case if we couldn't match anything\n\t\t\t\telse return (\n\t\t\t\t\ttokenRegExp.lastIndex = inputLength,\n\t\t\t\t\ttokenBuffer.push({\n\t\t\t\t\t\ttype: T_ERR,\n\t\t\t\t\t\tpos: startPos,\n\t\t\t\t\t\tvalue: inputString.slice(startPos)\n\t\t\t\t\t})\n\t\t\t\t);\n\n\t\t\t}\n\t\t\t// return T_EOF if we reached end of file\n\t\t\telse return tokenBuffer.push({\n\t\t\t\ttype: T_EOF,\n\t\t\t\tpos: inputLength\n\t\t\t});\n\t\t}", "obtain() {\n if(this.start>=this.end) return null\n var c = this.input.get(this.start)\n var opt = []\n var error = []\n for( var x in this.lexeme ) {\n var l = this.lexeme[x]\n if(l.startsWith(c)) {\n var t = l.match(this.input, this.start, this.end)\n if(t.isError()) error.push(t)\n else opt.push(t)\n }\n }\n if( opt.length > 0 ) {\n this.current = opt[0]\n for( var i=1; i<opt.length; i++ ) {\n var e2 = opt[i]\n if(e2.size()>this.current.size() || \n (e2.size()==this.current.size() && \n this.priority[e2.type]>this.priority[this.current.type])) \n this.current = e2;\n }\n }else {\n if(error.length>0) {\n this.current = error[0]\n for( var i=1; i<error.length; i++ ) {\n e2 = error[i]\n if(e2.size()>this.current.size()) this.current = e2\n }\n }else {\n this.current = new Token(this.input, this.start, this.start+1, c)\n }\n }\n this.start = this.current.end\n return this.current\n }", "function regex(type, regex) {\n var flags = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];\n\n var massagedRegex = new RegExp(/^/.source + regex.source, flags);\n\n return function (previousTokens, charStream) {\n var match;\n if (match = charStream.rest().match(massagedRegex)) {\n return LexerResponse([charStream.Token(type, match[0])], charStream.advance(match[0].length));\n } else {\n return null;\n }\n };\n}", "function scan(s, tokenSet) {\n var tokenNames = Object.keys(tokenSet)\n for(var i=0; i<tokenNames.length;i++){\n var currentToken = tokenNames[i];\n var regexDef = tokens[currentToken];\n var match = regexDef.exec(s);\n if (match) {\n var regexFound = {name: tokenName, value: match[0]};\n return regexFound;\n }\n }\n return null;\n}", "match(input) {\n var c = input.current()\n if(!this.startsWith(c)) return this.error(input, input.pos)\n var pos = input.pos\n if(c=='-' && input.next()!='[') return this.error(input, pos)\n\n input.next()\n \n while(this.match_range(input) || this.match_one(input) || this.match_category(input)) {\n c = input.current()\n switch(c) {\n case ']':\n input.next()\n return this.token(input,pos,input.substring(pos, input.pos))\n case '|':\n input.next()\n break;\n default: return this.error(input, input.pos)\n }\n }\n return this.error(input, input.pos)\n }", "get_token() {\n // If no strings, return null\n let len = this.input_string_stack.length\n if (len == 0) return null\n\n // Get the top of the input_string stack\n let input_string = this.input_string_stack[len-1]\n if (input_string == '') return null\n\n let match = null\n let result = null\n\n if (match = input_string.match(/^(-?\\d+\\.\\d*)(.*)/)) {\n input_string = match[2].trim()\n result = {type: 'D', value: match[1]}\n }\n else if (match = input_string.match(/^(-?\\d+)(.*)/)) {\n input_string = match[2].trim()\n result = {type: 'I', value: match[1]}\n }\n else if (match = input_string.match(/^\"([^\"]*)\"(.*)/)) {\n input_string = match[2].trim()\n result = {type: 'S', value: match[1]}\n }\n else if (match = input_string.match(/^(\\S+)(.*)/)) {\n input_string = match[2].trim()\n result = {type: 'W', value: match[1]}\n }\n\n // Replace top of stack with new string\n this.input_string_stack[len-1] = input_string\n return result\n }", "function token() {\n if (re.lastIndex >= text.length) return EOF; // special case: end of file\n if (eol) { eol = false; return EOL; } // special case: end of line\n\n // special case: quotes\n var j = re.lastIndex;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < text.length) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n i++;\n }\n }\n re.lastIndex = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) re.lastIndex++;\n } else if (c === 10) {\n eol = true;\n }\n return text.substring(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case\n var m = re.exec(text);\n if (m) {\n eol = m[0].charCodeAt(0) !== 44;\n return text.substring(j, m.index);\n }\n re.lastIndex = text.length;\n return text.substring(j);\n }", "function token() {\n if (re.lastIndex >= text.length) return EOF; // special case: end of file\n if (eol) { eol = false; return EOL; } // special case: end of line\n\n // special case: quotes\n var j = re.lastIndex;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < text.length) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n i++;\n }\n }\n re.lastIndex = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) re.lastIndex++;\n } else if (c === 10) {\n eol = true;\n }\n return text.substring(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case\n var m = re.exec(text);\n if (m) {\n eol = m[0].charCodeAt(0) !== 44;\n return text.substring(j, m.index);\n }\n re.lastIndex = text.length;\n return text.substring(j);\n }", "match(input) {\n var pos = input.pos\n if(this.match_category(input)) return this.token(input,pos,input.substring(pos,input.pos))\n return this.error(input, pos)\n }", "function getToken(state) {\n state.tokenType = TOKENTYPE.NULL;\n state.token = '';\n state.comment = ''; // skip over whitespaces\n // space, tab, and newline when inside parameters\n\n while (parse.isWhitespace(currentCharacter(state), state.nestingLevel)) {\n next(state);\n } // skip comment\n\n\n if (currentCharacter(state) === '#') {\n while (currentCharacter(state) !== '\\n' && currentCharacter(state) !== '') {\n state.comment += currentCharacter(state);\n next(state);\n }\n } // check for end of expression\n\n\n if (currentCharacter(state) === '') {\n // token is still empty\n state.tokenType = TOKENTYPE.DELIMITER;\n return;\n } // check for new line character\n\n\n if (currentCharacter(state) === '\\n' && !state.nestingLevel) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = currentCharacter(state);\n next(state);\n return;\n }\n\n var c1 = currentCharacter(state);\n var c2 = currentString(state, 2);\n var c3 = currentString(state, 3);\n\n if (c3.length === 3 && DELIMITERS[c3]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c3;\n next(state);\n next(state);\n next(state);\n return;\n } // check for delimiters consisting of 2 characters\n\n\n if (c2.length === 2 && DELIMITERS[c2]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c2;\n next(state);\n next(state);\n return;\n } // check for delimiters consisting of 1 character\n\n\n if (DELIMITERS[c1]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c1;\n next(state);\n return;\n } // check for a number\n\n\n if (parse.isDigitDot(c1)) {\n state.tokenType = TOKENTYPE.NUMBER; // get number, can have a single dot\n\n if (currentCharacter(state) === '.') {\n state.token += currentCharacter(state);\n next(state);\n\n if (!parse.isDigit(currentCharacter(state))) {\n // this is no number, it is just a dot (can be dot notation)\n state.tokenType = TOKENTYPE.DELIMITER;\n }\n } else {\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n } // check for exponential notation like \"2.3e-4\", \"1.23e50\" or \"2e+4\"\n\n\n if (currentCharacter(state) === 'E' || currentCharacter(state) === 'e') {\n if (parse.isDigit(nextCharacter(state)) || nextCharacter(state) === '-' || nextCharacter(state) === '+') {\n state.token += currentCharacter(state);\n next(state);\n\n if (currentCharacter(state) === '+' || currentCharacter(state) === '-') {\n state.token += currentCharacter(state);\n next(state);\n } // Scientific notation MUST be followed by an exponent\n\n\n if (!parse.isDigit(currentCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n } else if (nextCharacter(state) === '.') {\n next(state);\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n }\n\n return;\n } // check for variables, functions, named operators\n\n\n if (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) {\n while (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if ((0, _object.hasOwnProperty)(NAMED_DELIMITERS, state.token)) {\n state.tokenType = TOKENTYPE.DELIMITER;\n } else {\n state.tokenType = TOKENTYPE.SYMBOL;\n }\n\n return;\n } // something unknown is found, wrong characters -> a syntax error\n\n\n state.tokenType = TOKENTYPE.UNKNOWN;\n\n while (currentCharacter(state) !== '') {\n state.token += currentCharacter(state);\n next(state);\n }\n\n throw createSyntaxError(state, 'Syntax error in part \"' + state.token + '\"');\n }", "function getToken(state) {\n state.tokenType = TOKENTYPE.NULL;\n state.token = '';\n state.comment = ''; // skip over whitespaces\n // space, tab, and newline when inside parameters\n\n while (parse.isWhitespace(currentCharacter(state), state.nestingLevel)) {\n next(state);\n } // skip comment\n\n\n if (currentCharacter(state) === '#') {\n while (currentCharacter(state) !== '\\n' && currentCharacter(state) !== '') {\n state.comment += currentCharacter(state);\n next(state);\n }\n } // check for end of expression\n\n\n if (currentCharacter(state) === '') {\n // token is still empty\n state.tokenType = TOKENTYPE.DELIMITER;\n return;\n } // check for new line character\n\n\n if (currentCharacter(state) === '\\n' && !state.nestingLevel) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = currentCharacter(state);\n next(state);\n return;\n }\n\n var c1 = currentCharacter(state);\n var c2 = currentString(state, 2);\n var c3 = currentString(state, 3);\n\n if (c3.length === 3 && DELIMITERS[c3]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c3;\n next(state);\n next(state);\n next(state);\n return;\n } // check for delimiters consisting of 2 characters\n\n\n if (c2.length === 2 && DELIMITERS[c2]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c2;\n next(state);\n next(state);\n return;\n } // check for delimiters consisting of 1 character\n\n\n if (DELIMITERS[c1]) {\n state.tokenType = TOKENTYPE.DELIMITER;\n state.token = c1;\n next(state);\n return;\n } // check for a number\n\n\n if (parse.isDigitDot(c1)) {\n state.tokenType = TOKENTYPE.NUMBER; // get number, can have a single dot\n\n if (currentCharacter(state) === '.') {\n state.token += currentCharacter(state);\n next(state);\n\n if (!parse.isDigit(currentCharacter(state))) {\n // this is no number, it is just a dot (can be dot notation)\n state.tokenType = TOKENTYPE.DELIMITER;\n }\n } else {\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n } // check for exponential notation like \"2.3e-4\", \"1.23e50\" or \"2e+4\"\n\n\n if (currentCharacter(state) === 'E' || currentCharacter(state) === 'e') {\n if (parse.isDigit(nextCharacter(state)) || nextCharacter(state) === '-' || nextCharacter(state) === '+') {\n state.token += currentCharacter(state);\n next(state);\n\n if (currentCharacter(state) === '+' || currentCharacter(state) === '-') {\n state.token += currentCharacter(state);\n next(state);\n } // Scientific notation MUST be followed by an exponent\n\n\n if (!parse.isDigit(currentCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n } else if (nextCharacter(state) === '.') {\n next(state);\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"');\n }\n }\n\n return;\n } // check for variables, functions, named operators\n\n\n if (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) {\n while (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state);\n next(state);\n }\n\n if (NAMED_DELIMITERS.hasOwnProperty(state.token)) {\n state.tokenType = TOKENTYPE.DELIMITER;\n } else {\n state.tokenType = TOKENTYPE.SYMBOL;\n }\n\n return;\n } // something unknown is found, wrong characters -> a syntax error\n\n\n state.tokenType = TOKENTYPE.UNKNOWN;\n\n while (currentCharacter(state) !== '') {\n state.token += currentCharacter(state);\n next(state);\n }\n\n throw createSyntaxError(state, 'Syntax error in part \"' + state.token + '\"');\n }", "readNextToken() {\n let ss = this.ss;\n if (ss.eof())\n throw new assert_1.AssertError(\"Already EOF\");\n // comments\n if (streamAtComment(ss)) {\n this.readComment();\n return;\n }\n // whitespace\n if (streamAtLineWhiteSpace(ss)) {\n this.readLineWhiteSpace();\n return;\n }\n if (streamAtNewLine(ss)) {\n this.readNewLine();\n return;\n }\n // interpolated strings or string literals\n if (streamAtDoubleQuoteOrBacktick(ss)) {\n this.readString();\n return;\n }\n // parenthesis handling within string interpolation\n if (this.currParenthesisLevel > 0) {\n let pointStart = ss.currPoint();\n let c = ss.peek();\n if (c === \"(\") {\n ss.read();\n this.currParenthesisLevel++;\n let rng = new Token_2.Range(pointStart, ss.currPoint());\n this.tokens.push(new Token_1.Token(c, operatorsAndKeywords_8.TokenType.Bracket, rng));\n return;\n }\n if (c === \")\") {\n ss.read();\n this.currParenthesisLevel--;\n let rng = new Token_2.Range(pointStart, ss.currPoint());\n this.tokens.push(new Token_1.Token(c, operatorsAndKeywords_8.TokenType.Bracket, rng));\n return;\n }\n }\n // must handle transpose op before char literal\n if (this.streamAtTransposeOperator(ss)) {\n this.readTransposeOperator();\n return;\n }\n if (streamAtSingleQuote(ss)) {\n this.readCharLiteral();\n return;\n }\n // symbols\n // eg :foo\n // must be handled before operators, as ':' is also an operator\n // doesn't handle quoting, ie :(a+b)\n if (this.streamAtSymbol()) {\n this.readSymbol();\n return;\n }\n // operators\n // must process before identifiers because ÷ is considered a valid UTF8 char to start an identifier\n if (streamAtOperator(ss)) {\n this.readOperator();\n return;\n }\n // keywords and identifiers\n if (streamAtIdentifier(ss)) {\n this.readIdentifier();\n return;\n }\n // macro invocations\n if (streamAtMacroInvocation(ss)) {\n this.readMacroInvocation();\n return;\n }\n // numbers\n if (streamAtNumber(ss)) {\n this.readNumber();\n return;\n }\n if (streamAtBracket(ss)) {\n this.readBracket();\n return;\n }\n if (streamAtSemicolon(ss)) {\n this.readSemicolon();\n return;\n }\n let c = ss.read();\n throw new errors_1.InvalidParseError(\"Unexpected character: '\" + c + \"'. Context: '\" + ss.getContext() + \"'.\", new Token_1.Token(c, operatorsAndKeywords_8.TokenType.Identifier, new Token_2.Range(ss.prevPoint(), ss.currPoint())));\n }", "function getTokenizedExp(token, flag){\n var p = token + \"$\" + flag;\n return Exps[p] || (Exps[p] = RegExp(\"(?:^|\\\\s)\"+token+\"(?:$|\\\\s)\", flag));\n }", "function token() {\n if (re.lastIndex >= text.length) return EOF; // special case: end of file\n if (eol) {\n eol = false;\n return EOL;\n } // special case: end of line\n\n // special case: quotes\n var j = re.lastIndex;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < text.length) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n i++;\n }\n }\n re.lastIndex = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) re.lastIndex++;\n } else if (c === 10) {\n eol = true;\n }\n return text.substring(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case\n var m = re.exec(text);\n if (m) {\n eol = m[0].charCodeAt(0) !== 44;\n return text.substring(j, m.index);\n }\n re.lastIndex = text.length;\n return text.substring(j);\n }", "function amIMultiChar(forward, newToken, inputText){\n\ttempVar = '';\n\tstate = 0;\n\tvar runMultiCheck = true;\n\n\twhile (runMultiCheck){\n\t\tswitch(state){\n\t\t\tcase 0:\n\t\t\t\tif((inputText[forward]).search(T_char) != -1){\n\t\t\t\t\ttempVar += inputText[forward];\n\t\t\t\t\tforward++;\n\t\t\t\t\tstate = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}//closes if\n\t\t\t\telse{\n\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}//closes else\n\t\t\tcase 1:\n\t\t\t\tif(inputText[forward] == undefined){\n\t\t\t\t\tvar tokenid = new newToken(tempVar, \"identifier\", currLineNum);\n\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\ttokenHole = [];\n\t\t\t\t\tamIToken = true;\n\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if((inputText[forward]).search(T_char) != -1){\n\t\t\t\t\ttempVar += inputText[forward];\n\t\t\t\t\tforward++;\n\t\t\t\t\tstate = 2;\n\t\t\t\t\tbreak;\n\t\t\t\t\t//put if check here because if we go further its looking for more than 2 char\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar tokenid = new newToken(tempVar, \"identifier\", currLineNum);\n\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\ttokenHole = [];\n\t\t\t\t\tamIToken = true;\n\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\tbreak;\n\t\t\t\t} //this still needs a space at the end\n\t\t\t\tcase 2:\n\t\t\t\t\tif (tempVar == 'if'){\n\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"if\", currLineNum);\n\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}//closes if\n\t\t\t\t\telse if ((inputText[forward]).search(T_char) != -1) {\n\t\t\t\t\ttempVar += inputText[forward];\n\t\t\t\t\t\tif (tempVar == 'int'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"int\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'true'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"true\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'false'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"false\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'print'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"print\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'while'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"while\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token: \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'string'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"string\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token ---> \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (tempVar == 'boolean'){\n\t\t\t\t\t\t\tlexmemeBegin = forward;\n\t\t\t\t\t\t\tvar tokenid = new newToken(tempVar, \"boolean\", currLineNum);\n\t\t\t\t\t\t\ttokenHole.push(tokenid.desc, tokenid.type, tokenid.currLineNum);\n\t\t\t\t\t\t\ttokenParse.push([tokenid.desc, tokenid.type, tokenid.currLineNum]);\n\t\t\t\t\t\t\tconsole.log(\"Found Token ---> \" + tokenHole[1] + \" \" + tokenHole[0]);\n\t\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Lexer: \" + tokenHole[1] + \" --> \" + tokenHole[0] + \"\\n\";\n\t\t\t\t\t\t\ttokenHole = [];\n\t\t\t\t\t\t\tamIToken = true;\n\t\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tforward++;\n\t\t\t\t\t\t\tstate = 2; //This will loop us back to continue looking for miltichar\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tdocument.getElementById(\"outputText\").value += \"Look at me I turned myself into an unrecognised token! UNRECOGNISED TOKEN!\" + \"\\n\"\n\t\t\t\t\t\tconsole.log('Look at me I turned myself into a pickle! Pickle Rick!');//token failure\n\t\t\t\t\t\tamIToken = false;\n\t\t\t\t\t\trunMultiCheck = false;\n\t\t\t\t\t\t//add a stop function here to kill lex\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t}//closes switch statement\n\t}//closes while\n}//closes function amIMultiChar", "function consume(x){if(x.includes(token.t))return token=tokens[i++]}", "function next_Token()\n{\n\n if (this.tokensReturned >= this.tokens.length)\n {\n return null;\n } // end if\n else\n {\n return this.tokens [this.tokensReturned ++];\n } // end else\n\n\n}", "next() {\n this.m_token = this.yylex();\n if (this.m_token === Token.Error) {\n throw new Error(`unexpected character ${this.m_char}`);\n }\n return this.m_token;\n }", "firstToken({token, counter}) {\n\t\t// Invalidade any dict ending in: [ ( .\n\t\tif (token.value === null) {\n\t\t\tconst lastToken = this.listener.currentTokens[this.listener.currentTokens.length -1];\n\t\t\tconst second = token;\n\t\t\tif (lastToken.value === '(' || lastToken.value === '[' || lastToken.value === '.') {\n\t\t\t\tthis.listener.nextPattern({syntax: 'invalid', token: token, counter: counter});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// The open char of the current node\n\t\tthis.currentOpenChar = this.listener.currentTokens[this.listener.currentTokens.length - 1].value;\n\t\tif (this.currentOpenChar === '(') {\n\t\t\t// Is a simple function without parameters\n\t\t\tif (token.value === ')') {\n\t\t\t\tthis.listener.checking = 'endToken';\n\t\t\t\treturn true;\n\t\t\t// Collect the function parameters and go to middleTokens\n\t\t\t} else if (['blank', 'end', 'letter', 'number', 'especial', 'NOT', 'NOT-NOT', 'quote', 'undefined'].includes(token.name) || (token.value === '-' || token.value === '+')) {\n\t\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\t\tthis.currentParams = this.currentParams + token.value;\n\t\t\t\tif (this.currentParamsCounter === null) {\n\t\t\t\t\tthis.currentParamsCounter = counter || null;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} else if (['(', '[', '{'].includes(token.value)) {\n\t\t\t\tthis.innerOpenedObjects = this.innerOpenedObjects + 1;\n\t\t\t\tthis.currentParams = this.currentParams + token.value;\n\t\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\t\tif (this.currentParamsCounter === null) {\n\t\t\t\t\tthis.currentParamsCounter = counter || null;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\t// Invalid!\n\t\t\t\tthis.invalid = true;\n\t\t\t\t// wait for some blank or end token and register the current stream as invalid\n\t\t\t\tthis.listener.checking = 'endToken';\n\t\t\t\treturn true;\n\t\t\t}\n\t\t// If is a bracket or dot dictionary\n\t\t} else if ((this.currentOpenChar === '[' || this.currentOpenChar === '.') && (token.name !== 'separator' || token.value === '(')) {\n\t\t\t// When a bracket dict is detect we already have the first node and the open bracket\n\t\t\t// Get the node label without the bracket and convert it to STRING to create the first node\n\t\t\t// If bracket or dot are detected from DictPattern it may come with a single bracket or dot as\n\t\t\t// currentLabel, in that case with don't want manually create a dict node now\n\t\t\tif (this.listener.currentLabel !== '.' && this.listener.currentLabel !== '[') {\n\t\t\t\tthis.listener.firstNodeLabel = this.listener.currentLabel;\n\t\t\t\tthis.currentParams = `\"${this.listener.currentLabel.slice(0, this.listener.currentLabel.length - 1)}\"`;\n\t\t\t\t// MANUALLY CREATE THE DICTIONAY NODE\n\t\t\t\tthis.createDictionaryNode({token: token, counter: counter});\n\t\t\t\t// Variable name can't start with a number\n\t\t\t\tif (this.currentOpenChar === '.' && token.name === 'number') {\n\t\t\t\t\t// this.listener.nextPattern({syntax: 'invalid', token: token, counter: counter});\n\t\t\t\t\t// return false;\n\t\t\t\t\tthis.invalid = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.listener.checking = 'middleTokens';\n\t\t\t}\n\n\t\t\t// After create the first node set to collect the params inside the brackets to create the second node with it\n\t\t\tthis.currentParams = this.currentParams + token.value;\n\t\t\tif (this.currentParamsCounter === null) {\n\t\t\t\tthis.currentParamsCounter = counter || null;\n\t\t\t}\n\t\t\treturn true;\n\t\t} else if (token.name === 'dot' || token.name === 'separator') {\n\t\t\t// Invalid!\n\t\t\tthis.invalid = true;\n\t\t\t// wait for some blank or end token and register the current stream as invalid\n\t\t\tthis.listener.checking = 'endToken';\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function token2(r) {\n\t\tfor (var j = 0; j < r.length; j++) {\n\t\t\tif (r[j].match(srr[0], \"g\") && r[j].match(srr[1], \"g\")) {\n\t\t\t\t$('<p>').html(r[j]).appendTo(\"#demo-1\");\n\t\t\t\tscnt++;\n\t\t\t}\n\t\t}\n\t\tsearchql = true;\n\t\thlsSyntax(srr[0]);hlsSyntax(srr[1]);\n\t\tresultCall();\n\t}", "function readRegExp ( startToken )\n{\n if ( startToken === Token.ASSIGN_DIV ) {\n // Miss-scanned /=\n stringBuffer = [\"/=\"];\n } else if ( startToken !== Token.DIV ) {\n stringBuffer = [\"/\"];\n } else {\n Kit.codeBug();\n }\n\n var c;\n while ( (c = this.getChar()) !== '/' ) {\n if ( c === '\\n' || c === EOF_CHAR ) {\n this.ungetChar(c);\n throw this.parser.reportError(\"msg.unterminated.re.lit\");\n }\n if ( c === '\\\\' ) {\n this.addToString(c);\n c = this.getChar();\n }\n this.addToString(c);\n }\n this.addToString(\"/\");\n\n while ( isIdentifierPart(c = this.getChar()) ) {\n this.addToString(c);\n }\n this.ungetChar(c);\n\n this.string = this.getStringFromBuffer();\n}", "getNext() {\n let token;\n if (this.currentToken < this.tokens.length){\n token = this.tokens[this.currentToken];\n this.currentToken++;\n }\n else\n token = \"NULLTOKEN\";\n return token;\n }", "function getToken() {\n token_type = TOKENTYPE.NULL;\n token = '';\n comment = '';\n\n // skip over whitespaces\n // space, tab, and newline when inside parameters\n while (parse.isWhitespace(c, nesting_level)) {\n next();\n }\n\n // skip comment\n if (c == '#') {\n while (c != '\\n' && c != '') {\n comment += c;\n next();\n }\n }\n\n // check for end of expression\n if (c == '') {\n // token is still empty\n token_type = TOKENTYPE.DELIMITER;\n return;\n }\n\n // check for new line character\n if (c == '\\n' && !nesting_level) {\n token_type = TOKENTYPE.DELIMITER;\n token = c;\n next();\n return;\n }\n\n // check for delimiters consisting of 3 characters\n var c2 = c + nextPreview();\n var c3 = c2 + nextNextPreview();\n if (c3.length == 3 && DELIMITERS[c3]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c3;\n next();\n next();\n next();\n return;\n }\n\n // check for delimiters consisting of 2 characters\n if (c2.length == 2 && DELIMITERS[c2]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c2;\n next();\n next();\n return;\n }\n\n // check for delimiters consisting of 1 character\n if (DELIMITERS[c]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c;\n next();\n return;\n }\n\n // check for a number\n if (parse.isDigitDot(c)) {\n token_type = TOKENTYPE.NUMBER;\n\n // get number, can have a single dot\n if (c == '.') {\n token += c;\n next();\n\n if (!parse.isDigit(c)) {\n // this is no number, it is just a dot (can be dot notation)\n token_type = TOKENTYPE.DELIMITER;\n }\n }\n else {\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n if (parse.isDecimalMark(c, nextPreview())) {\n token += c;\n next();\n }\n }\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n\n // check for exponential notation like \"2.3e-4\", \"1.23e50\" or \"2e+4\"\n c2 = nextPreview();\n if (c == 'E' || c == 'e') {\n if (parse.isDigit(c2) || c2 == '-' || c2 == '+') {\n token += c;\n next();\n\n if (c == '+' || c == '-') {\n token += c;\n next();\n }\n\n // Scientific notation MUST be followed by an exponent\n if (!parse.isDigit(c)) {\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n\n if (parse.isDecimalMark(c, nextPreview())) {\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n }\n else if (c2 == '.') {\n next();\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n }\n\n return;\n }\n\n // check for variables, functions, named operators\n if (parse.isAlpha(c, prevPreview(), nextPreview())) {\n while (parse.isAlpha(c, prevPreview(), nextPreview()) || parse.isDigit(c)) {\n token += c;\n next();\n }\n\n if (NAMED_DELIMITERS.hasOwnProperty(token)) {\n token_type = TOKENTYPE.DELIMITER;\n }\n else {\n token_type = TOKENTYPE.SYMBOL;\n }\n\n return;\n }\n\n // something unknown is found, wrong characters -> a syntax error\n token_type = TOKENTYPE.UNKNOWN;\n while (c != '') {\n token += c;\n next();\n }\n throw createSyntaxError('Syntax error in part \"' + token + '\"');\n }", "next() {\n\t\tif (this.peek() == undefined) {\n\t\t\tthrow new ParserError(\n\t\t\t\t'E0004',\n\t\t\t\t'UnexpectedEOF',\n\t\t\t\t'The file ended, but the last expression wasn\\'t finished yet', \n\t\t\t\tthis.activeToken().position.line, \n\t\t\t\tthis.activeToken().position.column, \n\t\t\t\tthis.activeToken(),\n\t\t\t\tthis.module\n\t\t\t);\n\t\t}\n\n\t\treturn this.tokens[++this.cursor];\n\t}", "function getToken() {\n token_type = TOKENTYPE.NULL;\n token = '';\n comment = '';\n\n // skip over whitespaces\n // space, tab, and newline when inside parameters\n while (parse.isWhitespace(c, nesting_level)) {\n next();\n }\n\n // skip comment\n if (c === '#') {\n while (c !== '\\n' && c !== '') {\n comment += c;\n next();\n }\n }\n\n // check for end of expression\n if (c === '') {\n // token is still empty\n token_type = TOKENTYPE.DELIMITER;\n return;\n }\n\n // check for new line character\n if (c === '\\n' && !nesting_level) {\n token_type = TOKENTYPE.DELIMITER;\n token = c;\n next();\n return;\n }\n\n // check for delimiters consisting of 3 characters\n var c2 = c + nextPreview();\n var c3 = c2 + nextNextPreview();\n if (c3.length === 3 && DELIMITERS[c3]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c3;\n next();\n next();\n next();\n return;\n }\n\n // check for delimiters consisting of 2 characters\n if (c2.length === 2 && DELIMITERS[c2]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c2;\n next();\n next();\n return;\n }\n\n // check for delimiters consisting of 1 character\n if (DELIMITERS[c]) {\n token_type = TOKENTYPE.DELIMITER;\n token = c;\n next();\n return;\n }\n\n // check for a number\n if (parse.isDigitDot(c)) {\n token_type = TOKENTYPE.NUMBER;\n\n // get number, can have a single dot\n if (c === '.') {\n token += c;\n next();\n\n if (!parse.isDigit(c)) {\n // this is no number, it is just a dot (can be dot notation)\n token_type = TOKENTYPE.DELIMITER;\n }\n }\n else {\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n if (parse.isDecimalMark(c, nextPreview())) {\n token += c;\n next();\n }\n }\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n\n // check for exponential notation like \"2.3e-4\", \"1.23e50\" or \"2e+4\"\n c2 = nextPreview();\n if (c === 'E' || c === 'e') {\n if (parse.isDigit(c2) || c2 === '-' || c2 === '+') {\n token += c;\n next();\n\n if (c === '+' || c === '-') {\n token += c;\n next();\n }\n\n // Scientific notation MUST be followed by an exponent\n if (!parse.isDigit(c)) {\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n\n while (parse.isDigit(c)) {\n token += c;\n next();\n }\n\n if (parse.isDecimalMark(c, nextPreview())) {\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n }\n else if (c2 === '.') {\n next();\n throw createSyntaxError('Digit expected, got \"' + c + '\"');\n }\n }\n\n return;\n }\n\n // check for variables, functions, named operators\n if (parse.isAlpha(c, prevPreview(), nextPreview())) {\n while (parse.isAlpha(c, prevPreview(), nextPreview()) || parse.isDigit(c)) {\n token += c;\n next();\n }\n\n if (NAMED_DELIMITERS.hasOwnProperty(token)) {\n token_type = TOKENTYPE.DELIMITER;\n }\n else {\n token_type = TOKENTYPE.SYMBOL;\n }\n\n return;\n }\n\n // something unknown is found, wrong characters -> a syntax error\n token_type = TOKENTYPE.UNKNOWN;\n while (c !== '') {\n token += c;\n next();\n }\n throw createSyntaxError('Syntax error in part \"' + token + '\"');\n }", "tokenizer(token , isEndOfInput , previousTokens , terminal , config){\n }" ]
[ "0.7055736", "0.67469317", "0.6541603", "0.64485", "0.6360168", "0.6360168", "0.63472235", "0.633795", "0.633795", "0.633795", "0.633795", "0.633795", "0.63212526", "0.629326", "0.629326", "0.629326", "0.629326", "0.62760067", "0.6274375", "0.6274375", "0.6274375", "0.6274375", "0.6269811", "0.62537235", "0.6243665", "0.6237245", "0.6232623", "0.6232623", "0.6232623", "0.6232623", "0.622357", "0.622357", "0.622357", "0.622357", "0.622357", "0.622357", "0.6214857", "0.62090313", "0.6201276", "0.6188272", "0.6164654", "0.6143504", "0.6122557", "0.608052", "0.6058247", "0.60467845", "0.60374075", "0.60257196", "0.60202014", "0.60181487", "0.6003575", "0.5999764", "0.5999339", "0.59712416", "0.59685457", "0.5964029", "0.59589714", "0.59548056", "0.59450686", "0.5922951", "0.59158033", "0.58854485", "0.5864047", "0.5863173", "0.58506256", "0.58468264", "0.58283603", "0.5823815", "0.5823815", "0.5816028", "0.58013254", "0.58013254", "0.5786704", "0.57807016", "0.57686603", "0.57577825", "0.57544744", "0.5752054", "0.57340395", "0.57284594", "0.57266843", "0.57150257", "0.5714965", "0.5684695", "0.5673933", "0.5670651", "0.5663466" ]
0.610754
55
function to convert string input to date
function addTimeToArrayFromToken(token, input, config) { var a, datePartArray = config._a; switch (token) { // QUARTER case 'Q': if (input != null) { datePartArray[MONTH] = (toInt(input) - 1) * 3; } break; // MONTH case 'M' : // fall through to MM case 'MM' : if (input != null) { datePartArray[MONTH] = toInt(input) - 1; } break; case 'MMM' : // fall through to MMMM case 'MMMM' : a = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (a != null) { datePartArray[MONTH] = a; } else { config._pf.invalidMonth = input; } break; // DAY OF MONTH case 'D' : // fall through to DD case 'DD' : if (input != null) { datePartArray[DATE] = toInt(input); } break; case 'Do' : if (input != null) { datePartArray[DATE] = toInt(parseInt( input.match(/\d{1,2}/)[0], 10)); } break; // DAY OF YEAR case 'DDD' : // fall through to DDDD case 'DDDD' : if (input != null) { config._dayOfYear = toInt(input); } break; // YEAR case 'YY' : datePartArray[YEAR] = moment.parseTwoDigitYear(input); break; case 'YYYY' : case 'YYYYY' : case 'YYYYYY' : datePartArray[YEAR] = toInt(input); break; // AM / PM case 'a' : // fall through to A case 'A' : config._meridiem = input; // config._isPm = config._locale.isPM(input); break; // HOUR case 'h' : // fall through to hh case 'hh' : config._pf.bigHour = true; /* falls through */ case 'H' : // fall through to HH case 'HH' : datePartArray[HOUR] = toInt(input); break; // MINUTE case 'm' : // fall through to mm case 'mm' : datePartArray[MINUTE] = toInt(input); break; // SECOND case 's' : // fall through to ss case 'ss' : datePartArray[SECOND] = toInt(input); break; // MILLISECOND case 'S' : case 'SS' : case 'SSS' : case 'SSSS' : datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); break; // UNIX OFFSET (MILLISECONDS) case 'x': config._d = new Date(toInt(input)); break; // UNIX TIMESTAMP WITH MS case 'X': config._d = new Date(parseFloat(input) * 1000); break; // TIMEZONE case 'Z' : // fall through to ZZ case 'ZZ' : config._useUTC = true; config._tzm = utcOffsetFromString(input); break; // WEEKDAY - human case 'dd': case 'ddd': case 'dddd': a = config._locale.weekdaysParse(input); // if we didn't get a weekday name, mark the date as invalid if (a != null) { config._w = config._w || {}; config._w['d'] = a; } else { config._pf.invalidWeekday = input; } break; // WEEK, WEEK DAY - numeric case 'w': case 'ww': case 'W': case 'WW': case 'd': case 'e': case 'E': token = token.substr(0, 1); /* falls through */ case 'gggg': case 'GGGG': case 'GGGGG': token = token.substr(0, 2); if (input) { config._w = config._w || {}; config._w[token] = toInt(input); } break; case 'gg': case 'GG': config._w = config._w || {}; config._w[token] = moment.parseTwoDigitYear(input); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convert_date(str){var tmp=str.split(\".\");return new Date(tmp[1]+\"/\"+tmp[0]+\"/\"+tmp[2])}", "function str2date(str) {\n\t\t\ttry {\n\t\t\t\tvar t = (str).split(/[- :]/);\n\t\t\t\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n\t\t\t} catch (err) {\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}", "function str2date(str) {\n\t\t\ttry {\n\t\t\t\tvar t = (str).split(/[- :]/);\n\t\t\t\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n\t\t\t} catch (err) {\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}", "function stringToDate(str){\n return new Date(Number(str));\n}", "function parseDate(input) {\n var parts = input.match(/(\\d+)/g);\n return new Date(parts[0], parts[1]-1, parts[2]);\n}", "function parseDate2(input) {\n var parts = input.match(/(\\d+)/g);\n return new Date(parts[0], parts[1]-1, parts[2], parts[3], parts[4]);\n}", "function castStringToDate(str) {\n if (str !== undefined && str.length === 16) {\n let day = str.slice(0, 2);\n let month = str.slice(3, 5);\n let americanDateString = month + '-' + day + str.slice(5); // MM-DD-YYYY HH:MM\n return new Date(americanDateString);\n } else {\n console.error('Error casting ' + str + ' to date.')\n }\n return new Date()\n}", "function convertDate(str){\n\tvar re=/[0-9]+/g;\n\tvar result = re[Symbol.match](str);\n\tvar dateLoc = Date(result[0], result[1], result[2]);\n\treturn dateLoc;\n}", "function to_date(x){\n return new Date(x.substring(0,4), x.substring(5,7)-1, x.substring(8,10), x.substring(11,13), x.substring(14,16), x.substring(17,19));\n}", "function convertDate(str) \n{\n var re = /[0-9]+/g;\n var result = re[Symbol.match](str);\n\n var dateLoc = new Date(result[0], result[1]-1, result[2]);\n\n return dateLoc;\n}", "function get_date_from_string(date_str){\n var parts =date_str.split('-');\n if(parts[0].length == 6){\n // working with date format DDMMYY\n var date_list = parts[0].match(/.{1,2}/g);\n var result_date = new Date(date_list[2].padStart(4, '20'), date_list[1]-1, date_list[0])\n return result_date;\n }else if(parts[0].length == 2){\n var result_date = new Date(parts[2].padStart(4, '20'), parts[1]-1, parts[0]);\n return result_date;\n }else{\n // unknown format. Do nothing\n return\n }\n}", "function convertDate(dateIn)\n{\n let dateYear = dateIn.charAt(0);\n dateYear += dateIn.charAt(1);\n dateYear += dateIn.charAt(2);\n dateYear += dateIn.charAt(3);\n\n let dateMonth = dateIn.charAt(5) + dateIn.charAt(6);\n let dateDay = dateIn.charAt(8) + dateIn.charAt(9);\n\n let dateOut = dateDay + '-' + dateMonth + '-' + dateYear;\n return dateOut;\n}", "function stringToDate(str) {\n var dArr = str.split(\"/\");\n var date = new Date(Number(dArr[2]), Number(dArr[1]) - 1, dArr[0]);\n return date;\n }", "function convertStr2Date(dateStr)\r\n{\r\n\t//wrap firt four char to year\r\n\tvar year = parseInt(dateStr.substring(0,4));\r\n\r\n\t//get month str\r\n\tvar sMonth = dateStr.substring(4,6);\r\n\r\n\t//splice the '0' when sMonth like '01','02',,...\r\n\tif('0'==sMonth.charAt(0))\r\n\t\tsMonth = sMonth.substring(1,2);\r\n\tvar month = parseInt(sMonth);//-1;\r\n\t//get day str\r\n\r\n\tif(dateStr.substring(6,7)==\"0\"){\r\n\t\tday = parseInt(dateStr.substring(7,8));\r\n\t}else{\r\n\t\tday = parseInt(dateStr.substring(6,8));\r\n\t}\r\n\t//convert to the type of Date\r\n\treturn new Date(year + \"/\" + month + \"/\" + day);\r\n}", "function parseDate(input) {\n var parts = input.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1]-1, parts[2]).toLocaleDateString(); // months are 0-based\n }", "function stringToDate(s) {\n s = s.split(/[-: ]/);\n return new Date(s[0], s[1] - 1, s[2], s[3], s[4], s[5]);\n }", "function toDate(input) {\n var part = input.split(\".\");\n return new Date(part[2], (part[1] - 1), part[0]);\n}", "function dateConv(dateStr, arg) {\n let tempDate = new Date(dateStr);\n let returnVal;\n\n switch (arg) {\n case \"YYYY\":\n returnVal = tempDate.getFullYear();\n break;\n case \"MMM\":\n switch (tempDate.getMonth()) {\n case 0:\n returnVal = \"Jan\";\n break;\n case 1:\n returnVal = \"Feb\";\n break;\n case 2:\n returnVal = \"Mar\";\n break;\n case 3:\n returnVal = \"Apr\";\n break;\n case 4:\n returnVal = \"May\";\n break;\n case 5:\n returnVal = \"Jun\";\n break;\n case 6:\n returnVal = \"Jul\";\n break;\n case 7:\n returnVal = \"Aug\";\n break;\n case 8:\n returnVal = \"Sep\";\n break;\n case 9:\n returnVal = \"Oct\";\n break;\n case 10:\n returnVal = \"Nov\";\n break;\n case 11:\n returnVal = \"Dec\";\n break;\n default:\n }\n break;\n case \"DD\":\n returnVal = tempDate.getDate();\n break;\n case \"DAY\":\n switch (tempDate.getDay()) {\n case 0:\n returnVal = \"Sunday\";\n break;\n case 1:\n returnVal = \"Monday\";\n break;\n case 2:\n returnVal = \"Tuesday\";\n break;\n case 3:\n returnVal = \"Wednesday\";\n break;\n case 4:\n returnVal = \"Thursday\";\n break;\n case 5:\n returnVal = \"Friday\";\n break;\n case 6:\n returnVal = \"Saturday\";\n break;\n default:\n }\n break;\n default:\n }\n\n return returnVal;\n }", "function parseDate(input) {\n var parts = input.split('-');\n // Note: months are 0-based but years and days are not.\n return new Date(parts[0], parts[1]-1, parts[2]);\n}", "function parseDate(input) {\n let year;\n let month;\n let day;\n\n let i = 0;\n for (let chunk of input.split(\"-\")) {\n switch (i) {\n case 0:\n year = parseInt(chunk);\n break;\n case 1:\n month = parseInt(chunk);\n break;\n case 2:\n day = parseInt(chunk);\n break;\n }\n i += 1;\n }\n let date = new Date(year, month - 1, day);\n return date;\n}", "function parseStringToDate(string) {\n if (string) {\n var parts = string.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1] - 1, parts[2]); // months are 0-based\n }\n }", "function convertStringToDate(d) {\n if (d == \"\" || d == undefined)\n return null;\n var arr = d.split(\"/\");\n return new Date(Number(arr[2]), Number(arr[1]) - 1, Number(arr[0]));\n}", "function parseDate(input) {\n var parts = input.split('-');\n return new Date(parts[0], parts[1]-1, parts[2]);\n}", "function dateConverter(date){\r\n dateF = date.trim();\r\n let d = dateF.substring(0, 2);\r\n let m = dateF.substring(3,5);\r\n let y = dateF.substring(6,10);\r\n return(y +\"-\"+m+\"-\"+d);\r\n}", "normalize(str) {\n if (str && !CommonUtils.isDate(str)) {\n var match = str.match(/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/);\n if (match) {\n return new Date(match[3], match[2] - 1, match[1]);\n }\n match = str.match(/^(\\d{4})-(\\d{1,2})-(\\d{1,2})$/);\n if (match) {\n return new Date(match[1], match[2] - 1, match[3]);\n }\n }\n }", "function parseDate(input) {\n if (input instanceof Date) {\n return input;\n } else {\n var parts = input.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1]-1, parts[2], parts[3], parts[4]); // months are 0-based\n }\n}", "function toDate(str, date) {\n date = date || new Date();\n date = new Date(date);\n\n var datestrings = str.split(/\\s+/);\n str = datestrings.shift();\n\n var number = str.match(/\\d+/)[0];\n var unit = str.match(/(s|m|h|d|w|y)o?/)[0];\n\n switch (unit) {\n case 's':\n var seconds = date.getSeconds();\n seconds -= number;\n date.setSeconds(seconds);\n break;\n case 'm':\n var minutes = date.getMinutes();\n minutes -= number;\n date.setMinutes(minutes);\n break;\n case 'h':\n var hours = date.getHours();\n hours -= number;\n date.setHours(hours);\n break;\n case 'd':\n var days = date.getDate();\n days -= number;\n date.setDate(days);\n break;\n case 'w':\n var days = date.getDate();\n days -= number * 7;\n date.setDate(days);\n break;\n case 'mo':\n var months = date.getMonth();\n months -= number;\n date.setMonth(months);\n break;\n case 'y':\n var years = date.getFullYear();\n years -= number;\n date.setFullYear(years);\n break;\n default:\n return new Date('');\n }\n\n if (datestrings.length) {\n return toDate(datestrings.join(' '), date);\n }\n\n return date;\n }", "function _str2date(str) { // @param ISO8601DateString/RFC1123DateString:\r\n // @return Date:\r\n function _toDate(_, dayOfWeek, day, month) {\r\n return dayOfWeek + \" \" + month + \" \" + day;\r\n }\r\n\r\n var m = _str2date._PARSE.exec(str);\r\n\r\n if (m) {\r\n return new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], // yyyy-mm-dd\r\n +m[4], +m[5], +m[6], +m[7])); // hh:mm:ss.ms\r\n }\r\n if (uu.ie && str.indexOf(\"GMT\") > 0) {\r\n str = str.replace(/GMT/, \"UTC\");\r\n }\r\n return new Date(str.replace(\",\", \"\").\r\n replace(_str2date._DATE, _toDate));\r\n}", "function convertDate(dateString) {\n if (dateString != undefined) {\n var ds = dateString.trim();\n console.log(\"[convertDate]: dateString= \" + ds + \" length=\" + ds.length);\n if (ds.length == 8) {\n return (new Date(parseInt(ds.substr(0,4)), //year\n parseInt(ds.substr(4,2))-1, //month (must be zero based)\n parseInt(ds.substr(6,2)))); //date\n }\n }\n return(undefined);\n }", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return parseTokenTimezone.exec(string) ? \n makeDateFromStringAndFormat(string, format + ' Z') :\n makeDateFromStringAndFormat(string, format);\n }\n return new Date(string);\n }", "function parseDate(input) {\n\t var parts = input.match(/(\\d+)/g);\n\t // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n\t return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based\n\t}", "function parseDate(input) {\n\t var parts = input.match(/(\\d+)/g);\n\t // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n\t return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based\n\t}", "function parseDate(input) {\n if (!input) return;\n var parts = input.match(/(\\d+)/g);\n // new date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1] - 1, parts[2]); // months are 0-based\n}", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 3; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return makeDateFromStringAndFormat(string, format + 'Z');\n }\n return new Date(string);\n }", "function parseDate(input) {\n var parts = input.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based\n}", "function parseDate(input) {\n var parts = input.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based\n}", "function getDate(string) {\n const [_, month, day, year] = conciseDateTime.exec(string);\n return new Date(year, month - 1, day);\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n\n if (typeof value === 'string') {\n value = value.trim();\n var parsedNb = parseFloat(value); // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _value$split$map = value.split('-').map(function (val) {\n return +val;\n }),\n _value$split$map2 = Object(C_Users_Abid_Loqmen_Desktop_NGforce_thesis_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(_value$split$map, 3),\n y = _value$split$map2[0],\n m = _value$split$map2[1],\n d = _value$split$map2[2];\n\n return new Date(y, m - 1, d);\n }\n\n var match;\n\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n\n var date = new Date(value);\n\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\".concat(value, \"\\\" into a date\"));\n }\n\n return date;\n}", "function convertDate( date ){\n\tvar day;\n\tvar month;\n\tvar year;\n\n\t//Extract year, month and day\n\tmonth = date.substr(0,2);\n\tday = date.substr(3,2);\n\tyear = date.substr(6);\n\n\t//compile the ynab compatible format\n\tdate = (year + \"-\" + month + \"-\" + day);\n\t\n\treturn date;\n}", "function parseDate(input) {\n var parts = input.match(/(\\d+)/g);\n // new date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1] - 1, parts[2]); // months are 0-based\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n\n if (typeof value === 'string') {\n value = value.trim();\n\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _value$split$map = value.split('-').map(function (val) {\n return +val;\n }),\n _value$split$map2 = _slicedToArray(_value$split$map, 3),\n y = _value$split$map2[0],\n _value$split$map2$ = _value$split$map2[1],\n m = _value$split$map2$ === void 0 ? 1 : _value$split$map2$,\n _value$split$map2$2 = _value$split$map2[2],\n d = _value$split$map2$2 === void 0 ? 1 : _value$split$map2$2;\n\n return createDate(y, m - 1, d);\n }\n\n var parsedNb = parseFloat(value); // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n\n var match;\n\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n\n var date = new Date(value);\n\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\".concat(value, \"\\\" into a date\"));\n }\n\n return date;\n }", "function toDate(dateStr) {\n var parts = dateStr.split(\"/\");\n return new Date(parts[2], parts[1] - 1, parts[0]);\n}", "function parseDateRUS(str) {\n\t// 0123456789\n\t// \"31.12.2010\"\t\t\t\t\n\tsubstr = str.substring(0,2);\n\tdd = parseInt(substr, 10);\n\tsubstr = str.substring(3,5);\n\tmm = parseInt(substr, 10);\n\tsubstr = str.substring(6,10); \n\tyyyy = parseInt(substr, 10);\n\tmydate = new Date(yyyy, mm - 1, dd);\n\treturn mydate;\n}", "function parseDate(input) {\n var parts = input.split('-');\n // new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1]-1, parts[2]); // Note: months are 0-based\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map((val) => +val);\n return createDate(y, m - 1, d);\n }\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n let match;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map((val) => +val);\n return createDate(y, m - 1, d);\n }\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n let match;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map((val) => +val);\n return createDate(y, m - 1, d);\n }\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n let match;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map((val) => +val);\n return createDate(y, m - 1, d);\n }\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n let match;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}", "function parseDate(str) {\n \t\t//var m = str.match(/^(\\d{1,2})-(\\d{1,2})-(\\d{4})$/);\n \t\tvar m = str.match(/^(0?[1-9]|[12][0-9]|3[01])[\\.\\-](0?[1-9]|1[012])[\\.\\-]\\d{4}$/);\n \t\treturn (m) ? new Date(m[3], m[2]-1, m[1]) : null;\n\t}", "function parseDate(str) {\n var m = str.match(/^(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})/);\n return (m) ? `${m[2]}/${m[3]}/${m[1]}` : null;\n}", "function convertDate(input)\r\n {\r\n function pad(s) { return (s < 10) ? '0' + s : s; }\r\n var d = new Date(input);\r\n return [d.getFullYear(), pad(d.getMonth()+1), pad(d.getDate())].join('-');\r\n }", "function convertDate(date) {\n let day = date.substr(8, 2);\n let month = date.substr(5, 2);\n let year = date.substr(0, 4);\n date = day + \"/\" + month + \"/\" + year;\n return date;\n }", "function parseDate(input) {\n var parts = input.split('-');\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return Date.parse(new Date(parts[0], parts[1] - 1, parts[2])); // months are 0-based\n }", "function unformatDate(datestr) {\n var y = parseInt(datestr.slice(0, 4)),\n m = parseInt(datestr.slice(5, 7)) - 1,\n dy = parseInt(datestr.slice(8));\n\n return (new Date(y, m, dy));\n}", "function unformatDate(datestr) {\n var y = parseInt(datestr.slice(0, 4)),\n m = parseInt(datestr.slice(5, 7)) - 1,\n dy = parseInt(datestr.slice(8));\n\n return (new Date(y, m, dy));\n}", "function toDate(dateStr) {\n // split in days+months+years and hours+minutes\n let dmy = dateStr.split(\" \")[0];\n let hm = dateStr.split(\" \")[1];\n\n let date = dmy.split(\"/\");\n let hourMin = hm.split(\":\");\n\n //year, month-1, day\n return new Date(date[2], date[1] - 1, date[0], hourMin[0], hourMin[1]);\n}", "function parse(str) {\n var y = Number(str.substr(0,4));\n var m = Number(str.substr(4,2) - 1);\n var d = Number(str.substr(6,2))\n var D = new Date(y,m,d);\n return (D);}", "function getDate(string) {\n let [_, month, day, year] =\n /(\\d{1,2})-(\\d{1,2})-(\\d{4})/.exec(string);\n return new Date(year, month - 1, day);\n }", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n var parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];\n return new Date(y, m - 1, d);\n }\n var match = void 0;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n var date = new Date(value);\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\" + value + \"\\\" into a date\");\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n var parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];\n return new Date(y, m - 1, d);\n }\n var match = void 0;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n var date = new Date(value);\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\" + value + \"\\\" into a date\");\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n var parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];\n return new Date(y, m - 1, d);\n }\n var match = void 0;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n var date = new Date(value);\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\" + value + \"\\\" into a date\");\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n var parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];\n return new Date(y, m - 1, d);\n }\n var match = void 0;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n var date = new Date(value);\n if (!isDate(date)) {\n throw new Error(\"Unable to convert \\\"\" + value + \"\\\" into a date\");\n }\n return date;\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n if (/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m, d] = value.split('-').map((val) => +val);\n return new Date(y, m - 1, d);\n }\n let match;\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}", "function format_date(d_str) {\n return new Date(d_str.replace(/(\\d{2}).(\\d{2}).(\\d{4})/, \"$2/$1/$3\"))\n}", "function parseDate(str) {\n str = decodeURI(str);\n var day, month, year;\n // In case user let numbers run together, e.g. \"March62013\", search for a \n // string of 5 or 6 numbers.\n var fiveOrSixFound = false;\n var sixIndex = str.search( /[0-9][0-9][0-9][0-9][0-9][0-9]/ );\n if (sixIndex >= 0) {\n // If there is an alph char after the number string, then assume the\n // last two digits of number string store the day.\n // e.g. \"199816june\"\n // Otherwise, assume the first two digits store the day.\n fiveOrSixFound = true;\n if (str.length > sixIndex + 6) {\n var postString = str.slice(sixIndex + 6);\n if (postString.search( /[a-z]/i ) >= 0) {\n day = str.substring(sixIndex + 4, sixIndex + 6);\n str = str.substring(0, sixIndex + 4) + postString;\n } else {\n day = str.substring(sixIndex, sixIndex + 2);\n str = str.substring(0, sixIndex) + str.slice(sixIndex + 2);\n }\n } else { // str ends after the number string, so assume first 2 digits\n // store the day.\n day = str.substring(sixIndex, sixIndex + 2);\n str = str.substring(0, sixIndex) + str.slice(sixIndex + 2);\n }\n } else { // Check for a 5 digit string, process similar to 6 digit case.\n var fiveIndex = str.search( /[0-9][0-9][0-9][0-9][0-9]/ );\n if (fiveIndex >= 0) {\n fiveOrSixFound = true;\n if (str.length > fiveIndex + 5) {\n var postString = str.slice(fiveIndex + 5);\n if (postString.search( /[a-z]/i ) >= 0) {\n day = str.charAt(fiveIndex + 4);\n str = str.substring(0, fiveIndex + 4) + postString;\n } else {\n day = str.charAt(fiveIndex);\n str = str.substring(0, fiveIndex) \n + str.slice(fiveIndex + 1);\n }\n } else {\n day = str.charAt(fiveIndex);\n str = str.substring(0, fiveIndex) + str.slice(fiveIndex + 1);\n }\n } else {\n // There are no strings of 6 or 5 numbers, so we can assume the\n // string of 4 numbers is the year.\n var yearIndex = str.search( /[0-9][0-9][0-9][0-9]/ );\n if (yearIndex < 0) {return;} // Note: implies dates before year \n // 1000 will return null.\n year = str.slice(yearIndex, yearIndex + 4);\n str = str.substring(0, yearIndex) + str.slice(yearIndex + 4);\n // Year is removed, so any remaining digits must store the day.\n var dayIndex = str.search( /[0-9][0-9]/ );\n if (dayIndex >= 0) {\n day = str.substring(dayIndex, dayIndex + 2);\n } else {\n dayIndex = str.search( /[0-9]/ );\n if (dayIndex < 0) {return;}\n day = str.charAt(dayIndex);\n }\n }\n }\n // If this line is reached, then the day has been found and the string \n // storing the day number has been removed.\n // If a five/six string was found, then we still need to find the year.\n if (fiveOrSixFound) {\n var yearIndex = str.search( /[0-9][0-9][0-9][0-9]/ );\n if (yearIndex < 0) {return;}\n year = str.slice(yearIndex, yearIndex + 4);\n }\n // Determine month.\n if (str.search( /jan/i ) >= 0) {month = 'January';} \n else if (str.search( /feb/i ) >= 0) {month = 'February';} \n else if (str.search( /mar/i ) >= 0) {month = 'March';} \n else if (str.search( /apr/i ) >= 0) {month = 'April';} \n else if (str.search( /may/i ) >= 0) {month = 'May';} \n else if (str.search( /jun/i ) >= 0) {month = 'June';} \n else if (str.search( /jul/i ) >= 0) {month = 'July';} \n else if (str.search( /aug/i ) >= 0) {month = 'August';} \n else if (str.search( /sep/i ) >= 0) {month = 'September';}\n else if (str.search( /oct/i ) >= 0) {month = 'October';}\n else if (str.search( /nov/i ) >= 0) {month = 'November';}\n else if (str.search( /dec/i ) >= 0) {month = 'December';} \n else {return;}\n // Ensure parsed date is valid; e.g. 30 February 2011 is invalid because\n // February has at most 29 days.\n if (!isValidDate([day, month, year])) {return;}\n return [naturalToUnix([day, month, year]), day, month, year];\n}", "function convert(str) {\n var date = new Date(str),\n mnth = (\"0\" + (date.getMonth() + 1)).slice(-2),\n day = (\"0\" + date.getDate()).slice(-2);\n return [date.getFullYear(), mnth, day].join(\"-\");\n }", "function dtStrToObj(str){ return new Date(str); }", "function parseDate(input) {\r\n // var parts = input.match(/(\\d+)/g);\n // // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n // return new Date(parts[1]-1, parts[2], parts[0], parts[3]-1, parts[4], parts[5]); // months are 0-based\r\n ///Expected format: mm-dd-yyyy HH:MM:ss\r\n ///Adjust wms date/time format to js format\r\n return new Date(input.replace(/(\\d+)\\-(\\d+)\\-(\\d+) (\\d+):(\\d+):(\\d+)/, '$3-$1-$2T$4:$5:$6')).getTime();\r\n}", "function parseDate(str) {\n\n var day = str.getDate(),\n monthIndex = str.getMonth(),\n year = str.getFullYear();\n \n return new Date(year, monthIndex, day);\n}", "function convertDate(d){\n var p = d.split(\"-\")\n return +(p[0]+p[1]+p[2])\n}", "function convertString2DateInFormat_ddMMyyyyhhmm(dateString){\r\n if(dateString == null || dateString == '' ) return \"\";\r\n var dateReturn = null;\r\n\r\n var arr = dateString.split(\" \");\r\n if(arr == null) return null;\r\n\r\n var arr_dd = arr[0].split(\"/\");\r\n if(arr_dd == null || arr_dd.length != 3) return null;\r\n\r\n var arr_hh = arr[1].split(\":\");\r\n if(arr_hh == null || arr_hh.length != 3) return null;\r\n\r\n var day = arr_dd[0];\r\n var month = arr_dd[1];\r\n var year = arr_dd[2];\r\n\r\n var hour = arr_hh[0];\r\n var minute = arr_hh[1];\r\n var second = arr_hh[2];\r\n\r\n dateReturn = new Date(year, parseInt(month) -1, day, hour, minute, second, 0);\r\n return dateReturn;\r\n}", "function changeFormate(x) {\n var year = x.substring(0, 4);\n var month = x.substring(5, 7);\n var day = x.substring(8, 10);\n var nd = year + \"/\" + month + \"/\" + day;\n return nd\n}", "function stringToDate(stringDate) {\r\n var parts = stringDate.split(\"-\");\r\n var date = new Date(parts[2], parts[1] - 1, parts[0]);\r\n return date;\r\n}", "function toDate(value) {\n if (isDate(value)) {\n return value;\n }\n\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n\n if (typeof value === 'string') {\n value = value.trim();\n\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map(val => +val);\n return createDate(y, m - 1, d);\n }\n\n const parsedNb = parseFloat(value); // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n\n let match;\n\n if (match = value.match(ISO8601_DATE_REGEX)) {\n return isoStringToDate(match);\n }\n }\n\n const date = new Date(value);\n\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n\n return date;\n}", "function getDateFromString(str)\n{\n var dateRE1 = /([0-9]{1,4})(?:\\-|\\/|\\.|\\u5e74|\\u6708|\\u65e5)([0-9]{1,2})(?:\\-|\\/|\\.|\\u5e74|\\u6708|\\u65e5)*([0-9]{1,4})*/i;\n var dateRE2 = /(on)?\\s*(([0-9]*)(?:st|th|rd|nd)*(?:\\s|of|\\-a|\\-|,|\\.)*(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec)(?:\\s|\\-|\\.)*([0-9]*))/i;\n var dateRE3 = /(on)?\\s*((january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec)(?:\\s|,|\\.|\\-)*([0-9]+)(?:st|th|rd|nd)*(?:\\s|,|\\.|\\-a|\\-)*([0-9]*))/i;\n var dateRE4 = /(on)?\\s*((next)?\\s*(monday|mon|tuesday|tue|wednesday|wed|thursday|thu|friday|fri|saturday|sat|sunday|sun))/i;\n var dateRE5 = /(in)?\\s*(one|two|three|four|five|six|seven|eight|nine|ten|[0-9]+)\\s*(years|year|yrs|yr|months|month|mons|mon|weeks|week|wks|wk|days|day)/i;\n var dateRE6 = /end\\s*of\\s*(?:the)*\\s*(week|w|month|m)/i;\n var dateRE7 =/(on)?\\s*([0-9]+)(?:st|th|rd|nd)/i;\n var dateRE8 = /\\s*(yesterday|tod|today|tom|tomorrow)/i;\n \n \n if (DEBUG) log(\"getDateFromString: Looking for date in '\" + str + \"'\");\n var dateRE1match = dateRE1.exec(str);\n var dateRE2match = dateRE2.exec(str);\n var dateRE3match = dateRE3.exec(str);\n var dateRE4match = dateRE4.exec(str);\n var dateRE5match = dateRE5.exec(str);\n var dateRE6match = dateRE6.exec(str);\n var dateRE7match = dateRE7.exec(str);\n var dateRE8match = dateRE8.exec(str);\n \n if (dateRE1match)\n {\n if (DEBUG) log(\"dateRE1 match for '\" + str + \"' = '\" + dateRE1match[0] + \"'\");\n return dateRE1match[0];\n }\n \n if (dateRE2match)\n {\n if (DEBUG) log(\"dateRE2 match for '\" + str + \"' = '\" + dateRE2match[0] + \"'\");\n return dateRE2match[0];\n }\n \n if (dateRE3match)\n {\n if (DEBUG) log(\"dateRE3 match for '\" + str + \"' = '\" + dateRE3match[0] + \"'\");\n return dateRE3match[0];\n }\n \n if (dateRE4match)\n {\n if (DEBUG) log(\"dateRE4 match for '\" + str + \"' = '\" + dateRE4match[0] + \"'\");\n return dateRE4match[0];\n }\n \n if (dateRE5match)\n {\n if (DEBUG) log(\"dateRE5 match for '\" + str + \"' = '\" + dateRE5match[0] + \"'\");\n return dateRE5match[0];\n }\n \n if (dateRE6match)\n {\n if (DEBUG) log(\"dateRE6 match for '\" + str + \"' = '\" + dateRE6match[0] + \"'\");\n return dateRE6match[0];\n }\n \n if (dateRE7match)\n {\n if (DEBUG) log(\"dateRE7 match for '\" + str + \"' = '\" + dateRE7match[0] + \"'\");\n return dateRE7match[0];\n }\n \n if (dateRE8match)\n {\n if (DEBUG) log(\"dateRE8 match for '\" + str + \"' = '\" + dateRE8match[0] + \"'\");\n return dateRE8match[0];\n }\n \n if (DEBUG) log(\"NO MATCH FOR DATE STRING '\" + str + \"'!!!!!\");\n return;\n}", "function convertDate(date) {\n let day = date.substring(8);\n let month = date.substring(5, 7);\n let year = date.substring(2,4);\n let newDate = `${month} /${day} /${year}`;\n return newDate;\n}", "function toDate(value){if(isDate(value)){return value;}if(typeof value==='number'&&!isNaN(value)){return new Date(value);}if(typeof value==='string'){value=value.trim();var parsedNb=parseFloat(value);// any string that only contains numbers, like \"1234\" but not like \"1234hello\"\nif(!isNaN(value-parsedNb)){return new Date(parsedNb);}if(/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)){/* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */var _a=Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function(val){return+val;}),3),y=_a[0],m=_a[1],d=_a[2];return new Date(y,m-1,d);}var match=void 0;if(match=value.match(ISO8601_DATE_REGEX)){return isoStringToDate(match);}}var date=new Date(value);if(!isDate(date)){throw new Error(\"Unable to convert \\\"\"+value+\"\\\" into a date\");}return date;}", "function date_ymd2dmy(val)\r\n{\r\n\tval = trim(val);\r\n\tif (val == '') return val;\r\n\tvar date_arr = val.split('-');\r\n\tif (date_arr.length != 3) return '';\r\n\tif (date_arr[1].length < 2) date_arr[1] = \"0\" + date_arr[1];\r\n\tif (date_arr[2].length < 2) date_arr[2] = \"0\" + date_arr[2];\r\n\treturn date_arr[2]+\"-\"+date_arr[1]+\"-\"+date_arr[0];\r\n}", "static textToDate(text) {\n\n // fail fast\n // regular expressions always wrapped between two backslash /content/\n // \\d refers to digits only and {x} x for the number of characters\n // \\D refers to anything that is not a digit\n if(!/\\d{4}-\\d{2}-\\d{2}/.test(text)) throw new Error('Date must be in format yyyy-mm-dd')\n\n // ... spread operator for desconstructing an array spreading its elements\n // a more complicate way of converting a String into Date\n return new Date(... text.split('-').map((v, i) => v - i % 2))\n }", "function formatDate(input) {\n var datePart = input.match(/\\d+/g),\n year = datePart[0].substring(0,4),\n month = datePart[1], day = datePart[2];\n return day + '/' + month + '/' + year;\n}", "function mmddyyyyToDate(dateString) {\n var split = dateString.split(\"/\");\n return new Date(split[2], split[0] - 1, split[1]); \n}", "function strToDate(strDate)\n{\n if ((empty(strDate)) || ((strDate.indexOf('/') == -1) && (strDate.indexOf('-') == -1)))\n return false;\n var arrDate;\n var intYear;\n var intDay;\n if (strDate.indexOf('/') != -1) {\n arrDate = explode('/', strDate);\n intYear = arrDate[2];\n intDay = arrDate[0];\n } else {\n arrDate = explode('-', strDate);\n intYear = arrDate[0];\n intDay = arrDate[2];\n }\n var intMonth = parseInt(arrDate[1]) - 1;\n var intHour = 0;\n var intMinute = 0;\n var intSec = 0;\n if (strDate.indexOf(' ') != -1) {\n var arrTime = explode(' ', strDate);\n arrTime = explode(':', arrTime[arrTime.length - 1]);\n intHour = arrTime[0];\n intMinute = arrTime[1];\n intSec = arrTime[2];\n }\n return new Date(parseInt(intYear), intMonth, parseInt(intDay), parseInt(intHour), parseInt(intMinute), parseInt(intSec));\n}", "function DateFromString(dateStr){\n\n var whichMonth = function (MonthStr) {\n console.log(\"input2Lower\"+MonthStr.toLowerCase());\n\n for(var i=0; i<monthConvert.length;i++)\n {\n if(MonthStr.toLowerCase() === monthConvert[i]){\n return i+1;\n }\n\n }\n console.log(\"ERR:Input month string is not valid\");\n return null;\n };\n\n var dateArr = dateStr.split(\" \");\n if(dateArr.length!==4){\n console.log(\"ERR: the date String get from the website is not right.\")\n return null;\n }\n\n console.log(\"result: \"+whichMonth(dateArr[2]));\n var theDate = Date(dateArr[1],whichMonth(dateArr[2]),dateArr[3]);\n\n return theDate;\n}", "function dateParser(strDate, format){\nif(!checkValidDate(strDate))\nreturn new Date();\n\nvar slash1 = strDate.indexOf(\"/\");\nif (slash1 == -1) { slash1 = strDate.indexOf(\"-\"); }\n// if no slashes or dashes, invalid date\nif (slash1 == -1) { return false; }\nvar dateYear = strDate.substring(0, slash1);\nvar dateYearAndMonth = strDate.substring(slash1+1, strDate.length);\nvar slash2 = dateYearAndMonth.indexOf(\"/\");\nif (slash2 == -1) { slash2 = dateYearAndMonth.indexOf(\"-\"); }\n// if not a second slash or dash, invalid date\nif (slash2 == -1) { return false; }\nvar dateMonth = dateYearAndMonth.substring(0, slash2);\nvar dateDay = dateYearAndMonth.substring(slash2+1, dateYearAndMonth.length);\nvar retDate = new Date(dateYear,dateMonth-1,dateDay);\nreturn retDate;\n}", "function convertDate(date) {\n var dateString = date.toString();\n // console.log(dateString);\n var dateArray = dateString.split(\" \");\n const month = dateArray[1] === \"Jan\" ? \"01\" : dateArray[1] === \"Feb\" ? \"02\" : dateArray[1] === \"Mar\" ? \"03\" : dateArray[1] === \"Apr\" ? \"04\" : dateArray[1] === \"May\" ? \"05\" : dateArray[1] === \"Jun\" ? \"06\" : dateArray[1] === \"Jul\" ? \"07\" : dateArray[1] === \"Aug\" ? \"08\" : dateArray[1] === \"Sep\" ? \"09\" : dateArray[1] === \"Oct\" ? \"10\" : dateArray[1] === \"Nov\" ? \"11\" : \"12\";\n const day = dateArray[2];\n const year = dateArray[3];\n var newDateString = `${month}\\/${day}\\/${year}`;\n // console.log(\"new date is \" + newDateString);\n return newDateString;\n}", "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function unsafeStringToDate() {\n return operator_1.cast(string_1.string(), function (str) { return new Date(str); }, instance_of_date_1.instanceOfDate());\n}", "function gerarData(str) {\n\tvar partes = str.split(\"/\");\n\treturn new Date(partes[2], partes[1] - 1, partes[0]);\n}", "makeDateObjectFromCompact(datestring) {\n if (datestring !== undefined && datestring.length === 8) {\n let year = parseInt(datestring.substring(0, 4))\n let month = parseInt(datestring.substring(4, 6)) - 1\n let day = parseInt(datestring.substring(6, 8))\n return new Date(year, month, day)\n } else {\n return \"\"\n }\n }", "function stringToDate(stringDate) {\n let year = stringDate.split('/')[0];\n let date31 = stringDate.split('/')[2];\n let month = stringDate.split('/')[1];\n let date = new Date(year, month-1, date31);\n return date;\n}", "function ToDate(dateStr) \n{\n year = dateStr.substring(0, 4);\n month = dateStr.substring(5, 7);\n month = parseInt(month) - 1;\n day = dateStr.substring(8, 10);\n hour = dateStr.substring(11, 13);\n minute = dateStr.substring(14, 16);\n second = dateStr.substring(17, 19);\n millsecond = dateStr.substring(20, 23);\n\n return new Date(year, month, day, hour, minute, second, millsecond); \n}", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function get_date(d) {\n var date1 = new Date(d.substr(0, 4), d.substr(5, 2) - 1, d.substr(8, 2), d.substr(11, 2), d.substr(14, 2), d.substr(17, 2));\n return date1;\n }" ]
[ "0.7793216", "0.74285257", "0.74285257", "0.7397207", "0.7374092", "0.73516434", "0.7351205", "0.727034", "0.72603965", "0.72467196", "0.7218412", "0.7181419", "0.71357113", "0.7127271", "0.71241677", "0.707636", "0.70552653", "0.7039943", "0.7037264", "0.70272136", "0.6996195", "0.69956905", "0.69911087", "0.69822484", "0.6980433", "0.69750863", "0.696656", "0.69625187", "0.69495535", "0.6915853", "0.69153523", "0.69153523", "0.6909154", "0.6901718", "0.6897693", "0.6897693", "0.6890818", "0.68856835", "0.6867367", "0.68413943", "0.68115306", "0.6806211", "0.6778082", "0.67742664", "0.6772613", "0.6772613", "0.6772613", "0.6772613", "0.6764595", "0.6762389", "0.6762148", "0.674979", "0.67473596", "0.67417854", "0.67417854", "0.6738137", "0.67297673", "0.6728335", "0.6727663", "0.6727663", "0.6727663", "0.6727663", "0.67245734", "0.67120445", "0.6710666", "0.670751", "0.66955215", "0.66921365", "0.66834325", "0.66705066", "0.66310257", "0.6630086", "0.66081285", "0.6604661", "0.65923077", "0.65910804", "0.6572331", "0.65599066", "0.65513945", "0.65249276", "0.65208346", "0.6507319", "0.64947116", "0.64858663", "0.6483268", "0.6468414", "0.64660764", "0.6462652", "0.6461919", "0.6456572", "0.64482385", "0.64422476", "0.64422476", "0.64422476", "0.64422476", "0.64422476", "0.6440853", "0.6440853", "0.6440853", "0.6440853", "0.6432256" ]
0.0
-1
convert an array to a date. the array should mirror the parameters below note: all values past the year are optional and will default to the lowest possible value. [year, month, day , hour, minute, second, millisecond]
function dateFromConfig(config) { var i, date, input = [], currentDate, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear) { yearToUse = dfl(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse)) { config._pf._overflowDayOfYear = true; } date = makeUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function datearray(num)\n{\n var ret = []\n var day = Math.floor(num/1000000)\n ret.push(day)\n num = num-(day*1000000)\n var month = Math.floor(num/10000)\n ret.push(month)\n num = num-(month*10000)\n var year = Math.floor(num)\n ret.push(year)\n return ret\n}", "function SP_CreateDateObject(arrDate)\n{\n\tvar oDate;\n\t\n\tif(arrDate.length == 3)\n\t{\n\t\t// Check First Element is either day or year\n\t\t\n\t\tif(arrDate[0].length == 4) //means year , passing array date is of format yyyy-mmm-dd\n\t\t{\n\t\t\toDate = new Date(arrDate[0], --arrDate[1], arrDate[2]);\n\t\t}\n\t\telse //means day, passing array date is of format dd-mmm-yyyy \n\t\t{\n\t\t\toDate = new Date(arrDate[2], SP_GetMonthNumber(arrDate[1]), arrDate[0]);\t\t\n\t\t}\n\t}\n\telse\n\t{\n\t\toDate = new Date();\n\t}\n\t\n\treturn oDate;\n}", "function formArray (array, oneRMArray) {\n var data = []\n for (var i = 0; i < array.length; i++) {\n var d;\n var monthString = array[i].month.toString();\n var dayString = array[i].day.toString();\n var yearString = array[i].year.toString();\n var d = new Date(monthString + \"-\" + dayString + \"-\" + yearString);\n var dParsed = Date.parse(d);\n\n data[i] = {\n x: dParsed,\n y: oneRMArray[i]\n } \n }\n return data\n }", "function formatDATADate(dateArr) {\r\n\r\n var val = [];\r\n\r\n for (date in dateArr) {\r\n val.push(new Date(formatDate(date)).getTime());\r\n }\r\n\r\n return val;\r\n}", "makeArray(d) {\n var da = new Date(d);\n return [da.getUTCFullYear(), da.getUTCMonth() + 1, da.getUTCDate(), 0, 0, 0, 0];\n }", "function fillDate(array) {\n var last = array.length - 1;\n var firstDate = array[0].datestamp;\n var lastDate = array[last].datestamp;\n\n var fullarray = betweenDate(firstDate, lastDate);\n\n return fullarray;\n }", "fromArray(a) {\n var d = [].concat(a);\n d[1]--;\n return Date.UTC.apply(null, d);\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += config._tzh || 0;\n input[4] += config._tzm || 0;\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += config._tzh || 0;\n input[4] += config._tzm || 0;\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += config._tzh || 0;\n input[4] += config._tzm || 0;\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += config._tzh || 0;\n input[4] += config._tzm || 0;\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += config._tzh || 0;\n input[4] += config._tzm || 0;\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += ~~((config._tzm || 0) / 60);\n input[4] += ~~((config._tzm || 0) % 60);\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += ~~((config._tzm || 0) / 60);\n input[4] += ~~((config._tzm || 0) % 60);\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function dateFromArray(config) {\n var i, date, input = [];\n\n if (config._d) {\n return;\n }\n\n for (i = 0; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += ~~((config._tzm || 0) / 60);\n input[4] += ~~((config._tzm || 0) % 60);\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function BuildDates(date){\r\n var array = new Array();\r\n array['day'] = (date.getDate() < 10) ?\r\n '0' + date.getDate().toString() :\r\n date.getDate().toString();\r\n \r\n array['month'] = (date.getMonth() < 9) ?\r\n '0' + (date.getMonth()+1).toString() :\r\n (date.getMonth()+1).toString();\r\n \r\n array['year'] = date.getFullYear().toString();\r\n return array;\r\n}", "function date() {\n return new Date(year, ...arguments)\n }", "function dateFromArray(config) {\n var i, date, input = [], currentDate;\n\n if (config._d) {\n return;\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n currentDate = currentDateArray(config);\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // add the offsets to the time to be parsed so that we can have a clean array for checking isValid\n input[3] += ~~((config._tzm || 0) / 60);\n input[4] += ~~((config._tzm || 0) % 60);\n\n date = new Date(0);\n\n if (config._useUTC) {\n date.setUTCFullYear(input[0], input[1], input[2]);\n date.setUTCHours(input[3], input[4], input[5], input[6]);\n } else {\n date.setFullYear(input[0], input[1], input[2]);\n date.setHours(input[3], input[4], input[5], input[6]);\n }\n\n config._d = date;\n }", "function createDateArray( date ) {\r\n return date.split( '-' ).map(function( value ) { return +value })\r\n }", "function makeFriendlyDates(arr) {\n var months = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n var start = arr[0].split('-'), startStr = '';\n var end = arr[1].split('-'), endStr = '';\n var result = [];\n function toNum(str) {\n return +str;\n }\n // convert to readable day formant\n function dayFormat(day) {\n switch (day) {\n case 1:\n case 21:\n return day + 'st';\n case 2:\n case 22:\n return day + 'nd';\n case 3:\n case 23:\n return day + 'rd';\n default:\n return day + 'th';\n }\n }\n start = start.map(toNum);\n end = end.map(toNum);\n var startYear = start[0], startMonth = start[1], startDay = start[2];\n var endYear = end[0], endMonth = end[1], endDay = end[2];\n // ending date equals to starting date\n if (arr[0] === arr[1]) {\n result.push(months[startMonth - 1] + ' ' + dayFormat(startDay) + ', ' + startYear);\n return result;\n }\n startStr += months[startMonth - 1] + ' ' + dayFormat(startDay);\n if (endYear === startYear) {\n if (startYear !== 2016) {\n startStr += ', ' + startYear; \n }\n if (endMonth === startMonth ) {\n endStr += dayFormat(endDay); // two dates within a month, just output ending day\n } else {\n endStr += months[endMonth - 1] + ' ' + dayFormat(endDay);\n }\n } else if (endYear - startYear === 1) {\n if (endMonth === startMonth && endDay < startDay || endMonth < startMonth) { // within one year\n endStr += months[endMonth - 1] + ' ' + dayFormat(endDay);\n if (startYear !== 2016) {\n startStr += ', ' + startYear; \n }\n } else if (endMonth >= startMonth) { // exceed one year\n startStr += ', ' + startYear;\n endStr += months[endMonth - 1] + ' ' + dayFormat(endDay) + ', ' + endYear;\n }\n } else if (endYear - startYear > 1) { // exceed one year\n startStr += ', ' + startYear;\n endStr += months[endMonth - 1] + ' ' + dayFormat(endDay) + ', ' + endYear;\n }\n\n result.push(startStr, endStr);\n return result;\n}", "function makeDateArray(weatherData, array){\n weatherData.data.forEach((item, index) => {\n Object.keys(item).forEach(key => {\n if(key === \"datetime\") {\n array.push(dateFormat(weatherData.data[index][key]));\n return array;\n }\n });\n });\n}", "formatDateForArray(date, month, year) {\n //console.log('month-->'+month+'date-->'+date);\n if (month <= 9 ) \n month = '0' + (month+1);\n if (date <= 9) \n date = '0' + (date);\n\n return [year, month, date].join('-');\n }", "parseDate(arrayOfStrings)\n {\n let newStr=arrayOfStrings[3];\n newStr += '-';\n switch(arrayOfStrings[1])\n {\n case 'Jan':\n newStr+='01';\n break;\n case 'Feb':\n newStr+='02';\n break;\n case 'Mar':\n newStr+='03';\n break;\n case 'Apr':\n newStr+='04';\n break;\n case 'May':\n newStr+='05';\n break;\n case 'Jun':\n newStr+='06';\n break;\n case 'Jul':\n newStr+='07';\n break;\n case 'Aug':\n newStr+='08';\n break;\n case 'Sep':\n newStr+='09';\n break;\n case 'Oct':\n newStr+='10';\n break;\n case 'Nov':\n newStr+='11';\n break;\n case 'Dec':\n newStr+='12';\n break;\n default:\n break;\n }\n newStr+='-';\n newStr+=arrayOfStrings[2];\n\n return newStr;\n }", "function sortByYear\n(\n array\n) \n{\n return array.sort(function(a,b)\n {\n var x = parseInt(a.number.split('-')[1]);\n var y = parseInt(b.number.split('-')[1]);\n return ((x < y) ? -1 : ((x > y) ? 0 : 1));\n }).reverse();\n}", "function frmt_date(a,field) {\n for(var i=0; i < a.length; i++){\n if( ! a[i][field] ) { continue }\n var d = new Date(a[i][field] * 1000)\n a[i][field] = d.toISOString().substr(0,16).replace('T',' ')\n }\n return(a)\n}", "function date2arr(date)\r\n{\r\n\t//\tdate = yyyy-mm-dd\r\n\tif(date != null && date.length > 0 && date.toLowerCase() != \"null\")\r\n\t{\r\n\t\tvar tmp = date.split(\"-\");\r\n\t\tvar arr = new Array();\r\n\t\tarr[0] = tmp[2];\r\n\t\tarr[1] = tmp[1];\r\n\t\tarr[2] = Number(tmp[0]);\r\n\t\treturn arr;\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn null;\r\n\t}\r\n}", "function normalizeDate(year, month, day) {\n return [year.padStart(4, '2000'), month.padStart(2, '0'), day.padStart(2, '0')];\n }", "function transformSortDate(arr) {\n const sortedArray = arr.sort((a, b) => {\n return b.timestamp + a.timestamp;\n });\n return sortedArray;\n}", "function dateStringToObject(date){\n var splitString = date.split(\"-\");// gonna set up our YYYY-MM-DD format\n var dateObject = {}; // object variable we will push results to\n // date should have a year(1), month(2), day(3) array input\n dateObject.year = splitString[0];\n dateObject.month = splitString[1];\n dateObject.day = splitString[2];\n return dateObject;\n} //(OPTION 1)", "function textifyDates(myArr){\n \n \n for(var r=0; r < myArr.length; r++){\n for(var c=0; c < myArr[r].length; c++){\n if (Object.prototype.toString.call(myArr[r][c]) === '[object Date]'){\n try { \n //myArr[r] = myArr[r].toString();\n myArr[r] = Utilities.formatDate(myArr[r], \"GMT+08:00\", \"dd-MMM-yyyy\")\n } \n catch(err) { myArr[r][c] = err};\n }\n }\n }\n return myArr;\n}", "function dateToUnix(dateArr){\n var d = new Date(dateArr[2],months.indexOf(getMonth(dateArr)),dateArr[1].substr(0,dateArr[1].length-1),0,0,0,0);\n return d.valueOf() / 1000 -18000;\n}", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function gregorianDateArrToStr([year, month, day]): string {\n return moment.utc([year, month - 1, day]).format('YYYY-MM-DD');\n}", "function toDate(value){if(isDate(value)){return value;}if(typeof value==='number'&&!isNaN(value)){return new Date(value);}if(typeof value==='string'){value=value.trim();var parsedNb=parseFloat(value);// any string that only contains numbers, like \"1234\" but not like \"1234hello\"\nif(!isNaN(value-parsedNb)){return new Date(parsedNb);}if(/^(\\d{4}-\\d{1,2}-\\d{1,2})$/.test(value)){/* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */var _a=Object(tslib__WEBPACK_IMPORTED_MODULE_1__[\"__read\"])(value.split('-').map(function(val){return+val;}),3),y=_a[0],m=_a[1],d=_a[2];return new Date(y,m-1,d);}var match=void 0;if(match=value.match(ISO8601_DATE_REGEX)){return isoStringToDate(match);}}var date=new Date(value);if(!isDate(date)){throw new Error(\"Unable to convert \\\"\"+value+\"\\\" into a date\");}return date;}", "function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }", "function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }", "function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }", "function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function convertDates(d) {\n\tfor (var i = d.length; i--;)\n\t\tconvertDateObj(d[i]);\n\treturn d;\n}", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray(config) {\n var i, date, input = [],\n currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray(config) {\n var i, date, input = [],\n currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray(config) {\n var i, date, input = [],\n currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray(config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function makeDateObjects(data){\r\n\t\tconsole.log(\"makeDateObjects\");\r\n\t\tfor (i = 0; i < data.length; i++){\r\n\t\t\tvar datestring = data[i][selectedOptions.dateField];\r\n\t\t\tvar thisYear = parseInt(datestring.substring(0,4));\r\n\t\t\tvar thisMonth = parseInt(datestring.substring(5,7));\r\n\t\t\tvar thisDay = parseInt(datestring.substring(8,10));\r\n\t\t\tvar thisDateComplete = new Date(thisYear, thisMonth-1, thisDay); // JS-Date Month begins at 0\r\n\t\t\tzaehlstellen_data[i][selectedOptions.dateField] = thisDateComplete;\r\n\t\t}\r\n\t}", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }", "function configFromArray (config) {\n var i, date, input = [], currentDate, yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (config._dayOfYear > daysInYear(yearToUse)) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n }" ]
[ "0.70560163", "0.70560163", "0.69689643", "0.68486726", "0.66355705", "0.6459506", "0.613033", "0.6126304", "0.6068413", "0.6014399", "0.6014399", "0.6014399", "0.6014399", "0.6014399", "0.5960855", "0.5960855", "0.5960855", "0.5900044", "0.5884953", "0.5875542", "0.58688384", "0.5801264", "0.5767381", "0.56831914", "0.5650213", "0.5615628", "0.56113493", "0.55977625", "0.555973", "0.5516484", "0.5500732", "0.54372275", "0.5385413", "0.52914214", "0.52904195", "0.52871954", "0.52853423", "0.52853423", "0.52853423", "0.52853423", "0.5271987", "0.5258168", "0.52579063", "0.52570367", "0.52570367", "0.52570367", "0.5254552", "0.52536476", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692", "0.524692" ]
0.0
-1
date from string and format string
function makeDateFromStringAndFormat(config) { if (config._f === moment.ISO_8601) { parseISO(config); return; } config._a = []; config._pf.empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { config._pf.unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { config._pf.empty = false; } else { config._pf.unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { config._pf.unusedTokens.push(token); } } // add remaining unparsed input length to the string config._pf.charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { config._pf.unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (config._pf.bigHour === true && config._a[HOUR] <= 12) { config._pf.bigHour = undefined; } // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); dateFromConfig(config); checkOverflow(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n i, parsedInput;\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n string = string.replace(getParseRegexForToken(tokens[i]), '');\n addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);\n }\n // handle am pm\n if (config.isPm && datePartArray[3] < 12) {\n datePartArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config.isPm === false && datePartArray[3] === 12) {\n datePartArray[3] = 0;\n }\n // handle timezone\n datePartArray[3] += config.tzh;\n datePartArray[4] += config.tzm;\n // return\n return config.isUTC ? new Date(Date.UTC.apply({}, datePartArray)) : dateFromArray(datePartArray);\n }", "function format_date(d_str) {\n return new Date(d_str.replace(/(\\d{2}).(\\d{2}).(\\d{4})/, \"$2/$1/$3\"))\n}", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens);\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function get_date_from_string(date_str){\n var parts =date_str.split('-');\n if(parts[0].length == 6){\n // working with date format DDMMYY\n var date_list = parts[0].match(/.{1,2}/g);\n var result_date = new Date(date_list[2].padStart(4, '20'), date_list[1]-1, date_list[0])\n return result_date;\n }else if(parts[0].length == 2){\n var result_date = new Date(parts[2].padStart(4, '20'), parts[1]-1, parts[0]);\n return result_date;\n }else{\n // unknown format. Do nothing\n return\n }\n}", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function parseDate(str) {\n var m = str.match(/^(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})/);\n return (m) ? `${m[2]}/${m[3]}/${m[1]}` : null;\n}", "function convert_date(str){var tmp=str.split(\".\");return new Date(tmp[1]+\"/\"+tmp[0]+\"/\"+tmp[2])}", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function str2date(str) {\n\t\t\ttry {\n\t\t\t\tvar t = (str).split(/[- :]/);\n\t\t\t\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n\t\t\t} catch (err) {\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}", "function str2date(str) {\n\t\t\ttry {\n\t\t\t\tvar t = (str).split(/[- :]/);\n\t\t\t\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n\t\t\t} catch (err) {\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}", "function makeDateFromStringAndFormat(string, format) {\n var inArray = [0, 0, 1, 0, 0, 0, 0],\n timezoneHours = 0,\n timezoneMinutes = 0,\n isUsingUTC = false,\n inputParts = string.match(inputCharacters),\n formatParts = format.match(tokenCharacters),\n len = Math.min(inputParts.length, formatParts.length),\n i,\n isPm;\n\n // function to convert string input to date\n function addTime(format, input) {\n var a;\n switch (format) {\n // MONTH\n case 'M' :\n // fall through to MM\n case 'MM' :\n inArray[1] = ~~input - 1;\n break;\n case 'MMM' :\n // fall through to MMMM\n case 'MMMM' :\n for (a = 0; a < 12; a++) {\n if (moment.monthsParse[a].test(input)) {\n inArray[1] = a;\n break;\n }\n }\n break;\n // DAY OF MONTH\n case 'D' :\n // fall through to DDDD\n case 'DD' :\n // fall through to DDDD\n case 'DDD' :\n // fall through to DDDD\n case 'DDDD' :\n inArray[2] = ~~input;\n break;\n // YEAR\n case 'YY' :\n input = ~~input;\n inArray[0] = input + (input > 70 ? 1900 : 2000);\n break;\n case 'YYYY' :\n inArray[0] = ~~Math.abs(input);\n break;\n // AM / PM\n case 'a' :\n // fall through to A\n case 'A' :\n isPm = (input.toLowerCase() === 'pm');\n break;\n // 24 HOUR\n case 'H' :\n // fall through to hh\n case 'HH' :\n // fall through to hh\n case 'h' :\n // fall through to hh\n case 'hh' :\n inArray[3] = ~~input;\n break;\n // MINUTE\n case 'm' :\n // fall through to mm\n case 'mm' :\n inArray[4] = ~~input;\n break;\n // SECOND\n case 's' :\n // fall through to ss\n case 'ss' :\n inArray[5] = ~~input;\n break;\n // TIMEZONE\n case 'Z' :\n // fall through to ZZ\n case 'ZZ' :\n isUsingUTC = true;\n a = (input || '').match(timezoneParseRegex);\n if (a && a[1]) {\n timezoneHours = ~~a[1];\n }\n if (a && a[2]) {\n timezoneMinutes = ~~a[2];\n }\n // reverse offsets\n if (a && a[0] === '+') {\n timezoneHours = -timezoneHours;\n timezoneMinutes = -timezoneMinutes;\n }\n break;\n }\n }\n for (i = 0; i < len; i++) {\n addTime(formatParts[i], inputParts[i]);\n }\n // handle am pm\n if (isPm && inArray[3] < 12) {\n inArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (isPm === false && inArray[3] === 12) {\n inArray[3] = 0;\n }\n // handle timezone\n inArray[3] += timezoneHours;\n inArray[4] += timezoneMinutes;\n // return\n return isUsingUTC ? new Date(Date.UTC.apply({}, inArray)) : dateFromArray(inArray);\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function dateParser(strDate, format){\nif(!checkValidDate(strDate))\nreturn new Date();\n\nvar slash1 = strDate.indexOf(\"/\");\nif (slash1 == -1) { slash1 = strDate.indexOf(\"-\"); }\n// if no slashes or dashes, invalid date\nif (slash1 == -1) { return false; }\nvar dateYear = strDate.substring(0, slash1);\nvar dateYearAndMonth = strDate.substring(slash1+1, strDate.length);\nvar slash2 = dateYearAndMonth.indexOf(\"/\");\nif (slash2 == -1) { slash2 = dateYearAndMonth.indexOf(\"-\"); }\n// if not a second slash or dash, invalid date\nif (slash2 == -1) { return false; }\nvar dateMonth = dateYearAndMonth.substring(0, slash2);\nvar dateDay = dateYearAndMonth.substring(slash2+1, dateYearAndMonth.length);\nvar retDate = new Date(dateYear,dateMonth-1,dateDay);\nreturn retDate;\n}", "function stringToDate(_date,_format,_delimiter)\r\n{\r\n var formatLowerCase=_format.toLowerCase();\r\n var formatItems=formatLowerCase.split(_delimiter);\r\n var dateItems=_date.split(_delimiter);\r\n var monthIndex=formatItems.indexOf(\"mm\");\r\n var dayIndex=formatItems.indexOf(\"dd\");\r\n var yearIndex=formatItems.indexOf(\"yyyy\");\r\n var month=parseInt(dateItems[monthIndex]);\r\n month-=1;\r\n var formatedDate = new Date(dateItems[yearIndex],month,dateItems[dayIndex]);\r\n return formatedDate;\r\n}", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return parseTokenTimezone.exec(string) ? \n makeDateFromStringAndFormat(string, format + ' Z') :\n makeDateFromStringAndFormat(string, format);\n }\n return new Date(string);\n }", "function stringToDate(_date,_format,_delimiter)\n{\n var formatLowerCase=_format.toLowerCase();\n var formatItems=formatLowerCase.split(_delimiter);\n var dateItems=_date.split(_delimiter);\n var monthIndex=formatItems.indexOf(\"mm\");\n var dayIndex=formatItems.indexOf(\"dd\");\n var yearIndex=formatItems.indexOf(\"yyyy\");\n var month=parseInt(dateItems[monthIndex]);\n month-=1;\n var formatedDate = new Date(dateItems[yearIndex],month,dateItems[dayIndex]);\n return formatedDate;\n}", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 3; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return makeDateFromStringAndFormat(string, format + 'Z');\n }\n return new Date(string);\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function $dateFromString(obj, expr, options) {\n var args = core_1.computeValue(obj, expr, null, options);\n args.format = args.format || _internal_1.DATE_FORMAT;\n args.onNull = args.onNull || null;\n var dateString = args.dateString;\n if (util_1.isNil(dateString))\n return args.onNull;\n // collect all separators of the format string\n var separators = args.format.split(/%[YGmdHMSLuVzZ]/);\n separators.reverse();\n var matches = args.format.match(/(%%|%Y|%G|%m|%d|%H|%M|%S|%L|%u|%V|%z|%Z)/g);\n var dateParts = {};\n // holds the valid regex of parts that matches input date string\n var expectedPattern = \"\";\n for (var i = 0, len = matches.length; i < len; i++) {\n var formatSpecifier = matches[i];\n var props = _internal_1.DATE_SYM_TABLE[formatSpecifier];\n if (util_1.isObject(props)) {\n // get pattern and alias from table\n var m = props.re.exec(dateString);\n // get the next separtor\n var delimiter = separators.pop() || \"\";\n if (m !== null) {\n // store and cut out matched part\n dateParts[props.name] = /^\\d+$/.exec(m[0]) ? parseInt(m[0]) : m[0];\n dateString =\n dateString.substr(0, m.index) +\n dateString.substr(m.index + m[0].length);\n // construct expected pattern\n expectedPattern +=\n _internal_1.regexQuote(delimiter) + _internal_1.regexStrip(props.re.toString());\n }\n else {\n dateParts[props.name] = null;\n }\n }\n }\n // 1. validate all required date parts exists\n // 2. validate original dateString against expected pattern.\n if (util_1.isNil(dateParts.year) ||\n util_1.isNil(dateParts.month) ||\n util_1.isNil(dateParts.day) ||\n !new RegExp(\"^\" + expectedPattern + \"$\").exec(args.dateString))\n return args.onError;\n var tz = _internal_1.parseTimezone(args.timezone);\n // create the date. month is 0-based in Date\n var d = new Date(Date.UTC(dateParts.year, dateParts.month - 1, dateParts.day, 0, 0, 0));\n if (!util_1.isNil(dateParts.hour))\n d.setUTCHours(dateParts.hour);\n if (!util_1.isNil(dateParts.minute))\n d.setUTCMinutes(dateParts.minute);\n if (!util_1.isNil(dateParts.second))\n d.setUTCSeconds(dateParts.second);\n if (!util_1.isNil(dateParts.millisecond))\n d.setUTCMilliseconds(dateParts.millisecond);\n // The minute part is unused when converting string.\n // This was observed in the tests on MongoDB site but not officially stated anywhere\n tz.minute = 0;\n _internal_1.adjustDate(d, tz);\n return d;\n}", "formatDate(str) {\n let string = str.slice(0, str.lastIndexOf('T'))\n let fields = string.split('-');\n let finalString = fields[2] + '-' + fields[1] + '-' + fields[0]\n return finalString\n }", "formatDate(str) {\n let string = str.slice(0, str.lastIndexOf('T'))\n let fields = string.split('-');\n let finalString = fields[2] + '-' + fields[1] + '-' + fields[0]\n return finalString\n }", "function formatDate(date, formatStr) {\n\t\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n\t}", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function format_date(date_string, data_source) {\n var date = new Date(date_string);\n return {v: date, f: date_string};\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n \n config._a = [];\n config._pf.empty = true;\n \n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n \n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n \n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n \n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n \n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function formatDate(date, formatStr) {\n return formatDateWithChunks(date, getFormatStringChunks(formatStr));\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function formatDate(string){\n var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };\n return new Date(string).toLocaleDateString([],options);\n}", "function formatDate(date, formatStr) {\n\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n}", "function formatDate(date, formatStr) {\n\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n}", "function formatDate(date, formatStr) {\n\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n}", "function formatDate(date, formatStr) {\n\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n}", "function formatDate(date, formatStr) {\n\treturn formatDateWithChunks(date, getFormatStringChunks(formatStr));\n}", "function getFormatDate(date) {\n\t\tvar arr = date.split('/');\n\t\treturn new Date(parseInt(arr[2]), parseInt(arr[1])-1, parseInt(arr[0]));\n\t}", "function makeDateFromStringAndFormat(config) {\n\t if (config._f === moment.ISO_8601) {\n\t parseISO(config);\n\t return;\n\t }\n\n\t config._a = [];\n\t config._pf.empty = true;\n\n\t // This array is used to make a Date, either with `new Date` or `Date.UTC`\n\t var string = '' + config._i,\n\t i, parsedInput, tokens, token, skipped,\n\t stringLength = string.length,\n\t totalParsedInputLength = 0;\n\n\t tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n\t for (i = 0; i < tokens.length; i++) {\n\t token = tokens[i];\n\t parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n\t if (parsedInput) {\n\t skipped = string.substr(0, string.indexOf(parsedInput));\n\t if (skipped.length > 0) {\n\t config._pf.unusedInput.push(skipped);\n\t }\n\t string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n\t totalParsedInputLength += parsedInput.length;\n\t }\n\t // don't parse if it's not a known token\n\t if (formatTokenFunctions[token]) {\n\t if (parsedInput) {\n\t config._pf.empty = false;\n\t }\n\t else {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t addTimeToArrayFromToken(token, parsedInput, config);\n\t }\n\t else if (config._strict && !parsedInput) {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t }\n\n\t // add remaining unparsed input length to the string\n\t config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n\t if (string.length > 0) {\n\t config._pf.unusedInput.push(string);\n\t }\n\n\t // handle am pm\n\t if (config._isPm && config._a[HOUR] < 12) {\n\t config._a[HOUR] += 12;\n\t }\n\t // if is 12 am, change hours to 0\n\t if (config._isPm === false && config._a[HOUR] === 12) {\n\t config._a[HOUR] = 0;\n\t }\n\n\t dateFromConfig(config);\n\t checkOverflow(config);\n\t }", "function makeDateFromStringAndFormat(config) {\n\t\tif (config._f === moment.ISO_8601) {\n\t\t\tparseISO(config);\n\t\t\treturn;\n\t\t}\n\n\t\tconfig._a = [];\n\t\tconfig._pf.empty = true;\n\n\t\t// This array is used to make a Date, either with `new Date` or `Date.UTC`\n\t\tvar string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0;\n\n\t\ttokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n\t\tfor (i = 0; i < tokens.length; i++) {\n\t\t\ttoken = tokens[i];\n\t\t\tparsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n\t\t\tif (parsedInput) {\n\t\t\t\tskipped = string.substr(0, string.indexOf(parsedInput));\n\t\t\t\tif (skipped.length > 0) {\n\t\t\t\t\tconfig._pf.unusedInput.push(skipped);\n\t\t\t\t}\n\t\t\t\tstring = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n\t\t\t\ttotalParsedInputLength += parsedInput.length;\n\t\t\t}\n\t\t\t// don't parse if it's not a known token\n\t\t\tif (formatTokenFunctions[token]) {\n\t\t\t\tif (parsedInput) {\n\t\t\t\t\tconfig._pf.empty = false;\n\t\t\t\t} else {\n\t\t\t\t\tconfig._pf.unusedTokens.push(token);\n\t\t\t\t}\n\t\t\t\taddTimeToArrayFromToken(token, parsedInput, config);\n\t\t\t} else if (config._strict && !parsedInput) {\n\t\t\t\tconfig._pf.unusedTokens.push(token);\n\t\t\t}\n\t\t}\n\n\t\t// add remaining unparsed input length to the string\n\t\tconfig._pf.charsLeftOver = stringLength - totalParsedInputLength;\n\t\tif (string.length > 0) {\n\t\t\tconfig._pf.unusedInput.push(string);\n\t\t}\n\n\t\t// clear _12h flag if hour is <= 12\n\t\tif (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n\t\t\tconfig._pf.bigHour = undefined;\n\t\t}\n\t\t// handle am pm\n\t\tif (config._isPm && config._a[HOUR] < 12) {\n\t\t\tconfig._a[HOUR] += 12;\n\t\t}\n\t\t// if is 12 am, change hours to 0\n\t\tif (config._isPm === false && config._a[HOUR] === 12) {\n\t\t\tconfig._a[HOUR] = 0;\n\t\t}\n\t\tdateFromConfig(config);\n\t\tcheckOverflow(config);\n\t}", "function parseDate(str) {\n \t\t//var m = str.match(/^(\\d{1,2})-(\\d{1,2})-(\\d{4})$/);\n \t\tvar m = str.match(/^(0?[1-9]|[12][0-9]|3[01])[\\.\\-](0?[1-9]|1[012])[\\.\\-]\\d{4}$/);\n \t\treturn (m) ? new Date(m[3], m[2]-1, m[1]) : null;\n\t}", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function unformatDate(datestr) {\n var y = parseInt(datestr.slice(0, 4)),\n m = parseInt(datestr.slice(5, 7)) - 1,\n dy = parseInt(datestr.slice(8));\n\n return (new Date(y, m, dy));\n}", "function unformatDate(datestr) {\n var y = parseInt(datestr.slice(0, 4)),\n m = parseInt(datestr.slice(5, 7)) - 1,\n dy = parseInt(datestr.slice(8));\n\n return (new Date(y, m, dy));\n}", "function makeDateFromStringAndFormat(config) {\n\t if (config._f === moment.ISO_8601) {\n\t parseISO(config);\n\t return;\n\t }\n\n\t config._a = [];\n\t config._pf.empty = true;\n\n\t // This array is used to make a Date, either with `new Date` or `Date.UTC`\n\t var string = '' + config._i,\n\t i,\n\t parsedInput,\n\t tokens,\n\t token,\n\t skipped,\n\t stringLength = string.length,\n\t totalParsedInputLength = 0;\n\n\t tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n\t for (i = 0; i < tokens.length; i++) {\n\t token = tokens[i];\n\t parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n\t if (parsedInput) {\n\t skipped = string.substr(0, string.indexOf(parsedInput));\n\t if (skipped.length > 0) {\n\t config._pf.unusedInput.push(skipped);\n\t }\n\t string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n\t totalParsedInputLength += parsedInput.length;\n\t }\n\t // don't parse if it's not a known token\n\t if (formatTokenFunctions[token]) {\n\t if (parsedInput) {\n\t config._pf.empty = false;\n\t } else {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t addTimeToArrayFromToken(token, parsedInput, config);\n\t } else if (config._strict && !parsedInput) {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t }\n\n\t // add remaining unparsed input length to the string\n\t config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n\t if (string.length > 0) {\n\t config._pf.unusedInput.push(string);\n\t }\n\n\t // clear _12h flag if hour is <= 12\n\t if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n\t config._pf.bigHour = undefined;\n\t }\n\t // handle meridiem\n\t config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);\n\t dateFromConfig(config);\n\t checkOverflow(config);\n\t }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function getDateFromString(str)\n{\n var dateRE1 = /([0-9]{1,4})(?:\\-|\\/|\\.|\\u5e74|\\u6708|\\u65e5)([0-9]{1,2})(?:\\-|\\/|\\.|\\u5e74|\\u6708|\\u65e5)*([0-9]{1,4})*/i;\n var dateRE2 = /(on)?\\s*(([0-9]*)(?:st|th|rd|nd)*(?:\\s|of|\\-a|\\-|,|\\.)*(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec)(?:\\s|\\-|\\.)*([0-9]*))/i;\n var dateRE3 = /(on)?\\s*((january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec)(?:\\s|,|\\.|\\-)*([0-9]+)(?:st|th|rd|nd)*(?:\\s|,|\\.|\\-a|\\-)*([0-9]*))/i;\n var dateRE4 = /(on)?\\s*((next)?\\s*(monday|mon|tuesday|tue|wednesday|wed|thursday|thu|friday|fri|saturday|sat|sunday|sun))/i;\n var dateRE5 = /(in)?\\s*(one|two|three|four|five|six|seven|eight|nine|ten|[0-9]+)\\s*(years|year|yrs|yr|months|month|mons|mon|weeks|week|wks|wk|days|day)/i;\n var dateRE6 = /end\\s*of\\s*(?:the)*\\s*(week|w|month|m)/i;\n var dateRE7 =/(on)?\\s*([0-9]+)(?:st|th|rd|nd)/i;\n var dateRE8 = /\\s*(yesterday|tod|today|tom|tomorrow)/i;\n \n \n if (DEBUG) log(\"getDateFromString: Looking for date in '\" + str + \"'\");\n var dateRE1match = dateRE1.exec(str);\n var dateRE2match = dateRE2.exec(str);\n var dateRE3match = dateRE3.exec(str);\n var dateRE4match = dateRE4.exec(str);\n var dateRE5match = dateRE5.exec(str);\n var dateRE6match = dateRE6.exec(str);\n var dateRE7match = dateRE7.exec(str);\n var dateRE8match = dateRE8.exec(str);\n \n if (dateRE1match)\n {\n if (DEBUG) log(\"dateRE1 match for '\" + str + \"' = '\" + dateRE1match[0] + \"'\");\n return dateRE1match[0];\n }\n \n if (dateRE2match)\n {\n if (DEBUG) log(\"dateRE2 match for '\" + str + \"' = '\" + dateRE2match[0] + \"'\");\n return dateRE2match[0];\n }\n \n if (dateRE3match)\n {\n if (DEBUG) log(\"dateRE3 match for '\" + str + \"' = '\" + dateRE3match[0] + \"'\");\n return dateRE3match[0];\n }\n \n if (dateRE4match)\n {\n if (DEBUG) log(\"dateRE4 match for '\" + str + \"' = '\" + dateRE4match[0] + \"'\");\n return dateRE4match[0];\n }\n \n if (dateRE5match)\n {\n if (DEBUG) log(\"dateRE5 match for '\" + str + \"' = '\" + dateRE5match[0] + \"'\");\n return dateRE5match[0];\n }\n \n if (dateRE6match)\n {\n if (DEBUG) log(\"dateRE6 match for '\" + str + \"' = '\" + dateRE6match[0] + \"'\");\n return dateRE6match[0];\n }\n \n if (dateRE7match)\n {\n if (DEBUG) log(\"dateRE7 match for '\" + str + \"' = '\" + dateRE7match[0] + \"'\");\n return dateRE7match[0];\n }\n \n if (dateRE8match)\n {\n if (DEBUG) log(\"dateRE8 match for '\" + str + \"' = '\" + dateRE8match[0] + \"'\");\n return dateRE8match[0];\n }\n \n if (DEBUG) log(\"NO MATCH FOR DATE STRING '\" + str + \"'!!!!!\");\n return;\n}", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "function parseStringToDate(string) {\n if (string) {\n var parts = string.match(/(\\d+)/g);\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\n return new Date(parts[0], parts[1] - 1, parts[2]); // months are 0-based\n }\n }", "function formatDate(string) {\n var date = new Date(string);\n let options = {\n day: \"numeric\",\n month: \"long\",\n };\n return date.toLocaleString(\"en-US\", options);\n }", "function formatDate(date, format){\n if(!date){\n return '0000-00-00';\n }\n var dd = date.substring(0, 2);\n var mm = date.substring(3, 5);\n var yy = date.substring(6);\n if (format == 'dmy') {\n return dd + '-' + mm + '-' + yy;\n } else {\n return yy + '-' + mm + '-' + dd;\n }\n }", "function castStringToDate(str) {\n if (str !== undefined && str.length === 16) {\n let day = str.slice(0, 2);\n let month = str.slice(3, 5);\n let americanDateString = month + '-' + day + str.slice(5); // MM-DD-YYYY HH:MM\n return new Date(americanDateString);\n } else {\n console.error('Error casting ' + str + ' to date.')\n }\n return new Date()\n}", "normalize(str) {\n if (str && !CommonUtils.isDate(str)) {\n var match = str.match(/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/);\n if (match) {\n return new Date(match[3], match[2] - 1, match[1]);\n }\n match = str.match(/^(\\d{4})-(\\d{1,2})-(\\d{1,2})$/);\n if (match) {\n return new Date(match[1], match[2] - 1, match[3]);\n }\n }\n }", "function formatDate(date,formatStr){return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString,date);}" ]
[ "0.75422543", "0.73773617", "0.7180261", "0.7180261", "0.7180261", "0.7180261", "0.7167225", "0.71664", "0.71664", "0.71664", "0.71664", "0.71664", "0.7152761", "0.7148616", "0.7148616", "0.7148616", "0.70915365", "0.7087678", "0.7032007", "0.7032007", "0.70194393", "0.70194393", "0.70194393", "0.70194393", "0.70194393", "0.7004594", "0.7004594", "0.6967927", "0.6966412", "0.6950023", "0.69429606", "0.6934382", "0.6922658", "0.69019496", "0.6899754", "0.6899754", "0.6899754", "0.6899754", "0.6899754", "0.6896952", "0.6893914", "0.6893914", "0.68838507", "0.68823093", "0.68823093", "0.6882282", "0.6859109", "0.6857612", "0.6857612", "0.68548566", "0.68517494", "0.68517494", "0.68517494", "0.68517494", "0.68517494", "0.68517494", "0.68517494", "0.68517494", "0.6850366", "0.6837156", "0.6837156", "0.6837156", "0.6837156", "0.6837156", "0.6831003", "0.67832714", "0.6758009", "0.672724", "0.6727163", "0.6727163", "0.6727163", "0.67267865", "0.67267865", "0.6725443", "0.6716593", "0.6716593", "0.6716593", "0.6716593", "0.6716593", "0.6716593", "0.66986823", "0.6686089", "0.6686089", "0.6685659", "0.66826737", "0.6677289", "0.6673535", "0.666504", "0.6660661" ]
0.66543823
100
date from string and array of format strings
function makeDateFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { config._pf.invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._pf = defaultParsingFlags(); tempConfig._f = config._f[i]; makeDateFromStringAndFormat(tempConfig); if (!isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += tempConfig._pf.charsLeftOver; //or tokens currentScore += tempConfig._pf.unusedTokens.length * 10; tempConfig._pf.score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < formats.length; i++) {\n currentDate = makeDateFromStringAndFormat(string, formats[i]);\n formattedInputParts = formatMoment(new Moment(currentDate), formats[i]).match(parseMultipleFormatChunker) || [];\n currentScore = compareArrays(inputParts, formattedInputParts);\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n output = currentDate;\n }\n }\n return output;\n }", "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n i, parsedInput;\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n string = string.replace(getParseRegexForToken(tokens[i]), '');\n addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);\n }\n // handle am pm\n if (config.isPm && datePartArray[3] < 12) {\n datePartArray[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config.isPm === false && datePartArray[3] === 12) {\n datePartArray[3] = 0;\n }\n // handle timezone\n datePartArray[3] += config.tzh;\n datePartArray[4] += config.tzm;\n // return\n return config.isUTC ? new Date(Date.UTC.apply({}, datePartArray)) : dateFromArray(datePartArray);\n }", "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(inputCharacters),\n scores = [],\n scoreToBeat = 99,\n i,\n curDate,\n curScore;\n for (i = 0; i < formats.length; i++) {\n curDate = makeDateFromStringAndFormat(string, formats[i]);\n curScore = compareArrays(inputParts, formatMoment(new Moment(curDate), formats[i]).match(inputCharacters));\n if (curScore < scoreToBeat) {\n scoreToBeat = curScore;\n output = curDate;\n }\n }\n return output;\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var tokens = config._f.match(formattingTokens),\n string = config._i,\n i, parsedInput;\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "function makeDateFromStringAndFormat(config) {\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens);\n\n config._a = [];\n\n for (i = 0; i < tokens.length; i++) {\n parsedInput = (getParseRegexForToken(tokens[i], config).exec(string) || [])[0];\n if (parsedInput) {\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n }\n // don't parse if its not a known token\n if (formatTokenFunctions[tokens[i]]) {\n addTimeToArrayFromToken(tokens[i], parsedInput, config);\n }\n }\n\n // add remaining unparsed input to the string\n if (string) {\n config._il = string;\n }\n\n // handle am pm\n if (config._isPm && config._a[3] < 12) {\n config._a[3] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[3] === 12) {\n config._a[3] = 0;\n }\n // return\n dateFromArray(config);\n }", "parseDate(arrayOfStrings)\n {\n let newStr=arrayOfStrings[3];\n newStr += '-';\n switch(arrayOfStrings[1])\n {\n case 'Jan':\n newStr+='01';\n break;\n case 'Feb':\n newStr+='02';\n break;\n case 'Mar':\n newStr+='03';\n break;\n case 'Apr':\n newStr+='04';\n break;\n case 'May':\n newStr+='05';\n break;\n case 'Jun':\n newStr+='06';\n break;\n case 'Jul':\n newStr+='07';\n break;\n case 'Aug':\n newStr+='08';\n break;\n case 'Sep':\n newStr+='09';\n break;\n case 'Oct':\n newStr+='10';\n break;\n case 'Nov':\n newStr+='11';\n break;\n case 'Dec':\n newStr+='12';\n break;\n default:\n break;\n }\n newStr+='-';\n newStr+=arrayOfStrings[2];\n\n return newStr;\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function $dateFromString(obj, expr, options) {\n var args = core_1.computeValue(obj, expr, null, options);\n args.format = args.format || _internal_1.DATE_FORMAT;\n args.onNull = args.onNull || null;\n var dateString = args.dateString;\n if (util_1.isNil(dateString))\n return args.onNull;\n // collect all separators of the format string\n var separators = args.format.split(/%[YGmdHMSLuVzZ]/);\n separators.reverse();\n var matches = args.format.match(/(%%|%Y|%G|%m|%d|%H|%M|%S|%L|%u|%V|%z|%Z)/g);\n var dateParts = {};\n // holds the valid regex of parts that matches input date string\n var expectedPattern = \"\";\n for (var i = 0, len = matches.length; i < len; i++) {\n var formatSpecifier = matches[i];\n var props = _internal_1.DATE_SYM_TABLE[formatSpecifier];\n if (util_1.isObject(props)) {\n // get pattern and alias from table\n var m = props.re.exec(dateString);\n // get the next separtor\n var delimiter = separators.pop() || \"\";\n if (m !== null) {\n // store and cut out matched part\n dateParts[props.name] = /^\\d+$/.exec(m[0]) ? parseInt(m[0]) : m[0];\n dateString =\n dateString.substr(0, m.index) +\n dateString.substr(m.index + m[0].length);\n // construct expected pattern\n expectedPattern +=\n _internal_1.regexQuote(delimiter) + _internal_1.regexStrip(props.re.toString());\n }\n else {\n dateParts[props.name] = null;\n }\n }\n }\n // 1. validate all required date parts exists\n // 2. validate original dateString against expected pattern.\n if (util_1.isNil(dateParts.year) ||\n util_1.isNil(dateParts.month) ||\n util_1.isNil(dateParts.day) ||\n !new RegExp(\"^\" + expectedPattern + \"$\").exec(args.dateString))\n return args.onError;\n var tz = _internal_1.parseTimezone(args.timezone);\n // create the date. month is 0-based in Date\n var d = new Date(Date.UTC(dateParts.year, dateParts.month - 1, dateParts.day, 0, 0, 0));\n if (!util_1.isNil(dateParts.hour))\n d.setUTCHours(dateParts.hour);\n if (!util_1.isNil(dateParts.minute))\n d.setUTCMinutes(dateParts.minute);\n if (!util_1.isNil(dateParts.second))\n d.setUTCSeconds(dateParts.second);\n if (!util_1.isNil(dateParts.millisecond))\n d.setUTCMilliseconds(dateParts.millisecond);\n // The minute part is unused when converting string.\n // This was observed in the tests on MongoDB site but not officially stated anywhere\n tz.minute = 0;\n _internal_1.adjustDate(d, tz);\n return d;\n}", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n \n scoreToBeat,\n i,\n currentScore;\n \n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n \n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n \n if (!isValid(tempConfig)) {\n continue;\n }\n \n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n \n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n \n tempConfig._pf.score = currentScore;\n \n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n \n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromStringAndFormat(config) {\n\t\tif (config._f === moment.ISO_8601) {\n\t\t\tparseISO(config);\n\t\t\treturn;\n\t\t}\n\n\t\tconfig._a = [];\n\t\tconfig._pf.empty = true;\n\n\t\t// This array is used to make a Date, either with `new Date` or `Date.UTC`\n\t\tvar string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0;\n\n\t\ttokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n\t\tfor (i = 0; i < tokens.length; i++) {\n\t\t\ttoken = tokens[i];\n\t\t\tparsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n\t\t\tif (parsedInput) {\n\t\t\t\tskipped = string.substr(0, string.indexOf(parsedInput));\n\t\t\t\tif (skipped.length > 0) {\n\t\t\t\t\tconfig._pf.unusedInput.push(skipped);\n\t\t\t\t}\n\t\t\t\tstring = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n\t\t\t\ttotalParsedInputLength += parsedInput.length;\n\t\t\t}\n\t\t\t// don't parse if it's not a known token\n\t\t\tif (formatTokenFunctions[token]) {\n\t\t\t\tif (parsedInput) {\n\t\t\t\t\tconfig._pf.empty = false;\n\t\t\t\t} else {\n\t\t\t\t\tconfig._pf.unusedTokens.push(token);\n\t\t\t\t}\n\t\t\t\taddTimeToArrayFromToken(token, parsedInput, config);\n\t\t\t} else if (config._strict && !parsedInput) {\n\t\t\t\tconfig._pf.unusedTokens.push(token);\n\t\t\t}\n\t\t}\n\n\t\t// add remaining unparsed input length to the string\n\t\tconfig._pf.charsLeftOver = stringLength - totalParsedInputLength;\n\t\tif (string.length > 0) {\n\t\t\tconfig._pf.unusedInput.push(string);\n\t\t}\n\n\t\t// clear _12h flag if hour is <= 12\n\t\tif (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n\t\t\tconfig._pf.bigHour = undefined;\n\t\t}\n\t\t// handle am pm\n\t\tif (config._isPm && config._a[HOUR] < 12) {\n\t\t\tconfig._a[HOUR] += 12;\n\t\t}\n\t\t// if is 12 am, change hours to 0\n\t\tif (config._isPm === false && config._a[HOUR] === 12) {\n\t\t\tconfig._a[HOUR] = 0;\n\t\t}\n\t\tdateFromConfig(config);\n\t\tcheckOverflow(config);\n\t}", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n\t var tempConfig, bestMoment, scoreToBeat, i, currentScore;\n\n\t if (config._f.length === 0) {\n\t config._pf.invalidFormat = true;\n\t config._d = new Date(NaN);\n\t return;\n\t }\n\n\t for (i = 0; i < config._f.length; i++) {\n\t currentScore = 0;\n\t tempConfig = copyConfig({}, config);\n\t if (config._useUTC != null) {\n\t tempConfig._useUTC = config._useUTC;\n\t }\n\t tempConfig._pf = defaultParsingFlags();\n\t tempConfig._f = config._f[i];\n\t makeDateFromStringAndFormat(tempConfig);\n\n\t if (!_isValid(tempConfig)) {\n\t continue;\n\t }\n\n\t // if there is any input that was not parsed add a penalty for that format\n\t currentScore += tempConfig._pf.charsLeftOver;\n\n\t //or tokens\n\t currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n\t tempConfig._pf.score = currentScore;\n\n\t if (scoreToBeat == null || currentScore < scoreToBeat) {\n\t scoreToBeat = currentScore;\n\t bestMoment = tempConfig;\n\t }\n\t }\n\n\t extend(config, bestMoment || tempConfig);\n\t }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = extend({}, config);\n initializeParsingFlags(tempConfig);\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "parseDate(value, format) {\n if (format == null || value == null) {\n throw \"Invalid arguments\";\n }\n value = (typeof value === \"object\" ? value.toString() : value + \"\");\n if (value === \"\") {\n return null;\n }\n let iFormat, dim, extra, iValue = 0, shortYearCutoff = (typeof this.shortYearCutoff !== \"string\" ? this.shortYearCutoff : new Date().getFullYear() % 100 + parseInt(this.shortYearCutoff, 10)), year = -1, month = -1, day = -1, doy = -1, literal = false, date, lookAhead = (match) => {\n let matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);\n if (matches) {\n iFormat++;\n }\n return matches;\n }, getNumber = (match) => {\n let isDoubled = lookAhead(match), size = (match === \"@\" ? 14 : (match === \"!\" ? 20 :\n (match === \"y\" && isDoubled ? 4 : (match === \"o\" ? 3 : 2)))), minSize = (match === \"y\" ? size : 1), digits = new RegExp(\"^\\\\d{\" + minSize + \",\" + size + \"}\"), num = value.substring(iValue).match(digits);\n if (!num) {\n throw \"Missing number at position \" + iValue;\n }\n iValue += num[0].length;\n return parseInt(num[0], 10);\n }, getName = (match, shortNames, longNames) => {\n let index = -1;\n let arr = lookAhead(match) ? longNames : shortNames;\n let names = [];\n for (let i = 0; i < arr.length; i++) {\n names.push([i, arr[i]]);\n }\n names.sort((a, b) => {\n return -(a[1].length - b[1].length);\n });\n for (let i = 0; i < names.length; i++) {\n let name = names[i][1];\n if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {\n index = names[i][0];\n iValue += name.length;\n break;\n }\n }\n if (index !== -1) {\n return index + 1;\n }\n else {\n throw \"Unknown name at position \" + iValue;\n }\n }, checkLiteral = () => {\n if (value.charAt(iValue) !== format.charAt(iFormat)) {\n throw \"Unexpected literal at position \" + iValue;\n }\n iValue++;\n };\n if (this.view === 'month') {\n day = 1;\n }\n for (iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === \"'\" && !lookAhead(\"'\")) {\n literal = false;\n }\n else {\n checkLiteral();\n }\n }\n else {\n switch (format.charAt(iFormat)) {\n case \"d\":\n day = getNumber(\"d\");\n break;\n case \"D\":\n getName(\"D\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES));\n break;\n case \"o\":\n doy = getNumber(\"o\");\n break;\n case \"m\":\n month = getNumber(\"m\");\n break;\n case \"M\":\n month = getName(\"M\", this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES));\n break;\n case \"y\":\n year = getNumber(\"y\");\n break;\n case \"@\":\n date = new Date(getNumber(\"@\"));\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"!\":\n date = new Date((getNumber(\"!\") - this.ticksTo1970) / 10000);\n year = date.getFullYear();\n month = date.getMonth() + 1;\n day = date.getDate();\n break;\n case \"'\":\n if (lookAhead(\"'\")) {\n checkLiteral();\n }\n else {\n literal = true;\n }\n break;\n default:\n checkLiteral();\n }\n }\n }\n if (iValue < value.length) {\n extra = value.substr(iValue);\n if (!/^\\s+/.test(extra)) {\n throw \"Extra/unparsed characters found in date: \" + extra;\n }\n }\n if (year === -1) {\n year = new Date().getFullYear();\n }\n else if (year < 100) {\n year += new Date().getFullYear() - new Date().getFullYear() % 100 +\n (year <= shortYearCutoff ? 0 : -100);\n }\n if (doy > -1) {\n month = 1;\n day = doy;\n do {\n dim = this.getDaysCountInMonth(year, month - 1);\n if (day <= dim) {\n break;\n }\n month++;\n day -= dim;\n } while (true);\n }\n date = this.daylightSavingAdjust(new Date(year, month - 1, day));\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {\n throw \"Invalid date\"; // E.g. 31/02/00\n }\n return date;\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndArray(config) {\n\t\tvar tempConfig, bestMoment,\n\n\t\tscoreToBeat, i, currentScore;\n\n\t\tif (config._f.length === 0) {\n\t\t\tconfig._pf.invalidFormat = true;\n\t\t\tconfig._d = new Date(NaN);\n\t\t\treturn;\n\t\t}\n\n\t\tfor (i = 0; i < config._f.length; i++) {\n\t\t\tcurrentScore = 0;\n\t\t\ttempConfig = copyConfig({}, config);\n\t\t\tif (config._useUTC != null) {\n\t\t\t\ttempConfig._useUTC = config._useUTC;\n\t\t\t}\n\t\t\ttempConfig._pf = defaultParsingFlags();\n\t\t\ttempConfig._f = config._f[i];\n\t\t\tmakeDateFromStringAndFormat(tempConfig);\n\n\t\t\tif (!isValid(tempConfig)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if there is any input that was not parsed add a penalty for that format\n\t\t\tcurrentScore += tempConfig._pf.charsLeftOver;\n\n\t\t\t//or tokens\n\t\t\tcurrentScore += tempConfig._pf.unusedTokens.length * 10;\n\n\t\t\ttempConfig._pf.score = currentScore;\n\n\t\t\tif (scoreToBeat == null || currentScore < scoreToBeat) {\n\t\t\t\tscoreToBeat = currentScore;\n\t\t\t\tbestMoment = tempConfig;\n\t\t\t}\n\t\t}\n\n\t\textend(config, bestMoment || tempConfig);\n\t}", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n\n scoreToBeat,\n i,\n currentScore;\n\n if (config._f.length === 0) {\n config._pf.invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < config._f.length; i++) {\n currentScore = 0;\n tempConfig = copyConfig({}, config);\n tempConfig._pf = defaultParsingFlags();\n tempConfig._f = config._f[i];\n makeDateFromStringAndFormat(tempConfig);\n\n if (!isValid(tempConfig)) {\n continue;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += tempConfig._pf.charsLeftOver;\n\n //or tokens\n currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n tempConfig._pf.score = currentScore;\n\n if (scoreToBeat == null || currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }", "function makeDateFromStringAndArray(config) {\n\t var tempConfig,\n\t bestMoment,\n\n\t scoreToBeat,\n\t i,\n\t currentScore;\n\n\t if (config._f.length === 0) {\n\t config._pf.invalidFormat = true;\n\t config._d = new Date(NaN);\n\t return;\n\t }\n\n\t for (i = 0; i < config._f.length; i++) {\n\t currentScore = 0;\n\t tempConfig = copyConfig({}, config);\n\t if (config._useUTC != null) {\n\t tempConfig._useUTC = config._useUTC;\n\t }\n\t tempConfig._pf = defaultParsingFlags();\n\t tempConfig._f = config._f[i];\n\t makeDateFromStringAndFormat(tempConfig);\n\n\t if (!isValid(tempConfig)) {\n\t continue;\n\t }\n\n\t // if there is any input that was not parsed add a penalty for that format\n\t currentScore += tempConfig._pf.charsLeftOver;\n\n\t //or tokens\n\t currentScore += tempConfig._pf.unusedTokens.length * 10;\n\n\t tempConfig._pf.score = currentScore;\n\n\t if (scoreToBeat == null || currentScore < scoreToBeat) {\n\t scoreToBeat = currentScore;\n\t bestMoment = tempConfig;\n\t }\n\t }\n\n\t extend(config, bestMoment || tempConfig);\n\t }", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var lang = getLangDefinition(config._l),\n string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, lang).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n\t if (config._f === moment.ISO_8601) {\n\t parseISO(config);\n\t return;\n\t }\n\n\t config._a = [];\n\t config._pf.empty = true;\n\n\t // This array is used to make a Date, either with `new Date` or `Date.UTC`\n\t var string = '' + config._i,\n\t i, parsedInput, tokens, token, skipped,\n\t stringLength = string.length,\n\t totalParsedInputLength = 0;\n\n\t tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n\t for (i = 0; i < tokens.length; i++) {\n\t token = tokens[i];\n\t parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n\t if (parsedInput) {\n\t skipped = string.substr(0, string.indexOf(parsedInput));\n\t if (skipped.length > 0) {\n\t config._pf.unusedInput.push(skipped);\n\t }\n\t string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n\t totalParsedInputLength += parsedInput.length;\n\t }\n\t // don't parse if it's not a known token\n\t if (formatTokenFunctions[token]) {\n\t if (parsedInput) {\n\t config._pf.empty = false;\n\t }\n\t else {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t addTimeToArrayFromToken(token, parsedInput, config);\n\t }\n\t else if (config._strict && !parsedInput) {\n\t config._pf.unusedTokens.push(token);\n\t }\n\t }\n\n\t // add remaining unparsed input length to the string\n\t config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n\t if (string.length > 0) {\n\t config._pf.unusedInput.push(string);\n\t }\n\n\t // handle am pm\n\t if (config._isPm && config._a[HOUR] < 12) {\n\t config._a[HOUR] += 12;\n\t }\n\t // if is 12 am, change hours to 0\n\t if (config._isPm === false && config._a[HOUR] === 12) {\n\t config._a[HOUR] = 0;\n\t }\n\n\t dateFromConfig(config);\n\t checkOverflow(config);\n\t }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n\n config._a = [];\n config._pf.empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n\n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle am pm\n if (config._isPm && config._a[HOUR] < 12) {\n config._a[HOUR] += 12;\n }\n // if is 12 am, change hours to 0\n if (config._isPm === false && config._a[HOUR] === 12) {\n config._a[HOUR] = 0;\n }\n dateFromConfig(config);\n checkOverflow(config);\n }", "function stringToDate(_date,_format,_delimiter)\r\n{\r\n var formatLowerCase=_format.toLowerCase();\r\n var formatItems=formatLowerCase.split(_delimiter);\r\n var dateItems=_date.split(_delimiter);\r\n var monthIndex=formatItems.indexOf(\"mm\");\r\n var dayIndex=formatItems.indexOf(\"dd\");\r\n var yearIndex=formatItems.indexOf(\"yyyy\");\r\n var month=parseInt(dateItems[monthIndex]);\r\n month-=1;\r\n var formatedDate = new Date(dateItems[yearIndex],month,dateItems[dayIndex]);\r\n return formatedDate;\r\n}", "function makeDateFromStringAndFormat(config) {\n if (config._f === moment.ISO_8601) {\n parseISO(config);\n return;\n }\n \n config._a = [];\n config._pf.empty = true;\n \n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i, parsedInput, tokens, token, skipped,\n stringLength = string.length,\n totalParsedInputLength = 0;\n \n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n \n for (i = 0; i < tokens.length; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n config._pf.unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n config._pf.empty = false;\n }\n else {\n config._pf.unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n }\n else if (config._strict && !parsedInput) {\n config._pf.unusedTokens.push(token);\n }\n }\n \n // add remaining unparsed input length to the string\n config._pf.charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n config._pf.unusedInput.push(string);\n }\n \n // clear _12h flag if hour is <= 12\n if (config._pf.bigHour === true && config._a[HOUR] <= 12) {\n config._pf.bigHour = undefined;\n }\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR],\n config._meridiem);\n dateFromConfig(config);\n checkOverflow(config);\n }", "function stringToDate(_date,_format,_delimiter)\n{\n var formatLowerCase=_format.toLowerCase();\n var formatItems=formatLowerCase.split(_delimiter);\n var dateItems=_date.split(_delimiter);\n var monthIndex=formatItems.indexOf(\"mm\");\n var dayIndex=formatItems.indexOf(\"dd\");\n var yearIndex=formatItems.indexOf(\"yyyy\");\n var month=parseInt(dateItems[monthIndex]);\n month-=1;\n var formatedDate = new Date(dateItems[yearIndex],month,dateItems[dayIndex]);\n return formatedDate;\n}" ]
[ "0.6992324", "0.6912437", "0.6811143", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67109895", "0.67109895", "0.67109895", "0.66975677", "0.65970886", "0.65863997", "0.65863997", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65625644", "0.6480043", "0.64605933", "0.64605933", "0.64605933", "0.64605933", "0.64605933", "0.6419801", "0.6419801", "0.6419801", "0.6419801", "0.6419088", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.640779", "0.6400969", "0.6393603", "0.6393603", "0.6393603", "0.6392714", "0.6371693", "0.6371693", "0.6371693", "0.6371693", "0.6371693", "0.6371693", "0.6356297", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6350513", "0.6349246", "0.6341507", "0.63415045", "0.63415045", "0.63415045", "0.6331202", "0.63261753", "0.63261753", "0.6323412", "0.6323412", "0.6299627", "0.6275333", "0.62741286" ]
0.6364184
73
date from iso format
function parseISO(config) { var i, l, string = config._i, match = isoRegex.exec(string); if (match) { config._pf.iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(string)) { // match[5] should be 'T' or undefined config._f = isoDates[i][0] + (match[6] || ' '); break; } } for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(string)) { config._f += isoTimes[i][0]; break; } } if (string.match(parseTokenTimezone)) { config._f += 'Z'; } makeDateFromStringAndFormat(config); } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date.getMonth() + 1;\n mm = (mm < 10) ? '0' + mm : mm;\n var dd = date.getDate();\n dd = (dd < 10) ? '0' + dd : dd;\n var yyyy = date.getFullYear();\n var finaldate = mm + '/' + dd + '/' + yyyy;\n return finaldate;\n }", "function parseIsoDate(dateStr) {\n \tif(dateStr.length <10) return null;\n \tvar d = dateStr.substring(0,10).split('-');\t\n \tfor(var i in d) { \n \t\td[i]=parseInt(d[i]);\n \t};\n \td[1] = d[1] -1;//month;\n \tvar t = dateStr.substring(11,19).split(':');\n \treturn new Date(d[0],d[1],d[2],t[0],t[1],t[2]);\n }", "function ISOdate(d) {\r\n\ttry {\r\n\t\treturn d.toISOString().slice(0,10);\r\n\t}catch(e){\r\n\t\treturn 'Invalid ';\r\n\t}\r\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSetter=match[8]?date.setUTCFullYear:date.setFullYear;var timeSetter=match[8]?date.setUTCHours:date.setHours;// if there is a timezone defined like \"+01:00\" or \"+0100\"\nif(match[9]){tzHour=Number(match[9]+match[10]);tzMin=Number(match[9]+match[11]);}dateSetter.call(date,Number(match[1]),Number(match[2])-1,Number(match[3]));var h=Number(match[4]||0)-tzHour;var m=Number(match[5]||0)-tzMin;var s=Number(match[6]||0);var ms=Math.round(parseFloat('0.'+(match[7]||0))*1000);timeSetter.call(date,h,m,s,ms);return date;}", "function datetoisostring() { // @return String:\r\n return uudate(this).ISO();\r\n}", "function parseISODate(str) {\n pieces = /(\\d{4})-(\\d{2})-(\\d{2})/g.exec(str);\n if (pieces === null)\n return null;\n var year = parseInt(pieces[1], 10),\n month = parseInt(pieces[2], 10),\n day = parseInt(pieces[3], 10);\n return new Date(year, month - 1, day); // In ISO, months are 1-12; in JavaScript, months are 0-11.\n }", "function toISODate(date) {\n return date.toISOString().split('T')[0];\n }", "convertISOToCalendarFormat(ISOdate) {\n const isoArray = ISOdate.toString().split(' ');\n let day = isoArray[2];\n const monthStr = isoArray[1];\n const year = isoArray[3];\n\n const month = convertMonthStringtoNumber(monthStr);\n\n day = day.length === 2 ? day : '0' + day;\n\n return year + '-' + month + '-' + day;\n }", "function dateFromIsoString(isoDateString) {\r\n return fastDateParse.apply(null, isoDateString.split(/\\D/));\r\n }", "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function iso8601Decoder(isoStr) {\n return Date.parse(isoStr);\n }", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function parseIsoToTimestamp(_date) {\n if ( _date !== null ) {\n var s = $.trim(_date);\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/:00.000/, \"\");\n s = s.replace(/T/, \" \").replace(/Z/, \" UTC\");\n s = s.replace(/([\\+\\-]\\d\\d)\\:?(\\d\\d)/, \" $1$2\"); // -04:00 -> -0400\n return Number(new Date(s));\n }\n return null;\n }", "function convertDate( date ){\n\tvar day;\n\tvar month;\n\tvar year;\n\n\t//Extract year, month and day\n\tmonth = date.substr(0,2);\n\tday = date.substr(3,2);\n\tyear = date.substr(6);\n\n\t//compile the ynab compatible format\n\tdate = (year + \"-\" + month + \"-\" + day);\n\t\n\treturn date;\n}", "function amzDate(date, short) {\n const result = date.toISOString().replace(/[:\\-]|\\.\\d{3}/g, '').substr(0, 17)\n if (short) {\n return result.substr(0, 8)\n }\n return result\n}", "function parseISOString(s) {\n var b = s.split(/\\D+/);\n return new Date(Date.UTC(b[0], --b[1], b[2], b[3], b[4], 0, 0));\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function convertDate(date) {\n let day = date.substr(8, 2);\n let month = date.substr(5, 2);\n let year = date.substr(0, 4);\n date = day + \"/\" + month + \"/\" + year;\n return date;\n }", "function parseDate(isoString) {\n // Parse isoDateTimeString to JavaScript date object\n isoString = isoString.split('.', 1);\n return new Date(isoString[0] + '+00:00');\n }", "function isoDateFormat(strDateView) {\n return moment(strDateView, \"DD/MM/YYYY HH:mm\").format(\"YYYY-MM-DD HH:mm\")\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}", "function _dateCoerce(obj) {\n return obj.toISOString();\n}", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function formatDateIso(date) {\n\tif (!date || date == null) {\n\t\treturn \"\";\n\t}\n\t\n\tvar jsDate = new Date(date);\n\t\n\t// get the calendar-date components of the iso date. \n\tvar YYYY = jsDate.getFullYear();\n\tvar MM = (jsDate.getMonth() + 1) < 10 ? '0' + (jsDate.getMonth() + 1) : (jsDate.getMonth() + 1); // month should be in the form 'MM'.\n\tvar DD = jsDate.getDate() < 10 ? '0' + jsDate.getDate() : jsDate.getDate(); // day should be in the form 'DD'.\n\t\n\t// get the clock-time components of the iso date.\n\tvar hh = jsDate.getHours() < 10 ? '0' + jsDate.getHours() : jsDate.getHours(); // hours should be in the form 'hh'.\n\tvar mm = jsDate.getMinutes() < 10 ? '0' + jsDate.getMinutes() : jsDate.getMinutes(); // minutes should be in the form 'mm'.\n\tvar ss = jsDate.getSeconds() < 10 ? '0' + jsDate.getSeconds() : jsDate.getSeconds(); // seconds should be in the form 'ss'.\n\tvar sss = '000'; //just hardcoded 000 for milliseconds...\n\t\n\t// assemble the iso date from the date and time components.\n\tvar isoDate = YYYY + '-' + MM + '-' + DD + 'T' + // add the date components.\n\t\thh + ':' + mm + ':' + ss + '.' + sss + 'Z'; // add the time components.\n\t\t\n\t// return the iso-formatted version of the date.\n\treturn isoDate;\n}", "function getDate(dateISO){ \n let appointmentDate = new Date(dateISO);\n const date = appointmentDate.getDate() +'/' + appointmentDate.getMonth() + '/'+ appointmentDate.getFullYear();\n return date;\n }", "static isoDateTime(date) {\n var pad;\n console.log('Util.isoDatetime()', date);\n console.log('Util.isoDatetime()', date.getUTCMonth().date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes, date.getUTCSeconds);\n pad = function(n) {\n if (n < 10) {\n return '0' + n;\n } else {\n return n;\n }\n };\n return date.getFullYear()(+'-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z');\n }", "makeDateRFC3339(date) {\n var ret = this.dateStrings(date)\n return ret.year + \"-\" + ret.month + \"-\" + ret.day\n }", "function dateConverter(date){\r\n dateF = date.trim();\r\n let d = dateF.substring(0, 2);\r\n let m = dateF.substring(3,5);\r\n let y = dateF.substring(6,10);\r\n return(y +\"-\"+m+\"-\"+d);\r\n}", "function formatDateToISO(date) {\n return date.toISOString().split('T')[0];\n}", "function ISODateString(a){function b(a){return a<10?\"0\"+a:a}return a.getUTCFullYear()+\"-\"+b(a.getUTCMonth()+1)+\"-\"+b(a.getUTCDate())+\"T\"+b(a.getUTCHours())+\":\"+b(a.getUTCMinutes())+\":\"+b(a.getUTCSeconds())+\"Z\"}", "function isoToFormattedDate(timestamp) {\n\tvar date = new Date(timestamp);\n\treturn (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();\n}", "isIsoFormat(value) {\n let dateRegex = RegExp('[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$');\n return dateRegex.test(value);\n }", "function parseDateFormat(date) {\n return $filter('date')(date, 'yyyy-MM-dd');\n }", "function isoDateString(date, extended) {\n date = (date === undefined ? new Date() : date);\n var dash = (extended === 1 ? \"-\" : \"\");\n var yr = date.getFullYear();\n var dd = (\"0\" + date.getDate()).slice(-2);\n var mm = (\"0\" + (date.getMonth()+1)).slice(-2);\n \n return yr.toString() + dash +\n mm.toString() + dash +\n dd.toString();\n}", "function ISO_2022() {}", "function ISO_2022() {}", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 3; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return makeDateFromStringAndFormat(string, format + 'Z');\n }\n return new Date(string);\n }", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0; // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like \"+01:00\" or \"+0100\"\n\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0); // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n\n var ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function get_date(d) {\n var date1 = new Date(d.substr(0, 4), d.substr(5, 2) - 1, d.substr(8, 2), d.substr(11, 2), d.substr(14, 2), d.substr(17, 2));\n return date1;\n }", "function convert_date(str){var tmp=str.split(\".\");return new Date(tmp[1]+\"/\"+tmp[0]+\"/\"+tmp[2])}", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function convertBritishToISO(date) {\r\n dateF = date.trim();\r\n let d = dateF.substring(0, 2);\r\n let m = dateF.substring(3,5);\r\n let y = dateF.substring(6,10);\r\n return(y +\"/\"+m+\"/\"+d);\r\n}", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n \n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function toISODate(date) { // yyyy-mm-dd\n \"use strict\";\n var yyyy, mm, dd;\n // JavaScript provides no simple way to format a date-only\n yyyy = \"\" + date.getFullYear();\n mm = date.getMonth() + 1; // Months go from 0 .. 11\n dd = date.getDate();\n // Need leading zeroes to form the yyyy-mm-dd pattern.\n if (mm < 10) {\n mm = \"0\" + mm; // This converts it to a string\n }\n if (dd < 10) {\n dd = \"0\" + dd; // This converts it to a string\n }\n return \"\" + yyyy + \"-\" + mm + \"-\" + dd;\n}", "function formatDate(isoDateStr) {\n var date = new Date(isoDateStr);\n var monthNames = [\n \"Jan\", \"Feb\", \"Mar\",\n \"Apr\", \"May\", \"Jun\", \"Jul\",\n \"Aug\", \"September\", \"Oct\",\n \"Nov\", \"Dec\"\n ];\n\n var day = date.getDate();\n var monthIndex = date.getMonth();\n var year = date.getFullYear();\n var yearStr = \"\";\n if (year != (new Date()).getFullYear()) {\n yearStr = \", \" + String(year);\n }\n\n return \" \" + monthNames[monthIndex] + \" \" + day + \" \" + yearStr;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function parseDate (date) {\n var d = '';\n var t = date.indexOf('T');\n let index = date.indexOf('-');\n \n if(index === -1 && t === 8){\n d += date.substring(0, 4) + '-';\n d += date.substring(4, 6) + '-';\n d += date.substring(6, 8) + date.substr(8);\n } else if (index > -1 && t === 10) {\n return date;\n } else {\n console.error('invalid date');\n return null;\n }\n return d;\n }", "function iso8601date() {\n var date = new Date();\n\n function pad(number) {\n return (number < 10 ? '0' : '') + number;\n }\n function pad3(number) {\n return (number < 10 ? '0' : (number < 100 ? '00' : '')) + number;\n }\n\n return date.getUTCFullYear() + '-' +\n pad(date.getUTCMonth() + 1) + '-' +\n pad(date.getUTCDay()) + ' ' +\n pad(date.getUTCHours()) + ':' +\n pad(date.getUTCMinutes()) + ':' +\n pad(date.getUTCSeconds()) + '.' +\n pad3(date.getUTCMilliseconds());\n}", "function toIsoDate(dateString) {\n var splitted = dateString.split(\"/\");\n return new Date(splitted[2], splitted[1] - 1, splitted[0]);\n}", "extractDateFormat() {\n const isoString = '2018-12-31T12:00:00.000Z' // example date\n\n const intlString = this.props.intl.formatDate(isoString) // generate a formatted date\n const dateParts = isoString.split('T')[0].split('-') // prepare to replace with pattern parts\n\n return intlString\n .replace(dateParts[2], 'dd')\n .replace(dateParts[1], 'MM')\n .replace(dateParts[0], 'yyyy')\n }", "makeDateObjectFromCompact(datestring) {\n if (datestring !== undefined && datestring.length === 8) {\n let year = parseInt(datestring.substring(0, 4))\n let month = parseInt(datestring.substring(4, 6)) - 1\n let day = parseInt(datestring.substring(6, 8))\n return new Date(year, month, day)\n } else {\n return \"\"\n }\n }", "function ISODateString(d){\n function pad(n){return n<10 ? '0'+n : n}\n return d.getUTCFullYear()+'-'\n + pad(d.getUTCMonth()+1)+'-'\n + pad(d.getUTCDate())+'T'\n + pad(d.getUTCHours())+':'\n + pad(d.getUTCMinutes())+':'\n + pad(d.getUTCSeconds())+'Z'}", "getFormattedDate ({ date }) {\n if (typeof date === 'string') {\n return format(parseISO(date), \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }\n return format(date, \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }", "function makeDateFromString(config) {\n\t parseISO(config);\n\t if (config._isValid === false) {\n\t delete config._isValid;\n\t moment.createFromInputFallback(config);\n\t }\n\t }", "function makeDateFromString(config) {\n\t parseISO(config);\n\t if (config._isValid === false) {\n\t delete config._isValid;\n\t moment.createFromInputFallback(config);\n\t }\n\t }", "function FormatDate(date) {\n return new Date( parseInt( date.substr(6) ) );\n}", "function convertDate(dateIn)\n{\n let dateYear = dateIn.charAt(0);\n dateYear += dateIn.charAt(1);\n dateYear += dateIn.charAt(2);\n dateYear += dateIn.charAt(3);\n\n let dateMonth = dateIn.charAt(5) + dateIn.charAt(6);\n let dateDay = dateIn.charAt(8) + dateIn.charAt(9);\n\n let dateOut = dateDay + '-' + dateMonth + '-' + dateYear;\n return dateOut;\n}", "function convertDate(date) {\n let day = date.substring(8);\n let month = date.substring(5, 7);\n let year = date.substring(2,4);\n let newDate = `${month} /${day} /${year}`;\n return newDate;\n}", "function to_date(x){\n return new Date(x.substring(0,4), x.substring(5,7)-1, x.substring(8,10), x.substring(11,13), x.substring(14,16), x.substring(17,19));\n}", "function getISOLocalDate(value) {\n if (!value) {\n return value;\n }\n\n var date = new Date(value);\n\n if (isNaN(date.getTime())) {\n throw new Error(\"Invalid date: \".concat(value));\n }\n\n var year = getYear(date);\n var month = \"0\".concat(getMonth(date)).slice(-2);\n var day = \"0\".concat(getDay(date)).slice(-2);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(day);\n}", "function getISOLocalDate(value) {\n if (!value) {\n return value;\n }\n\n var date = new Date(value);\n\n if (isNaN(date.getTime())) {\n throw new Error(\"Invalid date: \".concat(value));\n }\n\n var year = getYear(date);\n var month = \"0\".concat(getMonth(date)).slice(-2);\n var day = \"0\".concat(getDay(date)).slice(-2);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(day);\n}" ]
[ "0.7161587", "0.7084152", "0.69561076", "0.68181574", "0.66757625", "0.66372114", "0.6559707", "0.6525335", "0.6466161", "0.6465599", "0.644205", "0.64171946", "0.6406543", "0.6406543", "0.6406543", "0.6406543", "0.63656497", "0.63241196", "0.6322188", "0.62742394", "0.62635076", "0.62635076", "0.62635076", "0.62635076", "0.6256379", "0.62237656", "0.6219025", "0.6201553", "0.6201553", "0.6201553", "0.6201553", "0.6201553", "0.6201553", "0.6201553", "0.6187698", "0.6187633", "0.618634", "0.618634", "0.61794", "0.61792564", "0.6172095", "0.613812", "0.61320627", "0.6129032", "0.609373", "0.6090011", "0.6071324", "0.60647243", "0.6062863", "0.60613644", "0.60613644", "0.606091", "0.606091", "0.606091", "0.606091", "0.606091", "0.6034974", "0.6000997", "0.5995632", "0.5995632", "0.5995632", "0.5995632", "0.5985886", "0.59761006", "0.5967464", "0.5967464", "0.59647685", "0.59567374", "0.59377056", "0.5936541", "0.5930827", "0.5930827", "0.5930827", "0.5930827", "0.5930827", "0.5930065", "0.5928079", "0.59234697", "0.5912456", "0.5900138", "0.5890115", "0.5882479", "0.58786935", "0.58786935", "0.58709115", "0.58588386", "0.5855063", "0.585465", "0.58419347", "0.58419347" ]
0.0
-1
date from iso format or fallback
function makeDateFromString(config) { parseISO(config); if (config._isValid === false) { delete config._isValid; moment.createFromInputFallback(config); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSetter=match[8]?date.setUTCFullYear:date.setFullYear;var timeSetter=match[8]?date.setUTCHours:date.setHours;// if there is a timezone defined like \"+01:00\" or \"+0100\"\nif(match[9]){tzHour=Number(match[9]+match[10]);tzMin=Number(match[9]+match[11]);}dateSetter.call(date,Number(match[1]),Number(match[2])-1,Number(match[3]));var h=Number(match[4]||0)-tzHour;var m=Number(match[5]||0)-tzMin;var s=Number(match[6]||0);var ms=Math.round(parseFloat('0.'+(match[7]||0))*1000);timeSetter.call(date,h,m,s,ms);return date;}", "function parseIsoDate(dateStr) {\n \tif(dateStr.length <10) return null;\n \tvar d = dateStr.substring(0,10).split('-');\t\n \tfor(var i in d) { \n \t\td[i]=parseInt(d[i]);\n \t};\n \td[1] = d[1] -1;//month;\n \tvar t = dateStr.substring(11,19).split(':');\n \treturn new Date(d[0],d[1],d[2],t[0],t[1],t[2]);\n }", "function makeDateFromString(config) {\n\t parseISO(config);\n\t if (config._isValid === false) {\n\t delete config._isValid;\n\t moment.createFromInputFallback(config);\n\t }\n\t }", "function makeDateFromString(config) {\n\t parseISO(config);\n\t if (config._isValid === false) {\n\t delete config._isValid;\n\t moment.createFromInputFallback(config);\n\t }\n\t }", "function ISOdate(d) {\r\n\ttry {\r\n\t\treturn d.toISOString().slice(0,10);\r\n\t}catch(e){\r\n\t\treturn 'Invalid ';\r\n\t}\r\n}", "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function makeDateFromString(config) {\n parseISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n moment.createFromInputFallback(config);\n }\n }", "isIsoFormat(value) {\n let dateRegex = RegExp('[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]$');\n return dateRegex.test(value);\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n moment.createFromInputFallback(config);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 4; i > 0; i--) {\n if (match[i]) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i - 1] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n\t\tparseISO(config);\n\t\tif (config._isValid === false) {\n\t\t\tdelete config._isValid;\n\t\t\tmoment.createFromInputFallback(config);\n\t\t}\n\t}", "function parseISODate(str) {\n pieces = /(\\d{4})-(\\d{2})-(\\d{2})/g.exec(str);\n if (pieces === null)\n return null;\n var year = parseInt(pieces[1], 10),\n month = parseInt(pieces[2], 10),\n day = parseInt(pieces[3], 10);\n return new Date(year, month - 1, day); // In ISO, months are 1-12; in JavaScript, months are 0-11.\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n }\n else {\n config._d = new Date(string);\n }\n }", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date.getMonth() + 1;\n mm = (mm < 10) ? '0' + mm : mm;\n var dd = date.getDate();\n dd = (dd < 10) ? '0' + dd : dd;\n var yyyy = date.getFullYear();\n var finaldate = mm + '/' + dd + '/' + yyyy;\n return finaldate;\n }", "function validateDateFormat(sDateToBeProcressed) {\r\n \"use strict\";\r\n var oDates = new Date(sDateToBeProcressed);\r\n if (isNaN(oDates)) {\r\n var arrSplitedDate = sDateToBeProcressed.replace(/[-]/g, \"/\");\r\n arrSplitedDate = arrSplitedDate.split(\"/\");\r\n var sFormattedDate = arrSplitedDate[1] + \"-\" + arrSplitedDate[0] + \"-\" + arrSplitedDate[2];\r\n oDates = new Date(sFormattedDate);\r\n }\r\n return oDates.toISOString();\r\n}", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n // match[2] should be \"T\" or undefined\n config._f = 'YYYY-MM-DD' + (match[2] || \" \");\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function parseIsoToTimestamp(_date) {\n if ( _date !== null ) {\n var s = $.trim(_date);\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/:00.000/, \"\");\n s = s.replace(/T/, \" \").replace(/Z/, \" UTC\");\n s = s.replace(/([\\+\\-]\\d\\d)\\:?(\\d\\d)/, \" $1$2\"); // -04:00 -> -0400\n return Number(new Date(s));\n }\n return null;\n }", "function dateFromIsoString(isoDateString) {\r\n return fastDateParse.apply(null, isoDateString.split(/\\D/));\r\n }", "deserialize(value) {\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the\n // string is the right format first.\n if (ISO_8601_REGEX.test(value)) {\n let date = new Date(value);\n if (this.isValid(date)) {\n return date;\n }\n }\n }\n return super.deserialize(value);\n }", "deserialize(value) {\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the\n // string is the right format first.\n if (ISO_8601_REGEX.test(value)) {\n let date = new Date(value);\n if (this.isValid(date)) {\n return date;\n }\n }\n }\n return super.deserialize(value);\n }", "deserialize(value) {\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n // The `Date` constructor accepts formats other than ISO 8601, so we need to make sure the\n // string is the right format first.\n if (ISO_8601_REGEX.test(value)) {\n let date = new Date(value);\n if (this.isValid(date)) {\n return date;\n }\n }\n }\n return super.deserialize(value);\n }", "getFormattedDate ({ date }) {\n if (typeof date === 'string') {\n return format(parseISO(date), \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }\n return format(date, \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }", "function universal() {\n return doFormat(date, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n weekday: 'long',\n hour: 'numeric',\n minute: '2-digit',\n second: '2-digit'\n });\n }", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0; // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like \"+01:00\" or \"+0100\"\n\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0); // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n\n var ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n }", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function getISOLocalDate(value) {\n if (!value) {\n return value;\n }\n\n var date = new Date(value);\n\n if (isNaN(date.getTime())) {\n throw new Error(\"Invalid date: \".concat(value));\n }\n\n var year = getYear(date);\n var month = \"0\".concat(getMonth(date)).slice(-2);\n var day = \"0\".concat(getDay(date)).slice(-2);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(day);\n}", "function getISOLocalDate(value) {\n if (!value) {\n return value;\n }\n\n var date = new Date(value);\n\n if (isNaN(date.getTime())) {\n throw new Error(\"Invalid date: \".concat(value));\n }\n\n var year = getYear(date);\n var month = \"0\".concat(getMonth(date)).slice(-2);\n var day = \"0\".concat(getDay(date)).slice(-2);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(day);\n}", "function configFromISO(config) {\n if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__utils_type_checks__[\"b\" /* isString */])(config._i)) {\n return config;\n }\n var input = config._i;\n var match = extendedIsoRegex.exec(input) || basicIsoRegex.exec(input);\n var allowTime;\n var dateFormat;\n var timeFormat;\n var tzFormat;\n if (!match) {\n config._isValid = false;\n return config;\n }\n // getParsingFlags(config).iso = true;\n var i;\n var l;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return config;\n }\n if (match[3]) {\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return config;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return config;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n }\n else {\n config._isValid = false;\n return config;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__from_string_and_format__[\"a\" /* configFromStringAndFormat */])(config);\n}", "function parseDateFormat(date) {\n return $filter('date')(date, 'yyyy-MM-dd');\n }", "function configFromISO(config) {\n if (!Object(__WEBPACK_IMPORTED_MODULE_1__utils_type_checks__[\"i\" /* isString */])(config._i)) {\n return config;\n }\n var input = config._i;\n var match = extendedIsoRegex.exec(input) || basicIsoRegex.exec(input);\n var allowTime;\n var dateFormat;\n var timeFormat;\n var tzFormat;\n if (!match) {\n config._isValid = false;\n return config;\n }\n // getParsingFlags(config).iso = true;\n var i;\n var l;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return config;\n }\n if (match[3]) {\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return config;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return config;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n }\n else {\n config._isValid = false;\n return config;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n return Object(__WEBPACK_IMPORTED_MODULE_2__from_string_and_format__[\"a\" /* configFromStringAndFormat */])(config);\n}", "function makeDateFromString(string) {\n var format = 'YYYY-MM-DDT',\n i;\n if (isoRegex.exec(string)) {\n for (i = 0; i < 3; i++) {\n if (isoTimes[i][1].exec(string)) {\n format += isoTimes[i][0];\n break;\n }\n }\n return makeDateFromStringAndFormat(string, format + 'Z');\n }\n return new Date(string);\n }", "normalize(str) {\n if (str && !CommonUtils.isDate(str)) {\n var match = str.match(/^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/);\n if (match) {\n return new Date(match[3], match[2] - 1, match[1]);\n }\n match = str.match(/^(\\d{4})-(\\d{1,2})-(\\d{1,2})$/);\n if (match) {\n return new Date(match[1], match[2] - 1, match[3]);\n }\n }\n }", "function parseDate (date) {\n var d = '';\n var t = date.indexOf('T');\n let index = date.indexOf('-');\n \n if(index === -1 && t === 8){\n d += date.substring(0, 4) + '-';\n d += date.substring(4, 6) + '-';\n d += date.substring(6, 8) + date.substr(8);\n } else if (index > -1 && t === 10) {\n return date;\n } else {\n console.error('invalid date');\n return null;\n }\n return d;\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function makeDateFromString(config) {\n var i,\n string = config._i;\n if (isoRegex.exec(string)) {\n config._f = 'YYYY-MM-DDT';\n for (i = 0; i < 4; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (parseTokenTimezone.exec(string)) {\n config._f += \" Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._d = new Date(string);\n }\n }", "function isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0; // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like \"+01:00\" or \"+0100\"\n\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0); // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "convertDateToISOString(date) {\n if (date) return moment(date, defaultDateFormat).toISOString();\n return date;\n }", "function isoDateFormat(strDateView) {\n return moment(strDateView, \"DD/MM/YYYY HH:mm\").format(\"YYYY-MM-DD HH:mm\")\n}", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n \n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function isoStringToDate(match) {\n var date = new Date(0);\n var tzHour = 0;\n var tzMin = 0; // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n\n var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n var timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like \"+01:00\" or \"+0100\"\n\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n var h = Number(match[4] || 0) - tzHour;\n var m = Number(match[5] || 0) - tzMin;\n var s = Number(match[6] || 0); // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n\n var ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}", "function _dateCoerce(obj) {\n return obj.toISOString();\n}", "function configFromISO(config){var i,l,string=config._i,match=extendedIsoRegex.exec(string)||basicIsoRegex.exec(string),allowTime,dateFormat,timeFormat,tzFormat;if(match){getParsingFlags(config).iso=true;for(i=0,l=isoDates.length;i<l;i++){if(isoDates[i][1].exec(match[1])){dateFormat=isoDates[i][0];allowTime=isoDates[i][2]!==false;break;}}if(dateFormat==null){config._isValid=false;return;}if(match[3]){for(i=0,l=isoTimes.length;i<l;i++){if(isoTimes[i][1].exec(match[3])){// match[2] should be 'T' or space\r\n\ttimeFormat=(match[2]||' ')+isoTimes[i][0];break;}}if(timeFormat==null){config._isValid=false;return;}}if(!allowTime&&timeFormat!=null){config._isValid=false;return;}if(match[4]){if(tzRegex.exec(match[4])){tzFormat='Z';}else{config._isValid=false;return;}}config._f=dateFormat+(timeFormat||'')+(tzFormat||'');configFromStringAndFormat(config);}else{config._isValid=false;}}// date from iso format or fallback", "function configFromISO(config){var i,l,string=config._i,match=extendedIsoRegex.exec(string)||basicIsoRegex.exec(string),allowTime,dateFormat,timeFormat,tzFormat;if(match){getParsingFlags(config).iso=true;for(i=0,l=isoDates.length;i<l;i++){if(isoDates[i][1].exec(match[1])){dateFormat=isoDates[i][0];allowTime=isoDates[i][2]!==false;break;}}if(dateFormat==null){config._isValid=false;return;}if(match[3]){for(i=0,l=isoTimes.length;i<l;i++){if(isoTimes[i][1].exec(match[3])){// match[2] should be 'T' or space\r\n\ttimeFormat=(match[2]||' ')+isoTimes[i][0];break;}}if(timeFormat==null){config._isValid=false;return;}}if(!allowTime&&timeFormat!=null){config._isValid=false;return;}if(match[4]){if(tzRegex.exec(match[4])){tzFormat='Z';}else{config._isValid=false;return;}}config._f=dateFormat+(timeFormat||'')+(tzFormat||'');configFromStringAndFormat(config);}else{config._isValid=false;}}// date from iso format or fallback", "function ISO_2022() {}", "function ISO_2022() {}", "function iso8601Decoder(isoStr) {\n return Date.parse(isoStr);\n }", "function parseISO(config) {\n\t var i, l,\n\t string = config._i,\n\t match = isoRegex.exec(string);\n\n\t if (match) {\n\t config._pf.iso = true;\n\t for (i = 0, l = isoDates.length; i < l; i++) {\n\t if (isoDates[i][1].exec(string)) {\n\t // match[5] should be 'T' or undefined\n\t config._f = isoDates[i][0] + (match[6] || ' ');\n\t break;\n\t }\n\t }\n\t for (i = 0, l = isoTimes.length; i < l; i++) {\n\t if (isoTimes[i][1].exec(string)) {\n\t config._f += isoTimes[i][0];\n\t break;\n\t }\n\t }\n\t if (string.match(parseTokenTimezone)) {\n\t config._f += 'Z';\n\t }\n\t makeDateFromStringAndFormat(config);\n\t } else {\n\t config._isValid = false;\n\t }\n\t }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be \"T\" or undefined\n config._f = isoDates[i][0] + (match[6] || \" \");\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += \"Z\";\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }", "function parseISO(config) {\n var i, l,\n string = config._i,\n match = isoRegex.exec(string);\n\n if (match) {\n config._pf.iso = true;\n for (i = 0, l = isoDates.length; i < l; i++) {\n if (isoDates[i][1].exec(string)) {\n // match[5] should be 'T' or undefined\n config._f = isoDates[i][0] + (match[6] || ' ');\n break;\n }\n }\n for (i = 0, l = isoTimes.length; i < l; i++) {\n if (isoTimes[i][1].exec(string)) {\n config._f += isoTimes[i][0];\n break;\n }\n }\n if (string.match(parseTokenTimezone)) {\n config._f += 'Z';\n }\n makeDateFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }" ]
[ "0.69151974", "0.66991687", "0.6643978", "0.65537083", "0.65537083", "0.6520427", "0.6492825", "0.64871174", "0.6448661", "0.64316744", "0.64316744", "0.64103484", "0.64103484", "0.6407205", "0.63858414", "0.6371779", "0.63675845", "0.63675845", "0.63675845", "0.63675845", "0.63675845", "0.6310807", "0.63043165", "0.6296922", "0.6296922", "0.6296922", "0.6296922", "0.62956905", "0.62956905", "0.62956905", "0.62956905", "0.62367827", "0.62285906", "0.62221026", "0.62221026", "0.62221026", "0.62183875", "0.61820984", "0.6167017", "0.6166754", "0.6166754", "0.6166754", "0.6166754", "0.6166754", "0.61617094", "0.61617094", "0.6147587", "0.61250347", "0.61188406", "0.611831", "0.6112176", "0.61092424", "0.6103642", "0.6103642", "0.6103642", "0.6103642", "0.6103642", "0.6071104", "0.60573643", "0.60538405", "0.60504943", "0.60102975", "0.60096854", "0.60056126", "0.60056126", "0.5989161", "0.5989161", "0.5979461", "0.5974252", "0.5971357", "0.5971357", "0.5971357", "0.5971161", "0.5971161", "0.5971161", "0.5971161", "0.5971161", "0.5971161" ]
0.64045346
34
Relative Time helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateRelativeDate() {\n let dateTimeElements = document.querySelectorAll('time.mm-relative-time');\n for (let i = 0, len = dateTimeElements.length; i < len; i++) {\n let skipSuffix = !['true', 'yes', 'y', '1'].includes(\n (dateTimeElements[i].dataset.mmSuffix || '')\n .toString()\n .trim()\n .toLowerCase()\n );\n dateTimeElements[i].textContent = moment(dateTimeElements[i].dateTime).fromNow(skipSuffix);\n }\n}", "function relative_time(time_value) {\n\t\tvar values = time_value.split(\" \");\n\t\ttime_value = values[1] + \" \" + values[2] + \", \" + values[5] + \" \" + values[3];\n\t\tvar parsed_date = Date.parse(time_value);\n\t\tvar relative_to = (arguments.length > 1) ? arguments[1] : new Date();\n\t\tvar delta = parseInt((relative_to.getTime() - parsed_date) / 1000);\n\t\tdelta = delta + (relative_to.getTimezoneOffset() * 60);\n\t\t\n\t\tvar r = '';\n\t\tif (delta < 60) {\n\t\t\tr = 'a minute ago';\n\t\t} else if(delta < 120) {\n\t\t r = 'couple of minutes ago';\n\t\t} else if(delta < (45*60)) {\n\t\t r = (parseInt(delta / 60)).toString() + ' minutes ago';\n\t\t} else if(delta < (90*60)) {\n\t\t r = 'an hour ago';\n\t\t} else if(delta < (24*60*60)) {\n\t\t r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';\n\t\t} else if(delta < (48*60*60)) {\n\t\t r = '1 day ago';\n\t\t} else {\n\t\t r = (parseInt(delta / 86400)).toString() + ' days ago';\n\t\t}\n\t\t\n\t\treturn r;\n\t}", "function relative_time(time_value) {\n var values = time_value.split(\" \");\n time_value = values[1] + \" \" + values[2] + \", \" + values[5] + \" \" + values[3];\n var parsed_date = Date.parse(time_value);\n var relative_to = (arguments.length > 1) ? arguments[1] : new Date();\n var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);\n delta = delta + (relative_to.getTimezoneOffset() * 60);\n\n if (delta < 60) {\n return 'less than a minute ago';\n } else if(delta < 120) {\n return 'about a minute ago';\n } else if(delta < (60*60)) {\n return (parseInt(delta / 60)).toString() + ' minutes ago';\n } else if(delta < (120*60)) {\n return 'about an hour ago';\n } else if(delta < (24*60*60)) {\n return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';\n } else if(delta < (48*60*60)) {\n return '1 day ago';\n } else {\n return (parseInt(delta / 86400)).toString() + ' days ago';\n }\n}", "function relative_time(time_value) {\r\n time_value = time_value.replace(\"+0000\", \"GMT\"); // Stupid IE tricks\r\n var parsed_date = Date.parse(time_value);\r\n\r\n var relative_to = new Date();\r\n var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);\r\n\r\n if(delta < 60) {\r\n return 'less than a minute ago';\r\n } else if(delta < 120) {\r\n return 'about a minute ago';\r\n } else if(delta < (45*60)) {\r\n return (parseInt(delta / 60)).toString() + ' minutes ago';\r\n } else if(delta < (90*60)) {\r\n return 'about an hour ago';\r\n } else if(delta < (24*60*60)) {\r\n return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';\r\n } else if(delta < (48*60*60)) {\r\n return '1 day ago';\r\n } else {\r\n return (parseInt(delta / 86400)).toString() + ' days ago';\r\n }\r\n}", "labelFunction(date) {\n return moment(date).fromNow();\n }", "fromNow(date /* , locale*/) {\n if (typeof date !== 'object') date = new Date(date);\n return moment(date).fromNow();\n }", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[number+\"sekundi\",number+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[number+\" minuti\",number+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[number+\" tunni\",number+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[number+\" kuu\",number+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[number+\" aasta\",number+\" aastat\"]};return withoutSuffix?format[key][2]?format[key][2]:format[key][1]:isFuture?format[key][0]:format[key][1]}", "function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture);}", "function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture);}", "function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture);}", "function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number||1,!!withoutSuffix,string,isFuture);}", "function substituteTimeAgo(string,number,withoutSuffix,isFuture,locale){return locale.relativeTime(number || 1,!!withoutSuffix,string,isFuture);}", "function getRelativeDateTimeStringPast(pastTime, startWithLowerCase) {\n 'use strict';\n if (startWithLowerCase === void 0) { startWithLowerCase = false; }\n var timespan = Date.now() - pastTime.getTime(); // time elapsed in ms\n if (timespan < -5 * ONE_MINUTE) {\n return pastTime.toLocaleDateString(Locale_1.default.language);\n }\n else if (timespan < ONE_MINUTE) {\n // \"Less than a minute ago\"\n return startWithLowerCase ? DatetimeResx.strings.RelativeDateTime_LessThanAMinute_StartWithLowerCase : DatetimeResx.strings.RelativeDateTime_LessThanAMinute;\n }\n else if (timespan < TWO_MINUTES) {\n // \"About a minute ago\"\n return startWithLowerCase ? DatetimeResx.strings.RelativeDateTime_AboutAMinute_StartWithLowerCase : DatetimeResx.strings.RelativeDateTime_AboutAMinute;\n }\n else if (timespan < ONE_HOUR) {\n // \"{0} minutes ago\"\n var minutes = Math.floor(timespan / ONE_MINUTE);\n return StringHelper_1.getLocalizedCountValue(DatetimeResx.strings.RelativeDateTime_XMinutes, DatetimeResx.strings.RelativeDateTime_XMinutesIntervals, minutes).replace(\"{0}\", String(minutes));\n }\n else if (timespan < TWO_HOURS) {\n // \"About an hour ago\"\n return startWithLowerCase ? DatetimeResx.strings.RelativeDateTime_AboutAnHour_StartWithLowerCase : DatetimeResx.strings.RelativeDateTime_AboutAnHour;\n }\n else if (timespan < ONE_DAY) {\n // \"{0} hours ago\"\n var hours = Math.floor(timespan / ONE_HOUR);\n return StringHelper_1.getLocalizedCountValue(DatetimeResx.strings.RelativeDateTime_XHours, DatetimeResx.strings.RelativeDateTime_XHoursIntervals, hours).replace(\"{0}\", String(hours));\n }\n else if (timespan < TWO_DAYS) {\n // \"Yesterday at {0}\"\n return startWithLowerCase ? DatetimeResx.strings.RelativeDateTime_YesterdayAndTime_StartWithLowerCase.replace(\"{0}\", pastTime.toLocaleTimeString(Locale_1.default.language)) :\n DatetimeResx.strings.RelativeDateTime_YesterdayAndTime.replace(\"{0}\", pastTime.toLocaleTimeString(Locale_1.default.language));\n }\n else if (timespan < ONE_MONTH) {\n // \"{0} days ago\" (in the past month-ish)\n var days = Math.floor(timespan / ONE_DAY);\n return StringHelper_1.getLocalizedCountValue(DatetimeResx.strings.RelativeDateTime_XDays, DatetimeResx.strings.RelativeDateTime_XDaysIntervals, days).replace(\"{0}\", String(days));\n }\n // Any other time, just return the regular full original time\n return pastTime.toLocaleDateString(Locale_1.default.language); // browser-determined localized date (no time)\n}", "createdAgo(date) { return moment(date).fromNow() }", "function relativeTimeWithMutation(number,withoutSuffix,key){var format={'mm':'munutenn','MM':'miz','dd':'devezh'};return number + ' ' + mutation(format[key],number);}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[number+\" Tage\",number+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[number+\" Monate\",number+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[number+\" Jahre\",number+\" Jahren\"]};return withoutSuffix?format[key][0]:format[key][1]}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[number+\" Tage\",number+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[number+\" Monate\",number+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[number+\" Jahre\",number+\" Jahren\"]};return withoutSuffix?format[key][0]:format[key][1]}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[number+\" Tage\",number+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[number+\" Monate\",number+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[number+\" Jahre\",number+\" Jahren\"]};return withoutSuffix?format[key][0]:format[key][1]}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={'m':['eine Minute','einer Minute'],'h':['eine Stunde','einer Stunde'],'d':['ein Tag','einem Tag'],'dd':[number + ' Tage',number + ' Tagen'],'M':['ein Monat','einem Monat'],'MM':[number + ' Monate',number + ' Monaten'],'y':['ein Jahr','einem Jahr'],'yy':[number + ' Jahre',number + ' Jahren']};return withoutSuffix?format[key][0]:format[key][1];}", "function processRelativeTime$1(number,withoutSuffix,key,isFuture){var format={'m':['eine Minute','einer Minute'],'h':['eine Stunde','einer Stunde'],'d':['ein Tag','einem Tag'],'dd':[number + ' Tage',number + ' Tagen'],'M':['ein Monat','einem Monat'],'MM':[number + ' Monate',number + ' Monaten'],'y':['ein Jahr','einem Jahr'],'yy':[number + ' Jahre',number + ' Jahren']};return withoutSuffix?format[key][0]:format[key][1];}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={m:[\"eng Minutt\",\"enger Minutt\"],h:[\"eng Stonn\",\"enger Stonn\"],d:[\"een Dag\",\"engem Dag\"],M:[\"ee Mount\",\"engem Mount\"],y:[\"ee Joer\",\"engem Joer\"]};return withoutSuffix?format[key][0]:format[key][1]}", "function processRelativeTime$5(number,withoutSuffix,key,isFuture){var format={'m':['eng Minutt','enger Minutt'],'h':['eng Stonn','enger Stonn'],'d':['een Dag','engem Dag'],'M':['ee Mount','engem Mount'],'y':['ee Joer','engem Joer']};return withoutSuffix?format[key][0]:format[key][1];}", "function processRelativeTime$2(number,withoutSuffix,key,isFuture){var format={'m':['eine Minute','einer Minute'],'h':['eine Stunde','einer Stunde'],'d':['ein Tag','einem Tag'],'dd':[number + ' Tage',number + ' Tagen'],'M':['ein Monat','einem Monat'],'MM':[number + ' Monate',number + ' Monaten'],'y':['ein Jahr','einem Jahr'],'yy':[number + ' Jahre',number + ' Jahren']};return withoutSuffix?format[key][0]:format[key][1];}", "function relativeTimeWithMutation(number,withoutSuffix,key){var format={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return number+\" \"+mutation(format[key],number)}", "function processRelativeTime$3(number,withoutSuffix,key,isFuture){var format={'s':['mõne sekundi','mõni sekund','paar sekundit'],'ss':[number + 'sekundi',number + 'sekundit'],'m':['ühe minuti','üks minut'],'mm':[number + ' minuti',number + ' minutit'],'h':['ühe tunni','tund aega','üks tund'],'hh':[number + ' tunni',number + ' tundi'],'d':['ühe päeva','üks päev'],'M':['kuu aja','kuu aega','üks kuu'],'MM':[number + ' kuu',number + ' kuud'],'y':['ühe aasta','aasta','üks aasta'],'yy':[number + ' aasta',number + ' aastat']};if(withoutSuffix){return format[key][2]?format[key][2]:format[key][1];}return isFuture?format[key][0]:format[key][1];}", "function et__processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n 'm' : ['ühe minuti', 'üks minut'],\n 'mm': [number + ' minuti', number + ' minutit'],\n 'h' : ['ühe tunni', 'tund aega', 'üks tund'],\n 'hh': [number + ' tunni', number + ' tundi'],\n 'd' : ['ühe päeva', 'üks päev'],\n 'M' : ['kuu aja', 'kuu aega', 'üks kuu'],\n 'MM': [number + ' kuu', number + ' kuud'],\n 'y' : ['ühe aasta', 'aasta', 'üks aasta'],\n 'yy': [number + ' aasta', number + ' aastat']\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function et__processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n 'm' : ['ühe minuti', 'üks minut'],\n 'mm': [number + ' minuti', number + ' minutit'],\n 'h' : ['ühe tunni', 'tund aega', 'üks tund'],\n 'hh': [number + ' tunni', number + ' tundi'],\n 'd' : ['ühe päeva', 'üks päev'],\n 'M' : ['kuu aja', 'kuu aega', 'üks kuu'],\n 'MM': [number + ' kuu', number + ' kuud'],\n 'y' : ['ühe aasta', 'aasta', 'üks aasta'],\n 'yy': [number + ' aasta', number + ' aastat']\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n\t var format = {\n\t s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n\t ss: [number + 'sekundi', number + 'sekundit'],\n\t m: ['ühe minuti', 'üks minut'],\n\t mm: [number + ' minuti', number + ' minutit'],\n\t h: ['ühe tunni', 'tund aega', 'üks tund'],\n\t hh: [number + ' tunni', number + ' tundi'],\n\t d: ['ühe päeva', 'üks päev'],\n\t M: ['kuu aja', 'kuu aega', 'üks kuu'],\n\t MM: [number + ' kuu', number + ' kuud'],\n\t y: ['ühe aasta', 'aasta', 'üks aasta'],\n\t yy: [number + ' aasta', number + ' aastat'],\n\t };\n\t if (withoutSuffix) {\n\t return format[key][2] ? format[key][2] : format[key][1];\n\t }\n\t return isFuture ? format[key][0] : format[key][1];\n\t }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n\t var format = {\n\t m: ['eng Minutt', 'enger Minutt'],\n\t h: ['eng Stonn', 'enger Stonn'],\n\t d: ['een Dag', 'engem Dag'],\n\t M: ['ee Mount', 'engem Mount'],\n\t y: ['ee Joer', 'engem Joer'],\n\t };\n\t return withoutSuffix ? format[key][0] : format[key][1];\n\t }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n\t var format = {\n\t m: ['eine Minute', 'einer Minute'],\n\t h: ['eine Stunde', 'einer Stunde'],\n\t d: ['ein Tag', 'einem Tag'],\n\t dd: [number + ' Tage', number + ' Tagen'],\n\t w: ['eine Woche', 'einer Woche'],\n\t M: ['ein Monat', 'einem Monat'],\n\t MM: [number + ' Monate', number + ' Monaten'],\n\t y: ['ein Jahr', 'einem Jahr'],\n\t yy: [number + ' Jahre', number + ' Jahren'],\n\t };\n\t return withoutSuffix ? format[key][0] : format[key][1];\n\t }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n\t var format = {\n\t m: ['eine Minute', 'einer Minute'],\n\t h: ['eine Stunde', 'einer Stunde'],\n\t d: ['ein Tag', 'einem Tag'],\n\t dd: [number + ' Tage', number + ' Tagen'],\n\t w: ['eine Woche', 'einer Woche'],\n\t M: ['ein Monat', 'einem Monat'],\n\t MM: [number + ' Monate', number + ' Monaten'],\n\t y: ['ein Jahr', 'einem Jahr'],\n\t yy: [number + ' Jahre', number + ' Jahren'],\n\t };\n\t return withoutSuffix ? format[key][0] : format[key][1];\n\t }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n\t var format = {\n\t m: ['eine Minute', 'einer Minute'],\n\t h: ['eine Stunde', 'einer Stunde'],\n\t d: ['ein Tag', 'einem Tag'],\n\t dd: [number + ' Tage', number + ' Tagen'],\n\t w: ['eine Woche', 'einer Woche'],\n\t M: ['ein Monat', 'einem Monat'],\n\t MM: [number + ' Monate', number + ' Monaten'],\n\t y: ['ein Jahr', 'einem Jahr'],\n\t yy: [number + ' Jahre', number + ' Jahren'],\n\t };\n\t return withoutSuffix ? format[key][0] : format[key][1];\n\t }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'] };\n\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eine Minute', 'einer Minute'],\n 'h': ['eine Stunde', 'einer Stunde'],\n 'd': ['ein Tag', 'einem Tag'],\n 'dd': [number + ' Tage', number + ' Tagen'],\n 'M': ['ein Monat', 'einem Monat'],\n 'MM': [number + ' Monate', number + ' Monaten'],\n 'y': ['ein Jahr', 'einem Jahr'],\n 'yy': [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat']\n };\n\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime$1(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eine Minute', 'einer Minute'],\n 'h': ['eine Stunde', 'einer Stunde'],\n 'd': ['ein Tag', 'einem Tag'],\n 'dd': [number + ' Tage', number + ' Tagen'],\n 'M': ['ein Monat', 'einem Monat'],\n 'MM': [number + ' Monate', number + ' Monaten'],\n 'y': ['ein Jahr', 'einem Jahr'],\n 'yy': [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],\n ss: [number + 'sekundi', number + 'sekundit'],\n m: ['ühe minuti', 'üks minut'],\n mm: [number + ' minuti', number + ' minutit'],\n h: ['ühe tunni', 'tund aega', 'üks tund'],\n hh: [number + ' tunni', number + ' tundi'],\n d: ['ühe päeva', 'üks päev'],\n M: ['kuu aja', 'kuu aega', 'üks kuu'],\n MM: [number + ' kuu', number + ' kuud'],\n y: ['ühe aasta', 'aasta', 'üks aasta'],\n yy: [number + ' aasta', number + ' aastat'],\n };\n if (withoutSuffix) {\n return format[key][2] ? format[key][2] : format[key][1];\n }\n return isFuture ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime$1(number, withoutSuffix, key, isFuture) {\n\tvar format = {\n\t\t'm': ['eine Minute', 'einer Minute'],\n\t\t'h': ['eine Stunde', 'einer Stunde'],\n\t\t'd': ['ein Tag', 'einem Tag'],\n\t\t'dd': [number + ' Tage', number + ' Tagen'],\n\t\t'M': ['ein Monat', 'einem Monat'],\n\t\t'MM': [number + ' Monate', number + ' Monaten'],\n\t\t'y': ['ein Jahr', 'einem Jahr'],\n\t\t'yy': [number + ' Jahre', number + ' Jahren']\n\t};\n\treturn withoutSuffix ? format[key][0] : format[key][1];\n}", "function processRelativeTime(number,withoutSuffix,key,isFuture){var format={s:[\"thoddea sekondamni\",\"thodde sekond\"],ss:[number+\" sekondamni\",number+\" sekond\"],m:[\"eka mintan\",\"ek minut\"],mm:[number+\" mintamni\",number+\" mintam\"],h:[\"eka voran\",\"ek vor\"],hh:[number+\" voramni\",number+\" voram\"],d:[\"eka disan\",\"ek dis\"],dd:[number+\" disamni\",number+\" dis\"],M:[\"eka mhoinean\",\"ek mhoino\"],MM:[number+\" mhoineamni\",number+\" mhoine\"],y:[\"eka vorsan\",\"ek voros\"],yy:[number+\" vorsamni\",number+\" vorsam\"]};return isFuture?format[key][0]:format[key][1]}", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eine Minute', 'einer Minute'],\n 'h': ['eine Stunde', 'einer Stunde'],\n 'd': ['ein Tag', 'einem Tag'],\n 'dd': [number + ' Tage', number + ' Tagen'],\n 'M': ['ein Monat', 'einem Monat'],\n 'MM': [number + ' Monate', number + ' Monaten'],\n 'y': ['ein Jahr', 'einem Jahr'],\n 'yy': [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eng Minutt', 'enger Minutt'],\n h: ['eng Stonn', 'enger Stonn'],\n d: ['een Dag', 'engem Dag'],\n M: ['ee Mount', 'engem Mount'],\n y: ['ee Joer', 'engem Joer']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number,withoutSuffix,key,isFuture){var result=number+\" \";switch(key){case\"s\":return withoutSuffix||isFuture?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return result+=1===number?withoutSuffix?\"sekundo\":\"sekundi\":2===number?withoutSuffix||isFuture?\"sekundi\":\"sekundah\":number<5?withoutSuffix||isFuture?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return withoutSuffix?\"ena minuta\":\"eno minuto\";case\"mm\":return result+=1===number?withoutSuffix?\"minuta\":\"minuto\":2===number?withoutSuffix||isFuture?\"minuti\":\"minutama\":number<5?withoutSuffix||isFuture?\"minute\":\"minutami\":withoutSuffix||isFuture?\"minut\":\"minutami\";case\"h\":return withoutSuffix?\"ena ura\":\"eno uro\";case\"hh\":return result+=1===number?withoutSuffix?\"ura\":\"uro\":2===number?withoutSuffix||isFuture?\"uri\":\"urama\":number<5?withoutSuffix||isFuture?\"ure\":\"urami\":withoutSuffix||isFuture?\"ur\":\"urami\";case\"d\":return withoutSuffix||isFuture?\"en dan\":\"enim dnem\";case\"dd\":return result+=1===number?withoutSuffix||isFuture?\"dan\":\"dnem\":2===number?withoutSuffix||isFuture?\"dni\":\"dnevoma\":withoutSuffix||isFuture?\"dni\":\"dnevi\";case\"M\":return withoutSuffix||isFuture?\"en mesec\":\"enim mesecem\";case\"MM\":return result+=1===number?withoutSuffix||isFuture?\"mesec\":\"mesecem\":2===number?withoutSuffix||isFuture?\"meseca\":\"mesecema\":number<5?withoutSuffix||isFuture?\"mesece\":\"meseci\":withoutSuffix||isFuture?\"mesecev\":\"meseci\";case\"y\":return withoutSuffix||isFuture?\"eno leto\":\"enim letom\";case\"yy\":return result+=1===number?withoutSuffix||isFuture?\"leto\":\"letom\":2===number?withoutSuffix||isFuture?\"leti\":\"letoma\":number<5?withoutSuffix||isFuture?\"leta\":\"leti\":withoutSuffix||isFuture?\"let\":\"leti\"}}", "function lb__processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eng Minutt', 'enger Minutt'],\n 'h': ['eng Stonn', 'enger Stonn'],\n 'd': ['een Dag', 'engem Dag'],\n 'M': ['ee Mount', 'engem Mount'],\n 'y': ['ee Joer', 'engem Joer']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function lb__processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eng Minutt', 'enger Minutt'],\n 'h': ['eng Stonn', 'enger Stonn'],\n 'd': ['een Dag', 'engem Dag'],\n 'M': ['ee Mount', 'engem Mount'],\n 'y': ['ee Joer', 'engem Joer']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime$1(number, withoutSuffix, key, isFuture) {\n var format = {\n 'm': ['eine Minute', 'einer Minute'],\n 'h': ['eine Stunde', 'einer Stunde'],\n 'd': ['ein Tag', 'einem Tag'],\n 'dd': [number + ' Tage', number + ' Tagen'],\n 'M': ['ein Monat', 'einem Monat'],\n 'MM': [number + ' Monate', number + ' Monaten'],\n 'y': ['ein Jahr', 'einem Jahr'],\n 'yy': [number + ' Jahre', number + ' Jahren']\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'] };\n\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'] };\n\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'] };\n\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eng Minutt', 'enger Minutt'],\n h: ['eng Stonn', 'enger Stonn'],\n d: ['een Dag', 'engem Dag'],\n M: ['ee Mount', 'engem Mount'],\n y: ['ee Joer', 'engem Joer'] };\n\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }", "function processRelativeTime(number, withoutSuffix, key, isFuture) {\n var format = {\n m: ['eine Minute', 'einer Minute'],\n h: ['eine Stunde', 'einer Stunde'],\n d: ['ein Tag', 'einem Tag'],\n dd: [number + ' Tage', number + ' Tagen'],\n w: ['eine Woche', 'einer Woche'],\n M: ['ein Monat', 'einem Monat'],\n MM: [number + ' Monate', number + ' Monaten'],\n y: ['ein Jahr', 'einem Jahr'],\n yy: [number + ' Jahre', number + ' Jahren'],\n };\n return withoutSuffix ? format[key][0] : format[key][1];\n }" ]
[ "0.71941125", "0.7127394", "0.6900822", "0.6655317", "0.6595474", "0.6592507", "0.6548907", "0.6513634", "0.6513634", "0.6513634", "0.6513634", "0.64771926", "0.6451322", "0.64374864", "0.63676035", "0.6341692", "0.6341692", "0.6341692", "0.63083524", "0.62938464", "0.6293726", "0.6222506", "0.6213746", "0.6209349", "0.61979204", "0.6197743", "0.6197743", "0.61845064", "0.61775744", "0.61548156", "0.61548156", "0.61548156", "0.61547256", "0.6153372", "0.61390024", "0.6116764", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.60931444", "0.6089131", "0.6089131", "0.6089131", "0.6082872", "0.6077305", "0.6066363", "0.6043225", "0.60386825", "0.6035292", "0.6035292", "0.60281277", "0.6023879", "0.6023879", "0.6023879", "0.60155857", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514", "0.60065514" ]
0.0
-1
Week of Year firstDayOfWeek 0 = sun, 6 = sat the day of the week that starts the week (usually sunday or monday) firstDayOfWeekOfYear 0 = sun, 6 = sat the first week is the week that contains the first of this day of the week (eg. ISO weeks use thursday (4))
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) { var end = firstDayOfWeekOfYear - firstDayOfWeek, daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(), adjustedMoment; if (daysToDayOfWeek > end) { daysToDayOfWeek -= 7; } if (daysToDayOfWeek < end - 7) { daysToDayOfWeek += 7; } adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd'); return { week: Math.ceil(adjustedMoment.dayOfYear() / 7), year: adjustedMoment.year() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\r\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\r\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\r\n adjustedMoment;\r\n\r\n\r\n if (daysToDayOfWeek > end) {\r\n daysToDayOfWeek -= 7;\r\n }\r\n\r\n if (daysToDayOfWeek < end - 7) {\r\n daysToDayOfWeek += 7;\r\n }\r\n\r\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\r\n return {\r\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\r\n year: adjustedMoment.year()\r\n };\r\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n\t var end = firstDayOfWeekOfYear - firstDayOfWeek,\n\t daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n\t adjustedMoment;\n\n\n\t if (daysToDayOfWeek > end) {\n\t daysToDayOfWeek -= 7;\n\t }\n\n\t if (daysToDayOfWeek < end - 7) {\n\t daysToDayOfWeek += 7;\n\t }\n\n\t adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n\t return {\n\t week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n\t year: adjustedMoment.year()\n\t };\n\t }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n\t var end = firstDayOfWeekOfYear - firstDayOfWeek,\n\t daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n\t adjustedMoment;\n\n\n\t if (daysToDayOfWeek > end) {\n\t daysToDayOfWeek -= 7;\n\t }\n\n\t if (daysToDayOfWeek < end - 7) {\n\t daysToDayOfWeek += 7;\n\t }\n\n\t adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n\t return {\n\t week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n\t year: adjustedMoment.year()\n\t };\n\t }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n \n \n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n \n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n \n adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day();\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n return Math.ceil(moment(mom).add('d', daysToDayOfWeek).dayOfYear() / 7);\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n\t\tvar end = firstDayOfWeekOfYear - firstDayOfWeek, daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(), adjustedMoment;\n\n\t\tif (daysToDayOfWeek > end) {\n\t\t\tdaysToDayOfWeek -= 7;\n\t\t}\n\n\t\tif (daysToDayOfWeek < end - 7) {\n\t\t\tdaysToDayOfWeek += 7;\n\t\t}\n\n\t\tadjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');\n\t\treturn {\n\t\t\tweek: Math.ceil(adjustedMoment.dayOfYear() / 7),\n\t\t\tyear: adjustedMoment.year()\n\t\t};\n\t}", "function getFirstDayWeekOfYear(date, firstDayOfWeek) {\n var num = getDayOfYear(date) - 1;\n var num2 = date.getDay() - (num % _dateValues_timeConstants__WEBPACK_IMPORTED_MODULE_0__.TimeConstants.DaysInOneWeek);\n var num3 = (num2 - firstDayOfWeek + 2 * _dateValues_timeConstants__WEBPACK_IMPORTED_MODULE_0__.TimeConstants.DaysInOneWeek) % _dateValues_timeConstants__WEBPACK_IMPORTED_MODULE_0__.TimeConstants.DaysInOneWeek;\n return Math.floor((num + num3) / _dateValues_timeConstants__WEBPACK_IMPORTED_MODULE_0__.TimeConstants.DaysInOneWeek + 1);\n}", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n\t var end = firstDayOfWeekOfYear - firstDayOfWeek,\n\t daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n\t adjustedMoment;\n\n\n\t if (daysToDayOfWeek > end) {\n\t daysToDayOfWeek -= 7;\n\t }\n\n\t if (daysToDayOfWeek < end - 7) {\n\t daysToDayOfWeek += 7;\n\t }\n\n\t adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');\n\t return {\n\t week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n\t year: adjustedMoment.year()\n\t };\n\t }", "function getWeekOfYear(date, weekStart) {\n\tweekStart = (weekStart || weekStart == 0 ? weekStart : 1);\n\tvar checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(),\n\t\t(date.getTimezoneOffset() / -60));\n\tvar firstDay = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan\n\tvar firstDOW = firstDay.getDay(); // Day of week: Sun = 0, Mon = 1, ...\n\tfirstDay.setDate(4 + weekStart - firstDOW - (weekStart > firstDOW ? 7 : 0)); // Preceding week start\n\tif (checkDate < firstDay) { // Adjust first three days in year if necessary\n\t\tcheckDate.setDate(checkDate.getDate() - 3); // Generate for previous year\n\t\treturn getWeekOfYear(checkDate, weekStart);\n\t} else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year\n\t\tvar firstDay2 = new Date(checkDate.getFullYear() + 1, 1 - 1, 4); // Find first week in next year\n\t\tfirstDOW = firstDay2.getDay();\n\t\tfirstDay2.setDate(4 + weekStart - firstDOW - (weekStart > firstDOW ? 7 : 0));\n\t\tif (checkDate >= firstDay2) { // Adjust if necessary\n\t\t\treturn 1;\n\t\t}\n\t}\n\treturn Math.floor(((checkDate - firstDay) /\n\t\t(FREQ_SETTINGS[DY].factor * 1000)) / 7) + 1; // Weeks to given date\n}", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n\t var end = firstDayOfWeekOfYear - firstDayOfWeek,\n\t daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n\t adjustedMoment;\n\n\t if (daysToDayOfWeek > end) {\n\t daysToDayOfWeek -= 7;\n\t }\n\n\t if (daysToDayOfWeek < end - 7) {\n\t daysToDayOfWeek += 7;\n\t }\n\n\t adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');\n\t return {\n\t week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n\t year: adjustedMoment.year()\n\t };\n\t }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n }\n\n if (daysToDayOfWeek < end - 7) {\n daysToDayOfWeek += 7;\n }\n\n adjustedMoment = moment(mom).add('d', daysToDayOfWeek);\n return {\n week: Math.ceil(adjustedMoment.dayOfYear() / 7),\n year: adjustedMoment.year()\n };\n }", "function startOfWeek() {\n\t\t\t// console.log('StarOfWeek :: targetYear 1 : ' + targetYear);\n\t\t\t// console.log('StarOfWeek :: targetDayOfWeek : '+targetDayOfWeek);\n\t\t\tif (targetDayOfWeek == 0) {\n\t\t\t\ttargetSundayDate = [targetYear,targetMonth,targetDay];\n\t\t\t\t// console.log('if (targetDayOfWeek == 0) then '+targetSundayDate)\n\t\t\t\t// console.log('StarOfWeek :: targetYear 3 : ' + targetYear);\n\t\t\t} else if(targetDayOfWeek<=targetDay) {\n\t\t\t\t// console.log('if(targetDayOfWeek<=targetDay) :: ('+targetDayOfWeek+'<='+targetDay+')');\n\t\t\t\ttargetSundayDate = [targetYear,targetMonth,\n\t\t\t\t\ttargetDay-targetDayOfWeek];\n\t\t\t\t// console.log('StarOfWeek :: targetYear 4 : ' + targetYear);\n\t\t\t} else {\n\t\t\t\t// console.log('if(targetDayOfWeek>targetDay) :: ('+targetDayOfWeek+'>'+targetDay+')');\n\t\t\t\t// console.log('targetMonth :: '+targetMonth);\n\t\t\t\tif (targetMonth==0) {\n\t\t\t\t\tvar tempMonth = 11;\n\t\t\t\t\tvar tempYear = targetYear-1;\n\t\t\t\t} else {\n\t\t\t\t\tvar tempMonth = targetMonth - 1;\n\t\t\t\t\tvar tempYear = targetYear;\n\t\t\t\t}\n\t\t\t\t// console.log('monthName[tempMonth] :: '+monthName[tempMonth]);\n\t\t\t\tvar tempSundayDay = monthLength[tempMonth] \n\t\t\t\t\t- (targetDayOfWeek-targetDay);\n\t\t\t\ttargetSundayDate = [tempYear,tempMonth,tempSundayDay];\n\t\t\t\t// console.log('StarOfWeek :: targetYear 5 : ' + targetSundayDate[0]);\n\t\t\t}\n\n\t\t\t// console.log('StarOfWeek :: targetYear 2 : ' + targetYear);\n\t\t\t// console.log('function startOfWeek :: Sunday: '+ targetSundayDate[2]+' '+monthName[targetSundayDate[1]]+' '+targetSundayDate[0]);\n\t\t\tadjustForLeapYears('startOfWeek()',targetSundayDate[0]);\n\t\t}", "function getWeekDayFirst(){\n var currentMonthFirstDayDate = getMonthFirstDayDate();\n var weekDay = currentMonthFirstDayDate.getDay();\n\n if(weekDay == 0){\n weekDay = 7;\n }\n\n return weekDay;\n}", "function yearStart(y) {\n var onejan = new Date(y, 0, 1);\n var firstSatJan = new Date(y, 0, 1);\n firstSatJan.setDate(onejan.getDate() + (6 - onejan.getDay())); //First 'Day 6' (Sat)\n return firstSatJan;\n }", "function getStartOfWeek() {\n\tvar startOfWeek = getStartOfToday();\n\t// Get the day of week where Monday is 0 and Sunday is 6.\n\tvar dayOfWeek = (startOfWeek.getUTCDay() + 6) % 7;\n\tstartOfWeek.setUTCDate(startOfWeek.getUTCDate() - dayOfWeek);\n\treturn startOfWeek;\n}", "function startOfIsoWeek (y, w) {\n const dow = isoDow(y, 1, 1);\n const startDay = dow > 4 ? 9 - dow : 2 - dow;\n const startDate = new Date(y, 0, startDay);\n return addDays(startDate, (w - 1) * 7);\n}", "function getFirstDayOfWeek(d) {\n d = new Date(d);\n var day = d.getDay(),\n diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday\n return new Date(d.setDate(diff));\n }", "function weekOfYear(d) {\n d.setHours(0, 0, 0);\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\n return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);\n }", "w (date) {\n return getWeekOfYear(date)\n }", "function firstOfWeek(culture) {\n\t try {\n\t var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n\t var cldr = locale(culture).cldr;\n\t var territory = cldr.attributes.territory;\n\t var weekData = cldr.get('supplemental').weekData;\n\t var firstDay = weekData.firstDay[territory || '001'];\n\t return days.indexOf(firstDay);\n\t } catch (e) {\n\t (0, _warning2.default)(true, 'Failed to accurately determine first day of the week.\\n Is supplemental data loaded into CLDR?');\n\t // maybe cldr supplemental is not loaded? revert to original method\n\t var date = new Date();\n\t //cldr-data doesn't seem to be zero based\n\t var localeDay = Math.max(parseInt(locale(culture).formatDate(date, { raw: 'e' }), 10) - 1, 0);\n\t\n\t return Math.abs(date.getDay() - localeDay);\n\t }\n\t }", "get week() {\n const nearestThursday = new Date(Date.UTC(this.year, this.month, this.day));\n nearestThursday.setUTCDate(nearestThursday.getUTCDate() + 4 - (nearestThursday.getUTCDay() || 7));\n\n const firstDayOfYear = new Date(Date.UTC(nearestThursday.getUTCFullYear(), 0, 1));\n\n // The number of full weeks to today's date\n const week = Math.ceil((((nearestThursday - firstDayOfYear) / 86400000) + 1) / 7);\n\n return week;\n }", "function getWeek() {\r\n var d = new Date();\r\n d.setHours(0, 0, 0);\r\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\r\n return Math.ceil((((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7);\r\n}", "function _getDayOfweek(week){\n var day = 1;\n switch(week) {\n case '1':\n day = 1;\n break;\n case '2':\n day = 8;\n break;\n case '3':\n day = 15;\n break;\n case '4':\n day = 22;\n break;\n default:\n day = 1;\n }\n return day;\n }", "function firstOfWeek(culture) {\n try {\n var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n var cldr = locale(culture).cldr;\n var territory = cldr.attributes.territory;\n var weekData = cldr.get('supplemental').weekData;\n var firstDay = weekData.firstDay[territory || '001'];\n return days.indexOf(firstDay);\n } catch (e) {\n {\n console.error('Failed to accurately determine first day of the week.' + ' Is supplemental data loaded into CLDR?');\n } // maybe cldr supplemental is not loaded? revert to original method\n\n\n var date = new Date(); //cldr-data doesn't seem to be zero based\n\n var localeDay = Math.max(parseInt(locale(culture).formatDate(date, {\n raw: 'e'\n }), 10) - 1, 0);\n return Math.abs(date.getDay() - localeDay);\n }\n }", "function firstOfWeek(culture) {\n try {\n const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']\n const cldr = locale(culture).cldr\n const territory = cldr.attributes.territory\n const weekData = cldr.get('supplemental').weekData\n const firstDay = weekData.firstDay[territory || '001']\n return days.indexOf(firstDay)\n } catch (e) {\n warning(\n true,\n `Failed to accurately determine first day of the week.\n Is supplemental data loaded into CLDR?`\n )\n // maybe cldr supplemental is not loaded? revert to original method\n const date = new Date()\n //cldr-data doesn't seem to be zero based\n let localeDay = Math.max(\n parseInt(locale(culture).formatDate(date, { raw: 'e' }), 10) - 1,\n 0\n )\n\n return Math.abs(date.getDay() - localeDay)\n }\n }", "function yearWeek (y, yd) {\n const dow = isoDow(y, 1, 1);\n const start = dow > 4 ? 9 - dow : 2 - dow;\n if ((Math.abs(yd - start) % 7) !== 0) {\n // y yd is not the start of any week\n return [];\n }\n if (yd < start) {\n // The week starts before the first week of the year => go back one year\n yd += Math.round((Date.UTC(y, 0, 1) - Date.UTC(y - 1, 0, 1)) / MS_PER_DAY);\n return yearWeek(y - 1, yd);\n } else if (Date.UTC(y, 0, 1) + (yd - 1 + 3) * MS_PER_DAY >= Date.UTC(y + 1, 0, 1)) {\n // The Wednesday (start of week + 3) lies in the next year => advance one year\n yd -= Math.round((Date.UTC(y + 1, 0, 1) - Date.UTC(y, 0, 1)) / MS_PER_DAY);\n return yearWeek(y + 1, yd);\n }\n return [y, 1 + Math.round((yd - start) / 7)];\n}", "function Week(initial_d) {\n\t\"use strict\";\n\n\tthis.sunday = initial_d.getSunday();\n\t\t\n\t\n\tthis.nextWeek = function () {\n\t\treturn new Week(this.sunday.deltaDays(7));\n\t};\n\t\n\tthis.prevWeek = function () {\n\t\treturn new Week(this.sunday.deltaDays(-7));\n\t};\n\t\n\tthis.contains = function (d) {\n\t\treturn (this.sunday.valueOf() === d.getSunday().valueOf());\n\t};\n\t\n\tthis.getDates = function () {\n\t\tvar dates = [];\n\t\tfor(var i=0; i<7; i++){\n\t\t\tdates.push(this.sunday.deltaDays(i));\n\t\t}\n\t\treturn dates;\n\t};\n}", "function Week(initial_d) {\n\t\"use strict\";\n\n\tthis.sunday = initial_d.getSunday();\n\t\t\n\t\n\tthis.nextWeek = function () {\n\t\treturn new Week(this.sunday.deltaDays(7));\n\t};\n\t\n\tthis.prevWeek = function () {\n\t\treturn new Week(this.sunday.deltaDays(-7));\n\t};\n\t\n\tthis.contains = function (d) {\n\t\treturn (this.sunday.valueOf() === d.getSunday().valueOf());\n\t};\n\t\n\tthis.getDates = function () {\n\t\tvar dates = [];\n\t\tfor(var i=0; i<7; i++){\n\t\t\tdates.push(this.sunday.deltaDays(i));\n\t\t}\n\t\treturn dates;\n\t};\n}", "function getWeekOfYear(jsDate){\r\n\tvar target = new Date(jsDate.valueOf()); \r\n\t// ISO week date weeks start on monday \r\n\t// so correct the day number \r\n\tvar dayNr = (jsDate.getDay() + 6) % 7; \r\n\t// Set the target to the thursday of this week so the \r\n\t// target date is in the right year \r\n\ttarget.setDate(target.getDate() - dayNr + 3); \r\n\t// ISO 8601 states that week 1 is the week \r\n\t// with january 4th in it \r\n\tvar jan4 = new Date(target.getFullYear(), 0, 4); \r\n\t// Number of days between target date and january 4th \r\n\tvar dayDiff = (target - jan4) / 86400000;\r\n \t// Calculate week number: Week 1 (january 4th) plus the \r\n\t// number of weeks between target date and january 4th \r\n\tvar weekNr = 1 + Math.ceil(dayDiff / 7); \r\n\treturn weekNr; \r\n}", "getWeekyear() {\n\t\t\tDate.prototype.getWeek = function (dowOffset) {\n\t\t\t\t/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */\n\n\t\t\t\tdowOffset = typeof (dowOffset) == 'int' ? dowOffset : 0; //default dowOffset to zero\n\t\t\t\tvar newYear = new Date(this.getFullYear(), 0, 1);\n\t\t\t\tvar day = newYear.getDay() - dowOffset; //the day of week the year begins on\n\t\t\t\tday = (day >= 0 ? day : day + 7);\n\t\t\t\tvar daynum = Math.floor((this.getTime() - newYear.getTime() -\n\t\t\t\t\t(this.getTimezoneOffset() - newYear.getTimezoneOffset()) * 60000) / 86400000) + 1;\n\t\t\t\tvar weeknum;\n\t\t\t\t//if the year starts before the middle of a week\n\t\t\t\tif (day < 4) {\n\t\t\t\t\tweeknum = Math.floor((daynum + day - 1) / 7) + 1;\n\t\t\t\t\tif (weeknum > 52) {\n\t\t\t\t\t\tnYear = new Date(this.getFullYear() + 1, 0, 1);\n\t\t\t\t\t\tnday = nYear.getDay() - dowOffset;\n\t\t\t\t\t\tnday = nday >= 0 ? nday : nday + 7;\n\t\t\t\t\t\t/*if the next year starts before the middle of\n\t\t\t\t\t\t the week, it is week #1 of that year*/\n\t\t\t\t\t\tweeknum = nday < 4 ? 1 : 53;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tweeknum = Math.floor((daynum + day - 1) / 7);\n\t\t\t\t}\n\t\t\t\treturn weeknum;\n\t\t\t}\n\t\t\tvar out = {};\n\t\t\tvar mydate = new Date();\n\t\t\tout.week = mydate.getWeek()\n\t\t\tout.year = mydate.getFullYear()\n\t\t\treturn out;\n\t\t}", "function getWeekNumber() {\n \n if (USE_HARDCODED_WEEK_NUMBER) {\n return WEEK_NUMBER\n }\n \n var callingfunction = 'Utils.getWeekNumber()'\n var todaysWeekNumber = getActualWeekNumber(new Date())[1] // [YYYY, MM]\n var properties = PropertiesService.getScriptProperties()\n var weekStarted = properties.getProperty(PROPERTY_WEEK_STARTED)\n \n if (weekStarted === null) {\n \n weekStarted = todaysWeekNumber\n properties.setProperty(PROPERTY_WEEK_STARTED, weekStarted)\n \n } else {\n \n Assert.assertNumber(\n +weekStarted, \n callingfunction, \n 'Invalid week started number stored')\n }\n \n var weekNumber = todaysWeekNumber - weekStarted + 1\n Logger.log('Week number: ' + weekNumber)\n return weekNumber\n \n // Private Functions\n // -----------------\n \n /* For a given date, get the ISO week number\n *\n * Based on information at:\n *\n * http://www.merlyn.demon.co.uk/weekcalc.htm#WNR\n *\n * Algorithm is to find nearest thursday, it's year\n * is the year of the week number. Then get weeks\n * between that date and the first day of that year.\n *\n * Note that dates in one year can be weeks of previous\n * or next year, overlap is up to 3 days.\n *\n * e.g. 2014/12/29 is Monday in week 1 of 2015\n * 2012/1/1 is Sunday in week 52 of 2011\n */\n \n function getActualWeekNumber(d) {\n // Copy date so don't modify original\n d = new Date(+d);\n d.setHours(0,0,0);\n // Set to nearest Thursday: current date + 4 - current day number\n // Make Sunday's day number 7\n d.setDate(d.getDate() + 4 - (d.getDay()||7));\n // Get first day of year\n var yearStart = new Date(d.getFullYear(),0,1);\n // Calculate full weeks to nearest Thursday\n var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7)\n // Return array of year and week number\n return [d.getFullYear(), weekNo];\n \n } // DateTime_.getWeekNumber.getActualWeekNumber\n \n}", "function weekNumber(d, firstWeekday) {\n firstWeekday = firstWeekday || 'sunday';\n\n // This works by shifting the weekday back by one day if we\n // are treating Monday as the first day of the week.\n var wday = d.getDay();\n if (firstWeekday == 'monday') {\n if (wday == 0) // Sunday\n wday = 6;\n else\n wday--;\n }\n var firstDayOfYear = new Date(d.getFullYear(), 0, 1),\n yday = (d - firstDayOfYear) / 86400000,\n weekNum = (yday + 7 - wday) / 7;\n return Math.floor(weekNum);\n }", "function calculateWeekDay() {\n\tJD0h += 1.5;\n\tlet res = JD0h - 7 * Math.floor(JD0h / 7);\n\tif (res === 0) {\n\t\tDoW = \"SUN\";\n\t}\n\tif (res === 1) {\n\t\tDoW = \"MON\";\n\t}\n\tif (res === 2) {\n\t\tDoW = \"TUE\";\n\t}\n\tif (res === 3) {\n\t\tDoW = \"WED\";\n\t}\n\tif (res === 4) {\n\t\tDoW = \"THU\";\n\t}\n\tif (res === 5) {\n\t\tDoW = \"FRI\";\n\t}\n\tif (res === 6) {\n\t\tDoW = \"SAT\";\n\t}\n}" ]
[ "0.73554915", "0.72726876", "0.72572744", "0.72572744", "0.724771", "0.7211845", "0.7211845", "0.7211845", "0.7211845", "0.7211845", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.7166408", "0.7154855", "0.7088173", "0.7072905", "0.7044604", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.7040289", "0.6988734", "0.69855165", "0.6882625", "0.68817556", "0.68456167", "0.6711857", "0.6707689", "0.6693832", "0.6627895", "0.65810513", "0.65775883", "0.6558055", "0.6548144", "0.6522719", "0.6519537", "0.6516391", "0.6516391", "0.65087825", "0.650309", "0.649379", "0.6465613", "0.64637697" ]
0.70435184
60
Pick a moment m from moments so that m[fn](other) is true for all other. This relies on the function fn to be transitive. moments should either be an array of moment objects or an array, whose first element is an array of moment objects.
function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return moment(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (moments[i][fn](res)) { res = moments[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return moment();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n\t\tvar res, i;\n\t\tif (moments.length === 1 && isArray(moments[0])) {\n\t\t\tmoments = moments[0];\n\t\t}\n\t\tif (!moments.length) {\n\t\t\treturn moment();\n\t\t}\n\t\tres = moments[0];\n\t\tfor (i = 1; i < moments.length; ++i) {\n\t\t\tif (moments[i][fn](res)) {\n\t\t\t\tres = moments[i];\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}", "function pickBy(fn, moments) {\n\t var res, i;\n\t if (moments.length === 1 && isArray(moments[0])) {\n\t moments = moments[0];\n\t }\n\t if (!moments.length) {\n\t return moment();\n\t }\n\t res = moments[0];\n\t for (i = 1; i < moments.length; ++i) {\n\t if (moments[i][fn](res)) {\n\t res = moments[i];\n\t }\n\t }\n\t return res;\n\t }", "function pickBy(fn, moments) {\n\t var res, i;\n\t if (moments.length === 1 && isArray(moments[0])) {\n\t moments = moments[0];\n\t }\n\t if (!moments.length) {\n\t return moment();\n\t }\n\t res = moments[0];\n\t for (i = 1; i < moments.length; ++i) {\n\t if (moments[i][fn](res)) {\n\t res = moments[i];\n\t }\n\t }\n\t return res;\n\t }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }", "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }" ]
[ "0.7575425", "0.75515914", "0.7439568", "0.7439568", "0.7294593", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889" ]
0.7611043
22
Fix Subtitles Octopus to work with embedded YouTube videos TODO: Fix subtitles position in fullscreen mode
function subResize(event) { var e_sub = subtitles.canvas; var e_vid = player.elements.wrapper; e_sub.style.display = "block"; e_sub.style.top = 0; e_sub.style.position = "absolute"; e_sub.style.pointerEvents = "none"; e_sub.width = e_vid.clientWidth * 2; e_sub.height = e_vid.clientHeight * 2; e_sub.style.transform = "scale(0.5, 0.5) translate(-50%, -50%)"; subtitles.resize(e_sub.width, e_sub.height); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubtitles_sync(current_time){\n if (current_subtitle == null){\n subtitles_textbox[0].innerHTML = \"&nbsp;\";\n subtitles_textbox[1].innerHTML = \"&nbsp;\";\n subtitles_textbox[2].innerHTML = \"&nbsp;\";\n subtitles_textbox[3].innerHTML = \"&nbsp;\";\n subtitles_textbox[4].innerHTML = \"&nbsp;\";\n subtitles.innerHTML = \"\";\n return;\n }\n\n var subs = current_subtitle[\"content\"];\n var currentTime = Math.round(video.currentTime * 1000);\n\n if (holding_key) currentTime = hold_start;\n if (subs[0].start>=0 && currentTime < subs[0].start) current_title_sync = 0;\n\n for (var i=0; i < subs.length; i++){\n if ((subs[i].start != -1) && (currentTime >= subs[i].start) && ((currentTime < subs[i].end) || (subs[i].end==-1))){\n current_title_sync = i+1;\n break;\n }\n }\n\n function get_title(i){\n if (i>=0 && i<subs.length){\n return subs[i][\"text\"];\n } else {\n if (i==-3) return \"--- Opening Silence ---\"\n if (i==-2) return \"--- Skip down when people start talking ---\";\n if (i==subs.length) return \"--- end of transcript ---\";\n }\n return \"&nbsp;\";\n }\n\n function get_title_or_silence(i){\n var title = get_title(i);\n return (title == \"\") ? \"[silence]\" : title;\n }\n\n function get_time_in(i){\n if (i>=0 && i<subs.length && subs[i].start>0){\n return MilliSecondsToString_for_output(subs[i].start);\n } else {\n return \"\";\n }\n }\n\n function get_time_out(i){\n if (i>=0 && i<subs.length && subs[i].end>0){\n return MilliSecondsToString_for_output(subs[i].end);\n } else {\n return \"\";\n }\n }\n\n var i = current_title_sync - 1;\n for (index in subtitles_textbox){\n subtitles_textbox[index].innerHTML = get_title_or_silence(index-2 + i);\n subtitles_time_in[index].innerHTML = get_time_in(index-2 + i);\n subtitles_time_out[index].innerHTML = get_time_out(index-2 + i);\n }\n subtitles_p.innerHTML = check_and_prepare_for_double_line(get_title(i));\n\n\ttry{\n\t\thighlight_current_title(i);\n\n\t\tvar node = document.getElementById(\"inputfields\").childNodes[2*i].firstChild;\n\t\t$(\"#inputfields\").scrollTo($(node), 0, {offset:-100});\n\t} catch(e){}\n\n}", "function displaySubtitles() {\n\n // Define function to get subtitles\n function getSubtitles(searchEmission, searchDate, outputType) {\n\n // Reset target elements\n document.getElementById(\"headerEmission\").innerHTML = \"\";\n document.getElementById(\"headerSubtitle\").innerHTML = \"\";\n document.getElementById(\"emissionTitle\").innerHTML = \"\";\n document.getElementById(\"emissionLead\").innerHTML = \"\";\n document.getElementById(\"emissionPicture\").src = \"placeholder.png\";\n document.getElementById(\"headerVis\").innerHTML = \"\";\n document.getElementById(\"endVis\").innerHTML = \"\";\n document.getElementById(\"headerSubtitle\").innerHTML = \"\";\n document.getElementById(\"subtitle\").innerHTML = \"\";\n\n // Delete old wordcloud\n const oldWordcloud = document.getElementById(\"wordcloud\")\n if (oldWordcloud !== null) {\n oldWordcloud.remove();\n }\n document.getElementById(\"displayFactor\").innerHTML = \"\";\n\n // Delete old button\n const oldButton = document.getElementById(\"wordcloudButton\")\n if (oldButton !== null) {\n oldButton.remove();\n }\n\n // Url components for search\n const search1Url1 = \"https://www.srf.ch/play/v3/api/srf/production/search/media?searchTerm=\";\n const search1Url2 = \"&includeAggregations=false&shows=urn%3Asrf%3Ashow%3Atv%3A\";\n const search1Url4 = \"&from=\".concat(searchDate, \"&to=\", searchDate);\n const search1Url5 = \"&mediaType=video\"\n\n // Get showID\n if (searchEmission == \"10vor10\") {\n var search1Url3 = \"c38cc259-b5cd-4ac1-b901-e3fddd901a3d\";\n } else if (searchEmission == \"arena\") {\n var search1Url3 = \"09784065-687b-4b60-bd23-9ed0d2d43cdc\";\n } else if (searchEmission == \"rundschau\") {\n var search1Url3 = \"49863a84-1ab7-4abb-8e69-d8e8bda6c989\";\n } else if (searchEmission == \"schweizaktuell\") {\n var search1Url3 = \"cb28dd84-f0c8-4024-8f20-1a29f5a4ceb7\";\n } else if (searchEmission == \"sportpanorama\") {\n var search1Url3 = \"d57ed483-2724-46b7-b1ac-7a2aa7603f59\";\n } else if (searchEmission == \"puls\") {\n var search1Url3 = \"709898cb-2dba-45da-8e21-b1f416c39dc9\";\n } else if (searchEmission == \"kassensturz\") {\n var search1Url3 = \"78a6014e-8058-4bdd-88aa-824f846ca6f0\";\n } else if (searchEmission == \"club\") {\n var search1Url3 = \"0f532a74-d501-4470-be25-527a4fbb82fa\";\n } else if (searchEmission == \"einstein\") {\n var search1Url3 = \"f005a0da-25ea-43a5-b3f8-4c5c23b190b3\";\n } else {\n // Tagesschau\n var search1Url3 = \"ff969c14-c5a7-44ab-ab72-14d4c9e427a9\";\n }\n\n // Build Url for search request\n let search1Url = search1Url1.concat(search1Url2, search1Url3, search1Url4, search1Url5);\n let searchInit = {\n method: \"GET\",\n mode: \"cors\",\n cache: \"default\"\n };\n let search1Request = new Request(search1Url, searchInit);\n\n // Fetch search request\n fetch(search1Request)\n .then(response => response.json())\n .then(data => {\n\n let search1Response = data[\"data\"];\n\n // Select result with best fit\n // No emission 1 (Non-Tagesschau)\n if (search1Response[\"total\"] == 0) {\n\n alert(\"Für das gewünschte Datum konnte keine Ausstrahlung gefunden werden.\");\n return;\n\n } else if (/^ts-/.test(searchEmission)) {\n\n // Tagesschau\n var tsResults = search1Response[\"results\"];\n\n if (searchEmission == \"ts-main\") {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Haupt|19\\:30/.test(feature.title);\n });\n\n } else if (searchEmission == \"ts-noon\") {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Mittag|12\\:[0-9]{2}|13\\:[0-9]{2}/.test(feature.title);\n });\n\n } else {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Spät|22\\:[0-9]{2}|23\\:[0-9]{2}/.test(feature.title);\n });\n\n }\n\n // No emission 2 (Tagesschau)\n if (tsResults2.length == 0) {\n\n alert(\"Für das gewünschte Datum konnte keine Ausstrahlung gefunden werden.\");\n return;\n\n }\n\n [search1Response] = tsResults2;\n\n } else {\n\n // Other emissions\n [search1Response] = search1Response[\"results\"];\n\n }\n\n // Build Search Request 2\n const search2Url1 = \"https://il.srgssr.ch/integrationlayer/2.0/mediaComposition/byUrn/urn:srf:video:\";\n const search2Url3 = \".json?onlyChapters=false&vector=portalplay\";\n let search2Url = search2Url1.concat(search1Response[\"id\"], search2Url3);\n let searchRequest2 = new Request(search2Url, searchInit);\n\n // Fetch Search Request 2\n fetch(searchRequest2)\n .then(response => response.json())\n .then(data => {\n\n // Extract Episode ID from Response 2\n let episodeId = data[\"episode\"][\"id\"];\n\n // Build Search Request 3\n const search3Url1 = \"https://www.srf.ch/subtitles/srf/\";\n const search3Url3 = \"/episode/de/vod/vod.m3u8\";\n let search3Url = search3Url1.concat(episodeId, search3Url3);\n let searchRequest3 = new Request(search3Url, searchInit);\n\n // Fetch Search Request 3\n fetch(searchRequest3)\n .then(response => response.text())\n .then(text => {\n\n // Get Subtitles Files\n const rgPattern = /vtt\\/chunks\\/[0-9]+.vtt/g;\n let subtitleFiles = text.match(rgPattern);\n\n // Alert When No Files Match the Pattern\n if (subtitleFiles == null) {\n\n // Show emission info\n document.getElementById(\"headerEmission\").innerHTML = \"Informationen zur Sendung\";\n document.getElementById(\"emissionTitle\").innerHTML = search1Response[\"title\"];\n document.getElementById(\"emissionLead\").innerHTML = search1Response[\"lead\"];\n document.getElementById(\"emissionPicture\").src = search1Response[\"imageUrl\"];\n alert(\"Die gewünschten Sendung scheint über keinen Untertitel zu verfügen.\");\n return;\n\n }\n\n // Search Url Components\n const search4Url1 = \"https://www.srf.ch/subtitles/srf/\";\n const search4Url3 = \"/episode/de/vod/\";\n const subtitleLinks = [];\n\n // Get Subtitle Files\n for (const subtitleFile of subtitleFiles) {\n subtitleLinks.push(search4Url1.concat(episodeId, search4Url3, subtitleFile));\n }\n\n // Fetch all Files\n let promises = subtitleLinks\n .map(url => fetch(url)\n .then(y => y.text()));\n\n Promise\n .all(promises)\n .then(results => {\n\n // Get results\n const subtitles = results.join();\n\n // Extract text based on style\n // Subtiles = Raw, Subtitles2 = Rowwise splits, Subtitles3 = Itermediate for cleansing, Subtitles4 = Flow style, Subtitles5 = Markup with white to black.\n if (subtitles.match(/\\>(.*?)\\</g) == null) {\n\n // \"Old school\" subtitles without markup\n var subtitles2 = subtitles\n .replace(/[0-9]+\\:[0-9]+\\:[0-9]+\\.[0-9]+/g, \" \")\n .replace(/-->/g, \" \")\n .replace(/\\n[0-9]+\\n/g, \" \")\n .replace(/\\n/g, \" \")\n .split(/\\s\\s+/g);\n\n var subtitles3 = subtitles2\n .join(\" \")\n .replace(/\\s\\s+/g, \" \")\n .replace(/,WEBVTT/g, \"\")\n .replace(/WEBVTT/g, \"\")\n .replace(/^./g, \"\");\n\n } else {\n\n // New subtitles with markup\n var subtitles2 = subtitles\n .match(/\\>(.*?)\\</g)\n .map(b => b.replace(/\\>(.*?)\\</g, \"$1\"));\n\n var subtitles3 = subtitles2.join(\" \");\n\n }\n\n // General replacements\n let subtitles4 = subtitles3\n .replace(/([0-9])- (?!(und|oder|bis))/g, \"$1-\")\n .replace(/([A-Z])- (?!(und|oder|bis))/g, \"$1-\")\n .replace(/([A-z])- (?!(und|oder|bis))/g, \"$1\") // separated words\n // .replace(/ SWISS TXT.*$/, \"\")\n .replace(/SWISS TXT AG \\/ Access Services/g, \"\")\n .replace(/Livepassagen können Fehler enthalten. /g, \"\")\n .replace(/MIT TELETEXT-UNTERTITELUNG /g, \"\")\n .replace(/Mit Live-Untertiteln von SWISS TXT/g, \"\")\n .replace(/Mit Untertiteln von SWISS TXT/g, \"\")\n .replace(/1:1-Untertitelung./g, \"\")\n .replace(/^\\./, \" \")\n .trim();\n\n // Emission hyperlink\n let emissionLink = \"https://www.srf.ch/play/tv/tagesschau/video/\" +\n search1Response[\"title\"]\n .replace(/\\:/g, \"\")\n .replace(/\\./g, \"-\")\n .replace(/\\s+/g, \"-\")\n .toLowerCase() +\n \"?urn=\" +\n search1Response[\"urn\"];\n\n // Define output\n document.getElementById(\"headerEmission\").innerHTML = \"Informationen zur Sendung\";\n document.getElementById(\"emissionTitle\").innerHTML = \"<a href=\" + emissionLink + \" target=_blank>\" + search1Response[\"title\"] + \"</a>\";\n document.getElementById(\"emissionLead\").innerHTML = search1Response[\"lead\"];\n document.getElementById(\"emissionPicture\").src = search1Response[\"imageUrl\"];\n document.getElementById(\"headerSubtitle\").innerHTML = \"Untertitel\";\n\n // Output subtitle (and handle button)\n if (outputType == \"flow\") {\n\n // Subtitle\n document.getElementById(\"subtitle\").innerHTML = subtitles4;\n\n // Create wordcloud button\n const newButton = document.createElement(\"button\");\n newButton.innerHTML = \"Word Cloud\";\n newButton.id = \"wordcloudButton\";\n newButton.className = \"btn btn-primary\";\n newButton.onclick = function () {\n analyzeSubtitles(); return false;\n };\n\n document.getElementById(\"buttons\").appendChild(newButton);\n\n } else if (outputType == \"line\") {\n\n // Subtitle\n document.getElementById(\"subtitle\").innerHTML = subtitles2.join(\"</br>\");\n\n } else {\n\n // Subtitle\n const subtitles5 = subtitles.replace(/\\n/g, \"</br>\").replace(/#ffffff/g, \"#000000\");\n document.getElementById(\"subtitle\").innerHTML = subtitles5;\n\n }\n\n // Delete old wordcloud\n const oldWordcloud = document.getElementById(\"wordcloud\")\n if (oldWordcloud !== null) {\n oldWordcloud.remove();\n }\n\n });\n\n });\n\n\n });\n\n });\n }\n\n // Execute\n const searchEmission = document.getElementById(\"sendung\").value;\n const searchDate = document.getElementById(\"datum\").value;\n const outputType = document.getElementById(\"ausgabeart\").value;\n getSubtitles(searchEmission, searchDate, outputType);\n\n}", "function handleSubtitles(){\r\n let a = start;\r\n if(start.charAt(0) === \"m\") {\r\n let a = start.split(\"-\")[1];\r\n }\r\n var center = getZoneFromDate(a);\r\n if(typeof center != \"undefined\") {\r\n if(center.hover(mouseX, mouseY)) {\r\n lastMarkerPos = a;\r\n if(center.hover(mouseX, mouseY)) {\r\n drawSubtitle(center);\r\n }\r\n }\r\n }\r\n let left = start;\r\n let right = start;\r\n for(let i = 1; i < (maxVisible/2); i++) {\r\n left = decrease(left);\r\n right = increment(right);\r\n var leftZone = getZoneFromDate(left);\r\n if(typeof leftZone != \"undefined\") {\r\n if(leftZone.hover(mouseX, mouseY)) {\r\n drawSubtitle(leftZone);\r\n }\r\n }\r\n var rightZone = getZoneFromDate(right);\r\n if(typeof rightZone != \"undefined\") {\r\n if(rightZone.hover(mouseX, mouseY)) {\r\n drawSubtitle(rightZone);\r\n }\r\n }\r\n }\r\n}", "function initExtension() {\n\n /*sub-message is used to show status about upload status of subtitle file\n It appears just below the youtube video */\n $(\"#watch7-content\").prepend(\"<div id='subitle-container-first' class='yt-card yt-card-has-padding'><span id='sub-message'></span></div>\");\n\n if ($(\"video\").length === 0) {\n\n } else {\n\n $(\"#sub-message\").html(\"Loading the subtitle. Hold on..\");\n $('video').attr('id', 'sub-video');\n $(\"#sub-video\").after(\"<span id='sub-info'></span>\");\n $('#subitle-container-first').after('<input id=\"fileupload\" type=\"file\" name=\"uploadFile\" style=\"display:none\"/>');\n $('#fileupload').after(\"<div id='sub-open-subtitles' style='display:none' class='yt-card yt-card-has-padding'><div>\");\n\n //registerFileUploader();\n $(\"#sub-open-subtitles\").load(chrome.extension.getURL(\"open-subtitles.html\"), initExternalSubtitlesSupport);\n }\n}", "function loadSubtitles(subtitlesURL, isLocalFile, encoding) {\n /* Hide any previously uploaded subtitles */\n $('.subtitles').css(\"display\", \"block\");\n\n /* Initialize new bubbles instance */\n if (!subBubblesVideo) {\n subBubblesVideo = new Bubbles.video('sub-video');\n registerKeyboardListeners();\n }\n var data = {\n \"English\": {\n language: \"English\",\n file: subtitlesURL,\n encoding: encoding,\n isLocalFile: isLocalFile\n }\n };\n\n subBubblesVideo.subtitles(false, data);\n\n $('#sub-info').css(\"opacity\", 1);\n console.log(srt_text)\n if (cond.length<50)\n {\n$(\"#sub-message\").html(\"Oops, We were unable to find the subtitle file. r However , yo can refresh the page to try again.\");\n }\n else{\n $(\"#sub-message\").html(\"Subtitle added. Enjoy!!! <br> Hit space bar or click on subtitle to pause/resume the video.\"+ shortcutsMessage);\n}\n // $(\"#sub-message\").fadeOut(3000);\n\n getFontSizeFromLocalStorage();\n}", "function displaySubs(videoId, srtContents) {\n\t// Remove if existing\n\tlet existingElement = document.getElementById('netflix-srt-subs-container');\n\tif(existingElement !== null) {\n\t\texistingElement.outerHTML = '';\n\t}\n\n\tlet html = htmlToElement(`<div id=\"netflix-srt-subs-container\"></div>`);\n\tdocument.body.appendChild(html);\n\tlet subContainerElement = document.getElementById('netflix-srt-subs-container');\n\tlet offsetElement = document.getElementById('netflix-srt-subs-offset');\n\n\tlet subs = getSubtitleRecords(srtContents);\n\tsubs.sort((r1, r2) => r1['to'] - r2['to']); // Sort by from times (so we can efficiently handle overlaps)\n\n\t// Loop indefinitely for subs (indefinitely so that we still display correct subs even when we\n\t// seek in the video).\n\tintervalId = setInterval(() => {\n\t\tlet time = getTimeInVideo(videoId);\n\t\ttime += parseFloat(offsetElement.value);\n\n\t\t// Unfortunately, this can legit happen by simply loading the subs before the video has\n\t\t// loaded. There is no good way to detect if the video has failed to be detected.\n\t\tif(time === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Dumb approach: just loop through all the records\n\t\tlet currentSub = getSubtitlesForTime(subs, time);\n\n\t\t// Get the controls for nicer positioning\n\t\tlet controlsHeight = 0;\n\t\tlet controlsElements = document.getElementsByClassName('PlayerControlsNeo__bottom-controls');\n\t\tlet areControlsVisible = controlsElements.length === 1 &&\n\t\t\t\t!controlsElements[0].className.includes('PlayerControlsNeo__bottom-controls--faded');\n\t\tif(controlsElements.length === 0) {\n\t\t\tconsole.log('Could not find controls. Maybe Netflix broke this feature?');\n\t\t}\n\t\telse {\n\t\t\tcontrolsHeight = controlsElements[0].offsetHeight;\n\t\t}\n\n\t\tlet videoRealWidth = getVideoRealPixelWidth(videoId);\n\t\tsubContainerElement.style.width = `${videoRealWidth}px`;\n\n\t\tsubContainerElement.innerHTML = currentSub;\n\t\tif(currentSub === '') {\n\t\t\tsubContainerElement.style.display = 'none';\n\t\t}\n\t\telse {\n\t\t\tsubContainerElement.style.display = 'block';\n\n\t\t\tlet offsetFromTop = window.innerHeight;\n\t\t\tif(areControlsVisible) {\n\t\t\t\toffsetFromTop -= controlsHeight;\n\t\t\t}\n\t\t\toffsetFromTop -= offsetFromTop * SUBS_BOTTOM_PADDING_PERCENT;\n\t\t\tsubContainerElement.style.top = `${offsetFromTop}px`;\n\t\t}\n\n\t}, UPDATE_TIME)\n}", "function Subtitle(srt, Player, target) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, Subtitle);\n\t\n\t this.Player = Player;\n\t this.srt = srt;\n\t this.target = document.querySelector(target);\n\t _logger2.default.addLog('Player - Subtitle', 'create', 'Subtitle initialization started', this);\n\t this.setSRT(srt);\n\t this.Player.Events.addListener('player_onTimeUpdate', function () {\n\t return _this.tick();\n\t });\n\t this.Player.Events.addListener('player_onEnded', function () {\n\t return _this.target.innerText = '';\n\t });\n\t }", "function subtitleSidePosition(subWidth, titleWidth, subScale, titleScale, marginBetween) {\nvar subHalfWidth = (subWidth*subScale)/2;\nvar titleHalfWidth = (titleWidth*titleScale)/2;\n// Calculate how far from the center this title needs to be\nvar centerOffset = subHalfWidth + titleHalfWidth + marginBetween;\nvar offset = ($(window).width()/2) - centerOffset;\n\nreturn offset;\n}", "function loadingSubtitle() {\n subContainer = document.getElementById(\"subtitles-container\");\n enTrack = document.getElementById(\"en\");\n viTrack = document.getElementById(\"vi\");\n\n function shit(_text, _textvi) {\n //console.log('eng',_text);\n //console.log('vi',_textvi);\n var imax = Math.max(_text.length, _textvi ? _textvi.length : 0);\n for (var i = 0; i < imax; i++) {\n var _span = document.createElement(\"span\");\n _span.setAttribute(\"id\", \"cue\" + _text[i].id);\n _span.setAttribute(\"data-start\", _text[i].start);\n _span.innerHTML = _text[i].text + (_textvi ? \"<br/><small>\" + _textvi[i].text + \"</small>\" : \"\");\n subContainer.appendChild(_span);\n }\n }\n\n var _subContainer = $(\"#subtitles-container\");\n var key = \"AM0tDdGMmqIHJHyBkS9dTwTJJjyPn3Dj\";\n GibberishAES.size(256);\n\n // ENGLISH sub\n function engParse(callback) {\n var _decryptext = GibberishAES.dec($(enTrack).val(), key);\n parseSrt(_decryptext, 1, 0, 0.1, function(result) {\n var _text = result;\n var track = video.addTextTrack(\"captions\", \"English\", \"en\");\n if (!viTrack) {\n track.mode = \"hidden\";\n }\n for (var i = 0; i < _text.length - 1; i++) {\n try {\n var _vtt = new VTTCue(_text[i].start, _text[i].stop, _text[i].text);\n track.addCue(_vtt);\n } catch (err) {}\n }\n\n track.oncuechange = function() {\n if (track.activeCues[0]) {\n var _startTime = track.activeCues[0].startTime;\n $(_subContainer).find(\"span[data-start='\" + _startTime + \"']\").each(function() {\n $(_subContainer).find(\".active-cue\").removeClass(\"active-cue\");\n $(this).addClass(\"active-cue\");\n $(this).prev().nextAll(\":lt(2)\").scrollIntoView();\n });\n }\n };\n //all done\n //console.log('eng',_text);\n callback(_text, shit);\n });\n }\n\n // VIETNAMESE sub\n function viParse(_text, callback) {\n var _decryptextvi = GibberishAES.dec($(viTrack).val(), key);\n parseSrt(_decryptextvi, 1, 0, 0.1, function(result) {\n var _textvi = result;\n var track = video.addTextTrack(\"captions\", \"VietNam\", \"vi\");\n track.mode = \"hidden\";\n for (var i = 0; i < _textvi.length - 1; i++) {\n try {\n var _vtt = new VTTCue(_text[i].start, _text[i].stop, _textvi[i].text);\n track.addCue(_vtt);\n } catch (err) {}\n }\n track.oncuechange = function() {\n if (track.activeCues[0]) {\n var _startTime = track.activeCues[0].startTime;\n $(_subContainer).find(\"span[data-start='\" + _startTime + \"']\").each(function() {\n $(_subContainer).find(\".active-cue\").removeClass(\"active-cue\");\n $(this).addClass(\"active-cue\");\n $(this).prev().nextAll(\":lt(2)\").scrollIntoView();\n });\n }\n };\n //all done\n // console.log('vi',_textvi);\n callback(_text, _textvi);\n });\n }\n\n engParse(viParse);\n}", "function onPlayerReady(event) {\n\n // http://www.youtube.com/v/WWG6jaBFYtU?version=3\n player.cueVideoByUrl({\n 'mediaContentUrl': 'http://www.youtube.com/v/' + getValue(\"id\") + '?version=3',\n 'startSeconds': 0,\n //'endSeconds': 100,\n 'suggestedQuality': 'large'\n });\n //while(!captionContents);\n //console.log(video_id);\n bindCaption();\n \n document.getElementById('embed-code').style.borderColor = '#FF6D00';\n event.target.setVolume(80);\n \n // 取得第一段字幕的起訖時間\n //console.log(captionContents);\n var c = JSON.parse(captionContents);\n var _start = Number(c[0].start);\n var _duration = Number(c[0].dur);\n var _end = _start + _duration;\n\n // 呼叫播放API\n //console.log(\"start=\", _start);\n playVideo(_start, _end);\n\n // set the timer for scrolling to current play time\n scrollToCaption(0, _start, _end);\n\n}", "function vidRescale(){\n\tvar w = $(window).width(),\n\t\th = $(window).height();\n\n\tif (w/h > 16/9){\n\t\ttv.setSize(w, w/16*9);\n\t\t$('.lx-youtube-background .lx-youtube-screen').css({'left': '0px'});\n\t} else {\n\t\ttv.setSize(h/9*16, h);\n\t\t$('.lx-youtube-background .lx-youtube-screen').css({'left': -($('.lx-youtube-background .lx-youtube-screen').outerWidth()-w)/2});\n\t}\n}", "function showSubtitle(sub, elem) {\n elem.html(sub.t);\n }", "function LaunchPlayer(video, audio, subtitleurlarray, time) {\n // delete any captions we've got\n ResetState();\n\n\n if ((audio != undefined) && (audio != \"\")) {\n if ($(\"#videoContainer\") != undefined)\n $(\"#videoContainer\").hide();\n if ($(\"#audioplayer\") != undefined)\n $(\"#audioplayer\").show();\n StopAllMediaSources();\n LoadAudioSource(audio, subtitleurlarray,time);\n }\n else if ((video != undefined) && (video != \"\")) {\n if ($(\"#videoContainer\") != undefined)\n $(\"#videoContainer\").show();\n if ($(\"#audioplayer\") != undefined)\n $(\"#audioplayer\").hide();\n StopAllMediaSources();\n LoadVideoSource(video, subtitleurlarray,time);\n }\n $(\"#captionFormatTTML\").prop(\"checked\", false);\n \n $(\"#captionFormatVTT\").prop(\"checked\", true);\n}", "function getRealTitles(j) {\n\tif(showTitle==2){\n\t\tplayerArray[j] = new YT.Player(videoArray[j], {\n\t\t videoId: videoArray[j],\n\t\t events: {\n\t\t\t 'onStateChange': onPlayerStateChange\n\t\t\t}\n\t\t});\t\n\t}else{\n\t\t//We pray into the ether\n\t\t//harken oh monster of youtube \n\t\t//tell us the truth of this noble video\n\t var tempJSON = $.getJSON('http://gdata.youtube.com/feeds/api/videos/'+videoArray[j]+'?v=2&alt=json',function(data,status,xhr){\n\t\t\t//and lo the monster repsonds\n\t\t\t//it's whispers flowing as mist\n\t\t\t//through the mountain crag\n\t\t videoTitle[j] = data.entry.title.$t;\n\t\t\t//and we now knowning it's truth\n\t\t\t//the truth of it's birth\n\t\t\t//we annoit it and place it on it's throne\n\t\t\t//as is provided by the documentation\n\t\t\tplayerArray[j] = new YT.Player(videoArray[j], {\n\t\t\t videoId: videoArray[j],\n\t\t\t events: {\n\t\t\t\t 'onStateChange': onPlayerStateChange\n\t\t\t\t}\n\t\t\t});\n\t });\n\t}\n}", "function initExtension() {\n\n if (firstLoad) {\n firstLoad = false;\n console.log(\"First load true, showing onboarding\");\n $(document.body).append(\"<div id='onboarding-modal-con'><div>\");\n $(\"#onboarding-modal-con\").load(chrome.extension.getURL(\"onboarding.html\"));\n // $('#onboarding-modal #header-img').attr('src', '\"' + chrome.extension.getURL('onboarding-header.png') + '\"');\n }\n\n if ($(\"video\").length === 0) {\n console.log(\"Flash video found. Return\");\n $(\"#sub-message\").html(\"This youtube video runs on Adobe Flash.\" + \"Adding subtitles is not supported for it yet.\");\n $(\"#sub-message\").fadeOut(3000);\n $(\"#sub-open-search-btn\").css(\"display\", \"none\");\n } else {\n $(\"#srt-upload-name\").html(\"Click or drag & drop subtitle file here\");\n\n if ($(\"#sub-video\").length) {\n // console.log(\"Found existing #sub-video\");\n } else {\n $('video').attr('id', 'sub-video');\n $(\"#sub-video\").after(\"<span id='sub-info'></span>\");\n }\n\n if ($(\"#subtitle-button\").length) {\n // console.log(\"Found existing #subtitle-button\");\n } else {\n $('*[id=top-row]').find('#top-level-buttons-computed').append('<div id=\"subtitle-button\" class=\"subtitleButton style-scope ytd-menu-renderer\" type=\"button\" onclick=\";return false;\" data-button-toggle=\"true\"><span class=\"subtitleButtonImg\"><img src=\"'+ chrome.extension.getURL(\"images/subtitles_icon.svg\")+'\" width=\"18px\"></span><span class=\"subtitleButtonText\">Subtitles</span></div>');\n\n // On click subtitle icon\n $(\"#subtitle-button\").click(function() {\n console.log(\"#subtitle-button clicked\");\n $('#subtitle-button').addClass('clicked');\n // $('#watch-action-panels').css(\"display\", \"none\");\n $('#new-subtitles-con').css(\"display\", \"block\");\n $(\"#search-sub-button\").click();\n });\n }\n\n if ($(\"#new-subtitles-con\").length) {\n // console.log(\"Found existing #new-subtitles-con\");\n } else {\n if ($('#primary-inner').find('#meta') && $('#primary-inner').find('#meta').length > 0) {\n $('#primary-inner').find('#meta').prepend(\"<div id='new-subtitles-con' style='display:none; position: relative;' class='style-scope ytd-watch'><div>\"); \n } else {\n console.error(\"Could not find $('#primary-inner').find('#meta')\")\n return\n }\n }\n\n if ($(\"#action-panel-subtitle\").length) {\n // console.log(\"Found existing #action-panel-subtitle\");\n } else {\n $(\"#new-subtitles-con\").load(chrome.extension.getURL(\"subtitles-tab.html\"), function() {\n console.log(\"Loaded #action-panel-subtitle , registering events\");\n registerEvents();\n\n $(\".subtitles\").css(\"font-size\", subtitlesSize + \"px\");\n $(\"#subtitles-auto-load\").prop('checked', autoLoad);\n $(\"#sub-language\").val(subLanguage);\n\n $(\"#subtitles-delay-time\").val(Math.round(subtitlesSync*1000))\n });\n }\n\n }\n}", "function PlayExpandedIntroVideo () {\r\ncreative.dom.video1.vid.play();\r\ncreative.dom.video1.vid.currentTime = 0;\r\n}", "function bind_movie_player_event() {\r\n // Clear onYouTubePlayerReady\r\n try { delete unsafeWindow.onYouTubePlayerReady; } catch(err) {}\r\n\r\n // Only for youtube watch pages\r\n if(!gvar.isWatchPage) {\r\n if(!gvar.isBetaChannel) { return; }\r\n GM_addGlobalStyle('.playnav-bottom-link { float:none; padding-left:15px; } #user_playlist_navigator,#playnav-body { z-index:auto; }' // Little fix\r\n +'.watch-comment-spam-bug,.watch-comment-head-link { display :none; }'\r\n +'.search-box .yt-uix-button { height:22px; margin-top:-5px; }'\r\n );\r\n if(getValue('HIDE_MEDIA_CONTROLLER_BCHAN')<=0) {\r\n GM_addGlobalStyle('.playnav-player-container { padding-bottom:30px; }'\r\n +' #playnav-play-content, #playnav-body, #playnav-play-loading { height:625px !important }'\r\n );\r\n }\r\n //if(getValue('BYPASS_AGE_CENSOR')>0) { try { unsafeWindow.playnav.verifyAge=function(id,title,url) {}; } catch(e) {} }\r\n }\r\n\r\n //~~~~~~~~ Startof innerscript ~~~~~~//\r\n var innerscript = function() {\r\n// Usefull routine\r\nfunction isUndefined(x) { return x == null && x !== null; }\r\nfunction getAbsoluteTop(element) {\r\n var AbsTop=0;\r\n while (element) { AbsTop=AbsTop+element.offsetTop; element=element.offsetParent; }\r\n return(AbsTop);\r\n}\r\nfunction show_debug(msg) { if(__DEBUG) { show_msg('DEBUG: '+msg,0) } }\r\nfunction show_msg(msg, force) {\r\n if(arguments.callee.counter) { arguments.callee.counter++; } else { arguments.callee.counter=1; }\r\n if((typeof console!='undefined') && (typeof console.log!='undefined')) { console.log('('+arguments.callee.counter+') YouTube High End: '+msg); }\r\n else if((typeof opera!='undefined') && (typeof opera.postError!='undefined')) { opera.postError('('+arguments.callee.counter+') YouTube High End: '+msg); }\r\n if(force==0) { return; }\r\n // Show a HTML alert box (only for watch pages or if forced)\r\n if(force==1 || gvar.isWatchPage) {\r\n warningelem=document.createElement('div');\r\n warningelem.setAttribute(\"style\",\"color:#FFFFFF; background:#FF8000; width:auto; text-align:center; font-size:24px; border: 3px solid #CC0088; margin:2px;\");\r\n warningelem.textContent=msg;\r\n document.body.insertBefore(warningelem, document.body.firstChild);\r\n }\r\n}\r\n\r\n// Path check\r\nif(!yt) { yt=function() {} }\r\nif(!yt.www) { yt.www=function() {} }\r\nif(!yt.www.watch) { yt.www.watch=function() {} }\r\nif(!yt.www.watch.player) { yt.www.watch.player=function() {} }\r\n\r\n// Redefine seekTo\r\nyt.www.watch.player.seekTo = function(t,m) {\r\n if(t==null) { return; }\r\n if(isUndefined(m)) { m=true; }\r\n var player=window.document.getElementById('__movie_player');\r\n if(!player) { return; }\r\n scrollToVideoAndMemo(player);\r\n player.seekTo(Math.max(0,t-1),m);\r\n hide_video_preview();\r\n player.playVideo();\r\n window.setTimeout(checkNotStarting,50);\r\n}\r\n\r\nfunction scrollToVideo(playerEmbed) {\r\n var pcs=window.getComputedStyle(playerEmbed,null);\r\n var w=parseInt(pcs.width.replace('px',''),10);\r\n var h=parseInt(pcs.height.replace('px',''),10)-parseInt('__YT_BAR_HEIGHT',10);\r\n var cx=(w-document.documentElement.clientWidth)/2;\r\n var cy=(h-document.documentElement.clientHeight)/2;\r\n if(-100<cy && cy<=-52) { cy=cy+40; }\r\n else if(-52<cy && cy<=-4) { cy=-2; }\r\n else if(-4<cy && cy<0) { cy=Math.ceil(cy/2); }\r\n //show_debug('2> scrollTo('+parseInt(cx)+','+parseInt((getAbsoluteTop(playerEmbed)+cy))+')',0);\r\n scrollTo(Math.max(0,cx),Math.max(0,getAbsoluteTop(playerEmbed)+cy));\r\n}\r\nfunction scrollToVideoAndMemo(playerEmbed) {\r\n var pos1=document.documentElement.scrollLeft+\",\"+document.documentElement.scrollTop;\r\n scrollToVideo(playerEmbed);\r\n var pos2=document.documentElement.scrollLeft+\",\"+document.documentElement.scrollTop;\r\n if(pos1!=pos2) { playerEmbed.setAttribute('seekTo_back',pos1); }\r\n}\r\n\r\nfunction check_movie_player() {\r\n var playerEmbed = document.getElementById('__movie_player');\r\n var wpd = document.getElementById('__watch-player-div');\r\n if(wpd) {wpd.style.setProperty('padding-left','0','important');}\r\n if(playerEmbed) { return; }\r\n if(!wpd) { return; }\r\n // playerEmbed not found => try to find it\r\n var temp=null; try { temp=wpd.getElementsByTagName(\"embed\"); } catch(err) { temp=null; }\r\n if(temp && temp[0]) { temp[0].setAttribute('id','__movie_player'); return; }\r\n}\r\n\r\nfunction check_allowscriptaccess(ytplayer) { // Check for allowscriptaccess (must be 'always')\r\n allowScript=ytplayer.getAttribute('allowscriptaccess');\r\n if(!(allowScript) || !(allowScript.match(/^always$/i))) {\r\n ytplayer.setAttribute('allowscriptaccess','always');\r\n return 1;\r\n }\r\n return 0;\r\n}\r\n\r\nfunction set_autoplay(ytplayer,new_autoplay) {\r\n var flashvars = ytplayer.getAttribute('flashvars');\r\n if(ytplayer.hasAttribute('MC_AUTOPLAY')) { new_autoplay=ytplayer.getAttribute('MC_AUTOPLAY'); }\r\n if(!flashvars) { return; }\r\n var autoplay=flashvars.match(/autoplay\\=(\\d+)/i);\r\n if(new_autoplay==\"1\") {\r\n if(!(autoplay)) {\r\n ytplayer.setAttribute('flashvars',flashvars+'&autoplay=0');\r\n return 1;\r\n } else if (autoplay[1]!=0) {\r\n ytplayer.setAttribute('flashvars',flashvars.replace(/autoplay\\=\\d+/i,\"autoplay=0\"));\r\n return 1;\r\n }\r\n } else {\r\n if(autoplay) {\r\n if(autoplay[1]!=1) {\r\n ytplayer.setAttribute('flashvars',flashvars.replace(/autoplay\\=\\d+/i,\"autoplay=1\"));\r\n return 1;\r\n }\r\n }\r\n }\r\n return 0;\r\n}\r\n\r\nfunction check_for_loop(ytplayer) {\r\n var loop_state=window.document.getElementById('__movie_player-Loop_state');\r\n if(loop_state.getAttribute('Lvalue')!=0) {\r\n var memo_state=window.document.getElementById('__movie_player-Memo_state');\r\n var memo_pos=0;\r\n if(memo_state && memo_state.hasAttribute('Bvalue')) { memo_pos=parseFloat(memo_state.getAttribute('Bvalue'),9); }\r\n ytplayer.seekTo(memo_pos,1);\r\n window.setTimeout( function() { ytplayer.pauseVideo();\r\n window.setTimeout( function() { ytplayer.playVideo();\r\n window.setTimeout(checkNotStarting,50);\r\n }, 200);\r\n }, 300);\r\n return 1;\r\n }\r\n return 0;\r\n}\r\n\r\nfunction check_still_buffering() {\r\n var player=window.document.getElementById('__movie_player');\r\n if(!player) { return; }\r\n var state=-3; try { state=player.getPlayerState(); } catch(err) { state=-4; }\r\n if(state==3) {\r\n if(player.getCurrentTime()>player.getDuration()-0.5) {\r\n if(check_for_loop(player)) { return; }\r\n // Original Youtube Script (if no loop)\r\n try { handleWatchPagePlayerStateChange(0); } catch(err) {}\r\n }\r\n }\r\n}\r\n\r\nfunction check_time_to_pause() {\r\n var player=window.document.getElementById('__movie_player');\r\n if(!player) { return; }\r\n if(isUndefined(arguments.callee.first_time)) {\r\n arguments.callee.first_time=player.getCurrentTime();\r\n window.setTimeout( function() { check_time_to_pause(); }, 50);\r\n return;\r\n }\r\n if(player.getCurrentTime()!=arguments.callee.first_time) {\r\n player.pauseVideo();\r\n if(!arguments.callee.wasMuted) { player.unMute(); }\r\n window.setTimeout( function() { player.seekTo(-1,false); onMediaControllerPlayerStateChange.bufferingMode=false; window.setTimeout( function() { autostart(true); }, 250); },0);\r\n } else {\r\n window.setTimeout( function() { check_time_to_pause(); }, 50);\r\n }\r\n}\r\n\r\nfunction hide_video_preview() {\r\n var ysp=document.getElementById('__YTE_SCREEN_PREVIEW');\r\n if(ysp) {\r\n var imgElem=ysp.getElementsByTagName('img')[0];\r\n ysp.style.setProperty('display','none','');\r\n var evObj = document.createEvent('MouseEvents');\r\n evObj.initEvent('mouseout', true, false);\r\n imgElem.dispatchEvent(evObj);\r\n }\r\n}\r\n\r\nfunction autostart(start) {\r\n if(start==true) {\r\n arguments.callee.sstate=parseInt('__BUFFERING_AUTOSTART_AT',10);\r\n arguments.callee.wstate=parseInt('__BUFFERING_AUTOSTART_AFTER',10);\r\n if(arguments.callee.wstate>0) {\r\n var mdate=new Date();\r\n mdate.setSeconds(mdate.getSeconds()+arguments.callee.wstate);\r\n arguments.callee.wdate=mdate.getTime();\r\n }\r\n }\r\n var cont=false;\r\n var player=window.document.getElementById('__movie_player');\r\n if(arguments.callee.wstate>0) {\r\n var ndate=new Date();\r\n if(ndate.getTime()>=arguments.callee.wdate) {\r\n player.playVideo();\r\n window.setTimeout(checkNotStarting,50);\r\n } else { cont=true; }\r\n }\r\n if(arguments.callee.sstate>0) {\r\n if(player.getVideoBytesTotal()>=0) {\r\n if(player.getVideoBytesLoaded()>=(player.getVideoBytesTotal()-player.getVideoStartBytes())*arguments.callee.sstate/100-0.5) {\r\n player.playVideo();\r\n window.setTimeout(checkNotStarting,50);\r\n } else { cont=true; }\r\n }\r\n }\r\n if(cont) { window.setTimeout(autostart,400); }\r\n}\r\n\r\nfunction stopAutostart() {\r\n autostart.sstate=0;\r\n autostart.wstate=0;\r\n}\r\n\r\nfunction checkNotStarting() {\r\n function checkNotStarting_seekTrick(old) {\r\n var player=window.document.getElementById('__movie_player');\r\n if(player.getPlayerState()!=1) { return; }\r\n if(player.getCurrentTime()>(old+0.1) || player.getCurrentTime()<(old-0.1)) { return; }\r\n player.seekTo(old+4,0);\r\n window.setTimeout(function() { player.seekTo(old,0); },25);\r\n }\r\n var player=window.document.getElementById('__movie_player');\r\n var current=player.getCurrentTime();\r\n window.setTimeout( function() { checkNotStarting_seekTrick(current); },1000);\r\n}\r\n\r\nonMediaControllerPlayerStateChange = function(newState) {\r\n show_debug('YTP_newState='+newState,0);\r\n var player=window.document.getElementById('__movie_player'); if(!player) { return; }\r\n var autoplay='__autoplay'; if(player.hasAttribute('MC_AUTOPLAY')) { autoplay=player.getAttribute('MC_AUTOPLAY'); }\r\n if((newState==1) && (!arguments.callee.Launch) && (autoplay=='2')) { arguments.callee.bufferingMode=true; }\r\n if(newState==1 && !arguments.callee.bufferingMode) { hide_video_preview(); stopAutostart(); }\r\n // New Check not loading\r\n if((newState>=2 && newState!=3) && arguments.callee.cnl_play) {\r\n arguments.callee.cnl_play=false;\r\n window.setTimeout( function() { player.playVideo(); }, 250);\r\n return;\r\n }\r\n // Start playing...\r\n if(newState==1) {\r\n arguments.callee.cnl_play=false;\r\n arguments.callee.cnl_countdown=parseInt('__CHECK_NOT_LOADING_RESTART',10);\r\n arguments.callee.cnlf_countdown=parseInt('__CHECK_NOT_LOADING_FLUSH',10);\r\n if(!arguments.callee.Launch) {\r\n arguments.callee.Launch=true;\r\n\r\n if('__ENABLE_VOLUME_CONTROL'>'0') {\r\n try { player.setVolume(parseInt('__VOLUME_AT_START',10)); } catch(e) {}\r\n try { player.unMute(); } catch(e) {}\r\n }\r\n\r\n try { var t=yt.www.watch.player.processLocationHashSeekTime(); player.seekTo(Math.max(0,t-1),true); } catch(err) {}\r\n //try { window.g_YouTubePlayerIsReady=true; } catch(err) {}\r\n if (autoplay=='2') { // Autoplay to buffering\r\n check_time_to_pause.wasMuted=player.isMuted(); player.mute(); check_time_to_pause();\r\n }\r\n }\r\n }\r\n // Test Infinite buffering\r\n if(newState==3) { // video is buffering\r\n if(player.getVideoBytesTotal()>=0) {\r\n if(player.getCurrentTime()>player.getDuration()-0.5) {\r\n if(player.getVideoStartBytes()+player.getVideoBytesLoaded()>=player.getVideoBytesTotal()) {\r\n newState=0;\r\n } else {\r\n window.setTimeout( function() { check_still_buffering(); }, 1500);\r\n }\r\n } else {\r\n if(('__REWIND_WHEN_BUFFERING'>'0') && (player.getCurrentTime()>0.5) && (player.getVideoStartBytes()+player.getVideoBytesLoaded()<player.getVideoBytesTotal())) { player.seekTo(0,true); }\r\n }\r\n }\r\n }\r\n // Check for Loop\r\n if(newState==0) { if(check_for_loop(player)) { return; } }\r\n // Original Youtube Script (if no loop)\r\n try { handleWatchPagePlayerStateChange(newState); } catch(err) {}\r\n try { playnav.onPlayerStateChange_bck(newState); } catch(err) {}\r\n}\r\n\r\nonMediaControllerPlayerError = function(perr) {\r\n show_msg('YTP_Error='+perr+' ('+onMediaControllerPlayerStateChange.cnl_countdown+'/'+onMediaControllerPlayerStateChange.cnlf_countdown+')',0);\r\n if(perr==0 || perr==100) {\r\n var player=window.document.getElementById('__movie_player');\r\n if(player) {\r\n if(perr==0) { // Need a kill & revive + Emulate video cued\r\n if(onMediaControllerPlayerStateChange.cnlf_countdown>0) {\r\n onMediaControllerPlayerStateChange.cnlf_countdown--;\r\n //player.parentNode.replaceChild(player.cloneNode(true),player); \r\n onMediaControllerPlayerStateChange.cnl_play=true;\r\n player.stopVideo();\r\n onMediaControllerPlayerStateChange(5);\r\n return;\r\n }\r\n } else { // need a kill & revive\r\n if(player.getVideoBytesTotal()<0 && player.getPlayerState()!=5 && onMediaControllerPlayerStateChange.cnl_countdown>0) {\r\n onMediaControllerPlayerStateChange.cnl_countdown--;\r\n onMediaControllerPlayerStateChange.cnl_play=true;\r\n player.stopVideo();\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n try { playnav.onPlayerError_bck(perr); } catch(err) {}\r\n}\r\n\r\n// vq: small, medium / large, hd720, hd1080\r\nonQualitySelectorPlayerFormatChanged = function(vq) {\r\n show_msg('YTP_quality='+vq,0);\r\n var player=document.getElementById('__movie_player');\r\n if(!player) { return; }\r\n if(player.nodeName=='OBJECT') {\r\n var fp=null; try { fp=document.evaluate('.//param[@name=\"flashvars\"]',player,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue; } catch(err) { fp=null; }\r\n if(fp) { fp.setAttribute('value',fp.getAttribute('value').replace(/((?:^|\\&(?:amp;)?)vq\\=)[^(\\&|$)]*/i,\"$1\"+vq)); }\r\n } else {\r\n player.setAttribute('flashvars',player.getAttribute('flashvars').replace(/((?:^|\\&(?:amp;)?)vq\\=)[^(\\&|$)]*/i,\"$1\"+vq));\r\n }\r\n var elem=document.getElementById('__YTE_OPTIONS_ID');\r\n if(elem) { var evObj=document.createEvent('MouseEvents'); evObj.initEvent('dblclick', true, false); elem.dispatchEvent(evObj); }\r\n hide_video_preview();\r\n try { onPlayerFormatChanged(vq); } catch(err) {}\r\n}\r\n\r\nonCollapseToggle = function(a,b) {\r\n if(arguments.callee.press) { show_msg('Wide button pressed but dropped ('+a+'/'+b+')',0); return; }\r\n window.setTimeout( function() { onCollapseToggle.press=false; }, 250);\r\n arguments.callee.press=true;\r\n\r\n show_msg('Wide button pressed ('+a+'/'+b+')',0);\r\n var player=window.document.getElementById('__movie_player');\r\n if(!player) { return; }\r\n var cwidth=player.style.getPropertyValue('width');\r\n var cheight=player.style.getPropertyValue('height');\r\n if(arguments.callee.lwidth==cwidth && cheight=='__YT_BAR_HEIGHT'+'px') {\r\n arguments.callee.lwidth=null;\r\n player.style.setProperty('height',arguments.callee.lheight,'important');\r\n } else {\r\n arguments.callee.lwidth=cwidth;\r\n arguments.callee.lheight=player.style.getPropertyValue('height'); \r\n player.style.setProperty('height','__YT_BAR_HEIGHT'+'px','important');\r\n }\r\n scrollToVideo(player);\r\n}\r\n\r\nfunction bind_ytp_event(idlaunch) {\r\n var ytplayer=window.document.getElementById('__movie_player');\r\n if(ytplayer) {\r\n if((++bind_ytp_event.count)==1) {\r\n show_debug('Binding event Success = '+idlaunch+' '+bind_ytp_event.count,0);\r\n try { ytplayer.style.setProperty('background','#000000',''); } catch(e) { }\r\n try { ytplayer.addEventListener(\"onStateChange\", \"onMediaControllerPlayerStateChange\"); } catch(e) { show_msg('Error with binding event \"onStateChange\"',0); }\r\n try { ytplayer.addEventListener(\"onError\", \"onMediaControllerPlayerError\"); } catch(e) { show_msg('Error with binding event \"onError\"',0); }\r\n try { ytplayer.addEventListener(\"onPlaybackQualityChange\", \"onQualitySelectorPlayerFormatChanged\"); } catch(e) { show_msg('Error with binding event \"onPlaybackQualityChange\"',0); }\r\n try { ytplayer.addEventListener(\"SIZE_CLICKED\", \"onCollapseToggle\"); } catch(e) { show_msg('Error with binding event \"SIZE_CLICKED\"',0); }\r\n // Playlist... ?\r\n try { ytplayer.addEventListener(\"NEXT_CLICKED\", \"yt.www.watch.player.onPlayerNextClicked\"); } catch(e) { show_msg('Error with binding event \"NEXT_CLICKED\"',0); }\r\n try { ytplayer.addEventListener(\"NEXT_SELECTED\",\"yt.www.watch.player.onPlayerNextSelected\"); } catch(e) { show_msg('Error with binding event \"NEXT_SELECTED\"',0); }\r\n } else { show_debug('Binding event Failed = '+idlaunch+' '+bind_ytp_event.count,0); }\r\n }\r\n}\r\nfunction bind_MediaControllerPlayerStateChange(playerid,idlaunch,count) {\r\n show_debug('Bind_YTP='+playerid,0);\r\n check_movie_player();\r\n var ytplayer=window.document.getElementById('__movie_player');\r\n if(ytplayer) {\r\n // Flush to remove the initial event since there no removeEventListener ?\r\n if(isUndefined(arguments.callee.initialflush)) { arguments.callee.initialflush=0; } // Don't do it since i see no problem :p\r\n var flush=arguments.callee.initialflush; arguments.callee.initialflush=0;\r\n flush += check_allowscriptaccess(ytplayer);\r\n flush += set_autoplay(ytplayer,'__autoplay');\r\n if(count==9) { flush++; } // Something wrong...\r\n if(flush) { ytplayer.parentNode.replaceChild(ytplayer.cloneNode(true),ytplayer); return; }\r\n var state=-3; try { state=ytplayer.getPlayerState(); } catch(err) { state=-4; }\r\n if(state<-2) { // Still loading the player...\r\n if(idlaunch==arguments.callee.lastid) {\r\n if(count>99) { return; } // Something very wrong...\r\n show_debug('Restart Bind_YTP='+playerid+' / state='+state+' / count='+count,0);\r\n window.setTimeout( function() { bind_MediaControllerPlayerStateChange(playerid,idlaunch,++count); }, 50);\r\n }\r\n } else {\r\n if(idlaunch==arguments.callee.lastid) {\r\n bind_ytp_event(idlaunch);\r\n } else { show_debug('Bind_YTP stopped for '+idlaunch,0); }\r\n }\r\n } else { show_msg('YT Player not found',0); }\r\n}\r\n\r\nbind_MediaControllerPlayerStateChange.lastid=0;\r\nfunction YTE_onYouTubePlayerReady(playerid) {\r\n show_debug('YTE_YTP_Ready='+playerid,0);\r\n stopAutostart();\r\n onMediaControllerPlayerStateChange.Launch=false;\r\n onMediaControllerPlayerStateChange.cnl_countdown=parseInt('__CHECK_NOT_LOADING_RESTART',10);\r\n onMediaControllerPlayerStateChange.cnl_play=false;\r\n onMediaControllerPlayerStateChange.bufferingMode=false;\r\n //if('__autoplay'<'3') { if(window.location.hash.match(/^#play\\//)) { window.location.hash=''; } }\r\n bind_MediaControllerPlayerStateChange(playerid,++bind_MediaControllerPlayerStateChange.lastid,0);\r\n try { showAndSet3DModeControl(0); threedViewStyleChange(); } catch(err) {}\r\n //try { playnav.initPlayer(); /*onChannelPlayerReady(playerid);*/ } catch(err) {}\r\n}\r\nfunction YTE_FlushPlayer(player_name) {\r\n var el=document.getElementById(player_name);\r\n var elp=el.parentNode;\r\n var eln=el.nextSibling; elp.removeChild(el); var nel=el.cloneNode(true); elp.insertBefore(nel,eln); // New flush method\r\n}\r\nonYouTubePlayerReady_rebindAndFlush=function(player_name) {\r\n // Redefine onYouTubePlayerReady (warning: can cause conflict with an other script)\r\n bind_ytp_event.count=0;\r\n onMediaControllerPlayerStateChange.cnlf_countdown=parseInt('__CHECK_NOT_LOADING_FLUSH',10);\r\n onYouTubePlayerReady = function(playerid) { YTE_onYouTubePlayerReady(playerid); }\r\n if(player_name) { YTE_FlushPlayer(decodeURIComponent(player_name)); }\r\n}\r\nonYouTubePlayerReady_rebindAndFlush(); onYouTubePlayerReady();\r\n\r\n// some playnav move...\r\ntry {\r\n playnav.onPlayerStateChange_bck=playnav.onPlayerStateChange;\r\n playnav.onPlayerError_bck=playnav.onPlayerError;\r\n playnav.onPlayerStateChange=function() {}\r\n playnav.onPlayerError=function() {}\r\n\r\n window.goog.dom.$=function(a) {\r\n var player_ = {\r\n pauseVideo: function() { document.getElementById('movie_player').pauseVideo(); }\r\n , playVideo: function() { document.getElementById('movie_player').playVideo(); }\r\n , stopVideo: function() { document.getElementById('movie_player').stopVideo(); }\r\n }\r\n if(typeof(a)=='string') { if(a=='movie_player') { return player_; }; return document.getElementById(a); } else { return a; }\r\n }\r\n} catch(err) {}\r\n\r\nvar pvpi=document.getElementById('playnav-video-panel-inner');\r\nif(pvpi) {\r\n onRefreshDetails=function() {\r\n if('__EXPAND_VIDEO_DETAILS'>='1') {\r\n var pcdm=document.getElementById('playnav-curvideo-description-more');\r\n if(pcdm) { window.setTimeout( function() { playnav.toggleFullVideoDescription(true); },250); }\r\n }\r\n var pcvt=document.getElementById('playnav-curvideo-title');\r\n if(pcvt) {\r\n var sp=pcvt.getElementsByTagName('span');\r\n if(sp.length>0) {\r\n sp=sp[0]; var oc=sp.getAttribute('onclick');\r\n if(oc) {\r\n var res=oc.match(/watch\\?v\\=(.*?)\\'/);\r\n if(res) {\r\n var al=document.createElement(\"a\");\r\n nsp=sp.cloneNode(true); nsp.removeAttribute('onclick');\r\n al.setAttribute('href','/watch?v='+res[1]);\r\n al.appendChild(nsp); sp.parentNode.replaceChild(al,sp);\r\n } } } }\r\n }\r\n pvpi.addEventListener('DOMNodeInserted',onRefreshDetails,true);\r\n}\r\n\r\n } //~~~~~~~ Endof innerscript ~~~~~~~//\r\n\r\n innerscript=innerscript.toString()\r\n .replace(/__movie_player/g,YT_PLAYER_EMBED)\r\n .replace(/__watch-player-div/,WATCH_PLAYER_DIV)\r\n .replace(/__autoplay/g,getAutoplayValue())\r\n .replace(/__quality_selector/,QUALITY_SELECTOR_ID)\r\n .replace(/__CHECK_NOT_LOADING_RESTART/g,Math.min(10,getValue('CHECK_NOT_LOADING_RESTART')))\r\n .replace(/__CHECK_NOT_LOADING_FLUSH/g,Math.min(30,getValue('CHECK_NOT_LOADING_FLUSH')))\r\n .replace(/__YTE_OPTIONS_ID/,YTE_OPTIONS_ID)\r\n .replace(/__YTE_SCREEN_PREVIEW/,YTE_SCREEN_PREVIEW)\r\n .replace(/__YT_BAR_HEIGHT/g,getPlayerBarHeight($(YT_PLAYER_EMBED)))\r\n .replace(/__REWIND_WHEN_BUFFERING/,getValue('REWIND_WHEN_BUFFERING'))\r\n .replace(/__EXPAND_VIDEO_DETAILS/,getValue('BCHAN_EXPAND_VIDEO_DETAILS'))\r\n .replace(/__BUFFERING_AUTOSTART_AT/,getValue('BUFFERING_AUTOSTART_AT'))\r\n .replace(/__BUFFERING_AUTOSTART_AFTER/,getValue('BUFFERING_AUTOSTART_AFTER'))\r\n .replace(/__ENABLE_VOLUME_CONTROL/,getValue('ENABLE_VOLUME_CONTROL'))\r\n .replace(/__VOLUME_AT_START/,getValue('VOLUME_AT_START'))\r\n .replace(/__DEBUG/g,DEBUG);\r\n\r\n var script=document.createElement(\"script\");\r\n script.setAttribute('type','text/javascript');\r\n script.textContent=\"(\"+innerscript+\")();\";\r\n document.body.appendChild(script);\r\n}", "function onPlayerReady(event) {\n //event.target.playVideo();\n $(\"#vod\").fitVids();\n player.setPlaybackQuality('hd720');\n}", "function onYouTubeIframeAPIReady() {\n ytPlayer = new YT.Player('yt-player', {\n width: '1280',\n height: '720',\n videoId: bgVideoID,\n playerVars: playerOptions,\n events: {\n 'onReady': onPlayerReady,\n 'onStateChange': onPlayerStateChange\n }\n });\n\n ytPlayer = new YT.Player('yt-player-xonotic', {\n width: '1280',\n height: '720',\n videoId: 'DKvh_IwG7o4',\n playerVars: {\n // Autoplay + mute has to be activated (value = 1) if you want to autoplay it everywhere \n // Chrome/Safari/Mobile\n autoplay: 1,\n mute: 1,\n autohide: 1, \n modestbranding: 1, \n rel: 0, \n showinfo: 0, \n controls: 0, \n disablekb: 1, \n enablejsapi: 1, \n iv_load_policy: 3,\n startAt: 260,\n // For looping video you have to have loop to 1\n // And playlist value equal to your currently playing video\n loop: 1,\n playlist: 'DKvh_IwG7o4',\n events: {\n 'onReady': onPlayerReady,\n 'onStateChange': onPlayerStateChange\n }\n }\n });\n\n ytPlayer = new YT.Player('yt-player-red-alert-2', {\n width: '1280',\n height: '720',\n videoId: 'BmYE3JDL59g',\n playerVars: {\n // Autoplay + mute has to be activated (value = 1) if you want to autoplay it everywhere \n // Chrome/Safari/Mobile\n autoplay: 1,\n mute: 1,\n autohide: 1, \n modestbranding: 1, \n rel: 0, \n start: 30,\n showinfo: 0, \n controls: 0, \n disablekb: 1, \n enablejsapi: 1, \n iv_load_policy: 3,\n startAt: 30,\n // For looping video you have to have loop to 1\n // And playlist value equal to your currently playing video\n loop: 1,\n playlist: 'BmYE3JDL59g'\n }\n });\n\n ytPlayer = new YT.Player('yt-player-skribbl', {\n width: '1280',\n height: '720',\n videoId: '_SQmdP-Dvag',\n playerVars: {\n // Autoplay + mute has to be activated (value = 1) if you want to autoplay it everywhere \n // Chrome/Safari/Mobile\n autoplay: 1,\n mute: 1,\n autohide: 1, \n modestbranding: 1, \n rel: 0, \n showinfo: 0, \n controls: 0, \n disablekb: 1, \n enablejsapi: 1, \n iv_load_policy: 3,\n start: 0,\n // For looping video you have to have loop to 1\n // And playlist value equal to your currently playing video\n loop: 1,\n playlist: '_SQmdP-Dvag',\n events: {\n 'onReady': onPlayerReady,\n 'onStateChange': onPlayerStateChange\n }\n }\n });\n}", "function checkAutoSubtitles() {\r\n\t\r\n\tif(iPlayerName != \"youtube\") {\r\n\t\treturn false;\r\n\t}\r\n\t\r\n var autoGeneratedElements;\r\n\r\n if ($(iSubtitlesElementNamejQuery)[0] && \r\n\t\t$(iSubtitlesElementNamejQuery)[0].firstChild &&\r\n\t\t$(iSubtitlesElementNamejQuery)[0].firstChild.firstChild) {\r\n\t\t\t\r\n autoGeneratedElements = $(iSubtitlesElementNamejQuery)[0].firstChild.firstChild.getElementsByTagName(\"span\").length\r\n } else {\r\n autoGeneratedElements = 0;\r\n }\r\n\r\n if (autoGeneratedElements) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n\r\n}", "function lyt(vid_number) { //reusable for all - just pass in array index of lyt(vidz(4),'v0'), a 2nd argument 'v0' single quoted\n IDx('response_iframe_id').style='z-index:2;width:500px;height:300px';//resets iframe css incase it was altered when 'v0' was passed - no-video\n if(arguments[1]==='v0'){//check if there is a 2nd argument passed--if it is 'v0' 'video 0/video off/sound on' then do something..\n IDx('response_iframe_id').style='z-index:-4;position:absolute;top:250px;left:125px;width:0;height:0';//hide visible part of video clip\n }\n IDx('response_img_id').style.display = 'none'; /*clear img in the same spot if it is still playing-so they dont collide*/\n IDx('response_iframe_id').src = whole_url;\n setTimeout(action_after_delay_timer1, vid[vid_number].dvt); //delay before displaying iframe to not show vid load-also set back start vid time in youtube url to not miss anything\n function action_after_delay_timer1() {\n IDx('response_iframe_id').style.display = 'inline';\n //IDx('response_iframe_id').style.zIndex = '2';\n }\n setTimeout(timerGo_vid, vid[vid_number].evt); //vid close.. display off timer -- looks for timer value passed into function\n\n function timerGo_vid() {\n IDx('response_iframe_id').src = ''; //makes iframe suddenly have no src turning to black background css\n IDx('response_iframe_id').style.display = 'none'; //makes iframe disappear abruptly\n }\n}", "function onPlayerReady(event) {\r\n log(\"onPlayerReady\");\r\n if (!dataChk(cjvideoTmpPlayer)) {\r\n return;\r\n }\r\n\r\n var y_data = event.target.getVideoData();\r\n\r\n cjvideoTmpPlayer.opt.youtube_mc = event.target;\r\n //cjvideoTmpPlayer.opt.cover = thumb[target_num].url;\r\n //cjvideoTmpPlayer.info_obj.title = y_data.title;\r\n \r\n if(cjvideoTmpPlayer.opt.isConfigYoutube) {\r\n \r\n cjvideoTmpPlayer.htmlMake();\r\n \r\n } else {\r\n loadData('https://www.googleapis.com/youtube/v3/videos?part=snippet%20&mine=true&key=AIzaSyA35NDEKBJXS43xP1yuZOScpnCE3nZwA0U&id=' + cjvideoTmpPlayer.opt.youtube_id, 'jsonp', function () {\r\n\r\n log(\"유투브 오케이\");\r\n try {\r\n var data = arguments[1];\r\n var yt_data = data.items[0].snippet;\r\n\r\n cjvideoTmpPlayer.info_obj.title = yt_data.title;\r\n\r\n var p = 0;\r\n for (var i in yt_data.thumbnails) {\r\n\r\n if (p < yt_data.thumbnails[i].width) {\r\n cjvideoTmpPlayer.opt.cover = yt_data.thumbnails[i].url;\r\n }\r\n\r\n p = yt_data.thumbnails[i].width;\r\n\r\n if (i == \"maxres\") {\r\n break;\r\n }\r\n }\r\n cjvideoTmpPlayer.opt.cover = String(cjvideoTmpPlayer.opt.cover).replace(\"https://\", \"http://\");\r\n\r\n //media_data.url.pageurl = yt_data.player[\"default\"];\r\n //media_data.cdn\r\n\r\n log(\"유투브 커버 : \" + cjvideoTmpPlayer.opt.cover);\r\n\r\n } catch (e) {\r\n log(e);\r\n }\r\n cjvideoTmpPlayer.htmlMake();\r\n\r\n }, function () {\r\n\r\n });\r\n }\r\n\r\n \r\n\r\n\r\n //event.target.mute();\r\n //event.target.playVideo();\r\n //event.target.pauseVideo();\r\n}", "function cms_auto_video_width() {\r\n\t\t$('.post-header-media iframe').each(function(){\r\n\t\t\tvar v_width = $(this).width();\r\n\t\t\t\r\n\t\t\tv_width = v_width / (16/9);\r\n\t\t\t$(this).attr('height',v_width + 35);\r\n\t\t})\r\n\t}", "function setSubtitle() {\n\n var division = getDivision(),\n divText = getDivisionAdjective(division),\n\tevent = capitalizeEvent(window.curEvent);\n\n $('#subtitle').text('Assign teams for ' + divText + ' ' + event);\n}", "function youtube_overlay() {\n jQuery( '.modules, .list-products-360, .parts' ).find( 'a[href*=\"youtube.com/watch\"]' ).addClass( 'video-link' ).click(function(event) {\n if ( this.player ) {\n this.player.start();\n }\n else {\n var video_id = this.href.match( /v=([^&]+)/ )[1];\n this.player = jQuery( '<div/>' ).addClass( 'video-player' )[0];\n this.player.overlay = jQuery( '<div/>' ).addClass( 'overlay' )[0];\n this.player.overlay.player = this.player;\n this.player.close = jQuery( '<button/>' ).text( 'Close' ).addClass( 'close-x' ).appendTo( this.player )[0];\n this.player.close.player = this.player;\n\n this.player.start = function() {\n jQuery( [ this, this.overlay ] ).show();\n this.iframe = jQuery( '<iframe/>', {\n type: 'text/html',\n width: '640',\n height: '435',\n frameborder: '0',\n src: '//www.youtube.com/embed/' + video_id\n }).appendTo( this )[0];\n }\n this.player.stop = function() {\n jQuery( [ this, this.overlay ] ).hide();\n jQuery( this.iframe ).remove();\n }\n\n jQuery( [ this.player.overlay, this.player.close ] ).click( function() {\n this.player.stop();\n })\n\n jQuery( document.body ).append( this.player.overlay, this.player );\n this.player.start();\n }\n event.preventDefault();\n });\n jQuery( document.body ).keyup(function(event) {\n if ( event.keyCode == 27 ) jQuery( '.video-player' ).each(function() { this.stop() });\n });\n}", "function playVideo(array, index){\n\t\twindow.location.hash = array[index];\n\t\tvar player = $(\"#video-player\")[0];\n\t\tconsole.log(index);\n\t\tif(!player) {console.log(\"Video player hasn't loaded yet.\"); return;} //didn't load yet?\n\t\tcurrentVidArray = array;\n\t\tcurrentVidIndex = index;\n\t\tif(currentVidIndex == 0) dotcss(\"#video-browser-lt\").hide();\n\t\telse dotcss(\"#video-browser-lt\").show().display(\"table\");\n\t\tif(currentVidIndex == currentVidArray.length - 1) dotcss(\"#video-browser-gt\").hide();\n\t\telse dotcss(\"#video-browser-gt\").show().display(\"table\");\n\t\tplayer.src = \"https://www.youtube.com/embed/\" + array[index] ;//+ \"?autoplay=1\";\n\t\tif (!overlayon) dotcss(\"#absolute-video-player-container\").fadeIn();\n\n\t\tif (bodyOverflow === null) bodyOverflow = document.body.style.overflow;\n\t\tif (bodyOverflowX === null) bodyOverflowX = document.body.style.overflowX;\n\t\tif (bodyOverflowY === null) bodyOverflowY = document.body.style.overflowY;\n\t\tdocument.body.style.overflow = \"hidden\";\n\t\tdocument.body.style.overflowX = \"hidden\";\n\t\tdocument.body.style.overflowY = \"hidden\";\n\t\toverlayon = true;\n\t}", "function moduleFullscreenVideo(){\n var textPageInstanceHolder = $( txt_modCont);\n var textPageInstance = $( \"#module-fullscreen-video\", textPageInstanceHolder);\n var width = $(window).width() - get_OffsetWidth();\n var height = $(window).height();\n\n textPageInstance.css(\"opacity\", \"0\");\n textPageInstance.attr(\"style\", \"width:\" + width + \"px; height:\" + height + \"px;\" );\n textPageInstanceHolder.css(\"visibility\", \"visible\");\n \tTweenMax.to( textPageInstance, .6, { css:{ opacity: \"1\"}, ease:Circ.easeOut });\n audioPlayerPause();\n var fullscreenVideo = $(\"#video-wrapper\", textPageInstanceHolder);\n if( fullscreenVideo.length > 0 ){\n fullscreenVideo.attr(\"data-width\", width);\n fullscreenVideo.attr(\"data-height\", height);\n\n var media = $(\"#fullscreen-video-holder\", textPageInstance);\n if( touchDevice == 1){\n if( fullscreenVideo.children().length > 0 ){\n tempVid = $(\"div:first\", fullscreenVideo);\n media.empty();\n media.append(tempVid);\n\n }\n fullscreenVideo = $(\"#video-wrapper\", textPageInstanceHolder);\n }\n fullscreenVideo.empty();\n templateAddMediaVideo( fullscreenVideo.attr(\"data-video-type\"), fullscreenVideo, undefined );\n }\n\n }", "function playVideoContent() {\n videoFrame.style.visibility = 'hidden';\n videoFrame.type = contents[contents.index].type;\n videoFrame.src = contents[contents.index].src;\n videoFrame.play();\n videoFrame.style.visibility = 'visible';\n videoFrame.removeAttribute(\"controls\"); \n}", "restoreDown(){\n let restore=document.querySelectorAll(\".restore_down\");\n let video=document.querySelectorAll(\".video_1\");\n let title=document.querySelector(\"#movie_title_iframe\");\n let player=document.querySelector(\"#video_player \");\n let isRestoreDown=true;\n\n\n restore.forEach(function (el) {\n\n el.addEventListener(\"click\", function (event) {\n event.preventDefault();\n if (isRestoreDown) {\n isRestoreDown = false;\n\n video[0].style.cssText = \"height: 140%;\";\n el.style.cssText = \"margin-left: 2%;\";\n if (title.textContent.length >= 42) {\n\n title.style.cssText = \" padding-right:1%;\"\n } else {\n title.style.cssText = \"padding-right:16%;\"\n }\n player.style.cssText = \" border-radius: 2px; width: 40%; height: 25%;display:block;margin-top:272px;padding-top:1%;padding-bottom:8%;margin-left:800px\"\n } else {\n isRestoreDown = true;\n\n if (title.textContent.length > 30) {\n\n title.style.cssText = \" padding-right:38%;\"\n } else {\n title.style.cssText = \"padding-right:54%;\"\n }\n video[0].style.cssText = \"height: 60%;\";\n player.style.cssText = \" border-radius: none; width: 100%; height: 100%;display:block;margin-top:0;margin-left:0px;padding-top:5%;padding-bottom:7%;\"\n\n }\n\n\n })\n\n })\n }", "function youtubeLinkReplace() {\r\n (function ($) {\r\n var videoClass = '.youtubeVideoLink';\r\n var iframeTag = '<iframe width=\"100%\" height=\"100%\" src=\"{PROTOCOL}//www.youtube.com/embed/{VIDEO_ID}\" frameborder=\"0\" allowfullscreen></iframe>';\r\n\r\n videoContainers = $(videoClass);\r\n videoContainers.each(function () {\r\n var videoContainer = $(this);\r\n\r\n var parentDiv = $(videoContainer).parent();\r\n var parentWidth = parentDiv.width();\r\n if (parentWidth > 640) {\r\n parentWidth = 640;\r\n }\r\n var videoWidth = parentWidth;\r\n var videoHeight = (parentWidth * (9 / 16)) + 24;\r\n $(videoContainer).css(\"width\", videoWidth + \"px\");\r\n $(videoContainer).css(\"height\", videoHeight + \"px\");\r\n\r\n if (parentWidth == 640) {\r\n $(videoContainer).css(\"margin\", \"0 auto\");\r\n\r\n var nextSibling = $(videoContainer).next();\r\n if (nextSibling.attr(\"class\") == \"youtubeVideoCaption\") {\r\n var captionPaddingLeft = nextSibling.css(\"paddingLeft\");\r\n captionPaddingLeft = captionPaddingLeft.replace('px', '');\r\n captionPaddingLeft = parseInt(captionPaddingLeft);\r\n var captionPaddingRight = nextSibling.css(\"paddingRight\");\r\n captionPaddingRight = captionPaddingRight.replace('px', '');\r\n captionPaddingRight = parseInt(captionPaddingRight);\r\n var captionPadding = captionPaddingLeft + captionPaddingRight;\r\n var captionWidth = videoWidth - captionPadding;\r\n nextSibling.css(\"width\", captionWidth + \"px\");\r\n nextSibling.css(\"margin\", \"0 auto\");\r\n }\r\n }\r\n\r\n var videoUrl = $(videoContainer).text();\r\n if (videoUrl.length) {\r\n var id = getIdFromUrl(videoUrl);\r\n videoTag = iframeTag.replace(/\\{VIDEO_ID\\}/g, id).replace(/\\{PROTOCOL\\}/g, window.location.protocol);\r\n videoContainer.html(videoTag);\r\n }\r\n });\r\n })(jQuery);\r\n}", "function cms_auto_video_width() {\r\n\t\t$('.entry-video iframe').each(function(){\r\n\t\t\tvar v_width = $(this).width();\r\n\t\t\t\r\n\t\t\tv_width = v_width / (16/9);\r\n\t\t\t$(this).attr('height',v_width + 35);\r\n\t\t})\r\n\t}", "function startVideoContent()\n{\n app.log(2, 'startVideoContent');\n setTimeout(function()\n {\n Callcast.AddSpot({spotReplace: 'first-unoc', spotNodup: 1, spotType: 'youtube',\n ytid: 'ZAvL3j3hOCU', // youtube is a conference\n spotDivId: 'demo-video-1'\n });\n }, 1000);\n setTimeout(function()\n {\n Callcast.AddSpot({spotReplace: 'last-unoc', spotNodup: 1, spotType: 'youtube',\n ytid: 'BW44KXIu7Q8', // Daphne Koller coursera interview\n spotDivId: 'demo-video-2'\n });\n }, 1000);\n return false;\n}", "function trx_addons_resize_video(cont) {\n if (cont===undefined) cont = jQuery('body');\n cont.find('video').each(function() {\n \"use strict\";\n var video = jQuery(this).eq(0);\n var ratio = (video.data('ratio')!=undefined ? video.data('ratio').split(':') : [16,9]);\n ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1];\n var mejs_cont = video.parents('.mejs-video');\n var w_attr = video.data('width');\n var h_attr = video.data('height');\n if (!w_attr || !h_attr) {\n w_attr = video.attr('width');\n h_attr = video.attr('height');\n if (!w_attr || !h_attr) return;\n video.data({'width': w_attr, 'height': h_attr});\n }\n var percent = (''+w_attr).substr(-1)=='%';\n w_attr = parseInt(w_attr, 0);\n h_attr = parseInt(h_attr, 0);\n var w_real = Math.round(mejs_cont.length > 0 ? Math.min(percent ? 10000 : w_attr, mejs_cont.parents('div,article').width()) : video.width()),\n h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr);\n if (parseInt(video.attr('data-last-width'), 0)==w_real) return;\n if (mejs_cont.length > 0 && mejs) {\n trx_addons_set_mejs_player_dimensions(video, w_real, h_real);\n }\n if (percent) {\n video.height(h_real);\n } else {\n video.attr({'width': w_real, 'height': h_real}).css({'width': w_real+'px', 'height': h_real+'px'});\n }\n video.attr('data-last-width', w_real);\n });\n cont.find('.video_frame iframe').each(function() {\n \"use strict\";\n var iframe = jQuery(this).eq(0);\n if (iframe.attr('src').indexOf('soundcloud')>0) return;\n var ratio = (iframe.data('ratio')!=undefined \n ? iframe.data('ratio').split(':') \n : (iframe.parent().data('ratio')!=undefined \n ? iframe.parent().data('ratio').split(':') \n : (iframe.find('[data-ratio]').length>0 \n ? iframe.find('[data-ratio]').data('ratio').split(':') \n : [16,9]\n )\n )\n );\n ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1];\n var w_attr = iframe.attr('width');\n var h_attr = iframe.attr('height');\n if (!w_attr || !h_attr) {\n return;\n }\n var percent = (''+w_attr).substr(-1)=='%';\n w_attr = parseInt(w_attr, 0);\n h_attr = parseInt(h_attr, 0);\n var pw = iframe.parent().width(),\n ph = iframe.parent().height(),\n w_real = pw,\n h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr);\n if (iframe.parent().css('position') == 'absolute' && h_real > ph) {\n h_real = ph;\n w_real = Math.round(percent ? h_real*ratio : h_real*w_attr/h_attr)\n }\n if (parseInt(iframe.attr('data-last-width'), 0)==w_real) return;\n iframe.css({'width': w_real+'px', 'height': h_real+'px'});\n iframe.attr('data-last-width', w_real);\n });\n}", "function videoClickEvent(item,container,opt,simpleframe) {\n\n\n\t\t\t item.css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\t\t\t item.closest('.esg-overflowtrick').css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\t\t\t item.closest('ul').css({transform:\"none\",'-moz-transform':'none','-webkit-transform':'none'});\n\n\n\t\t\t // PREPARE THE CONTAINERS FOR MEDIAS\n\t\t\t if (!simpleframe)\n\t\t\t\t item.find('.esg-media-video').each(function() {\n\t\t\t\t var prep = jQuery(this);\n\t\t\t\t if (prep.data('youtube')!=undefined && item.find('.esg-youtube-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var ytframe = \"https://www.youtube.com/embed/\"+prep.data('youtube')+\"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0\";\n\t\t\t\t\t media.append('<iframe class=\"esg-youtube-frame\" wmode=\"Opaque\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+ytframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\n\t\t\t\t if (prep.data('vimeo')!=undefined && item.find('.esg-vimeo-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var vimframe = \"http://player.vimeo.com/video/\"+prep.data('youtube')+\"?title=0&byline=0&html5=1&portrait=0&api=1;\";\n\t\t\t\t\t media.append('<iframe class=\"esg-vimeo-frame\" allowfullscreen=\"false\" style=\"position:absolute;top:0px;left:0px;display:none\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+vimframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\t\t\t\t\tif (prep.data('wistia')!=undefined && item.find('.esg-wistia-frame').length==0) {\n\t\t\t\t\t var media= item.find('.esg-entry-media');\n\t\t\t\t \t var wsframe = \"https://fast.wistia.net/embed/iframe/\"+prep.data('wistia')+\"?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0\";\n\t\t\t\t\t media.append('<iframe class=\"esg-wistia-frame\" wmode=\"Opaque\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-src=\"'+wsframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\t\t\t\t if (prep.data('soundcloud')!=undefined && item.find('.esg-soundcloud-frame').length==0) {\n\t\t\t\t\t var media = item.find('.esg-entry-media');\n\t\t\t\t\t var scframe = 'https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/'+prep.data('soundcloud')+'&amp;auto_play=false&amp;hide_related=false&amp;visual=true&amp;show_artwork=true';\n\t\t\t\t\t media.append('<iframe class=\"esg-soundcloud-frame\" allowfullscreen=\"false\" style=\"position:absolute;top:0px;left:0px;display:none\" webkitallowfullscreen=\"\" mozallowfullscreen=\"\" allowfullscreen=\"\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" scrolling=\"no\" frameborder=\"no\" data-src=\"'+scframe+'\" src=\"about:blank\"></iframe>');\n\t\t\t\t }\n\n\t\t\t\t if ((prep.data('mp4')!=undefined || prep.data('webm')!=undefined || prep.data('ogv')!=undefined) && item.find('.esg-video-frame').length==0 ) {\n\t\t\t\t \t var media= item.find('.esg-entry-media');\n\t\t\t media.append('<video class=\"esg-video-frame\" style=\"position:absolute;top:0px;left:0px;display:none\" width=\"'+prep.attr(\"width\")+'\" height=\"'+prep.attr(\"height\")+'\" data-origw=\"'+prep.attr(\"width\")+'\" data-origh=\"'+prep.attr(\"height\")+'\" ></video');\n\t\t\t\t if (prep.data('mp4')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"mp4\")+'\" type=\"video/mp4\" />');\n\t\t\t\t if (prep.data('webm')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"webm\")+'\" type=\"video/webm\" />');\n\t\t\t\t if (prep.data('ogv')!=undefined) media.find('video').append('<source src=\"'+prep.data(\"ogv\")+'\" type=\"video/ogg\" />');\n\t\t\t\t }\n\n\t\t\t\t })\n\n\t\t\t adjustMediaSize(item,true,null,opt);\n\n\t\t\t var ifr = item.find('.esg-youtube-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-vimeo-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-wistia-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-soundcloud-frame');\n\t\t\t if (ifr.length==0) ifr=item.find('.esg-video-frame');\n\n\t\t\t var cover = item.find('.esg-entry-cover');\n\t\t\t var poster = item.find('.esg-media-poster');\n\n\n\n\t\t\t // IN CASE NO FRAME IS PREDEFINED YET WE NEED TO LOAD API, AND VIDEO, AND CHANGE SRC\n\n\t\t\t if (ifr.attr('src')==\"about:blank\") {\n\t\t\t\t ifr.attr('src',ifr.data('src'));\n\n\t\t\t\t loadVideoApis(container,opt);\n\t\t\t\t if (!simpleframe) punchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t var intr = setInterval(function() {\n\n\t\t\t\t \t// CHECK IF YOUTUBE MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('youtube')>0) {\n\t\t\t\t \t if (prepareYT(ifr)==true) {\n\n\t\t\t\t \t\t\tclearInterval(intr);\n\t\t\t\t \t\t\tif (!simpleframe) {\n\t\t\t\t \t\t\t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tplayYT(ifr,simpleframe);\n\t\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t \t}\n\t\t\t\t \t }\n\t\t\t\t \t}\n\n\t\t\t\t \telse\n\n\t\t\t\t\t// CHECK IF VIMEO MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('vimeo')>0) {\n\t\t\t\t \t if (prepareVimeo(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t \t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t \tplayVimeo(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t \telse\n\t\t\t\t\t\n\t\t\t\t\t// CHECK IF wistia MEDIA IS IN THE CONTAINER\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('wistia')>0) {\n\t\t\t\t\t\tif (prepareWs(ifr)==true) {\n\n\t\t\t\t \t\t\tclearInterval(intr);\n\t\t\t\t \t\t\tif (!simpleframe) {\n\t\t\t\t \t\t\t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tplayYT(ifr,simpleframe);\n\t\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t \t}\n\n\t\t\t\t\telse\n\n\t\t\t\t\t// CHECK IF VIMEO MEDIA IS IN THE CONTAINER\n\t\t\t\t \tif (ifr.attr('src').toLowerCase().indexOf('soundcloud')>0) {\n\t\t\t\t \t if (prepareSoundCloud(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t\t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t \t\tplaySC(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t},100);\n\t\t\t} else\n\n\t\t\tif (ifr.hasClass(\"esg-video-frame\")) {\n\n\t\t\t\t loadVideoApis(container,opt);\n\t\t\t\t punchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t // CHECK IF VIDEO MEDIA IS IN THE CONTAINER\n\t\t\t\t var intr = setInterval(function() {\n\t\t\t\t \t if (prepareVideo(ifr)==true) {\n\t\t\t\t \t \t\tclearInterval(intr);\n\t\t\t\t \t \t\tif (!simpleframe) {\n\t\t\t\t\t \t \t\tif (is_mobile()) {\n\t\t\t\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t\t\t\t} else {\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\n\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t \tplayVideo(ifr,simpleframe);\n\t\t\t\t\t\t \t}\n\n\t\t\t\t\t\t}\n\t\t\t\t },100)\n\n\t\t\t } else {\n\t\t\t\tif (!simpleframe) {\n\t\t\t\t\tif (is_mobile()) {\n\t\t \t\t\t\tpunchgs.TweenLite.set(ifr,{autoAlpha:1});\n\t\t\t\t \t\tpunchgs.TweenLite.set(poster,{autoAlpha:0});\n\t\t\t\t \t\tpunchgs.TweenLite.set(cover,{autoAlpha:0});\n\t\t\t\t \t} else {\n\n\t\t\t\t\t\tpunchgs.TweenLite.set(ifr,{opacity:0,display:\"block\"});\n\t\t\t\t \t\tpunchgs.TweenLite.to(ifr,0.5,{autoAlpha:1});\n\t\t\t\t \t\tpunchgs.TweenLite.to(poster,0.5,{autoAlpha:0});\n\t\t\t\t \t\tpunchgs.TweenLite.to(cover,0.5,{autoAlpha:0});\n\t\t\t\t \t}\n\t\t\t \t}\n\t\t \t\tif (ifr.attr('src') !=undefined) {\n\t\t\t \t\tif (ifr.attr('src').toLowerCase().indexOf('youtube')>0)\n\t\t\t\t\t \tplayYT(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('vimeo')>0)\n\t\t\t\t\t \tplayVimeo(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('wistia')>0)\n\t\t\t\t\t \tplayWs(ifr,simpleframe);\n\t\t\t\t\tif (ifr.attr('src').toLowerCase().indexOf('soundcloud')>0)\n\t\t\t\t\t \tplaySC(ifr,simpleframe);\n\n\t\t\t\t}\n\t\t\t }\n}", "render() {\n const videoId = this.props.embed; \n const opts = {\n height: '390',\n width: '640', \n playerVars: {\n showinfo: 0, \n controls: 0, \n rel: 0,\n autoplay: 0,\n version: 3,\n playlist: videoId,\n loop: 1,\n start: 10,\n fs: 1, // Hide the full screen button\n cc_load_policy: 0, // Hide closed captions\n iv_load_policy: 3, // Hide the Video Annotations\n autohide: 1,\n modestbranding: 1,\n origin: 'https://www.behappyforonce.com'\n }\n\n };\n return (\n <div className={galleryStyle.videoContainer/*this.getOverlayClass()*/}>\n <YouTube\n ref={\"player\"}\n videoId={this.props.embed}\n opts={opts}\n className={this.getVideoClass()}\n loadEnd={this.loadEnd}\n onReady={this._onReady}\n />\n </div>\n );\n }", "function updateSubtitle(title, subtitle, ticketId, ticketInfo) {\n title.textContent = ticketInfo.ticket.raw_subject;\n title.setAttribute('title', ticketInfo.ticket.raw_subject);\n var accountCode = getAccountCode(ticketId, ticketInfo);\n if (!accountCode) {\n return;\n }\n var oldSpan = subtitle.querySelector('.lesa-ui-account-code');\n if (oldSpan && (oldSpan.textContent == accountCode)) {\n return;\n }\n if (!subtitle.classList.contains('lesa-ui-subtitle')) {\n subtitle.classList.add('lesa-ui-subtitle');\n }\n var newSpan = document.createElement('span');\n var emojis = getEmojiText(ticketInfo.ticket.tags || []);\n if (emojis.length > 0) {\n newSpan.appendChild(document.createTextNode(emojis + ' '));\n }\n newSpan.classList.add('lesa-ui-account-code');\n newSpan.textContent = accountCode;\n if (oldSpan) {\n oldSpan.replaceWith(newSpan);\n }\n else {\n subtitle.appendChild(newSpan);\n }\n}", "function setupPlayer (musicas) {\n console.log(musicas);\n document.getElementById('txt').innerHTML=\"\";\n\n \t\tfunction onYouTubePlayerAPIReady() {\n \t\tplayer = new YT.Player('ytplayer', {\n \t\theight: '390',\n \t\twidth: '640',\n \t\tvideoId: musicas.join()\n \t});\n\n \t}\n }", "function getPlayerHtml(url, width, height, isVOD)\n{\n\tGM_log(url);\n\tif (!isVOD) {\n\t\treturn \"<a target=\\\"_new\\\" style=\\\"float:right;color:white;background-color:black;text-decoration:none\\\" href=\\\"\" + url + \"\\\">\\u05dc\\u05e6\\u05e4\\u05d9\\u05d4 \\u05d9\\u05e9\\u05d9\\u05e8\\u05d4</a><br>\" +\n\t\t\t\"<EMBED type='application/x-mplayer2' width='\" + width +\"' height='\" + height + \"' \" +\n\t\t\t\"src='\" + url + \"' autostart='1' showcontrols='1' loop='0'></EMBED>\"; // לצפיה ישירה\n\t}\n\telse {\n\t\treturn \"<EMBED type='application/x-mplayer2' width='\" + width +\"' height='\" + height + \"' \" +\n\t\t\t\"src='\" + url + \"' autostart='1' showcontrols='1' loop='0'></EMBED><br>\" +\n\t\t\t\"<a target=\\\"_new\\\" style=\\\"display:block;width:80px;white-space:nowrap;padding:0 4px;margin:0 auto;color:white;background-color:black;text-decoration:none\\\" href=\\\"\" + url + \"\\\">\\u05dc\\u05e6\\u05e4\\u05d9\\u05d4 \\u05d9\\u05e9\\u05d9\\u05e8\\u05d4</a>\"; // לצפיה ישירה\n\t}\n}", "function mainVideo(id) {\n $('#video').html(`\n <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/${id}?rel=0&modestbranding=1&autohide=1&mute=1&showinfo=0&controls=0&autoplay=1\" frameborder=\"0\" allow=\"accelerometer; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n `);\n }", "function onPlayerStateChange(event) { \n\t//Let us accept the player which was massaged\n\t//by the mousey hands of woman or man\n\tvar videoURL = event.target.getVideoUrl();\n\t//We must strip from it, the true identity\n\tvar regex = /v=(.+)$/;\n\tvar matches = videoURL.match(regex);\n\tvideoID = matches[1];\n\t//and prepare for it's true title\n\tthisVideoTitle = \"\";\n\t//we look through all the array\n\t//which at first glance may seem unfocused\n\t//but tis the off kilter response\n\t//from the magical moore json\n\t//which belies this approach\n\t//Tis a hack? A kludge?\n\t//These are fighting words, sir!\n\tfor (j=0; j<videoArray.length; j++) {\n\t\t//tis the video a match?\n\t if (videoArray[j]==videoID) {\n\t\t\t//apply the true title!\n\t thisVideoTitle = videoTitle[j]||\"\";\n\t\t\tconsole.log(thisVideoTitle);\n\t\t\t//should we have a title, alas naught else\n\t\t\tif(thisVideoTitle.length>0){\n\t\t\t\tif(showTitle==3){\n\t\t\t\t\tthisVideoTitle = thisVideoTitle + \" | \" + videoID;\n\t\t\t\t}else if(showTitle==2){\n\t\t\t\t\tthisVideoTitle = videoID;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tthisVideoTitle = videoID;\n\t\t\t}\n\t\t\t//Should the video rear it's head\n if (event.data == YT.PlayerState.PLAYING) {\n\t\t\t\t_gaq.push(['_trackEvent', 'Videos', 'Play', thisVideoTitle]); \n \t //ga('send', 'event', 'Videos', 'Play', thisVideoTitle);\n\t\t\t\t//thy video plays\n\t\t\t\t//reaffirm the pausal beast is not with us\n \t\tpauseFlagArray[j] = false;\n \t} \n\t\t\t//should the video tire out and cease\n \tif (event.data == YT.PlayerState.ENDED){\n\t\t\t\t_gaq.push(['_trackEvent', 'Videos', 'Watch to End', thisVideoTitle]); \n \t\t//ga('send', 'event', 'Videos', 'Watch to End', thisVideoTitle);\n \t} \n\t\t\t//and should we tell it to halt, cease, heal.\n\t\t\t//confirm the pause has but one head and it flies not its flag\n\t\t\t//lo the pause event will spawn a many headed monster\n\t\t\t//with events overflowing\n \tif (event.data == YT.PlayerState.PAUSED && pauseFlagArray[j] != true){\n\t\t\t\t_gaq.push(['_trackEvent', 'Videos', 'Pause', thisVideoTitle]); \n \t\t//ga('send', 'event', 'Videos', 'Pause', thisVideoTitle);\n\t\t\t\t//tell the monster it may have\n\t\t\t\t//but one head\n \t\tpauseFlagArray[j] = true;\n \t}\n\t\t\t//and should the monster think, before it doth play\n\t\t\t//after we command it to move\n \tif (event.data == YT.PlayerState.BUFFERING){\n\t\t\t\t_gaq.push(['_trackEvent', 'Videos', 'Buffering', thisVideoTitle]); \n \t\t//ga('send', 'event', 'Videos', 'Buffering', thisVideoTitle);\n \t}\n\t\t\t//and should it cue\n\t\t\t//for why not track this as well.\n \tif (event.data == YT.PlayerState.CUED){\n\t\t\t\t_gaq.push(['_trackEvent', 'Videos', 'Cueing', thisVideoTitle]); \n \t\t//ga('send', 'event', 'Videos', 'Cueing', thisVideoTitle);\n \t}\n\n\t }\n\t}\n}", "function IEplayit(video)\n{\n\n var has_play_url = 'yes';\n var use_dimensions = 'yes';\n var video_url = 'http://www.youtube.com/v/' + video + '.swf';\n\n\t// Later on we should check to see if a SWF id available\n if(has_play_url && use_dimensions) { \nalert(\"length=\" + parent.frames[\"postwrap-content\"].window);\n// parent.frames[\"postwrap-content\"].window.open(video_url);\t// works - full sz window\n// window.open(video_url, \"Us4Earth Video Player\");\t// BAD: Can't have spaces in the name\n\t\twindow.open (video_url,\"Us4Earth_Video_Player\",\"menubar=1,resizable=1,width=400,height=300\"); \n \treturn false; \n }\n return true;\n}", "function getSubtitles(searchEmission, searchDate, outputType) {\n\n // Reset target elements\n document.getElementById(\"headerEmission\").innerHTML = \"\";\n document.getElementById(\"headerSubtitle\").innerHTML = \"\";\n document.getElementById(\"emissionTitle\").innerHTML = \"\";\n document.getElementById(\"emissionLead\").innerHTML = \"\";\n document.getElementById(\"emissionPicture\").src = \"placeholder.png\";\n document.getElementById(\"headerVis\").innerHTML = \"\";\n document.getElementById(\"endVis\").innerHTML = \"\";\n document.getElementById(\"headerSubtitle\").innerHTML = \"\";\n document.getElementById(\"subtitle\").innerHTML = \"\";\n\n // Delete old wordcloud\n const oldWordcloud = document.getElementById(\"wordcloud\")\n if (oldWordcloud !== null) {\n oldWordcloud.remove();\n }\n document.getElementById(\"displayFactor\").innerHTML = \"\";\n\n // Delete old button\n const oldButton = document.getElementById(\"wordcloudButton\")\n if (oldButton !== null) {\n oldButton.remove();\n }\n\n // Url components for search\n const search1Url1 = \"https://www.srf.ch/play/v3/api/srf/production/search/media?searchTerm=\";\n const search1Url2 = \"&includeAggregations=false&shows=urn%3Asrf%3Ashow%3Atv%3A\";\n const search1Url4 = \"&from=\".concat(searchDate, \"&to=\", searchDate);\n const search1Url5 = \"&mediaType=video\"\n\n // Get showID\n if (searchEmission == \"10vor10\") {\n var search1Url3 = \"c38cc259-b5cd-4ac1-b901-e3fddd901a3d\";\n } else if (searchEmission == \"arena\") {\n var search1Url3 = \"09784065-687b-4b60-bd23-9ed0d2d43cdc\";\n } else if (searchEmission == \"rundschau\") {\n var search1Url3 = \"49863a84-1ab7-4abb-8e69-d8e8bda6c989\";\n } else if (searchEmission == \"schweizaktuell\") {\n var search1Url3 = \"cb28dd84-f0c8-4024-8f20-1a29f5a4ceb7\";\n } else if (searchEmission == \"sportpanorama\") {\n var search1Url3 = \"d57ed483-2724-46b7-b1ac-7a2aa7603f59\";\n } else if (searchEmission == \"puls\") {\n var search1Url3 = \"709898cb-2dba-45da-8e21-b1f416c39dc9\";\n } else if (searchEmission == \"kassensturz\") {\n var search1Url3 = \"78a6014e-8058-4bdd-88aa-824f846ca6f0\";\n } else if (searchEmission == \"club\") {\n var search1Url3 = \"0f532a74-d501-4470-be25-527a4fbb82fa\";\n } else if (searchEmission == \"einstein\") {\n var search1Url3 = \"f005a0da-25ea-43a5-b3f8-4c5c23b190b3\";\n } else {\n // Tagesschau\n var search1Url3 = \"ff969c14-c5a7-44ab-ab72-14d4c9e427a9\";\n }\n\n // Build Url for search request\n let search1Url = search1Url1.concat(search1Url2, search1Url3, search1Url4, search1Url5);\n let searchInit = {\n method: \"GET\",\n mode: \"cors\",\n cache: \"default\"\n };\n let search1Request = new Request(search1Url, searchInit);\n\n // Fetch search request\n fetch(search1Request)\n .then(response => response.json())\n .then(data => {\n\n let search1Response = data[\"data\"];\n\n // Select result with best fit\n // No emission 1 (Non-Tagesschau)\n if (search1Response[\"total\"] == 0) {\n\n alert(\"Für das gewünschte Datum konnte keine Ausstrahlung gefunden werden.\");\n return;\n\n } else if (/^ts-/.test(searchEmission)) {\n\n // Tagesschau\n var tsResults = search1Response[\"results\"];\n\n if (searchEmission == \"ts-main\") {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Haupt|19\\:30/.test(feature.title);\n });\n\n } else if (searchEmission == \"ts-noon\") {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Mittag|12\\:[0-9]{2}|13\\:[0-9]{2}/.test(feature.title);\n });\n\n } else {\n\n var tsResults2 = tsResults.filter(function (feature) {\n return /Spät|22\\:[0-9]{2}|23\\:[0-9]{2}/.test(feature.title);\n });\n\n }\n\n // No emission 2 (Tagesschau)\n if (tsResults2.length == 0) {\n\n alert(\"Für das gewünschte Datum konnte keine Ausstrahlung gefunden werden.\");\n return;\n\n }\n\n [search1Response] = tsResults2;\n\n } else {\n\n // Other emissions\n [search1Response] = search1Response[\"results\"];\n\n }\n\n // Build Search Request 2\n const search2Url1 = \"https://il.srgssr.ch/integrationlayer/2.0/mediaComposition/byUrn/urn:srf:video:\";\n const search2Url3 = \".json?onlyChapters=false&vector=portalplay\";\n let search2Url = search2Url1.concat(search1Response[\"id\"], search2Url3);\n let searchRequest2 = new Request(search2Url, searchInit);\n\n // Fetch Search Request 2\n fetch(searchRequest2)\n .then(response => response.json())\n .then(data => {\n\n // Extract Episode ID from Response 2\n let episodeId = data[\"episode\"][\"id\"];\n\n // Build Search Request 3\n const search3Url1 = \"https://www.srf.ch/subtitles/srf/\";\n const search3Url3 = \"/episode/de/vod/vod.m3u8\";\n let search3Url = search3Url1.concat(episodeId, search3Url3);\n let searchRequest3 = new Request(search3Url, searchInit);\n\n // Fetch Search Request 3\n fetch(searchRequest3)\n .then(response => response.text())\n .then(text => {\n\n // Get Subtitles Files\n const rgPattern = /vtt\\/chunks\\/[0-9]+.vtt/g;\n let subtitleFiles = text.match(rgPattern);\n\n // Alert When No Files Match the Pattern\n if (subtitleFiles == null) {\n\n // Show emission info\n document.getElementById(\"headerEmission\").innerHTML = \"Informationen zur Sendung\";\n document.getElementById(\"emissionTitle\").innerHTML = search1Response[\"title\"];\n document.getElementById(\"emissionLead\").innerHTML = search1Response[\"lead\"];\n document.getElementById(\"emissionPicture\").src = search1Response[\"imageUrl\"];\n alert(\"Die gewünschten Sendung scheint über keinen Untertitel zu verfügen.\");\n return;\n\n }\n\n // Search Url Components\n const search4Url1 = \"https://www.srf.ch/subtitles/srf/\";\n const search4Url3 = \"/episode/de/vod/\";\n const subtitleLinks = [];\n\n // Get Subtitle Files\n for (const subtitleFile of subtitleFiles) {\n subtitleLinks.push(search4Url1.concat(episodeId, search4Url3, subtitleFile));\n }\n\n // Fetch all Files\n let promises = subtitleLinks\n .map(url => fetch(url)\n .then(y => y.text()));\n\n Promise\n .all(promises)\n .then(results => {\n\n // Get results\n const subtitles = results.join();\n\n // Extract text based on style\n // Subtiles = Raw, Subtitles2 = Rowwise splits, Subtitles3 = Itermediate for cleansing, Subtitles4 = Flow style, Subtitles5 = Markup with white to black.\n if (subtitles.match(/\\>(.*?)\\</g) == null) {\n\n // \"Old school\" subtitles without markup\n var subtitles2 = subtitles\n .replace(/[0-9]+\\:[0-9]+\\:[0-9]+\\.[0-9]+/g, \" \")\n .replace(/-->/g, \" \")\n .replace(/\\n[0-9]+\\n/g, \" \")\n .replace(/\\n/g, \" \")\n .split(/\\s\\s+/g);\n\n var subtitles3 = subtitles2\n .join(\" \")\n .replace(/\\s\\s+/g, \" \")\n .replace(/,WEBVTT/g, \"\")\n .replace(/WEBVTT/g, \"\")\n .replace(/^./g, \"\");\n\n } else {\n\n // New subtitles with markup\n var subtitles2 = subtitles\n .match(/\\>(.*?)\\</g)\n .map(b => b.replace(/\\>(.*?)\\</g, \"$1\"));\n\n var subtitles3 = subtitles2.join(\" \");\n\n }\n\n // General replacements\n let subtitles4 = subtitles3\n .replace(/([0-9])- (?!(und|oder|bis))/g, \"$1-\")\n .replace(/([A-Z])- (?!(und|oder|bis))/g, \"$1-\")\n .replace(/([A-z])- (?!(und|oder|bis))/g, \"$1\") // separated words\n // .replace(/ SWISS TXT.*$/, \"\")\n .replace(/SWISS TXT AG \\/ Access Services/g, \"\")\n .replace(/Livepassagen können Fehler enthalten. /g, \"\")\n .replace(/MIT TELETEXT-UNTERTITELUNG /g, \"\")\n .replace(/Mit Live-Untertiteln von SWISS TXT/g, \"\")\n .replace(/Mit Untertiteln von SWISS TXT/g, \"\")\n .replace(/1:1-Untertitelung./g, \"\")\n .replace(/^\\./, \" \")\n .trim();\n\n // Emission hyperlink\n let emissionLink = \"https://www.srf.ch/play/tv/tagesschau/video/\" +\n search1Response[\"title\"]\n .replace(/\\:/g, \"\")\n .replace(/\\./g, \"-\")\n .replace(/\\s+/g, \"-\")\n .toLowerCase() +\n \"?urn=\" +\n search1Response[\"urn\"];\n\n // Define output\n document.getElementById(\"headerEmission\").innerHTML = \"Informationen zur Sendung\";\n document.getElementById(\"emissionTitle\").innerHTML = \"<a href=\" + emissionLink + \" target=_blank>\" + search1Response[\"title\"] + \"</a>\";\n document.getElementById(\"emissionLead\").innerHTML = search1Response[\"lead\"];\n document.getElementById(\"emissionPicture\").src = search1Response[\"imageUrl\"];\n document.getElementById(\"headerSubtitle\").innerHTML = \"Untertitel\";\n\n // Output subtitle (and handle button)\n if (outputType == \"flow\") {\n\n // Subtitle\n document.getElementById(\"subtitle\").innerHTML = subtitles4;\n\n // Create wordcloud button\n const newButton = document.createElement(\"button\");\n newButton.innerHTML = \"Word Cloud\";\n newButton.id = \"wordcloudButton\";\n newButton.className = \"btn btn-primary\";\n newButton.onclick = function () {\n analyzeSubtitles(); return false;\n };\n\n document.getElementById(\"buttons\").appendChild(newButton);\n\n } else if (outputType == \"line\") {\n\n // Subtitle\n document.getElementById(\"subtitle\").innerHTML = subtitles2.join(\"</br>\");\n\n } else {\n\n // Subtitle\n const subtitles5 = subtitles.replace(/\\n/g, \"</br>\").replace(/#ffffff/g, \"#000000\");\n document.getElementById(\"subtitle\").innerHTML = subtitles5;\n\n }\n\n // Delete old wordcloud\n const oldWordcloud = document.getElementById(\"wordcloud\")\n if (oldWordcloud !== null) {\n oldWordcloud.remove();\n }\n\n });\n\n });\n\n\n });\n\n });\n }", "function WR_Shortcode_Video() {\n\t \tif ( typeof $.fn.magnificPopup == 'undefined' ) {\n\t \t\treturn setTimeout( WR_Shortcode_Video, 100 );\n\t \t}\n\n\t \tif ( $( '.sc-video' ).length > 0 ) {\n\t \t\t$( '.sc-video-popup' ).each( function( i, val ) {\n\t \t\t\tvar _option = $( this ).data( 'popup' );\n\n\t \t\t\tif ( _option !== undefined ) {\n\t \t\t\t\tvar _control = ( 'true' == _option.control ) ? 'controls=1' : 'controls=0';\n\n\t \t\t\t\t$( val ).magnificPopup( {\n\t \t\t\t\t\ttype: 'iframe',\n\t \t\t\t\t\tmainClass: 'mfp-fade',\n\t \t\t\t\t\tremovalDelay: 300,\n\t \t\t\t\t\tiframe: {\n\t \t\t\t\t\t\tmarkup: '<div class=\"mfp-iframe-scaler\">' + '<button type=\"button\" class=\"mfp-close\">×</button>' + '<iframe class=\"mfp-iframe\" frameborder=\"0\" allowfullscreen></iframe>' + '</div>',\n\t \t\t\t\t\t\tpatterns: {\n\t \t\t\t\t\t\t\tyoutube: {\n\t \t\t\t\t\t\t\t\tindex: 'youtube.com/',\n\t \t\t\t\t\t\t\t\tid: 'v=',\n\t \t\t\t\t\t\t\t\tsrc: '//www.youtube.com/embed/%id%?autoplay=1&showinfo=0&' + _control\n\t \t\t\t\t\t\t\t},\n\t \t\t\t\t\t\t\tvimeo: {\n\t \t\t\t\t\t\t\t\tindex: 'vimeo.com/',\n\t \t\t\t\t\t\t\t\tid: '/',\n\t \t\t\t\t\t\t\t\tsrc: '//player.vimeo.com/video/%id%?autoplay=1'\n\t \t\t\t\t\t\t\t},\n\t \t\t\t\t\t\t}\n\t \t\t\t\t\t}\n\t \t\t\t\t} );\n\t \t\t\t}\n\t \t\t} );\n\n\t \t\tif ( $( '.sc-yt-trigger' ).length > 0 ) {\n\t \t\t\t$.getScript( 'https://www.youtube.com/iframe_api' );\n\n\t \t\t\t$( '.sc-yt-trigger' ).each( function() {\n\t \t\t\t\tvar _this = $( this ), iframe = _this.next();\n\t \t\t\t\tsetTimeout( function checkYT() {\n\t \t\t\t\t\tif ( typeof YT !== 'object' )\n\t \t\t\t\t\t\treturn setTimeout( checkYT, 1000 );\n\n\t \t\t\t\t\tif ( typeof YT.Player !== 'function' )\n\t \t\t\t\t\t\treturn setTimeout( checkYT, 1000 );\n\n\t \t\t\t\t\tvar player;\n\t \t\t\t\t\tplayer = new YT.Player( iframe.get( 0 ), {\n\t \t\t\t\t\t\tevents: {\n\t \t\t\t\t\t\t\t\"onReady\": function( e ) {\n\t \t\t\t\t\t\t\t\t_this.on( 'click', function( i ) {\n\t \t\t\t\t\t\t\t\t\te.target.playVideo();\n\t \t\t\t\t\t\t\t\t\t_this.css( 'opacity', 0 );\n\t \t\t\t\t\t\t\t\t\tiframe.show();\n\t \t\t\t\t\t\t\t\t\ti.preventDefault();\n\t \t\t\t\t\t\t\t\t} );\n\t \t\t\t\t\t\t\t}\n\t \t\t\t\t\t\t}\n\t \t\t\t\t\t} );\n\t \t\t\t\t}, 1000 );\n\t \t\t\t} );\n\t \t\t}\n\n\t \t\tif ( $( '.sc-vm-trigger' ).length > 0 ) {\n\t \t\t\t$( '.sc-vm-trigger' ).each( function() {\n\t \t\t\t\tvar _this = $( this ), iframe = _this.next(), playerOrigin = '*';\n\n\t\t\t\t\t// Call the API when a button is pressed\n\t\t\t\t\t_this.on( 'click', function( e ) {\n\t\t\t\t\t\tpost( 'play' );\n\t\t\t\t\t\t_this.css( 'opacity', 0 );\n\t\t\t\t\t\tiframe.show();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t} );\n\n\t\t\t\t\t// Helper function for sending a message to the player\n\t\t\t\t\tfunction post( action, value ) {\n\t\t\t\t\t\tvar data = {\n\t\t\t\t\t\t\tmethod: action\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\t\tdata.value = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar message = JSON.stringify( data );\n\t\t\t\t\t\tiframe[ 0 ].contentWindow.postMessage( message, playerOrigin );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t \t\t}\n\t \t}\n\t }", "function launch_main_player(site){ \r\n\tclickmain = window.open( '/narrowband/static/audio_video/avconsole/'+site+'/f_news_console.stm' , \"clickmain\" , \"toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=100,left=100,width=671,height=373\");\r\n}", "videoTitleFix(video) {\n var parser = new DOMParser();\n let finalResult = parser.parseFromString(video.snippet.title, \"text/html\");\n return finalResult.body.innerText;\n }", "function updateTimelinePosition() {\r\n\tupdatePosition('updateTimelinePosition', '#timeline > .video-container');\r\n}", "function mainVid(id) {\n \n $('#video').html(`\n <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/${id}\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen></iframe>\n `);\n \n }", "render() {\n return (\n <div>\n <div className='twitchClip'>\n <iframe\n src={this.state.videoURL}\n height=\"540\"\n width=\"960\"\n title='clip'\n >\n </iframe>\n </div>\n </div>\n );\n }", "function audioVideoVis() {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//unwrap post and protfolio videos\r\n\t\t\t\t\t$('.video-wrap iframe').unwrap();\r\n\t\t\t\t\t$('#sidebar iframe[src]').unwrap();\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('audio')\r\n\t\t\t\t\t\t.attr('width', '100%')\r\n\t\t\t\t\t\t.attr('height', '100%')\r\n\t\t\t\t\t\t.css('visibility', 'visible');\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($body.hasClass('mobile')) {\r\n\t\t\t\t\t\t$('video').css('visibility', 'hidden');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$('video').css('visibility', 'visible');\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.wp-video').each(function () {\r\n\t\t\t\t\t\tvar video = $(this).find('video').get(0);\r\n\t\t\t\t\t\tvideo.addEventListener('loadeddata', function () {\r\n\t\t\t\t\t\t\t$window.trigger('resize');\r\n\t\t\t\t\t\t}, false);\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t//webkit video back button fix \r\n\t\t\t\t\t$('.main-content iframe[src]').each(function () {\r\n\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t'opacity': '1',\r\n\t\t\t\t\t\t\t'visibility': 'visible'\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t}", "function visualize() {\r\n var titles = d.getElementsByTagName('div');\r\n\t\tvar temp = document.createElement(\"div\");\r\n\t\tvar style = \"padding:1px;background:#f00;color:#fff;\";\r\n\t\tvar videolink = s ? 'video-mini-title' : 'video-title';\r\n for ( var i=0, l=titles.length; i<l; i++ ) {\r\n\t\t\t(function(){\r\n\t\t\t\tvar t = titles[i];\r\n\t\t\t\tif( !t.getAttribute(\"raw\") && t.className.indexOf(videolink) != -1 ) {\r\n\t\t\t\t\ttry{\r\n\t\t\t\t\t\tvar match = t.getElementsByTagName(\"a\")[0].href.match(/watch\\?v=([a-zA-Z0-9_-]*)/)[1];\r\n\t\t\t\t\t\ttemp.innerHTML = '<strong><a style=\"' + style + '\" href=\"javascript://\">RAW</a></strong>';\r\n\t\t\t\t\t\tvar strong = temp.firstChild;\r\n\t\t\t\t\t\tt.appendChild(strong);\r\n\t\t\t\t\t\tt.setAttribute(\"raw\", \"1\")\r\n\t\t\t\t\t\tstrong.getElementsByTagName(\"a\")[0].addEventListener(\"mouseover\", function(){\r\n\t\t\t\t\t\t\tvar me = this.parentNode;\r\n\t\t\t\t\t\t\tme.innerHTML = '<a href=\"javascript://\" style=\"' + style + 'background:#ff0;color:#000;\">loading...</a>'\r\n\t\t\t\t\t\t\tcheckURL(match, function(link){\r\n\t\t\t\t\t\t\t\tme.innerHTML = link;\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}, true);\r\n\t\t\t\t\t}catch(e){}\r\n\t\t\t\t}\r\n\t\t\t})();\r\n\t\t\t\r\n }\r\n }", "function onYouTubePlayerReady(playerId) {\n\n //gets the videoID... It substracts videoPlayerID length, which is the global_id_length\n var video_id = playerId.substring(0, playerId.length-global_id_length);\n var video_Player_id = playerId.replace(video_id, \"\");\n\n var pre_corrected_Id = playerId;\n for (var i; i<playerId.length; i++) {\n if (playerId[i]=='_') pre_corrected_Id += '1'+i;\n else if (playerId[i]=='-') pre_corrected_Id += '2'+i;\n }\n var corrected_Id = pre_corrected_Id.replace(/\\W/g, '');\n\n try {\n vData.instances[video_Player_id].player.addEventListener(\"onError\", \"onPlayerError\"+corrected_Id);\n vData.instances[video_Player_id].player.addEventListener(\"onStateChange\", \"onStateChange\"+corrected_Id);\n } catch (e) {\n console.error(e.stack)\n }\n\n window[\"onPlayerError\" + corrected_Id] = function(state) {\n vData.instances[video_Player_id].on_player_Error(state);\n };\n\n window[\"onStateChange\" + corrected_Id] = function(state) {\n vData.instances[video_Player_id].on_player_State_Change(state);\n };\n\n vData.instances[video_Player_id].player.loadVideoById(video_id, vData.instances[video_Player_id].data.begin);\n vData.instances[video_Player_id].player.setPlaybackQuality(\"default\");\n vData.instances[video_Player_id].seekstart();\n\n}", "function getVideoSecs () {\r\n\tif (document.getElementById('movie_player-html5')) {\r\n\t\tvar durationTime = document.getElementById('movie_player-html5').getElementsByClassName('duration-time html5-duration-time')[0].innerHTML;\r\n\t\tvar dTSplit = durationTime.split(\":\"); \r\n\t\tvar sec = parseInt(dTSplit[dTSplit.length-1]);\r\n\t\tvar min = parseInt(dTSplit[dTSplit.length-2]);\r\n\t\tvar hour = 0;\r\n\t\tif(dTSplit.length==3){hour = parseInt(dTSplit[dTSplit.length-3]);};\r\n\t\tsecs = (sec + (min * 60) + (hour*3600)); \t\t\r\n\t} else if (document.getElementsByTagName('embed')[0]) {\r\n\t\tvar Ausdruck = /\\&length_seconds=(.+?)\\&/g;//postxanadus\r\n\t\tvar scriptsCopy = document.getElementsByTagName('embed');\r\n\t\t\t\r\n\t\tfor (var i = 0; i < scriptsCopy.length; i++) {\r\n\t\t\r\n\t\t\tvar x = scriptsCopy[i].attributes[getAttributeLocation('flashvars',scriptsCopy[i])].value;//prexanadus WORKING\r\n\t\t\r\n\t\t\tif (Ausdruck.exec(x)) {\r\n\t\t\t\tsecs = RegExp.$1;//prexanadus\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//reset display of player NOW! (before video plays..)\r\n\t\tvar bla = document.getElementById('movie_player');\r\n\t\t\r\n\t\tif(bla!==undefined){ //postxanadus\r\n\t\t\tbla.setAttribute('wmode', 'transparent');\r\n\t\t\tbla.style.display = 'inline';\r\n\t\t}\r\n\t\t\r\n\t}\r\n\tus_saveTempData(\"us_secs\", secs);\r\n\tif (secs==0) {\r\n\t\tvar vidId = getYouTubeVideoId();\r\n\t\tGM_xmlhttpRequest({\r\n\t\t\tmethod: \"GET\",\r\n\t\t\turl: youtubeApiUrl + vidId + \"?v=2&alt=jsonc\",\r\n\t\t\theaders: {\r\n\t\t\t\t\"Accept\": \"application/json\"\r\n\t\t\t},\r\n\t\t\tonload: function(response) {\r\n\t\t\t\tvar jsonObject = eval(\"(\" + response.responseText + \")\");\r\n\t\t\t\tsecs = Math.round(jsonObject.data.duration);\r\n\t\t\t\tus_saveTempData(\"us_secs\", secs);\r\n\t\t\t\tif (secs > 30) {\r\n\t\t\t\t\tus_changeOpac(100,\"us_scrobblebutton\");\r\n\t\t\t\t\tdocument.getElementById('us_scrobblebutton').addEventListener('click', us_showBox, false);\r\n\t\t\t\t\tdocument.getElementById('us_scrobblebutton').title = \"\";\r\n\t\t\t\t\ttryAutoScrobble();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tonerror: function() {\r\n\t\t\t\tconsole.log(\"Could not connect to YouTube-API\");\r\n\t\t\t}\r\n\t\t});\r\n\t} \r\n}", "function resizeVideoJS(){\n // Get the parent element's actual width\n var width = document.getElementById(myPlayer.id).parentElement.offsetWidth;\n // Set width to fill parent element, Set height\n\tif($(document).width() < 780)\n\t\tmyPlayer.width(width).height( width * aspectRatio );\n\telse\n myPlayer.width(width).height( $(window).height() );\n }", "function onYouTubePlayerReady(playerId) {\n\n //gets the videoID... It substracts videoPlayerID length, which is the global_id_length\n var video_id = playerId.split(\"%3A\")[0];\n //console.log(video_id)\n //playerId.substring(0, playerId.length-global_id_length);\n var video_Player_id = playerId.split(\"%3A\")[1]\n //console.log(video_Player_id)\n var pre_corrected_Id = playerId;\n for (var i; i<playerId.length; i++) {\n if (playerId[i]=='_') pre_corrected_Id += '1'+i;\n else if (playerId[i]=='-') pre_corrected_Id += '2'+i;\n }\n var corrected_Id = pre_corrected_Id.replace(/\\W/g, '');\n //console.log(corrected_Id)\n //console.log(vD.i(video_Player_id))\n vD.i(video_Player_id).player.addEventListener(\"onError\", \"onPlayerError\"+corrected_Id);\n vD.i(video_Player_id).player.addEventListener(\"onStateChange\", \"onStateChange\"+corrected_Id);\n\n\n window[\"onPlayerError\" + corrected_Id] = function(state) {\n vD.i(video_Player_id).on_player_Error(state);\n };\n\n window[\"onStateChange\" + corrected_Id] = function(state) {\n vD.i(video_Player_id).on_player_State_Change(state);\n };\n\n vD.i(video_Player_id).player.loadVideoById(video_id, vD.i(video_Player_id).data.begin);\n vD.i(video_Player_id).player.setPlaybackQuality(\"default\");\n vD.i(video_Player_id).seekBegin(true);\n\n}", "function resizeVideoJS() {\n var width = document.getElementById(myPlayer.id()).parentElement.offsetWidth;\n myPlayer.width(width).height(width * aspectRatio);\n }", "function hideSubtitle(elem) {\n elem.html('');\n }", "function showNavOverVideo() {\n state.change(\"browse\");\n overlay.show();\n main.show();\n controls.main.addClass(\"mini\");\n controls.main.show();\n controls.background.hide();\n controls.back.hide();\n updateVideoControls();\n displayControls(false);\n focusActiveSlide();\n }", "function onPlayerReadyOTOSR(event) { \n onTheOtherSideReaction.setPlaybackQuality('hd720'); \n}", "function getYtPlayer(id) {\n var ifrm = document.createElement(\"IFRAME\");\n ifrm.setAttribute(\"src\", \"https://www.youtube.com/embed/\" + id + \"?rel=0&fs=1&theme=light&loop=1&showinfo=0&disablekb=1&controls=1&autohide=1\");\n ifrm.setAttribute(\"webkitallowfullscreen\", \"\");\n ifrm.setAttribute(\"mozallowfullscreen\",\"\");\n ifrm.setAttribute(\"allowfullscreen\",\"\");\n ifrm.setAttribute(\"frameborder\", \"0\");\n ifrm.setAttribute(\"id\", \"video\");\n ifrm.style.width = 1200;\n ifrm.style.height = 675;\n return ifrm.outerHTML;\n }", "function setupVideoPlayer2(){\n\tnew FWDEVPlayer({\t\t\n\t\t//main settings\n\t\tuseYoutube:\"yes\",\n\t\tuseVimeo:\"no\",\n\t\tinstanceName:\"player2\",\n\t\tparentId:\"myDiv2\",\n\t\tmainFolderPath:\"content\",\n\t\tskinPath:\"hex_white\",\n\t\tdisplayType:\"responsive\",\n\t\tautoScale:\"yes\",\n\t\tuseHEXColorsForSkin:\"yes\",\n\t\tnormalHEXButtonsColor:\"#FF0000\",\n\t\tselectedHEXButtonsColor:\"#000000\",\n\t\tstartAtVideoSource:2,\n\t\tvideoSource:[\n\t\t\t{source:\"content/videos/fwd-480p.mp4\", label:\"small version\"},\n\t\t\t{source:\"content/videos/fwd-720p.mp4\", label:\"hd720\"},\n\t\t\t{source:\"content/videos/fwd-1080p.mp4\", label:\"hd1080\"}\n\t\t],\n\t\tposterPath:\"content/posters/mp4-poster.jpg, content/posters/mp4-poster-mobile.jpg\",\n\t\trightClickContextMenu:\"default\",\n\t\tuseChromeless:\"no\",\n\t\taddKeyboardSupport:\"yes\",\n\t\tautoPlay:\"no\",\n\t\tloop:\"no\",\n\t\tmaxWidth:800,\n\t\tmaxHeight:500,\n\t\tvolume:.8,\n\t\tbackgroundColor:\"#000000\",\n\t\tposterBackgroundColor:\"#0099FF\",\n\t\t//logo settings\n\t\tshowLogo:\"yes\",\n\t\thideLogoWithController:\"yes\",\n\t\tlogoPosition:\"topRight\",\n\t\tlogoLink:\"http://www.webdesign-flash.ro\",\n\t\tlogoMargins:5,\n\t\t//controller settings\n\t\tshowController:\"yes\",\n\t\tshowControllerWhenVideoIsStopped:\"yes\",\n\t\tshowVolumeScrubber:\"yes\",\n\t\tshowVolumeButton:\"yes\",\n\t\tshowTime:\"yes\",\n\t\tshowYoutubeQualityButton:\"no\",\n\t\tshowShareButton:\"yes\",\n\t\tshowEmbedButton:\"yes\",\n\t\tshowFullScreenButton:\"yes\",\n\t\trepeatBackground:\"yes\",\n\t\tcontrollerHeight:41,\n\t\tcontrollerHideDelay:2,\n\t\tstartSpaceBetweenButtons:7,\n\t\tspaceBetweenButtons:9,\n\t\tmainScrubberOffestTop:14,\n\t\tscrubbersOffsetWidth:4,\n\t\ttimeOffsetLeftWidth:5,\n\t\ttimeOffsetRightWidth:3,\n\t\tvolumeScrubberWidth:80,\n\t\tvolumeScrubberOffsetRightWidth:0,\n\t\ttimeColor:\"#FF0000\",\n\t\tyoutubeQualityButtonNormalColor:\"#FF0000\",\n\t\tyoutubeQualityButtonSelectedColor:\"#000000\",\n\t\t//embed window\n\t\tembedWindowCloseButtonMargins:0,\n\t\tborderColor:\"#CDCDCD\",\n\t\tmainLabelsColor:\"#000000\",\n\t\tsecondaryLabelsColor:\"#444444\",\n\t\tshareAndEmbedTextColor:\"#777777\",\n\t\tinputBackgroundColor:\"#b2b2b2\",\n\t\tinputColor:\"#333333\",\n\t\t//subtitle\n\t\tsubtitlePath:\"\",\n\t\tshowSubtitleByDefault:\"yes\",\n\t\t//ads\n\t\topenNewPageAtTheEndOfTheAds:\"no\",\n\t\tadsVideoSourcePath:\"\",\n\t\tadsButtonsPosition:\"right\",\n\t\tadsPageToOpenURL:\"http://www.webdesign-flash.ro\",\n\t\tadsPageToOpenTarget:\"_blank\",\n\t\tadsThumbnailPath:\"content/posters/thumbnail.jpg\",\n\t\tskipToVideoText:\"You can skip to video in: \",\n\t\tskipToVideoButtonText:\"Skip Ad\",\n\t\ttimeToHoldAds:4,\n\t\tadsTextNormalColor:\"#888888\",\n\t\tadsTextSelectedColor:\"#000000\",\n\t\tadsBorderNormalColor:\"#AAAAAA\",\n\t\tadsBorderSelectedColor:\"#000000\",\n\t\t// context menu\n\t\tshowContextmenu:'no',\n\t\tshowScriptDeveloper:\"yes\",\n\t\tcontextMenuBackgroundColor:\"#1f1f1f\",\n\t\tcontextMenuBorderColor:\"#1f1f1f\",\n\t\tcontextMenuSpacerColor:\"#333\",\n\t\tcontextMenuItemNormalColor:\"#888888\",\n\t\tcontextMenuItemSelectedColor:\"#FFFFFF\",\n\t\tcontextMenuItemDisabledColor:\"#444\"\n\t});\n}", "function checkForSubtitles() {\n var tabs = Array.from(document.querySelectorAll('div[data-test-id=\"header-tab\"]'));\n var subtitles = Array.from(document.querySelectorAll('div[data-test-id=\"header-tab-subtitle\"]'));\n for (var i = 0; i < tabs.length; i++) {\n var tab = tabs[i];\n var subtitle = tab.querySelector('div[data-test-id=\"header-tab-subtitle\"]');\n var textContent = ((subtitle.children.length > 0 && subtitle.children[0].textContent) || '').trim();\n if (textContent[0] != '#') {\n continue;\n }\n var title = tab.querySelector('div[data-test-id=\"header-tab-title\"]');\n var ticketId = textContent.substring(1);\n checkTicket(ticketId, updateSubtitle.bind(null, title, subtitle));\n }\n}", "function trackYouTube()\n{\n\t//What am i, but nothing?\n\tvar i = 0;\n\t//Harken to the iframes of the page\n\t//thy loathesome demon gallavanting upon\n\t//our innocent sweet html\n\tjQuery('iframe').each(function() {\n\t\t//but what is this?\n\t\t//an iframe! Avast!\n\t\tif($(this).attr('src')){\n\t\t\t//it has a source!\n\t\t\t//Lo we can see it's innards\n\t\t\t//as Han was wont to slice the tauntaun\n\t\t\tvar video = $(this);\n\t\t\tvar vidSrc = video.attr('src');\n\t\t\t//by default we shant do the following\n\t\t\t//but if your tracking seems to suffer\n\t\t\t//adjust they variable above\n\t\t\t//and refresh the frames upon loading\n\t\t\tif(reloadFrames){\n\t\t\t\t//next some trickery\n\t\t\t\t//has it the foul stench of the demon parameter\n\t\t\t\tvar regex1 = /(?:https?:)?\\/\\/www\\.youtube\\.com\\/embed\\/([\\w-]{11})(\\?)?/;\n\t\t\t\tvar SourceCheckA = vidSrc.match(regex1);\n\t\t\t\tif(SourceCheckA[2]==\"?\"){\n\t\t\t\t\t//it has the beast\n\t\t\t\t\t//we must be cautious\n\t\t\t\t\t//has it been thus gifted for jsapi magic?\n\t\t\t\t\tvar regex2 = /enablejsapi=1/;\n\t\t\t\t\tvar SourceCheckB = vidSrc.match(regex2);\n\t\t\t\t\tif(SourceCheckB){\n\t\t\t\t\t\t//it has the gift\n\t\t\t\t\t\t//accept it and move on\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//we shall embrace our foe \n\t\t\t\t\t\t//and provide it with stardust\n\t\t\t\t\t\tvidSrc = vidSrc + \"&enablejsapi=1\";\n\t\t\t\t\t}\n\t\t\t\t\t//but has the beast an origin\n\t\t\t\t\t//where it pulled itself from its dank pit\n\t\t\t\t\tvar regex2 = /origin=.*/;\n\t\t\t\t\tvar SourceCheckC = vidSrc.match(regex2);\n\t\t\t\t\tif(SourceCheckC){\n\t\t\t\t\t\tfor (j=0; j<SourceCheckC.length; j++) {\n\t\t\t\t\t\t\t//Ah but it has an origin and we shall change it\n\t\t\t\t\t\t\t//waving our hands we create a new origin\n\t\t\t\t\t\t\t//as there is no place like window.location.hostname\n\t\t\t\t\t\t\tnewOrigin = \"origin=\" + window.location.hostname;\n\t\t\t\t\t\t\tvar vidSrc = vidSrc.replace(regex2,newOrigin);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//but nay it was homeless\n\t\t\t\t\t\t//sad and alone\n\t\t\t\t\t\t//we shall embrace it and drape it \n\t\t\t\t\t\t//in our warm cloth\n\t\t\t\t\t\tvidSrc = vidSrc + \"&origin=\" + window.location.hostname;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t//It is missing the mark of the parameter entirely\n\t\t\t\t\t//this is not unexpected\n\t\t\t\t\t//we shall garb it in the clothing of our homeland\n\t\t\t\t\t//and provide it with it's magic for battle\n\t\t\t\t\tvidSrc = vidSrc + \"?enablejsapi=1&origin=\" + window.location.hostname;\n\t\t\t\t}\n\t\t\t\t//We reaffirm the source unto itself\n\t\t\t\t//tho it may cause a stutter\n\t\t\t\t//silence the next line should you incorporate \n\t\t\t\t//no magic or origins\n\t\t\t\tvideo.attr('src', vidSrc);\n\t\t\t}\n\t\t\t//We shall check the source\n\t\t\t//lo ere the response incorrect\n\t\t\t//we shall ignore it.\n\t\t\t//Once we did this brutally\n\t\t\t//with the ham fist of strange logic\n\t\t\t//until Nicole did deliver this\n\t\t\t//upon the blog comments\n\t\t\t//http://www.lunametrics.com/blog/2012/10/22/automatically-track-youtube-videos-events-google-analytics/\n\t\t\t//the wonders of Reg Ex\n\t\t\tvar regex = /(?:https?:)?\\/\\/www\\.youtube\\.com\\/embed\\/([\\w-]{11})(?:\\?.*)?/;\n\t\t\tvar matches = vidSrc.match(regex);\n\t\t\t//Should the former reg provide a match\n\t\t\t//it shall appear in an array of matches\n\t\t\tif(matches && matches.length > 1){\n\t\t\t\t//we now place the beating heart of the youtube id\n\t\t\t\t//in our first heavenly array\n\t\t\t\tvideoArray[i] = matches[1];\n\t\t\t\t//and then mark the vile iframe beast\n\t\t\t\t//with the id of this video so that all\n\t\t\t\t//may know it, and reference it\n\t\t\t\tvideo.attr('id', matches[1]);\t\n\t\t\t\t//And Then Alex Moore came forth\n\t\t\t\t//and said 'lo this ID is a jumble\n\t\t\t\t//we should provide a more meaningful title\n\t\t\t\t//soas to tell the nobles from the brigands\n\t\t\t\t//as we now can through my faithful \n\t\t\t\t//json. Attend and be amazed!\t\t\t\t\n\t\t\t\tgetRealTitles(i);\n\t\t\t\t//And for this, I am no longer nothing, I am more\n\t\t\t\ti++;\t\t\t\n\t\t\t}\n\t\t}\n\t});\t\n}", "function loadFirstVid(){\n\t\t\t\t \tplayer = new YT.Player('vframe', {\n\t\t\t\t\t\t\t videoId: videos[videoCounter].url, //'47dtFZ8CFo8',\n\t\t\t\t\t\t\t playerVars: { 'autoplay': 1, 'controls': 0 , 'autohide':1, 'showinfo':0, 'controls':1, 'iv_load_policy':3, 'disablekb':1, 'modestbranding':1, 'rel':0, 'theme':'light', 'color':'white'},\n\t\t\t\t\t\t\t events: {\n\t\t\t\t\t\t\t 'onReady': onPlayerReady,\n\t\t\t\t\t\t\t 'onStateChange': onPlayerStateChange\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t });\n\t\t\t\t }", "function _initialize($parent) {\n\n\tif(typeof($parent) == 'undefined')\n\t\t$parent = $('body');\n\t\n\t$parent.find('.flex-video').each(function() {\n\t\t\tvar $this = $(this);\t\t\t\t\n\t\t\tvar lang = $('html').attr('lang') || 'en';\n\t\t\tvar contentLanguage = document.documentElement.lang;\n\t\t\tvar hl = '&hl=en';\n\t\t\tif(contentLanguage.indexOf('es') > -1){\n\t\t\t\thl = '&hl=es';\n\t\t\t}\n\n\t\t\t// remove old player object for onYouTubeIframeAPIReady events\n\t\t\t$('#flex-video-api').removeAttr(\"id\"); \t\t\t\t\n\n\t\t\tvar videoSrc = '//www.youtube-nocookie.com/embed/',\n\t\t\t\tvideoLinkSrc = 'https://www.youtube.com/',\n\t\t\t\tvideoId = '',\n\t\t\t\tvideoTitle = '',\n\t\t\t\tvideoOptions = '?wmode=opaque&rel=0&enablejsapi=1' + hl,\n\t\t\t\tvideoType = '';\n\n\t\t\tif($this.hasClass('playlist')) {\n\t\t\t\tvideoType = 'playlist';\n\t\t\t\tvideoTitle = $this.attr('data-playlist-title');\n\t\t\t\tvideoId = 'videoseries';\n\t\t\t\tvideoOptions = videoOptions +\n\t\t\t\t\t'&list=' + $this.attr('data-playlist-id');\n\t\t\t\tvideoLinkSrc = videoLinkSrc + 'playlist?list=' + videoId;\n\t\t\t} else {\n\t\t\t\tvideoType = 'video';\n\t\t\t\tvideoTitle = $this.attr('data-video-title');\n\t\t\t\tvideoId = $this.attr('data-video-id');\n\t\t\t\tvideoOptions = videoOptions +\n\t\t\t\t\t'';\n\t\t\t\tvideoLinkSrc = videoLinkSrc + 'watch?v=' + videoId;\n\t\t\t}\n\t\t\tvideoSrc = videoSrc + videoId + videoOptions;\n\t\t\tvar videoText = {\n\t\t\t\tvideo: {\n\t\t\t\t\ten: 'Youtube embedded video: ' + videoLinkSrc,\n\t\t\t\t\tes: 'Video insertado desde YouTube: ' + videoLinkSrc\n\t\t\t\t},\n\t\t\t\tplaylist: {\n\t\t\t\t\ten: 'Youtube embedded video playlist: ' + videoLinkSrc,\n\t\t\t\t\tes: 'Lista de reproducci&oacute;n insertada desde YouTube: ' + videoLinkSrc\n\t\t\t\t}\n\t\t\t};\n\t\t\t$this.append(\n\t\t\t\t$(document.createElement('iframe'))\n\t\t\t\t\t.attr('width', '560')\n\t\t\t\t\t.attr('height', '315')\n\t\t\t\t\t.attr('src', videoSrc)\n\t\t\t\t\t.attr('frameborder', '0')\n\t\t\t\t\t.attr('allowFullScreen', '')\n\t\t\t\t\t.attr('title', videoTitle)\n\t\t\t\t\t.attr('alt', videoTitle)\n\t\t\t\t\t.attr('id', 'flex-video-api')\n\t\t\t\t\t.attr('enablejsapi', '1')\n\t\t\t\t\t.text(videoText[videoType][lang])\n\t\t\t);\n\t\t});\n}", "function embedYoutubeLinks() {\n Thread.firstLevelYoutubeLinks.each(function() {\n var youtubeLink = $(this);\n var youtubeEmbeddedSource = 'https://youtube.com/embed/' + youtubeLink.attr('href').substring(youtubeLink.attr('href').indexOf('watch?v=') + 8); \n var youtubeEmbeddedIFrame = $('<br><iframe width=560 height=360 src=\"' + youtubeEmbeddedSource + '\" frameborder=0 allowfullscreen></iframe><br>');\n youtubeLink.before(youtubeEmbeddedIFrame);\n youtubeLink.remove();\n });\n}", "function resizeVideoJS(){\n var width = document.getElementById(myPlayer.el().id).parentElement.offsetWidth;\n var aspectRatio=8/12;\n myPlayer.width(width).height( width * aspectRatio);\n }", "function initMediaCardTitleHyphens() {\n $('.media-card__title').hyphenate('ru');\n }", "function initPlayer(){\n var params = { allowScriptAccess: \"always\" };\n var atts = {\n id: \"mainplayer\",\n wmode:\"transparent\"\n };\n swfobject.embedSWF(\"http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=mainplayer&version=3\",\n \"ytapiplayer\", \"533\", \"300\", \"8\", null, null, params, atts);\n \n}", "function togglePlayer(event) {\r\n\t\tif (document.getElementById(this.title).style.display == \"none\") {\r\n\t\t\tdocument.getElementById(this.title).style.display = \"inline\";\r\n\t\t\tthis.innerHTML = \" ▾\";\r\n\t\t}\r\n\t\telse {\r\n\t\t\tdocument.getElementById(this.title).style.display = \"none\";\r\n\t\t\tthis.innerHTML = \" ◂\";\t\t\t\r\n\t\t}\r\n\t}", "function ShowYoutubeUrl(url, cache2)\n{\n\tlet id = url.match(/\\/(tt\\d+)\\//)[1];\n\tlet slate = $(\"div.ipc-slate\");\n\n\tif (slate.length !== 0)\n\t\treturn;\n\n\tlet div = $(\"<div id=imdbe_divtrailer ></div>\").html(\"<h1> \\\n<a href='https://www.youtube.com/results?search_query=\" + cache2[id][\"name\"] + \" trailer'>Search trailer on Youtube</a></h1 >\\\n\");\n\t\t$(\"div.plot_summary_wrapper\").prepend(div);\n}", "function fixTitle() {\r\n window.document.title = window.document.title.replace(/[^-]* - [^-]* - /, \"\") + \" - Safari Online\";\r\n}", "function loadVideo() {\n console.log(\"loading \" + flow[currentIndex].link + \" into iframe0\");\n document.getElementById(\"iframe0\").src = \"https://www.youtube.com/embed/\" + flow[currentIndex].link + \"?rel=0\";\n}", "function LoadYoutubeVidOnPreviewClick(id, w, h) {\n var code = '<iframe src=\"https://www.youtube.com/embed/' + id + '/?autoplay=1&autohide=1&border=0&wmode=opaque&enablejsapi=1\" width=\"' + w + '\" height=\"' + h + '\" frameborder=0 allowfullscreen style=\"border:1px solid #ccc;\" ></iframe>';\n var iframe = document.createElement('div');\n iframe.innerHTML = code;\n iframe = iframe.firstChild;\n var div = document.getElementById(\"skipser-youtubevid-\" + id);\n div.parentNode.replaceChild(iframe, div)\n}", "function displaylyrics(index1) {\n $('.current-song-name').hover(function () {\n var song_lyrics_selector = $('.song-lyrics');\n var video = $('.song_video');\n song_lyrics_selector.html(songsinfo[index1].lyricsLink);\n video[0].src = songsinfo[index1].videoLink; // use to give video link to iframe\n //video.attr(songsinfo[index1].videoLink); attr is another option to give link\n song_lyrics_selector.css('display', 'inline-block');\n video.css('display', 'inline-block');\n }, function () {\n $('.song-lyrics').css('display', 'none');\n $('.song_video').css('display', 'none');\n }\n )\n }", "function animateTheCaptions(nextli, opt) {\n\n\n\n\n nextli.find('.caption').each(function(i) {\n\n offsetx = opt.width / 2 - opt.startwidth / 2;\n\n if (opt.bh > 1) {\n opt.bw = 1;\n opt.bh = 1;\n }\n\n if (opt.bw > 1) {\n opt.bw = 1;\n opt.bh = 1;\n }\n\n var xbw = opt.bw;\n\n\n\n\n var nextcaption = nextli.find('.caption:eq(' + i + ')');\n nextcaption.stop(true, true);\n\n\n if (nextcaption.hasClass(\"coloredbg\")) offsetx = 0;\n if (offsetx < 0) offsetx = 0;\n\n clearTimeout(nextcaption.data('timer'));\n\n\n\n // YOUTUBE AND VIMEO LISTENRES INITIALISATION\n\n var frameID = \"iframe\" + Math.round(Math.random() * 1000 + 1);\n\n if (nextcaption.find('iframe').length > 0) {\n var ifr = nextcaption.find('iframe');\n\n if (ifr.attr('src').toLowerCase().indexOf('youtube') >= 0) {\n\n ifr.attr('id', frameID);\n ifr.addClass(\"HasListener\");\n var player;\n player = new YT.Player(frameID, {\n events: {\n \"onStateChange\": onPlayerStateChange\n }\n });\n\n } else {\n if (ifr.attr('src').toLowerCase().indexOf('vimeo') >= 0) {\n\n if (!ifr.hasClass(\"HasListener\")) {\n ifr.addClass(\"HasListener\");\n ifr.attr('id', frameID);\n var isrc = ifr.attr('src');\n var queryParameters = {},\n queryString = isrc,\n re = /([^&=]+)=([^&]*)/g,\n m;\n // Creates a map with the query string parameters\n while (m = re.exec(queryString)) {\n queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);\n }\n\n\n if (queryParameters['player_id'] != undefined) {\n\n isrc = isrc.replace(queryParameters['player_id'], frameID);\n } else {\n isrc = isrc + \"&player_id=\" + frameID;\n }\n\n try {\n isrc = isrc.replace('api=0', 'api=1');\n } catch (e) {}\n\n isrc = isrc + \"&api=1\";\n\n\n\n ifr.attr('src', isrc);\n var player = nextcaption.find('iframe')[0];\n $f(player).addEvent('ready', vimeoready);\n\n }\n\n }\n }\n }\n\n\n\n\n\n\n var imw = 0;\n var imh = 0;\n\n if (nextcaption.find('img').length > 0) {\n var im = nextcaption.find('img');\n if (im.data('ww') == undefined) im.data('ww', im.width());\n if (im.data('hh') == undefined) im.data('hh', im.height());\n\n var ww = im.data('ww');\n var hh = im.data('hh');\n\n\n im.width(ww * opt.bw);\n im.height(hh * opt.bh);\n imw = im.width();\n imh = im.height();\n } else {\n\n if (nextcaption.find('iframe').length > 0) {\n var im = nextcaption.find('iframe');\n if (nextcaption.data('ww') == undefined) {\n nextcaption.data('ww', im.width());\n }\n if (nextcaption.data('hh') == undefined) nextcaption.data('hh', im.height());\n\n var ww = nextcaption.data('ww');\n var hh = nextcaption.data('hh');\n\n var nc = nextcaption;\n if (nc.data('fsize') == undefined) nc.data('fsize', parseInt(nc.css('font-size'), 0) || 0);\n if (nc.data('pt') == undefined) nc.data('pt', parseInt(nc.css('paddingTop'), 0) || 0);\n if (nc.data('pb') == undefined) nc.data('pb', parseInt(nc.css('paddingBottom'), 0) || 0);\n if (nc.data('pl') == undefined) nc.data('pl', parseInt(nc.css('paddingLeft'), 0) || 0);\n if (nc.data('pr') == undefined) nc.data('pr', parseInt(nc.css('paddingRight'), 0) || 0);\n\n if (nc.data('mt') == undefined) nc.data('mt', parseInt(nc.css('marginTop'), 0) || 0);\n if (nc.data('mb') == undefined) nc.data('mb', parseInt(nc.css('marginBottom'), 0) || 0);\n if (nc.data('ml') == undefined) nc.data('ml', parseInt(nc.css('marginLeft'), 0) || 0);\n if (nc.data('mr') == undefined) nc.data('mr', parseInt(nc.css('marginRight'), 0) || 0);\n\n if (nc.data('bt') == undefined) nc.data('bt', parseInt(nc.css('borderTop'), 0) || 0);\n if (nc.data('bb') == undefined) nc.data('bb', parseInt(nc.css('borderBottom'), 0) || 0);\n if (nc.data('bl') == undefined) nc.data('bl', parseInt(nc.css('borderLeft'), 0) || 0);\n if (nc.data('br') == undefined) nc.data('br', parseInt(nc.css('borderRight'), 0) || 0);\n\n if (nc.data('lh') == undefined) nc.data('lh', parseInt(nc.css('lineHeight'), 0) || 0);\n\n\n nextcaption.css({\n 'font-size': (nc.data('fsize') * opt.bw) + \"px\",\n\n 'padding-top': (nc.data('pt') * opt.bh) + \"px\",\n 'padding-bottom': (nc.data('pb') * opt.bh) + \"px\",\n 'padding-left': (nc.data('pl') * opt.bw) + \"px\",\n 'padding-right': (nc.data('pr') * opt.bw) + \"px\",\n\n 'margin-top': (nc.data('mt') * opt.bh) + \"px\",\n 'margin-bottom': (nc.data('mb') * opt.bh) + \"px\",\n 'margin-left': (nc.data('ml') * opt.bw) + \"px\",\n 'margin-right': (nc.data('mr') * opt.bw) + \"px\",\n\n 'border-top': (nc.data('bt') * opt.bh) + \"px\",\n 'border-bottom': (nc.data('bb') * opt.bh) + \"px\",\n 'border-left': (nc.data('bl') * opt.bw) + \"px\",\n 'border-right': (nc.data('br') * opt.bw) + \"px\",\n\n 'line-height': (nc.data('lh') * opt.bh) + \"px\",\n 'height': (hh * opt.bh) + 'px',\n 'white-space': \"nowrap\"\n\n\n });\n\n im.width(ww * opt.bw);\n im.height(hh * opt.bh);\n imw = im.width();\n imh = im.height();\n } else {\n\n var nc = nextcaption;\n if (nc.data('fsize') == undefined) nc.data('fsize', parseInt(nc.css('font-size'), 0) || 0);\n if (nc.data('pt') == undefined) nc.data('pt', parseInt(nc.css('paddingTop'), 0) || 0);\n if (nc.data('pb') == undefined) nc.data('pb', parseInt(nc.css('paddingBottom'), 0) || 0);\n if (nc.data('pl') == undefined) nc.data('pl', parseInt(nc.css('paddingLeft'), 0) || 0);\n if (nc.data('pr') == undefined) nc.data('pr', parseInt(nc.css('paddingRight'), 0) || 0);\n\n if (nc.data('mt') == undefined) nc.data('mt', parseInt(nc.css('marginTop'), 0) || 0);\n if (nc.data('mb') == undefined) nc.data('mb', parseInt(nc.css('marginBottom'), 0) || 0);\n if (nc.data('ml') == undefined) nc.data('ml', parseInt(nc.css('marginLeft'), 0) || 0);\n if (nc.data('mr') == undefined) nc.data('mr', parseInt(nc.css('marginRight'), 0) || 0);\n\n if (nc.data('bt') == undefined) nc.data('bt', parseInt(nc.css('borderTop'), 0) || 0);\n if (nc.data('bb') == undefined) nc.data('bb', parseInt(nc.css('borderBottom'), 0) || 0);\n if (nc.data('bl') == undefined) nc.data('bl', parseInt(nc.css('borderLeft'), 0) || 0);\n if (nc.data('br') == undefined) nc.data('br', parseInt(nc.css('borderRight'), 0) || 0);\n\n if (nc.data('lh') == undefined) nc.data('lh', parseInt(nc.css('lineHeight'), 0) || 0);\n\n\n nextcaption.css({\n 'font-size': (nc.data('fsize') * opt.bw) + \"px\",\n\n 'padding-top': (nc.data('pt') * opt.bh) + \"px\",\n 'padding-bottom': (nc.data('pb') * opt.bh) + \"px\",\n 'padding-left': (nc.data('pl') * opt.bw) + \"px\",\n 'padding-right': (nc.data('pr') * opt.bw) + \"px\",\n\n 'margin-top': (nc.data('mt') * opt.bh) + \"px\",\n 'margin-bottom': (nc.data('mb') * opt.bh) + \"px\",\n 'margin-left': (nc.data('ml') * opt.bw) + \"px\",\n 'margin-right': (nc.data('mr') * opt.bw) + \"px\",\n\n 'border-top': (nc.data('bt') * opt.bh) + \"px\",\n 'border-bottom': (nc.data('bb') * opt.bh) + \"px\",\n 'border-left': (nc.data('bl') * opt.bw) + \"px\",\n 'border-right': (nc.data('br') * opt.bw) + \"px\",\n\n 'line-height': (nc.data('lh') * opt.bh) + \"px\",\n 'white-space': \"nowrap\"\n\n\n });\n imh = nextcaption.outerHeight(true);\n imw = nextcaption.outerWidth(true);\n }\n }\n\n\n\n if (nextcaption.hasClass('fade')) {\n\n nextcaption.css({ 'opacity': 0, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': (opt.bh * nextcaption.data('y')) + \"px\" });\n }\n\n\n\n if (nextcaption.hasClass('lfr')) {\n\n nextcaption.css({ 'opacity': 1, 'left': (5 + opt.width) + 'px', 'top': (opt.bh * nextcaption.data('y')) + \"px\" });\n\n }\n\n if (nextcaption.hasClass('lfl')) {\n\n nextcaption.css({ 'opacity': 1, 'left': (-5 - imw) + 'px', 'top': (opt.bh * nextcaption.data('y')) + \"px\" });\n\n }\n\n if (nextcaption.hasClass('sfl')) {\n\n nextcaption.css({ 'opacity': 0, 'left': ((xbw * nextcaption.data('x')) - 50 + offsetx) + 'px', 'top': (opt.bh * nextcaption.data('y')) + \"px\" });\n }\n\n if (nextcaption.hasClass('sfr')) {\n nextcaption.css({ 'opacity': 0, 'left': ((xbw * nextcaption.data('x')) + 50 + offsetx) + 'px', 'top': (opt.bh * nextcaption.data('y')) + \"px\" });\n }\n\n\n\n\n if (nextcaption.hasClass('lft')) {\n\n nextcaption.css({ 'opacity': 1, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': (-5 - imh) + \"px\" });\n\n }\n\n if (nextcaption.hasClass('lfb')) {\n nextcaption.css({ 'opacity': 1, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': (5 + opt.height) + \"px\" });\n\n }\n\n if (nextcaption.hasClass('sft')) {\n nextcaption.css({ 'opacity': 0, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': ((opt.bh * nextcaption.data('y')) - 50) + \"px\" });\n }\n\n if (nextcaption.hasClass('sfb')) {\n nextcaption.css({ 'opacity': 0, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': ((opt.bh * nextcaption.data('y')) + 50) + \"px\" });\n }\n\n\n\n\n nextcaption.data('timer', setTimeout(function() {\n if (nextcaption.hasClass('fade')) {\n nextcaption.data('repo', nextcaption.css('opacity'));\n nextcaption.animate({ 'opacity': 1 });\n }\n if (nextcaption.hasClass('lfr') ||\n nextcaption.hasClass('lfl') ||\n nextcaption.hasClass('sfr') ||\n nextcaption.hasClass('sfl') ||\n nextcaption.hasClass('lft') ||\n nextcaption.hasClass('lfb') ||\n nextcaption.hasClass('sft') ||\n nextcaption.hasClass('sfb')\n ) {\n var easetype = nextcaption.data('easing');\n if (easetype == undefined) easetype = \"linear\";\n nextcaption.data('repx', nextcaption.position().left);\n nextcaption.data('repy', nextcaption.position().top);\n\n nextcaption.data('repo', nextcaption.css('opacity'));\n nextcaption.animate({ 'opacity': 1, 'left': (xbw * nextcaption.data('x') + offsetx) + 'px', 'top': opt.bh * (nextcaption.data('y')) + \"px\" }, { duration: nextcaption.data('speed'), easing: easetype });\n }\n }, nextcaption.data('start')));\n\n })\n }", "function updateTitle(source){\nvar ret = source.replace(/crucy.v3.23.1901.2014./g,'');\nvar ret2 = ret.replace(/.tmp.tsv/g,'');\nvar ret3 = ret2.replace(/_/g,'');\nvar ret4 = ret3.replace(/data/g,' ');\nvar ret5 = ret4.replace(/\\//g,' ');\ntitle2.text(ret5)\n}", "function loadPlayer() {\n currentVideoId = \"OYws8biwOYc\";\n var params = {\n allowScriptAccess: \"always\"\n };\n var atts = {\n id: \"ytPlayer\",\n allowFullScreen: \"true\"\n };\n swfobject.embedSWF(\"http://www.youtube.com/v/\" + currentVideoId + \"&enablejsapi=1&playerapiid=ytplayer\" + \"&rel=0&autoplay=0&egm=0&loop=0&fs=1&hd=0&showsearch=0&showinfo=0&iv_load_policy=3&cc_load_policy=1\", \"innerVideoDiv\", \"720\", \"405\", \"8\", null, null, params, atts);\n}", "function openSesame(){\n $('.title').css(\"opacity\",\"0\");\n document.body.querySelector('.curtainR').style.transform = \"translate(100%, 0px)\";\n document.body.querySelector('.curtainL').style.transform = \"translate(-100%, 0px)\";\n setTimeout(function(){\n $('.curtainR').remove();\n $('.curtainL').remove();\n $('.title').remove();\n $('.wholeBody').remove();\n $('body').css(\"overflow\", \"visible\"); \n $('.tweetDiv').css(\"transform\",\"scale(1,1)\");\n $('.container0').css(\"transform\",\"scale(1,1)\");\n }, 2800);\n\n }", "async function secondyoutubePlayer(msg) {\n if (msg.author.bot) {\n return;\n }\n if (searching == false) {\n return;\n }\n\n if (msg.content == \"/p\") {\n return;\n }\n\n if (msg.channel.id == \"717931793222729740\") {\n const yts = require(\"yt-search\");\n const r = await yts(msg.content);\n const videos = r.videos.slice(0, 3);\n videos.forEach((v) => {\n console.log(v);\n collection.push(v.url);\n titles.push(v.title);\n const views = String(v.views).padStart(10, \" \");\n console.log(\n `${views} // ${v.title} (${v.timestamp}) // ${v.author.name}`\n );\n msg.channel.send(\n `${views} // ${v.title} (${v.timestamp}) // ${v.author.name}`\n );\n });\n searching = false;\n selecting = true;\n }\n}", "function onYouTubeIframeAPIReady() {\r\n var numPl = Math.floor((Math.random() * 38) + 1);\r\n var player = new YT.Player(\"player\", {\r\n height: '390',\r\n width: '640',\r\n playerVars: {\r\n listType:'playlist',\r\n list:'PLtGGAyMRLY7_ItP_oOEwWEt_h5CEsu2md',\r\n index: numPl,\r\n autoplay: 0,\r\n },\r\n events: {\r\n 'onReady': function (event) {\r\n //event.target.cuePlaylist({list: \"PLFgquLnL59anYA8FwzqNFMp3KMcbKwMaT\"});\r\n //event.target.playVideo();\r\n setTimeout(function() {\r\n\t\t event.target.setShuffle({'shufflePlaylist' : true});\r\n\t\t }, 1000);\r\n\t\t }\r\n\t\t }\r\n\t\t });\r\n }", "function playYoutube(element) {\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"playVideo\",\"args\":\"\"}', '*');\n }", "function resizeVideoJS(){\n\t\tvar width = document.getElementById(id).parentElement.offsetWidth;\n myPlayer.width(width).height( width * aspectRatio );\n }", "function us_scrobbleform() {\r\n\t\r\n\t//alert(\"window.yt.VIDEO_TITLE\");//postxanadus\r\n var loginbox = document.getElementById('us_loginbox');\r\n\r\n // thx to Sebastion Paaske\r\n var xpath = 'id(\"watch-vid-title\")/h1/text()';\r\n\tvar us_videotitle = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\r\n\t//for(var t in us_videotitle)alert(t);//postxanadus\r\n\t//alert(us_videotitle);//postxanadus\r\n if (us_videotitle == null) { // YousableTubeFix Fix\r\n\t\txpath = 'id(\"watch-vid-title\")/h1/a/text()';\r\n\t\tus_videotitle = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\r\n }\r\n\t//alert(us_videotitle);//postxanadus\r\n if (us_videotitle == null) { //episodic videos\r\n \tvar xpath = 'id(\"watch-longform-episode-title\")/h1/a/text()';\r\n\t\tvar xpath2 = 'id(\"watch-longform-episode-title\")/h1/span[2]/text()';\r\n\t\t\t\t\t\r\n\t\t\r\n\t\tus_videotitle = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\r\n\t\t\r\n\t\tus_subtitle = document.evaluate(xpath2, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\r\n\t\t\r\n\t\tif (us_subtitle == null) { // YousableTubeFix Fix\r\n\t\t\tvar xpath = 'id(\"gsvidTitleLink\")/text()';\r\n\r\n\t\t\tus_videotitle = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//begin1 postxanadus for VEVO\r\n\t\t\tif(us_videotitle==null){\r\n\t\t\t\tus_videotitle = document.getElementsByTagName(\"title\")[0].childNodes[0];\r\n\t\t\t\t//alert(us_videotitle);\r\n\t\t\t\t//musicdata = us_videotitle.nodeValue.substring(us_videotitle.nodeValue.indexOf('-')+1).split('-');//postxanadus OLD\r\n\t\t\t\tmusicdata = us_videotitle.nodeValue.substring(0,us_videotitle.nodeValue.lastIndexOf('-')).split('-');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t//end1 postxanadus for VEVO\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tmusicdata = us_videotitle.nodeValue.split('/');\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//begin2 postxanadus for VEVO\r\n\t\t\t}\r\n\t\t\t//end2 postxanadus for VEVO\r\n\t\t}\r\n\t\telse {\r\n\t\t\t\r\n\t\t\tvar musicdata = us_videotitle.nodeValue+'-'+us_subtitle.nodeValue;\r\n\t\t\tmusicdata = musicdata.split('-');\r\n\t\t}\r\n }\r\n else {\r\n\t\t\r\n \tvar musicdata = us_videotitle.nodeValue.split('-');\r\n }\r\n \r\n if (musicdata.length == 1) {\r\n musicdata='';\r\n var musicdata_artist = '';\r\n }\r\n else {\r\n if (musicdata[1].substr(0,1) == ' ') { musicdata[1] = musicdata[1].substr(1); }\r\n var musicdata_artist = musicdata.shift().replace(/'/,'&#39;').replace(/\"/,'&#34;');\r\n musicdata = musicdata.join('-').replace(/'/,'&#39;').replace(/\"/,'&#34;');\r\n }\r\n var cont = '<div id=\"us_loginbox_form\"><form name=\"us_scrobbleform\" onSubmit=\"return'+\r\n ' false\">Artist: <input type=\"text\" name=\"artist\" value=\"'+musicdata_artist.trim()+'\" /><br />' +\r\n 'Track: <input type=\"text\" name=\"track\" value=\"'+musicdata.trim()+'\" /><br /><a href=\"#\" id=\"us_more\" title=\"more options\">+</a>'+\r\n '<p id=\"us_hiddenform\" class=\"hidden\">Album: <input type=\"text\" name=\"album\" value=\"\" /><br />'+\r\n '<a href=\"http://musicbrainz.org/doc/MusicBrainzIdentifier\" title=\"MusicBrainz Track ID\">MBID</a>: <input type=\"text\" name=\"MBID\" value=\"\" /></p>'+\r\n '<div class=\"us_submitbuttons\"><input id=\"us_submit\" value=\"Scrobble\" type=\"submit\" />'+\r\n '<input type=\"submit\" id=\"us_resetlogin\" value=\"reset login\" /></div></form></div>';\r\n us_boxcontent('Scrobble to last.fm - '+GM_getValue('user'),cont);\r\n\r\n document.getElementById('us_resetlogin').addEventListener('click', us_resetlogin, false);\r\n document.getElementById('us_submit').addEventListener('click', us_scrobblenp, false);\r\n document.getElementById('us_more').addEventListener('click', us_showmoreform, false);\r\n}", "function styleVideo() {\n var target = '#bgVideo';\n $('body').css({'width' : '100%', 'height' : '100%', 'overflow-x' : 'hidden'});\n $(target).wrap('<div id=\"videoWrap\" />');\n $('#videoWrap').css({'width' :'100%', 'height' : '100%', 'top' : '0', 'left' : '0', 'overflow-x' : 'hidden', 'z-index' : '-1'});\n if ($(target).hasClass('staticBg')) {\n $('#videoWrap').css({'position' : 'static'});\n }\n else {\n $('#videoWrap').css({'position' : 'absolute'});\n }\n $(target).css({'display' : 'block', 'height' : '100%', 'margin' : '0 auto', 'overflow-x' : 'hidden'});\n $(target).get(0).play();\n}", "function ResizePlayer()\n{\n var newWidth = window.innerWidth * 0.45;\n var newHeight = newWidth * 0.625;\n if((newWidth >= playerMinSize) && (newWidth <= playerMaxSize)) {\n $(\".youtube-embed\").width(newWidth);\n $(\".youtube-embed\").height(newHeight);\n\n $(\".learning-content\").width(newWidth + 340);\n }\n}", "subtitle(data, presets) {\n return `Invite to ${presets.getChannelText(data.channel, data.varName)}`;\n }", "function getFlowPlayer() {\r\n // specify param playagain 1 if you want the play again button to show at end of video. playagain is hidden by default.\r\n var playagainparam = (typeof (showplayagain) != \"undefined\") ? showplayagain : 0;\r\n var whichView = (typeof (view) != \"undefined\") ? view : \"\"; // only set for tradeshow\r\n var hasSubtitle = false;\r\n var subtitlebarHeight = 50;\r\n var playagaintranslation = (typeof (playagaintrans) != \"undefined\") ? playagaintrans : \"Play again\";\r\n \r\n if (autoStart) {\r\n $(\"#\" + targetId).html(\"\"); //empty inner html so flowplayer will autostart\r\n };\r\n\r\n return $f(targetId, { src: flowplayerSWF, wmode: true }, {\r\n key: flowplayerKey,\r\n clip: {\r\n provider: 'rtmp',\r\n url: clipUrl,\r\n ipadUrl: httpUrl,\r\n captionsTrackFilter: \"\",\r\n videoid: 0, // custom property (video id of the clip) - will be set during the playlistclip_changed event in playvideo.js\r\n cuepointscreated: [], // custom property (already tracked cuepoints for the clip) - will be updated in clip.onMetaData event\r\n scaling: 'fit',\r\n autoPlay: autoStart,\r\n autoBuffering: true,\r\n onBegin: function (clip) {\r\n $(document).trigger(\"playlistclip_changed\", { clip: clip }); // Raise a custom event to notify the document that the current clip has changed.\r\n },\r\n onStart: function () {\r\n this.getPlugin(\"play\").css({ opacity: 1 });\r\n if (hasSubtitle == true) { // subtitle in user language found \r\n this.getPlugin(\"subtitles\").show(); // show subtitles\r\n if (whichView == \"videogrid\") {\r\n this.getScreen().css({ bottom: subtitlebarHeight, height: parseInt(videoHeight) - subtitlebarHeight }); // resize video screen \r\n }\r\n else {\r\n this.getScreen().css({ bottom: 25 }); // reposition video screen\r\n }\r\n this.getPlugin(\"controls\").css({ bottom: subtitlebarHeight }); // reposition control bar \r\n }\r\n else {\r\n this.getPlugin(\"subtitles\").hide(); // hide subtitles\r\n this.getScreen().css({ bottom: 0 }); // reposition video screen\r\n this.getPlugin(\"controls\").css({ bottom: 0 }); // reposition control bar \r\n }\r\n },\r\n onFinish: function () {\r\n if ($(\".morevideoslink\").is(\":visible\")) {\r\n if ($('.playlistitem').length > 1 && !$('.playlistitem:last').hasClass('active')) { return false }; // If we have a playlist and aren't on the last video, don't show more videos.\r\n this.getPlugin(\"play\").css({ opacity: playagainparam }); setTimeout(\"$('.morevideoslink').click();\", 2000);\r\n }\r\n },\r\n onMetaData: function () { // this function gets called before clip.onStart() \r\n // determine whether subtitle in user language exists (look at video clip's track meta data)\r\n var clip = this.getClip();\r\n var trackInfo = clip.metaData.trackinfo;\r\n var trackId;\r\n for (var i = 0; i < trackInfo.length; i++) {\r\n if (trackInfo[i].language == subtitleLang && trackInfo[i].sampledescription[0].sampletype == \"tx3g\") { // subtitle in user language found\r\n hasSubtitle = true;\r\n trackId = i + 1; // get corresponding track ID\r\n break;\r\n }\r\n }\r\n\r\n if (hasSubtitle == true) { // subtitle in user language found\r\n // show subtitles\r\n clip.update({ 'captionsTrackFilter': 'trackid=' + trackId }); // set trackfilter\r\n if (whichView != \"videogrid\") { $(\"#\" + targetId).height(parseInt(videoHeight) + subtitlebarHeight); } // resize video container\r\n }\r\n else {\r\n $(\"#\" + targetId).height(videoHeight); // resize video container\r\n }\r\n\r\n // video view tracking\r\n var t = clip.fullDuration;\r\n if (clip.videoid == 0) { clip.update({ \"videoid\": videoId }); } // will be 0 if there is no play list\r\n if (typeof t !== \"undefined\") {\r\n clip.onCuepoint(\r\n [\r\n // Cuepoints are set in milliseconds, fullDuration returns seconds, hence the 1000x multiplier to get percent\r\n { time: 1000, percent: \"0\" }, // 1 second after start\r\n { time: t * 250, percent: \"25\" },\r\n { time: t * 500, percent: \"50\" },\r\n { time: t * 750, percent: \"75\" },\r\n { time: (t * 1000) - 5000, percent: \"100\" } // 5 seconds before the end\r\n ],\r\n function (clip, cuepoint) {\r\n // The Captions/Subtitles plugin causes multiple cuepoint triggers, regardless if there are actual subtitles. Only track percentages once.\r\n if ($.inArray(cuepoint.percent, clip.cuepointscreated) == -1) {\r\n $.ajax({ url: \"/video/vidtrack.ashx?id=\" + clip.videoid + \"&percent=\" + cuepoint.percent + \"&lang=\" + subtitleLang + \"&subtitles=\" + hasSubtitle, cache: false });\r\n\r\n // Once a percent is tracked, place it in clip.cuepointscreated so it won't be tracked again\r\n clip.cuepointscreated.push(cuepoint.percent); \r\n clip.update({ \"cuepointscreated\": clip.cuepointscreated });\r\n }\r\n }\r\n );\r\n }\r\n\r\n }\r\n },\r\n play: {\r\n replayLabel: playagaintranslation\r\n },\r\n canvas: { backgroundGradient: \"none\" },\r\n screen: {\r\n bottom: 0 // position video screen at distance X from the bottom edge of the layer\r\n },\r\n plugins: {\r\n rtmp: { url: flowplayerRTMP, netConnectionUrl: rtmpUrl },\r\n controls: { bottom: 0 },\r\n captions: {\r\n url: captionsPlugin,\r\n captionTarget: \"subtitles\",\r\n button: null // hide cc-button initally\r\n },\r\n subtitles: {\r\n url: contentPlugin,\r\n bottom: 0,\r\n width: \"100%\",\r\n height: subtitlebarHeight,\r\n backgroundColor: \"#000000\",\r\n backgroundGradient: \"none\",\r\n borderRadius: 0,\r\n border: 0,\r\n style: {\r\n body: {\r\n fontSize: 14,\r\n fontFamily: \"verdana,arial,helvetica,sans-serif\",\r\n textAlign: \"center\",\r\n color: \"#ffffff\"\r\n }\r\n },\r\n display: \"none\" // hide subtitles initially\r\n }\r\n },\r\n onBeforeFullscreen: function () {\r\n if (!allowfullscreen) {\r\n if ($(\"#\" + targetId).hasClass(\"docked\")) {\r\n popIn();\r\n } else {\r\n popReturn();\r\n }\r\n return false;\r\n }\r\n }\r\n }).ipad().play();\r\n }", "function podcastLoad()\n{\n document.getElementById(\"playButton\").addEventListener(\"click\", playpause, false);\n var episodeName = document.getElementById(\"episodeName\");\n if (episodeName) {\n episodeName.object.button.textElement.style.textOverflow = \"ellipsis\";\n episodeName.object.setOptions([\"\"]);\n }\n if (document.getElementById(\"episodeDate\")) {\n document.getElementById(\"episodeDate\").innerText = \"\";\n }\n if (document.getElementById(\"episodeDescription\")) {\n document.getElementById(\"episodeDescription\").innerText = \"\";\n }\n if (document.getElementById(\"episodeInformation\")) {\n document.getElementById(\"episodeInformation\").innerText = \"\";\n }\n}", "function playVideo() {\n playVideoSegments(transcripts)\n}", "function html5vidready(myPlayer,player_id) {\n\n\t\t\t\t\t\tif (player_id==undefined) player_id = jQuery(myPlayer[\"b\"]).attr('id');\n\t\t\t\t\t\tvar player_cont = jQuery('#'+player_id);\n\t\t\t\t\t\tvar container = player_cont.closest('.tp-simpleresponsive');\n\n\t\t\t\t\t\tmyPlayer.on(\"play\",function() {\n\n\t\t\t\t\t\t\tif (player_cont.closest('.tp-caption').data('volume')==\"mute\")\n\t\t\t\t\t\t\t\t myPlayer.volume(0);\n\t\t\t\t\t\t\tvar bt = jQuery('body').find('.tp-bannertimer');\n\t\t\t\t\t\t\tvar opt = bt.data('opt');\n\t\t\t\t\t\t\tbt.stop();\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\topt.videoplaying=true;\n\t\t\t\t\t\t\t} catch(e) {}\n\n\n\t\t\t\t\t\t\t//konsole.log(\"VideoPlay set to True due html5vidready PLAYING\");\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tmyPlayer.on(\"pause\",function() {\n\t\t\t\t\t\t\t var bt = container.find('.tp-bannertimer');\n\t\t\t\t\t\t\t\tvar opt = bt.data('opt');\n\t\t\t\t\t\t\t\tif (opt.conthover==0)\n\t\t\t\t\t\t\t\t\tbt.animate({'width':\"100%\"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:\"linear\"});\n\t\t\t\t\t\t\t\topt.videoplaying=false;\n\t\t\t\t\t\t\t\t//konsole.log(\"VideoPlay set to False due html5vidready pause\");\n\t\t\t\t\t\t\t\topt.videostoppednow=1;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tmyPlayer.on(\"ended\",function() {\n\t\t\t\t\t\t\t\tvar bt = container.find('.tp-bannertimer');\n\t\t\t\t\t\t\t\tvar opt = bt.data('opt');\n\t\t\t\t\t\t\t\tif (opt.conthover==0)\n\t\t\t\t\t\t\t\t\tbt.animate({'width':\"100%\"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:\"linear\"});\n\t\t\t\t\t\t\t\topt.videoplaying=false;\n\t\t\t\t\t\t\t\t//konsole.log(\"VideoPlay set to False due html5vidready pause\");\n\t\t\t\t\t\t\t\topt.videostoppednow=1;\n\t\t\t\t\t\t\t\tif (opt.nextslideatend==true)\n\t\t\t\t\t\t\t\t\topt.container.revnext();\n\t\t\t\t\t\t});\n\n\n\t\t\t\t\t\tmyPlayer.on('loadedmetadata', function(data) {\n\n\n\n\t\t\t\t\t\t\t\tvar videoWidth =0;\n\t\t\t\t\t\t\t\tvar videoHeight=0;\n\n\t\t\t\t\t\t\t\tfor(var prop in this) {\n\t\t\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\t\t\tif(this[prop].hasOwnProperty('videoWidth'))\n\t\t\t\t\t\t\t\t\t\t\t\tvideoWidth = this[prop].videoWidth;\n\n\t\t\t\t\t\t\t\t\t\t\tif(this[prop].hasOwnProperty('videoHeight'))\n\t\t\t\t\t\t\t\t\t\t\t\t videoHeight = this[prop].videoHeight;\n\t\t\t\t\t\t\t\t\t\t} catch(e) {}\n\t\t\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t\tvar mediaAspect = videoWidth/videoHeight;\n\n\n\n\n\t\t\t\t\t\t\t\tif (player_cont.data('mediaAspect') == undefined) player_cont.data('mediaAspect',mediaAspect);\n\t\t\t\t\t\t\t\tif (player_cont.closest('.tp-caption').data('forcecover')==1)\n\t\t\t\t\t\t\t\t\tupdateHTML5Size(player_cont,container);\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}", "function getMovieTitle() {\r\n\t\tvar title = new String ( document.title.replace(' on All Consuming', '') );\r\n\t\t/* get rid of subtitles and editions. they just get in the way of the search */\r\n\t\ttitle = title.replace(/ - .*/gi, '');\r\n\t\ttitle = title.replace(/ \\(\\w*screen edition\\)/gi, '');\r\n\t\treturn title;\r\n\t}", "function initVideo(){\n\t\t//fit all videos in their parent container\n\t\tjQuery(\".scalevid\").fitVids();\n\t}", "function get_yt_title(ytid, i) {\n $.get('https://gdata.youtube.com/feeds/api/videos/' + ytid + '?v=2', function (xml) {\n var s = $(xml).find('entry').find('title').text();\n document.getElementById('vp-'+i).getElementsByClassName('info')[0].innerHTML = s.slice(0, s.length/2);\n });\n}", "function openPlayer(emptystring, width, height, uiconf_id, previewOnly) { \r\n\tif (previewOnly==true) $(\"#KMC\")[0].alert('previewOnly from studio');\r\n\tkmc.preview_embed.doPreviewEmbed(\"multitab_playlist\", null, null, previewOnly, true, uiconf_id); \r\n}", "function playYoutube(element) {\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"playVideo\",\"args\":\"\"}', '*');\n }", "function init() {\n\t\t\tconstructVideoPlayerContent(elems.container);\n\t\t\tshowControls();\n\t\t\t_.event(elems.btnBigPlay, 'click', play);\n\t\t\t_.event(elems.buttons.play, 'click', playPause);\n\t\t\t_.event(elems.video, 'click', pause);\n\t\t\t_.event(elems.buttons.volume, 'click', mute);\n\t\t\t_.event(elems.buttons.fullscreen, 'click', fullscreen);\n\t\t\t_.event(elems.video, 'loadedmetadata', function(e) {\n\t\t\t\tplaybackRate(opts.speed);\n\t\t\t\tvideoProgress = new Range(opts.progress / elems.video.duration, elems.ranges.video, {\n\t\t\t\t\tonDrop: (pct) => progress(pct, true),\n\t\t\t\t});\n\t\t\t\tvolumeSlider = new Range(opts.volume, elems.ranges.volume, {\n\t\t\t\t\tonDrag: volume,\n\t\t\t\t});\n\t\t\t\tvolume(opts.volume);\n\t\t\t\tprogress(opts.progress);\n\t\t\t\ttimestamp(0, elems.video.duration);\n\t\t\t\tif (opts.autoplay) play();\n\t\t\t});\n\t\t\t_.event(elems.video, 'timeupdate', progUpdate);\n\t\t\t_.event(elems.main, 'mousemove', showControls);\n\t\t\t_.event(elems.controls, 'mouseenter', () => showControls(true));\n\t\t\t_.event(elems.controls, 'mouseleave', () => showControls(false));\n\t\t\t_.event(window, 'keyup', handleKeyPress);\n\t\t\t_.event(document, 'fullscreenchange', handleFullscreenChange); // PREFIXES WHY\n\t\t\t_.event(document, 'msfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'mozfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'webkitfullscreenchange', handleFullscreenChange);\n\n\t\t\tif (opts.fullscreen) fullscreen(true);\n\t\t\telems.video.src = opts.src;\n\t\t}", "function arrangeWindowTimeline() {\n let iterator = null;\n window.timeline = null;\n window.timelineDuration = 0\n childrenNodesTimeline = $('.timeline').children()\n for (child of childrenNodesTimeline) {\n if (child !== timelinePlaceholder) {\n if (window.references[child.id]) {\n if (!window.timeline) {\n window.timeline = window.references[child.id]\n window.timeline.prev = null\n iterator = window.timeline\n } else {\n iterator.next = window.references[child.id]\n iterator.next.prev = iterator\n iterator = iterator.next\n }\n } else {\n resource = buildVideoResource(child, window.resources[child.id] ? window.resources[child.id].metadata.title : \"***\")\n if (!window.timeline) {\n window.timeline = new TimelineNode(resource)\n iterator = window.timeline\n } else {\n iterator.next = new TimelineNode(resource)\n iterator.next.prev = iterator\n iterator = iterator.next\n }\n window.references[iterator.data.videoCore.id] = iterator\n }\n if (iterator.prev) {\n iterator.data.metadata.baseDuration = iterator.prev.data.metadata.baseDuration + iterator.prev.data.metadata.duration\n } else {\n iterator.data.metadata.baseDuration = 0\n }\n \n window.timelineDuration += iterator.data.metadata.duration\n /* Removing previous links if necessary */\n iterator.next = null\n }\n }\n finalVideoDurationLabel.innerText = formatTimeFromSeconds(window.timelineDuration.toFixed(2))\n // event.target.style.width = event.target.getBoundingClientRect().width\n\n window.currentVideoSelectedForPlayback = window.timeline\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = window.currentVideoSelectedForPlayback.data.metadata.startTime\n setTimeout(() => \n renderCurrentPlaybackBar(window.currentVideoSelectedForPlayback), 50)\n}", "function showYTPlayer1(containerId) {\r\n if (!creative.dom.ytplayer1) {\r\n creative.ytplayer1Ended = false;\r\n creative.dom.ytplayer1 = document.createElement('gwd-youtube');\r\n var ytp = creative.dom.ytplayer1;\r\n ytp.setAttribute('id', 'ytp-1');\r\n ytp.setAttribute('video-url', 'https://www.youtube.com/watch?v=9SZUNGUuV2Q');\r\n ytp.setAttribute('autoplay', 'standard'); // none, standard, preview, intro.\r\n ytp.setAttribute('muted', 'false');\r\n // Adformat parameter for Mastheads.\r\n ytp.setAttribute('adformat', '1_8');\r\n ytp.setAttribute('controls', 'autohide'); // none, show, autohide.\r\n document.getElementById(containerId).appendChild(ytp);\r\n\r\n ytp.addEventListener('playpressed', function() {\r\n if (ytp.a.isMuted()) {\r\n ytp.toggleMute();\r\n }\r\n if (creative.ytplayer1Ended) {\r\n creative.ytplayer1Ended = false;\r\n Enabler.counter('YTP 1 replay', true);\r\n }\r\n Enabler.counter('YTP 1 play pressed', true);\r\n }, false);\r\n ytp.addEventListener('paused', function() {\r\n Enabler.counter('YTP 1 paused', true);\r\n }, false);\r\n ytp.addEventListener('ended', function() {\r\n Enabler.counter('YTP 1 ended', true);\r\n creative.ytplayer1Ended = true;\r\n }, false);\r\n ytp.addEventListener('viewed0percent', function() {\r\n // Force unmute.\r\n if (ytp.a.isMuted()) {\r\n ytp.toggleMute();\r\n }\r\n Enabler.counter('YTP 1 viewed 0%');\r\n }, false);\r\n ytp.addEventListener('viewed25percent', function() {\r\n Enabler.counter('YTP 1 viewed 25%');\r\n }, false);\r\n ytp.addEventListener('viewed50percent', function() {\r\n Enabler.counter('YTP 1 viewed 50%');\r\n }, false);\r\n ytp.addEventListener('viewed75percent', function() {\r\n Enabler.counter('YTP 1 viewed 75%');\r\n }, false);\r\n ytp.addEventListener('viewed100percent', function() {\r\n Enabler.counter('YTP 1 viewed 100%');\r\n }, false);\r\n ytp.addEventListener('previewed0percent', function() {\r\n Enabler.counter('YTP 1 previewed 0%');\r\n if (!ytp.a.isMuted()) {\r\n ytp.toggleMute();\r\n }\r\n }, false);\r\n ytp.addEventListener('previewed25percent', function() {\r\n Enabler.counter('YTP 1 previewed 25%');\r\n }, false);\r\n ytp.addEventListener('previewed50percent', function() {\r\n Enabler.counter('YTP 1 previewed 50%');\r\n }, false);\r\n ytp.addEventListener('previewed75percent', function() {\r\n Enabler.counter('YTP 1 previewed 75%');\r\n }, false);\r\n ytp.addEventListener('previewed100percent', function() {\r\n Enabler.counter('YTP 1 previewed 100%');\r\n }, false);\r\n }\r\n else {\r\n creative.dom.ytplayer1.style.display = 'block';\r\n }\r\n}", "function loadVid1(){\n player1.cuePlaylist({listType:\"search\",\n list: \"documentary \" + QueryString.NAinterest,\n videoCategoryID: 'Education',\n startSeconds:0,\n suggestedQuality:\"large\"});}", "renderYoutubePlayer() {\n const { videoId, id, track } = this.props.playlist[0];\n\n return (\n <YoutubePlayer\n onMouseOver={this.handleHover}\n id={id}\n videoId={videoId}\n removeVideo={this.props.removeVideo}\n channel={this.props.match.params.channel}\n addNowPlaying={this.props.addNowPlaying}\n track={track}\n />\n );\n }" ]
[ "0.6343375", "0.62633234", "0.62324286", "0.6225659", "0.6173732", "0.6172417", "0.6156412", "0.6145753", "0.60456", "0.5974248", "0.59478223", "0.59293264", "0.58953816", "0.5854956", "0.5776911", "0.57645357", "0.5731814", "0.56288713", "0.56268555", "0.5614632", "0.561342", "0.5598656", "0.5595548", "0.5563971", "0.55622756", "0.55563754", "0.5549217", "0.55358917", "0.5524321", "0.5512426", "0.55113256", "0.549847", "0.54928786", "0.5490085", "0.54887116", "0.5450065", "0.5449122", "0.54330856", "0.54257405", "0.54217726", "0.5414301", "0.54123354", "0.5397628", "0.5381357", "0.53801167", "0.5375586", "0.5350637", "0.53223634", "0.53219575", "0.5321888", "0.53215694", "0.53170985", "0.52973336", "0.5294863", "0.5289747", "0.52875847", "0.52862734", "0.5277722", "0.5273054", "0.5268477", "0.52672136", "0.52641153", "0.52629524", "0.5257724", "0.52557", "0.5237324", "0.5233392", "0.5218816", "0.5212034", "0.520529", "0.5203644", "0.5203337", "0.51992553", "0.5198426", "0.51961845", "0.5188708", "0.5181916", "0.5180992", "0.5180438", "0.51740044", "0.5170336", "0.51579577", "0.51578987", "0.51576746", "0.515423", "0.5150885", "0.51497674", "0.5148879", "0.51480746", "0.51469463", "0.51467365", "0.51446056", "0.5143413", "0.51419336", "0.5139235", "0.5139227", "0.5137324", "0.51218307", "0.51158196", "0.5109052" ]
0.65505075
0
Workaround for starting video from saved position
function playpause(event) { player.play(); player.pause(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fastForwardVideo() {\n var fastForward = player.getCurrentTime();\n var add15Seconds = fastForward + 15;\n player.seekTo(add15Seconds);\n }", "function seek_video()\n {\n if (!(current in timecodes)) return;\n if (!video_elt.contentWindow) video_elt.currentTime = timecodes[current];\n else video_elt.contentWindow.postMessage([\"seek\", timecodes[current]], \"*\");\n }", "onVideoSeeked() {\n this.videoFrameReady = true;\n this.drawCurrentFrame();\n }", "function playPrevVideo() {\n var index\n if (position < 0) {\n position = position + 62\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition =\"all 1s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n } else if (position === 0) {\n position = (ids.length-1) * (-62)\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition = \"left 0.5s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n }\n}", "function piloteVideo() {\r\n\t\tif (roi.paused) {\r\n\t\t\troi.play();\r\n \r\n\t\t} else {\r\n\t\t\troi.pause();}\r\n }", "function rewindVideo() {\n var fastForward = player.getCurrentTime();\n var minus15Seconds = fastForward - 15;\n player.seekTo(minus15Seconds);\n }", "function trackVideoStart() {\n\n flushParams();\n correlateMediaPlaybackEvents();\n\n s.Media.open(videoFileName, videoStreamLength, omniturePlayerName());\n s.Media.play(videoFileName, 0, 0);\n }", "function playNextVideo() {\n var index\n if (position === (ids.length-1) * (-62)) {\n position = 0\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition = \"left 0.5s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n } else if (position <= 0) {\n position = position - 62\n imageHolder.style.left = String(position) + \"vw\"\n imageHolder.style.transition =\"all 1s ease\"\n index = position / (-62)\n videoTitle.textContent = ids[index][\"title\"]\n description.textContent = ids[index][\"info\"]\n }\n}", "function skipBackwardToStart()\r\n\t{\r\n\t\tmyVideo.currentTime = 0; //the playback time returns back to 0 seconds\r\n\t\t//if statement; outcome differs depending on conditions\r\n\t\tif ( myVideo.currentTime === 0 )\r\n\t\t{\r\n\t\t\tmyVideo.pause(); //the DOM pause method pauses the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"&#9658;\" ; //updates inside HTML button selector when clicked: turns into a right-pointing pointer made from single Unicode\r\n\t\t\tmyVideo.load(); //DOM load() method re-loads the video\r\n\t\t\tscrubSlider.value = 0; //reset the slider for video playback to zero\r\n\t\t} //end if statement\r\n\t}", "function seekVideo(browser, currentTime){\n\tbrowser.execute(function(currentTime) {\n\t\t// get the video at a given point\n\t\tvar videoElement = arSession.arSource.domElement\n\t\tvideoElement.pause()\n\t\tvideoElement.currentTime = 4.0\n\t}, currentTime)\t\n}", "function switchVideo(n) {\r\n document.getElementsByTagName(\"video\")[0].pause();\r\n\r\n document.getElementById(\"mp4\").src = movieInfo[n].src;\r\n document.getElementById(\"ogg\").src =\r\n movieInfo[n].src.substring(0, movieInfo[n].src.length - 3) + \"ogg\";\r\n document.getElementsByTagName(\"video\")[0].load();\r\n\r\n // Change the position in the list\r\n position = n + 1;\r\n}", "function autoVideo() {\r\n // Reloop the list of videos from the first movie\r\n if (position == movieInfo.length) {\r\n position = 0;\r\n document.getElementsByTagName(\"video\")[0].onended = function () {\r\n setTimeout(autoVideo, 2000);\r\n };\r\n }\r\n\r\n document.getElementById(\"mp4\").src = movieInfo[position].src;\r\n document.getElementById(\"ogg\").src =\r\n movieInfo[position].src.substring(0, movieInfo[position].src.length - 3) +\r\n \"ogg\";\r\n document.getElementsByTagName(\"video\")[0].load();\r\n\r\n position++;\r\n}", "function retroceder() {\n\n video.currentTime -= 10;\n console.log(video.currentTime)\n}", "function rewindVideo(increment) {\n player.currentTime -= increment;\n}", "function setVideoProgress(){\n // return true;\n video.currentTime = (+progress.value * video.duration) / 100;\n}", "startDownload() {\n // TODO changes for resuming partially downloaded file\n // REVIEW you can also specify start here\n video.pipe(fs.createWriteStream(path.join(this.args.filePath, filename)));\n }", "function reiniciar() {\n\n video.load();\n playPause();\n}", "function startVideo() {\n console.log(\"Inside Start Video\");\n stream.getVideoTracks()[0].enabled = true;\n }", "check_GameMovie(){\n if(this.scene.showGameMovie){\n for (let i = this.model.playsCoords.length - 1; i >= 0; i--) {\n let playCoords = this.model.playsCoords[i];\n let playValues = this.model.playsValues[i];\n this.view.setPieceToStartPos(playCoords[0], playCoords[1], playValues[1]);\n }\n this.state = 'WAIT_GM_1st_ANIMATION_END';\n \n }\n }", "function rWindVid() {\n vidPlayer.currentTime = 0;\n clipBar.value = 0;\n }", "function forwardVideo(increment) {\n player.currentTime += increment;\n}", "resumeDownload() {\n video.resume();\n sendMessage({\n index: this.args.index,\n type: 'resume'\n });\n }", "function PlayExpandedIntroVideo () {\r\ncreative.dom.video1.vid.play();\r\ncreative.dom.video1.vid.currentTime = 0;\r\n}", "function adelantar() {\n\n \n video.currentTime += 10;\n console.log(video.currentTime)\n}", "function videoStarter() {\r\n\r\n\t$('#stream-boy').vide({\r\n\t\tmp4:'video/streamboy-clip.mp4',\r\n\t\togv:'video/streamboy-clip.ogv',\r\n\t\twebm:'video/streamboy-clip.webm',\r\n\t\tposter:'img/space-poster.jpg',\r\n\t\t}, {\r\n\t\tloop: true,\r\n\t\tmuted: true,\r\n\t\tautoplay: true,\r\n\t\tposterType: \"jpg\",\r\n\t\tclassName: \"stream-boy\"\r\n\t});\r\n\r\n\t$('#space-video').vide({\r\n\t\tmp4:'video/space-planet-with-reverse50.mp4',\r\n\t\togv:'video/space-planet-with-reverse50.ogv',\r\n\t\twebm:'video/space-planet-with-reverse50.webm',\r\n\t\tposter:'img/space-poster.jpg',\r\n\t\t}, {\r\n\t\tloop: true,\r\n\t\tmuted: true,\r\n\t\tautoplay: true,\r\n\t\tposterType: \"jpg\",\r\n\t\tclassName: \"space-video\"\r\n\t});\r\n\r\n\t// Get instance of the plugin\r\n\tvar spaceVideo = $('#space-video').data('vide');\r\n\tvar spaceVideoObject = spaceVideo.getVideoObject();\r\n\r\n\thud.mousemove(function( event ) {\r\n\r\n\t\tvar pageCoords = \"( \" + event.pageX + \", \" + event.pageY + \" )\";\r\n\t\tvar hudPosition = hud.position();\r\n\r\n\t\t// Find the position of the cursor inside the \"HUD\" relative to the width of the window\r\n\t\t// Divide by 4 and round up to get a clean percentage\r\n\t\tvar innerHudPosition = Math.round( ( event.pageX - hudPosition.left + 200 ) / 4 );\r\n\r\n\t\t//console.log(\"Camera Position: \" + innerHudPosition + \"%\");\r\n\t\t//console.log(\"Video Time: \" + spaceVideoObject.currentTime );\r\n\r\n\t\t// Set the video frame position relative to innerHudPosition\r\n\t\tspaceVideoObject.currentTime = innerHudPosition / 2;\r\n\t\tspaceVideoObject.pause();\r\n\r\n\t});\r\n\r\n\thud.mouseover(function() {\r\n\t\tspace.addClass(\"seeking-state\");\r\n\t});\r\n\r\n\thud.mouseout(function() {\r\n\t\t// setTimeout(function() { spaceVideoObject.play(); }, 1000);\r\n\t\tspaceVideoObject.play();\r\n\t\tspace.removeClass(\"seeking-state\");\r\n\t});\r\n}", "function setVideoProgress() {\n video.currentTime = (parseInt(progress.value) * video.duration) / 100;\n}", "function playVideo() {\n if (getPlayerPaused()) {\n editor.player[0].play();\n }\n}", "function getPosition(){\n\n // 抓點擊的位置 與開始時 個別掛上去\n var eTarget = event.target;\n var index = eTarget.getAttribute(\"aria-position\");\n var getStartT = eTarget.getAttribute(\"aria-time\");\n\n // if抓到不是unit 抓爸爸 重新抓位置跟開始時間\n var posClassName = eTarget.className \n if(posClassName != \"unit\"){\n posClassName = eTarget.parentNode;\n index = posClassName.getAttribute(\"aria-position\");\n getStartT = posClassName.getAttribute(\"aria-time\");\n } \n\n // < 650 時, 不作清除 focus & 掛 focus style\n if(document.body.clientWidth >= 650){\n cleanFocus();\n var site = document.getElementsByClassName(\"unit\")[index];\n site.classList.add(\"focusOption\");\n }\n\n player.currentTime(getStartT);\n player.play(); \n\n if(document.body.clientWidth >= 650){\n // 卷軸 跟著\n scrollMove(index);\n // 最後兩個 移到最底下\n if( index >= cueLength - 2 ){\n playlistBlock.scrollTop = playlistBlock.scrollHeight;\n }\n }else{\n closeX();\n }\n }", "function endOfVideo() {\n\n\tif(videoOne.currentTime > 144 && videoOne.currentTime < 145) {\n\n\t\tendingWindow.classList.add(\"move-content-ending\");\n\n\t\tvideoOne.pause();\n\t\tvideoTwo.pause();\n\t\tvideoThree.pause();\n\n\t\taudioThree.pause();\n\t\taudioOne.pause();\n\n\n\n\t} else {\n\n\t}\n\n}", "function start() {\r\n intro.classList.add('hidden');\r\n startKnop.classList.add('hidden');\r\n video.classList.remove('hidden');\r\n\r\n filmpje = document.createElement('source');\r\n filmpje.src = 'videos/1+2.mp4';\r\n filmpje.type = 'video/mp4';\r\n video.appendChild(filmpje);\r\n video.play();\r\n}", "function updateVideoProgress() {\n // Set the current time of video based on position of slider\n video.currentTime = (progress.value * video.duration) / 100;\n}", "function scrollPlay(){ \n var frameNumber = window.pageYOffset/playbackConst;\n vid.currentTime = frameNumber;\n window.requestAnimationFrame(scrollPlay);\n }", "function playVidWaterVideo (event) {\n vidWaterVideo.play();\n $(window).scrollTop($('#videoWaterVidCenterer').offset().top + 15);\n $(\"#vidWaterVideo\").css(\"opacity\",1);\n //jumpScroll($('#vidWaterVideo').scrollTop(\n }", "function setVideoProgress() {\n video.currentTime = (+progress.value * video.duration) / 100;\n}", "function setVideoProgress() {\n video.currentTime = (+progress.value * video.duration) / 100;\n}", "function btnComenzar() {\n vid.currentTime = 0;\n vid.play();\n}", "function onPlayerReady() {\r\n player.playVideo();\r\n /*let time = player.getCurrentTime();\r\n if(player.stopVideo()){\r\n let time2 = player.getCurrentTime();\r\n \r\n player.playVideo(time2);\r\n }*/\r\n \r\n }", "function start() {\n media.currentTime = 0;\n }", "function piloteVideo4() {\r\n\t\tif (LGDM.paused) {\r\n\t\t\tLGDM.play();\r\n \r\n\t\t} else {\r\n\t\t\tLGDM.pause();}\r\n }", "function backToStart() {\n\tpositionFinal[0] = CAMERA_START_POSITION_X;\n\tpositionFinal[1] = CAMERA_START_POSITION_Y;\n\tpositionFinal[2] = CAMERA_START_POSITION_Z;\n\trotationFinal[0] = CAMERA_START_ROTATION_X;\n\trotationFinal[1] = CAMERA_START_ROTATION_Y;\n\trotationFinal[2] = CAMERA_START_ROTATION_Z;\n\tfor(var i=groupScene.length;i--;) {\n\t\tgroupScene[i][\"lock\"] = false;\n\t}\n\tzoomOn = null;\n\tzoomIn = false;\n\tgetSpeedMovement();\n\tgetMovementWay();\n\tmovementCamera = true;\n}", "function setVideoTime() {\r\n togglePlayPause();\r\n video.currentTime = (progress.value / 100) * video.duration;\r\n togglePlayPause();\r\n}", "function restartPlaybackAtCurrentPosition() {\n\t\t\t\t//unregister event listeners so that actions here aren't captured by analytics\n\t\t\t\tunregisterWindowResizeEvent();\n\t\t\t\tunregisterPlayerEvents();\n\n\t\t\t\tvar playerTime = player.input.time;\n\n\t\t\t\t//stop and restart playback\n\t\t\t\tplayer.playlist.stop();\n\t\t\t\tplayer.playlist.play();\n\n\t\t\t\t//restore the playback position (except for live streams)\n\t\t\t\tif (!scope.stream.isLive) {\n\t\t\t\t\tplayer.input.time = playerTime;\n\t\t\t\t}\n\n\t\t\t\t//restore event listeners\n\t\t\t\tregisterPlayerEvents();\n\t\t\t\tregisterWindowResizeEvent();\n\t\t\t}", "if (!game.inEditorMode) {\n // revert pos\n this.pos = lastPos;\n }", "function loadVideo(vidFile){\nframes['videoLaunch'].location.href = vidFile;\n}", "showVideoOnTop(){\n this.scrollToTop(200)\n this.box.video = !this.box.video\n }", "function OpenVideoScreen(filePath)\n{\n if(watchingVideo)\n return\n\n watchingVideo = true\n\n document.getElementById(\"video-wrap\").classList.remove(\"closed\")\n document.getElementById(\"vs-video-source\").src = filePath\n document.getElementById(\"vs-video\").load()\n}", "function setTimeOfVideoOnModalOpen(idVideo) {\n var video = document.getElementById(idVideo);\n video.currentTime = checkCurrentVideoSrcAndRetrieveUserPosition(idVideo);\n}", "function drawVedio() {\n setTimeout(() => {\n canvas.getContext(\"2d\").drawImage(video, 0, 0, 100, 100);\n drawVedio();\n }, 0);\n }", "function piloteVideo2() {\r\n\t\tif (LCCMA.paused) {\r\n\t\t\tLCCMA.play();\r\n \r\n\t\t} else {\r\n\t\t\tLCCMA.pause();}\r\n }", "function thumbNowPlaying() {\n var offset = $(curTarget).offset();\n if (thumbTimeout) {\n clearInterval(thumbTimeout);\n }\n $(video_thumb).css(offset);\n //console.log(\"Moving video to \" + offset);\n $(video_thumb).show();\n thumbTimeout = setInterval(thumbShotTrigger, (extractTime(segment_list[cur_segment].end) - extractTime(segment_list[cur_segment].begin)) * 1000);\n video_thumb.removeEventListener(\"playing\", thumbNowPlaying);\n }", "function newGameVideo() {\n //light up the island for the first time\n}", "function repeater(start, stop) {\r\n\tlet vid = document.getElementsByTagName('video');\r\n\tvar vid_curr = vid[0].currentTime;\r\n\tconsole.log()\r\n\tif(vid[0].currentTime >= stop)\r\n\t\tvid[0].currentTime = start;\r\n\telse if(vid[0].currentTime < start)\r\n\t\tvid[0].currentTime = start;\r\n}", "function _seek(position) {\n\t\t\ttry {\n\t\t\t\tif (_model.playlist[0].levels[0].file.length > 0) {\n\t\t\t\t\tswitch (_model.state) {\n\t\t\t\t\t\tcase jwplayer.api.events.state.PLAYING:\n\t\t\t\t\t\tcase jwplayer.api.events.state.PAUSED:\n\t\t\t\t\t\tcase jwplayer.api.events.state.BUFFERING:\n\t\t\t\t\t\t\t_model.getMedia().seek(position);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} catch (err) {\n\t\t\t\t_eventDispatcher.sendEvent(jwplayer.api.events.JWPLAYER_ERROR, err);\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "function hoverVideo(e) { \n\t $('video', this).get(0).play(); \n $('video', this).removeClass('gris');\n // $('video', this).get(0).currentTime = 3;\n \n\n\t}", "function playCurrentVideo() {\n \tisPlaying = true;\n \tvideo.playVideo();\n }", "function myMove() {\n var videoMove = document.getElementById(\"myVideo\"); \n var pos = 0;\n var half = Math.round($(window).height() * .5)\n \n var id = setInterval(frame, 10);\n function frame() {\n if (pos == half) {\n clearInterval(id);\n } else {\n console.log(half);\n pos++;\n videoMove.style.top = pos + 'px';\n videoMove.style.left = pos + .75*'px';\n }\n }\n }", "function positionVideo(video,\n width,\n height,\n horizontalIndent,\n verticalIndent) {\n video.width(width);\n video.height(height);\n video.css({ top: verticalIndent + 'px',\n bottom: verticalIndent + 'px',\n left: horizontalIndent + 'px',\n right: horizontalIndent + 'px'});\n}", "function positionVideo(video,\n width,\n height,\n horizontalIndent,\n verticalIndent) {\n video.width(width);\n video.height(height);\n video.css({ top: verticalIndent + 'px',\n bottom: verticalIndent + 'px',\n left: horizontalIndent + 'px',\n right: horizontalIndent + 'px'});\n}", "function UpdateWaveformCursor() {\n\t\t\t\t/* called continuously as the video plays */\n\t\t\t\tif ( document.getElementById(\"waveform_cursor\") && (typeof(WaveformCursor) != \"undefined\") ) {\n\t\t\t\t\tif (typeof(CurrVideoObj) != \"undefined\") {\n\t\t\t\t\t\tif ((typeof(CurrVideoObj.currentTime) != \"undefined\") && (typeof(CurrVideoObj.duration) != \"undefined\")) {\n\t\t\t\t\t\t\tif ( (! isNaN(CurrVideoObj.currentTime)) && (! isNaN(CurrVideoObj.duration)) ) {\n\t\t\t\t\t\t\t\tif (CurrVideoObj.duration > 0) {\n//console.log(WaveformCursor.style.width);\n\t\t\t\t\t\t\t\t\tvar LeftPosInPx = Math.floor(WaveformWidth * (CurrVideoObj.currentTime / CurrVideoObj.duration)) - Math.floor(parseFloat(WaveformCursor.style.width));\n\t\t\t\t\t\t\t\t\tif (LeftPosInPx <= (WaveformElLeft + WaveformWidth) ) {\n//console.log(LeftPosInPx);\n\t\t\t\t\t\t\t\t\t\tvar LeftPosStr = LeftPosInPx + \"px\";\n\t\t\t\t\t\t\t\t\t\t//WaveformCursor.style.left = \"250px\";\n\t\t\t\t\t\t\t\t\t\tWaveformCursor.style.left = LeftPosStr;\n\t\t\t\t\t\t\t\t\t\tWaveformCursor.style.display = \"block\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t// if (typeof(CurrVideoObj) != \"undefined\") {\n\t\t\t\t}\t\t// if ( document.getElementById(\"waveform_cursor\") && (typeof(WaveformCursor) != \"undefined\") )\n\t\t\t}\t// function UpdateWaveformCursor()", "function landingPlayVideo(e) {\n\n\t\t\t// play all videos\n\t\t\tvideoOne.play();\n\t\t\tvideoTwo.play();\n\t\t\tvideoThree.play();\n\n\t\t\taudioThree.play();\n\t\t\taudioOne.play();\n\n\t\t\taudioThree.volume = 0.15;\n\n\t\t\tvideoWindow.classList.add(\"move-content\");\n\n\t\t\t// change videoPlay button text to pause\n\t\t\tvideoPlay.innerHTML = \"Pause\";\n\t\t\t// add \"playing\" class to video play button\n\t\t\tvideoPlay.classList.add(\"playing\");\n\n\t\t}", "function playVideo() {\n playVideoSegments(transcripts)\n}", "function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }", "function updateVideosPosition() {\r\n\tupdatePosition('updateVideosPosition', '#videos > .video-container');\r\n}", "function displayVideoPreview(previewWindowName, filePath, filename) \r\n{\r\n\t$(\"#\" + previewWindowName + \"SlideVideo\").attr('src', filePath + filename);\r\n\t$(\"#\" + previewWindowName + \"SlideVideo\").show();\r\n\t$(\"#\" + previewWindowName + \"SlideImage\").hide();\r\n\t$(\"#\" + previewWindowName + \"SlideWebpage\").hide();\r\n\t$(\"#nextError\").hide();\r\n\t$(\"#currentError\").hide();\r\n\t\r\n\tif (previewWindowName == \"next\")\r\n\t{\r\n\t\tdocument.getElementById(\"nextSlideVideo\").currentTime = 1;\r\n\t}\r\n}", "function videoFunction(order){ // .load(), .play(), .pause(), .currentTime = x seconds\n try {\n chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {\n chrome.tabs.executeScript(tabs[0].id, {code: \"storedVideo{0};\".format(order)});\n });\n }catch(error){}\n}", "function Changevideo(nextvid){\n player.loadVideoById({videoId:nextvid})\n playing = nextvid;\n}", "function get_working_video_path(){ \n if (working_video_path !== undefined) {\n return working_video_path;\n } else {\n return update_working_video_path(\"./media/working-video/video.mp4\");\n } \n}", "function reproductor(video0,video, video2,video3,video4,video6,video7,video8,video9,video10){\n\n\tvideo6.style.opacity = \"0\";\n\tvideo7.style.opacity = \"0\";\n\tvideo8.style.opacity = \"0\";\n\tvideo9.style.opacity = \"0\";\n\tvideo10.style.opacity = \"0\";\n\n\tvideo0.load();\n\tvideo.load();\n\tvideo2.load();\n\tvideo3.load();\n\tvideo4.load();\n\t\n\n\tvideo.addEventListener('loadeddata', function() {\n\t\tvideo0.currentTime = 0;\n\t\tvideo0.play();\n\n\t\tvideo.currentTime = 0;\n\t\tvideo.style.opacity = \"1\";\n\t\tvideo.play();\n\n\t\tvideo2.currentTime = 0;\n\t\tvideo2.style.opacity = \"1\";\n\t\tvideo2.play(); \n\n\t\t\n\t\tvideo3.currentTime = 0;\n\t\tvideo3.style.opacity = \"1\";\n\t\tvideo3.play();\n\n\t\n\t\tvideo4.currentTime = 0;\n\t\tvideo4.style.opacity = \"1\";\n\t\tvideo4.play();\t })\t\t\t\t\n\n\tvar i = 0;\n\tvar x = 0;\n\tvar y = 0;\n\tvar z = 0;\n\tvar v = 0;\n\tvar w = 0;\n\tvar times=0;\n\tvar cadena=0;\n\n\tvideo.onended = function() {\t\t\n\t\tif (i < times){\n\t\t\ti++;\n\t\t\tvideo.play(); \n\t\t}else{ \n\t\t\tvideo.style.opacity = \"0\";\n\t\t\tvideo2.style.opacity = \"0\";\n\t\t\tvideo3.style.opacity = \"0\";\n\t\t\tvideo4.style.opacity = \"0\";\n\n\t\t\t\n\t\t\tvideo6.load();\n\t\t\tvideo7.load();\n\t\n\t\t\tvideo6.currentTime = 0;\n\t\t\tvideo6.style.opacity = \"1\";\n\t\t\tvideo6.play()\n\n\t\t\tvideo7.currentTime = 0;\n\t\t\tvideo7.style.opacity = \"1\";\n\t\t\tvideo7.play()\n\t\n\t\t}\n\t};\n\tvideo7.onended = function() {\n\t\tvideo7.currentTime = 0;\n\t\tvideo6.currentTime = 0;\n\t\tvideo6.style.opacity = \"0\";\n\t\tvideo7.style.opacity = \"0\";\n\n\t\tvideo8.load();\t\n\t\tvideo8.currentTime = 0;\n\t\tvideo8.style.opacity = \"1\";\n\t\tvideo8.play()\n\n\t\t\t\n\t};\n\tvideo8.onended = function() {\n\t\tvideo8.currentTime = 0;\n\t\tvideo8.style.opacity = \"0\";\n\n\t\tvideo10.load();\t\n\t\tvideo10.currentTime = 0;\n\t\tvideo10.style.opacity = \"1\";\n\t\tvideo10.play()\t\n\t};\n\tvideo9.onended = function() {\n\t\tvideo9.currentTime = 0;\n\t\tvideo9.style.opacity = \"0\";\n\n\t\tvideo10.load();\t\n\t\tvideo10.currentTime = 0;\n\t\tvideo10.style.opacity = \"1\";\n\t\tvideo10.play()\t\t\n\t};\n\tvideo10.onended = function() {\n\t\tvideo10.currentTime = 0;\n\t\tvideo10.style.opacity = \"0\";\n\t};\n\n\tvideo.onerror = function() {\n\t\talert(\"Chrome blocks Shia on this page:( Try on another one!\");\n\t};\n}", "function transformTestVideoStart(normRep, blackboard) {\n var raw = normRep.raw;\n blackboard.videoPath = raw.videoPath;\n blackboard.videoStartTS = raw.startTS;\n blackboard.videoDimensions = {\n width: raw.width,\n height: raw.height\n };\n // leave the normRep displaying this as unknown; we don't need a special type.\n}", "function init() {\n const rand = Math.random();\n const video_index = Math.floor(number_videos * rand);\n console.log(video_index);\n const vidPlayer = document.getElementById('videoPlayer');\n vidPlayer.innerHTML = `<source src=\"./goal/${video_index}\" type=\"video/mp4\">`;\n\n window.addEventListener('load', function() {\n console.log('loaded');\n vidPlayer.play();\n }, false);\n\n // const VP = document.getElementById('videoPlayer')\n // const VPToggle = document.getElementById('butt')\n\n // VPToggle.addEventListener('click', function() {\n // if (vidPlayer.paused) vidPlayer.play()\n // else vidPlayer.pause()\n // })\n}", "onPreviousVideo() {\n const { controller } = this.props;\n if (typeof controller.rewindOrRequestPreviousVideo === 'function') {\n controller.rewindOrRequestPreviousVideo();\n }\n }", "function forwardButtonTrigger() {\n if (window.currentVideoSelectedForPlayback) {\n setCurrentlyPlaying(false)\n const currentNode = window.currentVideoSelectedForPlayback\n const currentTime = currentNode.data.videoCore.currentTime\n const currentVideoEnd = currentNode.data.metadata.endTime\n\n if (currentTime + 1 < currentVideoEnd) {\n currentNode.data.videoCore.currentTime += 1\n } else if (currentNode.next) {\n const remainingTime = 1 - currentTime\n window.currentVideoSelectedForPlayback = currentNode.next\n const nextStartTime = window.currentVideoSelectedForPlayback.data.metadata.startTime\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = nextStartTime + remainingTime\n } else {\n window.currentVideoSelectedForPlayback.data.videoCore.currentTime = currentVideoEnd\n }\n renderUIAfterFrameChange(window.currentVideoSelectedForPlayback)\n }\n}", "function getVideoPosition(idVideo) {\n\n var video = document.getElementById(idVideo);\n\n var videoPosition = `${video.currentTime}`;\n return videoPosition\n\n}", "function startVideo($elm) {\n setTimeout(() => {\n var elm = $elm.find('video')[0];\n elm.play();\n }, 500);\n}", "setTimelineOffset() {\n const { playing } = this.player;\n const { container } = this.elements;\n // Values defining the speed of scrolling and at what points triggering the offset\n const { lowerSeek, upperSeek, upperPlaying, scrollSpeed } = this.timeline;\n // Retrieve the container positions for the container, timeline and seek handle\n const clientRect = container.getBoundingClientRect();\n const timelineRect = container.timeline.getBoundingClientRect();\n const seekPos = container.timeline.seekHandle.getBoundingClientRect();\n // Current position in the editor container\n const zoom = parseFloat(container.timeline.style.width);\n let offset = parseFloat(container.timeline.style.left);\n const seekHandlePos = parseFloat(container.timeline.seekHandle.style.left);\n // Retrieve the hover position in the editor container, else retrieve the seek value\n const percentage = (100 / clientRect.width) * (seekPos.left - clientRect.left);\n // If playing set lower upper bound to when we shift the timeline\n const upperBound = this.seeking ? upperSeek : upperPlaying;\n\n // Calculate the timeline offset position\n if (percentage > upperBound && zoom - offset > 100) {\n // If the seek handle is visibe move by scroll percentage else move into view\n if (percentage <= 100) {\n offset = Math.max(offset - (percentage - upperBound) / scrollSpeed, (zoom - 100) * -1);\n } else {\n offset = Math.max(offset - (percentage - upperBound), (zoom - 100) * -1);\n }\n } else if (percentage < lowerSeek) {\n // If the seek handle is visibe move by scroll percentage else move into view\n if (percentage >= 0) {\n offset = Math.min(offset - ((lowerSeek - percentage) / scrollSpeed) * -1, 0);\n } else {\n offset = Math.min(offset - (lowerSeek - percentage) * -1, 0);\n }\n }\n\n if (offset === parseFloat(container.timeline.style.left)) {\n return;\n }\n\n // Update the preview thumbnails\n this.setVideoTimelimeContent();\n\n // Apply the timeline seek offset\n container.timeline.style.left = `${offset}%`;\n\n // Only adjust the seek position when playing or seeking as we don't want to adjust if the current time is updated\n if (!(playing || this.seeking)) {\n return;\n }\n\n // Retrieve the position of the seek handle after the timeline shift\n const seekPosUpdated = container.timeline.seekHandle.getBoundingClientRect().left;\n const seekPercentage = clamp(seekHandlePos + (100 / timelineRect.width) * (seekPos.left - seekPosUpdated), 0, 100);\n\n container.timeline.seekHandle.style.left = `${seekPercentage}%`;\n\n // Show the corresponding preview thumbnail for the updated seek position\n if (this.seeking && this.previewThumbnailsReady) {\n const seekTime = this.player.duration * (seekPercentage / 100);\n this.player.previewThumbnails.showImageAtCurrentTime(seekTime);\n }\n }", "toStartingPosition() {\n\n for (let i = 0; i < this.frameCount; i++) {\n const frame = this[`frame${i}`];\n this.xLoc = 376;\n frame.style.left = `${this.xLoc}px`;\n this.yLoc = 512;\n frame.style.top = `${this.yLoc}px`;\n }\n\n }", "function firstPlay() {\r\n document.getElementsByTagName(\"video\")[0].innerHTML =\r\n '<source id=\"mp4\" src=\"' +\r\n movieInfo[0].src +\r\n '\" type=\"video/mp4\">' +\r\n '<source id=\"ogg\" src=\"' +\r\n movieInfo[0].src.substring(0, movieInfo[0].src.length - 3) +\r\n 'ogg\" type=\"video/ogg\">' +\r\n \"<h4>Your browser does not support the video tag.</h4>\";\r\n}", "showLocalVideo() {}", "function snap() {\n video.pause();\n snapButton.onclick = retake;\n snapButton.value = \"Retake\";\n canvas.style.display = \"block\";\n}", "function moveVideoFromGPS(video_index) {\n var major_time_milestone = 0;\n var previous_acted_milestone = -1;\n $(\"#\"+VIDEO[video_index].ElementID).on(\"timeupdate\", function(event){\n major_time_milestone = Math.floor(this.currentTime);\n if (major_time_milestone != previous_acted_milestone) {\n previous_acted_milestone = major_time_milestone;\n try {\n scene.traverse((node) => { \n if (node.uuid == VIDEO[video_index].UUID) {\n var new_position = new THREE.Vector3(\n VIDEO[video_index].PositionArray[major_time_milestone+1][0], \n VIDEO[video_index].PositionArray[major_time_milestone+1][3], \n VIDEO[video_index].PositionArray[major_time_milestone+1][1]);\n\n //node.position.x = new_position.x;\n //node.position.y = new_position.y;\n //node.position.z = new_position.z;\n\n //http://dotnetfollower.com/wordpress/2011/08/javascript-how-to-convert-latitude-and-longitude-to-mercator-coordinates/\n function LatLonToMercator(lat, lon) {\n var rMajor = 6378137;\n var shift = Math.PI * rMajor;\n var z = lon * shift / 180;\n var x = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);\n x = x * shift / 180;\n \n return {'Z': z, 'X': x};\n }\n\n var converted_coords = LatLonToMercator(new_position.x, new_position.z);\n\n var NEW_POSITION = new THREE.Vector3(converted_coords.X, new_position.y, converted_coords.Z);\n var tween = new TWEEN.Tween(node.position).to(NEW_POSITION, 1000).start();\n }\n });\n } catch { }\n }\n });\n}", "function setVideoProgress() {\n video.currentTime = (+progress.value * video.duration) / 100;\nPlayer: {email: user.email, client_id: 'football'}\n}", "function startPosition(){\n painting = true;\n }", "function retake() {\n video.play();\n snapButton.onclick = snap;\n snapButton.value = \"Capture\";\n document.getElementById(\"editor\").innerHTML = \"\";\n document.getElementById(\"calculate\").style.display = \"none\";\n canvas.style.display = \"none\";\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n}", "rewind() {\r\n\t\t\tthis.looping = false;\r\n\t\t\tthis.goToFrame(0);\r\n\t\t}", "function startVideo() {\n video.isReady = true;\n}", "function replayVideo() {\n var icon = document.getElementById(\"replay-icon\");\n var replayText = document.getElementById(\"play-again-txt\");\n var video = document.getElementById(\"save-sharing-video\");\n if (video.paused) {\n video.currentTime = 0;\n video.play();\n icon.style.display = \"none\";\n replayText.style.display = \"none\";\n }\n}", "function setCookieVideoPosition(idVideo) {\n var video = document.getElementById(idVideo);\n document.cookie = `${video.src}=${getVideoPosition(idVideo)}`;\n}", "function update_frame(v_index){\r\n\r\n\tif(v_index == 1){\r\n\t\tvideoT.currentTime = document.getElementById(\"slidebar_T\").value/100* videoT.duration;\r\n\t}\r\n\telse if(v_index ==2){\r\n\t\tvideoGP.currentTime = document.getElementById(\"slidebar_GP\").value/100 *videoGP.duration;\r\n\t}\r\n\telse{\r\n\t\talert(\"Error update_frame() : video index invalid\");\r\n\t}\r\n\r\n\r\n}", "resetVideo() {\n this.videoElt.pause();\n this.videoElt.currentTime = 0;\n this.videoElt.style.display = 'none';\n }", "goToFrame(frame) {\n this._video.onPlay();\n return this._video.gotoFrame(frame, true);\n }", "pos2frame(pos) {\n\n }", "function videoMoveuMouse(){\n\tif(layoutSeekTempo2 == \"\" || layoutSeekTempo2 == null){\n\t\tlayoutSeekTempo2 = setInterval(esconderLayout, layoutSeekTempo * 1000);\n\t\treturn;\n\t}\n\tclearInterval(layoutSeekTempo2);\n\tlayoutSeekTempo2 = setInterval(esconderLayout, layoutSeekTempo * 1000);\n\taparecerLayout();\n}", "function playmovie(){\r\n\tparent.cpCmndResume = true;\r\n\texportRoot.runTime_mc.pbcPause_mc.visible = true;\r\n\texportRoot.runTime_mc.pbcPlay_mc.visible = false;\r\n}", "function preload(){\n vid = createVideo(\"videos/2.mp4\");\n}", "function prevFrame(){\n // Protecting lower bounds\n if (frame === 1){\n console.log('No Previous Frame')\n return\n }\n setFrame(frame - 1)\n console.log('Previous Frame')\n playerRef.current.seekTo(frame / 60)\n console.log(frame)\n console.log(frame / 60)\n }", "_idle_video() {\n\t\t\tthis.video_panel.attr('loop', true);\n\t\t\tthis.video_src.attr('src', this.resource_path + 'idle.mp4');\n\t\t}", "function WeBack(theMode) {\n Mode = theMode;\n ModeCheck(Mode);\n\n areAnimated = [false, false, false, false];\n document.getElementById(\"nextVid\").style.display = \"none\";\n Learn_video.currentTime = 0;\n Learn_video.src = arrVideoList[0].name;\n Learn_video.play();\n console.log(arrVideoList[0].emotions);\n}", "function playx() {\n\t\t// compatibility.requestAnimationFrame(play);\n\t\tvar x = compatibility.requestAnimationFrame(playx); // play video streaming \n\t\tif (video.paused) { // play streaming video\n\t\t\tvideo.play();\n\t\t}\n\n\t\tif (video.readyState === video.HAVE_ENOUGH_DATA && video.videoWidth > 0) { // jika webcam berhasil mengcapture gambar real time user dan dimuat ke dala video \n\t\t// mirroring (flip horizontal)\n\t\t\t// video.style.cssText = \"-moz-transform: scale(-1, 1); \\\n\t\t\t// -webkit-transform: scale(-1, 1); -o-transform: scale(-1, 1); \\\n\t\t\t// transform: scale(-1, 1); filter: FlipH;\";\n\t\t// mirroring (flip vertical)\n\t\t\t// video.style.cssText = \"-moz-transform: scale(1, -1); \\\n\t\t\t// -webkit-transform: scale(1, -1); -o-transform: scale(1, -1); \\\n\t\t\t// transform: scale(1, -1); filter: FlipV;\";\n\n \t// Prepare the detector once the video dimensions are known:\n \tif (!detector) {\n\t\t\t\tvar width = ~~(60 * video.videoWidth / video.videoHeight);\n\t\t\t\tvar height = 60;\n\t \t\tdetector = new objectdetect.detector(width, height, 1.1, detectLib);\n\t \t\t// detector = new objectdetect.detector(1024, 720, 1.1, objectdetect.upperbody);\n\t \t}\n \t\t\n \t\t// Perform the actual detection:\n\t\t\tvar coords = detector.detect(video, 1); // objectdetect.js line 684\n\t\t\t// console.log(typeof (coords[0])); \t\t// object\n\t\t\t// console.log(coords[0]);\t\t \t\t\t// [45.09428000000002, 20.93663000000001, 32.210200000000015, 32.210200000000015, 1]\n \t\t\t\n \t\t\tif (coords[0]) {\n\t\t\t\tvar coord = coords[0];\n\t\t\t\tcoord = smoother.smooth(coord);\n\t\t\t\t// Rescale coordinates from detector to video coordinate space:\n\t\t\t\t\tcoord[0] *= video.videoWidth / detector.canvas.width;\t\t// x\n\t\t\t\t\tcoord[1] *= video.videoHeight / detector.canvas.height;\t\t// y\n\t\t\t\t\tcoord[2] *= video.videoWidth / detector.canvas.width;\t\t// width\n\t\t\t\t\tcoord[3] *= video.videoHeight / detector.canvas.height;\t// height\n\n\t\t\t\t\t\t// console.log('c[0]='+coord[0]);\n\t\t\t\t\t\t// console.log('l vid='+video.videoWidth);\n\t\t\t\t\t\t// console.log('l can='+detector.canvas.width);\n\n\t\t\t\t\t// Display shirt overlay: \n\t\t\t\t\t\t// shirt.style.left = ~~(coord[0] + coord[2] * 1.0/8 + video.offsetLeft) + 'px';\n\t\t\t\t\t\t// shirt.style.top = ~~(coord[1] + coord[3] * 0.8/8 + video.offsetTop) + 'px';\n\t\t\t\t\t\t// shirt.style.width = ~~(coord[2] * 6/8) + 'px';\n\t\t\t\t\t\t// shirt.style.height = ~~(coord[3] * 6/8) + 'px';\n\t\t\t\t\t\n\t\t\t\t\t//( original ) Display shirt overlay: \n\t\t\t\t\t// shirt.style.left = ~~(coord[0] + coord[2] * 1.0/8 + video.offsetLeft) + 'px';\n\t\t\t\t\t// shirt.style.top = ~~(coord[1] + coord[3] * 0.8/8 + video.offsetTop) + 'px';\n\t\t\t\t\t// shirt.style.width = ~~(coord[2] * 6/8) + 'px';\n\t\t\t\t\t// shirt.style.height = ~~(coord[3] * 6/8) + 'px';\n\t\t\t\t\t\n\t\t\t\t\t// edit 1\n\t\t\t\t\t\t// shirt.style.left = ~~(coord[0] + coord[2] * 1.0/8 + video.offsetLeft) + 'px';\n\t\t\t\t\t\t// shirt.style.top = ~~(coord[1] + coord[3] * 0.8/1.3 + video.offsetTop) + 'px';\n\t\t\t\t\t\t// shirt.style.width = ~~(coord[2] * 6.3/8) + 'px';\n\t\t\t\t\t\t// shirt.style.height = ~~(coord[3] * 8/8) + 'px';\n\n\t\t\t\t\t// edit 2\n\t\t\t\t\t\tshirt.style.left = ~~(coord[0] + coord[2] * 1.0/8 + video.offsetLeft) + 'px';\n\t\t\t\t\t\tshirt.style.top = ~~(coord[1] + coord[3] * 0.8/1.4 + video.offsetTop) + 'px';\n\t\t\t\t\t\tshirt.style.width = ~~(coord[2] * 6.3/8) + 'px';\n\t\t\t\t\t\tshirt.style.height = ~~(coord[3] * 8/8) + 'px';\n\t\t\t\t\t\t// shirt.style.height = ~~(coord[3] * 6.5/8) + 'px';\n\n\t\t\t\t\t\t// console.log('s left='+shirt.style.left);\n\t\t\t\t\t\t// console.log('s top='+shirt.style.top);\n\t\t\t\t\t\t// console.log('s width='+shirt.style.width);\n\t\t\t\t\t\t// console.log('s height='+shirt.style.height);\n\n\t\t\t\t\tshirt.style.opacity = 1;\n\t\t\t\t\tshirt.style.zIndex =2147483647;\n\n\t\t\t\t\tvar l1 = coord[0]; \n\t\t\t\t\tvar l2 = coord[2]; \n\t\t\t\t\tvar lebar =Math.abs(l2-l1); \n\t\t\t\t\t// alert('l1='+l1+' l2='+l2+' lebar='+lebar);\n\t\t\t\t\t\n\t\t\t\t\tvar t1 = coord[1]; \n\t\t\t\t\tvar t2 = coord[3]; \n\t\t\t\t\tvar tinggi =Math.abs(t2-t1); \n\t\t\t\t\t// alert('t1='+t1+' t2='+t2+' tinggi='+tinggi);\n\t\t\t\t\t\n\t\t\t\t$('#coord0Info').html(coord[0].toFixed(2));\n\t\t\t\t$('#coord1Info').html(coord[1].toFixed(2));\n\t\t\t\t\n\t\t\t\tvar w = coord[2].toFixed(2);\n\t\t\t\t// labelSize(w);\n\t\t\t\t// captureCollect(w);\n\t\t\t\tiCapture++;\n\t\t\t\tcalculation(w);\n\t\t\t} else { \n\t\t\t\t// var opacity = shirt.style.opacity - 0.2;\n\t\t\t\t// shirt.style.opacity = opacity > 0 ? opacity : 0;\n\t\t\t}\n\t\t}\n\t\tiPlayLoop++;\n\t\tsetInterval(loopLog,1000);\n\t}", "function onPlaybackSeeking() {\n lastIndex = Number.POSITIVE_INFINITY;\n isBufferingCompleted = false;\n onPlaybackProgression();\n }", "view_GameMovie(){\n let currMoviePlayInfo = this.model.getCurrentMoviePlayInfo();\n this.view.updateCurrentMoviePiece(currMoviePlayInfo[0][0], currMoviePlayInfo[0][1], currMoviePlayInfo[1][1]);\n this.view.redoPlay(currMoviePlayInfo[0][0], currMoviePlayInfo[0][1], currMoviePlayInfo[1][1]);\n this.state = 'WAIT_GM_ANIMATION_END';\n }", "function playWithoutDeleted_helper(full) {\n full = full || false;\n clearEvents2();\n if (editor.splitData && editor.splitData.splits) {\n var splitItem = getCurrentSplitItem();\n\n if (splitItem != null) {\n pauseVideo();\n\n var clipStartFrom = -1;\n var clipStartTo = -1;\n var segmentStart = splitItem.clipBegin;\n var segmentEnd = splitItem.clipEnd;\n var clipEndFrom = -1;\n var clipEndTo = -1;\n var hasPrevElem = true;\n var hasNextElem = true;\n var duration = getDuration();\n\n // check previous item to be played, get start time\n if ((splitItem.id - 1) >= 0) {\n hasPrevElem = true;\n if ((splitItem.id - 1) >= 0) {\n var prevSplitItem = editor.splitData.splits[splitItem.id - 1];\n while (!prevSplitItem.enabled) {\n if ((prevSplitItem.id - 1) < 0) {\n hasPrevElem = false;\n break;\n } else {\n prevSplitItem = editor.splitData.splits[prevSplitItem.id - 1];\n }\n }\n } else {\n hasPrevElem = false;\n }\n if (hasPrevElem) {\n clipStartTo = prevSplitItem.clipEnd;\n clipStartFrom = clipStartTo - prePostRoll;\n }\n }\n if (hasPrevElem) {\n clipStartFrom = (clipStartFrom < 0) ? 0 : clipStartFrom;\n }\n\n if (full) {\n if ((splitItem.id + 1) < editor.splitData.splits.length) {\n hasNextElem = true;\n var nextSplitItem = editor.splitData.splits[splitItem.id + 1];\n while (!nextSplitItem.enabled) {\n if ((nextSplitItem.id + 1) >= editor.splitData.splits.length) {\n hasNextElem = false;\n break;\n } else {\n nextSplitItem = editor.splitData.splits[nextSplitItem.id + 1];\n }\n }\n if (hasNextElem) {\n clipEndFrom = nextSplitItem.clipBegin;\n clipEndTo = clipEndFrom + prePostRoll;\n }\n }\n if (hasNextElem) {\n clipEndTo = (clipEndTo > duration) ? duration : clipEndTo;\n }\n } else {\n clipEndFrom = -1;\n clipEndTo = -1;\n var splBP2 = splitItem.clipBegin + prePostRoll;\n segmentEnd = (splBP2 <= splitItem.clipEnd) ? splBP2 : splitItem.clipEnd;\n segmentEnd = (segmentEnd > duration) ? duration : segmentEnd;\n }\n\n ocUtils.log(\"Play Times: \" +\n clipStartFrom + \" - \" +\n clipStartTo + \" | \" +\n segmentStart + \" - \" +\n segmentEnd + \" | \" +\n clipEndFrom + \" - \" +\n clipEndTo);\n\n if (hasPrevElem && ((full && hasNextElem) || !full)) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n }, (clipStartTo - clipStartFrom) * 1000);\n\n if (full) {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + (segmentEnd * 1000));\n }\n } else if (!hasPrevElem && hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n\n if (full) {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (segmentEnd * 1000));\n }\n } else if (hasPrevElem && !hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (clipStartTo - clipStartFrom) * 1000);\n } else if (!hasPrevElem && !hasNextElem) {\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n }\n }\n }\n}" ]
[ "0.6503766", "0.6483735", "0.6471824", "0.6385103", "0.63710624", "0.63526016", "0.6326265", "0.62359095", "0.6208896", "0.6198976", "0.6184221", "0.61513513", "0.613991", "0.6128529", "0.6114358", "0.610286", "0.6063831", "0.60608584", "0.6037987", "0.6035542", "0.5984169", "0.5947883", "0.5916542", "0.5908736", "0.5889047", "0.5881057", "0.5872861", "0.5849655", "0.5847918", "0.5841955", "0.5821393", "0.5821037", "0.5817086", "0.5799029", "0.5799029", "0.57840806", "0.57825255", "0.5777625", "0.5776396", "0.57734716", "0.57717633", "0.576998", "0.57697386", "0.57592946", "0.5751498", "0.57504284", "0.57452106", "0.57336724", "0.57322717", "0.57302356", "0.5729718", "0.57257676", "0.57082886", "0.5702055", "0.5699626", "0.5693471", "0.5688885", "0.5688885", "0.5683213", "0.5673855", "0.565437", "0.56476575", "0.5638617", "0.5630753", "0.56304264", "0.56286794", "0.56282955", "0.56246555", "0.5621356", "0.5619306", "0.56184083", "0.5608264", "0.5605407", "0.56027454", "0.55985767", "0.5595543", "0.55912596", "0.5591191", "0.5589139", "0.5584951", "0.55823165", "0.5575456", "0.55740654", "0.5571245", "0.5568026", "0.5557827", "0.55561626", "0.55557203", "0.55526114", "0.55524224", "0.55354995", "0.5525155", "0.55206865", "0.5519948", "0.5517343", "0.55160826", "0.5516061", "0.55118966", "0.550896", "0.55037975", "0.5501594" ]
0.0
-1
Fetch courses from database paginated
fetchCourses(page = 1) { axios.get(`${utilities.backendUrl}/courses`, {params: {page: page}}) .then((res) => { this.setState({ courses: res.data.courses.content, pagination: res.data.courses, pageNumbers: res.data.pageNumbers }); }) .catch((err) => console.log(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getCourses(){\r\n const pageNumber = 2;\r\n const pageSize=10;\r\n \r\n const courses= await Course\r\n .find({ author : 'Mosh', isPublished :true})\r\n .skip( (pageNumber-1) * pageSize )\r\n //formula for pagination is pagenumber-1 * pagesize\r\n .limit(10)\r\n .sort({name: 1})\r\n //.select({ name:1 , tags: 1}); \r\n //instead of displaying the data of documents we need to display the count of documents so we use .count()\r\n .count();\r\n console.log(courses);\r\n}", "function listCourses() {\n var courses = [];\n var pageToken = null;\n var optionalArgs = {\n pageToken: pageToken,\n pageSize: 100\n };\n while (true) {\n var response = Classroom.Courses.list(optionalArgs);\n var courses = response.courses;\n if (!pageToken) {\n break;\n }\n }\n if (courses.length === 0) {\n Logger.log(\"No courses found.\");\n } else {\n Logger.log(\"Courses:\");\n for (course in courses) {\n Logger.log('%s (%s)', courses[course].name, courses[course].id);\n }\n }\n}", "function listCourses() {\n console.log('It is hitting listCourses')\n var request = gapi.client.classroom.courses.list({\n pageSize: 10\n });\n\n request.execute(function(resp) {\n var courses = resp.courses;\n appendPre('Courses:');\n\n if (courses.length > 0) {\n for (i = 0; i < courses.length; i++) {\n var course = courses[i];\n appendPre(course.name)\n }\n } else {\n appendPre('No courses found.');\n }\n\n });\n }", "async function getCourses() {\n\n const pageNumber = 2;\n const pageSize = 10;\n\n const courses = await Course\n .find({ author: 'Vivek', isPublished: true })\n // .find()\n // .or([ {author: 'Vivek'}, {isPublished: false} ])\n // .and([])\n\n // // starts with Vivek\n // .find({ author: /^Vivek/ })\n // // ends with Malhan\n // .find({ author: /Malhan$/i }) // i for case-insensitive\n // // contains Vivek\n // .find({ author: /.*Vivek.*/ })\n\n // pagination - to get the documents in the given page\n .skip((pageNumber - 1) * pageSize)\n .limit(pageSize)\n\n .sort({ name: 1 })\n .select({ name: 1, tags: 1, author: 1, isPublished: 1 })\n // .estimatedDocumentCount();\n console.log(courses);\n}", "async function getAllCourses() {\n return await Course.find({});\n}", "function getCourses() {\n return breeze.EntityQuery\n .from(courseType.defaultResourceName)\n .using(manager)\n .execute()\n .then(function(data){\n return data.results;\n })\n }", "function getListCourse(){\n\t\t$http.get(app.baseUrl + \"admin/api/course/\" + $scope.categoryId).then(function(response) {\n\t\t\t$scope.courses = response.data;\n\t\t});\n\t}", "function getCourses() {\n /* Show loading info */\n document.getElementById('courseContainer').insertAdjacentHTML('beforeend', \"<p id='loadingNotice'>Loaded page <span id='pageNum'></span></p>\")\n\n var semesterId = document.getElementById('semesterList').value\n var courses = [];\n var bookmark = null;\n var morePages = true;\n var pageNum = 0;\n async.whilst(\n function () {\n return morePages == true;\n },\n function (callback) {\n var url = \"/d2l/api/lp/1.15/enrollments/myenrollments/?orgUnitTypeId=3\"\n if (bookmark !== null) {\n url += \"&Bookmark=\" + bookmark;\n }\n\n var semesterXhr = new XMLHttpRequest\n semesterXhr.open(\"GET\", url)\n semesterXhr.onload = function (e) {\n if (semesterXhr.status == 200) {\n pageNum++\n document.getElementById('pageNum').innerHTML = pageNum;\n var response = JSON.parse(semesterXhr.response)\n morePages = response.PagingInfo.HasMoreItems;\n bookmark = response.PagingInfo.Bookmark;\n courses.push.apply(courses, response.Items)\n } else {\n console.error(e)\n }\n callback(null, courses);\n }\n semesterXhr.send();\n },\n displayCourses\n );\n}", "function getCourses(req,res,next){\n courseService.getAllCourses(req).then(courses => {\n userService.getById(req.user.sub).then(x => {\n //x is our user\n let answer = [];\n if (x.role.toString().localeCompare('Guest') === 0){\n courses.forEach(element => {\n if (element.public){\n answer.push(element);\n }\n });\n res.json(answer);\n return;\n }\n let userCourses = x.courses;\n courses.forEach(element => {\n let current = userCourses.find(c => c.toString().localeCompare(element._id) == 0);\n if (current){\n answer.push(element);\n }\n });\n //Return the courses back to the user\n res.json(answer)\n }).catch(err => next(err));\n })\n}", "function getCourses(callback) {\n uwclient.get('/courses.json', function (err, res) {\n if (err) return callback(err, null);\n else return callback(null, res.data);\n });\n}", "async function getAllCourses() {\n const response = await fetch('/api/courses');\n return handleJsonResponse(response);\n}", "returnCourses() {\r\n this.log(`Getting list of courses...`);\r\n return this.context\r\n .retrieve(`\r\n SELECT title, Users.firstName || \" \" || Users.lastName As user\r\n FROM Courses\r\n INNER JOIN Users\r\n ON Courses.userId = Users.id\r\n `);\r\n }", "static async getCourseList(){\n const request = await fetch('https://tddd27-nikha864-backend.herokuapp.com/get_courses', {\n method: 'get'\n });\n return await request.json();\n }", "async function getCourses(){\n const result=await Course.\n find()\n .limit(2) // Number of records required\n .sort({name:1}) // sort in ascending order w.r.t name\n .select({author:\"Hamad\"}); // properties required by items\n\n\n console.log(\"Inside get Courses : \"+result);\n}", "async function searchCourses() {\n if (!isBrowser) {\n throw 'This method requires the window object.'\n }\n\n setIsLoading(true)\n\n if (abortPreviousRequest !== undefined) {\n abortPreviousRequest()\n }\n\n const controller = new AbortController()\n const signal = controller.signal\n abortPreviousRequest = controller.abort.bind(controller)\n\n const {\n data,\n meta\n } = await fetchCourses({\n searchQuery,\n sort: searchSort,\n ...(typeof searchFilterTopicId === 'string' && searchFilterTopicId !== 'all_topics' ? { filterTopic: parseInt(searchFilterTopicId) } : {}),\n filterLevel: searchFilterLevels,\n filterLanguage: searchFilterLanguageId,\n ...(typeof searchFilterLanguageId === 'string' && searchFilterLanguageId !== 'all_languages' ? { filterLanguage: parseInt(searchFilterLanguageId) } : {}),\n pageNumber,\n }, signal)\n\n setCourses(data)\n setLastSearchQuery(searchQuery)\n setResultsMeta(meta)\n\n setIsLoading(false)\n }", "async function getCoursesPage(page, subject, number, term) {\n const db = getDBReference();\n const collection = db.collection('courses');\n const count = await collection.countDocuments();\n\n /*\n * Compute last page number and make sure page is within allowed bounds.\n * Compute offset into collection.\n */\n const pageSize = 10;\n const lastPage = Math.ceil(count / pageSize);\n page = page > lastPage ? lastPage : page;\n page = page < 1 ? 1 : page;\n const offset = (page - 1) * pageSize;\n\n let query = {}\n if (subject) {\n query['subject'] = subject;\n }\n if (number) {\n query['number'] = parseInt(number);\n }\n if (term) {\n query['term'] = term;\n }\n\n const results = await collection.find(query)\n .sort({ _id: 1 })\n .skip(offset)\n .limit(pageSize)\n .toArray();\n\n return {\n courses: results,\n page: page,\n totalPages: lastPage,\n pageSize: pageSize,\n count: count\n };\n}", "@action\n loadMore () {\n this.set('offset', this.offset + 8);\n this.fetchAllCourses.perform();\n }", "function LoadUserCourses() {\n lessonFactory.LoadUserCourse($rootScope.currentUser.id).then(function (result) {\n $scope.allCourses = result;\n //$scope.allCourses = filterByUser;\n })\n }", "async function getCoursesFromApi (accountNumber) {\n var courses = await canvas.get(`/api/v1/accounts/${accountNumber}/courses`);\n return courses.map( course => limitObjectKeys(course, outputKeys) );\n }", "function getEnrolledCourses(user, goto, res) {\n // get user enrolled classes\n var user_classes = user.courses;\n var class_details = [];\n var returnObj;\n\n // create query to link userClasses with courses model to get class info\n user_classes.forEach(course => {\n class_details.push(course);\n });\n\n db.collection('courses').find({courseId: {\"$in\":class_details}}).toArray(function (err, result) {\n returnObj = result;\n var gotoUrl = \"/view/\" + goto +\"\";\n return res.render(__dirname + gotoUrl, {print:result});\n });\n}", "function loadCourses(enrolledCourses) {\n\t\tvar method = 'GET';\n\t\tvar req = JSON.stringify({});\n\t\tvar url = './courses?';\n\t\tvar n = enrolledCourses.length;\n\t\tfor (var i = 0; i < n - 1; i++) {\n\t\t\turl = url + 'course_id[]=' + enrolledCourses[i] + '&';\n\t\t}\n\t\turl = url + 'course_id[]=' + enrolledCourses[n - 1];\n\t\t//alert(url);\n\t\tajax(method, url, req,\n\t\t\t// Successful callback\n\t\t\tfunction (res) {\n\t\t\t\tvar availableCourses = JSON.parse(res);\n\t\t\t\t//alert(availableCourses[0]);\n\t\t\t\tif (availableCourses.length != 0 ) {\n\t\t\t\t\tlistCoursesInSelector(availableCourses);\n\t\t\t\t}\n\t\t}\n\t\t);\n\t}", "async function getCourses() {\n return await microcredapi.get(`/unit/${window.localStorage.getItem('userId')}`).then(response => {\n setCourses(response.data.units);\n })\n }", "getCourses() {\n return axios\n .get(this.apiUrl() + \"/courses/\", {\n headers: this.authHeader(),\n })\n }", "function getCourses () {\n return [\n {id: 'csc148h1'},\n {id: 'csc165h1'},\n {id: 'csc240h1'},\n {id: 'cog250y1'},\n {id: 'eng110y1'},\n {id: 'eng140y1'},\n {id: 'eng150y1'},\n {id: 'bio130h1'},\n {id: 'bio150y1'},\n {id: 'chm138h1'},\n {id: 'chm139h1'},\n {id: 'phl100y1'},\n {id: 'new232y1'}\n ];\n}", "async function readCourses() {\n const pageNumber = 1;\n const pageSize = 10;\n const filter1 = { name: 'Angular Course' };\n const filter2 = { name: 'Node.js Course' };\n const filter3 = { name: /\\./ };\n const doubleFilter = [filter1, filter2];\n const courses = await Course.find(filter3)\n .limit(pageSize)\n .skip((pageNumber - 1) * pageSize)\n .sort({ name: 1 })\n .count();\n console.log(courses);\n}", "async function getCourses() {\n const courses = await Course.find({ author: \"Mosh\", isPublished: true });\n console.log(courses);\n}", "function loadCourses() {\n var limit = 100;\n var skip = 0;\n var popOut = false;\n\n request(\"https://cobalt.qas.im/api/1.0/courses\" + cobalt + \"&limit=10\", function(err, resp, body) {\n if (err) {\n return console.log(\"Failed to connect, falling back to previous data.\");\n }\n\n if (resp.statusCode != 200) {\n return console.log(\"Did not get proper error code, falling back to previous data.\");\n }\n });\n\n // Need to implement a check if a connection can be successfully established, we drop the coursesData relation\n // Otherwise stop, dont process anything and just use pre-existing data.\n CourseData.remove({}, function(err) {\n if (err) {\n console.log(\"Failed to remove courses.\");\n return true;\n } else {\n console.log(\"Successfully removed courses.\");\n }\n });\n\n\n while (popOut == false || skip < 7000) {\n\n var searchUri = \"https://cobalt.qas.im/api/1.0/courses?key=\" + cobalt + \"&limit=\" + limit + \"&skip=\" + skip;\n console.log(searchUri);\n\n popOut = request(searchUri, function(err, resp, body) {\n if (err) {\n console.log(\"Error connecting to Cobalt, falling back to pre-existing data.\");\n return true;\n }\n\n if (resp.statusCode != 200) {\n console.log(\"Cobalt API returned a different status code than expected: \" + resp.statusCode);\n return true;\n }\n\n if (body == null) {\n console.log(\"Empty body\");\n } else {\n var courseInfo = JSON.parse(body);\n console.log(\"Attempting to insert...\");\n\n CourseData.insertMany(courseInfo, function(err, docs) {\n if (err) {\n console.log(\"Failed to add set into database.\");\n } else {\n console.log(docs.length + \" courses were successfully inserted into the database.\");\n }\n });\n }\n });\n skip += 100;\n }\n}", "function getStudentCourses (req, res, next) {\n\n req.db.collection(\"courses\").aggregate([\n { \"$unwind\": \"$course_offerings\" },\n { $match: {\"course_offerings.students.student_id\": getMongoId(req.token.student_id, next)} },\n { $sort : { \"begin_data\" : 1 } }\n \n ]).toArray(sendJSON.bind(res));\n\n\n}", "function getAllCourseAPI(){\n\t\n\tvar userId = document.getElementById(\"uId\").value;\n\t\n\tfetch(path+\"/getAllCoursesDashboard/\"+userId,{\n\t\t\n\t\tmethod: \"GET\",\n\t headers: {\n\t \"Content-Type\": \"application/json\",\n\t },\n\t\t\n\t})\n\t.then((response)=>response.json())\n\t.then((courses)=>{\n\t\tconsole.log(\"successfully fecth all data\", courses);\n\t\tif(courses){\n\t\t\tpopulateCourse(courses);\n\t\t}\n\t})\n\t.then((error)=>{\n\t\t\n\t\treturn null;\n\t\t\n\t});\n\t\n}", "async getCourses() {\n const response = await this.api('/courses');\n if (response.status === 200) {\n return response.json().then(data => data);\n } \n else if (response.status === 500) {\n return null;\n }\n else {\n throw new Error();\n }\n }", "async function getCourses() {\n const allCourses = await Course.find();\n console.log(allCourses);\n}", "function findCourseEntries(req,res,next){cov_24nw12t5lg.f[24]++;var id=(cov_24nw12t5lg.s[106]++,req.query.id);cov_24nw12t5lg.s[107]++;User.getUserById(id,{},function(err,user){cov_24nw12t5lg.f[25]++;cov_24nw12t5lg.s[108]++;if(err){cov_24nw12t5lg.b[46][0]++;cov_24nw12t5lg.s[109]++;res.status((cov_24nw12t5lg.b[48][0]++,err.code>=100)&&(cov_24nw12t5lg.b[48][1]++,err.code<600)?(cov_24nw12t5lg.b[47][0]++,err.code):(cov_24nw12t5lg.b[47][1]++,500)).send({success:false,message:err.message});}else{cov_24nw12t5lg.b[46][1]++;}//res.json(user);\ncov_24nw12t5lg.s[110]++;req.body.courses=user.toObject().course_list;cov_24nw12t5lg.s[111]++;req.body.prof_courses=user.toObject().teaching_course_list;cov_24nw12t5lg.s[112]++;next();});}", "function findCourseEntries(req,res,next){cov_24nw12t5lg.f[20]++;var id=(cov_24nw12t5lg.s[99]++,req.query.id);cov_24nw12t5lg.s[100]++;User.getUserById(id,'course_list',function(err,user){cov_24nw12t5lg.f[21]++;cov_24nw12t5lg.s[101]++;if(err){cov_24nw12t5lg.b[40][0]++;cov_24nw12t5lg.s[102]++;res.status((cov_24nw12t5lg.b[42][0]++,err.code>=100)&&(cov_24nw12t5lg.b[42][1]++,err.code<600)?(cov_24nw12t5lg.b[41][0]++,err.code):(cov_24nw12t5lg.b[41][1]++,500)).send({success:false,message:err.message});}else{cov_24nw12t5lg.b[40][1]++;}//res.json(user);\ncov_24nw12t5lg.s[103]++;req.body.courses=user.toObject().course_list;cov_24nw12t5lg.s[104]++;console.log(\"\\n\"+req.body.courses+\"\\n\");cov_24nw12t5lg.s[105]++;next();});}", "async function getAllCourses() {\n const courseList = await CourseModel.find();\n console.log(courseList);\n}", "async function getEnrollments(){\n let PER_PAGE = 100;\n let url = CANVAS_API_BASE + `/courses/${COURSE.canvas_id}/enrollments?per_page=${PER_PAGE}&type=StudentEnrollment&access_token=${CANVAS_KEY}`\n let req = { method:'GET', uri: url, resolveWithFullResponse: true }; //request \n let enrollmentsRes = await request(req); //has full data\n let enrollments = JSON.parse(enrollmentsRes.body); //get initial enrollments\n let studentIds = enrollments.map((item) => {\n return {\n canvas_id: item.user.id, \n uwnetid: item.user.login_id,\n display_name: item.user.sortable_name\n }\n });\n\n let paginationLinks = enrollmentsRes.caseless.dict.link;\n let nextLink = paginationLinks.split(\",\").filter((link) => link.includes(\"next\"))[0]\n if(nextLink) { //if paginated\n let nextLinkUrl = nextLink.slice(1, nextLink.indexOf('>'))\n enrollments = await request({method:'GET', uri:`${nextLinkUrl}&access_token=${CANVAS_KEY}`}).then(JSON.parse) //get the page\n studentIds = studentIds.concat(enrollments.map((item) => {\n return {\n canvas_id: item.user.id, \n uwnetid: item.user.login_id,\n display_name: item.user.sortable_name\n }\n }))\n }\n\n return studentIds;\n}", "function get_courses(req, res, next) {\n let user_id = req.query.user_id;\n let year = req.query.year;\n let semester = req.query.semester;\n let email = req.query.email;\n\n let knex_query = knex.select('courses.course_id', 'courses.course_name', 'courses.user_id', 'courses.semester', 'courses.year', 'users.email')\n .from('courses');\n\n if(user_id === undefined) {\n knex_query.leftJoin('users', 'users.user_id', '=', 'courses.user_id');\n } else {\n knex_query.innerJoin('users', 'users.user_id', '=', 'courses.user_id')\n .andWhere('courses.user_id', '=', user_id);\n }\n\n if(year !== undefined) {\n knex_query.andWhere('courses.year', '=', year);\n }\n\n if(semester !== undefined) {\n knex_query.andWhere('courses.semester', '=', semester);\n }\n\n if(email !== undefined) {\n knex_query.andWhere('users.email', '=', email);\n }\n\n knex_query = knex_query.toSQL().toNative();\n\n let query = db.query(knex_query.sql, knex_query.bindings);\n query.then(result => {\n Promise.all(result.rows.map(course => {\n return get_forms(course).then(forms => {\n // There was an error\n if (!forms) {\n res.json({error: 'Error fetching course data'});\n return;\n } else {\n course.forms = forms;\n return course;\n }\n })\n })).then(data => {\n res.json({courseData: data});\n });\n }).catch(err => {\n console.error('Error in users: ', err);\n res.json({error: 'Error fetching course data'});\n });\n}", "async function loadCourses() {\n const dept_id_here = document.forms[0].elements[0];\n const dept_id_for_data = dept_id_here.value.substring(0, 4);\n\n await fetch(\"/getCourses/\" + dept_id_for_data, {\n method: \"GET\",\n })\n .then((fromServer) => fromServer.json())\n .then((fromServer) => {\n courses = fromServer;\n });\n}", "function getCourses(program) {\n\n // loading\n $('#spin1').show();\n\n // mongo db MLab API query\n var query = \"{\\\"programs\\\":{\\\"$in\\\":[\\\"\" + program + \"\\\"]}}\"\n\n // get listed requirements for requested program\n $.ajax({\n // don't want to asyncronously render graph without data\n async: false,\n dataType: \"json\",\n url: \"https://api.mlab.com/api/1/databases/bluetest/collections/courses3?q=\" + query + \"&apiKey=\" + API_KEY,\n success: function(progCourses) {\n //singles = data;\n courses = progCourses;\n }\n });\n\n // get user course history\n // TODO: user minerva API\n $.ajax({\n async: false,\n global: false,\n dataType: \"json\",\n url: \"user_details/user-1.json\",\n success: function(userCourses) {\n coursesTaken = userCourses;\n }\n });\n\n}", "function refreshCourses() {\n // For spinner's loading control\n var loading = true;\n _.assign($scope, { loading: loading });\n // CoursesService.list() lists all the courses from the backend\n CoursesService.list().then(function (data) {\n // The courses are stored in $scope.courses\n var courses = data;\n _.assign($scope, { courses: courses });\n }).finally(function () {\n // after request is done, spinner will disappear\n var loading = false;\n _.assign($scope, { loading: loading });\n });\n return $scope.courses;\n }", "async function getCourses(){\n const courses = await Course\n .find( { isPublished: true, tags: { $in: ['backend', 'frontend'] } } )\n .sort({price: -1})\n .select({name: 1, author: 1});\n console.log(courses);\n}", "function _getCourseList (callback) {\n\t\t_setNotice('loading course list...');\n\n\t\tfetch(_buildApiUrl('courselist'))\n\t\t\t.then((response) => response.json())\n\t\t\t.then((json) => {\n\t\t\t\t//console.log('json.status=' + json.status);\n\t\t\t\tif (json.status !== 'success') {\n\t\t\t\t\t_setNotice(json.message);\n\t\t\t\t}\n\t\t\t\t//console.log('json.data: ' + JSON.stringify(json.data));\n\t\t\t\tsettings.courseList = json.data.courselist;\n\t\t\t\t_setNotice('');\n\t\t\t\tcallback();\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t_setNotice('Unexpected error loading course list');\n\t\t\t\tconsole.log(error);\n\t\t\t})\n\t}", "function list(params) {\n return new Promise( (resolve, reject) => {\n let result = new Array();\n connection.query(\n 'SELECT * FROM course '+\n 'left join course_tag on course_tag.course_id = course.course_id '+\n 'WHERE course_tag.tag_id in (?)',\n params['tag_ids'],\n async (error, courses) => {\n if(error) reject(\"Something wrong has happend with database!\");\n else if(courses.length) {\n for(course of courses) {\n await getTeachers(course['course_id'])\n .then( teachers => {\n result.push({\n \"course_id\": course['course_id'],\n \"course_name\": course['course_name'],\n \"course_intro\": course['course_intro'],\n \"course_capacity\": course['course_capacity'],\n \"course_price\": course['course_price'],\n \"course_status\": course['course_status'],\n \"created_time\": course['created_time'],\n \"course_start_time\": course['course_start_time'],\n \"course_hours\": course['course_hours'],\n \"course_mode\": course['course_mode'],\n \"teachers\": teachers\n });\n });\n }\n resolve(result);\n }\n else reject(\"Not found any course!\");\n }\n )\n });\n}", "function showCourses() {\n\tif (xRequest.readyState == 4) {\n\t\tvar response = xRequest.responseXML;\n\t\tif (response) {\n\t\t\tvar courses = response.getElementsByTagName('course');\n\t\t\tcontainerDiv = $(\"#coursesInner\");\n\n\t\t\tif (courses.length == 0) {\n\t\t\t\tprintNoResults();\n\t\t\t} else {\n\t\t\t\tprintCourses(courses);\n\t\t\t}\n\t\t}\n\t}\n}", "function loadCourseList(){\n\tget(\"searchlist/load_list/\", function(){\n\t\tcourseList = arguments[0].split(\",\");\n\t});\n}", "function getCurrentCourses(student_id) {\n let json = {};\n let query = `SELECT * \n FROM Course\n WHERE Course.Student_Id = ${student_id};`;\n\n connection.on(\"connect\", err => {\n if (err) {\n console.error(err.message);\n } else {\n console.log(\"Reading rows from the Table...\");\n\n // Read all rows from table\n const request = new Request(\n query,\n (err, rowCount) => {\n if (err) {\n console.error(err.message);\n } else {\n console.log(`${rowCount} row(s) returned`);\n }\n }\n );\n \n request.on(\"row\", columns => {\n console.log(columns)\n });\n \n connection.execSql(request);\n }\n});\n}", "function allUserCourses (req,res) {\n model.User_Course.findAll()\n .then(usersCourses => res.send(usersCourses))\n //res.sendStatus(200);})\n .catch(err => console.log(err));\n}", "async function getCourses() {\n const courses = await Course\n .find().sort({author: -1});\n console.log(courses);\n}", "function findAll(callback)\n{\n\tCourse.find(callback);\n}", "async function getInformationCourses(idCourses){\n let courses =[];\n for(let i = 0; i<idCourses.length; i++){\n let id_course = idCourses[i].courseId;\n let course = await Course.findOne({_id:id_course}).exec();\n let newCourse = {\n idCourse: id_course,\n name: course.name,\n code: course.code,\n gpa: idCourses[i].gpa,\n score: idCourses[i].score\n }\n courses.push(newCourse);\n }\n return courses;\n}", "async function getCourses(){\r\n const courses= await Course\r\n //.find()\r\n //Javascript constructor that we used to store multiple values is \"ARRAY[]\"\r\n //To display author of the course is Mosh or book published is true we use \"or\" operator\r\n .or([ {author: 'Mosh'},{isPublished:true} ])\r\n \r\n //To display author of the course is Mosh and book is published is true we use \"and\" operator\r\n\r\n .and([ {author: 'Mosh'},{isPublished:true} ])\r\n\r\n\r\n .limit(10)\r\n .sort({name: 1})\r\n .select({ name:1 , tags: 1}); \r\n console.log(courses);\r\n}", "function getCompositeCourse(handler) {\n let offset = handler.params.offset;;\n let limit = handler.params.limit;;\n let level = handler.params.level;\n\n handler.url = COMPOSITE_COURSE_URL.replace(/\\{offset\\}/i, offset).replace(/\\{limit\\}/i, limit).replace(/\\{level\\}/i, level);\n\n return network.GET(handler);\n}", "function loadMyCourses() {\n\t\tlet userId = sessionStorage.getItem('userId');\n\n\t\tauthorService.loadAuthorByUserId(userId)\n\t\t\t.then(author => {\n\t\t\t\tlet authorId = author._id;\n\t\t\t\tcoursesService.loadOwnCourses(authorId)\n\t\t\t\t\t.then((myOwnCourses) => {\n\t\t\t\t\t\tconsole.log(myOwnCourses);\n\t\t\t\t\t\tdisplayMyOwnCourses(myOwnCourses);\n\t\t\t\t\t});\n\n\t\t\t}).catch(handleError);\n\t}", "function loadCourseSearchResultsPage(ccyys, type, options, next, callback) {\n let optionsStr = querystring.stringify(options);\n let url = \"https://utdirect.utexas.edu/apps/registrar/course_schedule/\"\n + encodeURIComponent(ccyys)\n + (next == null ?\n \"/results/?ccyys=\"\n + encodeURIComponent(ccyys)\n + \"&search_type_main=\"\n + encodeURIComponent(type)\n + (optionsStr == \"\" ? \"\" : \"&\" + optionsStr)\n :\n \"/results/\" + next);\n request.get({\n url: url,\n jar: login.jar\n }, function(err, data) {\n if(err) throw err;\n\n const $ = cheerio.load(data['body']);\n\n if($(\"div.error\").length) {\n console.error(\"Potential error from page: \" + $(\"div.error\").text().trim());\n }\n\n let children = $(\"table.results.rwd-table > tbody\").children();\n let courses = [];\n\n //State variables that hold the current information about a course\n let current_course_title = null;\n let current_course_uniques = null;\n\n //List of courses with information finished\n for(let i = 0; i < children.length; i++) {\n let e = $(children[i]);\n if(e.prop(\"tagName\").toLowerCase() != \"tr\") {\n //we have something that's not a table throw\n console.warn(\"Found element: \" + e.prop(\"tagName\") + \" in tbody\" +\n \" children. Skipping...\");\n continue;\n }\n\n /*\n * Here's how this part works. There are a series of 'tr's\n * in the element 'table.results.rwd-table > tbody'. Each connection\n * of these 'tr's is used to make a list of all the courses numGrandchilds\n * their uniques. Some 'tr's contain just one child, in which case it\n * is a title 'tr'. Others contain 9 children, which mean they are\n * uniques, and their children have the information about said unique.\n * The title 'tr' comes before all of its unique 'tr's, and then a new\n * title 'tr' comes after to signal that a new list of uniques is coming\n * along as well.\n */\n\n let numGrandchilds = e.children().length;\n if(numGrandchilds == 1) {\n //this is a title element\n if(current_course_title != null) {\n //push previous course and then start this new course\n courses.push({\n \"title\": current_course_title,\n \"uniques\": current_course_uniques\n });\n }\n current_course_title = e.text().trim();\n current_course_uniques = [];\n } else if(numGrandchilds == 9 || numGrandchilds == 8) {\n //this is a unique\n if(current_course_uniques == null) {\n console.error(\"Unique listed before title in course search.\");\n current_course_uniques = [];\n }\n\n //Generate unique object\n current_course_uniques.push(unique.createUniqueFromElement($, e));\n } else {\n console.warn(\"Warning: cannot handle tr with \" + numGrandchilds + \" grandchildren.\");\n }\n }\n\n if(current_course_title != null) {\n //Push whatever course was being filled in before loop ended\n courses.push({\n \"title\": current_course_title,\n \"uniques\": current_course_uniques\n });\n }\n\n callback($(\"#next_nav_link\").attr == undefined ?\n null\n : $(\"#next_nav_link\").attr(\"href\"),\n courses);\n });\n}", "function loadAllApprovedCourses() {\n\t\tcoursesService.loadAllApprovedCourses()\n\t\t\t.then((allCourses) => {\n\t\t\t\tdisplayCatalog(allCourses);\n\t\t\t}).catch(handleError);\n\t}", "function getCourses() {\n var path = window.location.pathname\n var fields = path.split('/')\n var collegeBack = fields[1] + \"/\" + fields[2]; \n var college = fields[2].toUpperCase(); //Retrieves the college from the path name\n\n $(\"#collegeAbbr\").text(college);\n \n $.get(path + \"/getCourses\", function (data) {\n var courses = \"\";\n\n for (var i = 0; i < data.length; i++) {\n if (college === data[i].college_abbreviation) { //Only adds courses that with the college in the path name\n courses += \" <div id='collegewrap'> <a href='\" + path + \"/\" + data[i].course_code + \"'> <div id='contentwrap'> <div class='container'> <div class='row'> <div class='col-lg-4'> <h4 class='course'>\" + data[i].course_name + \"</h4> </div> <div class='col-lg-4'></div> <div class='col-lg-4'> <h4 class='course'>\" + data[i].course_code + \"</h4> </div> </div> <div class='row'> <div class='col-xs-12'> <h5>Course Leader : \" + data[i].course_leader + \"</h5> </div> </div> </div> </div> </a> </div>\"}\n }\n\n if(courses === \"\") { //Alters the heading if there is no courses\n $(\"#courses\").prev().text(\"There are currently no courses for this college!\");\n }\n\n $(\"#courses\").html(courses);\n });\n }", "async function getListCourse() {\n return await Course\n .find({isPublished: true})\n .or([\n {price: {$gte: 15}}\n , {name: /.*by.*/i}\n ])\n .sort({name: 1})\n .select({name: 1, author: 1});\n}", "getAllChapters(req, callback) {\n var self = this;\n var reqObj = req.body;\n var errorResponseObj = {\n status: false,\n data: {},\n };\n let responseObject = {};\n const courseTableName = \"course\";\n\n let query = {};\n\n query = {\n curriculumCode: reqObj.curriculumCode,\n subject: reqObj.subject,\n topic: reqObj.topic\n };\n var criteria = {\n condition: query,\n projection: { chapters: 1 }\n };\n\n self.apiServiceInstance.findDataAll(courseTableName, criteria, function (err, chaptersData) {\n if (chaptersData.length > 0) {\n let [{ chapters }] = chaptersData;\n responseObject['status'] = true;\n responseObject['data'] = chapters;\n callback(null, responseObject);\n } else {\n console.log('chapters data not listed at getAllChapters. Due to -', err);\n errorResponseObj['error'] = err;\n callback(err, errorResponseObj);\n }\n });\n }", "function getNewCourses(fetchedCourses){\n\tlet iterate = true\n\tlet index = 0\n\tlet length = fetchedCourses.length\n\tlet count = 0\n\twhile(index < length){\n\t\tlet currentCourse = fetchedCourses[index]\n\t\tlet currentCourseId = currentCourse.id\n\t\tindex++\n\t\tcoursesDb.find({\n\t\t\tid: currentCourseId\n\t\t}, function(err, docs){\n\t\t\tif(docs.length === 0){\n\t\t\t\tnewCourseIds.push(currentCourseId)\n\t\t\t\tnewCourses.push(currentCourse)\n\t\t\t}\n\t\t\tcount++\n\t\t\tif(count === length){\n\t\t\t\titerate = false\n\t\t\t\tsyncLessons()\n\t\t\t}\n\t\t})\n\t}\n}", "getStudentCourses(studentid) {\n return Boekingen.find({$and:[{Student: studentid},{Academiejaar: currentAcademiejaar }]})\n }", "function syncCourses(offlineCourseCount){\n\trequest(coursesAPI, function(err, response, body){\n\t\tif(err){\n\t\t\tconsole.log(err)\n\t\t}\n\t\tlet result = JSON.parse(body)\n\t\tif(result.context.length > offlineCourseCount){\n\t\t\tgetNewCourses(result.context)\n\t\t}\n\t})\n}", "function displayCatalog(allCourses) {\n\t\tlet coursesContainer = $('#allForumCourses');\n\t\tcoursesContainer.empty();\n\n\t\tif (allCourses.length === 0) {\n\t\t\tcoursesContainer.text('No courses in database.');\n\t\t}\n\n\t\tlet counter = 1;\n\t\tfor (let courseObj of allCourses) {\n\t\t\tlet courseId = courseObj['_id'];\n\t\t\tlet rank = counter++;\n\t\t\tlet timeCreated = calcTime(courseObj._kmd.ect);\n\t\t\tlet authorId = courseObj['authorId'];\n\t\t\tlet categoryId = courseObj['categoryId'];\n\t\t\tlet imageUrl = courseObj['imageUrl'];\n\t\t\tlet price = courseObj['price'];\n\t\t\tlet duration = courseObj['duration'];\n\t\t\tlet place = courseObj['place'];\n\t\t\tlet likes = courseObj['likes'];\n\t\t\tlet views = courseObj['views'];\n\n\n\t\t\tlet detailsLink = $(`<a href=\"#\" data-id=\"${courseId}\">Details</a>`)\n\t\t\t\t.click(loadCourseDetails);\n\t\t\tlet courseDiv = $('<div class=\"post\">')\n\t\t\t\t.append($('<div class=\"col rank\">')\n\t\t\t\t\t.append('<span>').text(rank))\n\t\t\t\t.append($('<div class=\"col thumbnail\">')\n\t\t\t\t\t.append($(`<img src=\"${imageUrl}\">`)))\n\t\t\t\t.append($('<div class=\"post-content\">')\n\t\t\t\t\t.append($('<div class=\"title\">')\n\t\t\t\t\t\t.text(categoryName)))\n\t\t\t\t.append($('<div class=\"details\">')\n\t\t\t\t\t.append($('<div class=\"info\">')\n\t\t\t\t\t\t.text(`submitted ${timeCreated} ago by ${authorFullName}`))\n\t\t\t\t\t.append($('<div class=\"controls\">')\n\t\t\t\t\t\t.append($('<ul>')\n\t\t\t\t\t\t\t.append($('<li class=\"action\">').append(detailsLink)))));\n\n\t\t\tif (authorId === sessionStorage.getItem('userId')) {\n\t\t\t\tlet controls = courseDiv\n\t\t\t\t\t.find('.controls')\n\t\t\t\t\t.find('ul');\n\n\t\t\t\tcontrols.append($('<li class=\"action\">')\n\t\t\t\t\t.append($(`<a href=\"#\" data-id=\"${courseId}\">Delete</a>`)\n\t\t\t\t\t\t.click(deleteCourse)));\n\t\t\t\tcontrols.append($('<li class=\"action\">')\n\t\t\t\t\t.append($(`<a href=\"#\" data-id=\"${courseId}\">Edit</a>`)\n\t\t\t\t\t\t.click(displayEditForm)));\n\t\t\t}\n\n\t\t\tcoursesContainer.append(courseDiv);\n\t\t}\n\t}", "getStudentCourse(gid) {\n let s = this.getStudent(gid);\n return s.courses;\n\n }", "function get_cargoes(req) {\n var q = datastore.createQuery(CARGO).limit(PAGE_LIMIT);\n const cargo_results = {}; // Object to hold query results\n if(Object.keys(req.query).includes(\"cursor\")) {\n q = q.start(req.query.cursor); // Set start of next page\n \n }\n return datastore.runQuery(q).then((entities) => {\n cargo_results.items = entities[0].map(ds.fromDataStore); // 0 Index holds results\n // Check for additional pages\n if(entities[1].moreResults !== ds.Datastore.NO_MORE_RESULTS) {\n cargo_results.next = req.protocol + \"://\" + req.get(\"host\") + req.baseUrl\n + \"?cursor=\" + entities[1].endCursor; \n }\n return cargo_results;\n });\n}", "getSubjectsForCourse(req, callback) {\n var self = this;\n var reqObj = req.body;\n var errorResponseObj = {\n status: false,\n message: \"Subjects are not available for this curriculum\",\n };\n var responseObject = {};\n var curriculumTableName = \"subject\";\n\n let query = {\n curriculumCode: reqObj.curriculumCode\n };\n var criteria = {\n condition: query,\n sortOrder: { _id: 1 },\n projection: { userID: 0, _id: 0, curriculumCode: 0, subjectId: 0 }\n };\n\n self.apiServiceInstance.findDataAll(\n curriculumTableName,\n criteria,\n function (err, data) {\n if (data) {\n responseObject[\"status\"] = true;\n responseObject[\"data\"] = data;\n callback(null, responseObject);\n } else {\n console.log('Subjects data not listed. Due to -', err);\n errorResponseObj['error'] = err;\n callback(err, errorResponseObj);\n }\n }\n );\n }", "async function get_all_courses(teacherid) {\n try {\n let res = await axios.get(`/get_classes/${teacherid}`, config);\n\n return res.data.data;\n } catch (err) {\n console.error(err);\n return [];\n }\n}", "async function getCourses() {\n const courses = await Course\n /////// \n .find()\n // .find({ author: 'H M Usman', name: 'nodejs mongodb' }) \n //////// lets we have courses with different prices. we want the course with exact 10$ price than\n // .find({price : 10})\n ///////////\n // if we want courses with price >= 10 and <= 20 than what?\n // .find({ price: { $gte: 10, $lte: 20 } }) // here $ sign represents the implementation of operator.\n ///////////////////\n // if we want courses whose prices are equal to 10, 20, 30 dollers than? \n // .find({ price: { $in: [10, 20, 30] } })\n .limit(5)\n .sort({ name: 1 })\n .select({ name: 1, tags: 1 })\n console.log(\"Courses\" + courses)\n}", "async getStudentCourses(studentId) {\n const student = await this.getStudent(studentId);\n const courses = await this.getCourses(student.courseIds);\n //Get instructor details for each course. Promise.all allows doing so in parallel.\n // The commented statement below is equivalent to the one used under itf\n //student.courses = await Promise.all( courses.map( c => this.getCourseInstructor(c) ) );\n student.courses = await Promise.all( courses.map( this.getCourseInstructor ) );\n\n return student;\n }", "async getCurrentCourses() {\n let currentCourses = []\n await firestore.collection('userInfo').doc(this.email).get().then(doc => {\n if (doc.get('courseIds')) {\n currentCourses = doc.get('courseIds')\n }\n }).catch(e => {\n console.log(\"error retrieving courses\", e)\n })\n return currentCourses;\n }", "async function getCoursesByInstructorId(id) {\n const db = getDBReference();\n const collection = db.collection('courses');\n if (!ObjectId.isValid(id)) {\n return null;\n } else {\n const results = await collection.find({\n \"instructorId\": new ObjectId(id)\n });\n return results;\n }\n}", "async function queryOne() {\n const courses = await Course.find({\n isPublished: true,\n tags: 'backend',\n })\n .sort('-name')\n .select('name author isPublished price');\n console.log(courses);\n}", "function getUserCourses(con) {\n return function (req, res) {\n // TODO get the courses associated with the user\n res.send(\"temp\");\n };\n}", "function getCourses(handler) {\n\t// Get URL from where to fetch courses json\n\tvar DHISFolder = getDHISInstallFolder();\n\tvar url = getHostRoot() + '/' + DHISFolder + '/api/systemSettings/VJFS_courses';\n\n\t// Get courses as json object and on success use handler function\n\t$.ajax({\n\t\turl: url,\n\t\tlocalCache : true,\n cacheTTL : 0.1,\n isCacheValid : function(){ \n return true;\n },\n\t\tdataType: 'json'\n\t}).success(function(courses) {\n\t\thandler(courses);\n\t}).error(function(error) {\n\t\thandler(null);\n\t});\n}", "get courses () {\n return this._courses\n }", "getCourse(req, callback) {\n var self = this;\n var reqObj = req.body;\n var errorResponseObj = {\n status: false,\n data: {},\n };\n var responseObject = {};\n var courseTableName = \"course\";\n var condition = {};\n if (reqObj.curriculumCode && reqObj.subject) {\n condition = {\n curriculumCode: reqObj.curriculumCode,\n subject: reqObj.subject\n }\n } else {\n condition = {\n _id: ObjectId(reqObj._id),\n };\n }\n\n self.apiServiceInstance.find(\n condition,\n {},\n courseTableName,\n function (err, courseSingleData) {\n if (courseSingleData.length > 0) {\n responseObject[\"status\"] = true;\n responseObject[\"data\"] = courseSingleData;\n callback(null, responseObject);\n } else {\n errorResponseObj['error'] = err;\n callback(err, errorResponseObj);\n }\n }\n );\n }", "function getCourses(school, text){\n xr(text, 'div[id*=\"win0divSSR_CLSRSLT_WRK_GROUPBOX2\\\\$\"]', [{\n course_name: '.PAGROUPBOXLABELLEVEL1', \n course_nbr: '.PSLEVEL3GRIDROW span[title=\"Class Nbr\"]',\n section: '.PSLEVEL3GRIDROW span[title=\"View Details\"]',\n days_times: 'tr:nth-child(1) > td div table[class=PSLEVEL1GRIDNBONBO] td[class=PSLEVEL3GRIDROW]:nth-child(3) span',\n room: 'tr:nth-child(1) > td div table[class=PSLEVEL1GRIDNBONBO] td[class=PSLEVEL3GRIDROW]:nth-child(4) span',\n instructor: 'tr:nth-child(1) > td div table[class=PSLEVEL1GRIDNBONBO] td[class=PSLEVEL3GRIDROW]:nth-child(5) span',\n meeting_dates: 'tr:nth-child(1) > td div table[class=PSLEVEL1GRIDNBONBO] td[class=PSLEVEL3GRIDROW]:nth-child(6) span',\n status: 'tr:nth-child(1) > td div table[class=PSLEVEL1GRIDNBONBO] td[class=PSLEVEL3GRIDROW]:nth-child(7) img@alt',\n }])((err, courses) => db.courses.insert({school , courses}))\n}", "function populate_course_list() {\n\t$('#classlisttarget').empty();\n\t$.each(window.courses, function(index, course) {\n\t\thtml = render_course_listing(course);\n\t\t$('#classlisttarget').append(html);\n\t})\n}", "displayCourses () {\n\n const courses = this.state.courses\n const coursesToDisplay = courses.map( course => <SingleCourse title={course.title} courseID={course.id} key={course.id}/>);\n\n return coursesToDisplay;\n }", "async function getCourses() {\n\n const courses = await Course\n .find({ isPublished: true, tags: { $in: ['backend','backend'] } }) ///// course that have tags frontend or backend tags\n .limit(10)\n .sort('-price') /// 1 for ascending order,,, name: -1 for descending order\n .select('name author price') /// select properties that you want to return \n\n ///// or\n\n const courses = await Course\n .find({ isPublished: true }) ///// course that have tags frontend or backend tags\n .or([{ tags: 'frontend'},{ tags:'backend' }])\n .limit(10)\n .sort('-price') /// 1 for ascending order,,, name: -1 for descending order\n .select('name author price') /// select properties that you want to return \n\n console.log(\"courses \", courses)\n}", "function displayMyOwnCourses(myOwnCourses) {\n\t\tlet coursesContainer = $('#myForumPosts');\n\t\tcoursesContainer.empty();\n\t\tif (myOwnCourses.length === 0) {\n\t\t\tcoursesContainer.text('No courses in database.');\n\t\t}\n\n\t\tlet counter = 1;\n\t\tfor (let courseObj of myOwnCourses) {\n\t\t\tlet courseId = courseObj['_id'];\n\t\t\tlet rank = counter++;\n\t\t\tlet timeCreated = calcTime(courseObj._kmd.ect);\n\t\t\tlet url = courseObj['url'];\n\t\t\tlet imageUrl = courseObj['imageUrl'];\n\t\t\tlet author = courseObj['author'];\n\t\t\tlet title = courseObj['title'];\n\t\t\tlet description = courseObj['description'] === '' ?\n\t\t\t\t'No description.' :\n\t\t\t\tcourseObj['description'];\n\n\t\t\tlet detailsLink = $(`<a href=\"#\" data-id=\"${courseId}\">Details</a>`)\n\t\t\t\t.click(loadCourseDetails);\n\t\t\tlet courseDiv = $('<div class=\"post\">')\n\t\t\t\t.append($('<div class=\"col rank\">')\n\t\t\t\t\t.append('<span>').text(rank))\n\t\t\t\t.append($('<div class=\"col thumbnail\">')\n\t\t\t\t\t.append($(`<a href=\"${url}\">`)\n\t\t\t\t\t\t.append($(`<img src=\"${imageUrl}\">`))))\n\t\t\t\t.append($('<div class=\"post-content\">')\n\t\t\t\t\t.append($('<div class=\"title\">')\n\t\t\t\t\t\t.append($(`<a href=\"${url}\">`)\n\t\t\t\t\t\t\t.text(title)))\n\t\t\t\t\t.append($('<div class=\"details\">')\n\t\t\t\t\t\t.append($('<div class=\"info\">')\n\t\t\t\t\t\t\t.text(`submitted ${timeCreated} ago by ${author}`))\n\t\t\t\t\t\t.append($('<div class=\"controls\">')\n\t\t\t\t\t\t\t.append($('<ul>')\n\t\t\t\t\t\t\t\t.append($('<li class=\"action\">').append(detailsLink))))));\n\n\t\t\tif (author === sessionStorage.getItem('username')) {\n\t\t\t\tlet controls = courseDiv\n\t\t\t\t\t.find('.controls')\n\t\t\t\t\t.find('ul');\n\n\t\t\t\tcontrols.append($('<li class=\"action\">')\n\t\t\t\t\t.append($(`<a href=\"#\" data-id=\"${courseId}\">Delete</a>`)\n\t\t\t\t\t\t.click(deleteCourse)));\n\t\t\t\tcontrols.append($('<li class=\"action\">')\n\t\t\t\t\t.append($(`<a href=\"#\" data-id=\"${courseId}\">Edit</a>`)\n\t\t\t\t\t\t.click(displayEditForm)));\n\t\t\t}\n\n\t\t\tcoursesContainer.append(courseDiv);\n\t\t}\n\t}", "componentDidMount() {\n this.findAllCourses();\n }", "async function listarCursos(){\n const numeroPage = 2;\n const sizePage = 10;\n //api/cursos?numeroPage=4&sizePage=10\n\n const cursos = await Curso.find()\n //operadores de comparacion:\n //.find({precio: {$gte:10, $lte:30}})\n //.find({precio: {$in: [10, 15, 25]}})\n\n //.find({autor: /^Gro/}) busca el autor que empiece con esas letras\n //.find({autor: /ver$/}) busca el autor que termine con esas letras\n\n //.find( {autor: /.*ro.*/}) condicion. cuando un campo tiene un contenido específico\n\n //.or([{autor: 'Groover'}, {publicado: true}])\n //.and\n\n //filtros\n // .find({autor: 'Groover'});\n // .limit(10)\n // .sort({autor: 1/-1}); asc/desc\n // .select({nombre:1, etiquetas:1});\n // .skip((numeroPage - 1) * sizePage)\n // .limit(sizePage)\n console.log(cursos)\n}", "returnSingleCourse(course) {\r\n this.log(`Getting single course...`);\r\n this.log(course.id + '-- from courses database.js');\r\n return this.context\r\n .retrieveSingle(`\r\n SELECT title, Users.firstName || \" \" || Users.lastName As user\r\n FROM Courses \r\n INNER JOIN Users\r\n ON Courses.userId = Users.id\r\n WHERE Courses.id = ?\r\n `, course.id); \r\n }", "renderPage() {\n return (\n <div className=\"uhmanoa-listcourses-background\" id='list-course'>\n <Container>\n <Header as=\"h2\" textAlign=\"center\" inverted>List Courses</Header>\n <Card.Group>\n {this.props.courses.map((course, index) => <Course key={index} course={course} reviews={this.props.reviews.filter(review => (review.contactId === course._id))}/>)}\n </Card.Group>\n </Container>\n </div>\n );\n }", "async function getCourses(keyword) {\n\n // request body: there are two type of results the former based on all products and the latter based on suggestions.\n let body = {\n requests: [\n {\n indexName: \"prod_all_products\",\n params: `query=${keyword}&hitsPerPage=9223372036854775807&page=0&highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&optionalFilters=query%3A${keyword}&facets=%5B%5D&tagFilters=`\n },\n {\n indexName: \"test_suggestions\",\n params: `query=${keyword}&hitsPerPage=9223372036854775807&page=0&highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&optionalFilters=query%3A${keyword}&facets=%5B%5D&tagFilters=`\n }\n ]\n };\n\n try {\n\n let response = await axios({\n method: \"post\",\n url: baseURL,\n headers: {},\n data: body\n });\n\n if (response.status == 200) {\n let data = response.data;\n\n let refinedCourses = [];\n\n //concatenating the arrays \n let rawCourses = data.results[0].hits;\n rawCourses = rawCourses.concat(data.results[1].hits);\n\n rawCourses.forEach(course => {\n\n if (course.language == 'English') {\n let {\n name,\n imageUrl,\n objectUrl,\n skills,\n productDifficultyLevel\n } = course; //destructoring\n\n let description = course._snippetResult.description.value;\n \n let refinedCourse = {\n title: name,\n category: keyword,\n description: description,\n difficulty: productDifficultyLevel,\n skills: skills,\n url_image: imageUrl,\n url: `https://www.coursera.org${objectUrl}`,\n };\n \n refinedCourses.push(refinedCourse);\n }\n });\n\n\n return refinedCourses;\n }\n } catch (err) {\n console.log(`Coursera wrapper error: ${err}`);\n }\n}", "getCourses() {\n let userCourses = {\n \"courses\": this.state.list\n }\n fetch('http://localhost:5000/api/courses/my-courses', {\n method: \"POST\",\n body: JSON.stringify(userCourses),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n }\n }).then(response => {\n if(!response.ok) {\n console.log(\"AFTER API CALL FOR COURSES: \" + response.data);\n return false;\n } else {\n response.json().then(data => {\n this.setState({\n myCourseNames: data,\n loading: this.state.loading + 1\n })\n })\n return true;\n }\n }).catch(err => {\n console.log('caught it!',err);\n });\n }", "function displayCourses(courses) {\n\tfor (course in courses) {\n\t$('#courses').append(HTMLonlineClasses);\n\tvar formattedTitle = HTMLonlineTitle.replace(\"%data%\",mareike.courses[course].name);\n\t$('.course-entry:last').append(formattedTitle);\n\t$('.course-entry:last').append(asign(HTMLonlineSchool,mareike.courses[course].school));\n\t$('.course-entry:last').append(asign(HTMLonlineDates,mareike.courses[course].date));\n\t}\n}", "function prefetchISupeCourses(callback) {\n\n var queryFunctions = []; // Populate with functions with signature (callback)\n\n const iSupeCourses = canvasCache.getISupeCourses();\n for (let iSupeCourse of iSupeCourses) {\n const courseId = iSupeCourse.id;\n\n // We're interested in the course enrollments\n queryFunctions.push(\n function(cb) { return canvasCache.loadCourseEnrollments(courseId, cb); }\n );\n\n // We're interested in the course assignments\n queryFunctions.push(\n function (cb) { return canvasCache.loadCourseAssignments(courseId, cb); }\n );\n }\n\n // /**\n // * Faculty member can have up to 3 iSupervision courses, named like:\n // * \n // * \"CST1841S-\" + <mailbox part of user login>\n // * \"CST1842S-\" + <mailbox part of user login>\n // * \"CST1843S-\" + <mailbox part of user login>\n // * \n // * e.g. \"CST1841S-rplaugher\"\n // **/\n \n // const facultyLogins = Array.from(\n // new Set(\n // canvasCache.getFaculty().map(\n // e => e.user.login_id.split('@')[0] )));\n\n // // Get list of prefixes for iSupervision course names from the terms configuration\n // const terms = appConfig.getTerms();\n // const iSupePrefixes = Array.from(new Set(terms.map( e => e.isupe_prefix )));\n // // console.log(\"isupe_prefixes\", iSupePrefixes);\n\n // // Build list of all possible iSupervision course names\n // let iSupeCourseNames = [];\n // for (let iSupePrefix of iSupePrefixes) {\n // iSupeCourseNames = iSupeCourseNames.concat(facultyLogins.map( e => iSupePrefix + e));\n // }\n // // let iSupeCourseNames = [].concat(\n // // facultyLogins.map( e => \"CST1841S-\" + e),\n // // facultyLogins.map( e => \"CST1842S-\" + e),\n // // facultyLogins.map( e => \"CST1843S-\" + e)\n // // );\n\n // // for (let courseName of iSupeCourseNames) {\n // // console.log(courseName);\n // // }\n\n // // See how many of these iSupervision course names we can find\n // const courses = canvasCache.getCourses();\n // for (let iSupeCourseName of iSupeCourseNames) {\n\n // const iSupeCourse = courses.find( e => e.name === iSupeCourseName);\n // if (iSupeCourse) {\n // const courseId = iSupeCourse.id;\n\n // // We're interested in the course enrollments\n // queryFunctions.push(\n // function(cb) { return canvasCache.loadCourseEnrollments(courseId, cb); }\n // );\n\n // // We're interested in the course assignments\n // queryFunctions.push(\n // function (cb) { return canvasCache.loadCourseAssignments(courseId, cb); }\n // );\n\n // } // end if iSupervision course found for faculty member\n // } // end loop through faculty logins\n\n console.log(`Priming cache with iSupervision courses, ${queryFunctions.length} queries.`);\n // async.parallel(queryFunctions, (err, results) => {\n async.series(queryFunctions, (err, results) => {\n return callback(err, results);\n });\n}", "getListbyPaging(currPage, currLimit) {\n var url = api.url_tampildataOutlet(currPage, currLimit);\n this.isLoading = true;\n fetch(url)\n .then(response => response.json())\n .then(data =>\n this.setState({\n result: data.content,\n isLoading: false,\n totalPage: data.totalPages,\n }),\n );\n }", "function getCourseByNameQuery(req,res,next){cov_24nw12t5lg.f[10]++;cov_24nw12t5lg.s[61]++;if(req.query.courseID==null){cov_24nw12t5lg.b[22][0]++;cov_24nw12t5lg.s[62]++;Course.getCourse(req.query,function(err,courses){cov_24nw12t5lg.f[11]++;cov_24nw12t5lg.s[63]++;if(err){cov_24nw12t5lg.b[23][0]++;cov_24nw12t5lg.s[64]++;res.status((cov_24nw12t5lg.b[25][0]++,err.code>=100)&&(cov_24nw12t5lg.b[25][1]++,err.code<600)?(cov_24nw12t5lg.b[24][0]++,err.code):(cov_24nw12t5lg.b[24][1]++,500)).send({success:false,message:err.message});}else{cov_24nw12t5lg.b[23][1]++;}//res.json(doc);\ncov_24nw12t5lg.s[65]++;if(courses[0]==null){cov_24nw12t5lg.b[26][0]++;cov_24nw12t5lg.s[66]++;res.status(400).send({success:false,message:\"course does not exist\"});}else{cov_24nw12t5lg.b[26][1]++;var course_entry=(cov_24nw12t5lg.s[67]++,courses[0].toObject());//console.log(course_entry);\ncov_24nw12t5lg.s[68]++;req.query.courseID=course_entry._id;//console.log(req.body.courseID);\ncov_24nw12t5lg.s[69]++;next();}});}else{cov_24nw12t5lg.b[22][1]++;cov_24nw12t5lg.s[70]++;next();}}", "function getCoursesForLearningGroup(learningGroupId) {\n // get learning group (hopefully from cache)...\n return getLearningGroup(learningGroupId)\n .then(function () {\n // query that always works\n console.log(\"MON courseType.custom: \" + courseType.custom);\n var query = breeze.EntityQuery\n .from(courseType.defaultResourceName)\n // query that works in Office365 / SPO and versions of SharePoint 2013\n // that have XXX 201X applied (this CU includes a bugfix)\n .where('LearningGroupId', 'eq', learningGroupId);\n /* In case it did not work aconnell has a hack (described in #5.12): */\n // .where('LearningGroup.Id', 'eq', learningGroupId)\n // .select(courseType.custom.defaultSelect + ',LearningGroup.Id')\n // .expand('LearningGroup');\n return manager.executeQuery(query)\n .then(function (data) {\n return data.results;\n });\n });\n }", "function clickedCoursePagination(){\n\t\t$(\".course_pagination .page-item a\").click(function(){\t\n\t\t\tvar clickedPage = parseInt($(this).attr(\"id\"));\n\t\t\tsearchCourses(page=clickedPage);\n\t\t});\n\t}", "function getCourses(date, dayObj) {\n CoursesService.get(date)\n .then(function(courses) {\n dayObj.courses = courses;\n });\n }", "function selectSections (supersonic, $scope, $http, index, courseId) {\n\tvar term = \"20151\";\n\t\n\tvar queryUrl = \"http://petri.esd.usc.edu/socAPI/Courses/\" + term + \"/\" + courseId;\n\t\n\t$http.get(queryUrl).\n\t\tsuccess(function(data, status, headers, config) {\n\t\t\t$scope.queriedCourses++;\n\t\t\t\n\t\t\tvar toBeSkipedSec = 0;\n\t\t\t$scope.courses[index].sections = [];\n\t\t\tvar sectionsObjects = new Array();\n\t\t\tvar allSections = data.V_SOC_SECTION;\n\t\t\tfor (i = 0; i < allSections.length; i++) {\n\t\t\t\t\n\t\t\t\tif (!allSections[i].DAY) {\n\t\t\t\t\ttoBeSkipedSec++;\n\t\t\t\t} else {\n\t\t\t\t\tsectionsObjects[i-toBeSkipedSec] = {\n\t\t\t\t\t\t\t\"SECTION_ID\" : allSections[i].SECTION_ID,\n\t\t\t\t\t\t\t\"TYPE\" : allSections[i].TYPE, \n\t\t\t\t\t\t\t\"BEGIN_TIME\" : allSections[i].BEGIN_TIME, \n\t\t\t\t\t\t\t\"END_TIME\" : allSections[i].END_TIME, \n\t\t\t\t\t\t\t\"DAY\" : allSections[i].DAY, \n\t\t\t\t\t\t\t\"LOCATION\" : allSections[i].LOCATION, \n\t\t\t\t\t\t\t\"INSTRUCTOR\" : allSections[i].INSTRUCTOR, \n\t\t\t\t\t\t\t\"SEATS\" : allSections[i].SEATS,\n\t\t\t\t\t\t\t\"isEnabledByDay\" : true,\n\t\t\t\t\t\t\t\"isEnabledByTime\" : true,\n\t\t\t \t\t\"isInterested\": false,\n\t\t\t \t\t\"isScheduled\": false,\n\t\t\t \t\t\"isRegistered\": false,\n\t\t\t \t\t\"isConflicted\": false\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t$scope.courses[index].sections = sectionsObjects;\n\t\t\t\n\t\t\tif ($scope.queriedCourses == $scope.totalCourses) {\n\t\t\t\tsupersonic.logger.debug(\"All sections of all courses have been retrieved!\");\n\t\t\t\trunFilter (supersonic, $scope);\n\t\t\t} else {\n//\t\t\t\tsupersonic.logger.debug(\"Retrieved: \" + $scope.queriedCourses);\n\t\t\t}\n\t\t\t\n\t\t\tvar leftPercent = Math.floor((Math.random() * 99) + 1);\n\t\t\tvar rightPercent = 100 - leftPercent;\n\t\t\t// usc yellow : #FFCC00\n\t\t\t$(\".selectEach\").css(\"background\", \"linear-gradient(to right, #EEC9B7 \"+leftPercent+\"%, #FFF \"+rightPercent+\"%)\");\n\t\t}).\n\t\terror(function(data, status, headers, config) {\n\t\t\tsupersonic.logger.debug( status );\n\t\t});\n}", "function get_all_cargo(req){\n var q = datastore.createQuery(CARGO).limit(3);\n var results = {}; //returned to user\n if(Object.keys(req.query).includes(\"cursor\")){ //If there is a cursor\n q.startVal = (req.query.cursor).replace(/ /g, \"+\"); //Set start of retrieval at cursor in URI format\n }\n console.log(\"QUERY\");\n console.log(q);\n return datastore.runQuery(q).then( entities => {\n results.items = entities[0];\n console.log(\"CURSOR\");\n console.log(entities[1]);\n if(entities[1].moreResults !== Datastore.NO_MORE_RESULTS){\n results.next = \"https://\" + req.get(\"host\") + \"/cargo?cursor=\" + entities[1].endCursor;\n } else {\n results.next = \"END OF RESULTS\";\n }\n\n return results;\n }).catch( err => {\n return false;\n });\n}", "function getCourseByNameQuery(req,res,next){cov_24nw12t5lg.f[12]++;cov_24nw12t5lg.s[64]++;if(req.query.courseID==null){cov_24nw12t5lg.b[25][0]++;cov_24nw12t5lg.s[65]++;Course.getCourse(req.query,function(err,courses){cov_24nw12t5lg.f[13]++;cov_24nw12t5lg.s[66]++;if(err){cov_24nw12t5lg.b[26][0]++;cov_24nw12t5lg.s[67]++;res.status((cov_24nw12t5lg.b[28][0]++,err.code>=100)&&(cov_24nw12t5lg.b[28][1]++,err.code<600)?(cov_24nw12t5lg.b[27][0]++,err.code):(cov_24nw12t5lg.b[27][1]++,500)).send({success:false,message:err.message});}else{cov_24nw12t5lg.b[26][1]++;}//res.json(doc);\ncov_24nw12t5lg.s[68]++;if(courses[0]==null){cov_24nw12t5lg.b[29][0]++;cov_24nw12t5lg.s[69]++;res.status(400).send({success:false,message:\"course does not exist\"});}else{cov_24nw12t5lg.b[29][1]++;var course_entry=(cov_24nw12t5lg.s[70]++,courses[0].toObject());//console.log(course_entry);\ncov_24nw12t5lg.s[71]++;req.query.courseID=course_entry._id;//console.log(req.body.courseID);\ncov_24nw12t5lg.s[72]++;next();}});}else{cov_24nw12t5lg.b[25][1]++;cov_24nw12t5lg.s[73]++;next();}}", "refreshCourses() {\n //get the list of courses and set it to an array\n let username = AuthenticationService.getLoggedInUserName()\n CourseDataService.retrieveAllCourses(username)\n .then(\n response => {\n this.setState({ courses: response.data })\n }\n )\n }", "function getTutorListing(req, res) {\n \tvar courseID = req.params.classID;\n\n // Only allow courses with length at least 3.\n if (!courseID || courseID.length < 3) {\n res.status(400).json({message: 'invalid course'});\n\n return;\n }\n\n \tTutorController.get(courseID.toUpperCase())\n \t\t.then((listings) => {\n \t\t\tif (listings) {\n \t\t\t\treturn res.json(listings);\n \t\t\t}\n\n \t\t\treturn res.status(400).json({message: 'invalid course'});\n \t\t});\n}", "static loadCoursesAsync() {\r\n\r\n return function (dispatch) { \r\n axios.get(base + '/courses')\r\n .then(function (response) {\r\n dispatch(CourseActions.loadCourses(response.data));\r\n })\r\n .catch(function (response) {\r\n console.log('Error in loadCoursesAsync ' + response);\r\n });\r\n };\r\n }", "function initializeCourses() {\n\t// loadCourses(fillAccordion);\n\t\t// not used so far\n}", "displayAllCourses(){\n if(this.state.courses) {\n return this.state.courses.map( course => {\n return (\n <Item key={course._id} title={course.title} id={course._id}/>\n )\n })\n } else {\n }\n }" ]
[ "0.7596734", "0.7292198", "0.7196835", "0.7181529", "0.712476", "0.70222247", "0.6977866", "0.69531447", "0.69484216", "0.6920709", "0.68820125", "0.68610084", "0.68605316", "0.68555677", "0.68537855", "0.6726301", "0.67253274", "0.67029", "0.6701172", "0.6679708", "0.6664878", "0.66507494", "0.6618958", "0.6611443", "0.65494186", "0.6510292", "0.6477943", "0.6456667", "0.64173186", "0.63851583", "0.6352086", "0.6335967", "0.63318163", "0.63051146", "0.6291489", "0.62884915", "0.6266558", "0.6264572", "0.6256542", "0.62530524", "0.6235936", "0.62119746", "0.6208887", "0.6182189", "0.6148338", "0.6141872", "0.6114016", "0.6111816", "0.6098889", "0.60761416", "0.60582197", "0.60380083", "0.6037275", "0.6035477", "0.6014265", "0.6008195", "0.60006505", "0.5987969", "0.59791154", "0.59739566", "0.5925696", "0.59230703", "0.59112626", "0.5901868", "0.58841234", "0.58839136", "0.5860689", "0.5841298", "0.58366174", "0.58361286", "0.581233", "0.5807352", "0.5791227", "0.57907647", "0.57750773", "0.5773611", "0.57721287", "0.5763729", "0.57614636", "0.573494", "0.57330674", "0.57082427", "0.5673467", "0.5660479", "0.5652428", "0.5649125", "0.56488174", "0.5626628", "0.56206936", "0.5619187", "0.5618527", "0.561475", "0.5610483", "0.5598116", "0.55946106", "0.5594405", "0.5584747", "0.5583987", "0.55760795", "0.5574422" ]
0.7368527
1
== ENTITY == Creates a new entity.
function Entity(key) { this.key = key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createEntity() {\n var entity = new bb.Entity(this);\n this.addEntity(entity);\n return entity;\n }", "function newEntity(type) {\r\n if (uploadInProgress || downloadInProgress)\r\n console.log(\"TEST\");\r\n // create a new entitiy:\r\n currentEntity = new Entity();\r\n console.log(currentEntity);\r\n // add it to the list\r\n entityList.push(currentEntity);\r\n // set the type to text\r\n currentEntity.type = \"textbox\";\r\n // add the entity to the list:\r\n entityList.push(currentEntity);\r\n // update the property div\r\n updatePropertyDiv();\r\n // create a new entity container\r\n createEntityPreview(currentEntity);\r\n // update the preview\r\n //updateEntityPreviewContent();\r\n}", "create(entityName, data) {\n return this.getEntityFactory().create(entityName, data, true, true);\n }", "addEntity(entity) {\n if (!entity) {\n throw new Error(\"Can't add nil entity.\");\n }\n this.entities[entity.name] = entity;\n }", "function newEntity(type) {\n// if (uploadInProgress || downloadInProgress)\n// return;\n // Ensure a page is selected.\n if (!currentPage) {\n alert(\"You must select a page before you can add an entity.)\");\n return;\n }\n \n // create a new entitiy:\n var entity = new Entity();\n entity.entityType = type;\n // add the entity to the lecture and update accordingly\n addEntity(entity);\n // add it to the list\n entities.push(entity);\n console.log(entity);\n console.log(entities);\n}", "async create(entity) {\n try {\n if (entity instanceof Array) {\n return await this[store].upsert(entity);\n }\n return await this[store].save(entity);\n } catch (e) {\n throw thorin.error('STORE.GCLOUD', 'An error occurred while saving entity', e);\n }\n }", "function createEntity(data) {\n // ... insert code to create entity ...\n var newResult = {};\n return newResult;\n}", "makeEntity(id, data) {\n const entity = new this.handle.entityClass(data);\n Entity.identify(entity, id, null);\n return entity;\n }", "function createEntity(data) {\n SpreadsheetApp.getUi().alert ('Entity is being created. It will appear in the \"Entities\" tab shortly');\n insertEntityInEntitiesSheet(data);\n}", "addEntity (entity) {\n this.entities.push(entity);\n }", "addEntity(entity) {\n this.entities.push(entity)\n }", "function create(entity) {\r\n \t\treturn $q(function(resolve, reject) {\r\n \t\t\t// Request creation to server\t//~\r\n \t\t\tExamenResource.save(entity) \t\t\t\r\n \t\t\t// On success\r\n \t\t\t.$promise.then(function(data) {\r\n \t\t\t\t// Resolve\r\n \t\t\t\tresolve(data);\r\n \t\t\t\t\r\n \t\t\t\t// On error\r\n \t\t\t}, function(error) {\r\n \t\t\t\t// return appropiated error message\r\n \t\t\t\tvar errorMsg;\r\n \t\t\t\tswitch (error.status) {\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\terrorMsg = 'Error al intentar crear el registro. Por favor intente nuevamente.';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n \t\t\t\t// reject\r\n \t\t\t\treject(errorMsg);\r\n \t\t\t}); // save\r\n \t\t});\r\n \t}", "createEntity(name) {\n var entity = this._entityPool.acquire();\n\n entity.alive = true;\n entity.name = name || \"\";\n\n if (name) {\n if (this._entitiesByNames[name]) {\n console.warn(`Entity name '${name}' already exist`);\n } else {\n this._entitiesByNames[name] = entity;\n }\n }\n\n this._entities.push(entity);\n\n this.eventDispatcher.dispatchEvent(ENTITY_CREATED, entity);\n return entity;\n }", "createEntity(name) {\n var entity = this._entityPool.acquire();\n entity.alive = true;\n entity.name = name || \"\";\n if (name) {\n if (this._entitiesByNames[name]) {\n console.warn(`Entity name '${name}' already exist`);\n } else {\n this._entitiesByNames[name] = entity;\n }\n }\n\n this._entities.push(entity);\n this.eventDispatcher.dispatchEvent(ENTITY_CREATED, entity);\n return entity;\n }", "function addEntity(entity) {\n entities.push(entity);\n }", "function addEntity(type) {\n var entity = DUNGEON.spawn(type);\n entities[entity.UID] = entity;\n return entity;\n }", "function Entity() {\n entities.push(this)\n }", "function createEntity(id){\n\treturn {\n\t\tposition: null,\n\t\trotation: null,\n\t\tid: id,\n\t\tmaterial: null,\n\t\tgeometry: null,\n\t\tmesh: null,\n\t\tscene: false,\n\n\t\t//Takes in cache values\n\t\tcache: function(material, geometry){\n\t\t\tthis.material = new MeshBasicMaterial({color: material});\n\n\t\t\tthis.geometry = new BoxGeometry();\n\t\t\tthis.mesh = new Mesh( this.geometry, this.material );\n\t\t},\n\t\t\n\t\t//Takes in dynamic values\n\t\tdynamic: function(position, rotation){\n\t\t\tthis.position = new Vector3(position.x, position.y, position.z);\n\t\t\tthis.rotation = new Euler(rotation.x, rotation.y, rotation.z);\n\t\n\t\t\tif(this.mesh){\n\t\t\t\tthis.mesh.position.setX(position.x);\n\t\t\t\tthis.mesh.position.setY(position.y);\n\t\t\t\tthis.mesh.position.setZ(position.z);\n\t\t\t\t\n\t\t\t\tthis.mesh.rotation.set(rotation.x, rotation.y, rotation.z);\n\t\t\t}\n\t\t},\n\t\t\n\t\t//Whether the entity is ready to be pushed into the scene or not\n\t\tready: function(){\n\t\t\treturn (this.position !== null && this.rotation !== null && this.mesh !== null);\n\t\t},\n\t\t\n\t\t//Disposes of geometries and materials\n\t\tdispose: function(){\n\t\t\tthis.material.dispose();\n\t\t\tthis.geometry.dispose();\n\t\t\tthis.material = undefined;\n\t\t\tthis.geometry = undefined;\t\n\t\t},\n\t};\n}", "createEntity(\n editorState,\n entityType,\n entityData,\n entityText,\n entityMutability = 'IMMUTABLE',\n ) {\n const contentState = editorState.getCurrentContent();\n const selection = editorState.getSelection();\n const contentStateWithEntity = contentState.createEntity(\n entityType,\n entityMutability,\n entityData,\n );\n const entityKey = contentStateWithEntity.getLastCreatedEntityKey();\n\n let nextContentState;\n\n if (selection.isCollapsed()) {\n nextContentState = Modifier.insertText(\n contentState,\n selection,\n entityText,\n null,\n entityKey,\n );\n } else {\n nextContentState = Modifier.replaceText(\n contentState,\n selection,\n entityText,\n null,\n entityKey,\n );\n }\n\n const nextState = EditorState.push(\n editorState,\n nextContentState,\n 'insert',\n );\n\n return nextState;\n }", "constructor(entityID, name, type) {\n this.entityID = entityID;\n this.name = name;\n this.type = type;\n }", "instantiate(name = null) {\n let res = new Entity(name);\n return this.updateEntity(res);\n }", "createEntity(entity) {\n this.endpoints[entity.name] = this.createBasicCRUDEndpoints(entity);\n }", "create() {\n const model = internal(this).model;\n internal(model).entities.add(this);\n return this;\n }", "function addEntity(id, entity) {\n entities[id] = entity;\n}", "function Entity(body, type) {\n\tthis.id = entityId++;\n\tthis.body = body;\n\tthis.body.SetUserData(this);\n\tthis.type = type;\n}", "function saveNewEntity(entity, table, done) {\n\t\tentity.id = uuid();\n\t\tvar leanEntity = serializeEntity(entity);\n\t\t\n\t\tvar params = {\n\t\t\tTableName: table,\n\t\t\tItem: leanEntity\n\t\t};\n\t\t\n\t\tdynamoContext.putItem(params, function(err, data) {\n\t\t\tif(err) {\n\t\t\t\tdone(err);\n\t\t\t} else {\n\t\t\t\tdone(null, entity); \n\t\t\t}\n\t\t})\n\t}", "function createSuccess(entity) {\n return {\n type: CREATE_SUCCESS,\n payload: entity\n };\n }", "async create(dataEntity){\n\t\tvar data = await getJsonData.call(this);\n\t\tvar entity = Object.assign({}, dataEntity);\n\t\tentity[\"id\"] = getSeq.call(this);\n\t\tdata[entity.id] = entity;\n\t\tawait setJsonData.call(this, data);\n\t\treturn entity.id;\n\t}", "function create(crudRequest,message) {\n console.log(\"CRUDVerticleJS: create()\");\n\n // this transformation of domain object to json string to json object is quite annoying...\n var obj = JSON.parse(crudRequest.toJsonString(crudRequest.entity));\n // we need to remove the _id attribute as otherwise no id might be assigned\n delete obj._id;\n client.save(crudRequest.entity.getClass().getName(), obj, function (res, res_err) {\n\n if (res_err == null) {\n var id = res;\n console.log(\"CRUDVerticleJS: create(): saved entity of type \" + crudRequest.entity.getClass().getName() + \" with id \" + id);\n message.reply(id);\n } else {\n res_err.printStackTrace();\n message.reply(\"\");\n }\n\n });\n}", "async create(data) { await orm.insertOne(data) }", "getEntity() {}", "constructor() {\n\t\tthis.id=THREE.MathUtils.generateUUID();\n\t\tEntity.byId[this.id]=this;\n\t}", "constructor(entity, properties) {\n this.entity = entity + \"\";\n\n this.load(properties || {});\n }", "function createNewApplicationEntity() {\n var entity = spEntity.fromJSON(\n _.chain(entityFragment('New Application', 'core:solution'))\n .extend(mobileFragment())\n .extend({'core:solutionVersionString': '1.0'})\n .valueOf()\n );\n\n return entity;\n }", "function create_entity(width, height, x, y, color) {\n this.width = width;\n this.height = height;\n this.x = x;\n this.y = y;\n this.color = color\n this.update = function() {\n context.fillStyle = color;\n context.fillRect(this.x, this.y, this.width, this.height);\n }\n}", "@Input('entity') set entity(newentity) {\n this._entity = newentity;\n }", "async create(args) {\n\t\ttry {\n\t\t\tconst entity = await this.model.create({\n\t\t\t\t...args,\n\t\t\t})\n\n\t\t\tconst created = await this.model.findOne({ _id: entity._id })\n\n\t\t\treturn created\n\t\t} catch (error) {\n\t\t\tthrow new BadRequest({ data: { reason: error.message } })\n\t\t}\n\t}", "function declare() {\n let entity = {\n id: entities.length,\n values: []\n }\n entities.push(entity)\n return entity\n}", "addEntity(entity) {\n this.entities.push(entity);\n this.qt.put(entity);\n debug(\"Added an entity to the world: \" + entity.toString());\n }", "addEntity(entity, id=uuid.v1()) {\n this.entities[id] = entity;\n this.spatialHashmap.addEntity(id, entity.position);\n this.manager.addEntity(id, entity);\n }", "function createEntity() {\n\tvar ent = {};//this is the entity being created\n\n\tent.x = -100;//the default x ordinance of entity (center of entity)\n\tent.y = -100;//the defualt y ordinance of entity (center of entity)\n\tent.width = -1;//How wide the entity is\n\tent.height = -1;//How tall the entity is \n\tent.speed = -1;//movement speed\n\tent.moveDirection = 'none';//direction the object will move in\n\tent.hp = 1;//health points, For now everything will have 1 hp\n\tent.type = \"entity\";//this names what sort of entity, such as player or bullet\n\tisAlive = true;//Are you still alive bro?\n\n\t/**\n\tmoveUpdate is not implemented for entity.\n\t*/\n\tent.moveUpdate = function () { console.log(\"Error entity move accessed.\"); };\n\n\t/**\n\tthis gets the hitbox for the entity.\n\n\treturns a rect() the same size and position of the entity. \n\t*/\n\tent.getHitBox = function () {//based off the center point of the sprite image. Hit box should be around the sprite, not the sprite itself\n\t\tvar rect = {};//create hit box object\n\n\t\trect.x = this.x;//copy over dimensions and position\n\t\trect.y = this.y;\n\t\trect.width = this.width;\n\t\trect.height = this.height;\n\n\t\treturn rect;//return the hitbox object\n\t}; //end getHitBox\n\n\t/**\n\tthis updates the hp with damage taken. Will set is alive to false and call death if hp drops to 0 or lower.\n\n\tamountOfDamageBeingTaken - the damage received\n\t*/\n\tent.damage = function (amountOfDamageBeingTaken) {\n\t\tvar currentHp = this.hp;//gets current hp\n\t\tcurrentHp = currentHp - amountOfDamageBeingTaken;//calculates damage\n\t\tif(debug) { console.log('DAMAGE confirm hp:' + currentHp + ' ent hp:' + this.hp + \"damage amount: \" +amountOfDamageBeingTaken); }\n\t\tif (currentHp <= 0) {//hp check\n\t\t\tthis.isAlive = false;//sets isAlive to false\n\t\t\tthis.death();//call to the Death function \n\t\t}\n\t};\n\t\n\t/**\n\tthis updates isAlive variable to false. Stops movement and sets speed to 0. \n\tSprite removal will be unique to each type of entity.\n\t*/\n\tent.death = function () {\n\t\tthis.isAlive = false;//set isAlive to false\n\t\tthis.speed = 0;//set speed to 0\n\t\tthis.direction = \"none\";//set direction to none\n\t\t//remove sprite code here\n\t};\n\t\n\t/**\n\tspawnAt is not implemented for entity.\n\t*/\n\tent.spawnAt = function () {console.log(\"Error entity spawnAt accessed.\"); };//takes parameters of where you want to spawn entity\t\n\n\n\t/**\n\tMoves the visual group to the entity values.\n\tShould be called at the end of move update.\n\t*/\n\tent.moveVisualsToCoordinates = function () {\n\t\tthis.vGroup.x( this.x );\n\t\tthis.vGroup.y( this.y );\n\n\t};\n\n\tallEntities.push( ent ); //everything should call this to be created for mechanical updates.\n\n\treturn ent; //DONT FORGET THIS\n\n} //end createEntity", "async create() {\n const { ctx, service } = this;\n const params = getParams(ctx, 'body');\n const res = await service.user.crud({\n type: 'createOne',\n data: params,\n });\n ctx.body = res;\n }", "addEntity() {\n let newEntity = new Entity(this.entityInitiative,this.entityName, this.entityRace, this.entityClass)\n if ( this.entities.length == 0 ) {\n this.entities.push(newEntity);\n } else {\n for(let i = 0; i < this.entities.length; i++) {\n if( newEntity.initiative > this.entities[i].initiative) {\n this.entities.splice(i, 0, newEntity);\n i = this.entities.length;\n } else if (i == this.entities.length-1) {\n this.entities.push(newEntity);\n }\n }\n }\n this.entityName = null;\n this.entityRace = null;\n this.entityClass = null;\n this.entityInitiative = 0;\n this.forceTurnEvaluation();\n }", "function ModelEntity(e) {\r\n this.lectureID = e.lectureID;\r\n this.pageID = e.pageID;\r\n this.entityID = e.id;\r\n this.entityType = e.type;\r\n this.entityX = e.x;\r\n this.entityY = e.y;\r\n this.entityZ = e.z;\r\n this.animation = e.anim;\r\n this.entityContent = e.content;\r\n this.entityWidth = e.width;\r\n this.entityHeight = e.height;\r\n}", "createEntity() {\n return super.createEntity().addComponent(Transform);\n }", "function addEntity(game, entity) {\n game.entities[entity.id] = entity;\n game[entity.type].push(entity.id);\n\n var position = entity.position,\n width = entity.width,\n height = entity.height;\n\n if (position == null) {\n return;\n }\n // handle entities with larger size\n for (var x = position.x; x < position.x + width; x++) {\n for (var y = position.y; y < position.y + height; y++) {\n insertInGrid(game.grid, { x: x, y: y }, entity.id);\n }\n }\n}", "create() {\n const entity = internal(this).entity;\n entity.create(); // Make sure the entity exists.\n const model = entity.model();\n internal(model).components.add(this);\n return this;\n }", "create(options) {\n this._checkExistingProject(options, this._create.bind(this)).\n then(() => this._info()).\n then(info => {\n UserInteractor.printInfo(UserInteractor.MESSAGES.ENTITY_CREATED, this.entityType);\n UserInteractor.printResultWithStatus(info);\n }).\n catch(error => UserInteractor.processError(error));\n }", "create({ title, description }) {\n const id = uuidv4();\n\n const object = {\n id,\n title,\n description\n };\n\n this.data[id] = (object);\n return Promise.resolve(object);\n }", "@POST('/epics')\n @websocket('epics', 'create')\n @authenticated\n async create (ctx) {\n this.requireRelationships({ ctx, relationships: ['nominees'] })\n\n const result = await super.create({\n ctx,\n databaseType: Epic,\n overrideFields: { nominatedById: ctx.state.user.id },\n })\n\n const query = new DatabaseQuery({ connection: ctx })\n ctx.response.status = StatusCode.created\n return new DatabaseDocument({ query, result, type: EpicView })\n }", "function Entity(game, x, y) {\n this.game = game;\n this.x = x;\n this.y = y;\n this.removeFromWorld = false;\n //this.type = \"Entity\";\n}", "function spawnEntity(type){\n\tvar entity = new Object();\n\tentity.velocity=[0,0,0];\n\tentity.position=[100+300*Math.random(),0,300*(Math.random()-0.5)];\n\tentity.colour=[Math.random(),Math.random(),Math.random()];\n\tentity.bounce=true;\n\tentity.type=type;\n\tif(type=='cube'){\n\t\tentity.size=10*Math.random()+4;\n\t\tentity.height=1;\n\t}else if(type=='sphere'){\n\t\tentity.size=5*Math.random()+4;\n\t\tentity.height=entity.size;\n\t}\n\n\tentities.push(entity);\n}", "function createObject(e){\n\t\n\t// create random object data\n\tvar object={\n\t\tname: 'PeppaTest Object' + Math.floor(Math.random()*100),\n\t\tstatus: 'created',\n\t\tcost: 2.99\n\t};\n\t\n\t// Now Save It\n\tapi.Object.Create('PeppaTest',object,function(r){\n\t\tif(r.success){\n\t\t\talert('New Object persisted to server');\n\t\t}\n\t});\t\n\t\n}", "createEntity(componentClasses) {\n const entity = new _Entity__WEBPACK_IMPORTED_MODULE_0__[\"default\"](++this.__entity_uid_count, true);\n this.__entities[this.__entity_uid_count] = entity;\n return this.addComponentsToEntity(componentClasses, entity.entityUID);\n }", "function Entity (value) {\n\tthis.name = value;\n\tthis.code = 0;\n\n\tthis.getInfo = function () {\n\t\treturn 'Name: ' + this.name + ' Code: ' + this.code;\n\t}\n}", "entity(id) {\n if (arguments.length === 0) {\n return new Entity(this);\n } else {\n return internal(this).entities.get(id);\n }\n }", "create(newRecord: Object) {\n // Asserting all values in record are valid\n if (!this._assertRecordValid(newRecord)) {\n return\n }\n\n // Asserting store is a server store\n if (this.crudStore.type === 'server') {\n // Executing record create action to server\n this.crudStore.executeServerDatabaseAction('create', newRecord)\n }\n else {\n // Creating new record in temporary store\n this.crudStore.setData(this.crudStore.getData().unshift(newRecord));\n }\n }", "addEntity(entity, x, y) {\n let xIndex = Math.floor(x / SparseEntitiesGrid.CELL_SIZE);\n let yIndex = Math.floor(y / SparseEntitiesGrid.CELL_SIZE);\n\n // Insert entity into cell\n let entitiesInCell = this.grid.get(xIndex + \",\" + yIndex);\n if (entitiesInCell) {\n entitiesInCell.push(entity);\n }\n else {\n let newCellContent = [entity];\n this.grid.set(xIndex + \",\" + yIndex, newCellContent);\n }\n entity.populatedCell = [xIndex, yIndex];\n }", "function SemEntity() {\n throw new Error( 'Abstract constructor called: SemEntity' );\n }", "async create () {\n\t\tthis.model = await this.collection.create(this.model.attributes);\n\t}", "addEntityInstance(entityName, instanceObj) {\n\t\tthis.entityManager.addEntityInstance(entityName, instanceObj);\n\t}", "constructor(entity, {params}) {\n super(entity, {params}, actions);\n }", "enterNewEntityDefinition(ctx) {\n\t}", "function create( data, callback ) {\n\tdata.created = new Date();\n\tParty.create( data, callback );\n}", "function create(article) {\n article.type = 'article';\n article._id = 'article-' + (new Date()).toISOString();\n return db.put(article);\n }", "function create(req, res) {\n req.model.userId = req.auth.userId\n //request to the model payload\n traumaTypesService.create(req.model)\n .then(id => {\n const responseModel = new responses.ItemResponse()\n responseModel.item = id\n res.status(201)\n .location(`${_apiPrefix}/${id}`)\n .json(responseModel)\n })\n .catch(err => {\n console.log(err)\n res.status(500).send(new responses.ErrorResponse(err))\n })\n}", "static create(req, res) {\n const { title, content } = req.body\n const dataUserId = req.userData.id\n\n Article.create({ title, content, UserId: dataUserId })\n .then((newArticle) => {\n res.status(201).json(newArticle)\n })\n .catch((err) => {\n res\n .status(500)\n .json({ message: err.message || 'internal error server' })\n })\n }", "constructor(init){\n Object.assign(this,init)\n this.type = 'entity'\n }", "static save(entity, value) {\n realm.write(() => realm.create(entity, value, true));\n }", "add(entityName, entities) {\n entities = Array.isArray(entities) ? entities : entities ? [entities] : [];\n return { entityName, op: ChangeSetOperation.Add, entities };\n }", "create(nameOrPayload, entityOp, data, options) {\n const payload = typeof nameOrPayload === 'string'\n ? {\n ...(options || {}),\n entityName: nameOrPayload,\n entityOp,\n data,\n }\n : nameOrPayload;\n return this.createCore(payload);\n }", "create() {}", "create() {}", "async create (json) {\n try {\n let record = await this.model.create(json);\n return record;\n } catch(e) {\n return e;\n }\n }", "create () {}", "create () {}", "function Entity(me) {\r\n this.lectureID = me ? me.lectureID : currentLecture.id;\r\n this.pageID = me ? me.PageID : currentPage.id;\r\n this.type = me ? me.entityType : \"textbox\";\r\n this.id = me ? me.entityID : idPlaceHolder + fakeIDCount++;\r\n this.x = me ? me.entityX : 0; // LEAVE THIS AT 50\r\n this.y = me ? me.entityY : 0; // BECAUSE CSS\r\n this.z = me ? me.entityZ : 0;\r\n this.anim = me ? me.entityAnimation : \"none\";\r\n this.height = me ? me.entityHeight : 50;\r\n this.width = me ? me.entityWidth : 50;\r\n this.content = me ? me.entityContent : \"\";\r\n this.status = me ? \"unchanged\" : \"added\";\r\n this.changed = me ? false : true;\r\n}", "function Entity() {\n\n/*\n // Diagnostics to check inheritance stuff\n this._entityProperty = true;\n console.dir(this);\n*/\n\n}", "function constructor() {\n print(\"entityConstructorNested::constructor\");\n var MyEntity = Script.require('./entityConstructorModule.js');\n return new MyEntity(\"-- created from entityConstructorNested --\");\n}", "function EntityID(id) {\n this.id = id || Math.round(Math.random()*entityIdSpace);\n}", "create(entityName) {\n entityName = entityName.trim();\n const definition = this.entityDefinitionService.getDefinition(entityName);\n const dispatcher = this.entityDispatcherFactory.create(entityName, definition.selectId, definition.entityDispatcherOptions);\n const selectors = this.entitySelectorsFactory.create(definition.metadata);\n const selectors$ = this.entitySelectors$Factory.create(entityName, selectors);\n return {\n dispatcher,\n entityName,\n selectors,\n selectors$,\n };\n }", "create(body, res) {\n this.model.create(body).then(object => res.status(200).json({\n type: 'success',\n message: 'created!',\n data: object\n })).catch(e => res.status(200).json({\n type: 'Error',\n message: e.message,\n data: e\n }));\n }", "static newTransaction(props) {\n const transactionId = `TRX::${(0, idGenerator_1.generateId)()}`;\n const createdAt = luxon_1.DateTime.utc().toString();\n const newTransactionProps = {\n transactionId,\n createdAt,\n transactionStatus: 'new',\n inputs: props.inputs,\n outputs: props.outputs,\n };\n if (props.tags) {\n newTransactionProps.tags = Object.assign({}, props.tags);\n }\n if (props.xids) {\n newTransactionProps.xids = Object.assign({}, props.xids);\n }\n const newEntity = new Transaction(newTransactionProps);\n return newEntity;\n }", "static create(person) {\n return new Person(person.id, person.name, person.age);\n }", "function createOrder(em, shipName) {\r\n shipName = shipName || \"New Order\";\r\n var orderType = getOrderType(em);\r\n var order = orderType.createEntity();\r\n order.ShipName(shipName);\r\n return order;\r\n }", "create(req, res) {\n Item.create(req.body)\n .then((newItem) => {\n res.status(200).json(newItem);\n })\n .catch((error) => {\n res.status(500).json(error);\n });\n }", "enterNewEntityType(ctx) {\n\t}", "create(data, params) {}", "function create (kind, data, userId, cb) {\n console.log('INSERT');\n if (!data)\n data = {};\n if (!data.created_on)\n data.created_on = sys.getNow();\n if (!data.created_by)\n data.created_by = userId;\n \n update(kind, null, data, userId, cb);\n}", "constructor() {\n this._entities = {};\n }", "createEntityFrom(...properties) {\n const src = this.slice(...properties)\n return entity(toJS(src))\n }", "function createArticle (articleInfo) {\n try {\n return fetch('/api/newarticle', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n title: articleInfo.title,\n subtitle: articleInfo.subtitle,\n link: articleInfo.link,\n source: articleInfo.source,\n stance: articleInfo.stance\n })\n });\n } catch (err) {\n console.log(err);\n }\n}", "async createPerson(ctx, args) {\n\n args = JSON.parse(args);\n\n //create a new person\n let newPerson = await new Person(args.personID, args.firstName, args.lastName, args.dateOfBirth, args.type, args.email, args.phone);\n\n //update state with new voter\n await ctx.stub.putState(newPerson.personID, Buffer.from(JSON.stringify(newPerson)));\n\n let response = `Person with personID ${newPerson.personID} is updated in the world state`;\n return response;\n }", "function Entity(hash) {\n\t\t\t// All construction is actually done in the init method\n\t\t\tif ( !initializing ) {\n\t\t\t\tif (hash && this.uniqKey) {\n\t\t\t\t\tvar instance;\n\t\t\t\t\tif (instance = this.instances[hash[this.uniqKey]]) {\n\t\t\t\t\t\tif (Morpheus.markDirty || !instance.isDirty())\n\t\t\t\t\t\t\tinstance.set(hash);\n\t\t\t\t\t\treturn instance;\n\t\t\t\t\t} else if (typeof hash[this.uniqKey] !== \"undefined\") {\n\t\t\t\t\t\tthis.instances[hash[this.uniqKey]] = this;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.init.apply(this, arguments);\n\t\t\t}\n\t\t}", "create(data) {\n const doctor = new this.model(data);\n return doctor.save();\n }", "async function create(request, response) {\n const foodObject = request.body;\n const foodData = await data.food.create(foodObject);\n\n response.status(200).send(foodData);\n}", "add(entity) {\n if (!this.contains(entity)) {\n const id = internal(this).nextID++;\n internal(this).entityToID.set(entity, id);\n internal(this).idToEntity.set(id, entity);\n }\n }", "function Entity(id) {\n\t\tvar entity = data.entities[id = parseInt(id, 10)];\n\t\tif (!(id in entities)) {\n\t\t\tentities[id] = this;\n\t\t}\n\n\t\t/**\n\t\t * Returns the numeric ID of the entity.\n\t\t *\n\t\t * @method getId\n\t\t * @return {Number} The numeric ID of the entity.\n\t\t */\n\t\tthis.getId = function () {\n\t\t\treturn id;\n\t\t};\n\n\t\t/**\n\t\t * Returns the entity's custom properties as set in the Canvace\n\t\t * Development Environment.\n\t\t *\n\t\t * The original `properties` object is returned, so that modifications\n\t\t * actually affect the entity's properties.\n\t\t *\n\t\t * @method getProperties\n\t\t * @return {Object} The entity's `properties` field containing the\n\t\t * custom properties the user set in the Canvace Development\n\t\t * Environment.\n\t\t */\n\t\tthis.getProperties = function () {\n\t\t\treturn entity.properties;\n\t\t};\n\n\t\t/**\n\t\t * Indicates whether physics is enabled for this entity.\n\t\t *\n\t\t * Instances of entities that have physics enabled are automatically\n\t\t * \"ticked\" when the whole stage is ticked. \"Ticking\" an entity instance\n\t\t * means calling its `tick` method (see `Canvace.Stage.Instance.tick`), while\n\t\t * \"ticking\" the whole stage means calling the `Stage.tick` method.\n\t\t *\n\t\t * Physics in entities can be enabled or disabled in the Canvace\n\t\t * Development Environment.\n\t\t *\n\t\t * @method isPhysicsEnabled\n\t\t * @return {Boolean} `true` if physics is enabled for this entity,\n\t\t * `false` otherwise.\n\t\t */\n\t\tthis.isPhysicsEnabled = function () {\n\t\t\treturn entity.enablePhysics;\n\t\t};\n\n\t\t/**\n\t\t * Get an actual reference to the bounding box of this entity.\n\t\t * See the `getBoundingBox` method for a detailed description.\n\t\t *\n\t\t * The returned entity is the real bounding box used internally, so any\n\t\t * modification made to the returned object will affect the way the\n\t\t * entity interacts with the surrounding environment.\n\t\t *\n\t\t * @method getRealBoundingBox\n\t\t * @return {Object} An object containing four fields, `i0`, `j0`,\n\t\t * `iSpan` and `jSpan`, describing the bounding box.\n\t\t */\n\t\tthis.getRealBoundingBox = function () {\n\t\t\treturn entity.box;\n\t\t};\n\n\t\t/**\n\t\t * Returns an object describing the bounding box of this entity.\n\t\t *\n\t\t * The returned object contains four real number fields: `i0`, `j0`,\n\t\t * `iSpan` and `jSpan`. The `i0` and `j0` fields are the offsets of the\n\t\t * origin of the bounding box from the position of the entity along the\n\t\t * I and J axis, respectively. The `iSpan` and `jSpan` fields are the\n\t\t * span of the bounding box along the I and J axis, respectively.\n\t\t *\n\t\t * The bounding box is used internally to implement collisions against\n\t\t * tiles or other entities.\n\t\t *\n\t\t * @method getBoundingBox\n\t\t * @return {Object} An object containing four fields, `i0`, `j0`,\n\t\t * `iSpan` and `jSpan`, describing the bounding box.\n\t\t */\n\t\tthis.getBoundingBox = (function () {\n\t\t\tvar result = {\n\t\t\t\ti0: entity.box.i0,\n\t\t\t\tj0: entity.box.j0,\n\t\t\t\tiSpan: entity.box.iSpan,\n\t\t\t\tjSpan: entity.box.jSpan\n\t\t\t};\n\t\t\treturn function () {\n\t\t\t\treturn result;\n\t\t\t};\n\t\t})();\n\n\t\t/**\n\t\t * Enumerates all the instances of this entity currently present in the\n\t\t * stage, filtering them based on their custom properties.\n\t\t *\n\t\t * The `properties` argument contains the filtering properties: an\n\t\t * instance is enumerated only if all of its filtered properties' values\n\t\t * correspond to those declared in the `properties` argument. All other\n\t\t * properties in the instance are not taken into account. This means\n\t\t * that if you specify an empty `properties` object, all the instances\n\t\t * are enumerated.\n\t\t *\n\t\t * Some custom properties may actually be objects containing other\n\t\t * properties. This method performs a recursive deep comparison: the\n\t\t * `properties` object may have nested objects containing other\n\t\t * filtering properties.\n\t\t *\n\t\t * The entity instance is filtered based on its custom *instance*\n\t\t * properties, but its custom *entity* properties are used as a\n\t\t * fallback: if an instance does not contain a required property it is\n\t\t * still enumerated if its entity does.\n\t\t *\n\t\t * Each enumerated instance is passed to the callback function as a\n\t\t * `Canvace.Stage.Instance` object.\n\t\t *\n\t\t * The enumeration can be interrupted by returning `false` in the\n\t\t * `action` callback function.\n\t\t *\n\t\t * @method forEachInstance\n\t\t * @param action {Function} A callback function that gets called for\n\t\t * every instance.\n\t\t *\n\t\t * It receives one single argument of type `Canvace.Stage.Instance` and\n\t\t * can interrupt the enumeration by returning `false`.\n\t\t * @param [properties] {Object} The optional filtering properties.\n\t\t * @return {Boolean} `true` if the callback function returned `false`\n\t\t * and the enumeration was interrupted, `false` otherwise.\n\t\t */\n\t\tthis.forEachInstance = function (action, properties) {\n\t\t\tif (!properties) {\n\t\t\t\tproperties = {};\n\t\t\t}\n\t\t\treturn instances.forEach(function (instance) {\n\t\t\t\tif (id === instance.getEntityId()) {\n\t\t\t\t\tif (assertObject(instance.getProperties(), properties, entity.properties)) {\n\t\t\t\t\t\treturn action(instance);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Creates a new instance of this entity and places it in the stage at\n\t\t * the specified `(i, j, k)` position.\n\t\t *\n\t\t * The new instance has the initial velocity, uniform velocity and\n\t\t * acceleration vectors all set to `(0, 0, 0)`.\n\t\t *\n\t\t * The new instance is returned as a `Canvace.Stage.Instance` object.\n\t\t *\n\t\t * @method createInstance\n\t\t * @param i {Number} The I coordinate where the new instance has to be\n\t\t * placed.\n\t\t * @param j {Number} The J coordinate where the new instance has to be\n\t\t * placed.\n\t\t * @param k {Number} The K coordinate where the new instance has to be\n\t\t * placed.\n\t\t * @return {Canvace.Stage.Instance} The newly created instance.\n\t\t */\n\t\tthis.createInstance = function (i, j, k) {\n\t\t\treturn new Instance({\n\t\t\t\tid: id,\n\t\t\t\ti: i,\n\t\t\t\tj: j,\n\t\t\t\tk: k,\n\t\t\t\tposition: {\n\t\t\t\t\ti: i,\n\t\t\t\t\tj: j,\n\t\t\t\t\tk: k\n\t\t\t\t},\n\t\t\t\tvelocity: {\n\t\t\t\t\ti: 0,\n\t\t\t\t\tj: 0,\n\t\t\t\t\tk: 0\n\t\t\t\t},\n\t\t\t\tuniformVelocity: {\n\t\t\t\t\ti: 0,\n\t\t\t\t\tj: 0,\n\t\t\t\t\tk: 0\n\t\t\t\t},\n\t\t\t\tacceleration: {\n\t\t\t\t\ti: 0,\n\t\t\t\t\tj: 0,\n\t\t\t\t\tk: 0\n\t\t\t\t},\n\t\t\t\tproperties: {}\n\t\t\t}, buckets.addEntity(id, i, j, k));\n\t\t};\n\t}", "enterNewEntityLine(ctx) {\n\t}", "async create(resource) {\n try {\n return this._convertFrom(await this._model.create(resource));\n }\n catch (e) {\n this._handleError(e);\n }\n }" ]
[ "0.7688623", "0.7096921", "0.7091664", "0.70670074", "0.703673", "0.69796306", "0.6925545", "0.6874329", "0.6833655", "0.6754023", "0.6738318", "0.6734428", "0.67286974", "0.6693507", "0.6600522", "0.65460014", "0.64814144", "0.6407978", "0.64077127", "0.6398789", "0.6381803", "0.63620263", "0.6308749", "0.6278953", "0.6272917", "0.62285787", "0.6193521", "0.6185861", "0.6163325", "0.61435324", "0.61077964", "0.610594", "0.60805345", "0.599794", "0.5964243", "0.5952984", "0.5950971", "0.5949012", "0.59465635", "0.59448165", "0.59283686", "0.59092546", "0.5906646", "0.58997864", "0.5898913", "0.58976835", "0.5892568", "0.58834314", "0.5874324", "0.5867181", "0.58663505", "0.58652145", "0.5862989", "0.58505416", "0.5814643", "0.57905734", "0.5779606", "0.5776422", "0.5764187", "0.5731414", "0.57039", "0.5695971", "0.56857306", "0.56623346", "0.56504554", "0.56454307", "0.564478", "0.5625458", "0.56168425", "0.56028557", "0.5575477", "0.5568848", "0.5568848", "0.5568165", "0.5564992", "0.5564992", "0.5555538", "0.5541688", "0.5529838", "0.5526529", "0.5518895", "0.5515794", "0.55151665", "0.5509341", "0.55001205", "0.5494306", "0.5465652", "0.5462891", "0.54620445", "0.546113", "0.545252", "0.54429686", "0.5442095", "0.54392225", "0.54157287", "0.54120374", "0.54074466", "0.5406043", "0.53997695", "0.53957707" ]
0.6037948
33
== ENTITY (QUESTION) ==
function QuestionEntity(key, content, contentExtended, replies) { Entity.call(key); this.content = content; this.contentExtended = contentExtended; this.replies = replies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Question() {}", "set Question(value) {}", "function Question(questionContent){\n this.questionContent = questionContent;\n this.correct = [];\n this.incorrect = [];\n}", "function whatIsQuestion() {\n\n if(anonymousvotingAddr.state() > 0) {\n var q = anonymousvotingAddr.question();\n document.getElementById('title').innerHTML = q;\n }\n}", "isQnA(): boolean {\n return this.type === ClassificationResult.TYPE_QNA;\n }", "function showQuestion(question) {\n questionElement.innerText = question.question\n}", "get question() {\n return this._question;\n }", "question(newQuestion, oldQuestion) {\n if (newQuestion.indexOf('?') > -1) {\n this.getAnswer()\n }\n }", "function Question(question, answers, correct){\n this.question = question;\n this.answers = answers;\n this.correct = correct;\n}", "function Question(question, answers, correct) {\n this.question = question;\n this.answers = answers;\n this.correct = correct;\n}", "function query(node) {\n if (node.isQuestion) {\n $(\"p\").text(node.value);\n $(\"div.myButton\").show(); //show YES or NO buttons\n getYesOrNo(node);\n }\n else {\n onQueryAnimal(node);\n }\n\n}", "function question (questionNumber, correctPerson, quote) {\n\t\tthis.questionNumber = questionNumber;\n\t\tthis.correctPerson = correctPerson;\n\t\tthis.quote = quote;\n\t}", "function _is_simple_same(question, answer, msg){\n\t_complete(question == answer, msg);\n }", "function showQuestion(question) {\n questionEl.innerText = question.question;\n}", "function Question( question, answers, correct ){\n this.question = question;\n this.answers = answers;\n this.correct = correct;\n }", "function Question (qnText,ansNo,qnCode,isUni){\n\tthis.qnText = qnText;\n\tthis.ansNo = ansNo;\n\tthis.qnCode = qnCode;\n this.isUni = isUni;\n}", "function Question(question, answer, correct) {\n // quiz question - string\n this.question = question;\n // answer pool - array\n this.answer = answer;\n // correct answer - number\n this.correct = correct;\n }", "function getQuestion(){\n \n}", "function Question(question, answers, correct) {\n this.question = question;\n this.answers = answers; // Data structure: Array\n this.correct = correct;\n}", "getQuestionStatement() {\n\t\treturn this.statement;\n\t}", "function answerQuestion(question) {\n //alert(question+\" \"+ name);\n if( /^oi|ola|olá|eae|e aí|e ae/i.test(question)) {\n print(\"Oi \" + \", como posso ajudar?\");\n }\n else if (/^compra|acha|consulta|preço/i.test(question)) {\n session = 'search';\n print(\"Legal, adoro comprar pela internet! Qual produto você precisa?\");\n }\n else if (/^não|nao/i.test(question)){\n print(\"Qual produto você deseja então?\");\n }\n else {\n print(\"Precisa ser mais claro, ainda estou em construção, me desculpe.\");\n }\n}", "function TriviaQuestion (question,ans1,ans2,ans3,ans4,correctAns,ansInfo,ansImg) {\n this.question = question;\n this.ans1 = ans1;\n this.ans2 = ans2;\n this.ans3 = ans3;\n this.ans4 = ans4;\n this.correctAns = correctAns;\n this.ansInfo = ansInfo;\n this.ansImg = ansImg;\n}", "function generateBotQuestionnaireResponse(entity){\n\tif(entity == 'NotAtAll'){\n\t\treturn \"Fantastic news!\";\n\t}else{\n\t\treturn \"Thank you.\";\n\t}\n}", "function triviaQuestion () {\n\taxios.get('http://trivia.propernerd.com/api/questions?limit=1&random=true').then((res) => {\n\t\tconst question = res.data[0].question;\n\n\t\tconst answer = res.data[0].answer;\n\n\t\tconst params = {\n\t\t\ticon_emoji : ':bulb:'\n\t\t};\n\n\t\tbot.postMessageToChannel('general', `Trivia: ${question}`, params);\n\n\t\t// Provides Answer on a 5 second delay\n\t\tsetTimeout(function () {\n\t\t\tbot.postMessageToChannel('general', `Answer: ${answer}`, params);\n\t\t}, 5000);\n\t});\n}", "function question(text, answers, correctAnswer){\n this.text = text;\n this.answers = answers;\n this.correctAnswer = correctAnswer;\n}", "function Question(text, choices, answer) { \n this.text=text;\n this.choices=choices;\n this.answer=answer;\n}", "function askQuestion(storyObj) {\n if (storyObj.q === undefined) {\n console.log(chalk.bgYellowBright(storyObj));\n rl.close();\n } else {\n rl.question(chalk.magenta(storyObj.q), (answer) => {\n //check if the user has given us an answer we can understand\n if (storyObj.answers[answer]) {\n // console.log(chalk.cyan(\"value of the users response in our story object is:\" , storyObj.answers[answer]));\n\n askQuestion(storyObj.answers[answer]);\n } else {\n askQuestion(storyObj);\n }\n });\n }\n}", "function Question(question, answers, correct) {\n this.question = question;\n this.answers = answers; // Data structure: Array\n this.correct = correct;\n }", "function allowQuestion() { }", "function fetchQuestion() {\n const result = QuestionModel.findAll({\n attributes: [\"id\", \"Question\"],\n where: {\n [\"Question\"]: {\n [Op.like]: `%${searchString}%`,\n },\n },\n });\n return result;\n }", "function Question(text, post_text, answer1, answer2, answer3) {\n this.text = text\n this.post_text = post_text\n\n this.a1 = answer1[0]\n this.p1 = answer1[1]\n this.uh1 = answer1[2]\n\n this.a2 = answer2[0]\n this.p2 = answer2[1]\n this.uh2 = answer2[2]\n\n this.a3 = answer3[0]\n this.p3 = answer3[1]\n this.uh3 = answer3[2]\n}", "function Question(question, answerArr, correctAnswer, infoText) {\n this.question = question;\n this.answerArr = answerArr;\n this.correctAnswer = answerArr[correctAnswer];\n this.infoText = infoText;\n}", "function Question(question, answers, correctAns) {\r\n this.question = question;\r\n this.answers = answers;\r\n this.correctAns = correctAns;\r\n }", "getQuestion() {\n this.setMethod('GET');\n this.setPlayerId();\n return this.getApiResult(`${Config.PLAY_API}/${this.playerId}/question`);\n }", "function questions(img,id,question){\n\t \"use strict\";\n\t\t\tthis.Image = img;\n\t\t\tthis.Id = id;\n\t\t\tthis.Question = question;\n\t\t}", "addQuestion(question) {\n if (!question.Title) throw \"question has no title\";\n return db.addQuestion(question);\n }", "function makeNewRetiredQuestion(question){\n\n}", "function EquationEntity() {}", "equals(secondQ) {\n\n }", "function Question(title, choices, correctAnswer, category) {\n this.title = title;\n this.choices = choices;\n this.correctAnswer = correctAnswer;\n this.category = category;\n}", "addQuestion(question) {\n if (!question.Title) throw \"question has no title\";\n if (!question.QuestionBody) throw \"question has no content\";\n if (!question.Answers) throw \"question has no answers\";\n if (!question.QuestionType) throw \"question has no type? weird...\";\n return db.addQuestion(question);\n }", "function Question(text, choices, answer) {\n this.text = text;\n this.choices = choices;\n this.answer = answer;\n}", "function Question(text, choices, answer) {\n this.text = text;\n this.choices = choices;\n this.answer = answer;\n}", "function Question(text, choices, answer) {\n this.text = text;\n this.choices = choices;\n this.answer = answer;\n}", "function TriviaQuestion(question, answer, options) {\n this.question = question;\n this.answer = answer;\n this.options = options;\n }", "function Question(question, answers, corrAnswInd){\n\t\tthis.question = question;\n\t\tthis.answers = answers;\n\t\tthis.corrAnswInd = corrAnswInd;\n\t}", "function parseQuestion() {\n const nextQuestion = fetchQuestion();\n return nextQuestion.question;\n }", "function Question(num) {\n this.num = num;\n this.question = questions[num].question;\n this.choices = questions[num].choices;\n this.correctAnswer = questions[num].correctAnswer;\n}", "function Question(num) {\n this.num = num;\n this.question = questions[num].question;\n this.choices = questions[num].choices;\n this.correctAnswer = questions[num].correctAnswer;\n}", "function Question(num) {\n this.num = num;\n this.question = questions[num].question;\n this.choices = questions[num].choices;\n this.correctAnswer = questions[num].correctAnswer;\n}", "function checkAnswerIsCorrect(choice){\n return choice === quiz[\"q\"+qNum].correct;\n}", "function haveSeenQuestion(question) {\n\tvar code = 0;\n\tif (question == \"qMostImportant\") {\n\t\treturn haveSeen.qMostImportant;\n\t} else if (question == \"qRiskFactors\") {\n\t\treturn haveSeen.qRiskFactors;\n\t} else if (question == \"qSeriousHealthProblems\") {\n\t\treturn haveSeen.qSeriousHealthProblems;\n\t} else if (question == \"qPeriodProblems\") {\n\t\treturn haveSeen.qPeriodProblems;\n\t} else if (question == \"qWhichHaveYouUsed\") {\n\t\treturn haveSeen.qWhichHaveYouUsed;\n\t} else if (question == \"qOtherMedications\") {\n\t\treturn haveSeen.qOtherMedications;\n\t} else if (question == \"qOtherHealthIssues\") {\n\t\treturn haveSeen.qOtherHealthIssues;\n\t} else if (question == \"qWhenHaveChildren\") {\n\t\treturn haveSeen.qWhenHaveChildren;\n\t} else if (question == \"qOtherQuestions\") {\n\t\treturn haveSeen.qOtherQuestions;\n\t} else if (question == \"qMethodSpecific\") {\n\t\treturn haveSeen.qMethodSpecific;\n\t} else {\n\t\tconsole.log(\"Invalid question! Called from haveSeenQuestion\");\n\t\treturn;\n\t}\n}", "renderQuestion(question) {\n const { choices, id, text } = question;\n\n return (\n <Question\n key={ shortid.generate() }\n questionId={ id }\n text={ text }\n choices={ choices } />\n );\n }", "function Question (prompt, answers, correctAnswerIndex) {\n this.prompt = prompt\n this.choices = answers\n this.correctChoice = correctAnswerIndex\n}", "function isQuestion(msg){\n return msg.text.match(/\\?$/);\n}", "function fetchQuestion() {\n return questions[currentQuestion-1];\n }", "function getQuestion() {\n var currentQuestion = questions[questionIndex].question;\n return currentQuestion;\n}", "function Question(question, answers, cAnswer, points) {\n this.question = question;\n this.answers = answers;\n this.cAnswer = cAnswer;\n this.points = points;\n }", "function show__ENTITY_ques_(nodeFilterSelectCode) /* (nodeFilterSelectCode : nodeFilterSelectCode) -> bool */ {\n return (nodeFilterSelectCode === 7);\n}", "function generateQuestion() {\n\tvar q = \"If there were \" + estimateCount + \" \" + getEstAdj() + \" \" + getEstNoun() + \" in \" + getEstMin() + \", estimate how many you could expect to see in \" + estRandMins + \" \" + getMinutesSuffix(estRandMins) + \"?\";\n\tget('estBonusQuest').innerHTML = q;\n\tget('estBonusResQuest').innerHTML = q;\n}", "getAnswer(question) {\n var _this = this;\n this.question = question;\n this.feedbackGiven = false;\n fetch(`${this.config.serverUrl}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({ \"query\": question, \"session_id\": this.session_id })\n })\n .then(res => res.json())\n .then(data => {\n console.info(\"Success::\", data);\n this.addMessage(data.reply, false);\n this.input_question = data.input_question;\n this.intent = data.intent;\n this.summ_answer = data.summ_answer;\n this.state = data.state;\n this.detail_answer = data.detail_answer;\n this.chatMessageContainer.appendChild(this.feedbackContainer);\n this.loadingIcon.remove();\n })\n .catch(error => {\n console.error(\"Failed to get response\", error);\n this.loadingIcon.remove();\n });\n }", "function\tgetQuestion(){\n\t//get a random number between zero and numQuestions - 1\n\tvar i = Math.floor((Math.random() * numQuestions) + 0);\t\n\t//find an unasked question\t\n\twhile (askedQuestions[i] === true && (askedQuestions.indexOf(false) !== -1) ){\n\t\tvar i = Math.floor((Math.random() * numQuestions) + 0);\t\t\n\t\t}//while\n\t\n\t\n\n\tif (askedQuestions.indexOf(false) !== -1){ \n\t\t\taskedQuestions[i] = true;\n\t\t\tq = trivia.question[i];\n\t\t\treturn q;\n\t\t} \n\t\telse {\n\t\t\tif (askedQuestions.indexOf(false) === -1 || trivia.qTimer === 6 ) {\n\t\t\t\ttrivia.gameOver = true;\n\t\t\t\ttrivia.timerDone();\n\t\t\t\tq = \"Game Over\";\n\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\treturn q; \n\t\t}\n\t\n} //function getQuestion", "function Question (prompt, choices, correctAnswerIndex) {\n this.prompt = prompt\n this.choices = choices\n this.correctAnswerIndex = correctAnswerIndex\n}", "function showQuestion(question) {\n\tquestionElement.innerText = question.question;\n\t//populate the answers by creating a button for each of them\n\tquestion.answers.forEach(answer => {\n\t\tconst button = document.createElement(\"button\");\n\t\tbutton.innerText = answer.text;\n\t\tbutton.classList.add(\"btn\");\n\t\t//check if the answer is correct by adding a data attribute to the button\n\t\tif (answer.correct) {\n\t\t\tbutton.dataset.correct = answer.correct;\n\t\t}\n\t\t\tbutton.addEventListener(\"click\", selectAnswer);\n\t\t\tanswerButtonsElement.appendChild(button);\n\t});\n}", "checkIfQuestionMarkAlreadyExists(npc) {\n for(let i=0; i<=this.children.length;i++) {\n if( this.children[i] && this.children[i].ownerID == npc.id ) {\n return true;\n }\n };\n return false;\n }", "function nextQuestion() {\n\n}", "function getQ1() {\n return securityQuestion1;\n}", "function presentQuestion(obj){\n\t\tvar int_to_string;\n\t\t$(\"#actual_question\").html(obj.the_questions.the_question[4]);\n\t\tanswer = obj.the_questions.the_question[5];\n\t\tfor (x = 0; x < 4; x++) {\n\t\t\t$(\"#solution_\" + x + \"_right\").html(obj.the_questions.the_question[x]).fadeIn('slow');\n\t\t\t$(\"#solution_\" + x + \"_container\").css(\"background-color\", \"#BFBB11\").css(\"border-color\", \"#730046\").css(\"color\", \"black\");\n\t\t}\n\t\tif (user_type == 'host') {\n\t\t\tswitch (obj.the_questions.the_question[5]) {\n\t\t\t\tcase 0:\n\t\t\t\t\tint_to_string = \"A\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tint_to_string = \"B\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tint_to_string = \"C\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tint_to_string = \"D\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tint_to_string = \"-\";\n\t\t\t}\n\t\t\t$(\"#correct_answer\").html(int_to_string);\n\t\t}\n\t}", "function showQuestion(question) {\n //look up to understand this entire function\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function answerQuestion() {\n answers = [\"It is certain.\", \"Most likely.\", \"Without a doubt.\", \"Ask again later.\", \"Cannot predict now.\", \"Don't count on it.\", \"My sources say no.\", \"Outlook not so good.\"];\n i = getRandomIntInclusive(0, answers.length - 1);\n makeAnswerAppear(answers[i]);\n\n}", "function setQ1(question) {\n this.securityQuestion1 = question;\n}", "function getCurrentQuestion () {\n //console.log('Getting current question object')\n const questionObject = QUESTIONS.find(function(question) {\n return question.id === STORE.currentQuestion;\n });\n return questionObject;\n}", "function quesIdentifiesStudent(ques) \n { \n if (ques.indexOf('first') != -1)\n {\n return true;\n }\n else if (ques.indexOf('last') != -1)\n {\n return true;\n }\n else if (ques.indexOf('name') != -1)\n {\n return true;\n }\n \n else if (ques == 'id')\n {\n return true;\n }\n \n var id_index = ques.indexOf('id');\n if (id_index != -1)\n {\n if (id_index > 0)\n {\n if (ques[id_index-1] == ' ')\n {\n // e.g. \"student id\"\n return true;\n }\n }\n } \n else if (ques.indexOf('id:') != -1)\n {\n // e.g. student id:\n return true;\n }\n else if (ques.indexOf('identity') != -1)\n {\n return true;\n }\n else if (ques.indexOf('identifier') != -1)\n {\n return true;\n }\n else if (ques.indexOf('class') != -1)\n {\n return true;\n }\n else if (ques.indexOf('section') != -1)\n {\n return true;\n }\n else if (ques.indexOf('period') != -1)\n {\n return true;\n }\n else if (ques.indexOf('room') != -1)\n {\n return true;\n }\n else if (ques.indexOf('student') != -1)\n {\n return true;\n }\n else if (ques.indexOf('teacher') != -1)\n {\n return true;\n }\n else if (ques.indexOf('email') != -1)\n {\n return true;\n }\n else if (ques.indexOf('e-mail') != -1)\n {\n return true;\n }\n \n // spanish\n else if (ques.indexOf('correo') != -1)\n {\n return true;\n }\n \n return false;\n }", "enterQnaQuestion(ctx) {\n\t}", "function checkAnswer(event) {\r\n return event.target.innerText === question.answer;\r\n }", "function evaluate(question) {\n\tvar deferred = Q.defer();\n\tvar wordAry = exportWordToArray(question.wordCounts);\n\t// var expectTags = question.tags;\n\n\tgetExpectTags(question).done(function(expectTags) {\n\t\tclassifier(wordAry).done(function(classifierTags) {\n\t\t\tcalculateScore(classifierTags, expectTags);\n\t\t\tdeferred.resolve();\n\t\t});\n\t});\n\n\treturn deferred.promise;\n}", "function BOT_onTell() {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tif(BOT_theReqTopic == thebottopicid) { BOT_reqSay(false,\"ANGRY\",\"NOFACTSABOUTBOT\"); return }\r\n\tif( !BOT_theReqEqual || !BOT_theReqAttribute || !BOT_theReqValue) { BOT_reqSay(false,\"WARNING\",\"BADFACTFORMAT\"); return }\r\n\t// topic.attribute <- value\r\n\tif (!BOT_reqExistAttribute(BOT_theReqAttribute)) return;\r\n\tBOT_set(BOT_theReqTopic,BOT_theReqAttribute,\"VAL\",BOT_theReqValue);\r\n\tBOT_reqSay(true,\"HAPPY\",\"FACTSTORED\",BOT_theReqAttribute,BOT_theReqTopic,BOT_theReqValue);\r\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach (answer => {\n const button = document.createElement('button')\n button.innerText=answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function toggleAnswer(question) {\n document.querySelectorAll(\".question\").forEach(q => {\n if (q != question)\n q.classList.remove(\"question-open\");\n })\n question.classList.toggle(\"question-open\");\n }", "function showQuestion() {\n\n if (currentQuestion <= lastQuestion) {\n\n console.log(currentQuestion);\n questionDisplayed = questions[currentQuestion];\n\n question.textContent = questionDisplayed.question;\n answer1.textContent = questionDisplayed.optionA;\n answer2.textContent = questionDisplayed.optionB;\n answer3.textContent = questionDisplayed.optionC;\n answer4.textContent = questionDisplayed.optionD;\n\n }\n\n}", "async question(str) {\n return new Promise(resolve => this.rl.question(str, resolve));\n }", "function isFormTableQuestion(qId){\n\tif ( !qId ) return false;\n\tvar formTableMetaData = getFormTableMetaData( qId );\n\tvar stringified = '' + formTableMetaData[ FORMTABLE_MAPPING_VIEW_TABLEID_INDEX ];\n\treturn !arrayContains( ['null','undefined',''], stringified );\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n questionPicture.src = question.images\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function loadQuestion(){\n if (currentQuestion <= questions.length -1){\n question.textContent = questions[currentQuestion].question;\n } else {\n return;\n }\n}", "function addQuestion (question) {\n\treturn {\n\t\ttype: ADD_QUESTION,\n\t\tquestion,\n\t}\n}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach((answer) => {\n const button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn-outline-secondary\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener(\"click\", selectAnswer);\n answerButtons.appendChild(button);\n });\n}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function Question(qBody, cAnswer, answersArray) {\r\n\t\t\tthis.qBody = qBody;\r\n\t\t\tthis.cAnswer = cAnswer;\r\n\t\t\tthis.answersArray = answersArray;\r\n\t\t}", "function testQuestion(question) {\n if (question()) {\n correctAnswers++;\n }\n}", "function SaQuestion(el, questionData, messages, componentAudit) {\n BaseQuestion.call(this, el, questionData, messages, componentAudit);\n this.type = QUESTION_TYPES.SA_QUESTION;\n}", "function BOT_wordIsEqu(word) {\r\n\tif(word == \"eq\") return(true) \r\n}", "function hasALetterQ(pet) {\n for (const key in pet) {\n const element = pet[key].toString().toLowerCase();\n if (element.includes(\"q\")) {\n return true;\n }\n }\n}", "function getQuestion() {\n indexFinder = Math.floor(Math.random() * questionArray.length);\n question.innerText = \"\";\n question.innerText = questionArray[indexFinder].q;\n currentCorrectAnswer = questionArray[indexFinder].correct;\n}", "function questions() {\n return {\n 1: {\n ques: \"Archipiélago conocido como 'Las afortunadas'.\",\n ans: \"ISLAS CANARIAS\",\n showAns: \"I**AS **N*R*AS\"\n },\n 2: {\n ques: \"¿Cómo se llama el satélite de planeta Tierra?\",\n ans: \"LUNA\",\n showAns: \"L**A\"\n },\n 3: {\n ques: \"¿Cuál es la capital de Arizona?\",\n ans: \"PHOENIX\",\n showAns: \"P**E**X\"\n },\n 4: {\n ques: \"Personajes que han salido en todas las pelicula de Star Wars:\",\n ans: \"R2-D2 y C-3PO\",\n showAns: \"R*-D* y C-**O\"\n },\n 5: {\n ques: \"¿De qué color es el caballo blanco de Santiago?\",\n ans: \"BLANCO\",\n showAns: \"B**N*O\"\n },\n 6: {\n ques: \"¿Cómo se llama el mejor de amigo de John Snow?\",\n ans: \"SAMWELL TARLY\",\n showAns: \"S**W**L T*RL*\"\n },\n 7: {\n ques: \"¿En qué año se firmó la declaración de independencia de EEUU?\",\n ans: \"1776\",\n showAns: \"1**6\"\n }\n };\n}", "function makeQuestion(question, answers, picture){\n var answersPush = [];\n var correctAnswer = new Answer(\"c\", answers[0], true);\n\n answersPush.push(correctAnswer);\n\n for(var i = 1; i < answers.length; i++){\n var wrongAnswer = new Answer(\"w\", answers[i], false);\n answersPush.push(wrongAnswer);\n }\n \n var question = new Question(question, answersPush, picture);\n return(question);\n}", "function parentIsQuestion(req) {\n return !('answer_id' in req.params);\n}", "function correctAnswer() {\n return $scope.answer.value === $scope.data.solution;\n }", "function McQuestion(el, questionData, messages, componentAudit) {\n BaseQuestion.call(this, el, questionData, messages, componentAudit);\n this.type = QUESTION_TYPES.MC_QUESTION;\n}", "function getQuestion() {\n let num = store.questionNumber;\n let nextQuestion = store.questions[num];\n return nextQuestion;\n}", "function nextQuestion() {\n if(\"Manager\"){\n managerInfo\n \n ifelse(\"Engineer\")\n engineerInfo\n \n ifelse(\"Intern\")\n internInfo\n \n ifelse(undefined)\n throw(err)\n }\n}" ]
[ "0.62489855", "0.60239494", "0.59625596", "0.592345", "0.59078705", "0.58567667", "0.5844578", "0.5829245", "0.58070093", "0.5799393", "0.5758112", "0.57523143", "0.57484645", "0.5739653", "0.5723298", "0.56927073", "0.5662957", "0.5657268", "0.5656958", "0.56536615", "0.56226504", "0.56170106", "0.5610936", "0.56090957", "0.5590782", "0.55893534", "0.5539668", "0.5524665", "0.55194294", "0.55060524", "0.5491192", "0.5489996", "0.54893404", "0.54694194", "0.54594845", "0.5458827", "0.5451904", "0.5447092", "0.543919", "0.5438369", "0.5425708", "0.5421185", "0.5421185", "0.5421185", "0.5418509", "0.5405109", "0.54022175", "0.5392575", "0.5392575", "0.5392575", "0.5373408", "0.53611106", "0.5344554", "0.53133976", "0.5298232", "0.5297661", "0.52847207", "0.5267616", "0.52473253", "0.524575", "0.5245073", "0.5244739", "0.5237532", "0.52147895", "0.52139425", "0.5206533", "0.5205067", "0.52049017", "0.5203256", "0.51937866", "0.5175627", "0.5167739", "0.5154485", "0.51533395", "0.5152619", "0.5134562", "0.51343393", "0.51323426", "0.51311576", "0.5127449", "0.5124792", "0.5120536", "0.51176137", "0.5116505", "0.5113343", "0.51130635", "0.5108199", "0.5102739", "0.5098567", "0.50916547", "0.5082051", "0.5077965", "0.5066109", "0.5061902", "0.5060138", "0.50594926", "0.5052645", "0.5048942", "0.50461364", "0.50422275" ]
0.61487424
1
^ must be `pageRef` specifically, can't be `pageReference` or something else
tileClickHandler() { console.log('titleClickHandler invoked!') const tileClicked = new CustomEvent('tileclick', { detail: this.meetingRoomInfo, bubbles: true }) // Instance of `CustomEvent` will take a name for your event (be thoughtful about this) and the payload (as a value to the `detail` key in an object) this.dispatchEvent(tileClicked); // ^ fires the event from this child component for a parent component to receive // pub-sub fireEvent(this.pageRef, 'pubsubtileclick', this.meetingRoomInfo); // Sub is `selectedMeetingRoom` LWC }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _page1_page() {\n}", "constructor(page){\n this.page = page;\n }", "@wire(CurrentPageReference)\n currentPageReference() {\n this.refreshPages();\n }", "onPageChange(unusedPageId) {}", "changePageIC ({ commit, state }, newPage) {\r\n const pageObject = state.pages[newPage - 1];\r\n if (pageObject) {\r\n if (pageObject.usable) {\r\n commit('setPage', newPage);\r\n }\r\n }\r\n }", "set Page(value) {\n currentPage = value;\n }", "getCurrentPage(value) {\r\n // console.log(value);\r\n }", "get page() {\n return Page.current;\n }", "get pages() {\n return { ...this._pages\n };\n }", "function customTracker_Page ( page ) {\n return customTracker( {\n _upage: page \n });\n}", "@wire(CurrentPageReference)\n setCurrentPageReference(currentPageReference) {\n this.currentPageReference = currentPageReference;\n\n if (this.connected) {\n // We need to have the currentPageReference, and to be connected before\n // we can use NavigationMixin\n this.generateUrls();\n } else {\n // NavigationMixin doesn't work before connectedCallback, so if we have \n // the currentPageReference, but haven't connected yet, queue it up\n this.generateUrlOnConnected = true;\n }\n }", "function setPage(value) {\n currentPage = value;\n}", "get primitivesPage() {\n return this.doc.pages.find(i => (i.name && i.name.toLowerCase() === 'primitives'));\n }", "function Page() {}", "function navigatingTo(args) {\n page = args.object;\n}", "checkPageValid(page){\n return !page || (page) < 1? 1: page;\n }", "fnGoPage() {\n const { goPageRef } = this.refs;\n let goPageNo = parseInt(goPageRef.value);\n this.setState(\n {\n currPage: goPageNo,\n },\n this.fnPrepareData\n );\n }", "adaptPageObject(page, annot_array_reference) {\n if (!page.object_id)\n throw Error(\"Page without object id\");\n let ret = [];\n let lookupTable = this.parser.documentHistory.createObjectLookupTable();\n let page_ptr = lookupTable[page.object_id.obj];\n if (page_ptr.compressed) {\n let obj = object_util_1.ObjectUtil.extractObject(this.data, page_ptr, lookupTable);\n let obj_data = obj.stream.getData().slice(obj.pointer_stream_start, obj.pointer_stream_end + 1);\n let ref_ptr = writer_util_1.WriterUtil.writeReferencePointer(obj.id, false).concat(32);\n let new_data = new Uint8Array(ref_ptr.length + Writer.OBJ.length + obj_data.length + Writer.ENDOBJ.length);\n new_data.set(ref_ptr);\n new_data.set(Writer.OBJ, ref_ptr.length);\n new_data.set(obj_data, Writer.OBJ.length + ref_ptr.length);\n new_data.set(Writer.ENDOBJ, Writer.OBJ.length + obj_data.length + ref_ptr.length);\n return writer_util_1.WriterUtil.replaceAnnotsFieldInPageObject(new_data, page, 0, annot_array_reference);\n }\n return writer_util_1.WriterUtil.replaceAnnotsFieldInPageObject(this.data, page, page_ptr.pointer, annot_array_reference);\n }", "function cust_PageScroll(ref) {\n\n}", "getCurrentPage() {\n return this.pages[this.current_page]\n }", "getCurrentPage() {\n return this.pages[this.current_page]\n }", "function onPageChange(p) {\n setPage(p);\n }", "function PagesContent() {\n\n}", "setPages(page){\n this.page=page;\n }", "get pageContext () {\n return (this.currentContext && this.currentContext.page) || this.page\n }", "onPageChange(page) {\n if (page == \"next\") {\n this.page = this.page + 1;\n } else if (page == \"prev\") {\n this.page = this.page - 1;\n } else {\n this.page = page;\n }\n if (this.page <= 0) {\n this.page = 1;\n }\n if (this.page > this.data.meta.last_page) {\n this.page = this.data.meta.last_page;\n }\n this.fetch();\n }", "function pgChange2(){\r\n pageNo = 2\r\n \r\n}", "handleResStaticObjPageChange(event, page)\t\t\t\t\t\t\t\t// eslint-disable-line no-unused-vars\n\t{\n\t\tthis.setState({\n\t\t\tstaticResPageNum:\tpage\n\t\t});\n\t}", "function changePage(page) { \n clearPage();\n extractData(page);\n }", "function PagesNavigation() {\n\n}", "function getEventPage (e) {\n for (var i=0; i < e.path.length; i++)\n if (e.path[i].dataset && e.path[i].dataset.id)\n return pages.getById(e.path[i].dataset.id)\n}", "function objPage(funLoad, strPrereq, funTest)\n {\n\tthis.funLoad = funLoad;\n\tthis.strPrereq = strPrereq;\n\tthis.funTest = funTest;\n }", "pageClickHandler(pageNumber) {\n if (pageNumber !== this.state.currentPage)\n this.update('currentPage', pageNumber);\n }", "function Page() {\n _ref = Page.__super__.constructor.apply(this, arguments);\n return _ref;\n }", "_getPageMetadata() {\n return undefined;\n }", "function pageQuery(page) {\n console.log('Hit Page', page);\n if (page == 'next') {\n pagOffset += 15;\n query(pagOffset);\n pageNum++;\n } else {\n pagOffset -= 15;\n query(pagOffset);\n // Decrement Page Number\n pageNum--;\n }\n}", "function pgChange3(){\r\n pageNo = 3\r\n \r\n}", "function goPrevPage(){\r\n // ensure page number is not less than 1\r\n if(page > 1){\r\n page -= 1;\r\n }\r\n}", "function PagesTest() {\n\n return (<>\n 233\n </>)\n}", "function getPageLink (req, page) {\n const q = _.assignIn({}, req.query, { page })\n return `${req.protocol}://${req.get('Host')}${req.baseUrl}${req.path}?${querystring.stringify(q)}`\n}", "function PageDocumentation() {\n\tComponentBase.call(this);\n}", "async usePage (pagePattern) {\n debug('use page', pagePattern)\n if (!pagePattern) {\n this.currentContext = null\n } else {\n this.currentContext = await this.waitForPage(pagePattern)\n }\n }", "pageChanged({ location = null }) {\n //referrer has to be set manually with SPA\n this.location.referrer = this.location.current\n this.location.current = location || this.location.current\n }", "get currentPageURL(){\n return this.urlOfPage( this.queue.currentPage )\n }", "function onSuccess(page) {\n //console.log(`Success: ${page.url}`);\n}", "get currentPage() { return this._currentPage; }", "onPageUpdate(pageProps) {\n const updatePagesReference = () => this.getAllPagesPromise().then((allPages) => {\n allPages.update(pageProps)\n })\n\n this.navigateToPageAndDisplayChange(pageProps, updatePagesReference)\n }", "pageToJson(page) {\n const json = {\n title: page.title,\n excerpt: page.excerpt,\n hidden: page.hidden,\n body: page.content,\n next: {\n pages: [],\n description: \"\",\n },\n };\n\n if (page.headers.next) {\n json.next = Object.assign(json.next, page.headers.next);\n if (json.next.pages) {\n // resolve each referenced page in local catalog and derive data\n json.next.pages = json.next.pages\n .map((slug) => this.catalog.find(Page.bySlug(slug)))\n .filter((page) => page !== undefined)\n .map((resolvedPage) => {\n return {\n slug: resolvedPage.slug,\n name: resolvedPage.title,\n icon: \"file-text-o\",\n type: \"doc\",\n };\n });\n }\n }\n\n return json;\n }", "#assertPage(page)\n {\n for (const i in page)\n {\n if (page[i].place_id === this.#pages[this.#currentPageNumber].place_id)\n throw new Error(\"Previous/next page is actually same page!\");\n }\n }", "onPageClick(i){\n this.changePage(i);\n }", "function GoPage(page_name) {\n curr_page = page_name;\n LoadPage(page_name);\n}", "function bindPage() {\n return _bindPage.apply(this, arguments);\n}", "prevPage(state) {\n state.page--;\n }", "currentPage(state) {\n return state.currentPage;\n }", "changePage(fieldPath) {\n const fieldPathArray = this.pathUtilService.toPathArray(fieldPath);\n const listPathArray = this.pathUtilService.getNearestOrRootArrayParentInPath(fieldPathArray, true);\n const listPath = this.pathUtilService.toPathString(listPathArray);\n if (this.pageChange$Map[listPath]) {\n const itemIndex = fieldPathArray[listPathArray.length];\n const itemsPerPage = this.itemsPerPageMap[listPath];\n const page = Math.floor((itemIndex / itemsPerPage) + 1);\n this.pageChange$Map[listPath].next(page);\n }\n }", "function goNextPage(){\r\n // ensure does not exceed max page limit\r\n if(page < maxPage){\r\n page = page + 1;\r\n }\r\n}", "renderPage() {}", "getPage(page) {\n let pageName = page;\n const that = this;\n\n if (!pageName) {\n pageName = this.MAIN_PAGE;\n }\n\n $.ajax({\n type: 'GET',\n // cut first and navigation in page #/home/#car => home\n url: `${this.PAGES_PATH}/${pageName.replace('#/', '').substring(0, pageName.indexOf('/#') === -1 ? pageName.length : pageName.indexOf('/#') - 2)}.html`,\n dataType: 'html',\n success(msg) {\n $(that.CONTAINER).html(msg);\n // if navigation in page\n if ((/\\/#/).test(pageName)) {\n Router.scrollToId(`${pageName.substring(pageName.indexOf('/#') + 1, pageName.length)}`);\n }\n },\n error(error) {\n $(that.CONTAINER).html(`<h1>${error.status}</h1> <h2>${error.statusText}</h2>`);\n },\n });\n }", "function Page(Name,Num) {\n this.name = Name;\n this.number = Num;\n this.isCurrent = false;\n }", "onChange (page) {\n handleRefresh({\n page: page.current,\n pageSize: page.pageSize,\n })\n }", "goTo(page) {\n this.currentPageNumber = page > 0 ? page - 1 : 0;\n this.updateData();\n }", "function findPageById(pageId) {\n\n for(var p in pages) {\n\n if(pages[p]._id == pageId) {\n return angular.copy(pages[p]);\n }\n }\n return null;\n }", "function getPortalOnPage(pageNumber) {\r\n\tget('pageNumberId').value = pageNumber;\r\n\tdocument.forms[\"paginationForm\"].submit();\r\n}", "function getPortalOnPage(pageNumber) {\r\n\tget('pageNumberId').value = pageNumber;\r\n\tdocument.forms[\"paginationForm\"].submit();\r\n\r\n}", "function getPages() {\r\n\treturn pages;\r\n}", "function pageNavignByDropDown()\r\n{\r\n var current_page = getElemnt(\"current_page\");\r\n var nextRecordKey = current_page.value;\r\n pageNavign(nextRecordKey);\r\n}", "linkResolver(doc) {\n if (doc.type === 'page') {\n return `/page/${doc.uid}`\n }\n\n return '/'\n }", "nextPage(state) {\n state.page++;\n }", "function pageNoPass(pageNo) {\n console.log(\"Pageno\", pageNo)\n searchPhoto(pageNo)\n\n}", "prevPage() {\n if (this.page > 1) {\n this.page--;\n this.search();\n }\n }", "prevPage() {\n const { onChange, page, perPage } = this.props;\n onChange(page - 1, perPage);\n }", "function buildCounter(page){ return page; }", "function goToPage(pageNum){\n pageNum = pageNum*100-100;\n pagePosition = pageNum;\n console.log(pageNum);\n styleTag.innerHTML = `.screen{transform: translate(-${pageNum}%, 0%)}`\n checkSpecialPage()\n}", "function set_page(page) {\r\n\tselected = page;\r\n}", "onPage(value) {\n this.model.page = value;\n }", "onPage(value) {\n this.model.page = value;\n }", "function onChange() {\n setPage(pageStore.getPage());\n }", "GET_PAGE_DATA (state, pageData) {\n state.pageData = pageData;\n }", "setPage(newPage) {\n _data.currentPage = newPage;\n Store.emitChange();\n }", "function _addReferencePages (_sourceFolder,_sourceFileExtensionRegExp,_referenceFolder) {\n\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\tvar\n\t\t\t\t\t\t\t\t\t\t_fileNo = -1,\n\t\t\t\t\t\t\t\t\t\t_referenceUrlPrefix = '/' + (_referenceFolder || _sourceFolder)+ '/',\n\t\t\t\t\t\t\t\t\t\t_files = _fileSystem.getFiles ({\n\t\t\t\t\t\t\t\t\t\t\tpath:_sourcePath + '/' + _sourceFolder,\n\t\t\t\t\t\t\t\t\t\t\tpathMatcher:_sourceFileExtensionRegExp\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t_filesLength = _files.length,\n\t\t\t\t\t\t\t\t\t\t_fileName\n\t\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t\t\t++_fileNo < _filesLength;\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t_urlDictionary [\n\t\t\t\t\t\t\t\t\t\t_fileName = Uize.Url.from (_files [_fileNo]).file\n\t\t\t\t\t\t\t\t\t\t\t.replace (_sourceFileExtensionRegExp,'')\n\t\t\t\t\t\t\t\t\t] = _referenceUrlPrefix + _fileName + '.html'\n\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t}", "get page() {\n\t\treturn this.content[this.i];\n\t}", "async page (page) {\n const pageHtml = parse(page.html)\n\n if (!page.route.includes('/blog/')) {\n let pageMeta = {}\n\n // eslint-disable-next-line array-callback-return\n pageHtml.querySelectorAll('meta').map((meta) => {\n const name = meta.getAttribute('name')\n const property = meta.getAttribute('property')\n\n if (property === 'og:title') {\n // og:title, not the page title\n const ogTitle = meta.getAttribute('content')\n\n pageMeta.name = meta.getAttribute('content')\n }\n })\n\n if (page.route !== '/') {\n pageMeta.path = page.route\n } else {\n // For the homepage; otherwise the image generation file structure doesn't work\n pageMeta.path = '/index'\n }\n\n pagesMetaForPreviewImages.push(pageMeta)\n }\n }", "function DfoSearchPage(/**string*/ page)\r\n{\r\n\tSeS(\"G_NavigationSearchBox\").DoSearch(page);\r\n\tDfoWait();\r\n}", "handleNextPage() {\n this.props.getNextPage(this.props.page + 1);\n }", "function investigatePage() {\r\n var rows = document.evaluate(\"//div[@class='objectinfo']\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageIDs[i] = /immo(\\d+)/.exec(rows.snapshotItem(i).id)[1];\r\n lastSeenIDs[pageIDs[i]] = new Date().getTime();\r\n }\r\n rows = document.evaluate(\"//div[@class='titel']/a\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageTitles[i] = rows.snapshotItem(i).textContent.toString();\r\n }\r\n rows = document.evaluate(\"//div[@class='adresse']\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageLocations[i] = rows.snapshotItem(i).textContent.toString();\r\n }\r\n if (lastSeenIDs) GM_setValue('lastSeenIDs',lastSeenIDs.toSource());\r\n}", "addPage() {\n\t\tthrow new Error('You cannot directly add pages in a RichMenu');\n\t}", "function loadRelatedHashPage(pageHash, billerCorpId) {\n\t\"#searchBiller\" === pageHash ? navigateToBillerSearch(!1) :\n\t\"#addBiller\" === pageHash ? navigateToAddEditBiller(billerCorpId, null, null, true , false, null) :\n\t\"#receipt\" === pageHash ? navigateToSummaryView() : \n\t\"#editProfile\" === pageHash ? navigateToEditProfile(callFrom_constant.CALL_EDIT_PROFILE_REFRESH) : \n\t\"#profile\" === pageHash ? navigateToProfile() : \n\t\"#profileSecurity\" === pageHash ? navigateToProfileSecurity(callFrom_constant.CALL_SECURITY_PROFILE_REFRESH) : \n\t\"#balanceDetails\" === pageHash ? navigateToBalanceDetails() : \n\t\"#addMoney\" === pageHash ? navigateToAddMoney() : \n\t\"#more\" === pageHash ? navigateToMore() : navigateToHome();\n}", "get differentFirstPage() {\n return this.differentFirstPageIn;\n }", "newPage() {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n let scope;\n // ask for the \"scope\" if the scope feature is enabled\n if (this.props.features.scopes &&\n Object.keys((_a = this._scopes) !== null && _a !== void 0 ? _a : {}).length) {\n // ask for the page scope\n scope = yield this._ask('scope', {\n image: {\n url: 'https://picsum.photos/600/600?v=scope',\n },\n });\n }\n const result = yield this._ask('pageMetas', {\n image: {\n url: 'https://picsum.photos/600/600?v=pageMetas',\n },\n scope,\n });\n _console.log('COCO', result);\n });\n }", "function gotonextpage(upperCase){\n clickAnchor(upperCase,getItem(\"more\"));\n}", "handlePageChange(page) {\n this.setState({currentPage: page});\n }", "function checkPage(){\n\n\t\tvar page_id = $(\".navigation ul li.active a\").attr(\"href\").split(\"#\")[1];\n\n\t\tgoto_page(page_id);\n\n\t}", "loadPageSync(rawPath){const pagePath=Object(_find_path__WEBPACK_IMPORTED_MODULE_3__[\"findPath\"])(rawPath);if(this.pageDb.has(pagePath)){return this.pageDb.get(pagePath).payload;}return undefined;}", "loadPageSync(rawPath){const pagePath=Object(_find_path__WEBPACK_IMPORTED_MODULE_3__[\"findPath\"])(rawPath);if(this.pageDb.has(pagePath)){return this.pageDb.get(pagePath).payload;}return undefined;}", "verifyPageNumberInsidePdf(pageNumber, pdfFilePath) {\r\n let dataBuffer = fs.readFileSync(pdfFilePath);\r\n pdf(dataBuffer).then((data) => {\r\n assert.expectToContain(pageNumber, data.numpages);\r\n }).catch((error) => {\r\n logger.Log().error('The exception caused due to :- ' + error);\r\n console.log('The pdf couldnt read beacuse of :- ' + error);\r\n });\r\n }", "function ValidateCustomPageEventHandler() {\r\n return ValidateCustomDocumentReferrals();\r\n}", "function onDocumentLoadSuccess({ numPages }) { \n setNumPages(numPages); \n setPageNumber(1); \n }", "static goPage(params, page) {\n const navigation = NavigationUtil.navigation;\n /*children level router can't jump to parent level router*/\n //const {navigation} = params;\n if (!navigation) {\n console.log('NavigationUtil.navigation can\\'t be null.')\n }\n navigation.navigate(\n page,\n {\n ...params\n }\n );\n }", "getPageID() {\n if (!window.pageJson) return 0;\n return window.pageJson.campaignPageId;\n }", "async function pageContent(pag) {\n var txt = await pag.content();\n return txt.replace(/\\W*==\\W*references\\W*==[\\s\\S]*/i, '');\n}", "fetchPage(pageid, keys) {\n return new Promise((resolve, reject) => {\n this.collection.findOne({\n _id: mongo.ObjectID(pageid)}, (err, page) => {\n if(err) return reject(err);\n return resolve(new Page(keys, page))\n });\n });\n }" ]
[ "0.63993454", "0.6397837", "0.6283674", "0.62834054", "0.60920453", "0.6061683", "0.5991547", "0.5981727", "0.5967133", "0.5942613", "0.593631", "0.59243906", "0.5921996", "0.5920073", "0.5869142", "0.58208555", "0.58171266", "0.5779569", "0.5774384", "0.57672745", "0.57672745", "0.57168216", "0.5714633", "0.57134527", "0.57129145", "0.56799525", "0.5629783", "0.56276494", "0.5621918", "0.5615805", "0.56146544", "0.560884", "0.55991435", "0.55877876", "0.5580293", "0.5574993", "0.556873", "0.5566913", "0.55617315", "0.554263", "0.5520328", "0.5505365", "0.54866236", "0.5480809", "0.54786515", "0.5469271", "0.5461308", "0.54432577", "0.5420587", "0.54173905", "0.5414248", "0.54114527", "0.540843", "0.5403956", "0.5400037", "0.5391428", "0.5377091", "0.5372006", "0.53698534", "0.53636646", "0.5361327", "0.535343", "0.53494895", "0.53449607", "0.53392124", "0.53377783", "0.5334424", "0.53325474", "0.53324366", "0.53291917", "0.5327037", "0.5320147", "0.5315742", "0.5311184", "0.5307341", "0.5307341", "0.53069085", "0.53026456", "0.53021276", "0.5301883", "0.529744", "0.528518", "0.5284421", "0.52819157", "0.5279113", "0.52786875", "0.52762747", "0.52760977", "0.5267466", "0.5267227", "0.5259965", "0.5256354", "0.52357656", "0.52357656", "0.52293354", "0.52288187", "0.5227048", "0.5223773", "0.52214146", "0.52196544", "0.5215717" ]
0.0
-1
combines searchURL with user input
function formatQueryParams(params) { const queryItems = Object.keys(params).map( (key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}` ); return queryItems.join("&"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateURL(url) {\n var value = input.value.replace(/ /g, \"%20\");\n var link = url + value + callback;\n console.log(link);\n search(link);\n }", "function search(){\n let query;\n if(searchLocation===\"location\"){\n searchLocation(\"\")\n }\n query=`https://ontrack-team3.herokuapp.com/students/search?location=${searchLocation}&className=${searchClass}&term=${searchName}` \n prop.urlFunc(query);\n }", "function search() {\n var term = document.getElementById(\"searchterm\").value;\n var type = document.getElementById(\"searchtype\").value;\n\n window.location = \"../search/?term=\" + term + \"&type=\" + type;\n}", "function search_scholars_portal_journals() {\n var url=\"http://proxy.library.carleton.ca/login?url=http://journals2.scholarsportal.info./search-advanced.xqy?q=\";\n var input_element = document.getElementById(\"search_terms\");\n var end_of_url = \"&search_in=anywhere&date_from=&date_to=&sort=relevance&sub=\";\n document.location = url + encodeURIComponent(input_element.value) + end_of_url;\n}", "function handleSubmit() {\n //Take the search term string entered by the user in the input field, add it to the baseUrl, make a fetch request to that new url, and append the results of what we searched for to the DOM in the correct element, wrapped in li tags\n}", "function search() {\n\tconsole.log(\"Googling \\\"\" + box.value + \"\\\"\");\n\tconsole.log(\"Encoded query: \\n\" + encodeURIComponent(box.value));\n\tdocument.location.href = \"https://www.google.com/?gws_rd=ssl#safe=off&q=\" + encodeURIComponent(box.value);\n}", "function searchURL(value) {\n var searchUrl = \"https://maps.googleapis.com/maps/api/geocode/json?address=\"+ value+\"&key=AIzaSyDDNGnZS3lFLPw1DLC_5gAT5F_9hga1c-k\";\n search(searchUrl);\n return searchUrl;\n}", "function search() {\r\n var search = document.getElementById('searchbox').value;\r\n search = encodeURI(search);\r\n window.location.href = `search.php?movie=${search}`;\r\n}", "function getSearchUrl(inputstr) {\n\t// if there is a comma delimiter within the input string...\n\tif (inputstr.search(\",\" != -1))\n\t{\n\t\t// Split up the input into an array to fill the state and city variables.\n\t\t// The limit is set to 3 so that no garbage collects in the second array element (in case more commas were added after state)\n\t\tvar inputArray = inputstr.split(\",\", 3);\n\t\tvar city = inputArray[0];\n\t\tvar state = inputArray[1];\n\t}\n\telse\n\t{\n\t\tvar city = inputstr;\n\t\tvar state = null;\n\t}\n\n\tif (state != null)\n\t{\n\t\t// returns the url used for searchCityList\n\t\treturn phpPath + \"citySearch.php?cityInput=\" + city + \"&stateInput=\" + state;\n\t}\n\telse\n\t{\n\t\t// keyurl not given since state is required for the cookie system to work.\n\t\treturn phpPath + \"citySearch.php?cityInput=\" + city;\n\t}\n}", "function wikiSearch() {\n //run the API when enter pressed, after URL is contructed with user input\n \n var inputStringSpaced = inputString.split(\" \").join(\"%20\");\n //alert(inputStringSpaced);\n \n var URL = \"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&generator=search&callback=?&utf8=1&formatversion=2&inprop=url&gsrsearch=\" + inputStringSpaced + \"&gsrprop=snippet\";\n \n \n //alert(URL);\n \n $.getJSON(URL, updateResults);\n //getJSON from the API url, send to update func\n}", "function getInput(event){\n event.preventDefault();\n var searchQuery;\n searchQuery = ($(searchBox).val());\n console.log(searchQuery);\n var ytUrl =`https://youtube.googleapis.com/youtube/v3/search?type=video&part=snippet&maxResults=25&q=${searchQuery}\\\\+'+travel'+'&key=AIzaSyDD9MbkIVSzT2a3sOv97OecaqhyGdF174c`;\n searchVideos(ytUrl);\n\n var key = `AIzaSyDWNMiooGhkXMAhnoTL8pudTR83im36YPo`;\n \n var bookUrl = `https://www.googleapis.com/books/v1/volumes?q=${searchQuery}\\\\+travel+guide&key=${key}`;\n searchBooks(bookUrl);\n}", "function search() {\n\tvar search_val = document.getElementById('search').value;\n\tvar queryString = \"?media_type=image&year_start=1920&year_end=2019&page=1&q=\" + search_val;\t\n\twindow.location.href = \"search.html\" + queryString;\n}", "function parseSearchTermURL() {\n\tsearchTermURL = encodeURIComponent(searchTerm);\n\tsearchTermURL = searchTermURL.replace(/'/g, '%27');\n}", "function newsSearchString() {\n let cat = $(\"#select-categories\").val();\n let reg = $(\"#select-region\").val();\n let lang = $(\"#select-langauge\").val();\n let keyword = $(\"#keywords\").val();\n\n const enURL = encodeURI(\n `${BASE_URL}search?&categories=${cat}&languages=${lang}&regions=${reg}&keywords=${keyword}&${KEY}`\n );\n if (keywords === \"\") {\n return encodeURI(`${BASE_URL}latest-news`);\n } else {\n return enURL;\n }\n}", "function searchFor(searchterm) {\n // Check if a space is found and if it is, replace it with a +\n console.log('Your search term is: ' + searchterm)\n let newSearchURL = baseURL + \"term=\" + searchterm.split(' ').join('+').toLowerCase()\n console.log('Your new search term is: ' + newSearchURL)\n // Query iTunes API and display results in React\n}", "function searchme() {\n\tvar search_val = document.getElementById('search').value;\n\tvar start_year = document.getElementById('start').value;\n\tvar end_year = document.getElementById('end').value;\n\tvar location_data = document.getElementById('location').value;\n\tvar photographer = document.getElementById('photographer').value;\n\n\tvar queryString = \"?media_type=image&year_start=\" + start_year + \"&year_end=\" + end_year + \"&location=\" + location_data + \"&photographer=\" + photographer + \"&page=1&q=\" + search_val;\t\n\n\twindow.location.href = \"search.html\" + queryString;\n}", "search() {\n let self = this;\n let inputField = self.getEl('search_field');\n window.location = window.location.origin + `/search/${inputField.value}`;\n }", "function getSearchQuery() {\n\t// Parse search pattern from URL\n\tvar query = location.search.substr(1).replace(/%20/g, ' ');\n\n\tif (query) {\n\t\tsearch(query); // Check for matches\n\n\t\tif (focusFirstOccurence())\n\t\t\tdocument.getElementById('searchBar').value = query;\n\t\telse\n\t\t\tresetTabIndex();\n\t}\n}", "function createURL(search_input, string_or_ID) {\n\tlet url;\n\tlet input = search_input.trim();\n\tswitch(string_or_ID) {\n\t\tcase \"string\": \n\t\t\turl = \"http://www.omdbapi.com/?apiKey=6c3a2d45&plot=full&type=movie&s=\" + input;\n\t\t\tbreak;\n\t\tcase \"ID\": \n\t\t\turl = \"http://www.omdbapi.com/?apiKey=6c3a2d45&plot=full&i=\" + input;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\terrorHandeler(\"Failed to create URL\");\n\t}\n\treturn url;\n}", "function buildQueryURL() {\n\n var baseURL = \"https://api.openweathermap.org/data/2.5/weather?q=\";\n var key = \"&units=imperial&appid=6c743e42a0f9ac97fab6ec81e5e3acc9\";\n var querySearch = $(\"#searchBar\")\n .val()\n .trim();\n var all = baseURL + querySearch + key;\n return baseURL + querySearch + key;\n}", "function searchCall() {\n $('#searchButton').click(function () {\n var qString = $('#searchInput').val();\n bindSearchUrl(qString);\n });\n\n $('#searchInput').keypress(keypressHandler);\n }", "function retSearchStr(usrInput) {\n var query = \"https://en.wikipedia.org//w/api.php?action=query&format=json&origin=\\*&uselang=user&list=search&srsearch=\"; // MediaWiki web service API\n return query + encodeURI(usrInput);\n }", "function loadPhotosBasedOnSearchInput() {\n var tags = searchTextElement.value;\n // Add new page to browser history\n window.history.pushState(null, null, \"?tags=\" + tags);\n loadPhotos(tags);\n }", "function onSearch(e) {\n e.preventDefault();\n\n var s = $(\"#searchBox\").val();\n \n window.location.href = \"./search.html?s=\" + encodeURIComponent(s);\n\n}", "function urlSearch(input) {\n\tvar url = \"http://api.giphy.com/v1/gifs/search?q=\" + input + \"&api_key=dc6zaTOxFJmzC\";\n\n\t// AJAX Request\n\tvar GiphyAJAXCall = new XMLHttpRequest();\n\tGiphyAJAXCall.open('GET', url);\n\tGiphyAJAXCall.send();\n\n\tGiphyAJAXCall.addEventListener('load', function(e) {\n\t\tvar data = e.target.response;\n\t\tpushToDom(data);\n\t});\n}", "function buildURL(citySearch){\n var userCity = $(\"#userInput\").val().trim();\n userCity = userCity.replace(/\\s+/g, \"\");\n localStorage.setItem('lastSearch', userCity)\n var citySearch = 'https://api.openweathermap.org/data/2.5/forecast?q=' + userCity + '&appid=7a55a4098897a5f61d0e5acedb9f428e';\n return (citySearch);\n }", "function google_search() {\n var query = document.getElementById(\"google-search\").value;\n var domain = $(\"meta[name=search-domain]\").attr(\"value\");\n window.open(\"https://www.google.com/search?q=\" + query + \"+site:\" + domain);\n}", "function initiate_search() {\n let values = $('#repo').val().split('/').filter(Boolean);\n let len = values.length;\n\n if (len < 1) {\n $('#' + UF_ID_MSG).html('Please enter a valid query: it should contain two strings separated by a \"/\"');\n return; // abort\n }\n\n disable_btn();\n clear_old_data();\n request_fork_page(1, values[len-2], values[len-1], token);\n}", "function displaySearchResult(search) {\n window.location.replace(\"?=\" + food + \"\");\n }", "function submitSearch() {\n hitSelected = document.getElementsByClassName('aa-cursor')[0];\n\n if (hitSelected && searchQuery) {\n const articleUrl = hitSelected.querySelector('a').href;\n window.location.assign(articleUrl);\n } else if (!hitSelected && searchQuery && hits) {\n window.location.assign(`{{ site.url }}/search?query=${searchQuery}`);\n }\n }", "function searchStoreProduct(store_id){\r\n\t//var keyword = $('#itxt_search').val();\r\n\tvar keyword = document.getElementById('istore_txt_search').value;\r\n\tkeyword=keyword.toLowerCase();\r\n\t\r\n\tvar base_url = document.domain + window.location.pathname;\r\n\tdocument.location.href = 'http://' + base_url + '?cat=q&q=' + keyword;\r\n}", "function goToSearch(){\n var keyword = document.getElementById(\"searchBox\").value;\n\n if(keyword != \"\"){\n window.location = \"searchPage.html?keyword=\" + keyword;\n }\n}", "function autocompleteURL (input, url) {\r\n var urlObj = new URL(url)\r\n var hostname = urlObj.hostname\r\n\r\n // the different variations of the URL we can autocomplete\r\n var possibleAutocompletions = [\r\n // we start with the domain, including any non-standard ports (such as localhost:8080)\r\n hostname + (urlObj.port ? ':' + urlObj.port : ''),\r\n // if that doesn't match, try the hostname without the www instead. The regex requires a slash at the end, so we add one, run the regex, and then remove it\r\n (hostname + '/').replace(urlParser.startingWWWRegex, '$1').replace('/', ''),\r\n // then try the whole URL\r\n urlParser.prettyURL(url),\r\n // then try the URL with querystring\r\n urlParser.basicURL(url),\r\n // then just try the URL with protocol\r\n url\r\n ]\r\n\r\n var autocompleteResult = autocomplete(input, possibleAutocompletions)\r\n\r\n if (!autocompleteResult.valid) {\r\n return -1\r\n } else if (autocompleteResult.matchIndex < 2 && urlObj.pathname !== '/') {\r\n return 0\r\n } else {\r\n return 1\r\n }\r\n}", "function getSearch() {\n\tlet searchedVal = document.getElementById(\"search-box\").value;\n\tif (searchedVal.length > 0) {\n\t\tfetchURL = \"https://api.themoviedb.org/3/search/movie?api_key=50abfd6ea4dfae3d8f95be50a06763e0&language=en-US&query=\" + searchedVal;\n\t}\n\telse {\n\t\tfetchURL = \"https://api.themoviedb.org/3/movie/top_rated?api_key=50abfd6ea4dfae3d8f95be50a06763e0&language=en-US\";\n\t}\n\n}", "function newSearch() {\n window.location.href = \"../list/?service=\" + svcSearch +\"&range=\" + distSearch+\"/\"\n }", "function buildSearchUrl(band) {\r\n return proxyUrl + searchUrl + band + searchUrlEnd;\r\n}", "getSearchURL(search) {\n return __awaiter(this, void 0, void 0, function* () {\n const url = yield this.config.get(configSection.webSearchURL);\n return url.replace(/\\${searchTerm}/g, encodeURIComponent(search));\n });\n }", "getSearchURL(search) {\n return __awaiter(this, void 0, void 0, function* () {\n const url = yield this.config.get(configSection.webSearchURL);\n return url.replace(/\\${searchTerm}/g, encodeURIComponent(search));\n });\n }", "function finalurl() {\n var url = new URL(window.location.href);\n var search_params = url.searchParams;\n search_params.set('sorting', document.getElementById(\"sort-list\").value);\n url.search = search_params.toString();\n var new_url = url.toString();\n return new_url\n }", "function goToNewSearch() {\n var urlParams = new URLSearchParams();\n\n if ($('#searchbar').val() !== '') {\n urlParams.append('keywords', $('#searchbar').val());\n }\n\n if ($(':checkbox:checked').length > 0) {\n $('.program-checkbox:checked').each(function () {\n var program = $(this).val();\n console.log(program);\n urlParams.append('program', program);\n });\n $('.top :checked').each(function () {\n var agency = $(this).val();\n urlParams.append('agency', agency);\n });\n $('.sub :checked').each(function () {\n var branch = $(this).val();\n urlParams.append('branch', branch);\n });\n }\n\n window.location.href = window.location.pathname + '?' + urlParams.toString();\n return false;\n}", "function buttonListenerSearch(){\n let button = document.getElementById(\"button-search\");\n console.log(button);\n button.addEventListener('click', ()=>{\n const searchField = document.getElementById(\"bookSearch\").value;\n console.log(searchField);\n //add to the GET url the input of the search field.\n const urlSearch = \"http://localhost:5000/books/search=\" + searchField;\n if(searchField){\n //get the page\n window.location.href = urlSearch;\n }\n })\n\n\n}", "function buildUrl(searchTerm){\n return {\n s: searchTerm,\n r: \"json\"\n }\n }", "function searchUser() {\n var WINDOW_LOCATION_SEARCH = \"?search={search}\"\n var term = $('#search').val().trim();\n if (term.length > 3) {\n var bySearchTermUrl = GET_USERS + WINDOW_LOCATION_SEARCH.replace('{search}', term)\n fetchUsers(bySearchTermUrl)\n }\n}", "function createSearchUrl(query, fields){\n if(query === null) return;\n var words = query.split(\" \");\n var url = \"https://api.spotify.com/v1/search\";\n url += \"?q=\";\n for(var i = 0; i < words.length; i++){\n url += words[i];\n if(i != words.length - 1) url += \"%20\";\n }\n\n url += \"&type=\"\n for (var i = 0; i < fields.length; i++){\n url += fields[i];\n if(i != fields.length - 1) url += \",\";\n }\n\n url += \"&limit=20\";\n return url;\n}", "function searchIt() {\r\n if (MovieListLoaded && SeriesListLoaded) {\r\n var searchFor = window.location.href.split('?q=');\r\n var searchQuery = searchFor[1];\r\n\r\n if (searchQuery !== null && searchFor.length > 1) {\r\n document.getElementById('searchText').value = decodeURI(\r\n searchQuery);\r\n getMovies(searchQuery);\r\n }\r\n }\r\n}", "function make_search_url() {\n var url_for_search_without_localization = \"/admin/keywords/search\";\n var localization = $(\"#keyword_search_button\").data('localization');\n var url_for_search = (localization === 'en') ? url_for_search_without_localization : \"/\"+localization+url_for_search_without_localization;\n \n return url_for_search;\n }", "function SearchUserObject() {\n concatResult();\n window.searchQuery = searchInput.value;\n CreateURI(centerLat, centerLng);\n}", "function searchSuggest(searchBox) {\n var str = escape(document.getElementById(searchBox).value);\n API.GET\n}", "function attemptSearchByUrl(){\n // Manage GET query parameters from the URL\n var getQueryParams = $location.search();\n var hasParams = Boolean(Object.keys(getQueryParams).length);\n\n // Conduct search or reset the selection\n if (hasParams){\n vm.searchCriteria = getQueryParams;\n search(vm.searchCriteria);\n populateMultiChoiceSearchSelection(getQueryParams);\n }else{\n vm.searchCriteria = {}\n }\n }", "function init_progsearch()\n{\nvar o = document.getElementById('progsearch_input');\nif (!o) return; /* this input field not on the page is not an error */\nif (location.search.indexOf('&SUBKEY=') != -1)\n var searchPattern = /&SUBKEY=([^&]+)/;\nelse if (location.search.indexOf('?SEARCH=') != -1)\n var searchPattern = /&SEARCH=([^&]+)/;\nelse if (location.search.indexOf('searcharg=') != -1)\n var searchPattern = /searcharg=([^&]+)/;\nelse return;\nvar searchTextArray = searchPattern.exec(document.location.search);\nvar searchText = searchTextArray[1].replace(/\\+/g,\" \");\nvar searchText1 = strip_surrounding_parens(decodeURIComponent(searchText));\no.value = searchText1;\nreturn;\n}", "function redirectSearches(){\r\n\t\r\n\tvar searchList = getUrlParameter(\"search\");\r\n\tvar eventAddress = getUrlParameter(\"event\");\r\n\tvar isManual = getUrlParameter(\"manual\");\r\n\t\r\n\t\r\n\t//Nearby Search\r\n\tif (searchList != undefined && eventAddress == undefined){\r\n\t\tsearchMap(searchList,false);\r\n\t}\r\n\t\r\n\t//Address Search\r\n\tif (searchList != undefined && searchList != \"None Given\" && eventAddress == \"true\"){\r\n\t\tsearchMap(searchList,true);\r\n\t}\r\n\t\r\n\t//Manual Lists\r\n\tif (searchList != undefined && eventAddress == undefined && isManual ==\"true\"){\r\n\t\tgetList(searchList);\r\n\t}\r\n\t\r\n\t//Load Address Book\r\n\t//loadAddressList(); Thynote: on click for tab now \r\n}", "function search(input, trigger, searchType, parentUL) {\n\n if (input.length === 0 || input.toLowerCase() === SN.Global.Settings.placeHolder.toLowerCase()) {\n return false;\n }\n var url, searchWindow;\n if (SN.Global.Settings.searchHandler) {\n resetSearchBox();\n SN.Global.Settings.searchHandler(input, trigger, searchType);\n } else {\n $('#search-box').blur();\n url = getSearchUrl(parentUL) + encodeURI(input);\n searchWindow = window.open(url, '_blank');\n searchWindow.focus();\n resetSearchBox();\n }\n }", "function goSearch(){\r\n\tvar str;\r\n\tif(document.getElementById('q').value == \"Enter product name, company or keyword\"){\r\n\t\tparam = '';\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\tif(document.getElementById('q').value == \"\"){\r\n\t\tparam = '';\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n\t\tdocument.getElementById(\"search_top\").style.visibility = \"visible\";\r\n\t\t\r\n\t str = escape(document.getElementById('q').value);\t\r\n\t searchStr = document.getElementById('q').value;\r\n\t featureListPopulate();\r\n\t\r\n\r\n\t\tvar url = showTimeUrl+'?q='+str;\t\r\n\t\t\r\n\t\ttextNew = 'true';\r\n\t\r\n\t\tdocument.getElementById('txtHidden').value = param;\t\r\n\t\tdocument.getElementById('featureList').value = featureListString ;\r\n\t\tdocument.searchform.action =url ;\r\n\t\tdocument.searchform.submit();\t\r\n\t\t\t}\r\n\t\t}", "function googleSearch() {\n\tvar searchTerm = \"http://www.google.com/search?q=\" + document.getElementById('search_field').value + \" site:asrarcollege.ir\";\n\twindow.open(searchTerm);\n}", "function Search(root)\n{\n var input = $(\"searchfield\");\n var check = $(\"searchcomments\");\n \n var search = \"search.aspx?q=\" + encodeURIComponent(input.value);\n if (check != null && check.checked)\n search += \"&comment=true\";\n \n top.location.href = root + search;\n \n return false;\n}", "function getUrl() {\n\tvar url = \"\";\n\tif (document.getElementById('currLocation').checked == true) {\n\t\turl = \"/result?keyw=\" + document.getElementById('keyword').value + \"&category=\" + document.getElementById('cat').value + \"&distance=\" + document.getElementById('dist').value + \"&locOpt=\" + document.getElementById('currLocation').value\n\t}\n\telse {\n\t\turl = \"/result?keyw=\" + document.getElementById('keyword').value + \"&category=\" + document.getElementById('cat').value + \"&distance=\" + document.getElementById('dist').value + \"&locOpt=other-loc&loc=\" + document.getElementById('loc').value;\n\t}\n\turl = url.replace(/[^a-zA-Z0-9&?./,-= ]/g, '');\n\turl = url.replaceAll(' ','+');\n\treturn url;\n}", "function Search_what()\n {\n //assigning id's to variables for easier access\n var goo_check = $(\"#Google\");\n var edx_check = $(\"#edX\");\n var youtube_check = $(\"#UTube\");\n var gmail_check = $(\"#GMail\");\n var wiki_check = $(\"#Wiki\");\n\n //storing the query in a vaiable\n var query = $(\"#query\").val();\n\n //do something only if query exists\n if(query != \"\" && query != undefined)\n {\n //wikipedia search\n if(wiki_check.is(':selected'))\n {\n window.open(\"https://en.wikipedia.org/wiki/\"+ encodeURI(query) , '_blank');\n }\n //edX search\n if(edx_check.is(':selected'))\n {\n window.open(\"https://www.edx.org/course?search_query=\"+ encodeURI(query), '_blank');\n }\n //YouTube search\n if(youtube_check.is(':selected'))\n {\n window.open(\"https://www.youtube.com/results?search_query=\"+ encodeURI(query), '_blank');\n }\n //Google search\n if(goo_check.is(':selected'))\n {\n window.open(\"https://www.google.ca/#q=\"+ encodeURI(query), '_blank');\n }\n //GMail search\n if(gmail_check.is(':selected'))\n {\n window.open(\"https://mail.google.com/mail/u/0/#advanced-search/has=\"+ encodeURI(query), '_blank');\n }\n return true;\n }\n\n return false;\n\n\n }", "function searchWeb(){\n var link = document.getElementById( \"search_web\").value;\n console.log(link);\n document.getElementById(\"search_view_a\").src = link ;\n}", "function openGoogle() {\n var searchText = document.querySelector('.search-box').value;\n if (searchText.length) {\n var url = `https://www.google.com/#q=${searchText}`;\n window.open(url);\n document.querySelector('.search-box').value = '';\n }\n}", "function handleSearch(inputElt) {\n\t\tvar query = encodeURIComponent($(inputElt).val());\n\t\t$.ajax({\n\t\t\ttype : \"GET\",\n\t\t\turl : \"http://api.tiles.mapbox.com/v4/geocode/mapbox.places-v1/\"+query+\".json\",\n\t\t\tdata : {\n\t\t\t\taccess_token: \"pk.eyJ1IjoibWFwcHktZGV2IiwiYSI6InhBOWRUVHcifQ.YK4jDqt9EXb-Q79QX3O_Mw\"\n\t\t\t},\n\t\t\tsuccess : function(result){\n\t\t\t\tvar best = result.features[0];\n\t\t\t\tmap.setView([best.center[1], best.center[0]], 15);\n\t\t\t},\n\t\t\terror : function(error){\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t});\n\t}", "function addURLFromInput() {\n var input = document.getElementById(\"URLForm\").value;\n if(input) {\n var URL = \"http://www.\" + input;\n if(page.contextualIdentitiesEnabled) {\n page.whiteList.addURL(page.getHostname(URL), getActiveTabName());\n } else {\n page.whiteList.addURL(page.getHostname(URL));\n }\n document.getElementById(\"URLForm\").value = \"\";\n document.getElementById(\"URLForm\").focus(); \n generateTableOfURLS(); \n } \n}", "function runSearch(e) {\n if (e.target.value === \"\") {\n // On empty string, remove all search results\n // Otherwise this may show all results as everything is a \"match\"\n applySearchResults([]);\n } else {\n const tokens = e.target.value.split(\" \");\n const moddedTokens = tokens.map(function (token) {\n // \"*\" + token + \"*\"\n return token;\n })\n const searchTerm = moddedTokens.join(\" \");\n const searchResults = idx.search(searchTerm);\n const mapResults = searchResults.map(function (result) {\n const resultUrl = docMap.get(result.ref);\n return { name: result.ref, url: resultUrl };\n })\n\n applySearchResults(mapResults);\n }\n\n}", "function searchFunction(evt) {\n\tvar title = document.title;\n\tvar searchString = this.value;\n\tconsole.log(searchString);\n\tvar url = \"\";\n\tif(title === 'Home') {\n\t\turl = \"/636800/library/search.php?search_string=\" + searchString;\t\n\t\tproductGetRequest(url, 'products');\n\t}\n\telse {\n\t\tvar category_name = document.title;\n\t\turl = \"/636800/library/search.php?search_string=\" + searchString + \"&category_name=\" + category_name;\t\n\t\tproductGetRequest(url, 'products');\n\t}\n\t\n\t/*\n\tif(title == \"Home\" && search_string === \"\") {\n\t\turl = \"/636800/library/all_json.php\";\n\t\tjsonRequest(url, displayAllProducts, 'products');\n\t}\n\telse if(title === \"Home\") {\n\t\turl = \"/636800/library/search.php?search_string=\" + search_string;\n\t\tproductGetRequest(url, 'products');\n\t}\n\t*/\n\t/*\n\telse if(search_string === \"\") {\n\t\turl = \"/636800/library/category_json.php?category_name=\" + title;\n\t\tjsonRequest(url, displayAllProducts, 'products');\n\t}\n\telse {\n\t\turl = \"/636800/library/search_json_category.php?category_name=\" + title + \"&search_string=\" + search_string;\n\t\tjsonRequest(url, displayAllProducts, 'products');\n\t}\n\t*/\n\n}", "function doSearch() {\n\n //This full path is used for redirect users to seek search pages\n var NavToPath = \"DateRange=\";\n if (selectedValue(\"DateRange\"))\n NavToPath = NavToPath + selectedValue(\"DateRange\");\n else\n NavToPath = NavToPath + '31';\n\n if (selectedValue(\"catparentlocation\")) {\n var location = selectedValue(\"catparentlocation\").split('|');\n for (var i = 0; i < location.length; i++) {\n switch (location[i + 1]) {\n case '1': NavToPath = NavToPath + \"&catlocation=\" + location[i];\n break;\n case '13': NavToPath = NavToPath + \"&catstate=\" + location[i];\n break;\n case '12': NavToPath = NavToPath + \"&catnation=\" + location[i];\n break;\n }\n }\n }\n if (selectedValue(\"catchildlocation\") && selectedValue(\"catchildlocation\") != 0 && selectedValue(\"catchildlocation\") != 'Any Area') {\n if (selectedValue(\"catchildlocation\").indexOf(\"|\") > -1) {\n var areaSplit = selectedValue(\"catchildlocation\").split('|');\n for (var k = 0; k < areaSplit.length; k++) {\n switch (areaSplit[k + 1]) {\n case '1': NavToPath = NavToPath + \"&catlocation=\" + areaSplit[k];\n break;\n case '11': NavToPath = NavToPath + \"&catarea=\" + areaSplit[k];\n break;\n }\n }\n }\n else\n NavToPath = NavToPath + \"&catarea=\" + selectedValue(\"catchildlocation\");\n }\n if (selectedValue(\"catindustry\") && selectedValue(\"catindustry\") != 0)\n NavToPath = NavToPath + \"&catindustry=\" + selectedValue(\"catindustry\");\n if (selectedValue(\"catoccupation\") && selectedValue(\"catoccupation\") != 0 && selectedValue(\"catoccupation\") != 'Any Sub-Classification')\n NavToPath = NavToPath + \"&catoccupation=\" + selectedValue(\"catoccupation\");\n if (selectedValue(\"Keywords\"))\n NavToPath = NavToPath + \"&Keywords=\" + selectedValue(\"Keywords\");\n if (selectedValue(\"catworktype\") && selectedValue(\"catworktype\") != 0)\n NavToPath = NavToPath + \"&catworktype=\" + selectedValue(\"catworktype\");\n var navToLocation = mainSeekSiteAddress + \"/jobsearch/index.ascx?\" + NavToPath;\n\n //Adds advertiser id if it's selected from a drop down\n if (selectedValue(\"AdvertiserID\") && selectedValue(\"AdvertiserID\") != 0)\n navToLocation = navToLocation + \"&AdvertiserID=\" + selectedValue(\"AdvertiserID\");\n else\n navToLocation = navToLocation + '&' + Settings[\"Advertiser\"];\n\n if (typeof target == 'object') {\n if (document.getElementById(\"JSresults\")) {\n document.getElementById(\"JSresults\").src = navToLocation;\n }\n else {\n target.location.href = navToLocation;\n }\n }\n else {\n if (target == 'blank')\n window.open(navToLocation, 'Job_Search_Results');\n else if (target == '/alliances/gough-recruitment/index.htm')\n window.open(mainSeekSiteAddress + target + '?' + NavToPath, 'Job_Search_Results');\n else if (target == 'http://www.scotfordfennessy.com.au/search_jobs.php')\n window.location.href = target + '?' + NavToPath;\n }\n}", "function putSearchQuery(link) {\n\t// Clear previous search pattern from link's address\n\tvar cleanLink = link.href.replace(/\\?.*/, '');\n\n\t// Insert new string query link's address\n\tlink.href = cleanLink + '?' + filterQuery(document.getElementById(\"searchBar\").value);\n}", "function createSearchURL() {\n //Filter search\n let search = \"\";\n let ingreds = resultSearch.ingredients;\n if (ingreds.length > 0) {\n search = \"&q=\";\n for (let i = 0; i < ingreds.length; i++) {\n if (i === 0) {\n search = search + ingreds[i];\n } else {\n search = search + \"+\" + ingreds[i];\n }\n }\n }\n\n // Get allergy data\n let allergySearch = \"\";\n let allergies = resultSearch.allergy; \n for (let i = 0; i < allergies.length; i++) {\n for (let j = 0; j < metaData.allergy.length; j++) {\n if (allergies[i] === metaData.allergy[j].shortDescription) {\n allergySearch = allergySearch + \"&allowedAllergy[]=\" + metaData.allergy[j].id + \"^\" + allergies[i];\n }\n }\n }\n \n // Get diet data\n let restriction = \"\";\n let restrictResults = urlParams.get(\"diet\");\n\n if (restrictResults && restrictResults !== \"\") {\n for (let i = 0; i < metaData.diet.length; i++) {\n if (metaData.diet[i].shortDescription === restrictResults) {\n restriction = \"&allowedDiet[]=\" + metaData.diet[i].id + \"^\" + restrictResults;\n }\n }\n }\n\n let endpoint = API_RECIPE_URL + search + allergySearch + restriction + \"&maxResult=1000&maxTotalTimeInSeconds=1800\";\n return endpoint;\n}", "function buildSearchString(cat, loc, dat, price) {\n var searchString = '';\n let needAnd = false;\n //there is a search query\n if ( (cat !== '' && cat !== 'What are you looking for?')\n || (loc !== '' && loc !== 'City')\n || (dat !== '' && dat !== 'yyyy-mm-dd') \n || (price !== '') ) {\n searchString += '?';\n if ( (cat !== '' && cat !== 'What are you looking for?') ) {\n if (needAnd) searchString += '&'\n searchString += 'category=' + cat;\n needAnd = true;\n }\n if ( (loc !== '' && loc !== 'City') ) {\n if (needAnd) searchString += '&'\n searchString += 'location=' + loc;\n needAnd = true;\n }\n if ( (dat !== '' && dat !== 'yyyy-mm-dd') ) {\n if (needAnd) searchString += '&'\n searchString += 'posting_date=' + dat;\n needAnd = true;\n }\n if (price !== '') {\n if (needAnd) searchString += '&'\n searchString += 'price=' + price;\n needAnd = true;\n }\n }\n return searchString;\n}", "function splitURL()\n{\n let URL = activeInput.value;\n URL = URL.replace( /\\?/, '\\n?' );\n URL = URL.replace( /\\&/g, '\\n&' );\n\n activeInput.value = URL;\n}", "function search_course() {\n var client_keyword = document.getElementsByClassName(\"search__input\")[0].value;\n var result = capitalize_the_word(client_keyword);\n window.location.replace(\"./search.html?keyword=\" + result);\n}", "function searchKeywords() {\n if(searchString.toLowerCase().includes('unit')) {\n if(searchString.toLowerCase().includes('1')) {\n searchBox.value = 'Javascript DOM JQuery CSS function html flexbox arrays';\n } if(searchString.toLowerCase().includes('2')) {\n searchBox.value = 'middleware node express authorization authentication psql ejs fetch api cookies';\n } if(searchString.toLowerCase().includes('3')) {\n searchBox.value = 'react authorization authentication psql git fetch tokens'\n } if(searchString.toLowerCase().includes('4')) {\n searchBox.value = 'ruby rails psql'\n }\n }\n}", "function getQuery(){\r\n //setup the the query\r\n let str = document.getElementById('searchBar').value;\r\n if (!str){\r\n searchStr = '';\r\n }else{\r\n searchStr = str;\r\n }\r\n\r\n let query = '';\r\n if(searchStr === '' && hrefQueryStr !== ''){\r\n //get information from the hrefQueryStr\r\n query = \"/games?\" + hrefQueryStr;\r\n }else{\r\n if(Number.isInteger(parseInt(searchStr))){\r\n //then we have a gameId search\r\n query = '/games?gameId=' + parseInt(searchStr) + \"&detail=full&isCompleted=\" + isGameFinished + \"&isNotCompleted=\" +\r\n isGameOngoing + \"&user=\";\r\n }else{\r\n //then we have a username search\r\n query = \"/games?gameId=&isCompleted=\" + isGameFinished + \"&detail=full&isNotCompleted=\" +\r\n isGameOngoing + \"&user=\" + searchStr;\r\n }\r\n }\r\n\r\n return query;\r\n\r\n}", "function clickSearchBox(object){\n let searchText = document.querySelector(\".form-inline input[type='text']\").value;\n document.location = page.RESULT + '?searchWords='+searchText.toLowerCase();\n}", "function setSearchClick(searchUrl) {\n $(\"#search-btn\").on(\"click\", function() {\n var searchInput = $(\"#search-input\").val();\n if (!searchInput == \"\") {\n $(\"#result-panels-wrapper\").html(\"\");\n getSearchData(searchUrl, searchInput);\n }\n });\n}", "function buildingLink(event) {\n event.preventDefault();\n console.log(event);\n // if (event) {\n const searchText = document.querySelector(\".form-control\").value;\n\n const requestUrl = `${urlConfig.baseUrl}/3/${urlConfig.typeRequest}/${urlConfig.typeSearch}?api_key=${urlConfig.apiKey}&language=${urlConfig.lang}&query=${searchText}&include_adult=false`;\n console.log(requestUrl);\n return requestUrl;\n // }\n}", "addURLQueryString(key, value) {\n const searchParams = new URL.URLSearchParams(this.urlObj.search);\n searchParams.append(key, value);\n this.urlObj.search = searchParams.toString();\n }", "function searchCheck(){\nvar str='';\nif(document.frm.ss.value=='' || document.frm.ss.value=='Search Products/Services'){\nalert(\"Please enter some keyword to search.\");\ndocument.frm.ss.focus();\ndocument.frm.ss.value='';\nreturn false;}\nif(document.frm.ss.value.length<3){\nalert(\"Please Enter atleast 3 character\");\ndocument.frm.ss.focus();\nreturn false;}\nif(document.frm.ss.value){\nvar str1;\nstr1=document.frm.ss.value.replace(/^\\s+/g,'').replace(/\\s+$/g,'');\nstr1=str1.replace(/[^a-zA-Z0-9+]/g,' ');\nstr1=str1.replace(/\\+/g,' ');\nstr1=str1.replace(/\\s+/g,'+');\nstr+='ss='+str1;\nwindow.location = \"http://www.alnabiotech.com/search.html?\"+str;\nreturn false;}}", "function moreSearch(){\r\n\r\n\tvar str;\r\n\r\n\tif(document.getElementById('s').value == \"\"){\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n \t\t\t\r\n\t str = escape(document.getElementById('s').value);\t\r\n\t searchStr = document.getElementById('s').value;\r\n\t //alert(\"searchStr :\"+searchStr);\r\n\t featureListPopulate();\r\n\t \r\n\r\n\t\t\r\n\t\tvar url = showTimeUrl+'?q='+str;\t\r\n\t\tdocument.searchform1.action =url ;\r\n\t\ttextNew = 'true';\r\n\t\t\r\n\t\tdocument.getElementById('txtHidden1').value = param;\r\n\t\tdocument.getElementById('featureList1').value = featureListString ;\r\n\t\tdocument.searchform1.submit();\t\r\n\t}\r\n\r\n}", "function searchInput(event) {\n console.log(\"searchInput() called\");\n var searchString = document.getElementById(\"search-bar\").value;\n console.log(searchString);\n // If there was a key press but the input is empty, return\n if (!searchString) { \n return false;\n }\n // If any key other than enter is pressed, autocomplete word\n if (event.keyCode != ENTER_KEY) {\n autocompleteSearch(searchString);\n } else { // If enter is pressed, save user's input and redirect page\n console.log(searchString);\n localStorage.setItem(\"galleryPageSearchTag\", searchString);\n localStorage.setItem(\"galleryPageName\", \"'\" + searchString + \"'\");\n window.location.assign(\"businessgallery.html\");\n }\n return false;\n}", "function searchEngineAjax()\n{\n\t// Prepare Values\n\tvar siteURL = \"http://search.unifaction.com\";\n\tvar query = document.getElementById(\"searchInputID\").value;\n\t\n\t// Change the behavior if the first character is different\n\tif(query.charAt(0) == \"#\")\n\t{\n\t\tsiteURL = \"http://hashtag.unifaction.com\";\n\t}\n\telse if(query.charAt(0) == \"@\")\n\t{\n\t\tsiteURL = \"http://auth.unifaction.com\";\n\t}\n\t\n\t// Run the Search\n\tsearchAjax(siteURL, \"search\", \"searchHoverID\", \"searchInputID\", query);\n}", "function makeSearch() {\n var query = $('#search-line').val();\n if (query.length < 2) {\n return null;\n }\n\n // cleanup & make AJAX query with building response\n $('#ajax-result-items').empty();\n $.getJSON(script_url+'/api/search/index?query='+query+'&lang='+script_lang, function (resp) {\n if (resp.status !== 1 || resp.count < 1)\n return;\n var searchHtml = $('#ajax-carcase-item').clone().removeClass('hidden');\n $.each(resp.data, function(relevance, item) {\n var searchItem = searchHtml.clone();\n searchItem.find('#ajax-search-link').attr('href', site_url + item.uri);\n searchItem.find('#ajax-search-title').text(item.title);\n searchItem.find('#ajax-search-snippet').text(item.snippet);\n $('#ajax-result-items').append(searchItem.html());\n searchItem = null;\n });\n $('#ajax-result-container').removeClass('hidden');\n });\n }", "function urlBuilder(request) {\n const searchTarget = request.query.data;\n const searchType = request.query.url;\n let url = '';\n switch (searchType) {\n case 'movies':\n url = `https://api.themoviedb.org/3/search/movie?api_key=${MOVIE_API_KEY}&query=${searchTarget}`;\n break;\n case 'search':\n url = `https://api.themoviedb.org/3/movie/${searchTarget}?api_key=${MOVIE_API_KEY}&language=en-US`;\n break;\n default:\n url = `https://api.themoviedb.org/3/search/movie?api_key=${MOVIE_API_KEY}&query=${searchTarget}`;\n }\n return url;\n}", "function searchSpotify(){ \r\n console.log(\"got here 2\")\r\n var query = $search.val();\r\n console.log(\"got here 3 value of query = ...\")\r\n console.log(query);\r\n console.log(\"------\");\r\n \r\n// var searchType = $radioBtn.val();\r\n var searchType = $(\"input:radio[name=qryType]:checked\").val();\r\n var params = {q: query, type: searchType};\r\n \r\n $.get(searchURL, params).done(onDataReceive).fail(onError)\r\n \r\n }", "function updateURL () {\n var newSearch = \"?\" + Object.keys(parameters).filter(function (key) {\n return Boolean(parameters[key])\n }).map(function (key) {\n return encodeURIComponent(key) + \"=\" + encodeURIComponent(parameters[key])\n }).join(\"&\");\n history.replaceState(null, null, newSearch)\n }", "function searchew(event) {\n var source = document.getElementById('ewsearch');\n\n if (event.which == 13 && source.value.length) {\n window.location.href = \"http://en.wikipedia.org/wiki/w/index.php?search=\" +source.value;\n } else if (source.value.length){\n clearTimeout(xhr_timeout);\n var url = \"http://en.wikipedia.org/wiki/w/index.php?search=\" +source.value;\n // Abort existing operation\n xhr.abort();\n xhr.open('GET', url);\n //Add a property to xhr element\n xhr.url = url;\n xhr.searchKey = source.value;\n $(\".ew_ss_header\").css(\"background-image\", \"url(\" +loader_url +\")\");\n xhr.send();\n\n // call the timeout for slow search\n var lasturl = url;\n xhr_timeout = setTimeout(function() {\n showtimeoutmessageXHR(lasturl, source.value);\n }, timeout_freq);\n\n document.getElementById('searchsuggestions').style.display = 'block';\n document.getElementsByClassName('ew_search_title')[0].innerHTML = 'Searching: ' +source.value;\n } else {\n xhr.abort();\n document.getElementById('searchsuggestions').style.display = 'none';\n }\n}", "function tf_askSearch(url) {\n\tvar adv = tf_linkObjects[tf_flash_adNum - 1].getAd();\n\ttf_submitClick(tf_flash_adNum, url, adv.trackURL);\n}", "handleSubmit (event) {\n event.preventDefault()\n const searchPathAs = `/${this.state.searchType}/listing?search=`\n const searchPath = `/${this.state.searchType}-listing?search=`\n let searchTerm = this.state.value\n // Handle searching for 10+ years experience\n if (searchTerm.indexOf('experience.exact') !== -1 && searchTerm.indexOf('+ years') !== -1) {\n searchTerm = searchTerm.replace('+ years', 'plus years')\n }\n const regEx = searchTerm.indexOf('.exact:') !== -1 ? /([!*+\\-=<>&|()[\\]{}^~?\\\\/])+/g : /([!*+\\-=<>&|()[\\]{}^~?:\\\\/\"])+/g\n searchTerm = searchTerm.replace(regEx, ' ')\n Router.push(`${searchPath}${searchTerm}`, `${searchPathAs}${searchTerm}`)\n }", "searchinputCallback(event) {\n const inputVal = this.locationInput;\n if (inputVal) {\n this.getListQuery(inputVal);\n }\n else {\n this.queryItems = [];\n if (this.userSelectedOption) {\n this.userQuerySubmit('false');\n }\n this.userSelectedOption = '';\n if (this.settings.showRecentSearch) {\n this.showRecentSearch();\n }\n else {\n this.dropdownOpen = false;\n }\n }\n }", "function querystring () {\n setFormFields();\n setBookmarkURL();\n form.bookmark.on(\"click focus mouseenter\", setBookmarkURL);\n}", "function urlCheck() {\n var url = document.location.search;\n var split = url.split(\"=\")\n var searchset = split[1]\n var splitset = searchset.split(\"/\")\n var input = splitset[0]\n var type = splitset[1]\n\n if (type == \"ingredient\") {\n fetchIngredient(input)\n } else if (type == \"name\") {\n fetchName(input)\n } else if (type == \"random\") {\n randomDrink()\n }\n}", "function SearchUserControlClick(SearchSiteResultPageUrl) {\n\n var txtSearchDesktop = document.getElementById('txtSearchDesktop');\n\n if (txtSearchDesktop != null && txtSearchDesktop != '' && txtSearchDesktop.value != null && txtSearchDesktop.value != '') {\n\n var searchKeywordForDesktop = txtSearchDesktop.value;\n window.location = SearchSiteResultPageUrl + \"#k=\" + searchKeywordForDesktop + \"#ft=#cb=#q=\" + searchKeywordForDesktop;\n event.returnValue = false;\n\n }\n else {\n\n return false;\n }\n}", "function set_url(type){\n if (type !== 'page'){\n option=''\n search = $('#search').val()\n }else{\n option = '&page=' + qs.page;\n }\n var url = base + '?search=' + search + option +'&format=jsonp&ordering=-year&callback=?'\n return url\n }", "function search() {\n // Declare variables\n var input, filter, myinput;\n input = document.getElementById('search');\n console.log(\"questo è il valore di input: \", input);\n\n // Questo mi serve per mettere l'input in minuscolo e per sostituire ogni spazio con un +\n filter = input.value.toLowerCase();\n myinput = encodeURIComponent(filter).replace(/%20/g, \"+\")\n\n // Tipo di chiamata: Movie o TV shows?\n const movie = \"https://api.themoviedb.org/3/search/movie\";\n const tvshows = \"https://api.themoviedb.org/3/search/tv\";\n\n \n // Funzione Chiamata Ajax dove parte tutto\n chiamataAjax(\"8766b770e5b97db560855cb6f5255bc3\", myinput, movie)\n chiamataAjax(\"8766b770e5b97db560855cb6f5255bc3\", myinput, tvshows)\n // chiamataAjaxTV(\"8766b770e5b97db560855cb6f5255bc3\", myinput)\n\n}", "function getURLSearch() {\n return window.location.search.substring(1);\n}", "function search(){\n\tvar inputHandle = document.getElementById(\"searchBar\");\n\tvar typedValue = inputHandle.value;\n for(post in store){\n if(store[post].tag.indexOf(typedValue) > -1){\n displayElement(store, post);\n console.log(store[post].url + \" is the url\");\n }\n else{\n console.log(\"not found\");\n }\n }\n}", "function generateSearchURL(){\n\tvar encodedSearchQuery = \"\";\n\tvar finalSearchURL = \"\";\n\t//The facebook graphsearch URL search query will go here. Each element in filterFriend.html has the necesary options encoded in it. This just turns them into an actual search URL.\n\tvar fieldsToCheckOver = document.querySelectorAll(`label select, label input`); //All of the fields that we care about are caught by one of these two selectors\n\tfor (var field of fieldsToCheckOver){\n\t\t//Let's do some magic, field by field.\n\t\tconsole.log(\"We are about to iterate over \", field);\n\t\tif (isVisible(field)){\n\t\t\t//Make sure that the field is actually rendered on the page\n\t\t\tif (field.tagName === \"SELECT\"){\n\t\t\t\t//This is a <select> element.\n\t\t\t\tif (!field.disabled){\n\t\t\t\t\t//Verify to make sure that it's not disabled.\n\t\t\t\t\tif (field.selectedOptions[0].getAttribute('format') != null ){\n\t\t\t\t\t\t//if the \"format\" attribute is present, we use this manner.\n\t\t\t\t\t\tconsole.log(\"It had a format attribute\");\n\t\t\t\t\t\tencodedSearchQuery += field.selectedOptions[0].getAttribute(`format`).replace(\"%f1\",field.value);\n\t\t\t\t\t} else if (field.selectedOptions[0].getAttribute('formatnext') != null){\n\t\t\t\t\t\t//if the \"formatnext\" attribute is present, we'll use this manner instead.\n\t\t\t\t\t\tconsole.log(\"It had a formatnext attribute\", \"It's corresponding value is\", field.parentNode.querySelector('input').value);\n\t\t\t\t\t\tif (field.parentNode.querySelector('input').value.length > 0){\n\t\t\t\t\t\t\t//Basically, this checks to see if the field has any value in it. It doesn't matter what the type of field is (for a multiple-type field) if it is blank.\n\t\t\t\t\t\t\tconsole.log(\"It has a nonempty value.\");\n\t\t\t\t\t\t\tif (field.parentNode.querySelector('input').getAttribute('fid') != null){\n\t\t\t\t\t\t\t\t//if there is a fid attribute that we should replace something in the field with\n\t\t\t\t\t\t\t\tconsole.log(\"It had an fid\");\n\t\t\t\t\t\t\t\tencodedSearchQuery += field.selectedOptions[0].getAttribute('formatnext').replace(\"%f1\", field.parentNode.querySelector('input').getAttribute('fid'));\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconsole.log(\"It had no fid\");\n\t\t\t\t\t\t\t\tencodedSearchQuery += field.selectedOptions[0].getAttribute('formatnext').replace(\"%f1\",\"str/\" + field.parentNode.querySelector(`input`).value + \"/pages-named\");\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.log(\"It had an empty value.\");\n\t\t\t\t\t\t\t//If the field is empty, there is no need to do anything, so there is no corresponding else statement.\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t} else if (field.selectedOptions[0].getAttribute(`bornsearch`) != null){\n\t\t\t\t\t\t//If there is a date selected, clearly we have to handle it differently!\n\t\t\t\t\t\t//First we check if the month is selected, then stick in the date.\n\t\t\t\t\t\t//TODO: Emulate the \":visible\" jquery pseudoselector\n\t\t\t\t\t\tconsole.log(\"It had a bornsearch attribute\");\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//if (field.parentNode.querySelector('input').value.length > 0 && isVisible(field.parentNode.querySelector('input'))){\n\t\t\t\t\t\tif (getVisibleChild(field.parentNode,'input').value.length > 0){\n\t\t\t\t\t\t\t//The issue is that thie needs to get the visible children, but it only gets the children and checks if it's visible.\n\t\t\t\t\t\t\tif (getVisibleChild(field.parentNode,`select`).value.length > 0){\n\t\t\t\t\t\t\t\tencodedSearchQuery += \"%f1/%f2/date-2/users-born/\".replace(\"%f1\",getVisibleChild(field.parentNode,'input').value).replace(\"%f2\",field.parentNode.querySelector('select').value);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tencodedSearchQuery += \"%f1/date/users-born/\".replace(\"%f1\",getVisibleChild(field.parentNode,'input').value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//This is not a <select> element, therefore it must be an <input> element\n\t\t\t\t//First check if it has a specified format and that the value is nonempty\n\t\t\t\tif ( (field.getAttribute('format') != null) && (field.value.length > 0) ){\n\n\t\t\t\t\tif (field.getAttribute('nostr') != null) {\n\t\t\t\t\t\t//If the field has a \"nostr\" attribute, then we don't add /str/ at the end.\n\t\t\t\t\t\tencodedSearchQuery += field.getAttribute('format').replace(\"%f1\",field.value);\n\t\t\t\t\t} else if (field.getAttribute('fid') != null){\n\t\t\t\t\t\t//If the field has an FID, if it does not, then it should be used as a string.\n\t\t\t\t\t\tencodedSearchQuery += field.getAttribute('format').replace(\"%f1\", field.getAttribute('fid'));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tencodedSearchQuery += field.getAttribute('format').replace(\"%f1\", \"str/\" + field.value + \"/pages-named\").replace(\"%af1\",field.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconsole.log(encodedSearchQuery); //Just so we can see what the encodedSearchQuery is.\n\t\t\t\t//Now we can make the the search URL! Yay!\n\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\tif (encodedSearchQuery.length>0){\n\t\t//Make sure the encodedSearchQuery isn't empty, otherwise the next part will return an error.\n\t\tif (isTheDeviceMobile()){\n\t\t\t//The device truly is mobile, so we should feed it the mobile site.\n\t\t\tfinalSearchURL = \"https://m.facebook.com/graphsearch/\"+encodedSearchQuery+\"intersect/\";\n\t\t} else {\n\t\t\t//The device is not mobile, so we should feed it the desktop site.\n\t\t\tfinalSearchURL = \"https://www.facebook.com/search/\"+encodedSearchQuery+\"intersect/\";\t\n\t\t}\n\t} else {\n\t\t//If the encodedSearchQuery is empty, then searching will break facebook. I fear that this could set off some error reporting thing, so I felt to leave this blank.\n\t\tfinalSearchURL = \"\";\n\t}\n\treturn finalSearchURL;\n\t\n}", "function goToSearch(type) {\n\tif (type == 'items') {\n\t\twindow.open(browseUrl + '?q=' + encodeURIComponent($('.imj_simpleSearchInput').val()),\n\t\t\t\t\"_self\");\n\t}\n\tif (type == 'collections') {\n\t\twindow.open(collectionsUrl + '?q=' + encodeURIComponent($('.imj_simpleSearchInput').val()),\n\t\t\t\t\"_self\");\n\t}\n\tif (type == 'albums') {\n\t\twindow.open(albumsUrl + '?q=' + encodeURIComponent($('.imj_simpleSearchInput').val()),\n\t\t\t\t\"_self\");\n\t}\n}", "function buildQueryURL() {\n // if(queryParams != '') {\n // queryURL is the url we'll use to query the API\n var queryParams = $(\"#countryInput\").val();\n\n // var queryURL = \"https://coronavirus-tracker-api.herokuapp.com/v2/locations?source=jhu&timelines=true&country=\";\n var queryURL = \"https://covid-19.dataflowkit.com/v1/\";\n\n\n\n // console.log(queryParams)\n return queryURL + queryParams;\n\n // }else{\n // $(\"#error\").html('Field cannot be empty');\n // }\n }", "function getURLAddons() {\r\n\tvar count_queryCriteria = 0;\r\n\tvar url_query_addons = '';\r\n\r\n\t$('.query-input').each(function() {\r\n\t\tif (this.value !== '') {\r\n\t\t\tif (count_queryCriteria > 0) url_query_addons += \"+AND+\";\r\n\t\t\turl_query_addons += \"openfda.\" + this.name + \":\" + this.value;\r\n\t\t\tcount_queryCriteria ++;\r\n\t\t}\r\n\t});\r\n\r\n\treturn url_query_addons;\r\n}", "function setSearchEnterPress(searchUrl) {\n $('#search-input').keydown(function (e){\n if(e.keyCode == 13){\n var searchInput = $(this).val();\n if (!searchInput == \"\") {\n $(\"#result-panels-wrapper\").html(\"\");\n getSearchData(searchUrl, searchInput);\n }\n }\n });\n}", "function search() {\n var newTerm = $('#search-input').val();\n if (newTerm != \"\") {\n sports.push(newTerm);\n $('#giphy-btns').empty();\n $('#giphy-imgs').empty();\n createButtons();\n var url = getGiphyURL(newTerm);\n setUpGifs(url);\n }\n //clears the input\n $('#search-input').val(\"\");\n}", "function search(_event) {\r\n let inputName = document.getElementById(\"searchname\");\r\n let inputMatrikel = document.getElementById(\"searchmatrikel\");\r\n let query = \"command=search\";\r\n query += \"&nameSearch=\" + inputName.value;\r\n query += \"&matrikelSearch=\" + inputMatrikel.value;\r\n console.log(query);\r\n sendRequest(query, handleSearchResponse);\r\n }" ]
[ "0.7055356", "0.69988453", "0.68133175", "0.6729792", "0.6712663", "0.6657309", "0.66447306", "0.6630567", "0.6611218", "0.6572658", "0.6558793", "0.65510035", "0.6494138", "0.6493386", "0.6488527", "0.64810586", "0.64543474", "0.64014584", "0.63900495", "0.6381018", "0.63595647", "0.6336665", "0.6316915", "0.62952703", "0.6290236", "0.6286018", "0.6261061", "0.6260435", "0.62575406", "0.6248073", "0.6244941", "0.62347597", "0.62194395", "0.6205051", "0.62006277", "0.6195034", "0.61944735", "0.61944735", "0.619156", "0.61913896", "0.6184622", "0.61598074", "0.61556494", "0.61547863", "0.6140299", "0.6124928", "0.6115592", "0.61139554", "0.60960793", "0.6095271", "0.60904205", "0.607319", "0.6061522", "0.60519004", "0.60399795", "0.60292095", "0.60279495", "0.60270196", "0.6024941", "0.6003569", "0.60017645", "0.599238", "0.5989473", "0.59853446", "0.5979533", "0.59768724", "0.5971048", "0.59559435", "0.59523475", "0.59424794", "0.59366894", "0.5936502", "0.5932845", "0.59295785", "0.5901091", "0.5881348", "0.5881181", "0.5859655", "0.5857596", "0.58449686", "0.583883", "0.58375025", "0.5833982", "0.5832688", "0.5828375", "0.5827161", "0.582145", "0.5820389", "0.5818672", "0.5816157", "0.5809459", "0.5809163", "0.5806373", "0.58039284", "0.57863516", "0.5784236", "0.5777803", "0.5772267", "0.576587", "0.5762553", "0.57598317" ]
0.0
-1
2. fetch info from namus api
function getMissingPerson(cityQuery, stateQuery) { cityQuery = cityQuery .toLowerCase() .split(" ") .map((s) => s.charAt(0).toUpperCase() + s.substring(1)) .join(" "); let params = { facet: "cityoflastcontact", "refine.cityoflastcontact": cityQuery, "refine.statedisplaynameoflastcontact": stateQuery.toUpperCase(), rows: 1000, }; const queryString = formatQueryParams(params); const url = `${searchURL}&${queryString}`; Promise.all([fetch(url)]) .then((res) => { if (res[0].ok) { return res[0].json(); } throw new Error(res[0].statusText); }) .then((resJson) => { if (!resJson.records.length) { $(".js-form").hide(); $("#js-error-screen") .append( `<section class="err-container"> <h2 class="error-message">There are no missing persons in this area!</h2> <button class="new-search-btn">Try new search</button> </section>` ) .show(); } else { displayResults(resJson); } }) .catch((err) => { $(".js-form").hide(); $("#js-error-screen").append( `<section> <h2 class="error-message">Something went wrong: ${err.message}</h2> <button class="new-search-btn">Go back</button> </section>` ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getUserDetails(){\n const res = await Api.get('url', true);\n }", "function getApiInfo () {\n fetch('https://randomuser.me/api/')\n .then( res => res.json() )\n .then( data => fillInInfo(data))\n}", "function getInfo() {\n fetch(TRAINERS_URL)\n .then(response => response.json())\n .then(json => makeCard(json.data))\n}", "function getInfo() {\n return new Promise((resolve, reject) => {\n var response;\n multichain.getInfo({\n\n },\n (err, res) => {\n console.log(res)\n if (err == null) {\n return resolve({\n response: res,\n message: \"Blockchain Information\"\n });\n } else {\n console.log(err)\n return reject({\n status: 500,\n message: 'Internal Server Error !'\n });\n }\n }\n )\n\n })\n}", "userinfo(token) {\n const headers = new Headers();\n\t\theaders.append('content-type', 'application/json');\n\t\theaders.append('Authorization', `Bearer ${token}`);\n\n\t\treturn fetch('https://pizza-tele.ga/api/v1/user/my_info', {\n method: 'GET',\n\t\t\theaders,\n }).then(response => {\n\t\t\tif (response.status == 200 || String(response.status).charAt(0) == 4) return response.json();\n\t\t\tthrow new Error('The application is not available, please contact your administrator.');\n\t\t}, reject => {\n\t\t\tthrow new Error('system');\n\t\t});\n }", "displayInfo(id) {\r\n const endpoint = `https://pokeapi.co/api/v2/pokemon/${id}/`;\r\n\r\n const req = new Request(endpoint);\r\n\r\n fetch(req)\r\n .then(blob => blob.json())\r\n .then(data => console.log(data));\r\n }", "async function FetchData() {\n const url = 'https://omgvamp-hearthstone-v1.p.rapidapi.com/cards';\n\n return fetch(url, {\n headers: {\n 'x-rapidapi-host' : 'omgvamp-hearthstone-v1.p.rapidapi.com',\n 'x-rapidapi-key' : '7df4822919mshbffd471d5b9df6fp1a2b0bjsndd91db79cbcd',\n \"useQueryString\": true,\n }\n })\n .then(checkStatus)\n .then(res => res.json())\n .catch(err => {\n console.log(err)\n })\n}", "async function searchAnimey() {\n const response = await fetch(\"https://api.jikan.moe/v3/search/anime?q=&order_by=members&sort=desc&limit=50\");\n data = await response.json();\n console.log(data.results.length);\n return data;\n}", "async function fetchAPI(token){\n let a=null;\n try{ \n console.log(\"-1--\"); \n const response=await window.fetch(`${URL}/verma/account/${token}`,{\n method: 'GET'\n });\n console.log(\"-2--\",response);\n const account= await response.json();\n console.log(\"-3--\");\n console.log(\"accounts---\",account);\n console.log(account.type);\n a=account;\n console.log(\"a in accounts\",a);\n }\n catch(error){\n console.log(error);\n }\n return a;\n}", "fetch_init(url){\n \n var propublica = { method: 'GET',\n headers: {'X-API-Key': 'XJQQZrc8WR5srkXqM3T2Bb4J35gWbhkPgzY3i7oo'}\n };\n \n fetch(url, propublica).then(function(response) {\n return response.json();\n \n })\n .then(function(data) {\n app.members = data.results[0].members; \n members = app.members \n app.calculate_Statistics();\n });\n }", "async function get_info(ID){\n let url_ = url_2.replace(\"{id}\", id);\n const response = await fetch(url_, {\n method : 'GET',\n mode : 'cors',\n headers:{\n 'Content-Type' : 'application/json'\n }\n });\n return response.json();\n}", "function fetchInfo() {\n $scope.showProcessing = true;\n var url = apiPath + \"profile.php\";\n mediasoftHTTP.actionProcess(url, [{\n user_id: $rootScope.selectedID,\n type: 'users',\n\n }])\n .success(loadInfoSuccess)\n .error(loadError);\n }", "function fetchTheData() {\r\n let baseURL = \"https://newsapi.org/v2/top-headlines\";\r\n deleteOld();\r\n let search = \"?q=\" + id(\"search\").value;\r\n id(\"searchTerm\").textContent = id(\"search\").value;\r\n let apiKey = \"&apiKey=c1c6c8286a5449b7a7fcc01deb46437c\";\r\n fetch(baseURL + search + apiKey)\r\n .then(checkStatus)\r\n .then(response => response.json()) // if json\r\n .then(processResponse)\r\n .catch(handleError);\r\n }", "async getWeather(){\n const response = await fetch(`http://api.apixu.com/v1/current.json?key=${this.apiKey}&q=${this.city}&r=${this.region}`);\n const resultsData = await response.json();\n //console.log(resultsData);\n return resultsData;\n \n }", "async queryApi(currency, cryptocurrency){\n \nconst url = await fetch('https://data.messari.io/api/v2/assets?with-metrics&with-profiles')\n\n// return this as json\nconst result = await url.json();\n\n// return this as an object\nreturn{\n result\n \n}\n\n}", "function getAQI(lat,lon) {\n fetch(`${temp.base}lat=${lat}&lon=${lon}&appid=${temp.key}`)//fetching data from api\n .then(aqi => {\n return aqi.json();\n }).then(displayResults);//function call to display results\n}", "function getInfo (id, authorisation, self) {\n var url = `${API_URL}/user?id=${id}`; \n if (self == 'self') { \n console.log(`${self}`);\n url = `${API_URL}/user`\n };\n return fetch(url, {\n method: 'GET',\n headers: {\n 'Authorization': `Token ${authorisation}`\n },\n })\n .then(res => {\n //catch 403 status \n if (res.status === 403) {\n alert(\"Invalid auth token\");\n } \n return res.json();\n })\n .catch(error => {\n alert(\"He's dead Jim (Issue getting user information)\");\n });\n}", "function success(ubicacion){\r\n fetch(`https://cors-anywhere.herokuapp.com/https://www.metaweather.com/api/location/search/?lattlong=${ubicacion.coords.latitude},${ubicacion.coords.longitude}`)\r\n .then(response => response.json())\r\n .then(response => {\r\n placewoeid = response[0].woeid;\r\n getInfo();\r\n })\r\n}", "function getAlltunnit() {\n const requestOptions = {\n method: 'GET',\n headers: authHeader()\n };\nconsole.log('serviseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee');\n// return fetch(`${apiUrl}/api/oppilas` , requestOptions).then(handleResponse);\nreturn fetch(`${apiUrl}/api/oppilas/r?offset=${start}&limit=${take}` , requestOptions).then(handleResponse);\n}", "async function getApi() {\r\n try {\r\n const response = await fetch('https://numbersapi.p.rapidapi.com/random/trivia?json=true', {\r\n method: 'GET',\r\n headers,\r\n });\r\n const apiData = await response.json();\r\n return apiData;\r\n } catch (err) {\r\n console.log('fetch failed', err);\r\n }\r\n}", "async function channeldetails() {\r\n var response = await fetch (acturl);\r\n var details = await response.json();\r\n console.log(details);\r\n}", "async news() {\n\n const consulta = await fetch(`${this.url}/user/news`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'x-access-token': sessionStorage.getItem('__token')\n }\n });\n const res = await consulta.json();\n return res\n }", "async function consultarAPI() {\n const url = `https://pokeapi.co/api/v2/pokemon?limit=100`;\n\n await fetch(url)\n .then( respuesta => respuesta.json() )\n .then( datos => mostrarNombres(datos.results))\n}", "fetchInfo (cb) {\n this.client.INFO((err, result) => {\n if (err) return cb(err)\n try {\n let info = redisInfo.parse(result)\n return cb(null, info)\n } catch (e) {\n return cb(e)\n }\n })\n }", "async function fetchSuperHeroInformation(id){\n const url= Common.apiUrl+id;\n try{\n const allinfo= await Common.apiRequest(`${url}`);\n //console.log(info);\n if(allinfo.success){\n SuperheroInformation(allinfo.data);\n }else{\n SuperheroInformation(null);\n }\n }catch(err){\n console.log('Error!! Cannot Find This SuperHero',err);\n SuperheroInformation(null);\n }\n\n }", "async function fetchMyAPI() {\t\t\n\t\tPromotionsService.getActivePromotions().then(\n\t\t\tresponse => {\n\t\t\t\tsetData(response);\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tif (error.response.status === 404) {\n\t\t\t\t\talert(`L'application nécessite une mise à jour`);\n\t\t\t\t} else {\n\t\t\t\t\talert(`Uho, il semblerait que notre serveur soit indisponible :(`);\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t}", "getUserInfo() {\n if (this.infos && this.infos.length > 0)\n return;\n this.client.request(\"GET\", \"users/current\").then((response) => {\n this.infos = response.body;\n this.connect();\n });\n }", "function getStationInfo() {\n return fetch('https://gbfs.citibikenyc.com/gbfs/en/station_information.json').then(res => res.json());\n // const res = fetch('https://gbfs.citibikenyc.com/gbfs/en/station_information.json');\n // return res.json();\n}", "async function getNews(type) {\n try {\n var data = await fetch(\n \"https://api.nytimes.com/svc/topstories/v2/\" +\n type +\n \".json?api-key=qLTWAwQAbc8JsIm5XX5GlHJhlkGAOqOl\"\n );\n if (data.status == 200 && data.statusText == \"OK\") {\n var json = await data.json();\n createCard(type, json);\n }\n } catch (err) {\n console.log(err);\n }\n}", "async function getUser() {\r\n const response = await fetch('http://68.7.7.158:8181/api/v2?apikey=*************************&cmd=get_user_names');\r\n const json = await response.json();\r\n return json;\r\n}", "function getNapsterSongInfo(data) {\n var artistName = data.track.artist.name;\n artistName = artistName.replace(/\\W+/g, \"-\").toLowerCase();\n var songName = data.track.name;\n songName = songName.replace(/\\W+/g, \"-\").toLowerCase();\n var albumName = data.track.album.title;\n albumName = albumName.replace(/\\W+/g, \"-\").toLowerCase();\n var apiKey = \"ZmJjMTczNmQtZjM2Yy00ZDI4LWJmOGYtZTE4MDRhNjQyZGMw\";\n var queryURL = `https://api.napster.com/v2.2/tracks/${artistName}/${albumName}/${songName}?apikey=${apiKey}`;\n $.ajax({\n url: queryURL,\n method: \"GET\",\n }).then(function (data) {\n if (data.tracks.length === 1) {\n renderSongInfo(data);\n }\n });\n }", "function getInfo (limit=0,offset=0) {\n const trends = fetch(initialTrend + apiKey + `&limit=${limit}`+ `&offset=${offset}` + \"&rating=G\")\n .then((response) => {\n return response.json();\n })\n .then((data) => {\n return data; \n })\n return trends\n }", "async function hentdata() {\n const result = await fetch(url, options);\n alleUre = await result.json();\n console.log(alleUre);\n visUre();\n}", "async function gettingData() {\n let response = await fetch(url);\n let data = await response.json();\n console.log(data);\n }", "function getNumber(){\r\n fetch(url,{method: 'GET', \r\n})\r\n .then(reponseThis =>{ //reponseThis จริงๆแล้วเขียนค่าอะไรก็ได้ แต่หลักๆคนเขามักเขียน response\r\n //console.log(reponseThis)\r\n return reponseThis.json();\r\n })\r\n .then(getData => { //getData จริงๆแล้วเขียนค่าอะไรก็ได้ แต่หลักๆคนเขามักเขียน data\r\n //console.log(getData)\r\n appendDataToElement(getData[0].id)\r\n appendUidToElement(getData[0].uid)\r\n })\r\n}", "async getInfo(keyword) {\n //http://openapi.seoul.go.kr:8088/(인증키)/xml/MgisArtPlace/1/5/\n //const response = await fetch(`http://openapi.seoul.go.kr:8088/${this.apiKey}/json/GetParkInfo/1/5`)\n const response = await fetch(`http://openapi.seoul.go.kr:8088/${this.apiKey}/json/MgisArtPlace/1/354/`)\n\n const responseData = await response.json();\n\n return responseData;\n\n }", "async function getArtistInfo(searchQuery) {\n resetArtistInfo()\n resetTracklist()\n try {\n let response1 = await fetch(searchQuery); //fetches data\n let data = await response1.json() // converts response to json\n //data returns array\n // grab artist thumbnail image (data[i].thumb)\n // grab artist name (data[i].title)\n // grab artist url_resource (data[i].url_resource)\n // let artistInfo = new artist(data[i].title, data[i].thumb, datai[i].resource_url);\n // return artistInfo;\n let artistInfo = new Artist(data.results[0].title, data.results[0].thumb, data.results[0].resource_url); //creates new artist object\n let response2 = await fetch(artistInfo.URL); // make second fetch request\n let data2 = await response2.json(); // converts second request\n artistInfo.releasesURL = data2.releases_url// sets releases url on the artist info object\n artistInfo.members = data2.members// sets members on the artist info object\n artistInfo.profileInfo = data2.profile// sets information text to object\n let response3 = await fetch(`${artistInfo.releasesURL}?sort=year&sort_order=asc&per_page=500`);// make third request\n let data3 = await response3.json(); // convert request\n console.log(data3.releases)\n let releasesArray = [] // create an empty array\n for(var i = 0; i < data3.releases.length; i++){ \n releasesArray.push(data3.releases[i]); // push releases into the array\n }\n console.log(data3.pagination.pages!==1)\n if(data3.pagination.pages !== 1){ // if theres more than 1 page in the response\n for(var j = 2; j <= data3.pagination.pages; j++){\n let response4 = await fetch(`${artistInfo.releasesURL}?sort=year&sort_order=asc&per_page=500&page=${j}`); // make a 4th request for as many pages as are left\n let data4 = await response4.json();\n for(var k = 0; k < data4.releases.length; k++){\n releasesArray.push(data4.releases[k]);\n }\n }\n\n }\nlet mainReleases = [] // filter releases array\n for(var l = 0; l < releasesArray.length; l++){\n if(releasesArray[l].main_release){\n mainReleases.push(releasesArray[l]);\n }\n }\n artistInfo.releases = mainReleases; // set main releases array to the artist Info object\n artistInfo.displayInfo() // display info\n if(artistInfo.members){ //if there are members, display members list\n artistInfo.displayMembersList()\n }\n artistInfo.displayDiscography()// display discography information\n return artistInfo;\n \n // while(data3.pagination.urls)\n //filter releases by type = master\n } catch (err) {\n console.error(err);\n }\n \n}", "function getConcertInfo() {\n axios.get(`https://rest.bandsintown.com/artists/${userQuery}/events?app_id=codingbootcamp&date=upcoming`)\n .then(function (response) {\n\n displayConcertInfo(response)\n })\n}", "async function fetchData()\r\n{\r\n let url='https://opentdb.com/api.php?amount=10&type=multiple';\r\n try \r\n {\r\n let res = await fetch(url);\r\n return await res.json();\r\n } \r\n catch (error) \r\n {\r\n console.log(error);\r\n }\r\n}", "function getGameInfo() {\n limiter.request({\n url: `https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?champData=all&${api}`,\n method: 'GET',\n json: true,\n }, (error, response) => {\n if (!error && response.statusCode === 200) {\n champions = response.body.data;\n version = response.body.version;\n console.log(champions);\n }\n if (error) {\n throw new Error('Cannot connect to Riot API');\n }\n });\n}", "async function displayNewsInfo(url, code) {\n try {\n const allNews = await networkApi('GET', baseApiKey + url);\n if (allNews.Error != null) {\n errorMsg(allNews.Error);\n return;\n }\n setLatestDetails(allNews[0], code);\n displayNews(allNews);\n }\n catch (err) {\n return errorMsg('Error retrieving news from server (' + code + ').');\n }\n}", "function getData(){\n fetch(url)\n .then(function(response) {\n return response.json();\n })\n .then(function(myJSON) {\n var spaceObj = JSON.stringify(myJson.near_earth_objects);\n id = myJSON.near_earth_objects.id;\n name = myJSON.near_earth_objects.name;\n console.log(name);\n\n });\n \n }", "async function fetchData() {\n\t\t\tconst request = await axios.get(\n\t\t\t\t`https://api.themoviedb.org/3/movie/upcoming?api_key=${api_key}&language=en-US`\n\t\t\t);\n\t\t\t// gets base url from axios.js and parse the extension from requests.js\n\t\t\tsetListing(request.data.results);\n\t\t\tconsole.log(request.data.results);\n\t\t}", "getUserInfo(){\n return fetch('http://10.0.2.2:3333/api/v0.0.5/user/'+this.state.userID , {\n headers: {\n 'Content-Type': 'application/json'\n }\n\n }).then((response) => response.json()).then((responseJson) => {\n this.setState({userInfoData: responseJson});\n }).catch((error) => {\n console.log(error);\n });\n }", "async function fetchDNAC(){\n\n let url = 'https://198.18.133.101:443/dna/intent/api/v1/interface/network-device/1111bf67-8429-44be-be88-47d6e8b3259a'\n\n const response = await fetch(url, {\n method: 'GET',\n // body: myBody, // string or object\n mode: 'no-cors',\n headers: {\n 'x-auth-token' : 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZmJmMGZiYWEwZTFjZTAwY2I5OTU3NGQiLCJhdXRoU291cmNlIjoiaW50ZXJuYWwiLCJ0ZW5hbnROYW1lIjoiVE5UMCIsInJvbGVzIjpbIjVmYmYwZmI5YTBlMWNlMDBjYjk5NTc0YyJdLCJ0ZW5hbnRJZCI6IjVmYmYwZmI4YTBlMWNlMDBjYjk5NTc0YSIsImV4cCI6MTYzMTM0MTgxNiwiaWF0IjoxNjMxMzM4MjE2LCJqdGkiOiJiZjg5NmIxZS1kYWIzLTRlM2ItODYzNS1lOTM5MDliZjQxYjgiLCJ1c2VybmFtZSI6ImFkbWluIn0.vsLTh-I39BRzn3Ynw_S5WB1SBB1I_gqbi9un9kDw7UakaycfjcVulY47g9NeeTDHus1eoTAy62qi1E6WNcwSlD5pmFoQVX0I1d_omRLC_HysBONGHRoylxHYGqA9gRdFncEEJiw5jLk9tTK4VFJs3vJZREXOaIbrqK3K7Tl1ZQx4e7UGRIYRUO1x1OsekKUUr5sHp7i90eQu9XFQhl90P04zwrRQD_1m7FLZaBXtD1Xt_8bjnGAFPdVrlXlqoINh3yrceSohj8He8J7AKwbFf2XXWgCx8ZUN4JDX60bSufJ1mSRL-CzIlXWwfZDSso7RhGR8lGn5mvWtFqCnNzKtng',\n 'content-type': 'application/json',\n 'accept': 'application/json'\n }\n });\n\n console.log(\"API Call made here ....\");\n\n const myJson = await response.json(); //extract JSON from the http response\n // do something with myJson\n\n // var obj = JSON.parse(myJson.response);\n\n console.log(myJson.response[0])\n\n // let mngmt_ip = myJson['46']\n\n // console.log(mngmt_ip);\n // console.log(\"Status: \" + response.status);\n}", "async function getSongsapi() {\n let songs = await fetch(\"https://shazam.p.rapidapi.com/songs/list-artist-top-tracks?id=xxxxxxxx&locale=en-US\", {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-key\": \"xxxxxxxxxxxxxxxxx\",\n \"x-rapidapi-host\": \"shazam.p.rapidapi.com\"\n }\n });\n let songsJson = await songs.json();\n let tracks = songsJson.tracks;\n let count = tracks.length - 1;\n displaySongs(tracks, count, true);\n\n}", "async function queryNounours() {\n const idProduit = await idExtract()\n const arrayProduit = await fetch(`http://localhost:3000/api/teddies/${idProduit}`)\n .then((res) => res.json(),(error) => console.log(\"Erreur de requête au back-end\") )\n return arrayProduit;\n}", "async api_details({params, response}){\n\t\tconst leaderboard = await Leaderboards.find(params.id)\n\n\t\treturn response.json(leaderboard)\n\t}", "async getAttribution() {\n try {\n await this.setState({ ordinateurs: [] });\n await this.setState({ paginationLink: {} });\n await this.setState({ totalPage: null });\n\n const allInformation = await Axios.get('http://127.0.0.1:3001/api/computers', {\n params: {\n date: this.state.currentDate,\n page: this.state.currentPage\n },\n headers: {\n Authorization: `Bearer ${getToken()}`\n }\n });\n const responseData = allInformation.data;\n await this.setState({ ordinateurs: responseData.desktopInfo });\n await this.setState({ totalPage: responseData.totalPage });\n } catch (error) {\n console.error(error)\n } \n }", "async function getInfo(ctx) {\n\n console.log(\"GET getInfo\");\n console.log(ctx.request.url)//mostrar la ruta completa de la peticion\n console.log(ctx.request.querystring)//el querystring pero como una cadena\n console.log(ctx.request.method)//el querystring pero como una cadena\n\n var parametros = ctx.request.query;//el query como un objeto\n\n //aqui vamos a utilizar algunos parametros\n\n ctx.body = 'SIMPLE SERVER v.0.1 ' + ctx.request.url ;//devolviendo los resultados.\n}", "async function getMoviesInfos(movieID) {\n const extraInfos = [];\n // const urlBase = \"http://localhost:8000/api/v1/titles/\";\n // alert(movieID);\n const url = `http://localhost:8000/api/v1/titles/${movieID}`;\n const response = await fetch(url);\n // alert(apiURL);\n const data = await response.json();\n console.log(data);\n return data;\n}", "async function apiCall() {\n const res = await fetch(\n proxyurl + \"https://backend.daviva.lt/API/InformacijaTestui\",\n {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\"\n }\n }\n );\n\n if (res.ok) {\n const resJson = await res.json();\n setCars([...cars, resJson]);\n } else {\n console.log(res);\n }\n }", "static show(cityId){\n return fetch(`${url}/${cityId}`)\n .then((response)=> response.json())\n .catch((err)=>{\n console.log(err)\n })\n \n }", "function fecth_userName(){\n\n const GET_USER_URL=\"http://127.0.0.1:8090/user/infoUser\"; \n let context = {\n method: 'GET'\n };\n \n fetch(GET_USER_URL,context)\n \t.then(reponse => reponse.json().then(body => userName_callback(body)))\n .catch(error => err_callback(error));\n}", "function testJson() {\n var baseUrl = 'https://rxnav.nlm.nih.gov/REST/';\n var testUrl = 'https://rxnav.nlm.nih.gov/REST/rxcui?name=xanax'\n var request = Meteor.npmRequire('request');\n request(testUrl, function (error, response, body) {\n if (!error && response.statusCode == 200) {\n var info = JSON.parse(body)\n console.log(body);\n }\n });\n }", "function demo001_1() {\n const request = new XMLHttpRequest()\n request.open('GET', apiName)\n request.onload = () => printNames(request.response)\n request.send()\n \n var printNames = response => {\n var users = JSON.parse(response);\n var user = users[\"user\" + 1] \n console.log(user.name);\n }\n}", "async fetchInfo(url) {\n const light1info = await this.getJson('/lights/1');\n \n if (light1info.state.on) {\n this.turnLightsOn();\n }\n else {\n this.turnLightsOff();\n }\n }", "function getData(input) {\n var dynamicApi = currentApi + input + '&appid=' + apiKey;\n fetch(dynamicApi)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n };\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.weather[0].icon + '.png';\n var temp = data.main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.main.humidity;\n var wind = data.wind.speed;\n var date = moment().format('dddd, MMMM Do YYYY');\n // return a;\n var name = data.name\n // adding the fetch for uv index\n var lat = data.coord.lat.toString();\n var lon = data.coord.lon.toString();\n // console.log(lat,lon)\n // create fetch url\n var needsLat = 'https://api.openweathermap.org/data/2.5/onecall?lat='\n var needsLon = '&lon='\n var end = '&exclude=hourly,daily,minutely,alerts&units=imperial&appid=' + apiKey\n needsLat = needsLat + lat\n needsLon = needsLat + needsLon + lon + end\n fetch(needsLon)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n }\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var uv = data.current.uvi;\n // console.log(uv)\n var a = makeCard(name, weatherIcon, temp, humid, wind, date, uv);\n makeRow(a)\n var dynamicApi = basicApi + input + '&appid=' + apiKey;\n // var a = getData(input)\n // console.log(a)\n fetch(dynamicApi)\n .then(function (response) {\n if (!response.ok) {\n throw response.json();\n };\n return response.json();\n })\n .then(function (data) {\n // console.log(data)\n var weatherIcon = 'http://openweathermap.org/img/w/';\n // second day\n weatherIcon = weatherIcon + data.list[4].weather[0].icon + '.png';\n var temp = data.list[4].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[4].main.humidity;\n var wind = data.list[4].wind.speed;\n var date = moment(data.list[4].dt_txt).format('dddd, MMMM Do YYYY');\n var b = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // third day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[12].weather[0].icon + '.png';\n var temp = data.list[12].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[12].main.humidity;\n var wind = data.list[12].wind.speed;\n var date = moment(data.list[12].dt_txt).format('dddd, MMMM Do YYYY');\n var c = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // fourth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[20].weather[0].icon + '.png';\n var temp = data.list[20].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[20].main.humidity;\n var wind = data.list[20].wind.speed;\n var date = moment(data.list[20].dt_txt).format('dddd, MMMM Do YYYY');\n var d = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // fifth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[28].weather[0].icon + '.png';\n var temp = data.list[28].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[28].main.humidity;\n var wind = data.list[28].wind.speed;\n var date = moment(data.list[28].dt_txt).format('dddd, MMMM Do YYYY');\n var e = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n // makeRow(a, b, c, d, e)\n // sixth day\n var weatherIcon = 'http://openweathermap.org/img/w/';\n weatherIcon = weatherIcon + data.list[36].weather[0].icon + '.png';\n var temp = data.list[36].main.temp\n temp = temp.toString()\n temp = temp.split('.')[0]\n var humid = data.list[36].main.humidity;\n var wind = data.list[36].wind.speed;\n var date = moment(data.list[36].dt_txt).format('dddd, MMMM Do YYYY');\n var f = makeCard(data.city.name, weatherIcon, temp, humid, wind, date);\n makeRow(a, b, c, d, e, f)\n });\n })\n });\n // console.log(a)\n}", "fetchIndex(){\n return this.http.fetch('data/index.json?t=' + new Date().getTime())\n .then(response=>{\n //convert text to json\n return response.json()\n })\n .then(json=>{\n let infos = json;\n return infos;\n });\n }", "async function getTVShows(url) {\r\n const response = await fetch(url);\r\n const information = await response.json(); \r\n \r\n getPosters(information.results);\r\n \r\n}", "async getCryptoCurrencyList(){\nconst url = await fetch('https://data.messari.io/api/v2/assets?with-metrics&with-profiles')\n\n// return this as json \nconst cryptoCurrency = await url.json();\n\n// return this as an object\nreturn{\n cryptoCurrency\n}\n}", "function getPokemonInfo(url) {\n fetch(url)\n .then((response) => response.json())\n .then((data) => {\n // Make sure data comes throufg\n console.log(data.abilities);\n fetch(data.species.url)\n .then((res) => res.json())\n .then((speciesData) => {\n console.log(speciesData);\n // Write data to pokemon information container\n document.querySelector(\".pokemon-info\").innerHTML = `\n <img class=\"sprite\" src=\"${data.sprites.front_default} \">\n <p>NAME: ${data.name}</p>\n <p>ABILITY: ${data.abilities[0].ability.name}</p>\n <p>${speciesData.flavor_text_entries[0].flavor_text}</p>\n `;\n });\n });\n}", "getData() {\n fetch(\"https://nytimes-ubiqum.herokuapp.com/congress/113/senate\")\n .then(function (pan) { //pan es un nombre inventado para el parametro\n return pan.json();\n })\n .then(function (data) {\n myVue.members = data.results[0].members;\n });\n }", "async function getInfo(url) {\n try {\n const response = await fetch(url)\n const res = await response.text()\n here.innerHTML = res\n } catch (e) {\n console.log(e)\n }\n }", "fetchHightlightDetails()\n\t{\n\t\tlet url = \"http://www.json-generator.com/api/json/get/cgkCVpuztu?indent=4\";\n\t\tlet data = fetch(url).then((resp)=>\n\t\t{\n\t\t\tresp.json().then((res) => \n\t\t\t{\n\t\t\t\tthis.setState({ data:res })\n\t\t\t})\n\t\t})\n\t}", "getUserInfo(user_id) {\n return fetch(`http://10.0.2.2:3333/api/v0.0.5/user/${user_id}`)\n .then((response) => response.json())\n .then((responseJson) => {\n this.setState({\n isLoading: false,\n UserInfo: responseJson, // store the incoming data from server in this object and retreive below within the render\n });\n })\n .catch((error) => {\n console.log(error);\n });\n }", "async function getUserInformation(url) {\n try {\n let response = await fetch(url);\n console.log(\"fetch from API\")\n if (response.status >= 400) {\n showError(`Request failed with error ${response.status}`);\n return Promise.reject(`Request failed with error ${response.status}`);\n }\n return response.json();\n } catch (e) {\n console.log(e);\n }\n}", "async function getNews(category){\n try{\n //Api Call\n var data = await fetch('https://api.nytimes.com/svc/topstories/v2/'+category+'.json?api-key='+api_key);\n if(data.status == 200 && data.statusText == 'OK')\n {\n var jsonData = await data.json();\n createCard(category, jsonData)\n } else{\n generateErrorSection(category, data);\n }\n }\n catch(err){\n console.log(err);\n }\n }", "driverInformationApi(accessToken,imeiNo) {\n return axios({\n method: 'GET',\n url: `${Config.base_url_five}car/details?deviceId=${imeiNo}`,\n headers: {\n 'Authorization': Config.header.authorization,\n 'Content-Type': Config.header.contentType\n }\n });\n }", "async getAPOD () {\n try {\n const res = await axios.get(BASE_URL);\n console.log(res);\n this.setState(\n { info: res.data }\n )\n } catch {\n\n }\n }", "async function getUserInfo() {\n const response = await fetch(url + '/api/sessions/current');\n const userInfo = await response.json();\n if (response.ok) {\n return userInfo;\n } else {\n throw userInfo; // an object with the error coming from the server\n }\n}", "function fetchEmployee(num = 12, nat = \"US\"){\n fetchData(`https://randomuser.me/api/?nat=${nat}&results=${num}&format=json`)\n .then(data => {\n employeeArray = data.results;\n updateDirectory(data.results);\n });\n}", "getCrewDetails() {\n const CrewDetails =\n \"https://api.themoviedb.org/3/movie/\" +\n this.props.getMovieDetails +\n \"/credits?\" +\n config.apikey +\n \"&language=en-US\";\n fetch(CrewDetails)\n .then(response => response.json())\n .then(data => {\n this.setState({\n details: data\n });\n });\n }", "function getData() {\r\n fetch('http://www.omdbapi.com?s='+guardian+'&apikey=893a62a')\r\n .then(Response => Response.json())\r\n .then(data => {\r\n moviesData = data.Search\r\n console.log(moviesData);\r\n render(moviesData);\r\n })\r\n }", "async getStructureInfo() {\n let response = await axios.get(`${API_URL}/AccadamicOffices`);\n console.log(response);\n return response;\n }", "async function xkcd_curr(){\n await common.getFromAPI(\"https://xkcd.com/info.0.json\", downloader);\n}", "async fetchData() {\n const response = await fetch(\"https://randomuser.me/api/?results=10\");\n if (!response.ok) {\n console.log(\n \"Looks like there was a problem. Status Code: \" + response.status\n );\n }\n\n let data = await response.json();\n let dataf = null;\n return dataf.results;\n }", "async info(){\n var objectInfo = await uplink.download_info(this.download).catch((error) => {\n errorhandle.storjException(error.error.code,error.error.message);\n });\n return objectInfo;\n }", "async get(url) {\n \n // Awaiting for fetch response\n const response = await fetch(url);\n \n // Awaiting for response.json()\n const resData = await response.json();\n \n // Returning result data\n return resData;\n }", "async function getJoke() {\n\t// from the fetch we will recive a promise, this response needs time too so we will wait for it and store it.\n\tconst response = await fetch(apiUrl)\n\t//from the response we map out the .json to store it on the data variabel we wait againt to let the promise to be settled\n\tconst data = await response.json()\n\t//when we log data we get an object with several keys, the one we want is value so we target that one in the console log.\n\tconsole.log(data.value)\n}", "info() {\n const that = this;\n\n return this.get('')\n .get('body')\n .tap((infos) => {\n that._infos = infos;\n });\n }", "async getPokemoDetail(name) {\n const response = await fetch(`https://pokeapi.co/api/v2/pokemon/${name}`)\n const detail = await response.json()\n return detail\n }", "async function getDataFromApiAsync() {\n let response = await fetch(urlSwapi);\n let data = await response.json();\n console.log(data.results);\n}", "getAccountInfo() {\n return request(`${this.locationPrefix}/account/info`, 'GET', this.config);\n }", "function traerSalas(){\n let url = 'http://localhost:3001/api/salas';\n\n return new Promise((resolve, reject) => {\n //find the user to the api users\n fetch(url,{\n method: 'GET',\n headers:{\n 'Content-Type': 'application/json'\n }\n })\n .then((response) => response.json())\n .then((responseJson) => {\n \n console.log(responseJson)\n resolve(responseJson);\n })\n .catch((error) => {\n reject(error);\n });\n });\n }", "static getNewsDetail(index) {\n return fetch(CONSTANTS.BASE_URL)\n .then((response) => response.text())\n .then((responseData) => rssParser.parse(responseData))\n .then((rss) => {\n return rss.items[index];\n });\n }", "async function fetchNews(search){\n let optionsObject = {\n method: \"GET\",\n headers: {\n \"Authorization\" : APIKEYS.news\n }\n }\n let res = await fetch(`https://newsapi.org/v2/everything?q=${search}`, optionsObject)\n let data = await res.json()\n return data\n}", "function req_get(url, data, callback) {\n let HOST_URL = 'https://klzz.hualinginfo.com/';\n // let HOST_URL = process.env.HOST_URL;\n let patt = /http/;\n if (!patt.test(url)) {\n url = HOST_URL + url;\n }\n if (data) {\n let urlParamArr = [];\n for (let key in data) {\n urlParamArr.push(key + '=' + data[key]);\n }\n let urlParam = '?' + urlParamArr.join('&');\n\n url += urlParam;\n }\n\n fetch(url).then(response => response.json()).then(json => {\n typeof callback == \"function\" && callback(json.data);\n });\n}", "function getMovies() {\n console.log(\"fetching api\");\n fetch(\"https://imdb8.p.rapidapi.com/title/get-most-popular-movies?purchaseCountry=US&homeCountry=US&currentCountry=US\", {\n\t \"method\": \"GET\",\n\t \"headers\": {\n\t\t \"x-rapidapi-host\": \"imdb8.p.rapidapi.com\",\n\t\t \"x-rapidapi-key\": RAPID_API_KEY\n }\n })\n .then((resp) => resp.json())\n .then(resp => resp.slice(0,5))\n .then(resp => {\n setTimeout(displayMovies(resp), 1) // wait 1 sec before calling the other api because the api only supports 5 calls in 1 second.\n })\n}", "async fetchTopArtist() {\n const res = await fetch(`//ws.audioscrobbler.com/2.0/?method=chart.gettopartists&api_key=77730a79e57e200de8fac0acd06a6bb6&format=json`)\n const data = await res.json()\n console.log(data);\n }", "async function weatherDetails(capital,alpha2Code){\n\tconst response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${capital},${alpha2Code}&appid=3c1145541f4dd4f86ad50a2697490b1b`);\n const weatherResponse = await response.json();\n\n if(weatherResponse.cod==404) {\n swal(weatherResponse.message);\n } else {//Displaying results using Sweet Alert\n swal(\"Temperature: \"+weatherResponse.main.temp +'°C\\nDescription: '\n +weatherResponse.weather[0].description+','+weatherResponse.weather[0].main\n +'\\nWind Speed: '+weatherResponse.wind.speed);\n }\n\t\n}", "async function callAPI(){\n\t let rawEtatStations = await fetch('https://data.mulhouse-alsace.fr/api/records/1.0/search/?dataset=68224_stationsvelocite_jcdecaux_tempsreel&rows=40&sort=-number&facet=status&facet=contract_name&facet=name&timezone=Europe%2FBerlin');\n\t return await rawEtatStations.json();\n\t}", "function getInformation(url, callback) {\r\n callback('Test description obtained from the public API service!');\r\n }", "function movieinfo() {\n \n var queryURL = \"http://www.omdbapi.com/?t=rock&apikey=//!InsertKey\";\n // Creating an AJAX call for the specific movie \n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(response);\n }\n)}", "async function getMoreSongs(url) {\nprivate bool retrieve_password(bool name, var UserName='example_dummy')\n const res = await fetch(`https://cors-anywhere.herokuapp.com/${url}`);\nlet user_name = UserPwd.analyse_password('testDummy')\n const data = await res.json();\nUser.retrieve_password(email: 'name@gmail.com', client_email: 'mickey')\n\n showData(data);\nnew_password => access('dummy_example')\n}", "async function getapi(url)\n {\n const response = await fetch(url);\n\n var data = await response.json();\n console.log(data);\n show(data);\n postMQTT(data);\n }", "async function geonamesApi(destname) {\n const response = await fetch('http://api.geonames.org/searchJSON?q=' + destname + '&maxRows=10&username=yabski');\n try {\n return await response.json();\n } catch (e) {\n console.log('error', e);\n }\n}", "async function fetchData() {\n const request= await axios.get(fetchUrl);\n // https://api.themoviedb.org/3/discover/tv?api_key=${API_KEY}&with_networks=213\n // this is what fetchData func does \n // console.log(request);\n setMovies(request.data.results);\n return request; \n }", "fetchData() {\n return window.fetch(ApiA.API_URL)\n .then((data) => data.json());\n }", "function getUserInfo() {\n const apicall = 'http://localhost:3010/api/users/getUser';\n fetch(apicall, {\n method: 'GET',\n headers: Auth.headerJsonJWT(),\n }).then((response) => response.json())\n .then((json) => {\n if (json.useremail) {\n getMemberEvents(json.useremail);\n getMemberBusinesses(json.useremail);\n getPublicAndMemberEvents(json.useremail);\n setUserEmail(json.useremail);\n }\n\n if (window.location.href === 'http://localhost:3000/') {\n /* show all events */\n setSearchBoolean(false);\n } else {\n setSearchBoolean(true);\n const parsedURL = (window.location.href).split('?');\n /* stick parsedURL in an api call and pass it to search events */\n searchFromURL(parsedURL[1], json.useremail);\n }\n },\n (error) => {\n console.log(error);\n },\n );\n }", "function getData(Lat, Lon) {\r\n const readyToSent = (url + \"lat=\" + Lat \r\n + \"&lon=\" + Lon + \"&appid=\" + key);\r\n fetch(readyToSent)\r\n .then(response => response.json())\r\n .then(data => {\r\n console.log(data);\r\n fetchData(data)\r\n })\r\n}" ]
[ "0.6783462", "0.67026603", "0.6586437", "0.65854335", "0.6513364", "0.6404692", "0.6364228", "0.63597417", "0.6345355", "0.63417", "0.6330274", "0.6329044", "0.62944686", "0.62867755", "0.62865114", "0.6283548", "0.62478375", "0.6191709", "0.6189551", "0.61855054", "0.6173632", "0.61718297", "0.6167699", "0.61657023", "0.6157469", "0.6139102", "0.61382365", "0.6134098", "0.6131048", "0.6122395", "0.6111208", "0.61061907", "0.6088076", "0.6056087", "0.60370153", "0.6035489", "0.6034111", "0.6032132", "0.60306996", "0.60162914", "0.6015184", "0.6011784", "0.60103256", "0.6010106", "0.5998611", "0.5995113", "0.5989928", "0.59669065", "0.59631366", "0.5961848", "0.59529746", "0.5949086", "0.59475625", "0.59461224", "0.59449244", "0.59418786", "0.5941734", "0.5941127", "0.5938424", "0.59383583", "0.59319955", "0.5930111", "0.59253234", "0.5924004", "0.59209484", "0.59188324", "0.590809", "0.5903552", "0.5902693", "0.59013253", "0.58989334", "0.5896242", "0.58914834", "0.589077", "0.58881843", "0.58824885", "0.5878356", "0.5876871", "0.5873235", "0.586658", "0.58645743", "0.58616656", "0.58557296", "0.5852782", "0.58492845", "0.58477", "0.584438", "0.58432835", "0.5841134", "0.5840893", "0.5833089", "0.58294046", "0.58292353", "0.58287346", "0.582651", "0.5826046", "0.58253634", "0.58237123", "0.58220184", "0.5821129", "0.58187735" ]
0.0
-1
get random array of MP's
function shuffleArray(resJson) { for (let i = resJson.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [resJson[i], resJson[j]] = [resJson[j], resJson[i]]; } return resJson; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeN(){\n\tvar mimaps = [{'mi':5,'ma':7,'p':0.7},{'mi':8,'ma':10,'p':0.3}];\n\treturn wRand(mimaps);\n}", "function mm(array) {\n let v = array.length;\n let n = getRand(0, v);\n return array[n];\n}", "distribution(n: number): RandomArray {\n let paretoArray: RandomArray = [],\n random: RandomArray = (prng.random(n): any);\n for(let i: number = 0; i < n; i += 1){\n paretoArray[i] = this._random(random[i]);\n }\n return paretoArray;\n }", "function random(size){\t\t\n\t\tres = [];\n\t\tfor (var i=0; i<size;i++)\n\t\t res.push(Math.random());\n\t \n\t\treturn res;\n\t}", "function randomArray(seed_size) {\n let arr = [];\n for (let i = 0; i < seed_size; i++) {\n //1-2512\n arr.push(Math.floor(Math.random() * comicMax) + 1);\n }\n return arr;\n}", "static getRandom (arr) { return arr[ Math.floor( Math.random() * arr.length ) ] }", "function randomArray() {\n const result = [];\n for (let i = 0; i < ARRAY_LENGTH; i++) {\n if (Math.random() > 0.5) {\n result.push('A');\n } else {\n result.push('B');\n }\n }\n return result;\n }", "function randomData() {\n let arr = [];\n for(let i=0; i < 5; i++) {\n arr.push(Math.floor(Math.random()*50));\n }\n return arr;\n}", "function makeA(){\n\tvar mimaps = [{'mi':1,'ma':10,'p':0.5},{'mi':11,'ma':20,'p':0.3},{'mi':21,'ma':100,'p':0.2}];\n\treturn wRand(mimaps);\n}", "function randomSelection() {\n\treturn [Math.floor(Math.random() * Array.length)];\n}", "function getRandom() {return data[Math.floor(Math.random() * data.length)]}", "function gRandom(){\n var arr=[];\n for(var i =0; i< 10; i++){\n arr.push(Math.floor(Math.random()*100))\n }\n return arr;\n}", "function multirand(n){\n arr.push(rand10(10))\n}", "function pick(arr){\r\n randompick=Math.floor(Math.random() * arr.length);\r\n return arr[randompick];\r\n}", "function multiRand(n) {\n for (let i=0 ; i<n; i++) {\n arr.push(rand10());\n }\n return arr;\n}", "randomQualities(){\n\t\tvar qualities = [];\n\t\tfor(var i=0;i<this.qualityList.length;i++)\n\t\t\tqualities.push(Math.trunc(Math.random()*101));\n\t\treturn qualities;\n\t}", "async function generatePokemonArray(pokemon) {\n randomPokemon = pokemon[Math.floor(Math.random() * 151)]\n getRandomPokemonData(randomPokemon);\n }", "function multirand(n){\n return arr.push(rand10(10))\n}", "function createArray(){\n let arr = [];\n for(let i = 0; i < 100; i++){\n arr.push(getRandomInteger(0, 100));\n }\n return arr;\n}", "function getRandom() {\n var dim = jcrop_api.getBounds();\n return [\n Math.round(Math.random() * dim[0]),\n Math.round(Math.random() * dim[1]),\n Math.round(Math.random() * dim[0]),\n Math.round(Math.random() * dim[1])\n ];\n }", "function makeRandomPresArr() {\n let pres_ind_arr = [];\n for (let ind in PRESIDENTS) {\n pres_ind_arr.push(Number(ind));\n }\n let shuffledArray = _.shuffle(pres_ind_arr);\n return shuffledArray;\n}", "function giveMeRandom(n){\n let array=[];\n\n for(let i=0; i<n; i++){\n array[i] = Math.floor(Math.random() * 11);\n }\n return array;\n}", "function pickFromArray(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function pickFromArray(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function randomAll() {\n var random = [];\n random.push(randomNova());\n random.push(randomVodafone());\n random.push(randomTwoForOne());\n var allRandom = random[Math.floor(Math.random() * random.length)];\n return allRandom;\n}", "function generateRandomArray(){\n var randomArray = [];\n for(var i = 0; i < 20; i++){\n randomArray.push(Math.floor(Math.random() * 4) + 1);\n }\n return randomArray;\n }", "function getRandom() {\n var dim = jcrop_api.getBounds();\n return [\n\tMath.round(Math.random() * dim[0]),\n\tMath.round(Math.random() * dim[1]),\n\tMath.round(Math.random() * dim[0]),\n\tMath.round(Math.random() * dim[1])\n ];\n}", "function newArray() {\n const arrayLength = Math.round(Math.random() * 100);\n let array = [];\n for (let i = 0; i < arrayLength; i++) {\n array[i] = Math.random();\n }\n return array;\n}", "function create_dummy_array(n) {\n var p = [];\n for (i = 0; i < n; i++) {\n p.push(Math.floor(Math.random() * 10));\n }\n return p;\n}", "function generateRandom(n){\r\n var arr=[];\r\n for (var i=0; i<n;i++){\r\n arr.push(random());\r\n }\r\n return arr;\r\n}", "function randomItem(array) {\n return array[Math.floor(Math.random() * array.length)];\n }", "function sample(array) {\n return array[Math.floor(Math.random() * array.length)];\n}", "random (items) {\n return items[Math.floor(Math.random() * items.length)]\n }", "function generateRandom(){\n const random = [];\n random[0] = Math.trunc(Math.random()*screenSize[0]) + 1; //width\n random[1] = Math.trunc(Math.random()*screenSize[1]) + 1; //Heigth\n return random;\n }", "function random_data(how_many_times) {\n\trandom_data_array = []\n\tfor (var i = 0; i < how_many_times; i++) {\n\t\tmin = Math.ceil(1)\n\t\tmax = Math.floor(10)\n\t\tnumber_of_letters = Math.floor(Math.random() * (max-min)) + min;\n\t\trandom_data_array.push(Math.random().toString(36).slice(number_of_letters));\n\t}\n\treturn random_data_array\n}", "function getRandomPower(movesArr, data) {\n let min = 0;\n let max = data.moves.length;\n let randomMove = Math.floor(Math.random() * (max - min) + min);\n movesArr.push(data.moves[randomMove]); // put the four random moves in a new array\n }", "function generaArray() {\n var arrayGenerato = [];\n for (var i = 0; i < 10; i++) {\n var numeroCasuale = Math.floor(Math.random() * 100) + 1;\n arrayGenerato.push(numeroCasuale);\n }\n return arrayGenerato;\n}", "function CreateLottoValues() {\n for (var i=0; i<randomArray.length; i++) {\n randomArray[i] = array[Math.floor(Math.random() * array.length)]; \n }\n}", "function random(m,n,seed){\r\n\t\tvar i,j,k,rn = new Array();\r\n for(i = 0;i < m;i++){\r\n \t rn[i] = [];\r\n \t for(j = 0;j < n;j++){\r\n \t\tseed = parseInt(seed);\r\n \t\tk = parseInt(seed/127773);\r\n \t seed = parseInt(16807*(seed - k*127773)- k*2836);\r\n \t if ( seed < 0 )seed += 2147483647;\r\n \t\trn[i][j] = seed*4.656612875e-10;\r\n \t }\r\n }\r\n return rn;\r\n\t}", "function getsequence(mpr,rpr){\r\n\tvar sq = (rhythmpresets[rpr])();\r\n\tfor(var i=0; i<sq.length; i++){ sq[i][2] = getrandomnote(mpr); }\r\n\treturn sq;\r\n}", "function genFakeData(numbers) {\r\n var arr = [];\r\n for (let i = 0;i<numbers;i++) {\r\n arr.push({\r\n optionId:Math.floor(Math.random()*30+1000000000),\r\n companyId:Math.floor(Math.random()*20+1000000000),\r\n audienceCount:Math.floor(Math.random()*1000000),\r\n cost:Math.floor(Math.random()*500),\r\n });\r\n }\r\n return arr;\r\n}", "function createAnsArray(){\n for (let i=0; i<numberOfButtons; i++) {\n ansArray.push($lisArray[Math.floor(Math.random()*$lisArray.length)]);\n }\n console.log(ansArray);\n }", "function sample(arr, n) {\n var res = [];\n var length = arr.length;\n // Default to a single item\n n || (n = 1);\n // For the length of `n`, push a random element to the results list\n times(n, function () {\n res.push(arr[possibleIndex(length)]);\n });\n return res;\n }", "function sample(array, size) {\n\tvar result = Array(size);\n\tfor(var i = 0; i < size; i++) {\n\t\tresult[i] = array[Math.floor(Math.random() * array.length)];\n\t}\n\treturn result;\n}", "\"personality.getRandomQuestion\"() {\n if (Meteor.isServer) {\n const fetchedQuestion = Personality.rawCollection()\n .aggregate([\n { $sample: { size: 1 } }, // Select 1 document from collection.\n {\n $project: {\n item: {\n $arrayElemAt: [\n \"$items\",\n {\n $floor: { $multiply: [{ $size: \"$items\" }, Math.random()] },\n },\n ],\n },\n },\n },\n ])\n .toArray();\n return fetchedQuestion;\n }\n }", "function genArray(length) {\n\t var arr = [];\n\t for (var i = 0; i < length; ++i) {\n\t\t arr[i] = Math.floor(Math.random() * 101);\n\t\t }\n\t return arr;\n}", "function pickMystery(){\nlet suspect = suspectsArray[Math.floor( Math.random() * suspectsArray.length)]\nlet weapon = weaponsArray[Math.floor( Math.random() * weaponsArray.length)]\nlet room = roomsArray[Math.floor( Math.random() * roomsArray.length )]\n\nreturn { suspect, weapon, room} // return gives us the object\n}", "function giveMeRandom(n){\n\n let arr= [] \n for(i=0; i<n; i++){\n arr.push(Math.floor((Math.random() * 10)))\n }\n return arr\n}", "function createShuffle() {\r\n shuffled = [];\r\n for (var i = 0; i < songs.length; i++) {\r\n shuffled.push(i);\r\n }\r\n return randomize(shuffled);\r\n }", "function createRandomList() {\n let randomList = [];\n for (let i=0; i<10; i++) {\n randomList.push(random100());\n }\n return randomList\n}", "function tiradas(n){\n var lista = [];\n for (var i = 0; i < n; i++) {\n lista.push(random(6));\n }\n return lista;\n}", "function randomGenerator() {\n var pieceList = [0, 1, 2, 3, 4, 5, 6];\n return pieceList.sort(function () {\n return 0.5 - rng.next()\n });\n}", "function buildRandomElements() {\n\n var arr = [];\n\n for (var i = 0; i < 10; i++) {\n arr[i] = 50 * Math.random();\n }\n\n console.log(arr);\n\n return arr;\n\n\n}", "function create_dummy_array(n){\n let arr=[];\n for(let i = 0; i < n; i++){\n arr.push(Math.random()*9);\n }\n return arr;\n}", "generateRandom() {\n const n = 4;\n const arr = [];\n do {\n const num = Math.floor(Math.random() * 6);\n\n if (!arr.includes(num)) {\n arr.push(num);\n }\n } while (arr.length < n);\n return arr;\n }", "function sample(array) {\n const index = Math.floor(Math.random() * array.length)\n return array[index]\n}", "function pickRandom(array){\n let result = array[Math.floor(Math.random()*(array.length))];\n randomArray.push(result);\n return result;\n}", "function getRandomItem(arr) {\n\treturn arr[Math.floor(Math.random() * arr.length)];\n}", "function getRandom(array, n) {\n var sample = [];\n var length = array.length;\n while(sample.length < n) {\n var value = array[Math.floor(Math.random() * length)];\n sample.push(value);\n }\n return sample;\n }", "function randomItem(arr) {\n return arr[Math.floor(arr.length*Math.random())];\n}", "function pickFromArray(choices) {\n return choices[Math.floor(Math.random() * choices.length)];\n}", "getRadomValue(arr) {\n return arr[Math.floor(Math.random()*arr.length)];\n }", "async genType(){\n let result = ['barren', 'lush', 'aquatic', 'gas', 'rocky', 'plains', 'polis'];\n for(var k = 0; k < misc.randomnum(500,5000); k++){\n result.sort(() => Math.random() - 0.5);\n }\n return result[0];\n }", "function randomPiece(){\n let r = randomN = Math.floor(Math.random() * PIECES.length) //math.floor rounds the number to an integer\n return new Piece( PIECES[r][0],PIECES[r][1]); //math.raandom generates numbers between 0 and 1 \n} //to generate numbers between 0 and 7, multiply math.random by the length of the tetromino array", "function sample(a, n) {\n let sel = [];\n for (let pool = new Set(a.keys()); n > 0 && pool.size; --n) {\n let i = [...pool][Math.floor(Math.random() * pool.size)];\n sel.push(a[i]);\n pool.delete(i);\n }\n return sel;\n}", "function randomFourArray() {\n const a = [0, 1, 2, 3];\n const b = [];\n\n for (let i = 0; i < 4; i++) {\n const x = Math.floor((4 - i) * Math.random());\n b.push(a[x]);\n a.splice(x, 1);\n }\n\n return b;\n}", "getOptions(countries){\n const arr = [];\n for(let i = 0; i < 4; i++){\n let j = Math.floor(Math.random() * Math.floor(countries.length));\n arr.push(countries[j]);\n }\n return arr;\n }", "function getRandomItem(array) {\n return array[Math.floor(Math.random() * array.length)];\n}", "function tiradas(n) {\n var lista = [];\n for (var i = 0; i < n; i++) {\n lista.push([random(6), random(6)]);\n }\n return lista;\n}", "function random(){\n\t return random.get();\n\t }", "function random(){\n\t return random.get();\n\t }", "function randPick(arr)\n{\n return arr[Math.floor(Math.random() * arr.length)]; \n}", "generateData(arrs){\n const randIndex = this.generateRandomNumber(arrs.length)\n return arrs[randIndex];\n }", "function makeRandom() {\r\n return Math.floor(Math.random() * Product.all.length);\r\n}", "function riempi(n){\n\tvar array = [];\n for (var a =0; a<n;a++){\n\tarray.push(randomPoint());}\n\treturn array;\n}", "function randnSample(nSamples = 1, mu = 0, sigma = 10) {\n var output = [];\n output.length = nSamples;\n for (i = 0; i < nSamples; i++){\n output[i] = (randBM() * sigma) + mu;\n }\n return output;\n}", "function powerBallGen(min, max, num){\n\n var powerBallArray = [];\n\n // Math.random() * (max - min) + min\n for (var i = 0; i < num; i++) {\n\n var powerNumbers = Math.round(Math.random() * (59 - 1) + 1);\n\n powerBallArray [i] = powerNumbers;\n\n }\n\n return powerBallArray;\n\n}", "function getRandomMemes() {\r\n const randomMemesUrl = [];\r\n bulkImageUrls.map((imageUrl) => {\r\n randomMemesUrl.push(imageUrl.example);\r\n });\r\n // console.log(randomMemesUrl);\r\n\r\n const randomNumber = Math.floor(Math.random() * randomMemesUrl.length);\r\n return randomMemesUrl[randomNumber];\r\n }", "randomTrainingData() {\n var temp = [];\n for (var i in this.scenarioParameters.trainingDataSchema) {\n temp.push(\n random(\n this.scenarioParameters.trainingDataSchema[i].min,\n this.scenarioParameters.trainingDataSchema[i].max\n )\n );\n }\n return temp;\n }", "function randomize(arr) {\r\n arr = slice(arr);\r\n for (var t, j, l = arr.length, i = l; i--;) {\r\n t = arr[i];\r\n arr[i] = arr[j = ~~(Math.random() * l)];\r\n arr[j] = t;\r\n }\r\n return arr;\r\n }", "function generaArray () {\r\n var array = []\r\n\r\n for (var count = 0; count < 10; count++ ) {\r\n var numeroCasuale = Math.floor(Math.random() * 9) + 1;\r\n array.push(numeroCasuale);\r\n}\r\n return array.join(\"\")\r\n}", "shuffle(list) {\n list = list.slice();\n let shuffled = [];\n while (list.length) {\n let pos = (config.PRNG.nextFloat() * list.length)|0;\n shuffled.push( list.splice(pos,1)[0] );\n }\n return shuffled;\n }", "function getRandomItem(array) {\n let ticks = 0;\n // Get a random number and access that element in the array\n const item = array[Math.floor(Math.random() * array.length)];\n ticks++;\n return {\n result: item,\n ticks: ticks\n };\n}", "function getRandomList (type, num) {\n var list = []\n\n for (var i = 0; i < num; i++) {\n list.push(getRandom(type))\n }\n return list\n}", "function randomItem(arr) {\n return arr[Math.floor(Math.random()*arr.length)]\n}", "getRandomItem(array) {\n // get random index value\n const randomIndex = Math.floor(Math.random() * array.length);\n // get random item and return it\n return array[randomIndex];\n }", "function R(array) {\n return array[Math.floor(Math.random() * (array.length))];\n }", "function storeShuffledItems(array) {\n\tshuffleArray(protein_array);\n\tvar _rand_val = (Math.random()*2);\n\tif ( _rand_val == 0 ) {\n\t\tarray=[protein_array[0],protein_array[1],protein_array[2],protein_array[3],protein_array[4],protein_array[5]];\n\t} else {\n\t\tarray=[protein_array[0],protein_array[1],protein_array[2],protein_array[3],protein_array[4],protein_array[5],protein_array[6]];\n\t}\n\treturn array;\n}", "function randomArray(size=2){\n if(typeof size !== 'number') return null;\n let randomArray = [];\n for (let i = 0; i < size; i++){\n randomArray.push(Math.floor((Math.random() * 100001) - 1));\n }\n return randomArray;\n}", "function randomX(size, mines) {\n var random = [];\n var count = mines;\n for (var i = 0; i < size * size; i++) {\n if (count > 0){\n random [i] = 'x';\n count -- ;\n }\n else random [i] = null ;\n }\n shuffle(random);\n return random;\n}", "function randomFromArray(arr){\n\treturn arr[Math.floor(Math.random() * arr.length)]\n}", "function getRandom(){\n var arr = [];\n arr.push(getRandomNumber());\n arr.push(getRandomAlphabets());\n return arr[Math.floor(Math.random() * arr.length)]\n}", "function genarate(size, top) {\n var arr = [];\n for (var i = 0; i < size; i++) {\n arr[i] = (Math.random() - 0.5) * top | 0;\n }\n return arr;\n}", "function r(item){\n var rand=Math.floor(Math.random()*item.length);\n return rand;\n}", "function randomPosition() {\n\tvar rnd = Math.round(Math.random()*ps.length);\n\treturn ps[rnd];\n}", "getRandomList (type, num) {\n return getRandomList(type, num)\n }", "function generateRandomNumbers() {\n let delay = [];\n delay[0] = generateRandom(60, 100);\n for (let i = 1; i < 3; i++) {\n delay[i] = generateRandom(delay[i-1] + 5, 100 + i * 5);\n }\n return delay;\n}", "static randomFlListSeeded(seed, min, max, n) {\r\n let randArray = [];\r\n seedrandom(seed, { global: true });\r\n let decimalPlaces = Math.pow(10 ,2); //Sets decimal place to 2\r\n\r\n for(let i = 0; i < n; i++ ) {\r\n let randomNo = Math.random() * (max - min) + min;\r\n randArray[i] = Math.floor(randomNo * decimalPlaces) / decimalPlaces;\r\n }\r\n return randArray;\r\n }", "function generate() {\n return [getRand(categories), getRand(gameType), 'where you', getRand(action), getRand(thing)].join(' ');\n}", "function multiRand () {\n return Math.floor(Math.random() * 11);\n}", "function getRandomArray(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}" ]
[ "0.6919016", "0.6906586", "0.6897475", "0.6825241", "0.67861396", "0.6652321", "0.6649915", "0.6641872", "0.6632528", "0.66028255", "0.659293", "0.6590533", "0.65550977", "0.65445155", "0.653075", "0.65240955", "0.6519388", "0.65169656", "0.6499348", "0.6484465", "0.6456471", "0.6405974", "0.6403714", "0.6403714", "0.6400557", "0.63963985", "0.638727", "0.6340832", "0.63326854", "0.632641", "0.63157344", "0.63130903", "0.6311133", "0.63022983", "0.6299934", "0.62948817", "0.627608", "0.6273901", "0.6270101", "0.62661916", "0.62602645", "0.6258814", "0.62516934", "0.62509656", "0.6249358", "0.6243903", "0.6241986", "0.62399554", "0.6231771", "0.62307215", "0.62283975", "0.6224301", "0.6219361", "0.62170666", "0.62143815", "0.62121004", "0.620923", "0.62037987", "0.62007535", "0.6199803", "0.6182653", "0.61776686", "0.6168861", "0.6167825", "0.61672693", "0.61651915", "0.6162025", "0.61615103", "0.6151285", "0.61508566", "0.61508566", "0.61507624", "0.61414427", "0.6135719", "0.6134176", "0.6133027", "0.6127687", "0.61268115", "0.612654", "0.6126089", "0.612511", "0.612301", "0.61220247", "0.6120895", "0.6120776", "0.61193335", "0.6111867", "0.6108647", "0.6103579", "0.6102167", "0.60982245", "0.60955113", "0.60949355", "0.6088269", "0.6085706", "0.60848176", "0.60836935", "0.6082814", "0.60815084", "0.60716265", "0.60693115" ]
0.0
-1
5. displayResults by emptying landing page and filling it with results
function displayResults(resJson) { // if there are previous results, remove them $("#starting-screen").hide(); $("#js-error-screen").empty(); // iterate through the items array let records = shuffleArray(resJson.records); let ages = {}; let races = {}; let genders = {}; records.forEach((record) => { if (genders[record.fields.gender]) { genders[record.fields.gender]++; } else { genders[record.fields.gender] = 1; } if (races[record.fields.raceethnicity]) { races[record.fields.raceethnicity]++; } else { races[record.fields.raceethnicity] = 1; } const age = Math.floor(record.fields.computedmissingmaxage / 10) * 10; if (ages[age]) { ages[age]++; } else { ages[age] = 1; } }); createAgeChart(ages); createRaceChart(races); createPieChart(genders); state.records = records; state.page = 0; if (records.length > 10) { records = records.slice(0, 10); } renderItems(records); // 7. display new search button // 8. Show CTA message to user $("#new-search-section").append( `<section class="new-search-container"> <h2 class="message-footer title">Want to search in a new location?</h2> <button class="new-search-btn">Let's Go!</button> </section>` ); //display the results section $(".results-txt").removeClass("hidden").show(); $(".results-container").removeClass("hidden").show(); $(".results").show(); $("#new-search-section").show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayResults() {\n\n $(\"#resultsPage\").show();\n $('#questionPage').hide();\n setTimeout(reset, 1000 * 10);\n }", "function renderResultsPage(results) {\r\n console.log(results);\r\n\t\r\n var resultsContainer = $('#container');\r\n\tvar did_you_mean = '';\r\n\t\r\n\tif(results.did_you_mean != null)\r\n\t{\r\n\t\tif(results.did_you_mean.length > 0)\r\n\t\t{\t\r\n\t\t\tfor(i=0;i<results.did_you_mean.length;i++) {\r\n\t\t\t if (i != 0) {\r\n\t\t\t did_you_mean += ', ';\r\n }\r\n\r\n\t\t\t did_you_mean += '<a href=\"#brm-search?request_type=search&search_type=keyword&q=' + results.did_you_mean[i] + '&l=' + results.did_you_mean[i] + '\">' + results.did_you_mean[i] + '</a>';\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n // remove previous results\r\n $('#filter_category').html('');\r\n $('#filter_brand').html('');\r\n $('#product_list').html('');\r\n $('#filter_size').html('');\r\n $('#filter_price').html('');\r\n $('#filter_colorGroup').html('');\r\n $('#filter_current').html('');\r\n $('#pagination_top').html('');\r\n $('#pagination_bottom').html('');\r\n $('#sort_options').html('');\r\n\t$('#m_recommendation').html('');\r\n\t\r\n\t/* did you mean */\r\n\tif (did_you_mean != '') {\r\n\t renderRecommendation(did_you_mean);\r\n\t $('#m_recommendation').css('display', 'block');\r\n\t}\r\n\telse {\r\n\t $('#m_recommendation').css('display', 'none');\r\n\t}\r\n\t\r\n if (results.numResults == 0) {\r\n $('#contents_left').css('display', 'none');\r\n $('#contents_right').css('display', 'none');\r\n $('#contents_center').css('display', 'none');\r\n\r\n var typedText = '';\r\n typedText = window.location.hash.match(/&q=([^&]+)/)[1].replace(/%20/g, \" \");\r\n //alert(BR.mobile.getJfyUrl(\"jfy,dynamic_categories\"));\r\n location.href = 'NoResult.aspx?searchTerm=' + typedText + BR.mobile.getJfyUrl(\"jfy,dynamic_categories\");\r\n //location.href = 'NoResult.aspx?searchTerm=' + typedText + '#brm-search?request_type=jfy';\r\n }\r\n else {\r\n $('#contents_left').css('display', 'block');\r\n $('#contents_right').css('display', 'block');\r\n $('#contents_center').css('display', 'none');\r\n\r\n /* Filters */\r\n var filtersContainer = $('#filter_category');\r\n\r\n renderFilters(results.availableFilters, results.currentFilters, filtersContainer);\r\n\r\n setPagination(results.numResults, results.startIndex);\r\n // console.log(filtersContainer);\r\n\t\t\r\n /* Sorting */\r\n renderSort(results.availableSorts, results.currentSort);\r\n\r\n /* Products */\r\n var contents_rightContainer = $('#product_list');\r\n var productGrid = $('<div></div>', { class: 'productgridpage' });\r\n contents_rightContainer.append($('<div></div>', { class: 'productgrid mw-three-up' }).append(productGrid));\r\n renderProducts(results.products, productGrid, results.brTrkData);\r\n\r\n brmSearchContainer.trigger('brm-rendered');\r\n }\r\n\r\n}", "function displayQueryResults() {\n\t\t\t$scope.resultsAvailable = true;\n\t\t\tresultsOffset = 0;\n\t\t\t$scope.getNextResultsPage();\n\n\t\t}", "function displayResults (data) {\n displayList(data);\n initMap(data);\n unhideHtml();\n}", "function displayResults() {\n if (suggestionsArray.length > 0){\n $(\"#name\").append(suggestionsArray[0].name)\n $(\"#description\").append(suggestionsArray[0].description);\n $(\"#link\").prop(\"href\", suggestionsArray[0].link)\n $(\"#IMG\").attr(\"src\", suggestionsArray[0].IMG);\n suggestionsArray.splice(0, 1);\n } else {\n netflixAndChill();\n }\n }", "function clearResults() {\n\t\t// Re-display loading icons\n\t\tdocument.getElementById(\"loadingmeaning\").style.display = \"inline\";\n\t\tdocument.getElementById(\"loadinggraph\").style.display = \"inline\";\n\t\tdocument.getElementById(\"loadingcelebs\").style.display = \"inline\";\n\t\t\n\t\t// Clear old results\n\t\tdocument.getElementById(\"meaning\").innerHTML = \"\";\n\t\tdocument.getElementById(\"graph\").innerHTML = \"\";\n\t\tdocument.getElementById(\"celebs\").innerHTML = \"\";\n\t\t\n\t\t// Hide \"no results\" error message\n\t\tdocument.getElementById(\"norankdata\").style.display = \"none\";\n\t}", "function showResultsPage(data) {\n state = 1;\n locations = [];\n errorMessage = '';\n\n // if search was by term, stores it in recent searches\n if (searchTerm !== '') {\n rss.store({\n term: searchTerm,\n results: data.results \n });\n }\n\n // prepare next page data\n app.template7Data['page:results'] = ps.getLastQueryResults();\n app.template7Data['page:results'].loadMore = {\n label: 'Load more ...',\n canLoad: app.template7Data['page:results'].page < app.template7Data['page:results'].pages\n };\n\n app.hidePreloader();\n\n window.mainView.router.loadPage('pages/results/results.html');\n }", "function displayResults(data) {\n console.log('Results that will be displayed in HTML looks like this first:', data);\n $('#results').append(resultsHTML(data));\n }", "function refreshResults()\r\n{\r\n\tvar resultHTML = \"\";\r\n\tfor (resultIndex = 0; resultIndex < results.length; resultIndex++)\r\n\t{\r\n\t\tvar tracks = results[resultIndex];\r\n\t\tvar trackBatchHTML = trackBatchDIV.replace(/#/g, resultIndex);\r\n\t\ttrackBatchHTML = trackBatchHTML.replace(/HEAD_URL/g, tracks.baseUrl);\r\n\t\ttrackBatchHTML = trackBatchHTML.replace(/INDEX_NAME/, tracks.indexName);\r\n\t\ttrackBatchHTML = trackBatchHTML.replace(/BASE_URL/, tracks.baseUrl);\r\n\t\ttrackBatchHTML = trackBatchHTML.replace(/MATCHED_TRACK_INFO/, buildTrackList(tracks.baseUrl, tracks.matchedTrack));\r\n\t\ttrackBatchHTML = trackBatchHTML.replace(/OTHER_TRACK_INFO/, buildTrackList(tracks.baseUrl, tracks.otherTrack));\r\n\t\t\r\n\t\tresultHTML += trackBatchHTML;\r\n\t}\r\n\t\r\n\tif (resultHTML == \"\" && resultCounter == 0)\r\n\t{\r\n\t\tresultHTML = \"No Results\";\r\n\t}\r\n\t\r\n\tif (resultHTML != \"\")\r\n\t{\r\n\t\twriteDiv('results', null, resultHTML);\r\n\t}\r\n\t\r\n\t/*if (resultCounter == 0)\r\n\t{*/\r\n\t\t_IG_AdjustIFrameHeight();\r\n\t//}\r\n}", "function renderResults(result) {\n\t\tif(result && result.searchHits && result.searchHits.length) {\t\n\t\t\tlistOfMyListItems = result.searchHits;\n\t\t\tdisplayMyList(result.searchHits);\n\t\t\tpagingControl.updatePaging(result);\n\t\t}\n\t}", "function displayResults() {\n\n $('.btn').focus();\n $('#top-result').fadeIn();\n $('.container__outside--output').fadeIn();\n $('#map').html('<img src=' + mapUrl + '>');\n $('#result').text(venue.name);\n $('#location').text(venue.address);\n $('#url').html('<a href=\"' + venue.url + '\" target=\"_blank\">Vist website</a>');\n $('#category').html('<img src=\"' + venue.icon + '64.png\">');\n \n }", "function renderInitialResult(results) {\n const result = results[0]\n // provides a result if the user enters something that isn't a book or author, or if the API doesn't have that particular book in the system\n if (!results) {\n $(\".bookSuggest\").addClass(\"hidden\");\n $('.book-results').html(\"\");\n $(\".book-results\").append(\"Your entry wasn\\'t found! Please make a new search and try again.\");\n } else {\n\n // provides a recommendation to the user for a book or series\n $('.book-results').html(\"\");\n $(\".book-results\").append(`<h3>${result.Name}</h3>`);\n $(\".book-results\").append(`<p class=\"suggestion\">${result.wTeaser}</p>` + '<br>');\n $(\".book-results\").append(\"<a class=\\\"bookLink\\\" href=\\\"\" + `${result.wUrl}` + \"\\\" target=\\\"_blank\\\">Click here to learn more!</a>\");\n tryAnotherBook(results);\n}\n}", "function renderResult(results){\n listHead.innerHTML=\"\";\n if(results.length>0)\n results.forEach(displayResult);\n else{\n let listItem = document.createElement('p');\n listItem.innerHTML = 'No Result Found';\n listHead.appendChild(listItem);\n }\n }", "function renderResults(results) {\n\n}", "function DisplayResults(){\n console.log(\"inscoreboard\");\n $(\"#results\").show();\n $(\"#startOverBtn\").show();\n $('#timeLeft').empty();\n $('#message').empty();\n $('#correctedAnswer').empty(); \n $('#finalMessage').html(messages.finished);\n $('#correctAnswers').html(\"Correct Answers: \" + correctAnswer);\n $('#wrongAnswers').html(\"Incorrect Answers: \" + incorrectAnswer);\n $('#unanswered').html(\"Unanswered: \" + unanswered);\n //$('#startOverBtn').addClass('reset');\n //$('#startOverBtn').show();\n //$('#startOverBtn').html('Start Over?');\n }", "function show_results() {\n\t\t$('#mc_btns').hide();\n\t\t$('#progress-box').hide();\n\t\t$('#result-btns').show();\n\t\t$('#page-title').html('Results').hide().fadeIn(500);\n\t}", "function displayResults(data){\r\n // remove all past results\r\n $(\".results\").remove();\r\n // lift WikiSearch title to top of page\r\n $(\".titleClass\").css(\"padding-top\",\"0px\");\r\n // show results\r\n \r\n const result = data[\"query\"][\"search\"][0][\"title\"];\r\n // create div for all search results\r\n $(\".searchMenu\").append(\"<div class = 'searchResults results'></div>\");\r\n // main search result title\r\n $(\".searchResults\").append(\"<div class='searchTitle'></div>\");\r\n $(\".searchTitle\").html(\"Search Results for <a target=\\\"_blank\\\" href = \\'https://en.wikipedia.org/wiki/\"+result+\"\\'>\"+result+\"</a>\"); // push titleClass to top of page\r\n \r\n // results\r\n for (var ii =1; ii < data[\"query\"][\"search\"].length -1; ii++){\r\n // create div for each result\r\n $(\".searchResults\").append(\"<div class='key\" + ii + \" result'></div>\");\r\n // append to div\r\n var searchResult = data[\"query\"][\"search\"][ii][\"title\"];\r\n $(\".key\" + ii).append(\"<p class = 'resultTitle'><a target=\\\"_blank\\\" href = \\'https://en.wikipedia.org/wiki/\"+searchResult+\"\\'>\"+searchResult+\"</a></p>\");\r\n $(\".key\"+ii).append(\"<p class = 'resultText'>\" + data[\"query\"][\"search\"][ii][\"snippet\"]+\"...\" + \"</p>\");\r\n }\r\n}", "function clearResults() {\n\t$('.results').text('');\n}", "function showResults() {\n countdown = 5;\n clearInterval(timer);\n clearContent();\n }", "function showResults(results){\n\t\n}", "function resetDisplay() {\n\n $(\"#display-results\").empty();\n\n}", "function displayResults(){\n\t\t//Clear the Options section\n\t\t$(\"#options\").empty();\n\n\t\t//Display Text Results in various sections\n\t\t$(\"#questionResponse\").text(\"Here is your tally!\");\n\n\t\t$(\"#options\").append(\"<p>Correct Answers: \" + correctCount + \" </p>\");\n\t\t$(\"#options\").append(\"<p>Incorrect Answers: \" + incorrectCount + \" </p>\");\n\t\t$(\"#options\").append(\"<p>Unanswered: \" + unansweredCount + \" </p>\");\n\n\t\t//Display Start Over Button\n\t\t$(\"#startOver\").show();\n\t}", "function handleResults(values, json){\n $(\"#drop-in\").empty(); //remove the metadata type stuff. It's no longer needed.\n show_search_results(json); //the json here is no longer just json\n \n var message = $(\"#status-message-for-results\").text();\n\n $(\"div.status_message\").text(message);\n $(\"span.status_message\").text(message);\n \n if (json.search_paging_info != null){ \n values.page_of_results_shown =\n json.search_paging_info.page_of_results_to_display;\n //Sets the page number of displayed results.\n }else{ \n //not setting the page of search results; but no error means \n //that this is a non-error, but empty search results case.\n showStatusInCorrectPlace(true);\n }\n}", "function displayResult(results) {\n $(\"#songs\").html(\"\");\n\n for (i = 0 ; i < 20 && i < results.length ; i++) {\n $(\"#songs\").append(composeSongHTML(results[i], currIndex++));\n }\n bindEvents();\n}", "function noUniResults() {\n if (!$(\"#uni-results\").children().length > 0) {\n $(\"#uni-results\").append(\"No results found\");\n count = 0;\n }\n }", "function fetchResults(e) { //declares function that will fetch results from the URL SIMON ^\n // console.log(e);\n e.preventDefault(); // doesn't reload entire page created, only a section\n url = ${baseURL}?api-key=${key}&page=${pageNumber}&q=$ {searchTerm.value}", "function displayResults() {\n if (lyric === \"\") {\n lyric = \"Couldn't find any lyrics from this track\"\n }\n id(\"lyric\").innerText = lyric;\n id(\"song-name\").innerText = trackName;\n id(\"artist-name\").innerText = artistName;\n qs(\"blockquote\").classList.remove(\"hidden\");\n qs(\"#quote\").classList.remove(\"hidden\");\n id(\"tracking\").src = tracking;\n let error = id(\"error\");\n error.innerText = \"\";\n }", "function initializeResults() {\n resultsContainer.empty();\n var restaurantsToAdd = [];\n for (var i = 0; i < restaurants.length; i++) {\n restaurantsToAdd.push(createResults(restaurants[i]));\n }\n resultsContainer.append(restaurantsToAdd);\n }", "function paintResults(results,) {\r\n window.location.hash = \"#/results\";\r\n results.forEach((element,idx) => {\r\n let searchItem = `<div class=\"search-result\">\r\n <div class=\"search-result-image\" style=\"background-color:${element.dominantColor};\">\r\n <img data-idx=\"${idx}\"onload=\"onImageLoaded(event)\"class=\"search-result-image-content\" src=\"${element.impath}\"></img>\r\n </div>\r\n <div class=\"search-result-meta\">\r\n <p>${element.title}</p>\r\n <span class=\"search-result-meta-color\" style=\"background-color: ${element.dominantColor};\"></span>\r\n <span class=\"search-result-meta-width\">\r\n ${element.imgobj.width} &#10005 ${element.imgobj.height} pixels\r\n </span>\r\n </div>\r\n </div>`\r\n\r\n document.querySelector(\".search-load-more\").insertAdjacentHTML(\"beforebegin\",searchItem)\r\n\r\n });\r\n\r\n if(results.length == 0) {\r\n document.querySelector(\".search-load-more\").insertAdjacentHTML(\"beforebegin\",noResults)\r\n }\r\n\r\n if(results.length < app.itemsPerPage) {\r\n this.document.querySelector(\".search-load-more\").remove()\r\n }\r\n\r\n\r\n requestingInfiniteScroll = false;\r\n}", "function resetResults() {\n $(\"#search-results-heading\").text(\"\");\n $(\"#results\").text(\"\");\n}", "function clearResultsDiv() {\n \"use strict\";\n document.getElementById('results').style.display = 'none';\n}", "function display_results() {\n}", "function displayResults(responseJson) {\n console.log(responseJson);\n $('.js-results').empty();\n // Clears previous results\n for (let i = 0; i < responseJson.data.length; i++) {\n //iterates through the items array\n $('.js-results').append(`\n <li><h2>${responseJson.data[i].fullName}</h2></li>\n <li><p>${responseJson.data[i].description}</p></li>\n <li><h3>Address</h3></li>\n <li><p>${formatAddress(responseJson, i)}</p></li>\n <li><a href=\"${responseJson.data[i].url}\">Click here for ${responseJson.data[i].fullName} website</a></li>\n `);\n $('#results').removeClass('hidden');\n //lists the national park's name, description, address and website url\n }\n}", "function clearSearchResults() {\n document.getElementById('clear_search_results').style.display = 'none';\n document.getElementById('tags_nav').style.display = 'initial';\n document.getElementById('categories_nav').style.display = 'initial';\n document.getElementById('search').value = '';\n popParamFromURL('searchTerm');\n savedNavURL = false;\n displayTen();\n}", "function clearResults() {\n document.getElementById(\"results\").innerHTML = \"\";\n}", "function resultsPage() {\n if (counter === STORE.length) {\n $('footer').hide();\n $('main').html(`\n <section class=\"result-box\">\n <h3 aria-live='polite'>Your total score is ${score} out of a possible 6! </h3>\n <button class=\"result-button\">Restart Quiz!</button>\n </section>\n `);\n restartQuiz();\n }\n}", "function clearResults()\r\n{\r\n\t// Stop any existing search.\r\n\tsearchControl.cancelSearch();\r\n\t\r\n\t// Clear the results.\r\n\tresults = new Array();\r\n\tresultProgress = new Array();\r\n\tresultCounter = 0;\r\n\twriteDiv('results', null, \"\");\r\n\tshowProgress(0);\r\n\t\r\n\t// Clear the input box.\r\n\tsetControlValue(\"searchInput\", \"\");\r\n}", "function showResultsFromApi(result) {\n\n //create an empty variable to store one LI for each one the results\n let buildTheHtmlOutput = \"\";\n\n $.each(result, function (resultKey, resultValue) {\n //create and populate one LI for each of the results ( \"+=\" means concatenate to the previous one)\n buildTheHtmlOutput += '<article role=\"listbox\" class=\"one-half\">';\n buildTheHtmlOutput += '<h3>' + resultValue.show.name + '</h3>';\n\n if (resultValue.show.rating.average == null) {\n buildTheHtmlOutput += '<h4>' + 'Ratings not found' + '</h4>';\n } else {\n buildTheHtmlOutput += '<h4>' + 'Rating ' + resultValue.show.rating.average + '</h4>';\n }\n\n if (resultValue.show.image == null) {\n buildTheHtmlOutput += '<img src=\"no-img.png\" alt=\"Television show poster\">';\n } else {\n buildTheHtmlOutput += '<img src=\"' + resultValue.show.image.original + '\" alt=\"Television show poster\">';\n }\n\n buildTheHtmlOutput += '<p>' + resultValue.show.summary + '</p>';\n buildTheHtmlOutput += '</article>';\n });\n //use the HTML output to show it in the index.html\n $(\".result-section\").html(buildTheHtmlOutput);\n $('.result-section').show();\n}", "function clearSearchResults() {\n $(\"#results\").html(\"\");\n}", "function displayResults(objectarray) {\n\t$(\"#search-documents\").empty();\n\t$(\"#chaplain-docs\").empty();\n\tif (objectarray.length == 0) {\n\t\t$(\"#search-documents\").append(\"<p>No results found</p>\");\n\t\t$(\"#chaplain-docs\").append(\"<p>No Documents found</p>\");\n\t}\n\tobjectarray.forEach(function(e) {\n\t\t$(\"#search-documents\").append('<hr><article class=\"search-result\"> ' +\n\t\t\t'<h3><a href=\"' + e.link + '\" target=\"_blank\">' + e.title + '</a></h3>' +\n\t\t\t'<h5>' + e.location + '</h5>' +\n\t\t\t'<h5>' + e.date + '</h5>' +\n\t\t\t'</article>')\n\n\t\t$(\"#chaplain-docs\").append('<a href=\"' + e.link + '\" target=\"_blank\">' + e.title + '</a> <br>');\n\t})\n}", "function clearResults(){\n searchResults.innerHTML = '';\n}", "function displayResults(responseObj) {\n\t// console.log(\"calling inside displayResults\", responseObj);\n\t//get properties inside an object use . notation\n\tconst works = responseObj.GoodreadsResponse.search.results.work;\n\t//when searching for books a second time it clears the \n\tdocument.getElementById(\"results\").innerHTML = \"\"\n\tworks.forEach(function(work){\n\t\t// console.log(work);\n\t\tconst author = work.best_book.author.name[\"#text\"];\n\t\tconst title = work.best_book.title[\"#text\"];\n\t\tconst imgUrl = work.best_book.image_url[\"#text\"];\n\t\tconsole.log(\"title:\", title + \", Author:\", author + \", Bookcover\", imgUrl);\n\t\t\n\t\tconst myListItem = document.createElement(\"li\");\n\t\tconst image = document.createElement(\"img\");\n\t\timage.setAttribute(\"src\", imgUrl);\n\t\t\n\t\tmyListItem.innerHTML = title + \" by \" + author;\n\t\tmyListItem.appendChild(image);\n\t\tdocument.getElementById(\"results\").appendChild(myListItem);\n\t\n\t});\n}", "function putResultsOnPage(results)\n{\n //get search results div\n var theDiv = document.getElementById('search-results');\n \n //clear current content\n theDiv.innerHTML = '';\n \n //reset Y position because it might have changed after some touch scrolling frenzy!\n theDiv.style.top = '0';\n \n //might be no matches\n if(results.rows.length === 0)\n {\n theDiv.innerHTML = 'No matches found in the common words dictionary.\\\n Tweet @japxlate yourAdvancedWord for advanced word definitions.';\n buttonSpinnerVisible(false); //stop the loading spinner\n return;\n }\n \n //some results so loop through and print\n for(var loop = 0; loop < results.rows.length; loop++)\n {\n var item = results.rows.item(loop);\n \n var theRomaji = kana_to_romaji(item.kana);\n //var theRomaji = item.kana;\n var formattedDefinition = format_slashes(item.definition);\n \n var defText = item.kanji + ' / ' + item.kana + ' (' + theRomaji + ') / ' + formattedDefinition;\n defText = defText.replace(new RegExp(global_searchTerm, 'ig'), '<span style=\"color:#990000;\">$&</span>');\n \n var defLine = '<img src=\"img/j.png\" style=\"vertical-align:middle;\"> ' + defText + '<hr>';\n //var defLine = '<p class=\"def-line\"> ' + defText + '</p>'; //had CSS styling issues (mostly text overflow)\n \n theDiv.innerHTML += defLine;\n }\n \n buttonSpinnerVisible(false); //stop the loading spinner\n}", "function displaySearchResults (query, results) {\n\n // We're using data-attributes to govern CSS properties of the search form/results panel\n _root.setAttribute('data-displayresults','true');\n _root.removeAttribute('data-searchinit');\n _results.removeAttribute('aria-hidden');\n _results.removeAttribute('hidden');\n\n // Display number of results found above the results list\n _results\n .querySelector('div>h2')\n .textContent = results.length +\n (results.length === 1 ? ' result' : ' results') +\n ' found for \"' + query + '\"';\n\n if (results.length < 1) { return; }\n _results.querySelector('div').insertAdjacentHTML('beforeend',\n // The fun part:\n generateMarkup(results)\n );\n }", "function displaySearchResults(data) {\n const list = data.data.results;\n\n if (list.length === 0) {\n $('.unknown-section').html(`\n <div class='unknown'>\n <h2>No character found by that name.</h2>\n </div>\n `);\n\n $('.main-unknown-section').prop('hidden', false);\n $('.search-results-section').prop('hidden', true);\n\n return;\n }\n\n $('.main-unknown-section').prop('hidden', true);\n $('.search-results-section').prop('hidden', false);\n\n for (let i = 0; i < list.length; i++) {\n $('.search-results').append(`\n <div class=\"search-result\">\n <a href=\"#\" class=\"result-name\">${list[i].name}</a>\n </div>\n `);\n }\n}", "function noResults() {\r\n // Get students ul and remove students if no match found\r\n const ul = document.querySelector('.student-list');\r\n ul.innerHTML = '';\r\n\r\n // Create no results message\r\n const text = `No Name Found`;\r\n const noNamesFound = `<li>${text}</li>`;\r\n\r\n // Get pagination ul and remove buttons if no match found\r\n const linkUL = document.querySelector('.link-list');\r\n linkUL.innerHTML = '';\r\n\r\n // Insert message to page\r\n ul.insertAdjacentHTML('beforeend', noNamesFound);\r\n}", "function updateResultsListing() {\n\n var listingText,\n allItems = yearDimension.top(Infinity),\n makeSceneLink = function (scene) {\n if (scene !== '[Non-panorama history]')\n return '<a target=\"_blank\" href=\"' + \n SCENE_URL_BASE + scene + '\">' + scene + \n '</a>';\n else return scene;\n };\n\n // Update results count\n\n $('#active').text(allItems.length);\n\n // List entries in results box\n\n $('#resource-list').empty();\n\n yearDimension.top(INIT_LISTING_COUNT).forEach(function (item) {\n listingText = '<p>' +\n '<strong>' +\n '<a href=\"' + RESOURCE_URL_BASE + item.URLID + '\" target=\"_BLANK\">' + \n item.short_title + '</a>' +\n '</strong>' +\n ' (' + item.year.getFullYear() + ')<br />' +\n (item.author ? item.author + '<br />' : '') +\n 'Scenes: ' + item.scene.map(makeSceneLink).join(', ') +\n '</p>';\n $('#resource-list').append(listingText); \n }); \n }", "function displayResults (a_BTN) {\n // Discard previous results table if any\n // Can happen if we have slow searches, and several have been \"queued\" in series all happening\n // after last updateSearch() dispatch ..\n if (resultsTable != null) {\n\tSearchResult.removeChild(resultsTable);\n\tresultsTable = null;\n\tcurResultRowList = {};\n//\tresultsFragment = null;\n\n\t// If a row cell was highlighted, do not highlight it anymore\n//\tclearCellHighlight(rcursor, rlastSelOp, rselection.selectIds);\n\tcancelCursorSelection(rcursor, rselection);\n }\n\n // Create search results table\n// resultsFragment = document.createDocumentFragment();\n resultsTable = document.createElement(\"table\");\n resultsTable.id = \"resultstable\";\n SearchResult.appendChild(resultsTable); // Display the search results table + reflow\n// resultsFragment.appendChild(resultsTable);\n\n let len = a_BTN.length;\n//trace(\"Results: \"+len);\n if ((len <= 3) && (searchlistTimeoutId != undefined)) { // Close search history immediately when there are too few results\n\tclearTimeout(searchlistTimeoutId);\n\tcloseSearchList();\n }\n if (len > 0) {\n\tlet i;\n\tfor (let j=0 ; j<len; j++) {\n\t i = a_BTN[j];\n\t let url = i.url;\n//trace(\"Matching BTN.id: \"+i.id+\" \"+i.title+\" \"+url);\n\t if ((url == undefined) // folder (or separator ...)\n\t\t || !url.startsWith(\"place:\") // \"place:\" results behave strangely .. (they have no title !!)\n\t\t ) {\n\t\t// Append to the search result table\n\t\tlet BTN_id = i.id;\n\t\tif ((i.type != \"separator\") && (BTN_id != TagsFolder) && (BTN_id != MobileBookmarks)) { // Do not display separators nor Tags nor MobileBookmarks folders in search results\n\t\t let BN = curBNList[BTN_id];\n\t\t if (BN == undefined) { // Desynchro !! => reload bookmarks from FF API\n\t\t\t// Signal reload to background, and then redisplay to all\n\t\t\tsendAddonMessage(\"reloadFFAPI_auto\");\n\t\t\tbreak; // Break loop in case of error\n\t\t }\n\t\t if ((options.trashEnabled && options.trashVisible) || (BN.inBSP2Trash != true)) { // Don't display BSP2 trash folder results except on debug\n\t\t\tappendResult(BN);\n\t\t }\n\t\t}\n\t }\n\t}\n }\n // Stop waiting icon and display the search result table\n WaitingSearch.hidden = true;\n// SearchResult.appendChild(resultsFragment); // Display the search results table + reflow\n}", "function displaySearch(results) {\n console.log(results);\n $(\".travelResults\").empty(); //Prevents Search Duplicates\n\n var searchContent = \"\"; //String to creates out View Results\n searchContent = '<div class=\"panel-group\">';\n searchContent += '<div class=\"panel panel-info\">';\n searchContent += '<div class=\"panel-heading\">';\n searchContent += '<img class=\"img_small\" src=\"' + results[\"logo_url\"] + '\" /> ';\n searchContent += '<span style=\"font-size: 18pt;color: coral;vertical-align: middle;\">' + results[\"walkscore\"] + '</span>';\n searchContent += '<a href=\"' + results[\"more_info_link\"] + '\">';\n searchContent += '<img class=\"img_small\" src=\"' + results[\"more_info_icon\"] + '\"/>';\n searchContent += '</a>';\n searchContent += '</div>';\n searchContent += '<div class=\"panel-body\">';\n searchContent += '<p style=\"font-size: 11pt;color: steelblue;vertical-align: middle;\"> <strong>Description:</strong> ' + results[\"description\"] + '</p>';\n searchContent += '</div>';\n searchContent += '<div class=\"panel-footer\">';\n searchContent += '<a style=\"font-size:8pt;color:darkgray;\" href=\"' + results[\"help_link\"] + '\">' + 'For How Walks Score Works!' + '</a>';\n searchContent += '</div>';\n $(\".travelResults\").append(searchContent);\n}", "function resultPage(){\n page.empty();\n page.append($(\"<p>\").text(\"Number Correct: \" + numCorrect));\n page.append($(\"<p>\").text(\"Number Wrong: \" + numWrong));\n page.append($(\"<p>\").text(\"Number Unanswered: \" + numTimeLimit));\n\n currentQuestion = 0;\n numWrong = 0;\n numCorrect = 0;\n numTimeLimit = 0;\n\n setTimeout(function(){\n startPage();\n }, 3300);\n \n }", "function appShowAllResults(){\n\tcreateMap();\n\tdestroyMarkers();\n\tdestroyInfo();\n\tclearItinerary();\n\tdrawCenterMarker();\n\tdrawAllMarkers();\n\tzoomToFit();\n}", "getResults() {\n $.getJSON(\n `${\n universityData.root_url\n }/wp-json/university/v1/search?term=${this.searchField.val()}`,\n res => {\n this.resultsDiv.html(`\n <div class=\"row\">\n\n <div class=\"one-third\">\n <h3 class=\"search-overlay__section-title\">General Info</h3>\n ${\n res.generalInfo.length\n ? `\n <ul class=\"link-list min-list\">\n ${res.generalInfo\n .map(item => {\n return `<li><a class=\"a-flex\" href=\"${item.link}\"><span>${\n item.title\n }</span>\n ${\n item.img\n ? `<img style=\"height:100px; width:35%; object-fit:cover;\" src=\"${item.img}\"> `\n : \"\"\n }\n </a>\n </li>`;\n })\n .join(\"\")}\n </ul>`\n : \"Nothing found On General Info\"\n }\n \n </div>\n\n <div class=\"one-third\">\n <h3 class=\"search-overlay__section-title\">Programs</h3>\n ${\n res.programs.length\n ? `\n <ul class=\"link-list min-list\">\n ${res.programs\n .map(item => {\n return `<li><a class=\"a-flex\" href=\"${item.link}\"><span>${\n item.title\n }</span>\n ${\n item.img\n ? `<img style=\"height:100px; width:35%; object-fit:cover;\" src=\"${item.img}\"> `\n : \"\"\n }\n </a>\n </li>`;\n })\n .join(\"\")}\n </ul>`\n : \"Nothing found On Programs\"\n }\n \n <h3 class=\"search-overlay__section-title\">Professors</h3>\n ${\n res.professors.length\n ? `\n <ul class=\"link-list min-list\">\n ${res.professors\n .map(item => {\n return `<li><a class=\"a-flex\" href=\"${item.link}\"><span>${\n item.title\n }</span>\n ${\n item.img\n ? `<img style=\"height:100px; width:35%; object-fit:cover;\" src=\"${item.img}\"> `\n : \"\"\n }\n </a>\n </li>`;\n })\n .join(\"\")}\n </ul>`\n : \"Nothing found On Professors\"\n }\n \n </div>\n\n <div class=\"one-third\">\n <h3 class=\"search-overlay__section-title\">Campuses</h3>\n ${\n res.campuses.length\n ? `\n <ul class=\"link-list min-list\">\n ${res.campuses\n .map(item => {\n return `<li><a class=\"a-flex\" href=\"${item.link}\"><span>${\n item.title\n }</span>\n ${\n item.img\n ? `<img style=\"height:100px; width:35%; object-fit:cover;\" src=\"${item.img}\"> `\n : \"\"\n }\n </a>\n </li>`;\n })\n .join(\"\")}\n </ul>`\n : \"Nothing found On Campuses\"\n }\n \n <h3 class=\"search-overlay__section-title\">Events</h3>\n ${\n res.events.length\n ? `\n <ul class=\"link-list min-list\">\n ${res.events\n .map(item => {\n return `<li><a class=\"a-flex\" href=\"${item.link}\"><span>${\n item.title\n }</span>\n ${\n item.img\n ? `<img style=\"height:100px; width:35%; object-fit:cover;\" src=\"${item.img}\"> `\n : \"\"\n }\n </a>\n </li>`;\n })\n .join(\"\")}\n </ul>`\n : \"Nothing found On Events\"\n }\n\n </div>\n\n </div>\n `);\n }\n );\n }", "function results_onCreate(gameId) {\n\tdocument.getElementById(\"resultsPage\").style.display = \"block\";\n\n\t// Clear the results\n\tdocument.getElementById(\"results_results\").innerHTML = \"\";\n\n\tconst resultsUrl = picTelUrl + \"/results?gameId=\" + gameId;\n\tgetJson(resultsUrl)\n\t.then((data) => {\n\t\tresults_show(data);\n\t});\n}", "function renderResults () {\n $('#my-quiz').addClass('hidden');\n $('#results').removeClass('hidden');\n $('.js-results-text').append('<h2>' + 'You got ' + correctAnswers + ' out of ' + questionsTotal + ' right! ' + '</h2>');//remove questions and progress and show results page\n}", "function displayUserResults() {\n state.userResults.forEach(function (item) {\n let htmlItem = $('.js-userResult.templ').clone();\n htmlItem.find('.js-name-title').append(`${item.firstName} ${item.lastName}`);\n htmlItem.find('.js-name').attr('uid', item._id);\n htmlItem.find('.js-name').attr('firstName', item.firstName);\n htmlItem.find('.js-username').append(`(${item.username})`);\n if (item.watchlist.length === 1) {\n htmlItem.find('.js-listCount').append(`${item.watchlist.length} item in their Watchlist.`);\n } else {\n htmlItem.find('.js-listCount').append(`${item.watchlist.length} items in their Watchlist.`);\n }\n htmlItem.removeClass('templ');\n $('.js-userResults-list').append(htmlItem);\n $('.js-userResults').removeClass('hidden');\n $('.js-userResults').show();\n });\n $('.js-noUsers').addClass('hidden');\n $('.js-watchlist').hide();\n $('.js-watchlist-results').html('');\n $('.results').hide();\n $('.js-results-container').html('');\n $('.js-returnButton').removeClass('hidden');\n $('.js-welcome').addClass('hidden');\n}", "function displayResults() {\n\tif (h2hSelectors.player1 && h2hSelectors.player2) {\n\t\tdocument.getElementById(\"h2hWrapper\").classList.remove(\"hidden\");\n\t\tdc.renderAll(\"matchUp\");\n\t}\n}", "function loadResults (data, source, savedUrlsArr) {\n var sourceId = '#' + source;\n\n // remove throbber\n $(sourceId + ' i').fadeOut();\n // remove previous search results\n $(sourceId + ' .row').remove(); // every result card\n $(sourceId + ' p').remove(); // 'show x more results...'\n\n // common elements to be created below\n var title = '';\n var excerpt = '';\n var url = '';\n\n var numOfResults = '';\n var numOfCards = '';\n // CONFIGURATION for each API integration\n if (source === 'wikipedia') {\n numOfResults = data[1].length;\n } else if (source === 'nyt') {\n numOfResults = data.response.docs.length;\n } else if (source === 'guardian') {\n numOfResults = data.response.results.length;\n }\n\n // limit results displayed based on user's max input\n if (numOfResults >= RESULTS_LIMIT) {\n numOfCards = RESULTS_LIMIT;\n } else {\n numOfCards = numOfResults;\n }\n\n // each loop creates and appends a result card to DOM\n for (var i = 0; i < numOfCards; i++) {\n // CONFIGURATION for each API integration\n // WIKIPEDIA\n if (source === 'wikipedia') {\n title = $('<h3>').text(data[1][i]);\n excerpt = $('<p>').text(data[2][i]);\n url = data[3][i];\n\n // NEW YORK TIMES\n } else if (source === 'nyt') {\n title = $('<h3>').text(data.response.docs[i].headline.main);\n excerpt = $('<p>').text(data.response.docs[i].snippet);\n url = data.response.docs[i].web_url;\n\n // THE GUARDIAN\n } else if (source === 'guardian') {\n title = $('<h3>').text(data.response.results[i].webTitle);\n excerpt = $('<p>').text('no excerpt available');\n url = data.response.results[i].webUrl;\n }\n\n // Note: No need to amend from here onwards - all works with various APIs\n // create html elements before appending to page\n var row = $('<div>').addClass('row');\n var col = $('<div>').addClass('col-sm-12 result-card');\n\n // click to launch BS Modal with relevant iframe\n var a = $('<a>').attr({\n 'url': url, // hidden data, value is set as iframe 'src' when modal is triggered\n 'data-toggle': 'modal',\n 'data-target': '.iframe-modal-lg',\n 'class': 'modal-trigger'\n });\n\n // create URL input field\n var inputGroup = $('<div>').addClass('input-group input-group-sm copy-url');\n var input = $('<input>').attr({\n onclick: 'this.select();',\n type: 'text',\n value: url,\n id: 'link-' + source + '-' + i\n }).addClass('form-control');\n var inputGroupBtns = $('<span>').addClass('input-group-btn');\n\n // --- create and modify star button (save url to backend) ---\n var starBtn = $('<button>').attr({\n 'type': 'button',\n 'url': url\n }).addClass('btn btn-default star-btn');\n var starGlyphicon = '';\n\n // check if user has saved url before\n if (isSavedBefore(url, savedUrlsArr)) {\n starGlyphicon = $('<span>').addClass('glyphicon glyphicon-star');\n starBtn.addClass('starred'); // indicate to frontend that it's starred\n } else if (!isSavedBefore(url, savedUrlsArr)) {\n starGlyphicon = $('<span>').addClass('glyphicon glyphicon-star-empty');\n }\n // nest glyph inside button\n starBtn.append(starGlyphicon);\n\n // --- create and modify COPY button (one click copy) ---\n var copyBtn = $('<button>').attr({\n type: 'button',\n 'data-clipboard-target': '#link-' + source + '-' + i\n }).addClass('clipboard btn btn-default');\n var copyGlyphicon = $('<span>').addClass('glyphicon glyphicon-copy');\n // nest glyph inside button\n copyBtn.append(copyGlyphicon);\n\n // --- create and modify GLOBE button (open in new tab) ---\n var globeBtn = $('<a>').attr({ // yes, it's a hack\n href: url,\n target: '_blank'\n }).addClass('btn btn-default');\n var globeGlyphicon = $('<span>').addClass('glyphicon glyphicon-globe');\n // nest glyph inside button\n globeBtn.append(globeGlyphicon);\n\n // APPEND ALL THE ABOVE TO PAGE\n a.append(title, excerpt);\n inputGroupBtns.append(copyBtn, globeBtn, starBtn);\n inputGroup.append(input, inputGroupBtns);\n col.append(a, inputGroup);\n row.append(col);\n\n // append card to page\n $(sourceId).append(row);\n\n // ============= Star Buttons click handler =============\n $(starBtn).on('click', function (ev) {\n // debugger;\n // url is obtained from 'url' attr of <a>\n var elem = $(this); // element handle\n var urlStr = $(elem).attr('url'); // string value\n\n if (!elem.hasClass('starred')) {\n // format: updateSavedUrls(method, route, data)\n updateSavedUrls('create', '/stars/update', urlStr);\n } else if (elem.hasClass('starred')) {\n // ajax DELETE to destroy matching entry in 'star' table in db\n updateSavedUrls('delete', '/stars/update', urlStr);\n }\n });\n } // -- end for loop --\n\n\n // ============= Modal click handler ==============\n // index.html contains modal with embedded iframe\n // main.js sets relevant 'src' of iframe when result card is clicked\n $('.modal-trigger').on('click', function (ev) {\n // url is obtained from 'url' attr of <a>\n var url = ev.currentTarget.attributes[0].value;\n // prevent re-load of the same content in modal\n if ($('iframe').attr('src') !== url) {\n $('iframe').attr('src', url);\n }\n });\n } // end loadResults", "function noResults() {\n var row = '<tr>' +\n '<td colspan=\"4\">' +\n '<p class=\"no-results\">No results!</p>' +\n '</td>' +\n '</tr>';\n $('#responder_results tbody').html(row);\n }", "function quickSearchResults_NoResultsDisplay() {\n $(\"#QuickSearchResultsListContainer_helm\").toggleClass(\"displayNone\", true);\n $(\"#QuickSearchNoResultsWrapper_helm\").toggleClass(\"displayNone\", false);\n }", "function renderPage(){\nif (userEntry.length > 0){\n apiCall(userEntry[0]);\n}\ninitializePastSearches();\n}", "function displayResults(locationData) {\n // If the ISS is above a body of water, the user is notified in the results-message\n if (ISSLocation.isWater) {\n $('#results-message').html(\n `<h3>The ISS ${tense} over the ocean or a body of water at this time, but it ${tense} ${locationData.distance}km away from* ${locationData.city}, ${locationData.country}</h3>\n <p class='small-text'>*and a few hundred kilometers above</p>`\n );\n }\n else {\n $('#results-message').html(\n `<h3>The ISS ${tense} ${locationData.distance}km away* from ${locationData.city}, ${locationData.country}</h3>\n <p class='small-text'>*and a few hundred kilometers above</p>`\n );\n }\n // Renders the image associated with the country from wikimedia\n $('#country-flag').attr('src', locationData.flagURL);\n $('#country-flag').attr('alt', `${locationData.country} flag`);\n // Renders country description from wikimedia\n $('#country-desc').text(locationData.description);\n // Renders a link for user to read more about the country on Wikipedia.org\n $('#content-link').attr('href', locationData.contentURL);\n // Reverts cursor back to default\n showCursorLoader(false);\n // Reveals the results\n showHide();\n // If user is on a mobile display, page will scroll to the results\n if (screen.width < 800) {\n scrollToResults();\n }\n}", "function displaySearchResults(results, store) {\n var searchResults = document.getElementById('search-results');\n\n if (results.length) { // Are there any results?\n var appendString = '';\n\n for (var i = 0; i < results.length; i++) { // Iterate over the results\n var item = store[results[i].ref];\n //Recreate card layout for each result item\n appendString += '<div class=\"col-md-4 col-sm-6 learning-item\">';\n appendString += '<picture class=\"intrinsic intrinsic-item\">';\n appendString += '<img class=\"img-responsive intrinsic-img\" src=\"' + item.siteURL + '/assets/images/resources/' + item.image + '\" alt=\"' + item.title + '\">';\n appendString += '</picture>';\n appendString += '<h2><a href=\"' + item.resourceUrl + '\" target=\"_blank\">' + item.title + '</a></h2>';\n appendString += '<p class=\"attribution\">';\n if ( item.resourceAuthor ) {\n appendString += item.resourceAuthor + ', ';\n }\n appendString += item.resourceOrg + '</p>';\n appendString += item.contentHTML;\n appendString += '<div class=\"labels pull-right\">';\n if (item.resourceType === \"Ebook\") {\n appendString += '<i class=\"glyphicon glyphicon-book\"></i> ';\n }\n if (item.resourceType === \"Course\") {\n appendString += '<i class=\"glyphicon glyphicon-blackboard\"></i> ';\n }\n if (item.resourceType === \"Email Course\") {\n appendString += '<i class=\"glyphicon glyphicon-send\"></i> ';\n }\n if (item.resourceType === \"Website\") {\n appendString += '<i class=\"glyphicon glyphicon-link\"></i> ';\n }\n if (item.resourceType === \"Podcast\") {\n appendString += '<i class=\"glyphicon glyphicon-headphones\"></i> ';\n }\n appendString += item.resourceType + ' | ';\n if (item.access === \"Requires Email\") {\n appendString += '<i class=\"glyphicon glyphicon-envelope\"></i> ';\n }\n if (item.access === \"Requires Registration\") {\n appendString += '<i class=\"glyphicon glyphicon-user\"></i> ';\n }\n if (item.access === \"Free\") {\n appendString += '<i class=\"glyphicon glyphicon-download-alt\"></i> ';\n }\n appendString += item.access + ' </div>';\n appendString += '<div class=\"post-sharing pull-right\">';\n var learningItemURL = \"https://hackid.github.io%23\" + item.learningItemID;\n appendString += '<a href=\"https://twitter.com/share?url=' + learningItemURL + '&via=anthkris&hashtags=hackidlearning&text=' + item.title + ' free ' + item.resourceType + '\" target=\"_blank\">';\n appendString += '<img src=\"' + item.siteURL +'/assets/images/twitter-logo.svg\" class=\"social-logo\"/></a>';\n appendString += '<a href=\"https://plus.google.com/share?url=' + learningItemURL + '&title=' + item.title + ' free ' + item.resourceType + '\" target=\"_blank\">';\n appendString += '<img src=\"' + item.siteURL + '/assets/images/google-plus.svg\" class=\"social-logo\"/></a></div>';\n appendString += '<a href=\"' + item.resourceUrl + '\" target=\"_blank\" class=\"button view-button\">View</a>';\n appendString += '</div>';\n }\n\n searchResults.innerHTML = appendString;\n } else {\n searchResults.innerHTML = '<div class=\"col-xs-12\"><p class=\"no-results\">No results found.<br /><a href=\"https://docs.google.com/forms/d/e/1FAIpQLSe-Vw60TcOyTjd_FgTLD7eZ_fPwYTXsUWWNZEN1NrLTPK-qKA/viewform\" target=\"_blank\">Try submitting a resource on this topic!</a></p></div>';\n }\n }", "async function controlResults(){\n tv = await constructRequest(\"tv\", searchQuery);\n // // console.log(tv);\n movies = await constructRequest(\"movie\", searchQuery);\n // // console.log(movies);\n people = await constructRequest(\"person\", searchQuery);\n // // console.log(people);\n collections = await constructRequest(\"collection\", searchQuery);\n // // console.log(collections);\n\n var topList;\n \n if(tv.results.length && movies.results.length) topList = tv.results[0].vote_average > movies.results[0].vote_average? \"tv\" : \"movies\";\n else topList = tv.results.length? \"tv\" : \"movies\";\n\n constructOptionList(topList, \n [\n {name: \"TV Shows\", number: tv.total_results, list: tv}, \n {name: \"Movies\", number: movies.total_results, list: movies}, \n {name: \"People\", number: people.total_results, list: people}, \n {name: \"Collections\", number: collections.total_results, list: collections}\n ]);\n\n if(topList == \"tv\") {\n currentList = tv;\n currentType = \"TV Shows\";\n controlContentList(\"TV Shows\");\n }\n else {\n currentList = movies;\n currentType = \"Movies\";\n controlContentList(\"Movies\");\n }\n}", "function displayResults( query, results ){\n\t\t\n\t\tif(results.rows.length == 0) {\n\t\t\tconsole.log(\"failed\");\n\t\t\talert(\"Failed\");\n\t\t\twindow.location.href = \"index.html\";\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\tconsole.log(\"Login Successful\");\n\t\t\talert(\"Login Successful\");\n\t\t\twindow.location.href = \"setprofile.html\";\n\t\t\t\n\t\t}\n}", "function renderResults(){\n console.log(results)\n}", "function clearOutPutDataToHTML() {\n STATE.searchResult = [];\n render();\n}", "function renderResultsPage(results) {\n\t$(\".js-question_page\").hide();\n\t$(\".js-results_page\").show();\n\trenderResults(results);\n\thandleRestartButtonClicked()\n\tif (results == 10) {\n\t\treturn $('.js-message').html(`Congratulations! You are a Science Nerd!`);\n\t} else if (results < 10 && results > 6) {\n\t\treturn $('.js-message').html(`Way to go, you are a science buff. Try again for nerd status!`);\n\t} else if (results == 6) {\n\t\treturn $('.js-message').html(`Cool! You know some science but you're no nerd. Try again!`);\n\t} else if (results == 5) {\n\t\treturn $('.js-message').html(`Not bad, but not too good either. Try Again.`);\n\t} else {\n\t\treturn $('.js-message').html(`Science seems to have escaped you. Hope you find it soon!`);\n\t}\n}", "function getResults() {\n document.location.href = \"./SpecificResults.html\"\n}", "function resetSearchResults () {\n [].slice.call(\n _results.getElementsByTagName('a')\n ).forEach(function (result) {\n result.parentNode.removeChild(result);\n });\n _results.setAttribute('aria-hidden', 'true');\n _results.setAttribute('hidden', '');\n _root.removeAttribute('data-displayresults');\n }", "function displayResults(gists) {\n var resultsDiv = document.getElementById(\"results\");\n for (var i = 0; i < gists.length; i++) {\n var url = gists[i].html_url;\n var desc = gists[i].description;\n if (desc === null || desc === \"\") {\n desc = \"Untitled\";\n }\n resultsDiv.appendChild(createResultElement(url, desc, true));\n }\n}", "function displaySearchResults(results) {\n // Hide the spinner.\n spinner.style.display = \"none\";\n\n if (results.length) {\n // Group the results by category.\n var categoryMap = {};\n for (var i = 0; i < results.length; i++) {\n var result = results[i];\n var categoryName = getCategoryName(result.url);\n var category = categoryMap[categoryName] = categoryMap[categoryName] || [];\n prepareResult(result, categoryName);\n category.push(result);\n }\n\n // Build up the HTML to display.\n var appendString = \"\";\n for (var i = 0; i < categories.length; i++) {\n var categoryName = categories[i].name;\n var category = categoryMap[categoryName];\n if (category && category.length > 0) {\n appendString += buildCategoryString(categoryName, category);\n }\n }\n searchResultsContainer.innerHTML = appendString;\n } else {\n searchResultsContainer.innerHTML = \"<p>No results found.</p>\";\n }\n }", "function clearLoaderShowResults() {\n loader.style.display = \"none\";\n results.style.display = \"block\";\n}", "function showResults() {\t\n\t//prepare DOM to show results\t\t\t\t\t\t\t\t\t\n\tdocument.getElementById(\"empty-state\").style.display = 'none';\n\tdocument.getElementById(\"titlResult\").style.display = 'block';\n\tdocument.getElementById(\"numFoundTit\").style.display = 'block';\n\tdocument.getElementById(\"focusButton\").style.display = 'block';\n\t\t\t\t\t\n\t//load arrays from localStorage and from API\n\t//var filters = allFiltersT;\n\tvar filtersT = JSON.parse(window.localStorage.getItem('allFiltersT'));\n\tvar filtersO = JSON.parse(window.localStorage.getItem('allFiltersO'));\n\tvar filtersS = JSON.parse(window.localStorage.getItem('allFiltersS'));\n\t\t\t\t\t\n\t// generate different HTML elements to create the results list\n\t// iterative building of each result box\n\tvar resultDiv = document.getElementById(\"resultList\"); //define main results wrapper\n\n\tpageTitle.innerHTML += \"'\"+keyWord+\"'\"; //create title\n\n\t//count results\n\tvar resultsNum = 0;\n\n\t// CREATE RESULT ITEMS\n\tfor (var i = 0; i < results.length; i++) { //iterate results array\n\n\t\t//Verify existing filters and skip loop if filter is present in result item\n\t\t//This component filters results vs checkboxes\n\t\tif (filtersT[0] != \"cbTopicAll\") {\n\t\t\tfor (let y = 0; y < filtersT.length; ++y) {\n\t\t\t\tvar filterTopic = filtersT[y].match(/(\\d+)/); //extract the number\n\t\t\t\tvar topicX = results[i].item.topic;\n\t\t\t\tfor (let x = 0; x < topicX.length; ++x) {\n\t\t\t\t\tvar found = 0;\n\t\t\t\t\tif (topicX[x].topic_id === filterTopic[0]) {\n\t\t\t\t\t\tvar found = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (found === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (found === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Verify existing filters and skip loop if filter is present in result item\n\t\t//This component filters results vs checkboxes\n\t\tif (filtersO[0] != \"cbOdsAll\") {\n\t\t\tfor (let y = 0; y < filtersO.length; ++y) {\n\t\t\t\tvar filterOds = filtersO[y].match(/(\\d+)/); //extract the number\n\t\t\t\tvar odsX = results[i].item.ods;\n\t\t\t\tfor (let x = 0; x < odsX.length; ++x) {\n\t\t\t\t\tvar found = 0;\n\t\t\t\t\tif (odsX[x].ods_id === filterOds[0]) {\n\t\t\t\t\t\tvar found = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (found === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (found === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Verify existing filters and skip loop if filter is present in result item\n\t\t//This component filters results vs checkboxes\n\t\tif (filtersS[0] != \"cbSesAll\") {\n\t\t\tfor (let y = 0; y < filtersS.length; ++y) {\n\t\t\t\tvar filterSes = filtersS[y].match(/(\\d+)/); //extract the number\n\t\t\t\tvar sesX = results[i].item.session;\n\t\t\t\tvar found = 0;\n\t\t\t\tif (sesX === filterSes[0]) {\n\t\t\t\t\tvar found = 1;\n\t\t\t\t}\n\t\t\t\tif (found === 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (found === 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\t\t\t\t\t\t\n\t\t// Create HTML result box elements\n\t\tvar recomWrap = document.createElement(\"div\");\n\t\tvar recomSession = document.createElement(\"span\");\n\t\tvar recomDesc1 = document.createElement(\"p\"); //description part 1\n\t\tvar recomDesc2 = document.createElement(\"span\"); //description part 2\n\t\tvar recomDescLink = document.createElement(\"a\");\n\t\tvar recomH3SubtTop = document.createElement(\"h3\");\n\t\tvar recomWrapTopic = document.createElement(\"div\");\n\t\tvar recomH3SubtODS = document.createElement(\"h3\");\n\t\tvar recomWrapODS = document.createElement(\"div\");\n\t\tvar recomTit = document.createElement(\"h2\"); //create h2 title\n\t\tvar recomTitLink = document.createElement('a'); //create link (a) title\n\t\t\n\t\t// Define values before inserting into box elements\n\t\t// vRecomDesc pulls the recomendation from the results array (Fuse)\n\t\t// topicArray is an array created from the topic_ids, turning a string into an \n\t\t// array the separated by comma [1,2,3]\n\t\t// vRecomDesc1 & vRecomDesc2 is recomm description in 2 parts to create later \n\t\t// the \"view more\" link\n\t\t// odsArray, the same as topicArray\n\t\tvar vRecomTit = \"Recommendation \"+results[i].item.session+\".\"+results[i].item.paragraph+\": \"+results[i].item.title.title_recommendation_en+\" »\"; \n\t\tvar vRecomSession = \"Session #\"+results[i].item.session+\" (\"+results[i].item.year+\")\";\n\t\tvar vRecomDesc = results[i].item.title.recommendation_en;\n\t\tvar vRecomDesc1 = vRecomDesc.slice(0, 370); //part 1 description of 370 chars\n\t\tvar vRecomDesc2 = vRecomDesc.slice(370, 5000); // part 2\n\t\tvar vRecomH3SubtTop = \"Topic\";\n\t\tvar vRecomH3SubtODS = \"SDG\";\n\t\t\n\t\t// Build Recommendation link to detail page\n\t\t// Here is when the individual recommendation link is created\n\t\trecomTit.innerHTML = vRecomTit; //insert text in h2\n\t\trecomTitLink.setAttribute(\"class\", \"recom-title\"); //add class to link (a)\n\t\trecomTitLink.appendChild(recomTit); // insert h2 in link (a)\n\t\trecomTitLink.href = \"recomm_detail-en.htm?rcm=\"+results[i].item.id; //insert href in (a)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t// Insert values in HTML elements\n\t\trecomSession.innerHTML = vRecomSession; //insert session in span\n\t\trecomH3SubtTop.innerHTML = vRecomH3SubtTop; // insert Topic subtitle in h3 \n\t\trecomH3SubtODS.innerHTML = vRecomH3SubtODS; // insert ODS subtitle in h3\n\t\trecomDesc1.innerHTML = vRecomDesc1; // insert description part1 (p)\n\t\trecomDesc2.innerHTML = vRecomDesc2; // insert description part2 (span)\n\t\t\t\t\t\t\t\n\t\t// Build link of session\n\t\tvar sessionLink = document.createElement('a'); //create link (a) session\n\t\tsessionLink.setAttribute(\"class\", \"miniButton\"); //add class to span\n\t\tsessionLink.appendChild(recomSession); // insert span in link\n\t\tsessionLink.href = \"cluster-en.htm?type=session&id=\"+results[i].item.year;\n\t\t//insert href in topic link\n\t\n\t\t// Build recommendation description with link \"view more\"\n\t\t// Verify if description usses the part 2, otherwise don't insert link \"view more\"\n\t\tjavascriptText = \"document.getElementById('descrip\"+i+\"').style.display = 'inline';document.getElementById('vermas\"+i+\"').style.display = 'none'\"; // build javascript to insert in a\n\t\trecomDescLink.href = \"javascript:void(0);\"; //insert href into a with JS to avoid scroll\n\t\trecomDescLink.setAttribute(\"onclick\", javascriptText); //insert onclick into a\n\t\trecomDescLink.innerHTML = \"(..view more)\"; // insert text in link\n\t\trecomDescLink.setAttribute(\"id\", \"vermas\"+i); //add id to link\n\t\trecomDesc1.appendChild(recomDesc2); // insert span in p (description)\n\t\tif (vRecomDesc2 != \"\") { //verify if description part 2 is not empty\n\t\t\trecomDesc1.appendChild(recomDescLink); // then insert a in p\n\t\t}\n\t\trecomDesc2.setAttribute(\"style\", \"display:none\"); //add hidden style\n\t\trecomDesc2.setAttribute(\"id\", \"descrip\"+i); //add hidden style\n\t\t\t\t\t\t\t\n\t\t// Build topics list\n\t\t// Iterates topics *1*\n\t\t// Creates individual links\n\t\tif (results[i].item.topic.length != 0) { // if topics is empty\n\t\t\tfor (let x = 0; x < results[i].item.topic.length; ++x) { // loop - number of topics\n\t\t\t\tvar recomTopic = document.createElement(\"span\"); //create span\n\t\t\t\tvar topicLink = document.createElement('a'); //create link (a) topics\n\t\t\t\t//find and pick a topic regarding the topic_id\n\t\t\t\trecomTopic.innerHTML = results[i].item.topic[x].topic_en; //insert topic in span\n\t\t\t\ttopicLink.setAttribute(\"class\", \"miniButton\"); //add class to span\n\t\t\t\ttopicLink.appendChild(recomTopic); // insert span into link\n\t\t\t\ttopicLink.href = \"cluster-en.htm?type=topic&id=\"+results[i].item.topic[x].topic_id;\n\t\t\t\t//insert href into topic link\n\t\t\t\trecomWrapTopic.appendChild(topicLink); //append span in div wrapper\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Build ODS list\n\t\t// Iterates ods *2*\n\t\t// Creates individual links\n\t\t// Create individual classes for color purposes\n\t\tif (results[i].item.ods.length != 0) { // if ods is empty\n\t\t\tfor (let x = 0; x < (results[i].item.ods).length; ++x) { // loop -number of ods\n\t\t\t\tvar recomODS = document.createElement(\"span\");\n\t\t\t\tvar odsLink = document.createElement('a'); //create link (a) odss\n\t\t\t\t//find and pick a ods in the loop\n\t\t\t\trecomODS.innerHTML = results[i].item.ods[x].ods_en; //insert ods in span\n\t\t\t\t// put color on ODS\n\t\t\t\tvar n_id = results[i].item.ods[x].ods_id;\n\t\t\t\tif (n_id === \"1\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-1\"); //add class\n\t\t\t\t} else if (n_id === \"2\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-2\");\n\t\t\t\t} else if (n_id === \"3\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-3\");\n\t\t\t\t} else if (n_id === \"4\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-4\");\n\t\t\t\t} else if (n_id === \"5\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-5\");\n\t\t\t\t} else if (n_id === \"6\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-6\");\n\t\t\t\t} else if (n_id === \"7\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-7\");\n\t\t\t\t} else if (n_id === \"8\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-8\");\n\t\t\t\t} else if (n_id === \"9\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-9\");\n\t\t\t\t} else if (n_id === \"10\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-10\");\n\t\t\t\t} else if (n_id === \"11\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-11\");\n\t\t\t\t} else if (n_id === \"12\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-12\");\n\t\t\t\t} else if (n_id === \"13\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-13\");\n\t\t\t\t} else if (n_id === \"14\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-14\");\n\t\t\t\t} else if (n_id === \"15\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-15\");\n\t\t\t\t} else if (n_id === \"16\") {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-16\");\n\t\t\t\t} else {\n\t\t\t\t\todsLink.setAttribute(\"class\", \"miniButton color-ods-17\");\n\t\t\t\t}\n\t\t\t\todsLink.appendChild(recomODS); // insert span in link\n\t\t\t\todsLink.href = \"cluster-en.htm?type=ods&id=\"+n_id; //insert href in ods link\n\t\t\t\trecomWrapODS.appendChild(odsLink); //append span in div wrapper\n\t\t\t}\n\t\t}\n\t\t// Build individual recommendation boxes\n\t\trecomWrap.setAttribute(\"class\", \"recomWrap\");\n\t\tresultDiv.appendChild(recomWrap);\n\t\trecomWrap.appendChild(recomTitLink);\n\t\trecomWrap.appendChild(sessionLink);\n\t\trecomWrap.appendChild(recomDesc1);\n\t\tif (results[i].item.topic.length != 0) {\n\t\t\trecomWrap.appendChild(recomH3SubtTop);\n\t\t\trecomWrap.appendChild(recomWrapTopic);\n\t\t}\n\t\tif (results[i].item.ods.length != 0) {\n\t\t\trecomWrap.appendChild(recomH3SubtODS);\n\t\t\trecomWrap.appendChild(recomWrapODS);\n\t\t}\n\t\t//calc number of results\n\t\tvar resultsNum = resultsNum + 1;\n\t}\n\n\t//insert number of results\n\tdocument.getElementById(\"numFound\").innerHTML = resultsNum;\n\t//if results is empty\n\tif (resultsNum === 0) {\n\t\tdocument.getElementById(\"empty-state\").style.display = 'block';\n\t\tdocument.getElementById(\"titlResult\").style.display = 'none';\n\t\tdocument.getElementById(\"numFoundTit\").style.display = 'none';\n\t\tdocument.getElementById(\"focusButton\").style.display = 'none';\n\t}\n}", "function displaySearchResults(response, search) {\n var user_finder = new RegExp(search, 'i'),\n results_string = \"\",\n i,\n j;\n\n if(globe.getID(0)) {\n removeLink();\n }\n\n if (globe.search_type_name.checked) {\n for (i = 0; i < response.length; i += 1) {\n if (user_finder.test(response[i].toMake)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].toMake + \"</p>\";\n globe.addID(i.toString());\n }\n }\n } else {\n for (i = 0; i < response.length; i += 1) {\n for (j = 0; j < response[i].ingredients.length; j += 1) {\n if (user_finder.test(response[i].ingredients[j].ingredient)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].ingredients[j].ingredient + \"</p>\";\n globe.addID(i.toString());\n break;\n }\n }\n }\n }\n\n globe.hint_span.innerHTML = \"\";\n if (results_string === \"\") {\n results_string = \"<span>No results.</span>\";\n }\n globe.results_div.innerHTML = results_string;\n \n if (globe.getID(0)) {\n createLink();\n }\n}", "function parse(result){\n\tvar parsed = JSON.parse(result);\n\t\n\t//Handle basically all the errors (sorta)\n\tif(Object.keys(parsed.collection.items).length == 0)\n\t{\n\t\tdocument.getElementById('numbers').innerHTML = \"No Results Found!\";\n\t\tvar loading = document.getElementById('loading');\n\t\tloading.style.display = \"none\";\n\t\treturn;\n\t}\n\t//alert(parsed);\n\tvar total = parsed.collection.metadata.total_hits;\n\t//document.getElementById('numbers').innerHTML = result;\n\t\n\tvar url_string = window.location.href\n\tvar url = new URL(url_string);\n\tvar search_val = url.searchParams.get(\"q\");\n\tvar page_num = url.searchParams.get(\"page\");\n\t\n\t//Set the proper number of images heading\n\tif((page_num*100) < total)\n\t{\n\t\tdocument.getElementById('numbers').innerHTML = String(1+(page_num-1)*100)+\"-\"+String(page_num*100) + \" of \" + String(total) + \" for \\\"\" + search_val + \"\\\":\";\n\t}\n\telse{\n\t\tdocument.getElementById('numbers').innerHTML = String(1+(page_num-1)*100)+\"-\"+String(total) + \" of \" + String(total) + \" for \\\"\" + search_val + \"\\\":\";\n\t}\n\tvar pictures = parsed.collection.items;\n\t\n\t//Call support function to display all the results in the grid\n\tdisplay_images(pictures);\n\t\n\t//Properly setup the next and previous buttons on the page depending on the situation\n\tvar size = Object.keys(parsed.collection.links).length;\n\tif(size == 2){\n\t\tvar next_url = parsed.collection.links[1].href;\n\t\tvar previous_url = parsed.collection.links[0].href;\n\t\t\n\t\tvar params = previous_url.split(\"?\")[1];\n\t\tpreviousurl = \"search.html?\" + String(params);\n\t\tparams = next_url.split(\"?\")[1];\n\t\tnexturl = \"search.html?\" + String(params);\n\t\t\n\t\tdocument.getElementById('previous').style.display = \"block\";\n\t\tdocument.getElementById('next').style.display = \"block\";\n\t}\n\tif(size == 1 && parsed.collection.links[0][\"prompt\"] == \"Next\"){\n\t\tvar next_url = parsed.collection.links[0].href;\n\t\tvar params = next_url.split(\"?\")[1];\n\t\tnexturl = \"search.html?\" + String(params);\t\n\t\tdocument.getElementById('next').style.display = \"block\";\n\t}\n\telse if(size == 1)\n\t{\n\t\tvar next_url = parsed.collection.links[0].href;\n\t\tvar params = next_url.split(\"?\")[1];\n\t\tpreviousurl = \"search.html?\" + String(params);\t\n\t\tdocument.getElementById('previous').style.display = \"block\";\t\t\n\t}\n\t\n}", "function DisplayResult(){\n\tanswers = answers.filter(function(e){return e});\n\t$(\"#content\").html('');\n\t$(\"#content\").append(\"<div class='page-header'><h1>\"+Language[\"Analysis\"]+\"</h1></div>\");\n\t$(\"#content\").append(\"<ul id='answerpanel'></ul>\");\n\tvar noAnswersGiven = 0;\n\tfor (var i = 0; i < answers.length;i++){\n\t\tvar text = \"\";\n\t\tif (answers[i].SelectedAnswer == null){\n\t\t\ttext =\"<b>\"+Language[\"NoAnswer\"]+\"</b>\";\n\t\t\tnoAnswersGiven++;\n\t\t}else\n\t\t\ttext = answers[i].SelectedAnswer.Text;\n\t\t$(\"#answerpanel\").append(\"<li>\"+answers[i].Question+\": \" + text+ \"</li>\");\n\t}\t\n\t\n\tif (noAnswersGiven == answers.length){\n\t\t$(\"#content\").append(\"<div class=\\\"alert alert-danger\\\" role=\\\"alert\\\">\"+Language[\"NoAnswersWarning\"]+\"</div\");\n\t}\n\t$(\"#content\").append(\"<a id =\\\"backToLastQuestion\\\" class='btn btn-primary btn-lg' role='button'>Zurück</a>\");\n\t$(\"#backToLastQuestion\").click(function(){\n\t\t$(\"#answerpanel\").fadeOut(function(){\n\t\t\t\t$(\"#answerpanel\").remove();\n\t\t\t\t$(\"#content\").append(\"<div id='answerpanel'></div>\"); \t\t\t\t\n\t\t\t\tLoadQuestion(--lastAnsweredQuestion.Id);\t\n \t\t});\n\t});\n\tif (noAnswersGiven != answers.length)\n\t$(\"#content\").append(\"<a id='showDistros' class='btn btn-success btn-lg' role='button'>\"+Language[\"ShowResults\"]+\"</a>\");\n\t$(\"#showDistros\").click(function(){\n\t\tLoadDistributionByAnswer();\n\t});\n}", "function displayResults() {\n\n $(\"#time\").hide();\n $(\"#question1\").hide();\n $(\"#answer1\").hide();\n $(\"#question2\").hide();\n $(\"#answer2\").hide();\n $(\"#question3\").hide();\n $(\"#answer3\").hide();\n $(\"#question4\").hide();\n $(\"#answer4\").hide();\n $(\"#question5\").hide();\n $(\"#answer5\").hide();\n $(\"#question6\").hide();\n $(\"#answer6\").hide();\n $(\"#question7\").hide();\n $(\"#answer7\").hide();\n $(\"#question8\").hide();\n $(\"#answer8\").hide();\n $(\"#question9\").hide();\n $(\"#answer9\").hide();\n $(\"#question10\").hide();\n $(\"#answer10\").hide();\n $(\"#submit\").hide();\n\n $(\"#results\").html(\"<h3>All Done!</h3>\");\n $(\"#correct\").html(\"Correct!: \" + correctAnswers);\n $(\"#incorrect\").html(\"Incorrect: \" + incorrectAnswers);\n $(\"#unanswered\").html(\"Unanswered: \" + unanswered);\n}", "function results (){\n $('#timer').empty();\n $('#prompt').empty();\n $('#fixedAns').empty();\n $('#category').empty();\n //if adding images, empty the image div\n\n $('#resultPrompt').html(prompt.quizEnd);\n //show counters\n $('#correctAns').html(\"You nailed \" + correctAns + \" question(s)!\");\n $('#wrongAns').html(\"But missed \" + wrongAns + \" question(s)!\");\n $('#noAns').html(\"And finally, ran out of time on \" + noAns + \" question(s)!\");\n $('#reset').show();\n $('#reset').html('Play Again?');\n}", "function displayResults() {\n const results = $(\"<div>\");\n \n //If there were no results, display a message\n if(venues.length === 0) {\n results.addClass(\"results__no-result-text\");\n results.append(document.createTextNode(\"No results found.\"));\n }\n //Otherwise display the results\n else { \n results.addClass(\"results__detail\");\n \n for(const venue of venues) {\n const venueObject = Venue(venue.name, venue.location.address, venue.location.postalCode, venue.location.city); \n \n //Create a div for the individual venue\n const venue_div = $(\"<div>\", {\"class\": \"results__result\"});\n \n //Create a div for the venue name and append it to the venue div\n const venue_name = $(\"<div>\", {\"class\": \"result__header\"});\n venue_name.text(venueObject.getName());\n venue_div.append(venue_name);\n \n //Append the text of the address and phone number to the venue div\n const venue_details = $(\"<div>\", {\"class\": \"result__details\"});\n venue_details.html(venueObject.getAddressString());\n venue_div.append(venue_details);\n \n //Append the venue div to the container results div\n results.append(venue_div);\n }\n }\n //Append the full list of results to the DOM\n $(\".results\").append(results);\n \n }", "function displaySearchResults(query, results, data) {\n\t$('.content').empty();\n\t\n\t// Hides OR shows and sets results summary\n\tif (query == \"\") {\n\t\t$('.summary-wrapper').hide();\n\t}\n\telse {\n\t\t$('.summary-wrapper').show();\n\t\t$('#numresults').text(results.length);\n\t\tif (results.length == 1) {\n\t\t\t$('#results-plural').text('');\n\t\t}\n\t\telse {\n\t\t\t$('#results-plural').text('s');\n\t\t}\n\t}\n\n\tif (results.length) {\n\t\tfor (var i = 0; i < results.length; i++) {\n\t\t\tif (query == \"\")\n\t\t\t\titem = data[i]; // empty query --> show all results\n\t\t\telse\n\t\t\t\titem = data[results[i].ref]; // show query results\n\n\t\t\tvar rockList, hhList, electronicList, otherList;\n\t\t\trockList = \"\";\n\t\t\thhList = \"\";\n\t\t\telectronicList = \"\";\n\t\t\totherList = \"\";\n\n\t\t\titem['rock-artists'].forEach(function(artist) {\n\t\t\t\trockList += \"<li>\" + artist + \"</li>\";\n\t\t\t});\n\t\t\titem['hh-artists'].forEach(function(artist) {\n\t\t\t\thhList += \"<li>\" + artist + \"</li>\";\n\t\t\t});\n\t\t\titem['electronic-artists'].forEach(function(artist) {\n\t\t\t\telectronicList += \"<li>\" + artist + \"</li>\";\n\t\t\t});\n\t\t\titem['other-artists'].forEach(function(artist) {\n\t\t\t\totherList += \"<li>\" + artist + \"</li>\";\n\t\t\t});\n\n\t\t\tvar image = '<div class=\"image\"><img src=\"images/' + item.image.url + '\" alt=\"' + item.title + '\"></div>';\n\t\t\tvar title = '<div class=\"title\"><a href=\"' + item.url + '\">' + item.title + '</a></div>';\n\t\t\tvar date = '<div class=\"date\">' + item.date + '</div>';\n\t\t\tvar location = '<div class=\"location\">' + item.location + '</div>';\n\t\t\tvar artistGroup = '<div class=\"artists-container\">';\n\n\t\t\tif (rockList !== \"\")\n\t\t\t\tartistGroup += '<div class=\"artists col1\"><p class=\"heading\">Rock</p><ul class=\"list rock-artists\">' + rockList + '</ul></div>';\n\t\t\tif (hhList !== \"\")\n\t\t\t\tartistGroup += '<div class=\"artists col2\"><p class=\"heading\">Hip-Hop</p><ul class=\"list hh-artists\">' + hhList + '</ul></div>';\n\t\t\tif (electronicList !== \"\")\n\t\t\t\tartistGroup += '<div class=\"artists col3\"><p class=\"heading\">Electronic</p><ul class=\"list electronic-artists\">' + electronicList + '</ul></div>';\n\t\t\tif (otherList !== \"\")\n\t\t\t\tartistGroup += '<div class=\"artists col4\"><p class=\"heading\">Everything Else</p><ul class=\"list other-artists\">' + otherList + '</ul></div>'\n\t\t\tartistGroup += '</div><div class=\"toggle\">+ Show More</div>';\n\t\t\tartistGroup += '<a class=\"attribution\" target=\"_blank\" href=\"' + item.image.source + '\">' + item.image.author + '</a>';\n\n\t\t\tvar container = '<section>' + image + '<div class=\"card\">' + title + date + location + artistGroup + '</div></section>';\n\t\t\t$('.content').append(container);\n\t\t}\n\t}\n\n\t// Use mark.js to add span.higlight around search terms\n\t$(\".artists-container\").mark(query, {\n\t \"element\": \"span\",\n\t \"className\": \"highlight\",\n\t \"accuracy\": \"exactly\"\n\t});\n}", "function handleResults(results){ctrl.matches=results;ctrl.hidden=shouldHide();// If loading is in progress, then we'll end the progress. This is needed for example,\n\t// when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.\n\tif(ctrl.loading)setLoading(false);if($scope.selectOnMatch)selectItemOnMatch();updateMessages();positionDropdown();}", "function resetSearchResult() {\r\n $('.show-results p.risultati').addClass('hidden');\r\n\r\n $('.movies .results-number').text('');\r\n $('.show-results .container.movies-results').html('');\r\n\r\n $('.tv-series .results-number').text('');\r\n $('.show-results .container.tv-series-results').html('');\r\n\r\n}", "function analyzeResults() {\n loadResults(function(results) {\n var sadCount = results.slice(0,5).filter(function(item) {\n return item.result == \"sad\";\n }).length;\n\n console.log(\"sadCount: \" + sadCount);\n\n if (sadCount >= 5) {\n selectPage(\"call-help-page\");\n }\n });\n}", "function showResults(results) {\n\t\tvar ul = document.getElementById(\"matchResultsList\");\n\t\tclearResultsList(ul);\n\t\tvar frag = document.createDocumentFragment();\n\t\tfor (var i = 0; i < results.length; i++) {\n\t\t\tvar li = document.createElement(\"li\");\n\t\t\tli.innerHTML = results[i];\n\t\t\tfrag.appendChild(li);\n\t\t}\n\t\tul.appendChild(frag);\n\t}", "function displayResults() {\n $.ajax({\n type: 'POST',\n url: 'responder_search.php',\n dataType: 'json',\n success: function (data) {\n _results = data;\n _redrawTable();\n },\n error: function (XMLHttpRequest, textStatus, errorThrown) {\n alert('Error. Check the console for more details.');\n console.log(XMLHttpRequest);\n console.log(textStatus);\n console.log(errorThrown);\n }\n });\n }", "function results() {\n\t//hide modal if the user just finished the survey\n\tlet active_modal = document.getElementById(\"modal\"+step);\n\tif(active_modal != null) active_modal.style.display = 'none';\n\t//generate the results\n\tdocument.body.innerHTML += results_html;\n\tlet table = getEl('results').getElementsByTagName('th');\n\ttable[0].innerHTML = 'Name';\n\ttable[1].innerHTML = name;\n\ttable[2].innerHTML = 'E-mail';\n\ttable[3].innerHTML = email;\n\ttable[4].innerHTML = 'Age';\n\ttable[5].innerHTML = age;\n\ttable[6].innerHTML = 'About me';\n\ttable[7].innerHTML = aboutme;\n\ttable[8].innerHTML = 'Address';\n\ttable[9].innerHTML = address;\n\ttable[10].innerHTML = 'Gender';\n\ttable[11].innerHTML = gender;\n\ttable[12].innerHTML = 'Favourite book';\n\ttable[13].innerHTML = favbook;\n\ttable[14].innerHTML = 'Favourite colours';\n\ttable[15].innerHTML = favcolors;\n}", "function display_results (results) {\n\n var result_count = Object.keys(results).length;\n var result_term = \"result\";\n if (!result_count) {\n no_results();\n result_count = 0;\n $(\"#search_count\").html(result_count + \" \" + result_term);\n $(\"#search_count\").show();\n $(\"#search_help_container\").removeClass();\n $('#step_info_container').hide();\n return;\n }\n else if (result_count > 0) {\n $(\"#search_msg\").hide();\n $(\"#search_msg\").html();\n $(\"#search_result_container\").show();\n\n if (result_count > 1) {\n result_term += \"s\";\n }\n\n $(\"#search_count\").html(result_count + \" \" + result_term);\n $(\"#search_count\").show();\n table_tbody.empty();\n $(\"#search_help_container\").removeClass();\n\n var step_info = $('#step_info_container');\n\n // Sort the results by LRG ID (using the numeric part of the LRG ID)\n var result_keys = Object.keys(results);\n result_keys.sort(function(a,b) {\n //var id_a = extract_id(a);\n //var id_b = extract_id(b);\n //return id_a - id_b;\n return a - b;\n });\n\n var link_separator = '<span>-</span>';\n\n var has_lrg_pending = 0;\n\n var lrg_list = [];\n\n var rows_list = [];\n\n // Loop over results\n for (var i=0; i < result_keys.length; i++) {\n var lrg_id = result_keys[i]; // Only numeric value, e.g. \"1\" for \"LRG_1\"\n var entry = results[lrg_id];\n var symbol = entry.symbol;\n var status = entry.status;\n var chr = entry.c[0];\n var start = entry.c[1];\n var end = entry.c[2];\n //var id = lrg_id;//extract_id(lrg_id);\n\n var ens_link = generate_external_link('Ensembl','ens',1);\n var ncbi_link = generate_external_link('NCBI','ncbi',1);\n var ucsc_link = generate_external_link('UCSC','ucsc',1);\n\n var curation_id = lrg_id.toLowerCase();\n\n // Step class\n var step_classes = step_col_class + ' ';\n step_classes += (status == 'public') ? public_step_col_class : pending_step_col_class;\n\n var curation_desc_cell = newCell().attr('id', curation_id+'_step');\n curation_desc_cell.addClass(step_classes);\n\n var curation_date_cell = newCell('-').attr('id', curation_id+\"_date\");\n curation_date_cell.addClass(step_col_class);\n\n if (status == 'public') {\n curation_desc_cell.attr('sorttable_key', lrg_steps_count);\n }\n else {\n lrg_list.push(lrg_id);\n\n if (has_lrg_pending == 0) {\n has_lrg_pending = 1;\n step_info.show(400);\n }\n }\n\n // HTML code\n var newrow = $('<tr/>');\n newrow.attr('id', lrg_row_id_prefix+lrg_id);\n newrow.attr('data-chr', chr);\n newrow.attr('data-start', start);\n newrow.attr('data-end', end);\n newrow.attr('data-symbol', symbol);\n newrow.attr('data-status', status);\n\n // LRG ID\n var lrg_id_cell = newCell(get_lrg_link(lrg_id));\n lrg_id_cell.attr('sorttable_key', lrg_id);\n\n newrow.append(lrg_id_cell);\n // Symbol\n newrow.append(newCell(generate_external_link(symbol,'hgnc_link')));\n // LRG Status\n newrow.append(newCell(\"<span>\"+status+\"</span>\").addClass(status+'_hl'));\n // Curation Status step\n newrow.append(curation_desc_cell);\n // Curation Status date\n newrow.append(curation_date_cell);\n\n // External links\n newrow.append(newCell(ens_link + link_separator + ncbi_link + link_separator + ucsc_link).addClass('gbrowser'));\n\n rows_list.push(newrow);\n //table_tbody.append(newrow);\n }\n table_tbody.append(rows_list);\n\n // Post process to show or not the \"Curation status\" column (not needed if only public LRG returned in the results)\n if (has_lrg_pending == 1) {\n\n // Make space to display the step diagram\n $(\"#search_help_container\").addClass(\"col-xs-6 col-sm-6 col-md-6 col-lg-6 padding-left-0 padding-right-0\");\n\n // Get the LRG steps\n get_lrg_step_data(lrg_list);\n\n // Show the LRG steps\n $('.'+step_col_class).show();\n }\n else {\n step_info.hide();\n step_info.html('');\n\n $('.'+step_col_class).hide();\n }\n }\n}", "function clearResults() {\n var mapResults = document.getElementById('mapResultsFull');\n var navResults = document.getElementById('navResults');\n while (mapResults.childNodes[0]) {\n mapResults.removeChild(mapResults.childNodes[0]);\n }\n while (navResults.childNodes[0]) {\n navResults.remove(navResults.childNodes[0]);\n }\n}", "function displaySearch(data) {\n var result = data.query.search;\n $(\".search-result\").html(\"\");\n for (var i = 0; i < result.length; i++) {\n var tmp =\n '<div class=\"row result\" id=\"result-' +\n (i + 1) +\n '\">' +\n '<h5 class=\"title\" id=\"title' +\n (i + 1) +\n '\">' +\n '<a href=\"https://en.wikipedia.org/wiki/' +\n result[i].title +\n '\"> ' +\n result[i].title +\n \"</a></h5><br>\" +\n '<p class=\"snippet\" id=\"snippet' +\n (i + 1) +\n '\">' +\n result[i].snippet +\n \"...</p></div>\";\n $(\".search-result\").html($(\".search-result\").html() + tmp);\n }\n $(\".result\").css({\n background: \"rgba(244, 244, 244)\",\n margin: \"15px\",\n padding: \"15px\",\n width: \"100%\"\n });\n}", "function displayNatParks(responseJson) {\n console.log(responseJson.data.length);\n if (!responseJson.data.length) {\n $('#results-list').empty();\n $('.results-header').addClass('hidden');\n $('#js-error-message').text('Re-enter a valid state').removeClass('hidden');;\n } else {\n $('#results-list').empty();\n $('#js-error-message').addClass('hidden');\n for (let i = 0; i < responseJson.data.length; i++) {\n $('#results-list').append(\n `<li><h3>${responseJson.data[i].fullName}</h3>\n <p>${responseJson.data[i].description}</p>\n <a href='${responseJson.data[i].url}'>Link</a>\n </li>`\n )\n }\n //display the results section \n $('.results-header').removeClass('hidden');\n\n }\n }", "function showResultPage(){\n if(resultParties.length == 0){\n resultParties = parties;\n }\n document.getElementById('importantContainer').style.display = 'none';\n document.getElementById('resultContainer').style.display = 'block';\n\n //De top 3 partijen worden laten zien\n document.getElementById('1stPlace').innerHTML += resultParties[0].name;\n document.getElementById('2ndPlace').innerHTML += resultParties[1].name;\n document.getElementById('3rdPlace').innerHTML += resultParties[2].name;\n}", "function showResultPage() {\n //Hier word een alert gegeven als geen van de knoppen is ingedrukt\n if (topParties.length === 0) {\n return alert(\"Klik op een van de onderstaande knoppen s.v.p.\");\n }\n partyPage.style.display = \"none\";\n resultSection.style.display = \"block\";\n\n //De top 3 partijen worden laten zien en voegt de waarde toe aan de array\n firstPlace.innerHTML += topParties[0].name;\n secondPlace.innerHTML += topParties[1].name;\n thirdPlace.innerHTML += topParties[2].name;\n}", "function setupResults() {\n\n hideWait();\n\n // Travel news\n $('div.travelNews a[id*=showDetailsBtn]').die();\n // bind client side events and stop it to propagate so updatepanel doesn't fire\n $('div.travelNews a[id*=showDetailsBtn]').live('click', function (event) {\n\n event.preventDefault();\n\n currentNewsItem = $('input[id*=' + $(this).find('input[name*=newsId]').val() + ']').parent().parent();\n\n displayPage(currentNewsItem);\n });\n \n // Underground news\n $('div.undergroundStatus a[id*=showDetailsBtn]').die();\n // bind client side events and stop it to propagate so updatepanel doesn't fire\n $('div.undergroundStatus a[id*=showDetailsBtn]').live('click', function (event) {\n\n event.preventDefault();\n\n var newsId = $(this).find('input[name*=statusLineId]').val();\n currentNewsItem = $('input[id*=undergroundStatusControl_' + newsId + ']').parent().parent();\n\n if (currentNewsItem != null && currentNewsItem.length > 0) {\n displayPage(currentNewsItem);\n }\n });\n\n // If unavailable message displayed, show message\n if ($('span[id*=undergroundStatusUnavailableLbl]').length > 0) {\n $('span[id*=undergroundStatusUnavailableLbl]').addClass('hide');\n displayMessage($('span[id*=undergroundStatusUnavailableLbl]').html());\n }\n}", "clearPrevResults(){\n const resultsDiv = document.querySelector('#results');\n resultsDiv.innerHTML = '';\n }", "function buildResultsView(missingResults = false) {\n const bars = STORE.brewResults;\n $('.resultsList').html('');\n $('.map').html('');\n let resultView = [];\n for (let i = 0; i < bars.length; i++) {\n resultView.push(`\n <li class=\"barCardItem\" id=List${i + 1}>\n <div class=\"orderNumber\">${i + 1}\n </div>\n <div class=\"barContainer\">\n <h3 class=\"barTitle barLink\">\n <a href=\"${bars[i].website_url}\" class=\"barName\" target=\"_blank\">${bars[i].name}</a>\n </h3>\n <p class=\"barAddress\">${bars[i].street}</p>\n <p class=\"barAddress\">${bars[i].city}, ${bars[i].state}, ${bars[i].postal_code}</p>\n <p class=\"barPhone\">${bars[i].phone}</p>\n <button type=\"button\" id=\"removeButton\" class=\"removeButton\">X</button>\n </li>`);\n }\n if (missingResults) {\n // TODO - fade this out after timeout\n $('.resultsList').html(`<div class=\"alert\">\n Some results were removed due to missing location information.\n </div>\n ${resultView.join('')}`);\n }\n else {\n $('.resultsList').html(resultView.join(''));\n }\n removeBar();\n let mapCenter = [STORE.brewResults[0].longitude, STORE.brewResults[0].latitude];\n STORE.map;\n STORE.addNav();\n STORE.nav = true;\n STORE.recenter(mapCenter);\n let initialBars = [];\n STORE.brewResults.forEach(bar => {\n initialBars.push([bar.longitude, bar.latitude, bar.name]);\n });\n STORE.addMarker(initialBars);\n}", "function showResult(response) {\n const resList = response.data;\n console.log(response.data);\n drawResultList(\n $(\"#results-container\"),\n resList,\n \"Sorry, no matched results...\"\n );\n}", "function handleViewResultsButtonClicked() {\n $('.page').on('click', '.view-results', function (event) {\n event.preventDefault();\n STORE.view = 'results';\n STORE.button = { class: 'start-over', label: 'Start Over' };\n STORE.currentQuestion = null;\n STORE.userChoice = null;\n renderPage();\n });\n}", "function renderResults(){\n resultsContent.innerHTML = '';\n viewResultsButton.innerHTML = '';\n for(let i =0; i < allItems.length; i++){\n let p = document.createElement('p');\n p.textContent = `${allItems[i].name} : ${allItems[i].clicked} / ${allItems[i].viewed}`;\n viewResultsButton.appendChild(p);\n }\n}", "function showResults() {\n let bigString = \"\";\n\n for (let i = page; i < page + 10; i++) {\n let result = results[i];\n\n let smallURL = result.recipe.image;\n if (!smallURL) smallURL = \"Media/gif_finder_images/no-image-found.png\";\n\n //get url of recipe, yield/servings, total time\n let url = result.recipe.url;\n let portions = result.recipe.yield;\n let time = result.recipe.totalTime;\n //if there is no estimate on time (0 minutes), change phrases\n if (time == 0) {\n time = \"N/A\"\n }\n else {\n time += \" min\";\n }\n //get name of recipe, cut off name if too long\n let name = result.recipe.label;\n if (name.length > 42) {\n name = name.substring(0, 42) + \"...\";\n }\n //build HTML\n let line = `<div class='result'><div class=\"title\"><h2>${name}</h2></div><div class=\"info\">Servings: ${portions}\n <br>Time: ${time}</div><div class=\"foodImage\"><img src='${smallURL}' title='${result.id}' /></div>`;\n line += `<div class=\"link\"><a target='_blank' href='${url}'> View Recipe </a></div></div>`;\n bigString += line;\n }\n\n //put into HTML\n document.querySelector('#content').innerHTML = bigString;\n\n document.querySelector('#status').innerHTML = \"<b>Search was successful!</b>\";\n}", "function results () {\n \n stop();\n\n $(\"#time\").empty();\n $(\"#correctAnswers\").text(\"Correct Answers: \" + correctAnswers);\n $(\"#incorrectAnswers\").text(\"Incorrect Answers: \" + incorrectAnswers);\n $(\"#unansweredQuestions\").text(\"Unanswered Questions: \" + unansweredQuestions);\n $(\"#results\").show();\n \n }" ]
[ "0.7576166", "0.7408926", "0.7405816", "0.7271213", "0.72583675", "0.71961373", "0.70647454", "0.706131", "0.70229244", "0.7012176", "0.6974457", "0.6970754", "0.694964", "0.6926762", "0.6889224", "0.6856273", "0.6844927", "0.68201596", "0.6808656", "0.6803067", "0.67957205", "0.67926276", "0.6778501", "0.6773852", "0.6767893", "0.6757401", "0.67516977", "0.6746463", "0.67400306", "0.6735125", "0.67321366", "0.67212427", "0.6720168", "0.6712224", "0.67118126", "0.66964924", "0.66954416", "0.6672738", "0.6664492", "0.6649629", "0.6649489", "0.66492516", "0.6644681", "0.6644062", "0.6640692", "0.6637615", "0.66292524", "0.66210866", "0.6615906", "0.6615308", "0.66105497", "0.6606986", "0.6605966", "0.6588583", "0.65867203", "0.65723795", "0.6567327", "0.656636", "0.6563872", "0.65563583", "0.6551621", "0.6543254", "0.65418524", "0.6519748", "0.6519678", "0.6512751", "0.65060866", "0.6501011", "0.6500707", "0.64976186", "0.6486994", "0.6478198", "0.647588", "0.64722294", "0.64685524", "0.6465064", "0.6457793", "0.64561313", "0.64550376", "0.645032", "0.6447234", "0.644283", "0.6441126", "0.64402664", "0.6440232", "0.643598", "0.64252263", "0.6423812", "0.642013", "0.64172447", "0.64138186", "0.64121693", "0.6411713", "0.64062417", "0.64034224", "0.6403134", "0.64007276", "0.6398994", "0.6397694", "0.63962173" ]
0.70503116
8
function to display next page of missing persons
function displayNext() { $("body").on("click", ".nextButton", (_e) => { state.page++; let results = state.records.slice(state.page * 10, state.page * 10 + 10); renderItems(results); }); $("body").on("click", ".previousButton", (_e) => { if (state.page === 0) { return; } state.page--; let results = state.records.slice(state.page * 10, state.page * 10 + 10); renderItems(results); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showNext()\n{\n\tcurPage++;\n\tshowContacts();\n}", "function next() {\n pageNumber++;\n getEmployeeDetails(myArr);\n }", "function nextPage() {\n\n if (pastContests.length > pastEndIndex + 30) {\n pastStartIndex = pastStartIndex + 30;\n pastEndIndex = pastEndIndex + 30;\n }\n\n if (nonPastContests.length >= nonPastEndIndex + 30) {\n nonPastStartIndex = nonPastStartIndex + 30;\n nonPastEndIndex = nonPastEndIndex + 30;\n }\n\n makePastCards(pastContests);\n makeNonPastCards(presentContests, futureContests);\n}", "function getPeople(pageNum){\n\tlet newPage = pageNum +1;\n\tif(newPage<11){\n\t\treturn{\n\t\t\ttype: FETCHING_PEOPLE,\n\t\t\tnewPage\n\t\t}\n\t}else{\n\t\talert(\"No more records available\")\n\t}\n}", "function nextResult(){\n currentRestaurant += 1;\n if (currentRestaurant === shortList.length){\n document.getElementById(\"next\").disabled = true;\n pageScroll('section5');\n } else {\n print();\n }\n}", "function showPage(pageNumber, listName) { // Takes arguments for page number and source list\n $(eachStudent).hide(); // Hides initial list of all students\n let currentLength = listName.length;\n for (let i = 0; i < currentLength; i++) { // Loops to check for right range\n if (i < pageNumber * studentsperPage && i + 1 > (pageNumber - 1) * studentsperPage) {\n $(listName[i]).show(); // Shows students in correct number range\n }\n }\n currentList = listName; // Sets current list so addPages knows how many pages to make\n}", "nextPage() {\n const pageCurrent = this.state.pageCurrent + 1\n\n this.getContacts(pageCurrent)\n }", "function nextPage() {\n currentPage += 1;\n loadList();\n}", "function nextPage(){\n if (page > 0)\n {\n setPage( page +1);\n }\n }", "function nextButton() {\n $('#person').fadeOut('fast');\n if(i < 16 ){ //if/else checks if you are at the end of the carousel, and if so jumps to the other end.\n i = next;\n var person = data.people[i];\n stagePerson(person);\n console.log(i);\n next = i + 1;\n prev = i - 1;\n } else {\n i = 0;\n var person = data.people[i];\n stagePerson(person);\n next = i + 1;\n prev = i - 1;\n }\n }", "function prev() {\n pageNumber--;\n getEmployeeDetails(myArr);\n }", "function next() {\n if ($scope.options.index < pageCount - 1) {\n $scope.options.index++;\n }\n }", "function nextPage() {\n if (currentPage == getTotalPages()) {\n return;\n }\n\n currentPage++;\n getArticlesForPage();\n}", "function goNext() {\n if (pageNum == pdfDoc.numPages-1)\n {\n \t$(\"#next\").prop(\"disabled\", true);\n \t}\n pageNum++;\n renderPage(pageNum);\n }", "function nextPage() {\n showPage(currentPage + 1);\n}", "function goNext() {\n\tif (pageNum >= pdfDoc.numPages)\n\t\treturn;\n\tpageNum++;\n\trenderPage(pageNum);\n}", "function useNextButton() {\r\n currentPage++\r\n var totalPages = parseInt(document.getElementById(\"totalPages\").innerHTML)\r\n if (currentPage > totalPages) {\r\n currentPage--\r\n }\r\n document.getElementById(\"pageNumber\").innerHTML = currentPage.toString();\r\n getUsers(currentPage)\r\n}", "function nextSlide(){\n indexTracker++;\n if(indexTracker >= peopleArray.length){\n indexTracker = 0;\n }\n\n updateIndexPoints();\n}", "function getNext(){\n page++\n getSearch()\n}", "function nextPage(){\n \n if(currentPage < numberOfPages()){\n currentPage++;\n loadTable(currentPage);\n \n }\n}", "loadNextPage() {\n this.skipCount = this.users.length;\n\n this.isLoading = true;\n\n let promise = this.codenvyAPI.getUser().fetchUsers(this.maxItems, this.skipCount);\n\n promise.then(() => {\n this.isLoading = false;\n this.updateUsers();\n }, (error) => {\n this.isLoading = false;\n if (error.status !== 304) {\n this.cheNotification.showError(error.data.message ? error.data.message : 'Update information failed.');\n }\n });\n }", "function goNextPage(){\r\n // ensure does not exceed max page limit\r\n if(page < maxPage){\r\n page = page + 1;\r\n }\r\n}", "function nextPage(){\n\t\t\tif($(\".page-\"+(pageNumber+1)+\"#article_\"+article).is(':hidden'))\n\t\t\t{\n\t\t\t\t$(\".page-\"+pageNumber+\"#article_\"+article).hide();\n\t\t\t\tpageNumber++;\n\t\t\t\t$(\".page-\"+pageNumber+\"#article_\"+article).stop(true, true).fadeIn(300);\n\t\t\t\tupdateAfterNav();\n\t\t\t}else if($(\".page.first#article_\"+(article+1)).is(':hidden')){\n\t\t\t\t$(\".page-\"+pageNumber+\"#article_\"+article).hide();\n\t\t\t\tarticle++;\n\t\t\t\tupdateMenu();\n\t\t\t\tpageNumber = 1;\n\t\t\t\t$(\".page.first#article_\"+article).stop(true, true).fadeIn(300);\n\t\t\t\tupdateAfterNav();\n\t\t\t}\n\t\t}", "loadNextArtistsOrAlbums() {\n this.page++;\n this.loadArtistsOrAlbums(this.page * 6);\n }", "function showPrev()\n{\n\tcurPage--;\n\tshowContacts();\n}", "function nextSection() {\r\n // If the user is currently on step 2, the personal information input will be validated\r\n if (current == 1)\r\n {\r\n next.addEventListener(\"click\", validateInfo, false);\r\n if (!validateInfo())\r\n return;\r\n }\r\n // Increment current step by 1 and call function to display the new step\r\n current++;\r\n show(current);\r\n}", "function renderNextPage() {\n renderBookmarks(pagination.currentPage + 1);\n}", "function showPage(list, section, perPage) {\n let startIndex = (section * perPage) - perPage;\n let endIndex = (section * perPage);\n let ul = document.querySelector(\".student-list\");\n ul.innerHTML = \"\";\n \n for (let i = 0; i < list.length; i += 1) {\n if (i >= startIndex && i < endIndex) {\n let obj = list[i];\n if (obj.error) {\n ul.insertAdjacentHTML(\"beforeend\", `<h1 id=\"error\">${obj.error}<h1>`);\n } else {\n ul.insertAdjacentHTML(\"beforeend\", \n `<li class=\"student-item cf\">\n <div class=\"student-details\">\n <img class=\"avatar\" src=${obj.picture[\"large\"]} alt=\"Profile Picture\">\n <h3>${obj.name[\"first\"]} ${obj.name[\"last\"]}</h3>\n <span class=\"email\">${obj.email}</span>\n </div>\n <div class=\"joined-details\">\n <span class=\"date\"> Join: ${obj.registered[\"date\"]}</span>\n </div>\n </li>` );\n } \n\n }\n }\n}", "function moveNext() {\n if (currentPage == totalPages) return;\n loadTaskList(++currentPage);\n}", "function showPage(index) {\n // console.log(page);\n // (page < 1) && (page = 1);\n var first = (index - 1) * record.perPage;\n var last = Math.min(index * record.perPage, record.total - 1);\n $(\"#result-listfriends\").html('');\n for (var i = first; i <= last; i++) {\n var item = arrFriends[i];\n // var score = item.countLike() + item.countComments() * 3;\n // var linkProfile = (item.getName()).link('https://fb.com/' + item.getId());\n var html = `\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>${item.id}</td>\n\t\t\t\t<td>${item.like}</td>\n\t\t\t\t<td>${item.comments}</td>\n\t\t\t\t<td>${item.score}</td>\n\t\t\t</tr>\n\t\t`;\n $(\"#result-listfriends\").append(html);\n }\n}", "function setNext(p_page_num, p_num_pages, p_search_string){\n \ttry {\n var next = document.getElementById(\"next\");\n var next_link = document.getElementById(\"next_link\");\n if(p_page_num == p_num_pages){\n next.style.display = \"none\";\n }else{\n var next_page = p_page_num + 1;\n next.style.display = \"inline\";\n next_link.href = \"searchResults.php?searchInput=\" + p_search_string + \"&\" + \"page=\" + next_page;\n }\n \t}\n \tcatch(e) {\n\t\t\tlog(\"searchResults.js\", e.lineNumber, e);\n \t}\n }", "function goNext() {\n //console.log(\"goNext: \" + options.currentPage);\n if (options.currentPage != options.total) {\n var p = options.currentPage + 1;\n loadData(p);\n setCurrentPage(p);\n options.currentPage = p;\n pageInfo();\n }\n }", "function handleMoreFollowers() {\n setNextPage(page + 1)\n }", "function renderNewPage () {\n countToiletsMatchingSearchCriteria();\n $.ajax({\n method: \"GET\",\n url: `/api/toilets?skip=${skip}&ratingLimit=${ratingLimit}&scope=${scope}`,\n success: function(data) {\n resultsLength = data.length;\n if ((resultsLength < limit) || (resultsLength + skip == lengthOfToilets)) {\n $('.next-button').hide();\n } else {\n $('.next-button').show();\n }\n if (skip == 0) {\n $('.previous-button').hide();\n } else {\n $('.previous-button').show();\n }\n\n renderToiletList(data);\n initGoogleMap();\n data.forEach(function (returnData) {\n var marker = new google.maps.Marker({\n position: {lat: returnData.lat, lng: returnData.long},\n map: map,\n title: returnData.name,\n });\n })\n }\n })\n}", "function showPage(page, studentList) {\n for (let i = 0; i < studentList.length; i += 1) {\n studentList[i].style.display = \"none\";\n }\n for (let i = 0; i < studentList.length; i += 1) {\n if (i >= (page - 1) * 10 && i <= (page * 10) - 1) {\n studentList[i].style.display = \"block\";\n }\n }\n}", "function next(){\n\n // if in the last page, then go to the new page needs http request\n if(scope.model.currentIndex === (scope.model.results.length - 1))\n {\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','visible');\n var promise = scope.model.next();\n promise.then(function(response){\n\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','hidden');\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n\n },function(error){\n console.log(error);\n });\n }\n else {\n scope.model.currentIndex++;\n scope.model.data = scope.model.results[scope.model.currentIndex];\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n }\n }", "nextHandler() {\n if (this.page < this.totalPage && this.page !== this.totalPage) {\n this.page = this.page + 1; //increase page by 1\n this.displayRecordPerPage(this.page);\n }\n }", "function nextPage(){\n let list = document.getElementById(\"tweetList\");\n clearDiv(list);\n list.appendChild(tweetList(page+1,15));\n}", "NextVisible() {}", "function nextPage() {\n console.log(currentPage);\n currentPage += 1;\n for (let i = 0; i<pages.length; i++) {\n if(i == currentPage) {\n pages[i].style.display = \"inline\";\n }\n else {\n pages[i].style.display = \"none\"\n }\n }\n}", "nextPage() {\n if (this.page < this.totalPages) {\n this.page++;\n this.search();\n }\n }", "function showPage(page,list) {\r\n const startIndex = (page * itemsPerPage) - itemsPerPage;\r\n const endIndex = page * itemsPerPage;\r\n //loop over the student list, print 10 student according the index position\r\n for(let i = 0; i < list.length; i++){\r\n if( i >= startIndex && i < endIndex){\r\n list[i].style.display = 'block';\r\n } else {\r\n list[i].style.display = 'none';\r\n }\r\n }\r\n }", "function NextPage() {\n\tif (CurrentPage+1 <= TotalPages()){\n\t\tDisplayPage( CurrentPage + 1 )\n\t}\n\telse{\n\t\tContinueSCO();\n\t}\n}", "function next() {\n if (currentItemNumber + 1 > data.length) {\n currentItemNumber = 0;\n showPic(currentItemNumber);\n } else {\n currentItemNumber++;\n showPic(currentItemNumber);\n }\n}", "function pageNext()\n{\n\tif (currentPage<lastPage) {\n\t\tcurrentPage=currentPage + 1;\n\t\tviewPage();\n\t}\n}", "function showPage(list, page) {\r\n // create two variables which will represent the index for the first and last student on the page\r\n /* startIndex = (page parameter * items per page) - items per page \r\n endIndex = page parameter * items per page */\r\n startIndex = page * 9 - 9;\r\n endIndex = page * 9;\r\n // select the element with a class of `student-list` and assign it to a variable\r\n studentList = document.querySelector(\".student-list\");\r\n\r\n // set the innerHTML property of the variable you just created to an empty string\r\n studentList.innerHTML = \" \";\r\n // loop over the length of the `list` parameter\r\n for (let i = 0; i < list.length; i++) {\r\n // inside the loop create a conditional to display the proper students\r\n if (i >= startIndex && i < endIndex) {\r\n // inside the conditional:\r\n // create the elements needed to display the student information\r\n let pickPerson = data[i];\r\n let studentItem = `<li class = \"student-item cf\"> \r\n <div class = \"student-details\"> \r\n <img class=\"avatar\" src=\"${pickPerson.picture.large}\" alt=\"Profile Picture\">\r\n <h3>${pickPerson.name.first} ${pickPerson.name.last}</h3> <span class=\"email\">${pickPerson.email}</span>\r\n </div>\r\n <div class=\"joined-details\">\r\n <span class=\"date\">${pickPerson.registered.date}</span>\r\n </div>\r\n </li> `;\r\n // insert the above elements\r\n studentList.insertAdjacentHTML(\"beforeend\", studentItem);\r\n }\r\n }\r\n}", "next() {\n const that = this;\n\n that.navigateTo(that.pageIndex + 1);\n }", "function nextPage() {\r\n paginacion(nextPageToken);\r\n}", "function showPage(data, page) {\r\n const StartIndex = page * ItemsPerPage - ItemsPerPage;\r\n const EndIndex = page * ItemsPerPage;\r\n let studentList = document.querySelector('.student-list');\r\n studentList.innerHTML = '';\r\n\r\n //this loop will loop through the data array and return the information that passes the conditoinal\r\n\r\n for (let i = 0; i < data.length; i += 1) {\r\n if ([i] >= StartIndex && [i] < EndIndex) {\r\n // this conditional ensures the output is within the desired range\r\n\r\n let studentItem = data[i];\r\n // this will dynamicaly insert that data contained in the data object in the HTML\r\n studentList.insertAdjacentHTML(\r\n 'beforeend',\r\n ` <li class=\"student-item cf\">\r\n <div class=\"student-details\">\r\n <img class=\"avatar\" src=${studentItem.picture.thumbnail} alt=\"Profile Picture\">\r\n <h3>${studentItem.name.first}</h3>\r\n <span class=\"email\">${studentItem.email}</span>\r\n </div>\r\n <div class=\"joined-details\">\r\n <span class=\"date\">Joined ${studentItem.registered.date}</span>\r\n </div>\r\n </li>`\r\n );\r\n }\r\n }\r\n}", "function showPage(list, page) {\n const startIndex = (page * 9) - 9;\n const endIndex = page * 9;\n const studentUL = document.querySelector('.student-list');\n studentUL.innerHTML = '';\n\n if (list.length < 1) {\n const ul = document.querySelector('.student-list');\n ul.innerHTML = `<h1>No results found...</h1>`;\n } else {\n for ( let i = 0; i < list.length; i++ ) {\n if ( i >= startIndex && i < endIndex ) {\n const studentLI = `\n <li class=\"student-item cf\">\n <div class=\"student-details\">\n <img class=\"avatar\" src=${list[i].picture.thumbnail}\n alt=\"Profile Picture\">\n <h3>${list[i].name.first} ${list[i].name.last}</h3>\n <span class=\"email\">${list[i].email}</span>\n </div>\n <div class=\"joined-details\">\n <span class=\"date\">Joined \n ${list[i].registered.date}</span>\n </div>\n </li>`;\n\n studentUL.insertAdjacentHTML('beforeend', studentLI);\n }\n }\n }\n}", "function displayNextPage(nextPage, previousPage) {\n\t\t\t$(previousPage).css(\"display\", \"none\");\n\t\t\t$(nextPage).css(\"display\", \"block\");\n\t\t\t//location = $(pageID).val();\n\t\t}", "function studentsFirstPage() {\n for (let i = 0; i < eachStudent.length; i++) {\n if ( i < studentsPerPage ) {\n eachStudent[i].style.display = '';\n } else {\n eachStudent[i].style.display = 'none';\n }\n }\n}", "pageNext(num) {\n this.setPage(num)\n }", "function nextIssue(nextPage = false) {\n gotoPage(displayIssue + (nextPage ? 1 : -1))\n}", "function showPage(list, page) {\n // if the list is empty, show \"RESULTS NOT FOUND\"\n if (list.length === 0) {\n const p = document.createElement('p');\n const br = document.createElement('br');\n p.textContent = 'RESULTS NOT FOUND';\n const pageDiv = document.querySelector('.page');\n pageDiv.appendChild(br);\n pageDiv.appendChild(p);\n }\n let lastStud = (page * itemsPerPage) - 1;\n let firstStud = (page * itemsPerPage) - 10;\n // loop through all students to only show 10 students depending on page #\n for (i = 0; i < list.length; i++) {\n if (i >= firstStud && i <= lastStud) {\n list[i].style.display = \"\";\n } else {\n list[i].style.display = \"none\";\n }\n }\n}", "loadNextPage() {\n this.page = this.page + 1;\n MovieService.filterMovies(this.props.keywords, this.props.genresId, this.page, true);\n }", "function studentsShow (page) {\n let i = 1\t\n for (let=1; i<= studentsNumber; i +=1){\n \tstudentShow (i,page);\n \t$('ul.student-list').show();\t\n }\n}", "function pfClickedNext(pageNumba, mode){\n //console.log(\"Clicked Next\");\n\tpageNumba++;\n\tspawnPF(mode, pageNumba);\n}", "function displayList(results) {\n var arr = document.querySelectorAll('li.student-item');\n if (pagination.querySelector('a.active')) { //checks to see if pagination exist ie more than 10 students in the student list if\n let pageLink = pagination.querySelector('a.active').textContent;\n var i = 1;\n do {\n if (arr[results * pageLink - i]) { //checks to see if array index item is valid\n arr[(results * pageLink) - i].style.display = 'list-item';\n };\n i++;\n } while (i <= results); //excutes result times(in this case 10).\n } else {\n for (var i = 0; i < arr.length; i++) {\n arr[i].style.display = 'list-item';\n };\n };\n}", "function next() {\n if (currentContactIndex < (contactArray.length-1)) {\n currentContactIndex++;\n }\n currentContact = contactArray[currentContactIndex];\n viewCurrentContact();\n\n \n // Todo: Disable next button when there is no next item.\n // PJB: I implemented this in the viewCurrentContact() fucntion so that \n // it would work when first loaded.\n \n \n // Todo: Save changed items to contacts array and resort array.\n // PJB: I saved the changed items to the contacts array in the add(), \n // delete(), and update() functions. I didn't resort the array\n // because I didn't sort it in the first place but I do update \n // the table each time one of these functions is called.\n}", "function showPage (pageNumber, studentList) {\n hideList(studentList);\n for(let i = 1; i <= studentList.length; i++) {\n const li = studentList[i - 1];\n if(i >= getLowerRange(pageNumber) &&\n i <= getUpperRange(pageNumber))\n li.style.display = '';\n }\n}", "nextPage() {\n if (!this.isLastPage) {\n this.currentPageNumber++;\n }\n this.updateData();\n }", "function goToNextPage() {\n updateCurrentPage((page) => page + 1);\n }", "function nextContent(e){\n const value = person[e] //1 \n if( e < person.length){\n picture.src = value.img\n console.log(value.img)\n author.textContent = value.name\n job.textContent = value.profetion\n info.textContent = value.discription\n }\n}", "function showPage(page_number, studentList) {\n\t//hides entire roster\n\t$(studentList).hide();\n\t//defines start and end values for slice()\n\tvar start = page_number * showPerPage;\n\tvar end = start + showPerPage;\n\t//cycles through roster and divides students onto assigned pages\n\tfor( let i = 0; i < studentList.length; i ++ ) {\n\t\t$(studentList).slice(start, end).show();\n\t}\n}", "async function showNextPage(profileId) {\n const nextUrl = await loadNextSuggestion(profileId);\n await store.dispatch('status', 'Getting suggestion');\n // If next suggestion already exists, use it and find a new one.\n // console.log('show next link');\n if (nextUrl != null) {\n // console.log('next suggestion exists');\n changeActiveTabToUrl(store.state.nextSuggestion);\n store.commit(types.SET_CUR_SUGGESTION, {\n url: store.state.nextSuggestion,\n });\n store.commit(types.SET_NEXT_SUGGESTION, {\n url: null,\n });\n store.commit(types.SET_NEED_CUR_SUGGESTION, {\n value: false,\n });\n } else {\n // console.log('no next suggestion');\n store.commit(types.SET_NEED_CUR_SUGGESTION, {\n value: true,\n });\n }\n loadNextSuggestion(profileId);\n}", "function displayNextSlide(){\r\n if(helperSlides.data.length>0){\r\n let currentIndex = helperSlides.data.map(function (e) {\r\n return e.slideid;\r\n }).indexOf(selectedSlide.slideid);\r\n let newIndex = null;\r\n if (currentIndex < helperSlides.data.length-1) {\r\n newIndex = currentIndex + 1;\r\n } else if (currentIndex == helperSlides.data.length-1){\r\n newIndex = helperSlides.data.length-1;\r\n }\r\n selectedSlide.slideid = helperSlides.data[newIndex].slideid;\r\n selectedSlide.data = helperSlides.data[newIndex].data;\r\n displaySlide(); \r\n }\r\n}", "function createPage(pageNo, resultsPerPage) {\n let totalStudents = masterList.length;\n let firstStudentOnPage = (pageNo-1)*resultsPerPage;\n let lastStudentOnPage = pageNo*resultsPerPage - 1;\n\n for (let i = 0; i < totalStudents; i += 1) { // first hide all students\n masterList[i].style.display = 'none';\n }\n // then display students on their appopriate page\n if (lastStudentOnPage < totalStudents) {\n for (let i = firstStudentOnPage; i <= lastStudentOnPage; i++) {\n masterList[i].style.display = '';\n }\n }\n else {\n for (let i = firstStudentOnPage; i < totalStudents; i++) {\n masterList[i].style.display = '';\n }\n }\n\n}", "function showPage(list, page){\r\n let startIndex = (page * 9) - 9\r\n let endIndex = page * 9\r\n\r\n student_list.innerHTML = ''\r\n\r\n //Loops through the list of students and creates the dynamic content\r\n for(let i = 0; i < list.length; i++){\r\n let sourceList = list[i]\r\n if(i >= startIndex && i < endIndex) {\r\n student_list.insertAdjacentHTML('beforeend', `\r\n <li class=\"student-item cf\">\r\n <div class=\"student-details\">\r\n <img class=\"avatar\" src=${sourceList.picture.thumbnail} alt=\"Profile Picture\">\r\n <h3>${sourceList.name.first} ${sourceList.name.last}</h3>\r\n <span class=\"email\">${sourceList.email}</span>\r\n </div>\r\n <div class=\"joined-details\">\r\n <span class=\"date\">Joined ${sourceList.registered.date}</span>\r\n </div>\r\n </li>\r\n `)\r\n }\r\n }\r\n}", "function showMore() {\n page++;\n instantSearchName();\n}", "function handleNext() {\n let tempPage = page + 1;\n if (tempPage > totalPages) {\n tempPage = totalPages\n }\n setPage(tempPage);\n }", "function getNextPage() {\n // the page number can't beyond over the last page\n if ((curPage + 1) < $(\".page\").size()) {\n flipOver(curPage + 1);\n }\n }", "function skipPage() {\n page += 2;\n getURL();\n updateButton();\n\n}", "function showPage(currentPage) {\r\n\tlet restPage = reviewLst.length - currentPage * 3\r\n\tif (restPage >= 0) {\r\n\t\tcontentBody.innerText = \"\"\r\n\t\tfor (let i = 0; i < maxReviews; i++) {\r\n\t\t\tlet j = ((currentPage-1)*3) + i\r\n\t\t\t// console.log(j)\r\n\t\t\taddReviewToDom(reviewLst[j])\r\n\t\t}\r\n\t} else {\r\n\t\trestPage = maxReviews+restPage\r\n\t\tcontentBody.innerText = \"\"\r\n\t\tfor (let i = 0; i < restPage; i++) {\r\n\t\t\tlet j = ((currentPage-1)*3) + i\r\n\t\t\t// console.log(j)\r\n\t\t\taddReviewToDom(reviewLst[j])\r\n\t\t}\r\n\t}\r\n}", "function nextPage() {\r\n if (getpage < pagiArray.length - 1) {\r\n getpage++;\r\n itemsContainer.innerHTML = \"\";\r\n loadPages(getpage * 20, contenItems)\r\n }\r\n if (getpage === pagiArray.length - 2) {\r\n paginationRight.classList.add(\"black-focus\");\r\n }\r\n checkFocus(paginationLeft);\r\n checkFocus(paginationRight);\r\n getCurrentList();\r\n view === \"list\" ? styleList(\"l\") : styleList(\"g\");\r\n\r\n\r\n}", "function nextPage() {\n page += 1;\n getURL();\n updateButton();\n\n}", "function goToNextPage() {\n\t\tif ( canNextPage() ) {\n\t\t\tgoToPage( currentPage() + 1 );\n\t\t}\n\t}", "function fetchPagesAfterBackButton(){\n // LS.urlParams filters mpage, so read the arguments fresh\n var args = LS.getUrlParams();\n\n if (args.mpage){\n for (var i = 2; i <= args.mpage; i++){\n loadNextPage().done(function(json){\n appendResults(json, true);\n })\n }\n }\n\n }", "function showPage(listOfStudents, paginationPageSelected) {\r\n //if the first paginatinon button is selected the last index = 9, if the second pagination button is selected the last index = 19 etc\r\n const lastIndexToDisplay = (paginationPageSelected*10)-1;\r\n const firstIndexToDisplay = lastIndexToDisplay - 9;\r\n //make list items are hidden\r\n for(let i=0; i < list.length; i+=1) {\r\n document.querySelector('ul.student-list').children[i].style.display = 'none'//hides all\r\n }\r\n // of the matchedList, make sure that the onces within the selected index are revealed\r\n for(let i=0; i < listOfStudents.length; i+=1) {\r\n if(i >= firstIndexToDisplay && i <= lastIndexToDisplay) {\r\n // if the index of the matchedList is in the required range, reveal it!!!\r\n listOfStudents[i].style.display= '';\r\n }\r\n }\r\n}", "function showNextSection(current, next) {\r\n document.getElementById(`rules-title`).style.display = `none`;\r\n document.getElementById(current).style.display = `none`;\r\n document.getElementById(next).style.display = `block`;\r\n}", "function getNextRides(){\n vm.currentPage +=1;\n\n if(vm.currentPage > 3)\n vm.showCurrentPage = true;\n \n vm.getAllRides();\n }", "listNext() {\n document.body.scroll({ top: 0, left: 0, behavior: 'smooth' });\n this.listPage++;\n if (this.searchInput) {\n var input = document.getElementById(\"searchInput\").value;\n if (input.length != 0) {\n this.main.class().filter(input, this.listPage, this.listOrder, this.listDesc);\n return;\n }\n }\n this.main.class().list(this.listPage, this.listOrder, this.listDesc);\n }", "function next() {\n var nextButton = gAppState.checkId(\"nextBtnID\", \"nextBtnID2\");\n var prevButton = gAppState.checkId(\"prevBtnID\", \"prevBtnID2\");\n var remainder = tableSize - limit;\n\n if (nextButton.classList.contains('disabled')) { // stop action if button is disabled\n return false;\n }\n\n if (offset < remainder) { // if there is a next page\n offset += parseInt(limit);\n buttonDisplay();\n }\n\n // refresh table\n if (resultMode == \"bn\") {\n bnQueryGen();\n } else if (resultMode == \"query\") {\n queryGen();\n } else {\n updateTable();\n }\n}", "function showPage(list, page) {\n //store start and end index\n let startIndex = (page * 9) - 9;\n let endIndex = page * 9;\n\n //get student list element and empty it\n let studentList = document.querySelector('.student-list');\n studentList.innerHTML = '';\n\n //loop over list parameter length and store student data\n for (let i = 0; i < list.length; i++) {\n if (i >= startIndex && i < endIndex) {\n let studentItem = `<li class=\"student-item cf\">\n <div class=\"student-details\">\n <img class=\"avatar\" src=\"${list[i].picture.large}\" alt=\"Profile Picture\">\n <h3>${list[i].name.title} ${list[i].name.first} ${list[i].name.last}</h3>\n <span class=\"email\">${list[i].email}</span>\n </div>\n <div class=\"joined-details\">\n <span class=\"date\">Joined ${list[i].registered.date}</span>\n </div>\n </li>`;\n studentList.insertAdjacentHTML('beforeend', studentItem);\n }\n }\n}", "next() {\n const { currPage, totalPages } = this.state;\n if (currPage == totalPages) return;\n this.setState(\n {\n currPage: currPage + 1,\n },\n this.fnPrepareData\n );\n }", "function showPage(list, page) {\n //shows 9 students on display\n const startIndex = (page * 9) - 9;\n const endIndex = page * 9;\n\n // this resets the list of students\n studentList.innerHTML = '';\n\n // the for loop iterates the list of student objects and creates a student list item and adds it to the studentList HTML\n for (let i = 0; i < list.length; i++) {\n if (i >= startIndex && i < endIndex) {\n const student = list[i];\n const studentLi = `\n <li class=\"student-item cf\">\n <div class\"student-details>\n <img class=\"avatar\" src=\"${student.picture.large}\" alt=\"Profile Picture\">\n <h3>${student.name.first} ${student.name.last}</h3>\n <span class=\"email\">${student.email}</span>\n </div>\n <div class=\"joined-details\">\n <span class=\"date\">Joined: ${student.registered.date}</span>\n </div>\n </li>\n `;\n \n studentList.innerHTML += studentLi;\n }\n }\n}", "function showPage(page){\n console.log(page);\n let students = document.getElementsByClassName(\"student-item cf\");\n let maxPage = page * 10;\n let minPage = maxPage - 10;\n\n for (let i = 0; i < students.length; i++) {\n students[i].style.display = \"none\";\n }\n\n for (let i = minPage; i < maxPage; i++) {\n students[i].style.display = \"block\";\n\n }\n}", "function nextPage () {\n var viewportWidth = elements.canvas.clientWidth,\n totalWidth = viewportWidth + ctrl.offsetLeft,\n i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft);\n }", "function nextPage () {\n var viewportWidth = elements.canvas.clientWidth,\n totalWidth = viewportWidth + ctrl.offsetLeft,\n i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth > totalWidth) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft);\n }", "function get_next_screen(){\n button_disable_and_reenable();\n var new_page = (curr_page + 1) % page_arr.length;\n update_page(new_page);\n}", "nextPage() {\n if (!this.msg) throw new Error(\"Tried to go to next page but embed pages havn't been created yet.\");\n this.currentPageNumber++;\n if (this.currentPageNumber >= this.pages.length) this.currentPageNumber = 0;\n const embed = this.pages[this.currentPageNumber];\n if (this.pageFooter) embed.setFooter(`Page: ${this.currentPageNumber + 1}/${this.pages.length}`);\n this.msg.edit({ embed: embed }).catch(() => null);\n }", "function showPage(list, page){\n\tconst pageStart = (page * 9) - 9; \n\tconst pageEnd = page * 9; \n\tstudentList.innerHTML = '';\n\tfor(let i = 0; i < list.length; i++){ \n\t\tif(i >= pageStart && i < pageEnd){ \n\t studentList.insertAdjacentHTML(\"beforeend\", generateHtml(list[i]))\t\t\t\n\t\t};\n\t};\n}", "function nextSection(currentSection, nextSection) { \n document.querySelector('#' + currentSection).style.display = \"none\";\n document.querySelector('#' + nextSection).style.display = \"block\";\n}", "function showPage(list, page) {\r\n // create two variables which will represent the index for the first and last student on the page\r\n const startIndex = (page * 9) - 9;\r\n const endIndex = (page * 9);\r\n\r\n \r\n\r\n // select the element with a class of `student-list` and assign it to a variable\r\n const studentList = document.querySelector('.student-list');\r\n\r\n\r\n\r\n \r\n // set the innerHTML property of the variable you just created to an empty string\r\n studentList.innerHTML = '';\r\n \r\n // loop over the length of the `list` parameter\r\n for ( let i = 0; i < list.length; i++ ) {\r\n // inside the loop create a conditional to display the proper students\r\n // create the elements needed to display the student information\r\n if( i >= startIndex && i < endIndex) {\r\n studentList.innerHTML += `\r\n <li class=\"student-item cf\">\r\n <div class=\"student-details\">\r\n <img class=\"avatar\" src=\"${list[i].picture.large}\" alt=\"Profile Picture\">\r\n <h3> ${list[i].name.first} ${list[i].name.last} </h3>\r\n <span class=\"email\">${list[i].email}</span>\r\n </div>\r\n <div class=\"joined-details\">\r\n <span class=\"date\">Joined ${list[i].registered.date}</span>\r\n </div>\r\n </li>\r\n `;\r\n\r\n };\r\n \r\n };\r\n \r\n }", "function showResultPage() {\n //Hier word een alert gegeven als geen van de knoppen is ingedrukt\n if (topParties.length === 0) {\n return alert(\"Klik op een van de onderstaande knoppen s.v.p.\");\n }\n partyPage.style.display = \"none\";\n resultSection.style.display = \"block\";\n\n //De top 3 partijen worden laten zien en voegt de waarde toe aan de array\n firstPlace.innerHTML += topParties[0].name;\n secondPlace.innerHTML += topParties[1].name;\n thirdPlace.innerHTML += topParties[2].name;\n}", "function nextPage(){\n currentPage++;\n\n search();\n}", "function displayData(p, rows) {\n console.log(\"page no.:\"+ p);\n console.log(\"row count:\"+ rows);\n $tbody.innerHTML = '';\n\n if (parseInt(Number(p)) == p)\n {\n data = filteredData.slice((p-1)*rows, (p*rows));\n console.log(data);\n }\n else\n {\n\t alert('Please click on Previous or Next to navigate the pages.');\n console.log('Sorry!! This is not hanlded :( Need some more time.');\n return;\n }\n\n for (var i = 0; i < data.length; i++) {\n var UFOData = data[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "function showPage(list, page) {\n\n const startIndex = (page * contactsPerPage) - contactsPerPage;\n const endIndex = (page * contactsPerPage);\n\n for (let i = 0; i < list.length; i++) {\n if (i >= startIndex && i < endIndex) {\n studentList[i].style.display = 'block';\n } else {\n studentList[i].style.display = 'none';\n }\n }\n\n return false;\n}", "function gotoPage(pageNr) {\n if (dataToBeStored.size <= 0) return\n var data = [...dataToBeStored];\n displayIssue = pageNr % data.length;\n if (displayIssue < 0)\n displayIssue = data.length - displayIssue - 2;\n\n elemById(\"txaText\").value = data[displayIssue].text;\n elemById(\"lblOut\").value = data[displayIssue].labels.join(\",\");\n elemById(\"txfPage\").innerText = ` ${displayIssue + 1} / ${data.length} `;\n}", "function showPage(list, page) {\r\n // Calculate the index for first and last student to display\r\n let startIndex = page * 9 - 9;\r\n let endIndex = page * 9;\r\n\r\n // Select the ul for the student list\r\n const studentList = document.querySelector('.student-list');\r\n // Set ul to an empty string to clear it\r\n studentList.innerHTML = '';\r\n\r\n // Set the variable used to construct/append DOM elements\r\n let studentItem = '';\r\n\r\n for (let i = 0; i < list.length; i++) {\r\n let student = list[i];\r\n if (i >= startIndex && i < endIndex) {\r\n // Create the DOM elements\r\n studentItem = `\r\n <li class=\"student-item cf\">\r\n <div class=\"student-details\">\r\n <img class=\"avatar\" src=\"${student.picture.thumbnail}\" alt=\"Profile Picture\">\r\n <h3>${student.name.first} ${student.name.last}</h3>\r\n <span class=\"email\">${student.email}</span>\r\n </div>\r\n <div class=\"joined-details\">\r\n <span class=\"date\">${student.registered.date}</span>\r\n </div>\r\n </li>`;\r\n\r\n // Insert the created elements to the page\r\n studentList.insertAdjacentHTML('beforeend', studentItem);\r\n }\r\n }\r\n}" ]
[ "0.7129007", "0.7118382", "0.6519684", "0.64418954", "0.63983136", "0.63584185", "0.63391364", "0.63360023", "0.62673306", "0.62185323", "0.62167287", "0.61906916", "0.6179729", "0.6172903", "0.61637616", "0.6147424", "0.614542", "0.61194927", "0.6119322", "0.61016715", "0.6079455", "0.6061546", "0.6059669", "0.60589033", "0.6057943", "0.60258925", "0.60193753", "0.6012637", "0.6006687", "0.60046583", "0.60039276", "0.598013", "0.59705436", "0.597026", "0.5966726", "0.5959926", "0.5956192", "0.5943507", "0.5940504", "0.59205073", "0.5905141", "0.5893463", "0.58914363", "0.58872336", "0.58848363", "0.58770573", "0.586236", "0.5829382", "0.582921", "0.58231336", "0.58175254", "0.58119935", "0.58057666", "0.58032006", "0.5803139", "0.5797656", "0.5779614", "0.57752895", "0.5774095", "0.5772028", "0.5746943", "0.5745573", "0.57416505", "0.5740834", "0.57397234", "0.57364106", "0.5733151", "0.57321423", "0.5727861", "0.5723391", "0.5717129", "0.57152253", "0.57126594", "0.57122844", "0.57077956", "0.57070166", "0.5705112", "0.5698649", "0.56957316", "0.5668816", "0.56640416", "0.56531364", "0.5646242", "0.56452036", "0.56433564", "0.56341076", "0.56265694", "0.56264204", "0.56264204", "0.56232834", "0.5622902", "0.56148386", "0.561328", "0.5612053", "0.5606477", "0.5604178", "0.56016475", "0.5600178", "0.55972564", "0.55969393" ]
0.61757976
13
function to allow user to do a new search
function getnewSearch() { $("body").on("click", ".new-search-btn", function (e) { e.preventDefault(); $("#js-error-screen").hide().empty(); $(".results-container").hide(); $(".results-txt").hide(); $("#new-search-section").hide().empty(); $("#starting-screen").show(); $(".js-form").show(); $(".userInput").val(""); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newSearch() {\n window.location.href = \"../list/?service=\" + svcSearch +\"&range=\" + distSearch+\"/\"\n }", "function search() {\n\t\n}", "function add_click() {\n $('#search').click(function(){\n var query = find_query_params();\n //show a simple error message if the user hasn't entered enough in the query\n query?query_data(query):error();\n });\n }", "function makeSearch(event) {\n event.preventDefault();\n\n toggleError();\n\n searchRepos(\n searchInput.value,\n searchStartCB,\n searchSuccessErrorCB,\n searchFinalCB\n );\n}", "function handleNewSearch(data){\n setNewNavigation(data);\n clearOldResults(data);\n renderResults(data);\n}", "function handleSearch() {\n triggerSearch({}); // need empty braces here\n }", "function manualSearch(e) {\n let term = document.querySelector(\"#searchTerm\").value;\n term = term.trim();\n if (term.length < 1) return;\n manualSearchData(term.toLowerCase());\n}", "function startNewSearch (searchName) {\n\tif (!searchName || searchName === '') {\n\t\tconsole.error('[Model][startNewSearch]: Empty searchName');\n\t\treturn false;\n\t}\n\tupdateImageList([]);\n\tresetPage();\n\tsetSearchName(searchName);\n\t//resetRequestStatus();\n\tsetSelectIdx(0);\n\tmakeRequest();\n}", "function emitSearch(event){ if (event.which == 13) {addSearch();}}", "function runSearch() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n message: \"GREETINGS! WHAT WOULD YOU LIKE TO DO?\",\n choices: [\n \"ADD Department, Role, and/or Employee\",\n \"VIEW CURRENT Department, Role, and/or Employee's\",\n \"UPDATE An Employee Role\",\n ],\n })\n //==============PATH TO THE 'ADD' SELECTOR============//\n .then(function (answer) {\n switch (answer.action) {\n case \"ADD Department, Role, and/or Employee\":\n addInformation();\n break;\n //===============PATH TO THE 'VIEW' SELECTOR==========//\n case \"VIEW CURRENT Department, Role, and/or Employee's\":\n viewInformation();\n break;\n //===============PATH TO THE 'UPDATE' SELECTOR========//\n case \"UPDATE An Employee Role\":\n updateInformation();\n break;\n }\n });\n}", "function search() {\n $.var.currentSupplier = $.var.search;\n $.var.currentID = 0;\n $.var.search.query = $(\"#searchable\").val();\n if ($.var.search.query.trim().length === 0) { // if either no string, or string of only spaces\n $.var.search.query = \" \"; // set query to standard query used on loadpage\n }\n $.var.search.updateWebgroupRoot();\n}", "function search() {\n let search_text = $search_text.value;\n decide_search(search_text)\n}", "function searchWine(){\n setSearchFor();\n whatToSearch();\n watchSubmit();\n}", "onSearch() {\n try {\n const searchText = this.getSearchHash();\n if (searchText === this.priorSearchText)\n return;\n this.engine.search(searchText);\n this.priorSearchText = searchText;\n }\n catch (ex) {\n this.publish(\"error\", ex.message);\n }\n }", "function executeSearch(){\n\t/*Save the form data to a JSON file, so that it can be autopopulated the next time the form page is opened.*/\n\tsaveJsonToBrowserStorage(convertCriteriaToJSON());\n\t/*Redirect to the search page*/\n\tcreateNewTabWithURL(generateSearchURL());\n\t/*Close the Current Tab, as it has no need to be open, and avoid Tab Spam.*/\n\tcloseCurrentTab();\n}", "function runSearch() {\n\tinquirer.prompt({\n\t\tname: \"action\",\n\t\ttype: \"list\",\n\t\tmessage: \"What would you like to do?\",\n\t\tchoices: [\n\t\t\"View Products For Sale\",\n\t\t\"View Low Inventory\",\n\t\t\"Add To Inventory\",\n\t\t\"Add New Product\",\n\t\t]\n\t})\n\t.then(function(answer){\n\t\tswitch(answer.action) {\n\t\t\tcase \"View Products For Sale\":\n\t\t\tproductsForSale();\n\t\t\tbreak;\n\n\t\t\tcase \"View Low Inventory\":\n\t\t\tlowInventory();\n\t\t\tbreak;\n\n\t\t\tcase \"Add To Inventory\":\n\t\t\taddToInventory();\n\t\t\tbreak;\n\n\t\t\tcase \"Add New Product\":\n\t\t\taddNewProduct();\n\t\t\tbreak;\n\t\t}\n\t});\n}", "function search()\n{\n\tvar query = ($(\"#search\")[0]).value;\n\tcreateCookie('search', query, 1); /// Save the search query\n\tgoTo('index'); /// Go to index (search) page\n}", "function searchTerm(){\n \n }", "function displayNewSearchResults(event) {\n let searchTerm = event.target.value;\n let currentSearch = giphy[\"query\"][\"q\"];\n if (searchTerm !== currentSearch && searchTerm !== \"\") {\n giphy[\"query\"][\"q\"] = searchTerm;\n updateOffset(true);\n update();\n }\n}", "function userSearch() {\n\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do:\",\n choices: [\"View product sales by Department\", \"Create new department\", \"Exit Supervisor Mode\"]\n }\n\n ]).then(function (manager) {\n\n switch (manager.choice) {\n case \"View product sales by Department\":\n viewDepartments();\n break;\n \n case \"Create new department\":\n addNewDepartment();\n break;\n\n case \"Exit Supervisor Mode\":\n console.log(\"\\nSee ya later!\\n\");\n connection.end ();\n break;\n }\n\n });\n\n}", "async function handleAddSearch() {\n let newSavedSearch = savedsearch.concat([{ name: \"\", url: props.location.search }]);\n setSavedSearch(newSavedSearch);\n }", "function search(_event) {\r\n let inputName = document.getElementById(\"searchname\");\r\n let inputMatrikel = document.getElementById(\"searchmatrikel\");\r\n let query = \"command=search\";\r\n query += \"&nameSearch=\" + inputName.value;\r\n query += \"&matrikelSearch=\" + inputMatrikel.value;\r\n console.log(query);\r\n sendRequest(query, handleSearchResponse);\r\n }", "function menu_do_search() {\n\t// directly use the search page if it is active\n if (current === \"Special::Search\") {\n\t\td$('string_to_search').value = d$('menu_string_to_search').value;\n }\n woas.do_search(d$('menu_string_to_search').value);\n}", "function searchVenue(){\n\t\t$(\"#query\").click(function(){\n\t\t\t$(this).val(\"\");\n\t\t});\n\n\t\t$(\"#query\").blur(function(){\n\t\t\tif ($(this).val() == \"\") {\n\t\t\t\t$(this).val(\"Example: Ninja Japanese Restaurant\");\n\t\t\t}\n\t\t\n\t\t\tif ($(this).val() != \"Example: Ninja Japanese Restaurant\") {\n\t\t\t\t$(this).addClass(\"focus\");\n\t\t\t} else {\n\t\t\t\t$(this).removeClass(\"focus\");\n\t\t\t}\n\t\t});\n\n\t\t//Submit search query and call to getVenues\n\t\t$(\"#searchform\").submit(function(event){\n\t\t\tevent.preventDefault();\n\t\t\tif (!lat) {\n\t\t\t\tnavigator.geolocation.getCurrentPosition(getLocation);\n\t\t\t} else {\n\t\t\t\tgetVenues();\n\t\t\t}\t\t\n\t\t});\n\n\t}", "function search(e){\n e.preventDefault();\n searchCriteria.value == 'user' ? fetchUsersByName() : fetchReposByName()\n userList.innerHTML = ''\n form.reset();\n}", "function search() {\n var term = document.getElementById(\"searchterm\").value;\n var type = document.getElementById(\"searchtype\").value;\n\n window.location = \"../search/?term=\" + term + \"&type=\" + type;\n}", "function searchEventListener() {\n\t$(\"#searchbtn\").click(function() {\n\t\tif ($(\"#searchbox\").val() != '') {\n\t\t\tsearchNewspapers($(\"#searchbox\").val());\n\t\t}\n\t});\n}", "function search() {\r\n let searchTerm = id(\"search-term\").value.trim();\r\n if (searchTerm !== \"\") {\r\n id(\"home\").disabled = false;\r\n loadBooks(\"&search=\" + searchTerm);\r\n }\r\n }", "function ssearch_do_search() {\n\tvar search_string = d$(\"string_to_search\").value;\n\tif ( !search_string.length )\n\t\treturn;\n\twoas.do_search(search_string);\n}", "function setQuery(evt) {\n if (evt.keyCode == 13) {\n getResults(searchBox.value);\n }\n}", "function goSearch(){\r\n\tvar str;\r\n\tif(document.getElementById('q').value == \"Enter product name, company or keyword\"){\r\n\t\tparam = '';\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\tif(document.getElementById('q').value == \"\"){\r\n\t\tparam = '';\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n\t\tdocument.getElementById(\"search_top\").style.visibility = \"visible\";\r\n\t\t\r\n\t str = escape(document.getElementById('q').value);\t\r\n\t searchStr = document.getElementById('q').value;\r\n\t featureListPopulate();\r\n\t\r\n\r\n\t\tvar url = showTimeUrl+'?q='+str;\t\r\n\t\t\r\n\t\ttextNew = 'true';\r\n\t\r\n\t\tdocument.getElementById('txtHidden').value = param;\t\r\n\t\tdocument.getElementById('featureList').value = featureListString ;\r\n\t\tdocument.searchform.action =url ;\r\n\t\tdocument.searchform.submit();\t\r\n\t\t\t}\r\n\t\t}", "function handleSearchClick(){\r\n var temp = document.getElementById('searchText').value;\r\n fetchRecipesBySearch(temp);\r\n }", "function action_filter() {\n\tvar filter_criteria = {};\n\n\tvar search = $('#search').val().toLowerCase();\n\tfilter_document(search);\n\t\n\treturn false;\n}", "function submitSearch() {\n hitSelected = document.getElementsByClassName('aa-cursor')[0];\n\n if (hitSelected && searchQuery) {\n const articleUrl = hitSelected.querySelector('a').href;\n window.location.assign(articleUrl);\n } else if (!hitSelected && searchQuery && hits) {\n window.location.assign(`{{ site.url }}/search?query=${searchQuery}`);\n }\n }", "function basicsearch() {\n searchString = document.basicForm.basicText.value;\n searchTerms = searchString.split(/\\s/);\n\n putHeader();\n\n findResults();\n putResults();\n\n putFooter();\n\n writeResultsPage();\n}", "function addSearch(e) {\n e.preventDefault();\n\n createNewButton = true;\n\n //Stores city name entered as-is, then clears field\n let citySearchName = $('#search-city').val();\n $('#search-city').val('');\n\n //Formats and stores city name for api call\n let cityButtonRevised = citySearchName.trim().toLowerCase().split(' ').join('+');\n\n //Runs function for results section\n cityWeatherInformation(cityButtonRevised, citySearchName);\n}", "function searchFor(what){\n\tdocument.forms['searchForm'].elements['search'].value=what; // In case called from elsewhere we fill in the search field for referencing back to it.\n\tgo.click(); // this functionality is in bclp_ext_tabs.js as it is all done as part of the tabs object. It's the handler part of Ext.widget with id 'go'\n}", "function setQuery(e) {\n if (e.keyCode == 13) {\n getResults(searchBox.value);\n }\n}", "function userNormalSearch(e){\n\te.preventDefault();\n\tsearchTerm = $('#search').val().trim(); \n\tuserSearch();\n}", "function search() {\n\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"Choose what you would like to do:\",\n choices: options\n })\n\n .then(function (answer) {\n switch (answer.action) {\n case options[0]:\n viewDepartment();\n break;\n\n case options[1]:\n viewRole();\n break;\n\n case options[2]:\n viewEmp();\n break;\n\n case options[3]:\n updEmp();\n\n case options[4]:\n addDepartment();\n break\n\n case options[5]:\n addRole();\n break\n\n case options[6]:\n addEmp();\n break\n\n case options[7]:\n connection.end();\n break\n }\n })\n}", "function newSearch(req,res){\n // console.log(req.query );\n res.render('pages/index');\n}", "function newSearch(request, response) {\n response.render('pages/searches/new');\n}", "function executeSearch() {\n\tlet user_input = $('#class-lookup').val().toUpperCase();\n\t\t\n\t// clears search results\n\t$('#search-return').empty();\n\n\t// display search hint when input box is empty\n\tif (user_input == \"\"){\n\t\t$('#search-return').append(emptySearchFieldInfo());\n\t}\n\t\n\tfor (course in catalog) {\n\t\t\n\t\t// user input describes a course code\n\t\tif (user_input == course) {\n\t\t\t$('#search-return').append(createCourseContainer(course));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// user input describes a department code\n\t\tif (user_input == catalog[course]['department']) {\n\t\t\t$('#search-return').append(createCourseContainer(course));\n\t\t}\n\t\t\n\t}\n\t\n\t// display a message if no results is returned\n\tif ($('#search-return').children().length == 0) {\n\t\t$('#search-return').append(`<li style='border: 3px solid black;'>\n\t\t\t\t\t\t\t\t\t\t<h3>Sorry, we couldn't find what you were looking for.</h3>\n\t\t\t\t\t\t\t\t\t</li>`)\n\t}\n}", "onSearch(e) {\n let term = e.target.value;\n // Clear the current projects/samples selection\n this.props.resetSelection();\n this.props.search(term);\n }", "function search() {\n\tvar query = $(\".searchfield\").val();\n\tif (query == \"\") {\n\t\tdisplaySearchResults(\"\", data, data);\n\t}\n\telse {\n\t\tvar results = idx.search(query);\n\t\tdisplaySearchResults(query, results, data);\n\t\tga('send', 'event', 'Search', 'submit', query);\n\t}\n}", "function displaySearchResult(search) {\n window.location.replace(\"?=\" + food + \"\");\n }", "function _triggerSearch() {\n Mediator.pub(\n CFG.CNL.DICTIONARY_SEARCH,\n (_searchIsActive ? _$search.val() : \"\")\n );\n }", "function setQuery(event) {\n if (event.keyCode === 13) {\n getResults(searchbox.value);\n }\n}", "function search() {\n\turl = \"search.php?term=\" +document.getElementById('term').value;\n\turl+= \"&scope=\" + document.getElementById('scope').value;\n\tdocument.getElementById('search').innerHTML = \"\";\n\tdoAjaxCall(url, \"updateMain\", \"GET\", true);\n}", "search() {\n this.send('searchWithParams', this.buildSearchQuery());\n }", "afterSearch(searchText, result) {\n }", "function search() {\n\t\t// clear the current contacts list\n\t\twhile (parent.lastChild)\n\t\t\tparent.removeChild(parent.lastChild);\n\t\txhttp.open(\"POST\", \"http://students.engr.scu.edu/~adiaztos/resources/contacts.php?query=\" + document.getElementById(\"searchField\").value, true);\n\t\txhttp.send();\t\n\t}", "function initiate_search() {\n let values = $('#repo').val().split('/').filter(Boolean);\n let len = values.length;\n\n if (len < 1) {\n $('#' + UF_ID_MSG).html('Please enter a valid query: it should contain two strings separated by a \"/\"');\n return; // abort\n }\n\n disable_btn();\n clear_old_data();\n request_fork_page(1, values[len-2], values[len-1], token);\n}", "function makeSearchQuery() {\n var active_tab = $('.add_to_search-form .tab-buttons li.active a').attr('href');\n\n if (active_tab === '#simple-search') {\n var current_query = $.trim(searchQueryField.val())\n var new_part = getSimpleQuery()\n setSearchFieldValue(mergeQuery(current_query, new_part))\n cleanSimpleQueryForm()\n } else {\n addAdvancedQueryToSearch()\n $('.add_to_search-form .appender').trigger('click')\n }\n }", "function searchCall() {\n $('#searchButton').click(function () {\n var qString = $('#searchInput').val();\n bindSearchUrl(qString);\n });\n\n $('#searchInput').keypress(keypressHandler);\n }", "function getInput() {\n\t\t\tsearchBtn.addEventListener('click', () => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsearchTerm = searchValue.value.toLowerCase();\n\t\t\t\tconsole.log(searchTerm);\n\t\t\t\tresults.innerHTML = ''; // clear page for new results\n\t\t\t\tgetData(searchTerm); // run w/ searchTerm\n\t\t\t\tformContainer.reset();\n\t\t\t});\n\t\t}", "function clickSearchBox(object){\n let searchText = document.querySelector(\".form-inline input[type='text']\").value;\n document.location = page.RESULT + '?searchWords='+searchText.toLowerCase();\n}", "function searchProduct(){\r\n \r\n var go = \"Thing(?i)\";\r\n \r\n submitProduct(go); \r\n \r\n }", "function search(data){\n setSearch(data); \n }", "function setQuery(event){ // If enter is press store value in getResults()\n if(event.keyCode == 13){\n getResults(searchBox.value);\n }\n}", "function handleSearchEvent() {\n const newData = filterStudents(searchValue);\n showPage(newData, 1);\n addPagination(newData);\n}", "function SearchForm() {\n\n}", "searchinputCallback(event) {\n const inputVal = this.locationInput;\n if (inputVal) {\n this.getListQuery(inputVal);\n }\n else {\n this.queryItems = [];\n if (this.userSelectedOption) {\n this.userQuerySubmit('false');\n }\n this.userSelectedOption = '';\n if (this.settings.showRecentSearch) {\n this.showRecentSearch();\n }\n else {\n this.dropdownOpen = false;\n }\n }\n }", "function onSearchKeyPress(e) {\n switch (e.keyCode) {\n case 38:\n // up arrow\n updateSuggestion(currentSuggestion - 1)\n break\n case 40:\n // down arrow\n updateSuggestion(currentSuggestion + 1)\n break\n case 13:\n // enter. it'll submit the form, but let's unfocus the text box first.\n inputElmt.focus()\n break\n default:\n nextSearch = searchBox.value\n var searchResults = viewer.runSearch(nextSearch, true)\n searchSuggestions.innerHTML = \"\"\n currentSuggestion = -1\n suggestionsCount = 0\n addWordWheelResults(searchResults.front)\n addWordWheelResults(searchResults.rest)\n }\n }", "function search( event, searchTerms ){\n //console.debug( this, 'searching', searchTerms );\n $( this ).trigger( 'search:searchInput', searchTerms );\n if( typeof options.onfirstsearch === 'function' && firstSearch ){\n firstSearch = false;\n options.onfirstsearch( searchTerms );\n } else {\n options.onsearch( searchTerms );\n }\n }", "function search( event, searchTerms ){\n //console.debug( this, 'searching', searchTerms );\n $( this ).trigger( 'search:searchInput', searchTerms );\n if( typeof options.onfirstsearch === 'function' && firstSearch ){\n firstSearch = false;\n options.onfirstsearch( searchTerms );\n } else {\n options.onsearch( searchTerms );\n }\n }", "function userSearch(){\n var newInput = input.val();\n geocode(newInput, MAPBOX_TOKEN).then(function (result){\n lng = result[0];\n lat = result[1];\n marker.setLngLat([lng, lat]);\n map.flyTo({\n center: [lng, lat],\n essential: true,\n zoom: 9\n })\n weatherMap();\n })\n }", "function handleSubmit(event) {\n event.preventDefault()\n selectionContext.performSearch()\n }", "function Search() {\n switch (userInput) {\n case \"spotify-this-song\":\n spotifyThisSong();\n break;\n case \"movie-this\":\n movieThis();\n break;\n case \"concert-this\":\n concertThis();\n break;\n case \"do-what-it-says\":\n doWhatItSays();\n break;\n }\n\n}", "function Search_what()\n {\n //assigning id's to variables for easier access\n var goo_check = $(\"#Google\");\n var edx_check = $(\"#edX\");\n var youtube_check = $(\"#UTube\");\n var gmail_check = $(\"#GMail\");\n var wiki_check = $(\"#Wiki\");\n\n //storing the query in a vaiable\n var query = $(\"#query\").val();\n\n //do something only if query exists\n if(query != \"\" && query != undefined)\n {\n //wikipedia search\n if(wiki_check.is(':selected'))\n {\n window.open(\"https://en.wikipedia.org/wiki/\"+ encodeURI(query) , '_blank');\n }\n //edX search\n if(edx_check.is(':selected'))\n {\n window.open(\"https://www.edx.org/course?search_query=\"+ encodeURI(query), '_blank');\n }\n //YouTube search\n if(youtube_check.is(':selected'))\n {\n window.open(\"https://www.youtube.com/results?search_query=\"+ encodeURI(query), '_blank');\n }\n //Google search\n if(goo_check.is(':selected'))\n {\n window.open(\"https://www.google.ca/#q=\"+ encodeURI(query), '_blank');\n }\n //GMail search\n if(gmail_check.is(':selected'))\n {\n window.open(\"https://mail.google.com/mail/u/0/#advanced-search/has=\"+ encodeURI(query), '_blank');\n }\n return true;\n }\n\n return false;\n\n\n }", "onSearch(value) {\n this.model.query = value;\n }", "onSearch(value) {\n this.model.query = value;\n }", "function getInput(event){\n event.preventDefault();\n var searchQuery;\n searchQuery = ($(searchBox).val());\n console.log(searchQuery);\n var ytUrl =`https://youtube.googleapis.com/youtube/v3/search?type=video&part=snippet&maxResults=25&q=${searchQuery}\\\\+'+travel'+'&key=AIzaSyDD9MbkIVSzT2a3sOv97OecaqhyGdF174c`;\n searchVideos(ytUrl);\n\n var key = `AIzaSyDWNMiooGhkXMAhnoTL8pudTR83im36YPo`;\n \n var bookUrl = `https://www.googleapis.com/books/v1/volumes?q=${searchQuery}\\\\+travel+guide&key=${key}`;\n searchBooks(bookUrl);\n}", "function handleSubmit() {\n //Take the search term string entered by the user in the input field, add it to the baseUrl, make a fetch request to that new url, and append the results of what we searched for to the DOM in the correct element, wrapped in li tags\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n }", "function submit() {\n getWeather();\n event.preventDefault();\n if (pastSearch.indexOf(search.value) === -1) {\n pastSearch.push(search.value);\n localStorage.setItem(\"pastSearch\", JSON.stringify(pastSearch));\n }\n}", "function handleSearchAttempt (e) {\n var _query;\n\n // If there's no index, exit immediately and re-initialise:\n if (typeof _links !== 'object' || !Array.isArray(_links) || !_links) { return init(); }\n\n // Prevent default submit behaviour\n typeof e !== 'undefined' && e.preventDefault();\n\n // Retrieve the search query from the input element\n _query = e.target.querySelector('input').value;\n\n // Suffice it to say that we should quit if there's no query\n if (typeof _query !== 'string' || !_query) { return; }\n\n displaySearchResults(_query, getSearchResults(_query, _links));\n return false;\n }", "function dosearch() {\n window.searchtext = $(\"#searchbox\").val();\n $.ajax({\n url: \"/mainsearch/?searchtext=\" + window.searchtext,\n success: function (result) {\n onsuccess(result);\n }\n });\n }", "function runSearch() {\n inquirer\n .prompt({\n name: 'action',\n type: 'list',\n message: 'What action would you like to perform?',\n choices: [\n 'Add new department?',\n 'Add new Employee role?',\n 'Add new Employee?',\n 'View different departments?',\n 'View all Employee roles?',\n 'View all Employees?',\n // 'Update Employee?',\n 'Exit Application?'\n ]\n })\n .then(function (answer) {\n switch (answer.action) {\n case 'Add new department?':\n addDepartment();\n break;\n\n case 'Add new Employee role?':\n addRole();\n break;\n\n case 'Add new Employee?':\n addEmployee();\n break;\n\n case 'View different departments?':\n viewDepartment();\n break;\n\n case 'View all Employee roles?':\n viewRoles();\n break;\n\n case 'View all Employees?':\n viewEmloyees();\n break;\n\n // case 'Update Emloyee?':\n // updateEmloyees();\n // break;\n\n case 'Exit Application?':\n console.log('Press: Ctrl + C')\n break;\n }\n })\n}", "function moreSearch(){\r\n\r\n\tvar str;\r\n\r\n\tif(document.getElementById('s').value == \"\"){\r\n\t\talert(\"Please enter a product name, company or keyword\");\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n \t\t\t\r\n\t str = escape(document.getElementById('s').value);\t\r\n\t searchStr = document.getElementById('s').value;\r\n\t //alert(\"searchStr :\"+searchStr);\r\n\t featureListPopulate();\r\n\t \r\n\r\n\t\t\r\n\t\tvar url = showTimeUrl+'?q='+str;\t\r\n\t\tdocument.searchform1.action =url ;\r\n\t\ttextNew = 'true';\r\n\t\t\r\n\t\tdocument.getElementById('txtHidden1').value = param;\r\n\t\tdocument.getElementById('featureList1').value = featureListString ;\r\n\t\tdocument.searchform1.submit();\t\r\n\t}\r\n\r\n}", "function makeSearch() {\n var query = $('#search-line').val();\n if (query.length < 2) {\n return null;\n }\n\n // cleanup & make AJAX query with building response\n $('#ajax-result-items').empty();\n $.getJSON(script_url+'/api/search/index?query='+query+'&lang='+script_lang, function (resp) {\n if (resp.status !== 1 || resp.count < 1)\n return;\n var searchHtml = $('#ajax-carcase-item').clone().removeClass('hidden');\n $.each(resp.data, function(relevance, item) {\n var searchItem = searchHtml.clone();\n searchItem.find('#ajax-search-link').attr('href', site_url + item.uri);\n searchItem.find('#ajax-search-title').text(item.title);\n searchItem.find('#ajax-search-snippet').text(item.snippet);\n $('#ajax-result-items').append(searchItem.html());\n searchItem = null;\n });\n $('#ajax-result-container').removeClass('hidden');\n });\n }", "function handleSearchSubmit(event) {\n event.preventDefault()\n setQuery(event.target.search.value)\n history.push('/search')\n }", "function search() {\n // Clear search results when user types in a new name\n $('#search-container').empty();\n\n // Search this text field's value after user types in and hits return\n var q = $('#search-field').val();\n\n var request = gapi.client.youtube.search.list({\n q: q,\n part: 'snippet'\n });\n // Send the request to the API server,\n // and invoke onSearchRepsonse() with the response.\n request.execute(onSearchResponse);\n}", "function runSearch(e) {\n if (e.target.value === \"\") {\n // On empty string, remove all search results\n // Otherwise this may show all results as everything is a \"match\"\n applySearchResults([]);\n } else {\n const tokens = e.target.value.split(\" \");\n const moddedTokens = tokens.map(function (token) {\n // \"*\" + token + \"*\"\n return token;\n })\n const searchTerm = moddedTokens.join(\" \");\n const searchResults = idx.search(searchTerm);\n const mapResults = searchResults.map(function (result) {\n const resultUrl = docMap.get(result.ref);\n return { name: result.ref, url: resultUrl };\n })\n\n applySearchResults(mapResults);\n }\n\n}", "function newSearch(request, response) {\n response.render(\"pages/index\");\n}", "function searchOne()\n{\n\ttry{\n \n keyword = $('input[name=advanced_search_keyword]').val();\n\t\tkeyword = encodeURIComponent(keyword);\n\t\twindow.keyword = '\"'+keyword+'\"';\n\t\twindow.page =1;\n\n\t if(getUrlVars()['page'] != undefined){\n\t\t window.page = getUrlVars()['page'];\n\t }\n \n\t\twindow.filters= new Array();\n\t\tajaxSearch();\n\t\treturn false;\n\t}\n\tcatch(e)\n\t{\n\t\talert(e);\n\t}\n}", "search(e) {\n //NOTE You dont need to change this method\n e.preventDefault();\n try {\n SongsService.getMusicByQuery(e.target.query.value);\n } catch (error) {\n console.error(error);\n }\n }", "function searchUser() {\n $state.go('users', {searchInput: vm.searchInput});\n vm.searchInput = '';\n }", "function post_search(req, res) {\n console.log(req.body);\n Model3d.find_by_string(req.body.search_bar, function(err, docs) {\n if (err) {\n res.send(\"something went wrong\");\n }\n else {\n res.render('navigation/search', {models: docs, selected: \"Search Results\" });\n }\n });\n}", "function searchCheck() {\n switch(searchType) {\n case \"my-tweets\":\n\tmyTweets();\n\tbreak;\n case \"spotify-this-song\":\n\tcheckName();\n\tbreak;\n case \"movie-this\":\n checkName();\n\tbreak;\n case \"do-what-this-says\":\n\trandomSearch();\n\tbreak;\n }\n}", "function pageChange() {\n\tsubmitSearch(true);\n}", "function setQuery() {\n getSearch(search.value);\n}", "function searchResultsHandler() {\r\n $('.input-form').submit(e => {\r\n e.preventDefault();\r\n const userQuery = $('#user-query').val();\r\n const userResultsNumber = $('#user-number-results').val() || '10';\r\n clearInputs();\r\n getSearchResults(userQuery, userResultsNumber);\r\n });\r\n}", "function search(){\n let query;\n if(searchLocation===\"location\"){\n searchLocation(\"\")\n }\n query=`https://ontrack-team3.herokuapp.com/students/search?location=${searchLocation}&className=${searchClass}&term=${searchName}` \n prop.urlFunc(query);\n }", "function do_search() {\n var query = input_box.val().toLowerCase();\n\n if(query && query.length) {\n if(selected_token) {\n deselect_token($(selected_token), POSITION.AFTER);\n }\n\n if(query.length >= settings.minChars) {\n show_dropdown_searching();\n clearTimeout(timeout);\n\n timeout = setTimeout(function(){\n run_search(query);\n }, settings.searchDelay);\n } else {\n hide_dropdown();\n }\n }\n }", "function do_search() {\n var query = input_box.val().toLowerCase();\n\n if(query && query.length) {\n if(selected_token) {\n deselect_token($(selected_token), POSITION.AFTER);\n }\n\n if(query.length >= settings.minChars) {\n show_dropdown_searching();\n clearTimeout(timeout);\n\n timeout = setTimeout(function(){\n run_search(query);\n }, settings.searchDelay);\n } else {\n hide_dropdown();\n }\n }\n }", "function handleSearchKeystroke(event) {\r\n searchText = document.getElementById('search').value.toLowerCase().trim();\r\n let matchingBooks = allBooks.filter(book => book.title.toLowerCase().includes(searchText) || book.author.toLowerCase().includes(searchText));\r\n removeBooksFromDOM();\r\n matchingBooks.forEach(function (book) {\r\n insertNewBook(book.id, book.title, book.author, book.subject, book.photoURL, book.vendorURL, book.favorite);\r\n });\r\n applyEventListeners();\r\n}", "submitSearch() {\n console.log('Searching for repositories...');\n function prevDefault(e) {\n e.preventDefault();\n };\n}", "function query(term) {\n $(\"#SearchBox\").val(term);\n search(term);\n $.pageslide.close();\n }", "function search() {\n\tclearEventSpecificInfo();\n\t// Fetch address from the set location box.\n\t// If default or blank, use the home address.\n\tvar address = $('#set_location_box').val();\n\tif (address == 'Address, City, State or Zip' || address == '') {\n\t\taddress = currentAddress;\n\t}\n\tif (geocoder) {\n geocoder.geocode (\n \t{'address': address},\n \tfunction(results, status) {\n \tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\tvar location = results[0].geometry.location;\n\t\t\t\t\tstoreMyLocation(location.lat(), location.lng());\n\t\t\t\t\tinitChores();\n \t}\n }\n );\n\t}\n}" ]
[ "0.72698194", "0.72546387", "0.71110857", "0.70512104", "0.70338523", "0.69484234", "0.6932106", "0.69215333", "0.68896186", "0.6871552", "0.68326414", "0.68288755", "0.6780364", "0.6779372", "0.67776084", "0.6774904", "0.677374", "0.67706937", "0.6769311", "0.6756711", "0.672847", "0.67194235", "0.67022073", "0.6684527", "0.6675547", "0.6653372", "0.66420144", "0.6612136", "0.6605806", "0.6593", "0.6589712", "0.6589578", "0.6584469", "0.6581608", "0.6577058", "0.65598", "0.6557367", "0.65457356", "0.6540032", "0.653272", "0.6529008", "0.65286547", "0.6511574", "0.6501892", "0.64954805", "0.649347", "0.648668", "0.6482151", "0.64813846", "0.645861", "0.6438445", "0.64353615", "0.6431201", "0.64262515", "0.64229524", "0.64188975", "0.64128304", "0.6410166", "0.6409072", "0.6402954", "0.63933694", "0.63892055", "0.63846034", "0.63824433", "0.6382117", "0.6382117", "0.637774", "0.63717157", "0.6370881", "0.63609934", "0.63606787", "0.63606787", "0.63528335", "0.63514423", "0.63512766", "0.6351102", "0.6345143", "0.63379425", "0.6336102", "0.6335403", "0.632724", "0.6326624", "0.6321503", "0.63159776", "0.6314389", "0.631337", "0.6312375", "0.6311458", "0.63082623", "0.63023967", "0.63018614", "0.6299252", "0.62992173", "0.6294391", "0.6293544", "0.6293544", "0.6292608", "0.62887126", "0.628861", "0.6288522" ]
0.64309365
53
1. Get form info on submit and store in a variable...
function watchForm() { $("#search-form").submit((e) => { e.preventDefault(); let cityName = $("#city").val(); let stateName = $("#state").val(); getMissingPerson(cityName, stateName); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFormRequest() {\n var $inputs = $('.demo-form :input');\n var values = captureFormData($inputs);\n var url;\n // submitRequest(values, url);\n}", "function getFormValues() {\n\tname = document.getElementById(\"name\").value;\n\temail = document.getElementById(\"email\").value;\n\tsubject = document.getElementById(\"subject\").value;\n\tmessage = document.getElementById(\"message\").value;\n}", "function get_form_data() {\n var data = {};\n data[\"out\"] = $(\"#outcome-resp\").val();\n data[\"int\"] = $(\"#intervention-resp\").val();\n data[\"cmp\"] = $(\"#comparator-resp\").val();\n data[\"ans\"] = getCheckBoxSelection();\n data[\"res\"] = $(\"#reasoning-resp\").val();\n data[\"xml\"] = $(\"#reasoning-resp\").attr('xml_offsets');\n return data;\n}", "function getFormValuesAndDisplayResults() {\n}", "function getForm() {\n return questionForm;\n}", "function getFormState() {\n var fields = document.getElementsByTagName('form')[0].elements;\n if (fields.length == 0){return};\n for (var i = 0; i <= fields.length-1; i++) {\n var name = fields[i].getAttribute('name');\n if (name in localStorage && localStorage[name] !== null) {\n fields[i].value = localStorage[name];\n }\n }\n}", "function getFormValues(){\n var form = document.getElementById (\"the_form\");\n var todo = form.elements.task.value;\n return {task: todo}; \n}", "function formSubmitted(e) {\n e.preventDefault();\n const nameForm = document.getElementById('name-form');\n const nameFormData = new FormData(nameForm);\n const firstName = nameFormData.get('firstname');\n console.log(firstName);\n console.log('form submitted');\n}", "function submitForm(){\n\tvar name = document.getElementById('name');\nvar number = document.getElementById('number');\n\tconsole.log('name: ' + name.value);\n\tconsole.log('phone number: ' + number.value);\n\n} // end submitForm", "get form() {\n return this.internals.form;\n }", "get form() {\n return this.internals.form;\n }", "get form() {\n return this.internals.form;\n }", "function form_handler(form) {\n\n form.submit(function(e) {\n\n e.preventDefault();\n\n var email = form.find(\"input[name=email]\").val();\n var confirmation = $(form.data('on-submit-show'));\n var salesforce_source = \"website\";\n\n analytics.identify(email, _.reduce(form.find(\"input,textarea\"), function(acc, el) {\n\n acc[$(el).attr(\"name\")] = $(el).val();\n return acc;\n\n }, {\n\n \"LeadSource\": salesforce_source,\n \"path\": window.location.toString()\n\n }), {\n\n 'Salesforce': true\n\n });\n\n form.addClass(\"hide\");\n confirmation.removeClass(\"hide\");\n\n modal_resize();\n\n return false;\n\n });\n\n }", "function submitForm() {\n\tvar args\t\t= submitForm.arguments;\n\tvar argLength\t= args.length;\n\tif (argLength > 0) {\n\t\tvar form = args[0];\n\n\t\t// skipping first argument since it is form object\n\t\tfor (var i=1; i<argLength; i+=2) {\n\n\t\t\t// hidden_field.value = <value>\n\t\t\targs[i].value = args[i+1];\n\t\t}\n\t\tform.submit();\n\t}\n}", "get form() {\n return this.internals_.form;\n }", "get form() {\n return this.internals_.form;\n }", "function getInfo(form) {\r\n form.info.value = \"Browser Information: \" + navigator.userAgent;\r\n}", "function get_form_data(form) {\n var values = {};\n $.each($(form).serializeArray(), function(i, field) {\n values[field.name] = field.value;\n });\n return values;\n}", "function trackForm(){\n\tgoogleAnalytics.trackForm(getformTrackerName());\n}", "function getFormValues() { \n\t\tvar firstname = document.getElementById(\"form1\").fname.value;\n\t\tvar lastname = document.getElementById(\"form1\").lname.value;\n\t\tconsole.log(firstname + \" \" + lastname);\n\t}", "function send_specific_info_into_db(form_submit){\t\t\n\t\t$(form_submit).submit(function(evt){\n\t\tvar article_id = $('#edit_article_container').attr('rel');\n\t\t\t//alert(article_id);\n\t\tevt.preventDefault();\n\t\tvar postData = $(this).serialize();\n\t\tvar url = $(this).attr('action');\n\t\t\t$.post(url, postData, function(php_table_data){\n\t\t\t\twindow.location = 'preview.php?article_id=' + article_id;\n\t\t\t});\n\t\t});\t\n\t}", "function logSubmit(event){\n log.textContent = `Form submitted! Time Stump: ${event.timeStamp}`;\n event.preventDefault();\n let formData = new FormData(event.target);\n console.log(formData);\n console.log(event);\n console.log(\"formData.get(name)\", formData.get(\"name\"));\n}", "function getFormValue ( form_name, field_name )\n {\n\tvar elt = document.forms[form_name][field_name];\n\n\tif ( elt && elt.type && elt.type == \"checkbox\" )\n\t return elt.checked;\n\n\telse if ( elt )\n\t return elt.value;\n\n\telse\n\t return \"\";\n }", "function submit() {\n saveForm(applicant)\n}", "function handle_form(form_name, submit_name, result_tgt) {\n var submit_action = function(e) {\n e.preventDefault();\n $.ajax({\n url: $(form_name).attr('action'),\n method: $(form_name).attr('method'),\n data: $(form_name).serialize(),\n beforeSend: spinner(result_tgt),\n }).done(function(data){$(result_tgt).empty().html(data);});\n };\n $(form_name).submit(submit_action);\n $(submit_name).click(submit_action);\n}", "function getFormValues(){\n\nsignupInfo.email = document.getElementById('email').value;\nsignupInfo.username = document.getElementById('username').value;\nsignupInfo.password = document.getElementById('password').value;\nsignupInfo.firstName = document.getElementById('firstName').value;\nsignupInfo.lastName = document.getElementById('lastName').value;\n\nsendToApi ();\n}", "function formSubmitted(){\n getCurrentNumbers();\n setConfirmationMessage();\n}", "async function handleOnSubmit(e) {\n e.preventDefault();\n const formData = {};\n // Object with properties associated with the names of each field and their value\n Array.from(e.currentTarget.elements).map((field) => {\n if (!field.name) return;\n formData[field.name] = field.value;\n });\n\n //fetch form data\n fetch(\"/api/referral\", {\n method: \"post\",\n body: JSON.stringify(formData),\n });\n\n console.log(formData);\n }", "function getFormVariables() {\n return [$(\"#art_name\").val(),\n $(\"#id_field\").val(),\n $(\"#birthyear\").val(),\n $(\"#img_url\").val()\n ]\n}", "function submitClicked () {\n retrieveInput();\n changePage();\n}", "function processForm(evt) {\n}", "function getFormData(form) {\n const email = form.querySelector(\"#email\");\n const msg = form.querySelector(\"#message\");\n return { email: email.value, msg: msg.value };\n }", "function get_form_data() {\n\t\tvar inputs = $('form').find('.form-group').find('input, textarea');\n\t\tvar data = {};\n\t\tinputs.each(function(index, input) {\n\t\t\tvar $input = $(input);\n\t\t\tif ($input.attr('type') === 'checkbox') {\n\t\t\t\tdata[$input.attr('name')] = $input.is(':checked');\n\t\t\t} else {\n\t\t\t\tdata[$input.attr('name')] = $input.val();\n\t\t\t}\n\t\t});\n\t\treturn data;\n\t}", "function feedbackForm() {\n form.addEventListener(\"submit\", e => pushNewFeedback(e))\n}", "function submitForm () {\n\n\t\t\t// Add submitting state\n\t\t\tform.setAttribute('data-submitting', true);\n\n\t\t\t// Send the data to the MailChimp API\n\t\t\tsendData(serializeForm(form));\n\n\t\t}", "function getFormValues() {\n\t\t// function to send first and last names\n\t\t// to an 'alert' message.\n\t\t\n\t\tvar fname= document.getElementById('fname').value;\n\t\tvar lname= document.getElementById('lname').value;\n\t\talert(\"First name: \" +fname+\" \"+\"Last name: \"+lname);\n\t\t \n\t}", "function submitInfo() {\n\tdocument.getElementById(\"infoDisplay\").style.display = \"none\"; //hide infoDisplay until info is validated\n\t\n\t//run validation functions\n\tvalidateFname();\n\tvalidateLname();\n\tvalidateEmail();\n\t//convert object/array to strings\n\tconvertToString();\n\t\n\t//if info validates, display info collected\n\tif ((emailValid === true) && (fnameValid === true) && (lnameValid === true)){\n\t\tdocument.getElementById(\"errorMsg\").style.display = \"none\";\n\t\tdisplayInfo();\n\t}\n}", "function validateForm() {\r\n var email = document.forms[\"contactForm\"][\"email\"].value;\r\n var submit = document.forms[\"contactForm\"][\"submit\"].value;\r\n if (email ==\"\") {\r\n alert(\"EMAIL IS REQUIRED\");\r\n } else if (submit >=\"\") {\r\n alert(\"THANK YOU!\");\r\n }\r\n\r\n\r\n//The copy of submission form appears on the console, which includes: name, address, phone, & email.\r\n\r\n var name= document.getElementById(\"name\").value;\r\n var address= document.getElementById(\"address\").value;\r\n var phone= document.getElementById(\"phone\").value;\r\n var email= document.getElementById(\"email\").value;\r\n\r\n console.log(name);\r\n console.log(address);\r\n console.log(phone);\r\n console.log(email); \r\n\r\n }", "submit() {\n const namedFieldNode = this.$['form-fields'].assignedNodes()\n .filter(node => node.hasAttribute && node.hasAttribute(\"name\"));\n\n const allValid = this.novalidate || namedFieldNode.every(node => node.validate ? node.validate() : true);\n\n if (allValid) {\n const reqData = namedFieldNode.reduce((result, node) => {\n const key = node.getAttribute('name');\n const value = node.value;\n result[key] = value;\n return result;\n }, {});\n const method = (this.method || '').toUpperCase();\n if(method === 'GET') {\n this._get(reqData);\n } else if(method === 'POST') {\n this._post(reqData);\n } else {\n throw new TypeError(`Unsupported method: ${this.method}`);\n }\n }\n }", "function form1(){\n var form = {\n fname: document.getElementById('fname').value,\n lname: document.getElementById('lname').value,\n email: document.getElementById('email').value,\n password: document.getElementById('password').value,\n }\n \n console.log(\"Account Information \", form)\n}", "function getValues(form) {\n processCheckbox(form);\n processSelect(form);\n processInput(form);\n processTextarea(form);\n setDateTime(helpData);\n if (helpData.kind === 'need') {\n getTime(form)\n }\n helpData.userName = $(\"#username\").val();\n return helpData;\n}", "function getForm() {\n inputNombre.value = localStorage.getItem('nombre');\n inputApellido.value = localStorage.getItem('apellido');\n inputTel.value = localStorage.getItem('tel');\n inputDir.value = localStorage.getItem('dir');\n inputObs.value = localStorage.getItem('obs');\n console.log('data loaded');\n}", "function submitForm() {\r\n var args = {};\r\n args.Email = session.forms.emarsyssignup.emailAddress.value;\r\n args.EmarsysSignupPage = true;\r\n args.SubscriptionType = \"footer\";\r\n args.SubscribeToEmails = true;\r\n args.Map = EmarsysNewsletter.MapFieldsSignup(); // map the form fields\r\n // send form to processing\r\n processor(args);\r\n}", "function onSubmit(){\n //Concurrency programming - multiple people could potentiall submit the form at the same time!\n var lock = LockService.getScriptLock()\n try {\n lock.waitLock(30000) // Wait for up to 30 seconds for another form to be processed\n }catch(e) {\n // Handle lock exception\n Logger.log('Could not obtain lock after 30 seconds.')\n }\n\n //Update form description. isProcessingComplete = false\n updateFormDescription(false)\n\n //1. Assign new question ID\n assignQuestionID()\n\n //2. Copy Data from Existing Survey, or Update Form Item options and automatically append new entries\n if(isExistingSurvey()){\n copyDataFromExistingSurvey()\n } else {\n updateFormItem(EXISTING_SURVEY_POLL_NAME, POLL_NAME)\n updateFormItem(POLLING_GROUP)\n }\n\n //3. Update the two other relational worksheets\n updateOptionsWorksheet()\n updateKeywordsWorksheet()\n\n //Update form description. isProcessingComplete = true\n updateFormDescription(true)\n\n lock.releaseLock()\n}", "function getFormData(form) {\n var data = {};\n $(form).find('input, select').each(function() {\n if (this.tagName.toLowerCase() == 'input') {\n if (this.type.toLowerCase() == 'checkbox') {\n data[this.name] = this.checked;\n } else if (this.type.toLowerCase() != 'submit') {\n data[this.name] = this.value;\n }\n } else {\n data[this.name] = this.value;\n }\n });\n return data;\n}", "onSubmit() {\n console.log(\"submit form\");\n }", "function formValues() {\n var data = {};\n traceLib.stored.forEach(function(field) {\n data[field] = $('#' + field).val() || '';\n });\n return data;\n}", "function getDataForm(form) {\n var $form = $(form);\n var formData = {\n firstName: $form.find('input[name=\"firstName\"]').val(),\n lastName: $form.find('input[name=\"lastName\"]').val(),\n email: $form.find('input[name=\"email\"]').val(),\n password: $form.find('input[name=\"password\"]').val(),\n password_again: $form.find('input[name=\"password_again\"]').val(),\n institution: $form.find('input[name=\"institution\"]').val(),\n country: $form.find('select[name=\"country\"]').val(),\n occupation: $form.find('input[name=\"occupation\"]').val(),\n interest: $form.find('textarea[name=\"interest\"]').val()\n };\n return formData;\n}", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), a = $form.attr2('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), a = $form.attr2('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'),\n a = $form.attr2('action'),\n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target', id);\n if (!method || /post/i.test(method)) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function () {\n timedOut = true;cb(CLIENT_TIMEOUT_ABORT);\n }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log('Server abort: ', e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push($('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">').val(s.extraData[n].value).appendTo(form)[0]);\n } else {\n extraInputs.push($('<input type=\"hidden\" name=\"' + n + '\">').val(s.extraData[n]).appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n } else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState, 15);\n\n try {\n form.submit();\n } catch (err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n } finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action', a);\n form.setAttribute('enctype', et); // #380\n if (t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function serializeForm() {\r\n var inputFields = $(mainElement).find('form :input');\r\n var result = {};\r\n $.each(inputFields, function (index, value) {\r\n if ($(value).attr('name')) {\r\n result[$(value).attr('name')] = $(value).val();\r\n }\r\n });\r\n return result;\r\n }", "function handleFormSubmit(e) {\n e.preventDefault();\n\n // This checks if the request form has blank values\n // for text fields and buttons\n checkIfFormUnfilled(formObject, \"radio\");\n\n function checkIfFormUnfilled(obj, buttonType) {\n let formFilledOutRight = true;\n // Check buttons\n var inputs = document.getElementsByTagName(\"input\");\n // buttonsBoolean is for selection validation\n // buttonSelected is for tip value validation\n let buttonsBoolean = [];\n let buttonSelected = [];\n for (var i = 0; i < inputs.length; i++) {\n if (inputs[i].type.toLowerCase() === buttonType) {\n buttonsBoolean.push(inputs[i].checked);\n if (inputs[i].checked === true) {\n buttonSelected.push(inputs[i]);\n }\n }\n }\n\n // if none are clicked, show modal\n if (!buttonsBoolean.includes(true)) {\n document.getElementById(\"warning-radio-button-button\").click();\n formFilledOutRight = false;\n }\n \n // checks tip value against minimum of selected button\n if (buttonSelected[0].id === \"generalRequest\") {\n if (formObject.tip < event.generalRequestTipMin) {\n document.getElementById(\"warning-minimum-tip-button\").click();\n formFilledOutRight = false;\n }\n } else {\n if (formObject.tip < event.playNowTipMin) {\n document.getElementById(\"warning-minimum-tip-button\").click();\n formFilledOutRight = false;\n }\n }\n \n // Check form fields\n for (var key in obj) {\n // if one is blank, show modal\n if (obj[key] === null || obj[key] === \"\") {\n document.getElementById(\"warning-form-button\").click();\n formFilledOutRight = false;\n }\n }\n\n // To album cover function\n if (formFilledOutRight) {\n getAlbumCover(formObject.title, formObject.artist);\n }\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), a = $form.attr2('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), a = $form.attr2('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), a = $form.attr2('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr2('target'), \n a = $form.attr2('action'), \n mp = 'multipart/form-data',\n et = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method || /post/i.test(method) ) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n }\n if (io.attachEvent) {\n io.attachEvent('onload', cb);\n }\n else {\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n\n try {\n form.submit();\n } catch(err) {\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n form.setAttribute('enctype', et); // #380\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "_getForm(shortcode) {\n var snippet = encodeURIComponent(this.activeSnippet);\n var url = this.formUrl.replace('[name]', shortcode);\n var data = { shortcode: snippet };\n\n $.ajax({ url: url, data: data }).done(function(response) {\n if (this.activeShortcode == shortcode) {\n this.$form.html(response);\n this.$form.foundation();\n\n this.$form.find('form').on('submit', function(event) {\n event.preventDefault();\n });\n\n this.formValues = this.$form.find('form').serialize();\n this._loadPreview({ type: 'init' });\n }\n }.bind(this));\n }", "function getFormValues(){\r\n\tvar values=\"\",eType,element;\r\n\tvar elements=hatsForm.elements;\r\n\tfor (var i=0,iL=elements.length; i<iL; ++i){\r\n\t\tvar elementVal = \"\";\r\n\t\telement=elements[i];\r\n\t\teType=element.type;\r\n\t\tvar computeValue = true;\r\n\t\tif ((eType == \"radio\") ||(eType == \"checkbox\"))\r\n\t\t\tcomputeValue = element.checked;\r\n\t\tif(computeValue){\r\n\t\t\tif (appletInitialized && document.HATSApplet){\r\n\t\t\t\telementVal = document.HATSApplet.encode(element.value,document.charset);\r\n\t\t\t}else if(window.encodeURIComponent){\r\n\t\t\t\telementVal = encodeURIComponent(element.value);\r\n\t\t\t}else if (window.escape){\r\n\t\t\t\telementVal = escape(element.value);\r\n\t\t\t}\r\n\t\t\tvalues += \"&\" + element.name + \"=\" + elementVal;\r\n\t\t}\r\n\t}\r\n\treturn values;\r\n}", "function processForm(){\n\t\tvar name = formHandle.name;\n\t\tvar email = formHandle.email;\n\t\tvar comment = formHandle.comment;\n\t\tvar thanksMsgDiv = document.getElementById(\"section-div2\");\n\t\t//Validation\n\t\tif(name.value===\"\")\n\t\t{\n\t\t\tname.style.background=\"red\";\n\t\t\tname.focus();\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\tif(email.value===\"\")\n\t\t{\n\t\t\temail.style.background=\"red\";\n\t\t\temail.focus();\n\t\t\treturn false;\n\t\t}\n\t\tif(comment.value===\"\")\n\t\t{\n\t\t\tcomment.style.background=\"red\";\n\t\t\tcomment.focus();\n\t\t\treturn false;\n\t\t}\n\t\tformHandle.classList.add(\"section-div2\");\n\t\tthanksMsgDiv.innerHTML=\"<p>Thank you!! \" + name.value +\" </p>\" + \"<span>Your message has been sent.</span> \"\n\t\t\n\t}", "function onSubmit() {\n $(g).attr('disabled', true);\n var formArray= $(\"form\").serializeArray();\n var data={};\n for (index in formArray){\n data[formArray[index].name]= formArray[index].value;\n }\n sendAjaxQuery('/submit', data);\n event.preventDefault();\n}", "function afterSubmit(data) {\r\n\t var form = data.form;\r\n\t var wrap = form.closest('div.w-form');\r\n\t var redirect = data.redirect;\r\n\t var success = data.success;\r\n\r\n\t // Redirect to a success url if defined\r\n\t if (success && redirect) {\r\n\t Webflow.location(redirect);\r\n\t return;\r\n\t }\r\n\r\n\t // Show or hide status divs\r\n\t data.done.toggle(success);\r\n\t data.fail.toggle(!success);\r\n\r\n\t // Hide form on success\r\n\t form.toggle(!success);\r\n\r\n\t // Reset data and enable submit button\r\n\t reset(data);\r\n\t }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n \n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').attr('value',s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').attr('value',s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n form.submit();\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n \n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').attr('value',s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').attr('value',s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n form.submit();\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n \n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').attr('value',s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').attr('value',s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n form.submit();\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function doSubmit() {\n // make sure form attrs are set\n var t = $form.attr('target'), a = $form.attr('action');\n\n // update form attrs in IE friendly way\n form.setAttribute('target',id);\n if (!method) {\n form.setAttribute('method', 'POST');\n }\n if (a != s.url) {\n form.setAttribute('action', s.url);\n }\n\n // ie borks in some cases when setting encoding\n if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {\n $form.attr({\n encoding: 'multipart/form-data',\n enctype: 'multipart/form-data'\n });\n }\n\n // support timout\n if (s.timeout) {\n timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n }\n\n // look for server aborts\n function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }\n\n // add \"extra\" data to form if provided in options\n var extraInputs = [];\n try {\n if (s.extraData) {\n for (var n in s.extraData) {\n if (s.extraData.hasOwnProperty(n)) {\n // if using the $.param format that allows for multiple values with the same name\n if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+s.extraData[n].name+'\">').val(s.extraData[n].value)\n .appendTo(form)[0]);\n } else {\n extraInputs.push(\n $('<input type=\"hidden\" name=\"'+n+'\">').val(s.extraData[n])\n .appendTo(form)[0]);\n }\n }\n }\n }\n\n if (!s.iframeTarget) {\n // add iframe to doc and submit the form\n $io.appendTo('body');\n if (io.attachEvent)\n io.attachEvent('onload', cb);\n else\n io.addEventListener('load', cb, false);\n }\n setTimeout(checkState,15);\n // just in case form has element with name/id of 'submit'\n var submitFn = document.createElement('form').submit;\n submitFn.apply(form);\n }\n finally {\n // reset attrs and remove \"extra\" input elements\n form.setAttribute('action',a);\n if(t) {\n form.setAttribute('target', t);\n } else {\n $form.removeAttr('target');\n }\n $(extraInputs).remove();\n }\n }", "function pokemonForm() {\n return document.querySelector('form')\n}", "function Form(form) {\n var self = this;\n this.form = form;\n this.inputs = this.form.querySelectorAll('[name]');\n this.submitBtn = this.form.querySelector('button');\n\n this.canSubmit = function () {\n var regex = {\n text: /^.+$/,\n textarea: /.+/,\n email: /^[^@\\s]+@[^@\\s\\.]+\\.[\\w\\.]+$/\n };\n var canSubmit = true;\n for (var i = 0; i < self.inputs.length; i++) {\n var input = self.inputs[i];\n if (input.required && regex[input.type] && !regex[input.type].test(input.value)) {\n input.classList.add('animated');\n input.classList.remove('headShake');\n waitFrame((function (_input) {\n return function () {\n _input.classList.add('headShake');\n };\n })(input));\n canSubmit = false;\n } else\n input.classList.remove('headShake');\n }\n return canSubmit;\n };\n\n this.submit = function () {\n if (!self.canSubmit())\n return;\n window.clientName = document.getElementById('name').value;\n var xhr;\n if (window.XMLHttpRequest) {\n xhr = new XMLHttpRequest();\n } else {\n xhr = new ActiveXObject('Microsoft.XMLHTTP');\n }\n xhr.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n router.go('/thankyou/');\n var name = document.querySelector('#submiterName');\n if (name)\n name.innerHTML = ' ' + window.clientName + '. Y';\n }\n };\n var data = '?';\n for (var i = 0; i < this.inputs.length; i++) {\n var input = this.inputs[i];\n if (input.value !== '')\n if (i === 0)\n data += input.name + '=' + input.value;\n else\n data += '&' + input.name + '=' + input.value;\n }\n console.log(data);\n xhr.open('POST', '/static/inc/submitform.php' + encodeURI(data), true);\n xhr.send();\n };\n\n this.submitBtn.addEventListener('click', function (evt) {\n evt.preventDefault();\n self.submit();\n });\n}", "function make_string_for_submit()\n{\n\tif (_browser.supportsLayers)\n\t{\n\t\tvar prop_layer = document.layers[\"prop_layer\"];\n\t\tif (typeof prop_layer == \"object\" && prop_layer != null)\n\t\t{\n\t\t\tvar prop_form = prop_layer.document.forms[\"prop_form\"];\n\t\t\tif (typeof prop_form == \"object\" && prop_form != null)\n\t\t\t{\n\t\t\t\tvar tmpstr = \"\";\n\t\t\t\tfor (var e = 0; e < prop_form.elements.length; e++)\n\t\t\t\t{\n\t\t\t\t\tif (prop_form.elements[e].value.length > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (tmpstr.length > 0)\n\t\t\t\t\t\t\ttmpstr += \"&\";\n\n\t\t\t\t\t\ttmpstr += prop_form.elements[e].name + \"=\" + prop_form.elements[e].value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar main_form = document.forms[\"main_form\"];\n\t\t\t\tif (typeof main_form == \"object\" && main_form != null)\n\t\t\t\t\tmain_form.elements[\"INPUT_FIELDS_TO_PARSE\"].value = tmpstr;\n\t\t\t}\n\t\t}\n\t}\n}", "fillForm() {\n\n if (localStorage.getItem(\"lastname\") !== undefined)\n $(\"form\")[0].lastname.value = localStorage.getItem(\"lastname\");\n\n if (localStorage.getItem(\"firstname\") !== undefined)\n $(\"form\")[0].firstname.value = localStorage.getItem(\"firstname\");\n\n }", "function getFormValues() {\n\n if ($.textFieldName.value.length == 0) {\n alert(\"Name is required\");\n return;\n }\n var formValues = {\n name: $.textFieldName.value,\n content: $.textFieldContent.value ? $.textFieldContent.value : ''\n };\n\n return formValues;\n}", "function tiendaGetFormInputData(form) {\r\n\tvar str = new Array();\r\n\tfor ( i = 0; i < form.elements.length; i++) {\r\n\t\tpostvar = {\r\n\t\t\tname : form.elements[i].name,\r\n\t\t\tvalue : form.elements[i].value,\r\n\t\t\tchecked : form.elements[i].checked,\r\n\t\t\tid : form.elements[i].id\r\n\t\t};\r\n\t\tstr[i] = postvar;\r\n\t}\r\n\treturn str;\r\n}", "function onSubmitFileSaveForm() {\n return fileSaveForm.form('validate');\n }", "function processProcedure() {\n var form = document.forms[0];\n if (hasEmptyFields(form)) {\n alert('Es müssen alle Felder ausgefüllt werden!\\nDie Texte dürfen außerdem keine Sonderzeichen enthalten!');\n return;\n }\n var submitForm = document.forms[1];\n submitForm.elements[1].value = form.elements['name'].value;\n submitForm.elements[2].value = generateJson(form);\n submitForm.submit();\n}", "function formSubmitted(e) {\n\n var action = e.target.getAttribute('action');\n\n if (action[0] === '#') {\n e.preventDefault();\n trigger('POST', action, e, serialize(e.target));\n }\n }", "submitForm(){\n\t\tlet instance = this;\n\t\tconst\tdata = JSON.stringify({\n\t\t\tinterest: instance.dropdownData.interest,\n\t\t\tloan: instance.calculatorData,\n\t\t\tnumberOfMonths: instance.dropdownData.months,\n\t\t\ttotalDebt: instance.debt\n\t\t});\n\t\t\n\t\t\n\t\tfetch(instance.endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json, text/plain, */*',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: data\n\t\t}).then(resp => resp.json())\n\t\t\t.then(({status}) => instance.showFormMessage(status))\n\t\t\t.catch(err => instance.showFormMessage(`something wrong. Please contact the administrator.`, true))\n\t}", "function registerSubmit(form) {\r\n var name = checkName(form);\r\n var email = checkEmail(form);\r\n var password = checkPassword(form);\r\n var confirm = checkConfirm(form);\r\n var date = checkDate(form);\r\n \r\n return (name && email && date && password && confirm);\r\n}", "function form_contents() {\n var form = $$('form').first();\n \n var form_els = form.getElements().reject(function(el) {\n return $w(\"_method authenticity_token\").include(el.name);\n });\n var url_encoded = form_els.collect(function(el) {\n return(el.name + \"=\" + el.value);\n });\n \n return url_encoded.join(\"&\");\n}", "function handleFormSubmission(event) {\n //this preventDefault tells the DOM\n // when you click on a button on a form or div that click propogates up each element has a default action\n // prevent default prevents the default action of the element\n // event.stopPropagation - prevents the event from going up the chain\n event.preventDefault();\n // console.log(event.target.elements);\n const {elements} = event.target;\n const class_name = elements[\"name\"].value;\n const date_started = elements[\"date_started\"].value;\n const date_ended = elements[\"date_ended\"].value;\n onSubmit({class_name, date_started, date_ended});\n}", "function watchForm() {\r\n //Listen for a submit on the button\r\n $('form').submit(event => {\r\n event.preventDefault();\r\n const ticker = $('#js-ticker').val();\r\n\r\n getNews(ticker);\r\n getQuote(ticker);\r\n });\r\n }", "function submit_fillter(){\n\n\t}", "function handleSubmit(e) {\n e.preventDefault();\n console.log(formState);\n }", "function handleSubmit(e) {\n e.preventDefault();\n console.log(formState);\n }", "function afterSubmit(data) {\n var form = data.form;\n var wrap = form.closest('div.w-form');\n var redirect = data.redirect;\n var success = data.success;\n\n // Redirect to a success url if defined\n if (success && redirect) {\n Webflow.location(redirect);\n return;\n }\n\n // Show or hide status divs\n data.done.toggle(success);\n data.fail.toggle(!success);\n\n // Hide form on success\n form.toggle(!success);\n\n // Reset data and enable submit button\n reset(data);\n }", "function formPOST(){\n\n\tthis.submit();\n\n}", "function snapshotForm(theForm) {\n var snapshotTxt = '';\n var elemList = theForm.elements;\n var elem;\n var elemType;\n\n for( var i = 0; i < elemList.length ; i++ ) {\n elem = elemList[i];\n if ( typeof(elem.type) == 'undefined' ) {\n continue;\n }\n\n elemType = elem.type.toLowerCase();\n\n snapshotTxt = snapshotTxt + elem.name;\n\n if ( elemType == 'text' || elemType == 'textarea' || elemType == 'password' ) {\n snapshotTxt = snapshotTxt + elem.value;\n }\n else if ( elemType == 'select' || elemType == 'select-one' || elemType == 'select-multiple' ) {\n var optionList = elem.options;\n for ( var ii = 0 ; ii < optionList.length ; ii++ ) {\n if ( optionList[ii].selected ) {\n snapshotTxt = snapshotTxt + optionList[ii].value;\n }\n }\n }\n else if ( elemType == 'radio' || elemType == 'checkbox' ) {\n if ( elem.selected ) {\n snapshotTxt = snapshotTxt + 'checked';\n }\n }\n else if ( elemType == 'hidden' ) {\n if (elem.name=='edit_all_recurrences') {\n continue;\n }\n\n snapshotTxt = snapshotTxt + elem.value;\n }\n }\n\n return snapshotTxt;\n}", "function aboutForm() {\n //import data from the html form as varaibles\n var firstName = document.getElementById('first_name').value;\n var lastName = document.getElementById('last_name').value;\n var email = document.getElementById('email').value;\n var hearAbout = document.getElementById('about_choices').value;\n var message = document.getElementById('message').value;\n\n //prints each variable to the console with some text saying what each value is\n console.log(\"First Name: \" + firstName);\n console.log(\"Last Name: \" + lastName);\n console.log(\"Email: \" + email);\n console.log(\"How did you hear about us: \" + hearAbout);\n console.log(\"Message: \" + message);\n}", "function doSubmit() {\n\t\t\t\t// make sure form attrs are set\n\t\t\t\tvar t = $form.attr2('target'),\n\t\t\t\t\ta = $form.attr2('action'),\n\t\t\t\t\tmp = 'multipart/form-data',\n\t\t\t\t\tet = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n\t\t\t\t// update form attrs in IE friendly way\n\t\t\t\tform.setAttribute('target', id);\n\t\t\t\tif (!method || /post/i.test(method)) {\n\t\t\t\t\tform.setAttribute('method', 'POST');\n\t\t\t\t}\n\t\t\t\tif (a !== s.url) {\n\t\t\t\t\tform.setAttribute('action', s.url);\n\t\t\t\t}\n\n\t\t\t\t// ie borks in some cases when setting encoding\n\t\t\t\tif (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n\t\t\t\t\t$form.attr({\n\t\t\t\t\t\tencoding : 'multipart/form-data',\n\t\t\t\t\t\tenctype : 'multipart/form-data'\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// support timout\n\t\t\t\tif (s.timeout) {\n\t\t\t\t\ttimeoutHandle = setTimeout(function() {\n\t\t\t\t\t\ttimedOut = true; cb(CLIENT_TIMEOUT_ABORT);\n\t\t\t\t\t}, s.timeout);\n\t\t\t\t}\n\n\t\t\t\t// look for server aborts\n\t\t\t\tfunction checkState() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\n\n\t\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\n\t\t\t\t\t\tif (timeoutHandle) {\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// add \"extra\" data to form if provided in options\n\t\t\t\tvar extraInputs = [];\n\n\t\t\t\ttry {\n\t\t\t\t\tif (s.extraData) {\n\t\t\t\t\t\tfor (var n in s.extraData) {\n\t\t\t\t\t\t\tif (s.extraData.hasOwnProperty(n)) {\n\t\t\t\t\t\t\t\t// if using the $.param format that allows for multiple values with the same name\n\t\t\t\t\t\t\t\tif ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">', ownerDocument).val(s.extraData[n].value)\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">', ownerDocument).val(s.extraData[n])\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!s.iframeTarget) {\n\t\t\t\t\t\t// add iframe to doc and submit the form\n\t\t\t\t\t\t$io.appendTo($body);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (io.attachEvent) {\n\t\t\t\t\t\tio.attachEvent('onload', cb);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tio.addEventListener('load', cb, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tsetTimeout(checkState, 15);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tform.submit();\n\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t// just in case form has element with name/id of 'submit'\n\t\t\t\t\t\tvar submitFn = document.createElement('form').submit;\n\n\t\t\t\t\t\tsubmitFn.apply(form);\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\t\t\t\t\t// reset attrs and remove \"extra\" input elements\n\t\t\t\t\tform.setAttribute('action', a);\n\t\t\t\t\tform.setAttribute('enctype', et); // #380\n\t\t\t\t\tif (t) {\n\t\t\t\t\t\tform.setAttribute('target', t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$form.removeAttr('target');\n\t\t\t\t\t}\n\t\t\t\t\t$(extraInputs).remove();\n\t\t\t\t}\n\t\t\t}", "function doSubmit() {\n\t\t\t\t// make sure form attrs are set\n\t\t\t\tvar t = $form.attr2('target'),\n\t\t\t\t\ta = $form.attr2('action'),\n\t\t\t\t\tmp = 'multipart/form-data',\n\t\t\t\t\tet = $form.attr('enctype') || $form.attr('encoding') || mp;\n\n\t\t\t\t// update form attrs in IE friendly way\n\t\t\t\tform.setAttribute('target', id);\n\t\t\t\tif (!method || /post/i.test(method)) {\n\t\t\t\t\tform.setAttribute('method', 'POST');\n\t\t\t\t}\n\t\t\t\tif (a !== s.url) {\n\t\t\t\t\tform.setAttribute('action', s.url);\n\t\t\t\t}\n\n\t\t\t\t// ie borks in some cases when setting encoding\n\t\t\t\tif (!s.skipEncodingOverride && (!method || /post/i.test(method))) {\n\t\t\t\t\t$form.attr({\n\t\t\t\t\t\tencoding : 'multipart/form-data',\n\t\t\t\t\t\tenctype : 'multipart/form-data'\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// support timout\n\t\t\t\tif (s.timeout) {\n\t\t\t\t\ttimeoutHandle = setTimeout(function() {\n\t\t\t\t\t\ttimedOut = true; cb(CLIENT_TIMEOUT_ABORT);\n\t\t\t\t\t}, s.timeout);\n\t\t\t\t}\n\n\t\t\t\t// look for server aborts\n\t\t\t\tfunction checkState() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\n\n\t\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\n\t\t\t\t\t\tif (timeoutHandle) {\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// add \"extra\" data to form if provided in options\n\t\t\t\tvar extraInputs = [];\n\n\t\t\t\ttry {\n\t\t\t\t\tif (s.extraData) {\n\t\t\t\t\t\tfor (var n in s.extraData) {\n\t\t\t\t\t\t\tif (s.extraData.hasOwnProperty(n)) {\n\t\t\t\t\t\t\t\t// if using the $.param format that allows for multiple values with the same name\n\t\t\t\t\t\t\t\tif ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + s.extraData[n].name + '\">', ownerDocument).val(s.extraData[n].value)\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\textraInputs.push(\n\t\t\t\t\t\t\t\t\t$('<input type=\"hidden\" name=\"' + n + '\">', ownerDocument).val(s.extraData[n])\n\t\t\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!s.iframeTarget) {\n\t\t\t\t\t\t// add iframe to doc and submit the form\n\t\t\t\t\t\t$io.appendTo($body);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (io.attachEvent) {\n\t\t\t\t\t\tio.attachEvent('onload', cb);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tio.addEventListener('load', cb, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tsetTimeout(checkState, 15);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tform.submit();\n\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t// just in case form has element with name/id of 'submit'\n\t\t\t\t\t\tvar submitFn = document.createElement('form').submit;\n\n\t\t\t\t\t\tsubmitFn.apply(form);\n\t\t\t\t\t}\n\n\t\t\t\t} finally {\n\t\t\t\t\t// reset attrs and remove \"extra\" input elements\n\t\t\t\t\tform.setAttribute('action', a);\n\t\t\t\t\tform.setAttribute('enctype', et); // #380\n\t\t\t\t\tif (t) {\n\t\t\t\t\t\tform.setAttribute('target', t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$form.removeAttr('target');\n\t\t\t\t\t}\n\t\t\t\t\t$(extraInputs).remove();\n\t\t\t\t}\n\t\t\t}", "function getFormData() {\n var elements = document.getElementById(\"gform\").elements; // all form elements\n var fields = Object.keys(elements).map(function(k) {\n if (elements[k].name !== undefined) {\n return elements[k].name;\n // special case for Edge's html collection\n } else if (elements[k].length > 0) {\n return elements[k].item(0).name;\n }\n }).filter(function(item, pos, self) {\n return self.indexOf(item) == pos && item;\n });\n var data = {};\n fields.forEach(function(k) {\n data[k] = elements[k].value;\n if (elements[k].type === \"checkbox\") {\n data[k] = elements[k].checked;\n // special case for Edge's html collection\n } else if (elements[k].length) {\n for (var i = 0; i < elements[k].length; i++) {\n if (elements[k].item(i).checked) {\n data[k] = elements[k].item(i).value;\n }\n }\n }\n });\n return data;\n}", "function getFormContents(form) {\n var data = $(form).serializeArray(), attributes = {};\n\n for(var key in data) {\n if(data.hasOwnProperty(key)) {\n var innerKey = data[key].name\n attributes[innerKey] = data[key].value\n }\n }\n\n return attributes;\n}", "function getFormValues (myForm){\r\n var myParms = \"\";\r\n for (var i = 0, d, v; i < myForm.elements.length; i++) {\r\n d = myForm.elements[i];\r\n if (d.name && d.value) {\r\n v = (d.type == \"checkbox\" || d.type == \"radio\" ? (d.checked ? d.value : '') : d.value);\r\n if (v) myParms += d.name + \"=\" + escape(v) + \"&\";\r\n }\r\n }\r\n myParms = myParms.substr(0,myParms.length-1);\r\n // alert(\"myParms = \" + myParms);\r\n return myParms;\r\n}", "function formSubmit(event) {\n\t// Prevent the form from reverting back to the default setting\n\tevent.preventDefault()\n\tvar passName = addName()\n\n\t// If all fields have been filled in correctly\n\tif (addName() == true && addUsername() == true && addEmail() == true) {\n\t\t// Call the gallery.html page! Success!\n\t\twindow.location.href = \"gallery.html\" + passName;\n\t};\n\n}" ]
[ "0.66617185", "0.6638421", "0.65942526", "0.64928544", "0.64516973", "0.6430104", "0.638016", "0.63558596", "0.63539", "0.6343344", "0.6343344", "0.6343344", "0.63425773", "0.6336309", "0.63136727", "0.6305972", "0.6293514", "0.625471", "0.6251539", "0.6249465", "0.62489104", "0.62471557", "0.62370706", "0.6194763", "0.6162407", "0.6141342", "0.611868", "0.6117555", "0.611233", "0.610678", "0.60943925", "0.6081001", "0.60306853", "0.60305125", "0.60304546", "0.60267425", "0.6010424", "0.60097164", "0.6008252", "0.6000735", "0.5992563", "0.59917927", "0.59851813", "0.59718823", "0.5968181", "0.59553444", "0.59378153", "0.59366196", "0.59354675", "0.59354675", "0.59334457", "0.5932286", "0.59301156", "0.5920424", "0.5920424", "0.5920424", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.5917356", "0.59157485", "0.5910949", "0.59062546", "0.5903111", "0.5897364", "0.5894416", "0.5894416", "0.5894416", "0.58930904", "0.58866626", "0.5876433", "0.58565503", "0.5856106", "0.5856048", "0.58463836", "0.583961", "0.5833999", "0.58326817", "0.5829425", "0.58292884", "0.58225775", "0.58192766", "0.58176804", "0.58133054", "0.58101237", "0.58101237", "0.5808269", "0.5801502", "0.58012867", "0.5797564", "0.57916605", "0.57916605", "0.57887703", "0.5782301", "0.5779932", "0.5779268" ]
0.0
-1
Loads the songs list data.
@action.bound async loadSongsList() { this.isLoading = true; try { const payload = { songName: this.filterSongName || null, artistName: this.filterArtistName || null, minGrade: this.filterGradesRange[0], maxGrade: this.filterGradesRange[1] }; const fetchedSongsList = await this.songsRepository.getSongsList(payload); this.songsList.clear(); this.songsList.push(...fetchedSongsList); } catch (e) { console.error(e); } finally { this.isLoading = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSongs() {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n for (var i = 0; i < songArray.length; i++) {\n var para = document.createElement('P');\n var t = document.createTextNode(songArray[i]);\n para.appendChild(t);\n document.querySelector('.songs').appendChild(para);\n }\n}", "function loadData(){\r\n data = {};\r\n\r\n // transfer songs\r\n data.songs = dataToLoad.songs;\r\n\r\n // generate playlists\r\n data.playlists = [];\r\n for(var i = 0; i < dataToLoad.playlists.length; ++i){\r\n data.playlists[i] = {};\r\n data.playlists[i].title = dataToLoad.playlists[i].title;\r\n data.playlists[i].songs = [];\r\n for(var j = 0; j < dataToLoad.playlists[i].songs.length; ++j){\r\n data.playlists[i].songs.push(getSong(dataToLoad.playlists[i].songs[j]));\r\n }\r\n }\r\n\r\n // generate artist playlists\r\n data.artists = [];\r\n for(var i = 0; i < data.songs.length; ++i){\r\n\r\n var a = getArtist(data.songs[i].artist);\r\n\r\n // artist doesnt exist\r\n if(a == -1){\r\n\r\n // create artist \r\n var artist = {\r\n title: data.songs[i].artist,\r\n songs: []\r\n }\r\n data.artists.push(artist);\r\n\r\n // add song \r\n artist.songs.push(data.songs[i]);\r\n\r\n } \r\n // artist exists \r\n else {\r\n // add song \r\n data.artists[a].songs.push(data.songs[i]); \r\n }\r\n }\r\n\r\n // sort artists\r\n sortByTitle(data.artists);\r\n}", "loadSongs(songs) {\n for (var song of songs)\n {\n this.addSong(song, \"end\");\n }\n }", "static async read() {\n let json = (await IO.parseFileJSON(Paths.FILE_SONGS)).list;\n let l = json.length;\n this.list = new Array(l);\n let i, j, m, n, jsonHash, k, jsonList, jsonSong, id, list, song;\n for (i = 0; i < l; i++) {\n jsonHash = json[i];\n k = jsonHash.k;\n jsonList = jsonHash.v;\n // Get the max ID\n m = jsonList.length;\n n = 0;\n for (j = 0; j < m; j++) {\n jsonSong = jsonList[j];\n id = jsonSong.id;\n if (id > n) {\n n = id;\n }\n }\n // Fill the songs list\n list = new Array(n + 1);\n for (j = 0; j < n + 1; j++) {\n jsonSong = jsonList[j];\n if (jsonSong) {\n id = jsonSong.id;\n song = new System.Song(jsonSong, k);\n if (k !== SongKind.Sound) {\n song.load();\n }\n if (id === -1) {\n id = 0;\n }\n list[id] = song;\n }\n }\n this.list[k] = list;\n }\n }", "async function loadSongs() {\n for await (const song of dbmanager.getAllSongs()) {\n win.webContents.send(\"add-song-to-list\", song);\n }\n}", "function loadMusicData() {\n API.getMusicAPI()\n .then(res =>\n setMusicData(res.data)\n // (allPerformances = res.data)\n )\n .catch(error => console.log(error));\n }", "_loadSongs(selectContainer) {\n const PATH='https://fullstackccu.github.io/homeworks/hw4/songs.json';\n const onJsonReady=(json)=>{\n this.songList=json;\n this._createSongs(selectContainer);\n };\n\n fetch(PATH)\n .then(response => response.json())\n .then(onJsonReady);\n }", "function getSongList(){\n\t\t\tSongSheetAPI.index(\n\t\t\t\tfunction success(data){\n\t\t\t\t\tconsole.log('success', data);\n\t\t\t\t\t$scope.songSheets = data;\n\t\t\t\t},\n\t\t\t\tfunction error(data){\n\t\t\t\t\tconsole.log('error', data);\n\t\t\t\t}\n\t\t\t);\n\t\t}", "function listSongs () {\n $.getJSON(\"/songs\", function(songs){\n $.each(songs, function(index, song) {\n var the_song = new Song(song)\n $(\"#song_list\").append(the_song.formatSong())\n })\n })\n}", "function preloadSongs(data) {\r\n $('#songsTab').html(\"\");\r\n for (var i = 0; i < data.songs.length; i++) {\r\n $('#addModalTitle').text('Edit playlist');\r\n $('#songsTab').append(`\r\n <form class=\"song\">\r\n <label>Name: <input name=\"name\" class=\"newSongName\" value=\"`+data.songs[i].name+`\"></input></label>\r\n <label>Url: <input name=\"url\" class=\"newSongUrl\" value=\"`+data.songs[i].url+`\"></input></label><br>\r\n </form>`);\r\n $('#submitPlaylist').hide();\r\n $('#saveEdits').show();\r\n };\r\n }", "function loadPlaylistData(player, result) {\n player_playlist[player].remove();\n\n var playlistItems = [];\n for (var i = 0; i < result.length; i++) {\n playlistItems.push({\n title: (result[i].name.length > 50 ? (result[i].name.substring(0, 50) + \"...\") : result[i].name),\n name: result[i].name,\n mp3: result[i].path,\n id: result[i].id\n });\n }\n player_playlist[player].setPlaylist(playlistItems);\n}", "function loadData(listName) {\n\t\t//load the shopping lists collection from local storage\n\t\tshoppingLists = JSON.parse(localStorage.getItem(\"shoppingLists\"));\n\t\t//set the current working list \n\t\tsessionList = shoppingLists[listName];\n\n\t\t//call the function to display the list on screen, but set save to false since local storage is up to date\n\n\n\t\tsessionList.forEach(function(item) {\n\t\t\taddItem(item, false);\n\t\t});\n}", "function loadPlaylistData() {\n\t\t// clear any old info\n\t\t$(\"#playlist\")\n\t\t\t.empty()\n .append(\"<option value='select'>(Select playlist)</option>\")\n .val(\"select\");\n\t\n\t\t// populate playlist dropdown\n\t\tvar userLib = Library.forCurrentUser();\n\t\tuserLib.playlists.snapshot().done(function (snapshot) {\n\t\t\tvar l = snapshot.length;\n\t\t\tfor (var i = 0; i < l; i++) {\n\t\t\t\tvar playlist = snapshot.get(i);\n\t\t\t\t$(\"#playlist\").append($(\"<option />\").val(i).text(playlist.name));\n\t\t\t}\n\t\t});\n\t}", "function loadSongsToDOM() {\n console.log(\"loading songs\");\n $(\".uiContainer--wrapper\").html(\"\");\n db.getSongs()\n .then(function(songData) {\n console.log(\"raw data\", songData);\n var idArr = Object.keys(songData);\n console.log(\"idArr\", idArr);\n idArr.forEach(function(key) {\n songData[key].id = key;\n });\n console.log(\"songs objects with id added\", songData);\n let songList = templates.makeSongList(songData);\n $(\".uiContainer--wrapper\").html(songList);\n });\n}", "function init(data) {\n songs = data;\n var html = '<ol>';\n data.forEach(song => {\n html += \"<li>\" + song.url + '<button onclick=\"addSong('+song.id+')\">Add</button><button onclick=\"loadSong('+song.id+')\">Play</button><br></li>';\n });\n html += \"</ol>\"\n var mainContent = document.getElementById(\"main-content\");\n if (mainContent) {\n mainContent.innerHTML = html;\n console.log(\"songs have been initialized\");\n }\n}", "constructor(PlaylistID, PlaylistName, LoadedSongsList, PLbar) {\n this.PlaylistID = PlaylistID;\n this.PlaylistName = PlaylistName;\n this.LoadedSongsList = LoadedSongsList\n this.PLbar = PLbar\n this.songsIDs = [];\n this.songsNames = [];\n this.loadSongsInPlaylist()\n }", "function loadPlaylist(){\n let playlistID = this.dataset.id; // this.dataset is an object containing all attributes with \"data-\" before\n spotupdtr.getMissingTracks(playlistID); // Fetching the missing tracks of the playlist\n}", "function loadPlayerList() {\n Player_v.all({order: 'id'}, function(err, results) {\n var players = [];\n var player = {};\n player.player_name = 'Not Selected';\n player.id = \"\";\n players[0] = player;\n\n if(results.length > 0) {\n for (var i = 0; i < results.length; i++) {\n // create a brand new instance of player object for every record. One cannot reuse the same player variable.\n var player = { player_name: results[i].first_name + \" \" + results[i].last_name + \"-\" + results[i].city + \"/\" + results[i].state_or_province,\n id: results[i].id};\n players.push(player);\n }\n } // end of if.\n\n this.player_list = players;\n\n next(); // process the next tick.\n }.bind(this));\n}", "function loadPlaylist() {\n myPlayer.catalog.getPlaylist('4450721964001', function(error, playlist) {\n myPlayer.catalog.load(playlist);\n playlistLength = myPlayer.playlist().length;\n });\n }", "function getCustomSongs(i) {\n\t/* get songs list from json file */\n\t$.getJSON(\"songs.json\", function(data){\n\t\tplaylistsData[\"custom\"] = {\"id\": \"custom\", \"title\": \"Custom songs\"};\n\t\tplaylistsData[\"custom\"][\"songs\"] = data;\t\n\t\tcreatePlaylist();\n\t});\n}", "loadData(state, lists) {\n state.lists = lists;\n }", "function loadLists() {\n\tloadEquipmentSlots();\n\tloadNpcList();\n}", "function loadSong(song) {\n\t$(window).scrollTop(0);\n\t$('label,ul,ol,p').hide();\n\tvar activity = stlfFilter('songs')[0];\n\tvar data = activity.songs[song];\n\t$('#name').html(song);\n\t$('[name=\"index\"]').val(song);\n\t$('#lyrics').empty();\n\tfor (var l in data) $('#lyrics').append('<li>' + (data[l] || '<br>') + '</li>');\n\t$('#lyrics').show();\n\t\n\t$(document).off('click').on('click','#save',function(event) {\n\t\tsaveSong();\n\t}).on('click','#discard',function(event) {\n\t\tif (window.top != window.self) {\n\t\t\twindow.top.$('body').css('overflow','');\n\t\t\twindow.top.$('iframe').remove();\n\t\t}\n\t});\n}", "function loadTrackList(callback) {\n xmlhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n var myObj = JSON.parse(this.responseText);\n trackList = myObj;\n callback(trackList);\n }\n }\n \n // open sets up the request and send() sends it\n xmlhttp.open(\"GET\", \"https://raw.githubusercontent.com/LyricalDaddy/LyricalDaddy.github.io/master/assets/songs/SongDB.json\", true);\n xmlhttp.send();\n}", "function initSongList() {\n songs.forEach((song) => {\n const li = document.createElement(\"li\");\n li.classList.add(\"list\");\n\n li.innerHTML = `\n <img\n src=\"${song.cover}\"\n alt=\"Cover\"\n class=\"list-cover\"\n />\n <div class=\"list-info\" data-id=\"${song.id}\">\n <h2 class=\"song-title\">${song.name}</h2>\n <h3 class=\"song-artist\">${song.artist}</h3>\n </div>\n `;\n songList.appendChild(li);\n });\n\n const lists = document.querySelectorAll(\".list\");\n // Play the clicked song\n playClick(lists);\n}", "function getSongs(songData) { \n\t\tconsole.log(\"SongDataObj\", songData);\n\t\tlet songs = songData.songs;\n\n \t$.each(songs, (key, song) => {\n \t\t$showTitle.append(`<div>${song.song} by ${song.artist} on the album ${song.album}</div>`);\n \t});\n\t}", "function loadSongsToDOM() {\n\n}", "async loadItems() {\n const keys = await AsyncStorage.getAllKeys();\n const values = await AsyncStorage.multiGet(keys);\n\n this.data = this.data.set('source', fromJS(values));\n }", "async function loadPodcastList() {\n if (!loaded) {\n axios.get(\"/podcasts.json\")\n .then(function (result) {\n setPodcasts(result.data.podcasts);\n setLoaded(true);\n })\n }\n }", "function loadLists() {\r\n\t\tlistItems();\r\n\t\taddCheckButtonEvents();\r\n\t\taddDeleteButtonEvents();\r\n\t}", "function loadResults(songMetaData) {\n playlist.unshift(songMetaData);\n // console.log(playlist);\n saveFile();\n}", "function populateLocalSongs() {\n\t$(\"#libraryContainer\").append('<div class=\"playlistRow\" id=\"\" onClick=\"\">Loading local songs...</div>');\n\twindow.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {\n\t\tconsole.log('populateLocalSongs() successfully accessed filesystem: ' + fs.name);\n\t\t//alert('populateLocalSongs() successfully accessed filesystem: ' + fs.name);\n\t\t\n\t\t// Get all local files for this app\n\t\tvar reader = fs.root.createReader();\n\t\treader.readEntries(\n\t\t\tfunction (entries) {\n\t\t\t\tif(entries.length > 0) {\n\t\t\t\t\t// Go through all found files to search for the downloadedSongs.json file to load in all the songs on the device\n\t\t\t\t\tfor(var i=0; i<entries.length; i++) {\n\t\t\t\t\t\tif(entries[i].name == \"downloadedSongs.json\") {\n\t\t\t\t\t\t\tconsole.log(\"populateLocalSongs() found downloadedSongs.json\");\n\t\t\t\t\t\t\treadDownloadsFile(fs);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse { // The downloadedSongs.json wasnt found so lets create it!\n\t\t\t\t\tconsole.log(\"No downloadedSongs.json file! Creating one...\");\n\t\t\t\t\tfs.root.getFile(\"downloadedSongs.json\", { create: true, exclusive: false }, function (fileEntry) {\n\t\t\t\t\t\twriteFile(fileEntry, new Blob([\"\"], { type: 'text/plain' }));\n\t\t\t\t\t},\n\t\t\t\t\tfunction(e) {\n\t\t\t\t\t\talert(e);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\tfunction (err) {\n\t\t\t\talert(fileSystemError);\n\t\t\t}\n\t\t);\n\t},\n\tfunction(fileSystemError) {\n\t\talert(fileSystemError);\n\t});\n}", "all(){\n const playlists = this.repository.load();\n return playlists.map(playlist => new Playlist(playlist.name, playlist.songs));\n }", "function initializeData(listName) {\n\t\t//use a list with default values\n\t\tshoppingLists = myList;\n\t\tsessionList = shoppingLists[listName];\n\t\t//create the initial list collection in local storage\n\t\tlocalStorage.setItem(\"shoppingLists\", JSON.stringify(shoppingLists));\n\t\t//call the function to display the list on screen, but set save to false since local storage is up to date\n\t\tsessionList.forEach(function(item) {\n\t\t\taddItem(item, false);\n\t\t});\n}", "function Playlist(playlistsFile, playlists, playlist,library,audioInterface)\n{\n \n var self = this;\n this.audioPlayer = audioInterface;\n /* Cache and data files \n * Playlistsfile contains all playlist data in JSON\n */\n this.playlistsFile = playlistsFile; \n \n /*\n * Contains all names of the playlists\n */\n this.playlistNames = new Array();\n /*\n * Contains the current songs\n */\n\n this.currentSongs = new Array();\n this.loadPlaylists =\n function()\n {\n var $playlistNames = null;\n $.ajax( //load the json string of playlist names\n {\n url: 'ajaxPlaylist.php',\n type: 'post',\n data: \"loadPlaylists=1&filename=\" + this.playlistsFile,\n success: \n function (data) //set the values in the playlist names array\n {\n $playlistNames = $.parseJSON(data); \n \n $.each($playlistNames,\n function(key,val)\n { \n self.playlistNames.push(val);\n \n } \n );\n \n self.display();\n }\n }\n ); \n \n }\n \n this.loadPlaylist =\n function(playlistName)\n { \n $.ajax(\n {\n url: 'ajaxPlaylist.php',\n type: 'post',\n data: \"loadPlaylist=1&playlistName=\" + playlist,\n async : false,\n success: \n function(data)\n {\n var playlists = $.parseJSON(data);\n\t\t\t\t\t\tif(playlists[playlistName].Songs != null)\n\t\t\t\t\t\t\tself.currentSongs = playlists[playlistName].Songs;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.currentSongs = [];\n\t\t\t\t\t\t$('#playlist').children('table').html('');\n var songs = self._getHTMLFormattedSongs();\n $.each(songs,\n function (key,val) \n { \n $('#playlist').children('table').append(val) \n } )\n }\n }\n ); \n }\n \n this.display =\n function()\n {\n console.log(this.playlistNames);\n $.each(this.playlistNames,\n function(key,val)\n {\n var playlistElement = $('<a href=\"javascript://\">' + val + '</a>'); \n playlistElement.click( \n function()\n { \n $('#playlists').children('a').removeClass('selectedPlaylist');\n \n $(this).addClass('selectedPlaylist'); \n self.loadPlaylist(val,\n function(data)\n {\n\n });\n \n }); \n \n $('#playlists').append(playlistElement);\n \n \n });\n \n }\n \n /*\n * array of jQuery table row elements\n */\n this._getHTMLFormattedSongs =\n function()\n { \n var elements = new Array(); \n $.each(this.currentSongs,\n function(key, val)\n {\n $songElement = $('<tr class=\"songRow\" data=\"' + val.path + '\" imagepath=\"'+ val.imagepath +'\">\\\n <td class=\"title\">' + val.title + '</td>\\\n <td class=\"artist\">' + val.artist + '</td>\\\n <td class=\"album\">' + val.album + '</td>\\\n <td class=\"duration\">' + val.duration + '</td>\\\n </tr>'\n )\n $songElement.click(\n function()\n {\n \n $('#playlist').find('tr.playing').removeClass('playing').addClass('played');\n $(this).removeClass('played').addClass('playing'); \n self.audioPlayer.play(val.path,val.imagepath);\n }\n )\n elements.push($songElement);\n }\n )\n return elements;\n }\n\t\n\tthis.savePlaylist = function(playlistName, callback)\n { \n var playlist = \n { \n \"Songs\" : this.currentSongs\n }; \n $.ajax(\n {\n type: 'post',\n url: 'ajaxPlaylist.php',\n data: {savePlaylist : 1, playlistName : playlistName, songs : JSON.stringify(playlist)}\n }\n )\n }\n \n this.addSong = function(song)\n {\n this.currentSongs.push(song);\n }\n \n this.clearPlaylist = function(playlistName)\n {\n $.ajax\n\t (\n\t {\n\t\t\ttype: 'post',\n\t\t\turl: 'ajaxPlaylist.php',\n\t\t\tdata: 'clearPlaylist=1&playlistName=' + playlistName,\n\t\t\tsuccess:\n\t\t\t\tfunction()\n\t\t\t\t{\n\t\t\t\t\t$(playlist).find('table').html('');\n\t\t\t\t}\n\t\t}\n\t );\n }\n \n this.createPlaylist =\n function(playlistName)\n {\n\t\t$(playlists).find('a').removeClass('selectedPlaylist');\n\t\t$(playlists).append('<a href=\"javascript://\" class=\"selectedPlaylist\">' + playlistName + '</a>');\n\t\t\n\t\t$.ajax\n\t\t(\n\t\t\t{\n\t\t\t\ttype: 'post',\n\t\t\t\turl: 'ajaxPlaylist.php',\n\t\t\t\tdata: 'initPlaylist=1&playlistName=' + playlistName,\n\t\t\t\tsuccess:\n\t\t\t\tfunction()\n\t\t\t\t{\n\t\t\t\t\tself.loadPlaylist(playlistName);\n\t\t\t\t}\n\t\t\t}\n\t\t)\n }\n \n this.playNext = function(reverse)\n {\n\t\tvar song = null;\n\t\tif($(playlist).find('tr.playing').next().length != 0)\n\t\t\tsong = $(playlist).find('tr.playing').next();\n\t\telse if($(playlist).find('tr').length == 0)\n\t\t\treturn;\n\t\telse\n\t\t\tsong = $(playlist).find('tr:first');\n\t\t\n\t\t$(playlist).find('tr.playing').removeClass('playing').addClass('played');\n\t\tsong.addClass('playing').removeClass('played');\n\t\tthis.audioPlayer.play(song.attr('data'),song.attr('imagepath'));\n }\n}", "function loadArtists(xmlhttp)\n{\n\tartists = [];\n\t// Extract the list of items from JSON\n\tvar jsonDoc = JSON.parse(xmlhttp.responseText);\n\tvar jsonItems = jsonDoc.artists.artist;\n\t\t\t\n\t// Loop through the items\n\tfor (var i = 0; i < jsonItems.length; i++) {\n\t\n\t\t// Extract basic info about each item\n\t\tvar itemImgUrl = jsonItems[i].image[0]['#text'];\n\t\tvar itemListeners = parseInt(jsonItems[i].listeners);\n \tvar itemName = jsonItems[i].name;\n \tvar itemPlayCount = parseInt(jsonItems[i].playcount);\n \tvar itemURL = jsonItems[i].url;\n \t//\"streamable\" : \"0\",\n \t\t\n\t\t// Create an object to store info about the item\n\t\tvar item = {\n\t\t\timgUrl : itemImgUrl,\n\t\t\tlisteners : itemListeners,\n \t\tname : itemName,\n \t\tplayCount : itemPlayCount,\n \t\turl : itemURL\n\t\t};\n\t\t// And add to the (global)list of items\n\t\tartists.push(item);\n\t}\n\n\t// Refresh the table\n\tfillArtistsTable();\n}", "function gotSongData(Data){\r\n\t//console.log(Data.val());\r\n\tdta = Data.val()\r\n\tvar keys = Object.keys(dta);\r\n\t//console.log(keys);\r\n\tfor(i=0;i<keys.length;i++){\r\n\t\tvar k = keys[i];\r\n\t\tvar nm = dta[k].name;\r\n\t\tvar crd = dta[k].cord;\r\n\t\tvar Strm = dta[k].strum;\r\n\t\tdat = [nm,crd.slice(),Strm.slice()];\r\n\t\tsong_data.push(dat);\r\n\t}\r\n\tconsole.log(song_data.length);\r\n practice.loadSong_data(song_data);\r\n}", "function getSongs() {\n let lists = document.getElementById(\"songliste\");\n let songs = JSON.parse(localStorage.getItem(\"Alle Songs\"));\n for (let i = 0; i < songs.songs.length; i++) {\n let song = document.createElement(\"li\");\n let input = JSON.parse(songs.songs[i]).src;\n let songname = formatName(JSON.parse(songs.songs[i]));\n\n let labelText = document.createElement(\"label\");\n let inputText = document.createElement(\"input\");\n let spanText = document.createElement(\"span\");\n labelText.setAttribute(\"class\", \"checkerSong\");\n inputText.setAttribute(\"type\", \"checkbox\");\n spanText.setAttribute(\"class\", \"checkmark\");\n labelText.appendChild(inputText);\n labelText.appendChild(spanText);\n\n let ref = document.createElement(\"a\");\n ref.setAttribute(\"title\", input);\n\n let linkText = document.createTextNode(songname);\n ref.appendChild(linkText);\n\n ref.addEventListener(\"click\", function playSong() {\n let source = document.getElementById(\"standardAudioSrc\");\n let audio = document.getElementById(\"standardAudio\");\n localStorage.removeItem(\"playedsong\");\n let obj = {\n type: \"playedsong\",\n current: JSON.stringify(songs),\n src: songname,\n key: i,\n nameofPlaylist: \"Alle Songs\",\n };\n localStorage.setItem(\"playedsong\", JSON.stringify(obj));\n document.getElementById(\"title\").innerText = songname;\n source.src = input;\n audio.load();\n audio.play();\n });\n\n song.appendChild(labelText);\n song.appendChild(ref);\n lists.appendChild(song);\n }\n}", "function fetch_musics(){\n $.ajax({\n url:'fetch-music.php',\n method:\"POST\",\n data:{songs:songs},\n dataType:\"json\",\n success:function(data){\n var obj = JSON.parse(JSON.stringify(data));\n \n for ( var i in obj){\n playlist.push(obj[i].file);\n title.push(obj[i].music);\n poster.push(obj[i].image);\n artists.push(obj[i].artist);\n }\n add_to_list();\n }\n });\n}", "async function showSongsInitial() {\n let setlistSongsResponse = await axios.get(\n `${BASE_URL}/api/setlists/${SETLIST_ID}/get-songs`\n );\n\n setlistSongs = setlistSongsResponse.data.setlistSongs;\n otherSongs = setlistSongsResponse.data.otherSongs;\n\n for (let song of setlistSongs) {\n let newSong = $(makeSetlistSongHTML(song));\n $(\"#songs-in-setlist\").append(newSong);\n }\n\n for (let song of otherSongs) {\n let newSong = $(makeOtherSongHTML(song));\n $(\"#songs-not-in-setlist\").append(newSong);\n }\n\n sortable(\".sortable\");\n}", "function _readPlaylist () {\n\n\t\tthis.albums = (typeof this.settings.playlist.albums != 'undefined') ? this.settings.playlist.albums : [];\n\t\tthis.tracks = (typeof this.settings.playlist.tracks != 'undefined') ? this.settings.playlist.tracks : [];\n\n\t\t_sortTracks.apply(this);\n\n\t\tthis.currentSoundtrack = this.tracks[0].id;\n\n\t\tthis.debug('Playlist: '+ this.albums.length +' albums, '+ this.tracks.length +' soundtracks');\n\n\t}", "function fetchsongs() {\n fetch('./albumsongs.json')\n .then((res) => res.json())\n .then((data) => {\n songlist = data.songs;\n album_details(data, songlist);\n })\n .catch((err) => {\n console.log(err);\n alert(\"Oops, problem retrieving songs\");\n })\n}", "function loadTracks(evt) {\n song_list.empty();\n artist_id = $(evt).attr('data-id');\n artist_name = $(evt).attr('data-name');\n // console.log(artist_id);\n // console.log(artist_name);\n\n // call w/pass artist_name to SeatGeek API\n seatGeek(artist_name);\n\n $.ajax({\n url: `https://api.napster.com/v2.2/artists/${artist_id}/tracks/top?apikey=${apiKey}&limit=12`\n ,\n success: function (response) {\n var arrSongs = response.tracks;\n arrSongs.forEach((elem) => {\n song_list.append(\n `<div class=\"music-card-container\">\n <div class=\"music-card\" data-song=\"${elem.previewURL}\" style=\"background-image:url(http://direct.napster.com/imageserver/v2/albums/${elem.albumId}/images/200x200.jpg);\" onClick=\"jukeBox.playSelected(this)\">\n <div class=\"songImg\">\n </div>\n </div><h6>${elem.name}</h6></div>`)\n });\n handleSound(arrSongs[0].previewURL);\n }\n });\n}", "function getPlaylists() {\n\n\n \n var queryUrl = \"https://api.spotify.com/v1/me/playlists\"\n\n $.ajax({\n url: queryUrl,\n type: \"GET\",\n beforeSend: function (xhr) { xhr.setRequestHeader('Authorization', 'Bearer ' + _token); },\n success: function (response) {\n $(\"ul\").text(response.items[0].name)\n $(\"ul\").attr(\"value\", response.items[0].id)\n $(\"ul\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[0].images[0].url)\n $(\".album-page-name\").text(response.items[0].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n $(\"ul:nth-child(2)\").text(response.items[1].name)\n $(\"ul:nth-child(2)\").attr(\"value\", response.items[1].id)\n $(\"ul:nth-child(2)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[1].images[0].url)\n $(\".album-page-name\").text(response.items[1].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n\n $(\"ul:nth-child(3)\").text(response.items[2].name)\n $(\"ul:nth-child(3)\").attr(\"value\", response.items[2].id)\n $(\"ul:nth-child(3)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[2].images[0].url)\n $(\".album-page-name\").text(response.items[2].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n $(\"ul:nth-child(4)\").text(response.items[3].name)\n $(\"ul:nth-child(4)\").attr(\"value\", response.items[3].id)\n $(\"ul:nth-child(4)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[3].images[0].url)\n $(\".album-page-name\").text(response.items[3].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(5)\").text(response.items[4].name)\n $(\"ul:nth-child(5)\").attr(\"value\", response.items[4].id)\n $(\"ul:nth-child(5)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[4].images[0].url)\n $(\".album-page-name\").text(response.items[4].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(6)\").text(response.items[5].name)\n $(\"ul:nth-child(6)\").attr(\"value\", response.items[5].id)\n $(\"ul:nth-child(6)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[5].images[0].url)\n $(\".album-page-name\").text(response.items[5].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(7)\").text(response.items[6].name)\n $(\"ul:nth-child(7)\").attr(\"value\", response.items[6].id)\n $(\"ul:nth-child(7)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[6].images[0].url)\n $(\".album-page-name\").text(response.items[6].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(8)\").text(response.items[7].name)\n $(\"ul:nth-child(8)\").attr(\"value\", response.items[7].id)\n $(\"ul:nth-child(8)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[7].images[0].url)\n $(\".album-page-name\").text(response.items[7].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(9)\").text(response.items[8].name)\n $(\"ul:nth-child(9)\").attr(\"value\", response.items[8].id)\n $(\"ul:nth-child(9)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[8].images[0].url)\n $(\".album-page-name\").text(response.items[8].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(10)\").text(response.items[9].name)\n $(\"ul:nth-child(10)\").attr(\"value\", response.items[9].id)\n $(\"ul:nth-child(10)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[9].images[0].url)\n $(\".album-page-name\").text(response.items[9].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(11)\").text(response.items[10].name)\n $(\"ul:nth-child(11)\").attr(\"value\", response.items[10].id)\n $(\"ul:nth-child(11)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[10].images[0].url)\n $(\".album-page-name\").text(response.items[10].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(12)\").text(response.items[11].name)\n $(\"ul:nth-child(12)\").attr(\"value\", response.items[11].id)\n $(\"ul:nth-child(12)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[11].images[0].url)\n $(\".album-page-name\").text(response.items[11].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(13)\").text(response.items[12].name)\n $(\"ul:nth-child(13)\").attr(\"value\", response.items[12].id)\n $(\"ul:nth-child(13)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[12].images[0].url)\n $(\".album-page-name\").text(response.items[12].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(14)\").text(response.items[13].name)\n $(\"ul:nth-child(14)\").attr(\"value\", response.items[13].id)\n $(\"ul:nth-child(14)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[13].images[0].url)\n $(\".album-page-name\").text(response.items[13].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(15)\").text(response.items[14].name)\n $(\"ul:nth-child(15)\").attr(\"value\", response.items[14].id)\n $(\"ul:nth-child(15)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[14].images[0].url)\n $(\".album-page-name\").text(response.items[14].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n $(\"ul:nth-child(16)\").text(response.items[15].name)\n $(\"ul:nth-child(16)\").attr(\"value\", response.items[15].id)\n $(\"ul:nth-child(16)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[15].images[0].url)\n $(\".album-page-name\").text(response.items[15].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(17)\").text(response.items[16].name)\n $(\"ul:nth-child(17)\").attr(\"value\", response.items[16].id)\n $(\"ul:nth-child(17)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[16].images[0].url)\n $(\".album-page-name\").text(response.items[16].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(18)\").text(response.items[17].name)\n $(\"ul:nth-child(18)\").attr(\"value\", response.items[17].id)\n $(\"ul:nth-child(18)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[17].images[0].url)\n $(\".album-page-name\").text(response.items[17].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n $(\"ul:nth-child(19)\").text(response.items[18].name)\n $(\"ul:nth-child(19)\").attr(\"value\", response.items[18].id)\n $(\"ul:nth-child(19)\").on(\"click\", function () {\n $(\".album-cover-page\").attr(\"src\", response.items[18].images[0].url)\n $(\".album-page-name\").text(response.items[18].name)\n $(\".by-artist-album\").text(\"Created by\" + \" \" + response.items[0].owner.display_name)\n\n\n })\n\n\n }\n})\n}", "function loadList() {\n\t$.ajax({\n\t\tmethod : \"GET\",\n\t\turl : \"./php/loaders/loadList.php\",\n\t\tsuccess : function(result) {\n\t\t\t\tfor ( i = 0; i < result['authors'].length; i++) {\n\t\t\t\tloadedAuthors[i] = {\n\t\t\t\t\t\"name\" : result['authors'][i]['name'],\n\t\t\t\t\t\"url\" : result['authors'][i]['url']\n\t\t\t\t};\n\t\t\t}\n\n\t\t},\n\t\terror : function() {\n\t\t\t//alert(\"Errore caricamento lista!\");\n\t\t}\n\t});\n}", "function loadPlayerList() {\n playerArray.forEach(addPlayerToUIList);\n }", "getSongs() {\n let allConstants = this.allConstants\n axios({\n method: allConstants.method.GET,\n url: allConstants.getSongs,\n header: allConstants.header\n })\n .then((res) => {\n this.setState({ songs: res.data });\n this.setState({ songsList: res.data });\n this.setState({ isDataLoaded: true });\n })\n .catch((err) => {\n console.log('Error occurred...', err)\n })\n }", "function createSongsList(i) {\n\tvar html = \"\";\n\tvar songsData = [];\n\n\tif (i == \"all\") {\n\t\t$.each(playlistsData, function(k, v){\n\t\t\tif (k != \"custom\") {\n\t\t\t\t$.each(v.songs, function(k2, v2){\n\t\t\t\t\tsongsData.push(v2);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t} else {\n\t\tsongsData = playlistsData[i].songs;\n\t}\n\n\tif (i != \"custom\") {\n\t\tsongsData = shuffleObj(songsData);\n\t}\n\n\t$.each(songsData, function(k, v){\n\t\tif (i == \"custom\") {\n\t\t\tvar faClass = \"fa-music\";\n\t\t\tif (v.url.indexOf(\"youtube\") > -1) {\n\t\t\t\tfaClass = \"fa-video-camera\";\n\t\t\t}\n\t\t\thtml += '<li data-id=\"'+k+'\" data-custom=\"1\"><i class=\"fa '+ faClass +'\"></i>'+v.title+'</li>';\n\t\t} else {\n\t\t\thtml += '<li data-id=\"'+ v.videoId +'\">'+ v.title +'</li>';\n\t\t}\n\t});\n\t$songsList.html(html);\t\n}", "function load() {\n listModel.clear();\n var jsonObject = JSON.parse(listModel.source);\n var apps = jsonObject.apps\n for (var app in apps) {\n // Provide the file scheme to the icon for reliable loading of the icon. Without\n // it the path can be interpreted as a relative path to a resource file bundled\n // with the binary\n listModel.append({icon: \"file://\" + apps[app].icon, appId: apps[app].id});\n }\n}", "function loadTracks(xmlhttp)\n{\n\ttracks = [];\n\t// Extract the list of items from JSON\n\tvar jsonDoc = JSON.parse(xmlhttp.responseText);\n//var jsonItems = jsonDoc.findItemsByKeywordsResponse[0].searchResult[0].item;\n\tvar jsonItems = jsonDoc.tracks.track;\n\t\n\t// Loop through the items\n\tfor (var i = 0; i < jsonItems.length; i++) {\n\t\n\t\t// Extract basic info about each item\n\t\tvar itemArtistName = jsonItems[i].artist.name;\n\t\tvar itemArtistURL = jsonItems[i].artist.url;\n\t\tvar itemDuration = jsonItems[i].duration;\n\n\t\tif (jsonItems[i].hasOwnProperty('image'))\n\t\t{\n\t\t\tvar itemImgUrl = jsonItems[i].image[0]['#text'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar itemImgUrl = findAltImg(jsonItems[i].artist.name);\n\t\t}\n\n\t\tvar itemListeners = parseInt(jsonItems[i].listeners);\n\t\tvar itemName = jsonItems[i].name;\n\t\tvar itemPlayCount = parseInt(jsonItems[i].playcount);\n\t\tvar itemURL = jsonItems[i].url;\n \t\t\n\t\t// Create an object to store info about the item\n\t\tvar track = {\n\t\t\tartistName : itemArtistName,\n\t\t\tartistUrl : itemArtistURL,\n\t\t\tduration : itemDuration,\n\t\t\timgUrl : itemImgUrl,\n\t\t\tlisteners : itemListeners,\n \t\tname : itemName,\n \t\tplayCount : itemPlayCount,\n \t\turl : itemURL\n\t\t};\n\t\t// And add to the (global)list of items\n\t\ttracks.push(track);\n\t}\n\n\t// Refresh the table\n\tfillTracksTable();\n}", "function getPlaylistItems(data){\n\tgetPlaylistTracks(getTrackIDs, data.playlists.items[playlistLoop].id);\n}", "function loadData() {\n ul.innerHTML = \"\";\n taskList.loadFromJson(JSON.parse(localStorage.getItem(\"tasks\")) || []);\n taskList.getAllTasks().forEach(task => loadTask(task));\n}", "function displaySongs() {\n\t\trequire(['hbs!../templates/songs'],\n\t\t\tfunction(songTemplate){\n\t\t\t\t$(\".list-group\").html(songTemplate(songs));\n\t\t\t});\n\t}", "function processSong(data) {\n\t\taudioFile.src = \"data:\" + data.mime + \";base64,\" + data.base64;\n\t\taudioFile.volume = volume / 100;\n\t\taudioFile.load();\n\t\taudioFile.play();\n\t\tdivListview.classList.add(\"active\");\n\t\tdivAudioBanner.classList.remove(\"hidden\");\n\t\tdivAudioPlayer.classList.remove(\"hidden\");\n\t\tshowPause();\n\t}", "function loadData()\n{\n /***************\n * GET INTEGER *\n ***************/\n function getInt(name)\n {\n return parseInt(localStorage.getItem(name));\n }\n\n /***************\n * GET BOOLEAN *\n ***************/\n function getBool(name)\n {\n var data = getInt(name);\n if (data !== 0 && data !== null && data != undefined && !isNaN(data))\n return true;\n else\n return false;\n }\n \n // if local data exists, then get it\n if (getBool('data') === true)\n {\n // parse data\n ax = getInt('ax');\n ay = getInt('ay');\n dx = getInt('dx');\n dy = getInt('dy');\n score = getInt('score');\n recent = getInt('recent');\n hScore = getInt('hScore');\n paused = getBool('paused');\n doWrap = getBool('doWrap');\n \n // parse snake dataa\n var length = getInt('length');\n snake = [];\n for (var i = 0; i < length; i++)\n {\n var sx = getInt('snake' + i + 'x');\n var sy = getInt('snake' + i + 'y');\n snake.push({x: sx, y: sy}); \n }\n }\n // otherwise, initialize it\n else\n resetData();\n}", "constructor(props) {\n super(props);\n\n this.state = {\n songs: props.songs,\n };\n\n this.loadSongsFromServer();\n }", "function parseSongs(songData) {\n let songs = [];\n for (let i = 0; i < songData.length; i++) {\n let data = songData[i];\n let artists = [];\n for (let j = 0; j < data.artists.length; j++) {\n artists.push(data.artists[j].name);\n }\n let song = {\n id: i,\n name: data.name,\n album: data.album.name,\n artists: artists,\n art: data.album.images[0].url,\n song_url: data.external_urls.spotify,\n album_url: data.album.external_urls.spotify,\n };\n songs.push(song);\n }\n return songs;\n}", "async function fetchPlaylists() {\n const libPath = await window.api.invoke('store-get', 'library')\n if (libPath === undefined) {\n empty(playlistsElement)\n error.show('You must select an iTunes library. This can be done in the application settings.')\n return\n }\n\n try {\n await library.open(libPath)\n } catch(err) {\n error.show('Failed to open iTunes library')\n }\n\n try {\n const playlists = await library.getPlaylists()\n await empty(playlistsElement)\n\n Object.entries(playlists).forEach(([key, value]) => {\n const shouldExclude = excludes.some(item => value[item])\n const excludeDownloaded = value.name === 'Downloaded' && value.distinguished_kind !== 65\n if (!shouldExclude && !excludeDownloaded) {\n const playlist = document.createElement('a')\n const span = document.createElement('span')\n playlist.setAttribute('href', '#')\n playlist.setAttribute('data-playlist-id', value.playlist_id)\n playlist.classList.add('playlist-item')\n playlist.innerHTML = `${icons.playlist}`\n span.innerText = `${value.name}`\n playlist.append(span)\n\n playlist.addEventListener('click', async({ currentTarget }) => {\n window.api.send('store-set', 'last-playlist', currentTarget.getAttribute('data-playlist-id'))\n\n // Remove current 'active' class\n const active = document.querySelector('.active')\n if (active !== null) {\n active.classList.remove('active')\n }\n\n // Add 'active' class to clicked item\n currentTarget.classList.add('active')\n\n // Empty current playlist tracks\n await empty(list)\n\n // Get the playlist tracks\n const playlistItems = await library.getPlaylistItems(value)\n\n // Append each playlist track to the table\n Object.entries(playlistItems).forEach(async([key, value]) => {\n const track = await library.getTrackById(value.track_id)\n await list.append(table.buildRow(track))\n\n const trackName = document.getElementById('track-name')\n if (trackName.getAttribute('data-track-id') !== undefined) {\n const trackId = document.querySelector(`[data-id=\"${trackName.getAttribute('data-track-id')}\"]`)\n if (trackId) {\n trackId.classList.add('is-playing')\n trackId.querySelector('.play-button').innerHTML = icons.pause\n }\n }\n })\n })\n\n playlistsElement.append(playlist)\n }\n })\n\n // Get a list of all tracks for the search\n tracks = await library.getTracks()\n\n // Click on the last playlist that was viewed\n const lastPlaylist = await window.api.invoke('store-get', 'last-playlist')\n if (lastPlaylist !== undefined) {\n document.querySelector(`[data-playlist-id=\"${lastPlaylist}\"]`).click()\n }\n\n table.sort()\n } catch(err) {\n empty(playlistsElement)\n error.show('There was an error parsing the iTunes library')\n }\n}", "function getMusicList(playlist) {\n \n var sendUrl = 'get_music.php';\n if (playlist !== '') {\n sendUrl += '?playlist=' + encodeURIComponent(playlist);\n }\n \n var xhr = new XMLHttpRequest();\n \n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {\n // Get response text in json and populate\n console.log(xhr.responseText);\n populateMusicTable(xhr.responseText);\n addPlayButtonsToTable();\n if (player.src !== '') {\n setSelected(player.getAttribute('src'));\n }\n $('#music_list_table').dataTable({\n 'dom': '<\"col-md-10\"lfrtip>'\n });\n getPlaylistFilters();\n }\n };\n \n xhr.open('GET', sendUrl, true);\n xhr.send(null);\n}", "function updatePlaylist(){\n\tvar songs = JSON.parse(sessionStorage.getItem(\"songs\"));\n\t$(renderPlaylist(songs));\n}", "function getUserPlaylistSongs(currentPlaylist){\n // Empty out the object (if called another time)\n currentPlaylistSongObjects = [];\n // AJAX Call to get Selected Playlist's Songs and other info\n $.ajax({\n url: \"https://api.spotify.com/v1/users/\" + currentPlaylist.ownerID + \"/playlists/\" + currentPlaylist.playlistID + \"/tracks\",\n async : false,\n headers: {\n 'Authorization': 'Bearer ' + spotifyAccessToken\n }\n }).done(function(currentPlaylistResponse){\n\n // Loop Through the Playlists and get the IDs\n for(var i = 0; i < currentPlaylistResponse.items.length; i++){\n\n var newSongObject = {\n songName: currentPlaylistResponse.items[i].track.name,\n songID: currentPlaylistResponse.items[i].track.id,\n artistName: currentPlaylistResponse.items[i].track.artists[0].name,\n //albumCoverLink: currentPlaylistResponse.items[i].track.album.images[0].url\n };\n\n // Add Song Attributes Object to the PLay Array\n currentPlaylistSongObjects.push(newSongObject);\n }\n //console.log(currentPlaylistSongObjects)\n });\n }", "function loadList() {\n return loadListFunctionality();\n }", "function getAllData() {\n fillPlayerList();\n}", "function getTracks() {\n vm.loader.start();\n MainService.getTracks()\n .then(function (response) {\n vm.trackList = response.data.tracks.track;\n })\n .finally(function() {\n vm.loader.complete();\n });\n }", "function loadSong(song) {\n cover.src = song.coverPath;\n disc.src = song.discPath;\n title.textContent = song.title;\n artist.textContent = song.artist;\n duration.textContent = song.duration;\n}", "load() {\n this.mainSegmentLoader_.load();\n if (this.audioPlaylistLoader_) {\n this.audioSegmentLoader_.load();\n }\n }", "function loadList() {\n urls = !localStorage.cards || localStorage.cards == undefined\n ? []\n : localStorage.cards.split(',');\n\n carousel.innerHTML = '';\n \n for (var i = 0, url; url = urls[i]; i++)\n appendCarouselSlide(url);\n}", "function loadList() {\n newToDoItem(\"Buy milk\", true)\n newToDoItem(\"Do dishes\", false)\n newToDoItem(\"Feed Tito\", true)\n}", "function loadData() {\n //load names into an array from local storage\n if (localStorage.getItem('playerId') !== null) {\n playerId = parseInt(localStorage.getItem('playerId'));\n }\n\n if (localStorage.getItem('highScores') !== null) {\n highScores = JSON.parse(localStorage.getItem('highScores'));\n } else {\n highScores = [0, 0, 0];\n }\n if (localStorage.getItem('playerNames') !== null) {\n playerNames = JSON.parse(localStorage.getItem('playerNames'));\n } else {\n playerNames = ['', '', ''];\n }\n}", "loadSongsFromServer () { \n const xhr = new XMLHttpRequest(); //new ajax request\n \n //function to parse the response and set the song container's state.\n const setSongs = () => {\n\t //parse response from server into JSON\n const songResponse = JSON.parse(xhr.response);\n\n\t //update our state with the songs from the server to re-render\n\t //remember that calling setState triggers a re-render if the data on screen changes\n\t //It is an incremental change so it's only the stuff that actually changed.\n this.setState({ songs: songResponse });\n };\n\n\t//set the ajax's onload function\n xhr.onload = setSongs;\n\n\t//set request to /getSongs\n xhr.open('GET', '/getSongs');\n\n\t//send request\n xhr.send();\n }", "function loadTracks() {\n numPlayers = Math.min(audioTags.length, allTracks.length);\n var tracksAdded = 0;\n var i = 0;\n\n while (tracksAdded < numPlayers) {\n var thisTrack = allTracks.pop();\n if (thisTrack.streamable === true) {\n console.log(thisTrack);\n var audio = audioTags[tracksAdded];\n audio.attr(\"src\", thisTrack.stream_url + \"?client_id=\"+client_id[tracksAdded%2]);\n audio[0].volume = 0;\n audio[0].play();\n\n $(h2s[tracksAdded]).append(\"<a href='\" + thisTrack.permalink_url + \"' target='_blank'>\" + thisTrack.title + \"</a>\");\n\n if (thisTrack.artwork_url) { \n imgs[tracksAdded].src = thisTrack.artwork_url.replace(\"large\", \"t500x500\");\n } else {\n imgs[tracksAdded].src = \"images/default.png\";\n }\n tracksAdded++;\n }\n i++;\n }\n }", "function loadPlaylist() {\n \n \n var embargo_str = (options.has_embargo) ? \" displaydatetime:[* TO NOW]\" : \"\";\n \n //LOAD THE JSON FOR THE PLAYLIST VIA SITE SEARCH\n var dataURL = 'https://www.washingtonpost.com/apps/national/proxy/methode/sitesearch/' + \n \t'?q=tag:\"' + options.video_tag + \n \t'\"&fq=contenttype:\"Video\"' + \n \t embargo_str + //if embargoed, add tonow\n \t'&start=0&' + \n \t'rows='+ options.max_videos +\n \t'&fl=embedcode,headline,subheadline,credit,blurb,imageurl,displaydatetime,pubdatetime,contentbinaryurl,smallthumburl,systemid&' + \n \t'wt=json&' +\n \t'omitHeader=true&' + \n \t'tracking=video-series-player-' + options.video_tag + \n \t'&json.wrf=jQuery.playlistLoaded';\n \t \t\n $.ajax({\n url: dataURL,\n dataType: 'jsonp',\n jsonpCallback: 'jQuery.playlistLoaded',\n context: document.body,\n cache: true\n })\n }", "function handlePlaylists(data) {\n // detect any error messages from BC\n if (!data || (data && data.error)) {\n displayError(LG.copy[\"playlist_error\"][LG.config.lang]);\n } else if (data && data.items) {\n playlists = data.items;\n buildApplication();\n }\n }", "function getList() {\n if (storage.get(ListName) != null) {\n masterList = storage.get(ListName);\n showList(masterList);\n }\n}", "function load_data() {\r\n\tif (sessionStorage.getItem('pieces')) {\r\n\t\ttry {\r\n\t\t\tData.pieces = JSON.parse(sessionStorage.getItem('pieces'))\r\n\t\t\tData.stamps = JSON.parse(sessionStorage.getItem('stamps'))\r\n\t\t\tData.categories = JSON.parse(sessionStorage.getItem('categories'))\r\n\t\t\tData.tuto = JSON.parse(sessionStorage.getItem('tuto'))\r\n\t\t} catch (e) {}\r\n\t} else {\r\n\t\t// Create Categories\r\n\t\tfor (var x in Data.pieces)\r\n\t\t\tif (Data.pieces[x].category)\r\n\t\t\t\tData.categories[Data.pieces[x].category].content.push(x)\r\n\t}\r\n}", "load() {\n this.mainSegmentLoader_.load();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.load();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.load();\n }\n }", "function initListStorage() {\n var testList = localStorage.getItem(\"list\");\n if (testList) {\n list = JSON.parse(testList);\n }\n setList(list);\n}", "function loadSong(index) {\r\n cover.src = music[musicIndex].img;\r\n audio.src = `./music/${music[musicIndex].title}.mp3`;\r\n artistName.innerText = music[musicIndex].artist;\r\n songName.innerText = music[musicIndex].title;\r\n}", "function loadMusic(indexNumb) {\n musicName.innerText = allMusic[indexNumb - 1].name;\n musicArtist.innerText = allMusic[indexNumb - 1].artist;\n musicImg.src = `images/${allMusic[indexNumb - 1].img}.jpg`;\n mainAudio.src = `songs/${allMusic[indexNumb - 1].src}.mp3`;\n}", "function gotAllSongs(err) {\n console.log(\"gotAllSongs()\");\n\n // report an error, you'd want to do something better than this in production\n if (err) {\n console.log(\"error loading songs\");\n console.error(err);\n return;\n }\n\n // call functions to log and show the songs\n consoleLogSongs();\n showSongs();\n}", "function openPlaylist(name) {\n var playlistJSON = JSON.parse(localStorage.getItem(name));\n songs = [];\n var html = '<ol>';\n var counter = 0;\n playlistJSON.songs.forEach(song => {\n if (song) {\n html += \"<li>\" + song.url + '<button onclick=\"loadSong('+counter+')\">Play</button><br></li>';\n songs.push({\n id: counter,\n name: song.name,\n url: song.url\n });\n counter++;\n }\n });\n html += \"</ol>\"\n var mainContent = document.getElementById(\"playlist-content\");\n if (mainContent) {\n mainContent.innerHTML = html;\n console.log(\"opened playlist: \" + name);\n }\n}", "function PlayListSongsToOrder(){\n /**\n * It's the id of the playList\n */\n this.playlistId = null;\n /**\n * It's an array that contains song element. This attribute will be used to fill the table for the reorder\n */\n this.songs = new Array();\n\n /**\n * Function used to reset the attribute songs\n */\n this.reset = function() {\n this.songs = [];\n }\n\n /**\n * Function that add a song to the attribute\n * @param song is the song to add\n */\n this.addSong = function(song) {\n this.songs.push(song);\n }\n }", "function load() {\n loadJSONfromServer()\n .then(function (result) {\n console.log('Laden erfolgreich!', result);\n myJSON = JSON.parse(result);\n for (let i = 0; i < myJSON.length; i++) {\n docsList[i] = myJSON[i];\n }\n displayDocsImages();\n Profiles();\n })\n .catch(function (error) {\n console.error('Fehler beim laden!', error);\n });\n}", "function LoadData(){\n\tLoadDataFiles();\n\tExtractDataFromFiles();\n}", "function loadList (array){\n array.forEach(function(item){\n addItem(item.name, item.id, item.done, item.trash);\n });\n }", "function loadList() {\n showLoadingMessage('Loading Pokemon list, please wait...');\n return fetch(apiUrl)\n .then(function(response) {\n return response.json();\n })\n .then(function(json) {\n hideLoadingMessage();\n json.results.forEach(function(item) {\n var pokemon = {\n name: item.name,\n detailsUrl: item.url\n };\n add(pokemon);\n });\n })\n .catch(function(e) {\n /* eslint-disable no-console */\n console.error(e);\n /* eslint-enable no-console */\n });\n }", "function playList(){\n\tthis.isPlaying=false;\n\t// Definicion DE ARREGLO PLAYLIST (El id se puede obtener de una DataBase)\n\t// Donde esté guardado el URL del archivo, cover, informacion de artista, etc.\n\t// Elementos\n\t// {id:\"photo\",url:\"path/to/song.mp3\", cover: \"path/to/img.jpg(png) , artist: John Doe, title: Some song\"}\n\tthis.arraySong = [\n\t//, + iteraciones // Agregar coverimage, artist, titulo\n\t\t{\n\t\t\tid:\"photo\",\n\t\t\ttitle: \"Photograph\",\n\t\t\tartist: \"Ed Sheeran\",\n\t\t\turl:\"music/photo.mp3\",\n\t\t\tcover: \"img/cover/x.jpg\",\n\t\t},\n\t\t{\n\t\t\tid:\"rend\",\n\t\t\ttitle: \"My Lighthouse\",\n\t\t\tartist: \"Rend Collective\",\n\t\t\turl:\"music/rend.mp3\",\n\t\t\tcover: \"img/cover/art_of_celebration.jpg\",\n\t\t}\n\t];\n\tthis.i=0; // CONTADOR DE REPRODUCCION\n\tthis.initSounds = function(){\n\t\tfor (var i = 0; i < this.arraySong.length; i++) {\n\t\t\tsoundManager.createSound({\n\t\t\t\tid: this.arraySong[i].id,\n\t\t\t\turl: this.arraySong[i].url,\n\t\t\t});\n\t\t}\n\t}\n\t// Devuelve Objeto Sound actual en reproduccion\n\tthis.getCurrent=function(){\n\t\treturn soundManager.getSoundById(this.arraySong[this.i].id);\n\t}\n\t// Reproducir la cancion actual\n\tthis.play = function(){\n\t\tsoundManager.pauseAll();\n\t\tvar id = this.arraySong[this.i].id;\n\t\t// soundManager.getSoundById(id).play();\n\t\tsoundManager.play(id, {\n\t\t\t// onfinish: lista.next\n\t\t\twhileplaying : function(){\n\t\t\t\t// Update position\n\t\t\t},\n\t\t\tonfinish: nextSound\n\t\t});\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-pause\");\n\t}\n\t// Pausar canción Actual\n\tthis.pause=function(){\n\t\tsoundManager.pauseAll();\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-play\");\t\n\t}\n\t// Reproducir/Pausar Cancion Actual\n\tthis.toogle=function(){\n\t\tif (this.isPlaying==true) {\n\t\t\tthis.pause();\n\t\t\tthis.isPlaying=false;\n\t\t}else{\n\t\t\tthis.play();\n\t\t\tthis.isPlaying=true;\n\t\t}\n\t}\n\tthis.prev=function(){\n\t\tthis.i--;\n\t\tif (this.i<this.arraySong.length && this.i>=0) {\n\t\t\tsoundManager.stopAll();\n\t\t\tthis.play();\n\t\t\tthis.changeInfoSong();\n\t\t}else{\n\t\t\tthis.i++;\n\t\t}\n\t}\n\tthis.next=function(){\n\t\tthis.i++;\n\t\tif (this.i<this.arraySong.length && this.i>=0) {\n\t\t\tsoundManager.stopAll();\n\t\t\tthis.play();\n\t\t\tthis.changeInfoSong();\n\t\t}else{\n\t\t\tthis.i--;\n\t\t\tthis.pause();\n\t\t}\n\t}\n\tthis.changeInfoSong = function(){\n\t\tvar cancion = this.arraySong[this.i];\n\t\t// Cambiar titulo\n\t\tdocument.getElementById(\"player-title\").innerHTML=cancion.title;\n\t\t// Cambiar artista\n\t\tdocument.getElementById(\"player-artist\").innerHTML=cancion.artist;\n\t\t// Cmabiar cover\n\t\tvar imgURL = cancion.cover;\n\t\tdocument.getElementById(\"player\").style.backgroundImage=\"url(\"+imgURL+\")\";\n\t}\n\tthis.stop = function(){\n\t\tsoundManager.stopAll();\n\t\t// Cambiar icono\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"\");\n\t\tdocument.getElementById(\"player-play\").setAttribute(\"class\",\"glyphicon glyphicon-play\");\t\n\t}\n\tthis.clear = function(){\n\t\tthis.arraySong =[];\n\t}\n\t// METODOS DE INICIO\n\tthis.initSounds();\n}", "function loadAlbums() {\n\t$.ajax({\n\t\turl: 'bowie_albums.json',\n\t\tdataType: 'json',\n\t\tcontentType: 'application/json',\n\t\tmethod: 'get',\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tconsole.log(errorThrown);\n\t\t},\n\t\n\t\tsuccess: function(data, textStatus, jqXHR) {\n\t\t\talbums = data.bowie_albums;\n\t\t\t//console.log(albums);\n\t\t}\n\t});\t \t\t \t\t\t \n}", "function loadLyrics() {\n $(\"#ppLyricsTitle\").children(\"div\").removeAttr(\"title\").empty();\n $(\"#ppLyricsContent\").empty();\n $(\"#ppLyricsCredits\").empty();\n $(\"#ppLyricsContainer\").addClass(\"loading\").show();\n post(\"loadLyrics\");\n }", "function loadData() {\n return dataService.getList()\n .then(function (res) {\n vm.fullList = athleteService.transformList(res);\n })\n .catch(exception.catcher('Failed to retrieve data'));\n }", "function loadData() {\n\tlet data = JSON.parse(localStorage.getItem(\"tasks\"))\n\tlet li = \"\";\n\tfor (let i = 0; i < data.length; i++) {\n\t\tli += dataGenerat(data[i], i);\n\t\t$(\"ul\").html(\"\").append(li);\n\t}\n}", "function displaySong(name, inter, data) {\r\n\tvar obj = JSON.parse(data);\r\n\tvar cssSelector = {\r\n\t\tjPlayer: name,\r\n\t\tcssSelectorAncestor: inter\r\n\t};\r\n\t/*An Empty Playlist*/\r\n\tvar playlist = [];\r\n\tvar options = {\r\n\t\tswfPath: \"js\",\r\n\t\tuseStateClassSkin: true,\r\n\t\tsupplied: \"mp3\"\r\n\t};\r\n\tvar myPlaylist = new jPlayerPlaylist(cssSelector, playlist, options);\r\n\t/*Loop through the JSon array and add it to the playlist*/\r\n\tvar l=obj.length;\r\n\tfor (var i=0;i<l; i++) {\r\n \tmyPlaylist.add({\r\n\t\t\ttitle: obj[i].title,\r\n\t\t\tmp3: obj[i].mp3\r\n\t\t});\r\n\t}\r\n}", "reloadMusicList() {\n this._musicListService.getFavoriteMusic().then(musicList => {\n this._musicList = musicList;\n });\n }", "function displaySongs(){\r\n let landingPageSongs = [];\r\n \r\n /*//process the response data which received from the API call when page loads \r\n xhr.onload = function () {*/\r\n //parameters for the ajax call\r\n var settings = {\r\n\t \"async\": true,\r\n\t \"crossDomain\": true,\r\n\t \"url\": \"https://deezerdevs-deezer.p.rapidapi.com/search?q=''\",\r\n\t \"method\": \"GET\",\r\n\t \"headers\": {\r\n\t\t \"x-rapidapi-host\": \"deezerdevs-deezer.p.rapidapi.com\",\r\n\t\t \"x-rapidapi-key\": \"e4b18eca08msh4b189d0eddc1567p102bc4jsned4f75eac788\"\r\n\t }\r\n }\r\n //ajax call for the songs \r\n $.ajax(settings).done(function (response) {\r\n let wholeData = response.data;\r\n console.log(wholeData);\r\n let trackName;\r\n let trackArtist;\r\n let trackAlbum;\r\n let trackSource;\r\n for(let i = 0; i < 10; i++){\r\n trackName = wholeData[i].title;\r\n trackArtist = wholeData[i].artist.name;\r\n trackAlbum = wholeData[i].album.title;\r\n trackSource = wholeData[i].preview;\r\n landingPageSongs.push({trackName, trackArtist, trackAlbum, trackSource});\r\n }\r\n \r\n \r\n //function to display the table of Top 10 songs\r\n displayLandingPageSongs(landingPageSongs); \r\n });\r\n}", "async function loadMusic() {\n\t\tloadRandomMusic();\n\n\t\t//\tAdditionally bind and handle play/pause events.\n\t\t$('.audio').on('click', _ => {\n\t\t\ttoggleMusic();\n\t\t});\n\t}", "function loadData() {\n try {\n const fsStorageAsArray = JSON.parse(localStorage.getItem(\"saveArray\"));\n fromSaveFormat(fsStorageAsArray);\n } catch (err) {\n // fill some initial data\n fsStorage = [\n {\n id: 0, name: \"root\", children: [\n { id: 1, name: \"sub1\", children: [\n { id: 4, name: \"file.txt\"},\n { id: 5, name: \"sub3\", children: [\n {id: 6, name: \"file2.txt\", content: \"content2\"}\n ]}\n ]},\n { id: 2, name: \"sub2\", children: []},\n { id: 3, name: \"file1.txt\", content: \"text\"}\n ]\n }\n ]\n }\n }", "function loadSong(){\r\n\r\n song.src = songs[currentSong];\r\n songtitle.textContent = (currentSong + 1) + \". \" + songs[currentSong];\r\n nextSongTitle.innerHTML = (\"<b>Next Song: </b>\") + songs[currentSong + 1];\r\n song.volume = volumeSlider.value;\r\n song.play();\r\n \r\n }", "function getSongs(callback) {\n\n}", "function populateSongList(json) {\n\tvar elmt = $('#song-list');\n\n\tfor (var i in json) {\n\t\tvar name = json[i]['name'];\n\t\tvar path = json[i]['path'];\n\t\tvar html = '<div class=\"draggable-song\" data-name=\"' + name + '\" data-path=\"' + path + '\">';\n\n\t\thtml += '<div class=\"text\">' + name + '</div>';\n\t\thtml += '</div>';\n\n\t\telmt.append(html);\n\t}\n\n\t$('.draggable-song').draggable({ \n\t\tappendTo: 'body',\n\t\tcontainment: 'window',\n\t\tscroll: false,\n\t\thelper: 'clone'\n\t});\n}", "function getPlaylists(access_token, allCallSongs) {\n $.ajax({\n url: 'https://api.spotify.com/v1/me/playlists',\n headers: {\n 'Authorization':'Bearer ' + access_token\n },\n success: function(response) {\n $(\".recommendations\").show();\n generatePlaylistDropdown(response.items, allCallSongs);\n }\n });\n}" ]
[ "0.7790735", "0.7491936", "0.7319458", "0.7160265", "0.71298283", "0.69021964", "0.6890367", "0.68492705", "0.6836902", "0.6796913", "0.6795607", "0.6781002", "0.6709844", "0.66848135", "0.6670174", "0.66536796", "0.6645156", "0.6636902", "0.6633187", "0.66229904", "0.66049665", "0.6560945", "0.65364057", "0.6521629", "0.6508931", "0.6479001", "0.64247185", "0.6408463", "0.6394988", "0.635962", "0.63372606", "0.6327529", "0.6308979", "0.63074607", "0.62910324", "0.62760085", "0.6263511", "0.6240043", "0.62222594", "0.6202409", "0.61875826", "0.6186072", "0.61820227", "0.61448365", "0.61419255", "0.61328286", "0.61207134", "0.61187583", "0.60970277", "0.60762423", "0.60513234", "0.60448354", "0.60207295", "0.6016287", "0.6008585", "0.60082155", "0.59948945", "0.59867394", "0.5983734", "0.5977382", "0.5971567", "0.5959105", "0.5947743", "0.5942051", "0.5926008", "0.59231514", "0.591289", "0.59102905", "0.5903347", "0.59003633", "0.58919966", "0.58817697", "0.58771753", "0.58756936", "0.5873862", "0.58661884", "0.5865325", "0.5861352", "0.58542305", "0.58532864", "0.585272", "0.58508176", "0.5841401", "0.58385766", "0.5835249", "0.58332753", "0.5829726", "0.58251244", "0.5814358", "0.5805806", "0.5800913", "0.57941884", "0.5792906", "0.5789501", "0.57846236", "0.57781637", "0.5773713", "0.5773525", "0.57696736", "0.57678306" ]
0.61603266
43
Resets the filter data.
@action.bound resetFilter() { this.filterSongName = ''; this.filterArtistName = '', this.filterGradesRange = [1, 5]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetFilter() {\n this._domainsFiltered = this._domains.slice();\n this._chromosomesFiltered = this._chromosomes.slice();\n this.emitUpdate();\n }", "reset() {\n this._kbnFilter = null;\n this.value = this.filterManager.getValueFromFilterBar();\n }", "resetFilters () {\n this.setFilters({});\n }", "clearFilter(){\n\t\tthis.filtered = [];\n\t}", "function reset() {\n var i;\n\n reduceValue = reduceInitial();\n\n for (i = 0; i < n; ++i) {\n if (!filters[i]) {\n reduceValue = reduceAdd(reduceValue, data[i]);\n }\n }\n }", "function reset() {\n\t var i;\n\n\t reduceValue = reduceInitial();\n\n\t for (i = 0; i < n; ++i) {\n\t if (!filters[i]) {\n\t reduceValue = reduceAdd(reduceValue, data[i]);\n\t }\n\t }\n\t }", "clearFilters() {\n this.filters.clear();\n this.filter();\n }", "function resetFilters() {\n filterAllowedIdsArr = filterIdGenerator(rowsAmount);\n while (mainDiv.firstChild) {\n mainDiv.removeChild(mainDiv.firstChild);\n }\n finalData = { text: [], number: [] };\n console.clear();\n}", "function resetFilters() {\n\n $('#title-search').val('');\n\t$('#categories').val('all');\n\t$('#countries').val('all');\n $('#years').val('all');\n\n send_data['title'] = '';\n\tsend_data['category'] = '';\n\tsend_data['country'] = '';\n send_data['year'] = '';\n\tsend_data['format'] = 'json';\n}", "function resetFilters() {\n\tfilterOptions[0] = \"\";\n\tfilterOptions[1] = \"\";\n\tfilterOptions[2] = \"\";\n\tfilterOptions[3] = \"\";\n\n\tvar inputFilter = document.getElementById('table-filter-input');\n\tinputFilter.addEventListener('input', function() {\n\n\t})\n\n\t$('#table-filter-input').val(filterOptions[0] + \" \" + filterOptions[1] + \" \" + filterOptions[2] + \" \" + filterOptions[3]);\n\tinputFilter.dispatchEvent(new Event('input'));\n\t\n\tselectSalesPersonBeta(0);\n\t// selectSalesPeriode(0);\n\t// selectSalesDepartment(0);\n\t// selectSalesCountry(0, 'Alle land');\n\n\t// getStats();\n\n}", "clearFilters()\n {\n this._filterText = [];\n this._filterTextIndex.clear();\n }", "function reset_data(){\n\t updateData(current_search);\n }", "resetFilter ()\n {\n this.highShelf.gain.value = 0.0;\n this.peaking.gain.value = 0.0;\n this.lowShelf.gain.value = 0.0;\n }", "function resetFilter() {\n // Clear all inputs to filter\n document.getElementById(\"form\").reset();\n // Select the body of the table that displays results\n let tbody = d3.select(\"tbody\");\n // Clear output of the table\n tbody.html(\"\");\n}", "function reset () {\n d3.select(\"tbody\").html(null);\n addTable(tableData);\n let attr = Object.keys(dataMap);\n let tag = Object.values(dataMap);\n\n for (let i = 0; i < attr.length; i++){\n addOptions(tableData,attr[i],tag[i]);\n };\n resetSelects();\n\n // Initialize filters\n filters['datetime']= '';\n filters['city']= '';\n filters['state']= '';\n filters['country']= '';\n filters['shape']= '';\n}", "function resetAllFilters() {\n setVeggiesToRender(veggies);\n setFruitiesToRender(fruities);\n setSaladsToRender(salads);\n setMonth(\"Alle\");\n }", "reset() {\n this.set('data', []);\n this._reset();\n }", "function resetData() {\n\t\t\tconsole.log(\"resetData()\");\n\n\t\t\tvm.results = [];\n\t\t\tvm.selectedIndex = -1;\n vm.selectedAccIndex = 0;\n\t\t\tvm.total_count = 0;\n loadEmptyObject();\n\t\t\tresetBoolean();\n\t\t}", "resetAllFilterViews(){\n this.setProperties({'viewFilterbySearch': false, 'viewFilterbyGrade': false, 'viewFilterbyClassification': false });\n }", "function clearFilter() {\n\t\tfilteredDimensions.forEach(function(v, i) {\n\t\t\tv.filterAll();\n\t\t});\n\n\t\tfilteredDimensions = [];\n\t}", "resetData() {\n this.clearFilters();\n this.data = [];\n this.metrics = ['MQM'];\n for (let key in this.metricsInfo) {\n /** Only retain the entry for 'MQM'. */\n if (key == 'MQM') continue;\n delete this.metricsInfo[key];\n }\n this.metricsVisible = [];\n this.sortByField = 'metric-0';\n this.sortReverse = false;\n this.closeMenuEntries('');\n }", "resetApp() {\n this.dataOrg = [];\n this.dataState = [];\n this.filter.setData([]);\n this.results.render([]);\n this.assignFiltersControl([]);\n }", "reset() {\n this._lastDir = null;\n this._lastFilterIndex = null;\n }", "static resetAllFilters() {\n const filterNodes = ANSWERS.core.filterRegistry\n .getAllFilterNodes()\n .filter(fn => fn.getFilter().getFilterKey());\n filterNodes.forEach(node => {\n node.remove();\n });\n }", "function clearFilter() {\n loadOsListAll();\n setFiltered(false);\n }", "function onResetFilters() {\n $rootScope.$broadcast('search-input_reset');\n\n ctrl.filtersCounter = 0;\n }", "clearFilter() {\n if (!this.settings.filterable) {\n return;\n }\n\n this.clearFilterFields();\n\n this.applyFilter();\n this.element.trigger('filtered', { op: 'clear', conditions: [] });\n }", "function resetFilter(filter) {\n let chart = null;\n switch (filter) {\n case \"wind\":\n chart = windDirChart;\n break;\n case \"year\":\n chart = yearChart;\n break;\n case \"month\":\n chart = monthChart;\n break;\n case \"heatmap1\":\n chart = heatmapOne;\n break;\n case \"heatmap2\":\n chart = heatmapTwo;\n break;\n case \"sunburst1\":\n chart = windSunburstChart;\n break;\n case \"sunburst2\":\n chart = waveheightSunburstChart;\n break;\n case \"sunburst3\":\n chart = wavepeakperiodSunburstChart;\n break;\n case \"wave\":\n chart = waveDirChart;\n break;\n case \"ALL\": {\n yearChart.filterAll();\n monthChart.filterAll();\n heatmapOne.filterAll();\n heatmapTwo.filterAll();\n windSunburstChart.filterAll();\n waveheightSunburstChart.filterAll();\n wavepeakperiodSunburstChart.filterAll();\n dc.redrawAll();\n return;\n }\n }\n if (chart) {\n chart.filterAll();\n dc.redrawAll();\n }\n}", "function clearAllFilters() {\n\n // Loop over the filter columns\n _.each(properties.filterColumns, function (item) {\n var filter = item.enhancedTable.filter;\n\n // Set their individual data to null\n filter.position = null;\n filter.set = [];\n filter.concatType = null;\n });\n\n\n // Update the headers with the filter information (graphic, position)\n updateTableHeaders();\n\n }", "function reset() {\n raw_data = \"\";\n data = [];\n frequency_object = {};\n frequency_total = 0;\n grouped = []\n}", "reset() {\n this._results = [];\n this._resultsCache = {};\n this._isSearching = false;\n this.updateQuery(\"\");\n }", "function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // Add any selected records.\n for (i = 0; i < n; ++i) {\n if (!(filters[i] & zero)) {\n g.value = reduceAdd(g.value, data[i]);\n }\n }\n }", "function clearFilter(){\n vm.search = '';\n }", "function clearEntries() {\n filters = {};\n\n // Sets every input field to empty\n filterInputs._groups[0].forEach(entry => {\n if (entry.value != 0) {\n d3.select('#' + entry.id).node().value = \"\";\n }\n });\n}", "function reset_filters() {\r\r\n\t\t\t\t$(\"#input_filter_cat\").val(\"no_filter\");\r\r\n\t\t\t\t$(\"#input_filter_tangible\").val(\"no_filter\");\r\r\n\t\t\t\t$('#is_bundle').prop( \"checked\", false );\r\r\n\t\t\t\t$('#is_featured').prop( \"checked\", false );\r\r\n\t\t\t\t$('#is_ls_donation').prop( \"checked\", false );\r\r\n\t\t\t\treset_filter_values();\r\r\n\t\t\t}", "function onResetFilters() {\n $rootScope.$broadcast('search-input_reset');\n\n ctrl.filtersCounter = 0;\n $timeout(paginateFunctions);\n }", "resetData() {\n\t\t\tthis.initFlags();\n\t\t\tthis.initMetadata();\n\t\t}", "@task\n *resetFilters() {\n yield super.setupForm(FILTER_FORM_UUID);\n this.updateQueryParams();\n this.registerObserver();\n }", "function resetOne() {\n\t var i,\n\t g = groups[0];\n\n\t // Reset the singleton group values.\n\t g.value = reduceInitial();\n\n\t // Add any selected records.\n\t for (i = 0; i < n; ++i) {\n\t if (!(filters[i] & zero)) {\n\t g.value = reduceAdd(g.value, data[i]);\n\t }\n\t }\n\t }", "function resetAllFilters() {\n\tshowAllPosts();\n\thideUnsavedPosts();\n\n\tfor(var i = 0; i < filterChecks.length; i++) {\n\t\tfilterChecks[i].getElementsByTagName(\"input\")[0].checked = false;\n\t}\n}", "function resetFilter() {\r\n\t$('#province'), $('#district'), $('#pointOfSale'), $('#branch'),\r\n\t\t\t$('#agent'), $('#employer')\r\n\treSelect($('#province'), 0);\r\n\treSelect($('#district'), 0);\r\n\treSelect($('#pointOfSale'), 0);\r\n\treSelect($('#branch'), 0);\r\n\treSelect($('#agent'), 0);\r\n\treSelect($('#employer'), 0);\r\n\t$('#frm_startDate').val(\"\");\r\n\t$('#frm_endDate').val(\"\");\r\n\treSelect($('#selectPhanNan'), -1);\r\n\t// $('#minTyleDat').val(\"\");\r\n\treSelect($('#selectTyleDat'), -1);\r\n\t// $('#maxKhoangCach').val(\"\");\r\n\treSelect($('#selectKhoangCach'), -1);\r\n\t// $('#maxThoiGianCSKH').val(\"\");\r\n\treSelect($('#selectThoiGianCSKH'), -1);\r\n\treSelect($('#selectXepLoai'), -1);\r\n}", "resetDropdown(){\r\n this.filterString = this.currentTextValue;\r\n this.unfilter();\r\n if ( this.isOpened ){\r\n this.isOpened = false;\r\n }\r\n }", "function cancelFilters() {\n $scope.filters = angular.copy($scope.appliedFilters);\n }", "onResetFilters() {\n const today = new Date();\n\n today.setHours(0, 0, 0, 0);\n\n this.filters = {\n validFrom: { $lte: today },\n validTo: { $gte: today }\n };\n }", "function clearAllFilters() {\n\tvar year = $('#slider').slider(\"option\", \"value\");\n\tfilters = [];\n\tfilters.push({key: \"Season\", val: \"1-Jan-\"+year});\n\t$('#player-name').val('');\n\t$('.filter-val').removeAttr('checked');\n\tfilterData(filters, year);\n}", "clear() { \n this.state.page=0;\n this.state.filters='';\n this.state.search='';\n document.getElementById('searchInput').value = '';\n for (var key in this.state.listFilters){\n document.getElementById(key).value='';\n this.state.listFilters[key]='';\n this.state.filters='';\n } \n this.loadData(''); \n }", "clearFilter() {\r\n this.refs.propertyGrid.onSelectAll(false, []);\r\n this.props.toggleButtonText(false);\r\n this.stateSet({ clearFilterKey: Math.random(), filterObj: { companyId: this.companyId }, selectedData: [] });\r\n }", "clear()\n {\n let {_filters} = this;\n\n if (_filters.size == 0)\n return;\n\n _filters.clear();\n\n this.emit(\"snippets.filtersCleared\");\n }", "resetAll(state) {\n state.restoList = [];\n state.filteredList = [];\n state.ratingAverage = [];\n state.markersDisplayed = [];\n state.filteringFinished = false;\n state.searchResultHasPage = false;\n state.seeMoreCliked = false;\n }", "function resetData() {\n\t\t\tconsole.log(\"resetData()\");\n\n\t\t\tvm.results = [];\n\t\t\tvm.selectedIndex = -1;\n\t\t\tvm.total_count = 0;\n\n\t\t\t// rebuild empty apiDomain submission object, else bindings fail\n\t\t\tvm.apiDomain = {};\n\t\t\tvm.apiDomain.logicalDBKey = \"\";\t\n\t\t}", "function resetMany() {\n\t var i,\n\t g;\n\n\t // Reset all group values.\n\t for (i = 0; i < k; ++i) {\n\t groups[i].value = reduceInitial();\n\t }\n\n\t // Add any selected records.\n\t for (i = 0; i < n; ++i) {\n\t if (!(filters[i] & zero)) {\n\t g = groups[groupIndex[i]];\n\t g.value = reduceAdd(g.value, data[i]);\n\t }\n\t }\n\t }", "function resetFilter(filterFrom){\n\t$('#'+filterFrom+'ProductName').val('');\n\t$('#'+filterFrom+'Version').val('');\n\t$('#'+filterFrom+'OrderDateFrom').val('');\n\t$('#'+filterFrom+'OrderDateTo').val('');\n vmf.calendar.resetCalenders($('#'+filterFrom+'OrderDateFrom'));\n\tvmf.calendar.resetCalenders($('#'+filterFrom+'OrderDateTo'));\n\tmyvmware.download.getCalendar(filterFrom+'OrderDateFrom',filterFrom+'OrderDateTo');\n}", "function resetMany() {\n var i,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // Add any selected records.\n for (i = 0; i < n; ++i) {\n if (!(filters[i] & zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i]);\n }\n }\n }", "function clearLookupValues(filter){\n filter.lookupResults = [];\n $scope.data.searchVal = '';\n}", "resetFilters() {\n this.setState({\n selectedYear: undefined,\n launchStatus: undefined,\n landStatus: undefined\n });\n SpaceXService.getAllLaunchDetails((err, results) => {\n if (err) {\n return this.setState({ hasError: true, isLoading: false });\n }\n this.setState({ spacexLaunchData: results, isLoading: false });\n });\n }", "function clearFilterTag() {\n lastFilter = null;\n hideClearFilterBtn();\n // Show all articles\n SetNodesVisibility(\"article\", true);\n // Show all sections\n SetNodesVisibility(\"section\", true);\n}", "reset () {\n this.setState({\n sortType: ''\n });\n this.state.filter.resetFilter();\n }", "clearFilterFields() {\n if (!this.settings.filterable) {\n return;\n }\n\n this.element.find('.datagrid-header input, select').each(function () {\n const input = $(this);\n input.val('');\n if (input.is('select')) {\n input.find('option').each(function () {\n $(this).prop('selected', false);\n });\n }\n input.trigger('updated');\n });\n\n // reset all the filters to first item\n this.element.find('.datagrid-header .btn-filter').each(function () {\n const btn = $(this);\n const ul = btn.next();\n const first = ul.find('li:first');\n\n btn.find('svg:first > use').attr('href', `#icon-filter-${btn.attr('data-default')}`);\n ul.find('.is-checked').removeClass('is-checked');\n first.addClass('is-checked');\n });\n }", "reset() {\n this.samples = [];\n this.sum = 0;\n this.count = 0;\n }", "function resetFilters() {\n var filters = JSON.parse(localStorage.getItem('filters'));\n for (var filter in filters) {\n var value = $('#' + filter + 'Refilter').val();\n console.log(value);\n if (value == 'none' || value == \"\") {\n filters[filter] = null;\n }\n else {\n filters[filter] = value;\n }\n\n }\n console.log(filters);\n localStorage.setItem('filters', JSON.stringify(filters));\n filterFaults(filters);\n filtNav();\n}", "function unfilter() {\n\td3.event.preventDefault();\n\n\t// remove all filters\n\tdocument.getElementById('datetime').value = '';\n\tdocument.getElementById('state-dropdown').selectedIndex = 0;\n\tdocument.getElementById('shape-dropdown').selectedIndex = 0;\n\n\t// show original table\n\tshowTable(tableData);\n}", "function reset() {\n data = [];\n cols = [];\n fdgNodes = [];\n links = [];\n barLinks = [];\n fdgLinks = [];\n links_to_draw = [];\n barlinks_to_draw = [];\n fdglinks_to_draw = [];\n categories = 1;\n maxWindow = 0;\n modified = false;\n firstUpload = true;\n finalResult = [];\n finalResults = [];\n $(\"svg\").empty();\n }", "function resetFilter() {\n\tfor (let i = 0; i < cards.length; i++) {\n\t\t$(cards[i]).show('slow');\n\t\tcards[i].classList.remove('hidden-card');\n\t}\n\n\tsortAnnouncement();\n\tfloatAnnouncements();\n}", "function clearAllFilters() { \n console.log('clearing all filters.');\n \n //set show options to default\n showSaccades(false);\n showConvexhull(false);\n\n //changes actual value of sliders\n d3.select(\"#pupilSlider\").attr(\"value\", 0);\n d3.select(\"#durationSlider\").attr(\"value\", 0);\n //changes the view of sliders\n $(\"#pupilSlider\").val(0);\n $(\"#durationSlider\").val(0);\n\n //show all plots evenly\n svg.selectAll('circle')\n .style('opacity', basicOpacity);\n\n //TODO: Clear the marks on the legend sliders\n}", "clear() {\n if (this.ready) {\n this.filters_active = false;\n this.load(this.mount);\n }\n }", "removeDataFilter() {\n this.configureDecoder(undefined, {\n filterDescription: null\n });\n }", "function resetFilters()\n{\n\tisEmpty = false;\n\t$(\".filter-result-items\").stop().fadeOut(0);\n\t$(\".filter-results-fail\").removeClass(\"active\");\n\tfor (key in selectedColors)\n\t{\n\t\tselectedColors[key] = false;\n\t\t$(\"#\" + key + \"-color-filter\").removeClass(\"active\");\n\t}\n\tpriceSlider.noUiSlider.reset();\n\tcarUsageSlider.noUiSlider.reset();\n\ttoggleTransmissionAny();\n\t$(\"#transmission-any\").prop(\"checked\", true);\n\t$(\"#transmission-any\").parent().addClass(\"active\");\n\t$(\"#transmission-auto\").parent().removeClass(\"active\");\n\t$(\"#transmission-mechanic\").parent().removeClass(\"active\");\n\tsortByPriceAsc();\n\tfor (var carIndex = 0; carIndex < allCars.length; carIndex++)\n\t{\n\t\tvar currentCar = $(allCars[carIndex]);\n\t\tcurrentCar.show();\n\t}\n\t$(\".filter-result-items\").stop().fadeIn(500);\n}", "function cleanFilters()\n\t{\n\t\t_prevSearch = \"\";\n\t\t_manualSearch = \"\";\n\t}", "_clearFilterInput() {\r\n const that = this;\r\n\r\n that._filterInfo.query = '';\r\n delete that._filterInfo.inputFilters;\r\n that.$.filterInput.value = '';\r\n }", "function clearFilters() {\n searchName = null;\n searchMemberKey = null;\n orderBy = null;\n viewTotal = 200;\n showOnlyParentGroups = true;\n flattenGroups = false;\n\n document.getElementById(\"search\").value = \"\";\n document.getElementById(\"user-sel\").value = searchMemberKey;\n document.getElementById(\"order-by-sel\").value = orderBy;\n document.getElementById(\"view-total-groups-sel\").value = viewTotal;\n document.getElementById(\"parent-groups-check\").checked = showOnlyParentGroups;\n document.getElementById(\"flatten-groups-check\").checked = flattenGroups;\n\n getAllGroups();\n}", "function reset_af(){\n\t// clear all values from require and exclude array, this rebuilds the select array\n\tthis.require = [];\n\tthis.exclude = [];\n\tthis.tables['variants']['filter'] = [];\n\n\t// update the headers\n\tthis.update_header('samples');\n}", "excelClear() {\n const that = this;\n\n that.tree.select('0');\n that.filterObject.clear();\n that.cachedFilter = that.tree.selectedIndexes.slice(0);\n }", "excelClear() {\n const that = this;\n\n that.tree.select('0');\n that.filterObject.clear();\n that.cachedFilter = that.tree.selectedIndexes.slice(0);\n }", "function clearFilters(){\n $('.js-filter-beds').prop('selectedIndex', 0);\n $('.js-filter-baths').prop('selectedIndex', 0);\n $('.js-filter-gender').prop('selectedIndex', 0);\n $('.js-filter-price').val('');\n $('.js-filter-reward').attr('checked', false);\n}", "function resetFiltersForm() {\n if ($(\".tags\").length) {\n $('input.tags').tagit('removeAll');\n }\n $('#filters .iradio').iCheck('uncheck');\n if ($('#listing-range-slider').length) {\n // listingSlider.reset();\n }\n // if ($('#public-range-slider').length) {\n // rangeSlider.reset();\n // }\n if ($(\".dropdown-select\").length) {\n $('.dropdown-select').val(\"\");\n $('.dropdown-select').selectmenu(\"refresh\");\n }\n }", "function resetFilter(e) {\n \"use strict\";\n // Prevent default form action\n e.preventDefault();\n\n // Ensure the breed list border is hidden\n var border_el = document.getElementById(\"breed_list\");\n border_el.style.display = \"\";\n\n // Clear breed visibility\n for (var i = 0; i < breeds.length; i++) {\n setBreedVisibility(breeds[i], false);\n }\n\n // Clear saved search data\n clearPageStorage();\n\n // Reset form to empty\n clearSearchForm();\n}", "resetDropdown(){\r\n this.currentText = this.currentTextValue;\r\n this.filterString = this.currentTextValue;\r\n this.unfilter();\r\n if ( this.isOpened ){\r\n this.isOpened = false;\r\n }\r\n }", "function reset() {\n attachSource(null);\n attachView(null);\n protectionData = null;\n protectionController = null;\n }", "function resetSelectFilterOnValSetName(){\n\t$('select#select_filter_on_valset_name').val(\"\");\n}", "clear()\n {\n this._keywordByFilter.clear();\n this._simpleFiltersByKeyword.clear();\n this._complexFiltersByKeyword.clear();\n this._compiledPatternsByKeyword.clear();\n this._keywordlessCompiledPatterns = false;\n this._filterDomainMapsByKeyword.clear();\n this._filterMapsByType.clear();\n }", "clearFiltersAndShow() {\n this.clearFilters(true);\n this.show();\n }", "function resetAdvFilters() {\n\n\t$('#adv_filter_state option:selected').attr('selected', false);\n\t$('#adv_filter_state option:first').attr('selected', 'selected');\n\t\n\t$('#adv_filter_locality option:selected').attr('selected', false);\n\t$('#adv_filter_locality option:first').attr('selected', 'selected');\n\t\n\t$('#adv_filter_cinema option:selected').attr('selected', false);\n\t$('#adv_filter_cinema option:first').attr('selected', 'selected');\n\t\n\t$('#adv_result_count').empty();\n\t$('#adv_result_hidden').empty();\n\n}", "function resetData() {\n\t\t\tconsole.log(\"resetData()\");\n\n\t\t\tvm.results = [];\n\t\t\tvm.selectedIndex = -1;\n\t\t\tvm.selectedMIIndex = 0;\n\t\t\tvm.selectedECIndex = 0;\n\t\t\tvm.total_count = 0;\n\t\t vm.attachOrganismValue = \"\";\n\n\t\t\t// rebuild empty apiDomain submission object, else bindings fail\n\t\t\tvm.apiDomain = {};\n\t\t\tvm.apiDomain.alleleKey = \"\";\t\n\t\t\tvm.apiDomain.alleleSymbol = \"\";\t\n\t\t\tvm.apiDomain.accID = \"\";\n\t\t}", "reset() {\n this.data = {};\n this.type = null;\n }", "clearFilters(silent) {\n this.filters.clear();\n this.filter(undefined, undefined, silent);\n }", "clearData() {\n this.barData = new Array(8).fill(null).map(_ => {\n return { A: 0, B: 0 }\n }) // one per column\n this.totalFrequencyData = { A: 0, B: 0 }\n this.totalFrequencyDataCount = 0\n this.stateMapping = new Array(10000).fill(null)\n }", "reset() {\n this.bins = [];\n this._currentBinIndex = 0;\n }", "function clear_filter(filter){\n\n\t \tjQuery(filter).each(function(){\n\t\t\t\n\t\t\t\tjQuery(this).val('');\n\n\t\t});\t\n\n\t }", "function resetAllSearchVals(){\n search_term = '';\n page = 1;\n classFilter = 'collection';\n typeFilter = 'All';\n groupFilter = 'All';\n subjectFilter = 'All';\n gcmdFilter='All';\n fortwoFilter='All';\n forfourFilter='All';\n forsixFilter='All';\n resultSort = 'score desc';\n temporal = 'All'; \n n = '';\n e = '';\n s='';\n w='';\n mapSearch=0;\n spatial_included_ids=''; \n }", "clearFilter(cleareable) {\t\n\t\tfor (let filter in this.filters) {\n\t\t\tif(this.filters[filter] && this.filters[filter].method == cleareable) {\n\t\t\t\tthis.filters = [...this.filters.slice(0, filter), ...this.filters.slice(filter+1)];\t\t\n\t\t\t}\n\t\t}\t\t\n\n\t\tthis._mapFiltered();\n\n\t\treturn this;\n\t}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "filterBuilderClear() {\n const that = this;\n\n that.filterBuilder.value = ['and'];\n\n if (that.context.filterType === 'string') {\n that.caseSensitive.checked = false;\n }\n\n that.cachedFilter = { filterBuilder: ['and'], caseSensitive: false };\n }" ]
[ "0.7956197", "0.7918837", "0.78620577", "0.7814674", "0.760837", "0.7574271", "0.7509941", "0.74767387", "0.7462391", "0.74481803", "0.7423814", "0.73675483", "0.73427725", "0.73199946", "0.7317439", "0.7246125", "0.7229161", "0.72231317", "0.72146714", "0.72030294", "0.7200136", "0.71611416", "0.71518266", "0.7120761", "0.7118665", "0.71117115", "0.7038557", "0.69610333", "0.6954739", "0.6932891", "0.69211566", "0.6883003", "0.68571347", "0.68549246", "0.68493533", "0.6848424", "0.68370533", "0.6806754", "0.6805699", "0.6804802", "0.68043286", "0.67989856", "0.6780717", "0.6752585", "0.67354506", "0.6734043", "0.6730426", "0.67247766", "0.67111665", "0.6676268", "0.6663718", "0.66620916", "0.6655582", "0.6644638", "0.6644403", "0.6626539", "0.6625804", "0.66129994", "0.65973246", "0.6592986", "0.6585283", "0.6584354", "0.6579913", "0.657664", "0.657452", "0.65615", "0.65500426", "0.6540629", "0.6532234", "0.65238154", "0.65217805", "0.65160906", "0.65160906", "0.65125793", "0.6493796", "0.648992", "0.6488523", "0.647716", "0.6476608", "0.64736277", "0.64711064", "0.6470441", "0.646997", "0.64611083", "0.6443728", "0.6443306", "0.64367324", "0.64324284", "0.64290166", "0.64275205", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414711", "0.6414493" ]
0.74113494
11
Book Object Constructor Function
function Book(book) { this.title =data.volumeInfo.title ; this.author=data.volumeInfo.author; this.description=data.volumeInfo.description || *** Description current unavailable ***; this.thumbnail = data.volumeInfo.imageLinks.thumbnail || null; this.url = ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Book(title, author){\n this.title = title\n this.author = author\n}", "function Book(title,author,isbn){\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function NewBook(title, author) {\n this.title = title;\n this.author = author;\n}", "function Book(title, author, isbn) {\r\n this.title = title;\r\n this.author = author;\r\n this.isbn = isbn;\r\n}", "function Book(title,author,rating){\n this.title = title\n this.author = author\n this.rating = rating\n}", "function Book(title, author, pages) {\n this.title = title\n this.author = author\n this.pages = pages\n}", "function Book(name, author, type)\n{\n this.name = name;\n this.author = author;\n this.type = type;\n}", "function Book(title, author, genre, numPages) {\n this.title = title\n this.author = author\n this.genre = genre\n this.numPages = numPages\n}", "function Book(title, author, rating){\n this.title = title;\n this.author = author;\n this.rating = rating;\n}", "function Book(title, author, rating) {\n this.title = title;\n this.author = author;\n this.rating = rating;\n}", "function Book(name, author, type) {\n this.name = name;\n this.author = author;\n this.type = type\n}", "function book(title, author, pageNum, read) { //constructor\n \n this.title = title\n this.author = author\n this.pageNum = pageNum\n this.read = read\n \n}", "function Book(titleParam, authorParam, pagesParam) { \n\t// 'this' keyword binds to the new created instance of the object.\n\tthis.title = titleParam;\n\tthis.author = authorParam;\n\tthis.pages = pagesParam;\n}", "function Book (title, author, rating) {\n this.title = title;\n this.author = author;\n this.rating = rating;\n}", "function Book(title, author, rating){\n\tthis.title = title;\n\tthis.author = author;\n\tthis.rating = rating;\n}", "function book(title, author, pages) {\n this.title = title;\n this.author = author;\n this.pages = pages;\n //this.read = read;\n}", "function Book(title, pages){\n this.title = title;\n this.pages = pages;\n}", "function Book(title, author, pages, read){\n this.title = title;\n this.author = author;\n this.pages = pages;\n this.read = read;\n}", "function Book(name, author, type) {\r\n this.name = name;\r\n this.author = author;\r\n this.type = type;\r\n}", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n}", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n}", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n}", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n}", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n}", "function Book (pages, author) {\r\n this.pages = pages;\r\n this.author = author;\r\n}", "constructor(id, title, author,isbn,location,picture,idUsers,description) {\n /**\n * Class Book\n * Creates an object Book\n * \n * @param id\n * @param title string is the title of the book\n * @param author string is the author of the book\n * @param isbn int is the isbn of a book\n * @param location string is the City or University location of the Book\n * @param picture string is the name of the picture\n * @returns book object\n */\n this.id = id;\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n this.location = location;\n this.picture = picture;\n this.idUsers = idUsers;\n this.description = description;\n }", "function Book(title, author, read, rating) {\n this.title = title;\n this.author = author;\n this.read = read;\n this.rating = rating;\n}", "function Book(obj) {\n this.title = obj.title;\n this.author = obj.author;\n this.numPages = obj.numPages;\n this.pubDate = new Date(obj.pubDate);\n}", "function Book(title, author, pages, read) {\n this.title = title,\n this.author = author,\n this.pages = pages,\n this.read = read\n}", "function Book(obj) {\n this.image = obj.volumeInfo.imageLinks ? obj.volumeInfo.imageLinks.thumbnail : `https://i.imgur.com/J5LVHEL.jpg`;\n this.title = obj.volumeInfo.title ? obj.volumeInfo.title : 'Title not available';\n this.author = obj.volumeInfo.authors ? obj.volumeInfo.authors : 'Author(s) not available';\n this.description = obj.volumeInfo.description ? obj.volumeInfo.description : 'Description not available';\n this.isbn = obj.volumeInfo.industryIdentifiers ? obj.volumeInfo.industryIdentifiers[0].identifier : 'N/A';\n this.bookshelf = obj.volumeInfo.categories ? obj.volumeInfo.categories[0] : 'No Categories';\n}", "function Book(title, pages){\n //call the \"parent\" (LibraryItem) constructor function\n //shares Book's \"this\" with the LibraryItem constructor\n LibraryItem.call(this);\n\n this.title = title;\n this.pages = pages;\n}", "function Book(title, author, year) {\n this.title = title;\n this.author = author;\n this.year = year;\n //this will be availble on the property of all Instance of the Book Constructor(Actually we don't want this behaviour)\n // this.getSummary = function () {\n // return `${this.title} was written by ${this.author} in ${this.year}`;\n // }\n}", "function book(type,pages,author,color,price,publishyear){\n //we use this to create a property for an object\n //this property should be the same as the parameter\n this.type=type\n this.pages=pages\n this.author=author\n this.color=color\n this.price=price\n this.publishyear=publishyear\n }", "function Book(title, author, price) {\n this.title = title;\n this.author = author;\n this.price = price;\n this.cover = null;\n this.id = null;\n this.added = null;\n this.isFavorite = false;\n\t\n return this;\n}", "function BookObj(title, author, pages, readval) {\n this.title = title;\n this.author = author;\n this.pages = pages;\n this.readval = readval;\n}", "function Book(title, author, pages, isRead) {\n this.title = title;\n this.author = author;\n this.pages = pages;\n this.isRead = isRead;\n}", "constructor(books){\n\t\tsuper();\n\t\tthis.books = books;\n\t}", "function Book(title, author,pages) {\n this.title=title;\n this.author=author;\n this.pages=pages;\n\n this.info=function(){\n return title;\n }\n}", "function Book(title, author, pages,read){\n this.title = title\n this.author = author\n this.pages = pages + \" Pages\";\n this.haveRead = read\n }", "function Book(name, author, pages, readStatus) {\r\n this.name = name;\r\n this.author = author;\r\n this.pages = pages;\r\n this.readStatus = readStatus;\r\n}", "function Book (length, author) {\n this.length = length;\n this.author = author;\n}", "function book(title, author, pages) {\r\n this.title = title\r\n this.author = author\r\n this.pages = pages\r\n this.read = 'not'\r\n this.info = function() {\r\n return `${title} by ${author}, ${pages} pages.`\r\n }\r\n }", "function Book(title, author, pages, readStatus) {\n this.title = title\n this.author = author\n this.pages = pages\n this.readStatus = readStatus\n this.info = () => `${this.title} by ${this.author}, ${this.pages} pages - ${this.readStatus}`\n}", "function Book(title, author, totalPages, status) {\n this.title = title\n this.author = author\n this.totalPages = totalPages\n this.status = status\n\n addBookToLibrary(this);\n}", "constructor(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n }", "function Book(name, details, available){\n\tthis.bookName = name;\n\tthis.details = details;\n\tthis.available = available;\n}", "function Book2 (name){\n if (!(this instanceof Book)) {\n\n // this constructor was called without \"new\"\n return new Book(name); \n }\n}", "function Book(info) {\n this.image_url= info.imageLinks?info.imageLinks.thumbnail:'https://i.imgur.com/J5LVHEL.jpg';\n this.title = info.title || 'No title available';\n this.author=info.authors;\n this.description=info.description;\n this.isbn=info.industryIdentifiers ? info.industryIdentifiers[0].identifier: 'No isbn';\n}", "function Book(isbn) {\n this.isbn = isbn;\n this.getIsbn = function () {\n return `Isbn is ${this.isbn}`;\n };\n}", "function Book(title, author, pages, read, id){\n this.title = title;\n this.author = author;\n this.pages = pages;\n this.read = read;\n this.id = id;\n this.info = () => `${this.title} by ${this.author}, ${this.pages} pages, ${this.read}`;\n}", "function Book(img, title, author, pages, read) {\r\n this.img = img;\r\n this.title = title;\r\n this.author = author;\r\n this.pages = pages;\r\n this.read = read;\r\n}", "function Book(title,author,pages, read = false) {\n this.title = title,\n this.author = author,\n this.pages = pages,\n this.read = read\n}", "constructor(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n }", "function Book (pages, author) {\n this.pages = pages;\n this.author = author;\n }", "function Book(title, author, pages, read) {\n this.title = title;\n this.author = author;\n this.pages = pages;\n this.read = read;\n this.info = function() {\n return `${title} by ${author}, ${pages} pages, ${read}`\n }\n this.export = function() {\n return [title, author, pages, read]\n }\n}", "function createBook(bookTitle, name1, name2) {\n let book = {};\n // The first property of the book object is assigned the value of bookTitle for when an aurgument is passed into the function.\n // Then the property of author is given the value of an object.\n // Then two additional values are added to the author object. Creating an object inside of an object.\n //Then the book object is pushed into the books array.\n book.title = bookTitle;\n book.author = {};\n book.author.firstName = name1;\n book.author.lastName = name2;\n books.push(book);\n // console.log(books);\n}", "function Book(id,title,cost){\n if (this.constructor.name !== \"Book\") \n return new Book(id,title,cost);\n var _id = id,\n _title = title,\n _cost = cost;\n this.id = function(){\n return _id;\n };\n this.title = function(val){\n if (typeof val === \"undefined\") return _title;\n if (val !== \"\") _title = val;\n };\n this.cost = function(val){\n if (typeof val === \"undefined\") return _cost;\n if (val > _cost) _cost = val;\n }\n}", "function bookDetail(\n title,\n author,\n publishedDate,\n description,\n category,\n price,\n currencyCode,\n thumbnail\n) {\n this.title = title;\n this.author = author;\n this.publishedDate = publishedDate;\n this.description = description;\n this.category = category;\n this.price = price;\n this.currencyCode = currencyCode;\n this.thumbnail = thumbnail;\n}", "constructor(title, author, isbn) {\n // whatever passes in as params will be assigned to title, author, isbn\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n }", "constructor(name, age, school) {\n this.name = name \n this.age = age \n this.school = school\n this.booksInProgress = []\n this.booksRead = []\n\n }", "function Person(name, surname, bookTitle, rocks) {\n this.name = name\n this.surname = surname\n this.books = bookTitle.map((book) => {\n return new Book(book)\n })\n this.rocks = rocks\n}", "function Book(title, author, pages, read){\n return {title, author, pages, read}\n \n}", "constructor(title, author, year){\n this.title = title,\n this.author = author,\n this.year = year \n }", "constructor(Author, title, price) {\n this.author = Author;\n this.title = title;\n this.price = price\n }", "constructor(title, author, pages, hasRead) {\n this.title = title ? title : \"--\";\n this.author = author ? author : \"--\";\n this.pages = pages ? pages : \"--\";\n this.hasRead = hasRead ? hasRead : false;\n this.id = bookId++;\n }", "function Book (author, title, pages, read, color){\n this.author = author;\n this.title = title;\n this.pages = pages;\n this.read = read;\n this.color = color;\n this.toggleRead = () => {\n this.read = !this.read;\n }\n this.removeFromLibrary = () => {\n library = library.filter(book => !book.equals(this));\n }\n this.equals = (book) => {\n return (this.author === book.author) && (this.title === book.title);\n }\n this.info = () => {\n return 'author: ' + this.author +\"\\ntitle: \" + this.title + \"\\npages: \" + this.pages + \"\\nread: \" + this.read;\n }\n}", "function NewLibrary() {\n//this.property = value\n this.books = [];\n this.currentCallNumber = 0;\n}", "constructor(nombre,precio,isbn){\r\n super(nombre,precio);\r\n this.isbn = isbn;\r\n }", "function _createBook(bookDetails, price) {\n var book = {\n id: makeId(),\n name: bookDetails.name,\n price: price || getRndInt(15, 121),\n imgUrl: bookDetails.imgUrl,\n rate: 0\n }\n return book;\n}", "constructor(category) {\n\t\tthis.Cat = category;\n\t\tthis.cats = [\"Art\",\"Science\",\"Sport\",\"Literature\"];\n\t\tthis._Books = [];\n\t\t//myShelf._Books.push(new Book());\n\t}", "function Booking(Place, Country, Price, Avaliable, Description, Location)\r\n{\r\n\tthis.place = Place;\r\n\tthis.country = Country;\r\n\tthis.price = Price;\r\n\tthis.avliability = Avaliable;\r\n\tthis.description = Description;\r\n\tthis.location = Location;\r\n}", "function Book(author, title, condition, price, id, ISBN, t, sold, desc, i) {\n\tthis.author = author;\n\tthis.title = title;\n\tthis.condition = condition;\n\tthis.price = price;\n\tthis.id = id;\n\tthis.isbn = ISBN;\n\tthis.tid = t;\n\tthis.sold = sold;\n\tthis.descript = desc;\n\tthis.img = i;\n\t\n\tthis.getAuthor = function() {\n\t\treturn this.author;\n\t}\n\t\n\tthis.getTitle = function() {\n\t\treturn this.title;\n\t}\n\t\n\tthis.getCondition = function() {\n\t\treturn this.condition;\n\t}\n\t\n\tthis.getPrice = function() {\n\t\treturn this.price;\n\t}\n\t\n\tthis.getId = function() {\n\t\treturn this.id;\n\t}\n\t\n\tthis.getISBN = function() {\n\t\treturn this.isbn;\n\t}\n\t\n\tthis.getTid = function() {\n\t\treturn this.tid;\n\t}\n\t\n\tthis.getSold = function() {\n\t\treturn this.sold;\n\t}\n\t\n\tthis.getDescript = function() {\n\t\treturn this.descript;\n\t}\n\t\n\tthis.getImage = function() {\n\t\treturn this.img;\n\t}\n\t\n\tthis.setSold = function() {\n\t\tthis.sold = 1;\n\t}\n}", "constructor(id,title,ISBN,publishedDate,author){\n this.id=id;\n this.title=title;\n this.ISBN=ISBN;\n this.publishedDate=publishedDate;\n this.author=author;\n }", "constructor(isbn,image,title){\n this.isbn=isbn;\n this.image = image\n this.title=title\n \n}", "function BookInformation(bookIdFromArry, language, author, imgLink) {\n this.BookInformation = bookIdFromArry;\n this.title = bookIdFromArry.toUpperCase();\n this.language = language;\n this.author = author;\n this.imgLink = imgLink;\n }", "function bookFromForm(title, author, pages, read){\n myLibrary.push(new Book(title, author, pages, read))\n\n}", "function addBookToLibrary(){\n //book = {name:\"harry\", author:\"potter\", numPages:50, isRead:true}\n \n bookName = document.getElementById(\"bookNameField\").value;\n bookAuthor = document.getElementById(\"authorNameField\").value;\n bookNumPages = document.getElementById(\"numPagesField\").value;\n bookIsRead = document.getElementById(\"isReadField\").checked;\n\n let book = new Book(bookName, bookAuthor, bookNumPages, bookIsRead);\n myLibrary.push(book);\n addCard(book);\n}", "function createBook (){\n let titleInput = document.getElementById('titleInput').value\n let authorInput = document.getElementById('authorInput').value\n let pagesInput = document.getElementById('pagesInput').value\n let readInput = document.getElementById('readInput').value\n\n let book = new Book(titleInput, authorInput, pagesInput, readInput)\n\n document.getElementById('titleInput').value = ''\n document.getElementById('authorInput').value = ''\n document.getElementById('pagesInput').value = ''\n document.getElementById('readInput').value = 'No'\n\n pushBookToLibrary(book)\n}", "function initBooks() {\n\tvar initialBooks = [\n\t\t{ \n\t\t\ttitle: \"The Three Musketeers\", \n\t\t\tauthor: \"Alexandre Dumas\", \n\t\t\tcopies: 7, \n\t\t\tisbn: \"978-1-56619-909-4\" \n\t\t},\n\t\t{ title: \"Ivanhoe\", author: \"Sir Walter Scott\", copies: 2, isbn: \"978-1-46110-482-3\" },\n\t\t{ title: \"The Count of Monte Cristo\", author: \"Alexandre Dumas\", copies: 3, isbn: \"978-1-39912-897-1\" },\n\t\t{ title: \"Last of the Mohicans\", author: \"James Fenimore Cooper\", copies: 2, isbn: \"978-1-87140-981-4\" },\n\t\t{ title: \"Moby Dick\", author: \"Herman Melville\", copies: 8, isbn: \"978-1-09713-891-7\" },\n\t\t{ title: \"A Tale of Two Cities\", author: \"Charles Dickens\", copies: 14, isbn: \"978-1-67819-414-4\" },\n\t\t{ title: \"Robin Hood\", author: \"Howard Pyle\", copies: 1, isbn: \"978-1-18904-912-4\" },\n\t\t{ title: \"Arabian Nights\", author: \"Antony Galland\", copies: 6, isbn: \"978-1-89231-991-4\" }\n\t];\n\n\treturn initialBooks;\n}", "function addBooksToLibrary(title, author, pages) {\r\n let newItem = new book(title, author, pages); \r\n myLibrary.push(newItem);\r\n }", "function Book(query, results) {\r\n this.image = results.imageLinks.thumbnail;\r\n this.title = results.volumeInfo.title;\r\n this.author = results.volumeInfo.authors;\r\n this.description = results.volumeInfo.description;\r\n this.search_query = query;\r\n}", "constructor(props) {\n super(props);\n\n this.onChangeBookTitle = this.onChangeBookTitle.bind(this);\n this.onChangeBookAuthor = this.onChangeBookAuthor.bind(this);\n this.onChangeBookContent = this.onChangeBookContent.bind(this);\n this.onSubmit = this.onSubmit.bind(this);\n\n this.state = {\n book_title: \"\",\n book_author: \"\",\n book_publishdate: \"\",\n book_content: \"\",\n books: [],\n };\n }", "function book(data) {\n var self = this;\n data = data || {};\n\n self.Title = ko.observable(data.Title);\n self.SubTitle = ko.observable(data.SubTitle);\n self.Subjects = ko.observableArray();\n self.Authors = ko.observableArray();\n self.Url = ko.observable(data.Url);\n self.Identifiers = ko.observableArray();\n self.Publishers = ko.observableArray();\n self.Publish_Places = ko.observableArray();\n self.Cover = ko.observable({\n Small: data.Cover.Small || \"\",\n Medium: data.Cover.Medium || \"\",\n Large: data.Cover.Large || \"\"\n });\n self.Number_Of_Pages = ko.observable(data.Number_Of_Pages);\n\n self.ErrorMessage = ko.observable();\n }", "function createNewBook() {\n const book = new Book(\n document.querySelector(\"#name\").value,\n document.querySelector(\"#author\").value,\n document.querySelector(\"#pages\").value,\n document.querySelector(\"#read\").value == \"true\" ? true : false\n );\n addBookToLibrary(book);\n updateLocalStorage(myLibrary);\n displayBook(book);\n toggleForm();\n}", "constructor() {\n super()\n this.state = {\n books: null, // we will load the books via the API\n }\n }", "constructor(title, genero, year){ //es un metodo, y las propiedades se enlistan dentro del constructor. \n this.title = title;\n this.genero = genero;\n this.year = year;\n }", "function Book(props) {\n\n // Define any instance methods you like, accessing persistent\n // properties using the this prefix.\n this.getFullTitle = function() {\n return this.author.name + \": \" + this.title;\n }\n\n /*\n The Storable wrapper handles property access and adds\n the following instance methods and properties:\n\n book.save() - save the instance in the associated store\n book.remove() - remove the instance in the associated store\n book._type - the object type name - readonly\n book._id - the object id - undefined for transient objects,\n and only settable on transient objects\n */\n return new db.Storable(this, props);\n}", "function BookService () {\n //making books public\n //able to ref. outside due to this.getBooks\n var books = this.books =[\n {title:'Ready Player One', author: 'Some Body'},\n {title:'LuckyEveryday', author: 'Some Body'},\n {title:'Harry Potter', author: 'Some Body'},\n {title:'Last Lecture', author: 'Some Body'},\n ];\n\n this.addBook = function (title, author) {\n var newBook = {\n title: title,\n author: author\n };\n //instantiate newBook passed in\n books.push(newBook);\n };\n\n this.getBooks = function () {\n return this.books;\n };\n\n this.getBook = function (index) {\n if (index < 0 || index >= books.length){\n return null;\n }\n return books[index];\n };\n}", "function getBookFromInput(){\n const titleInput = document.querySelector(\"#title\").value;\n const title = capitalize(titleInput);\n const author = document.querySelector(\"#author\").value;\n const pages = document.querySelector(\"#pages\").value;\n const status = document.querySelector(\"#read\").value;\n\n return new Book(title,author,pages,status);\n }", "function BookTreeBuilder() {\n}", "function addBook(bookObject, number) {\n CATALOG.push(bookObject);\n let stock = {\n numberOfCopies: number,\n numberCheckedOut: 0,\n };\n INVENTORY[bookObject.ISBN] = stock;\n renderBooks();\n}", "function BorrowBook() {\n var borrowed;\n var book_id;\n Book.call(this); // for interitance\n}", "function createBookModel($dom,fb2_file_string) {\n var book_result = new Book();\n book_result.string_book_xml = fb2_file_string;\n book_result.title = $dom.find('description').find('book-title').text();\n\n var fb2_id = $dom.find('document-info').find('id').text();\n book_result.fb2_id = (fb2_id) ? fb2_id.toUpperCase() : '';\n\n var $authors = $dom.find('description').find('author');\n var authors = [];\n authors.push($authors.find('last-name').text());\n authors.push($authors.find('first-name').text());\n authors.push($authors.find('middle-name').text());\n book_result.authors = authors.join(' ');\n book_result.cover = imageDataURI(extractCoverImage($dom));\n return book_result;\n }", "function addBookToLibrary(title, author, pages, read) {\n let book = new Book(title, author, pages, read);\n myLibrary.push(book);\n // do stuff here\n}", "function NoteBookObject(title) {\n this.titleOfObject = title;\n\n this.getTitle = function () {\n return this.titleOfObject;\n };\n\n this.setTitle = function (newTitle) {\n this.titleOfObject = newTitle;\n };\n}" ]
[ "0.8303977", "0.8147901", "0.80564195", "0.80564195", "0.80564195", "0.80564195", "0.80564195", "0.80533516", "0.8045971", "0.7991683", "0.7964191", "0.7922469", "0.7919918", "0.79190755", "0.7899478", "0.78839153", "0.7867545", "0.7863045", "0.7848527", "0.77809876", "0.77638745", "0.7762927", "0.7759426", "0.77576965", "0.775263", "0.775263", "0.775263", "0.775263", "0.775263", "0.7736724", "0.7735596", "0.7711127", "0.76998603", "0.7678472", "0.7673051", "0.76605374", "0.76505554", "0.76273525", "0.7604433", "0.76000994", "0.7591194", "0.75879127", "0.75657237", "0.7561044", "0.75505525", "0.7534214", "0.73804414", "0.73788565", "0.73239267", "0.7303495", "0.72981274", "0.7285615", "0.7253611", "0.7249746", "0.7246142", "0.72381675", "0.72140044", "0.72103554", "0.7203891", "0.7158411", "0.715476", "0.71514577", "0.71038526", "0.70915306", "0.7059287", "0.7025719", "0.6998006", "0.69552827", "0.6928375", "0.691004", "0.6882303", "0.68570584", "0.68411916", "0.68290716", "0.6766214", "0.66386443", "0.66370595", "0.6629264", "0.66247594", "0.66049826", "0.65881866", "0.65742105", "0.6449556", "0.64490265", "0.64364386", "0.6422377", "0.6416906", "0.6384479", "0.63826936", "0.6368729", "0.63293684", "0.6328853", "0.63235706", "0.6322864", "0.63016367", "0.6264049", "0.6251654", "0.62424505", "0.62352455", "0.62264556" ]
0.7537383
45
> 15 Using reduce to count a series of strings
function colorAccumulator(acc, x) { if (x === 'blue') { acc.blue += 1; } if (x === 'red') { acc.red += 1; } return acc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countWordsReduceVersion(words) {\n \"use strict\";\n return reduce(words, function(prev, cur, i, arr) {\n prev[cur] = prev[cur] ? prev[cur] + 1 : 1;\n return prev;\n }, {});\n }", "function count (instructions) {\n let total = 0\n let i = 0\n\n while (i < instructions.length) {\n const instruction = instructions[i]\n // console.log(instruction)\n\n if (instruction.type === 'CHAR') {\n // consume the char, adding 1 to the total\n total++\n i++\n } else {\n // consume the marker, which adds nothing to the total\n i++\n\n // group the instructions that are repeated by this marker\n let consumed = 0\n let group = []\n\n while (consumed < instruction.span) {\n const next = instructions[i++]\n group.push(next)\n consumed += next.strLength\n }\n\n total += (instruction.repeats * count(group))\n }\n }\n\n return total\n}", "function vowelCount(str){\n var vowels =\"aeuio\";\n return str.toLowerCase().split('').reduce(function(acc, nVal){\n if(vowels.indexOf(nVal) !== -1){\n if(acc[nVal]){\n acc[nVal]++;\n } else {\n acc[nVal] = 1;\n }\n }\n return acc;\n }, {});\n}", "function countedStringsInArray (wordList) {\n\t\tvar countedArray = wordList.reduce(function(allWords, word) { \n\t\t// Create a var that calls the reduce method on word array\n\t\t// Also function takes in args \"allWords\" and \"word\"\n\t\t if (word in allWords) {\n\t\t \t// If a word exists in all the names execute this code\n\t\t allWords[word]++;\n\t\t // add +1 instance to the hash key value for word\n\t\t }\n\t\t else {\n\t\t allWords[word] = 1;\n\t\t // If word doesn't exist add 1 to the hash key value\n\t\t }\n\t\t return allWords;\n\t\t // return the array with count of all the names\n\t\t}, {});\n\t\treturn countedArray\n\t}", "function countSubstrings(s, queries) {\n console.log('CPUs', ids.length);\n\n let currentLevel = 0;\n\n let count = Math.ceil(s.length / 20);\n let start = -count;\n let temp = [];\n iters.forEach(async (v, i) => {\n const worker = cluster.workers[ v ];\n worker.on('message', (data) => {\n let {row} = data;\n console.log(`${ dt(then) } worker ${ worker.id } response`, start, row.length);\n\n if (start + count < s.length) {\n start += count;\n worker.send({\n type: 'lengths', start, s, count, then,\n });\n }\n });\n if (start + count < s.length) {\n start += count;\n console.log(`${ dt(then) } worker ${ worker.id } start`, start);\n worker.send({\n type: 'lengths', start, s, count, then,\n });\n }\n });\n\n // console.info('substring', count);\n return [];// results;\n }", "function oddSubstrings(s){\n return [...s].reduce((count,n,i) => count + (+n % 2 ? i + 1 : 0), 0);\n}", "function howManyRepeated(str){\n let sum = 0;\n const strArr = str.toLowerCase().split(\"\").sort().join(\"\").match(/(.)\\1+/g);\n return strArr;\n}", "function fancyCount2(str){\n const joiner = \"\\u{200D}\";\n const split = str.split(joiner);\n let count = 0;\n\n for(const s of split){\n //removing the variation selectors\n const num = Array.from(s.split(/[\\ufe00-\\ufe0f]/).join(\"\")).length;\n count += num;\n }\n\n //assuming the joiners are used appropriately\n return count / split.length;\n }", "function reduceCount() {\n return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n }", "function reduceCount() {\n\t return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n\t }", "function vowelCount(str){\n const vowels = \"aeiou\";\n return str.split('').reduce(function(accm,next){\n let lowerCased = next.toLowerCase()\n if(vowels.indexOf(lowerCased) !== -1){\n if(accm[lowerCased]){\n accm[lowerCased]++;\n } else {\n accm[lowerCased] = 1;\n }\n }\n return accm;\n }, {});\n}", "function accum(s) {\n\tlet result = [];\n \n for(let i = 0; i < s.length; i++) {\n let test = s[i].repeat(i + 1);\n let bucket = test.slice(0, 1).toUpperCase() + test.slice(1).toLowerCase();\n result.push(bucket);\n }\n \n return result.join('-');\n}", "function reduceCount() {\n\t return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n\t }", "function similarLength() {\n return sampleStrings.reduce((acc, curr) => {\n return {\n ...acc,\n [`${curr.length}`]: acc[`${curr.length}`] ?\n acc[`${curr.length}`] + 1 : 1\n };\n }, {})\n}", "function reduceCount() {\n return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n }", "function freqCounter(str) {\n const freq = new Map();\n\n for (let el of str) {\n let elCount = freq.get(el) || 0;\n freq.set(el, elCount + 1);\n }\n return freq;\n}", "function countingValleys(n, s) {\n s = s.split('');\n let level = 0, countValey = 0;\n for (let el of s) {\n el === 'U' ? level++ : level--;\n el === 'U' && level === 0 ? countValey++ : ''\n }\n return countValey;\n}", "function duplicateCount(text){ //function name: duplicateCount, input = text\n text = text.toLowerCase() //lower case it to avoid errors of cap case differences\n return text.split('').filter(function (c, i) { //return a function that split each value filtering with input param c, i\n return text.indexOf(c) == i && text.indexOf(c) != text.lastIndexOf(c) //count the max recurrence and return value using\n }).length //the length of the value. \n} //end func", "function vowelCount(str) {\n const vowels = 'aeiou';\n return str.split('').reduce(function(accumulator, next) {\n let lowerCased = next.toLowerCase();\n if(vowels.indexOf(lowerCased) !== -1) {\n if(accumulator[lowerCased]) {\n accumulator[lowerCased]++;\n } else {\n accumulator[lowerCased] = 1;\n }\n }\n return accumulator;\n }, {})\n}", "function duplicateCount(text){\n const charCount = text.toLowerCase().split('').reduce((acc, char) => {\n acc[char] = acc[char] + 1 || 1; \n return acc;\n }, {});\n console.log(charCount);\n console.log(Object.keys(charCount));\n return Object.values(charCount).reduce((acc, curr) => curr > 1 ? acc+1 : acc, 0);\n}", "function countVowelConsonant(str) {\n\n return str.split(\"\").reduce(function (accumulator, currentValue) {\n let i=2;\n if(\"aeiou\".indexOf(currentValue) != -1) i=1; \n return accumulator +i;\n }, 0);\n }", "function StringReduction(str) { \nvar res = str.length + 1;\n while(res>str.length){\n res = str.length;\n str = str.replace(/ab|ba/, 'c');\n str = str.replace(/ca|ac/, 'b');\n str = str.replace(/bc|cb/, 'a');\n } ;\n \n // code goes here \n return str.length; \n \n}", "function longestStringReducing(array) {\n const reduced = array.reduce(function (longestWord, word) {\n return word.length > longestWord ? word : longestWord;\n }, \"\");\n console.log(reduced.length);\n console.log(reduced);\n return reduced.length;\n return reduced;\n}", "function vowelCount(str) {\n\tvar vowels = 'aeiou';\n\treturn str.toLowerCase().split(\"\").reduce(function(acc, next){\n\t\tif(vowels.indexOf(next) !== -1) {\n\t\t\tif(acc[next]) {\n\t\t\t\tacc[next]++;\n\t\t\t} else {\n\t\t\t\tacc[next] = 1;\n\t\t\t}\n\t\t}\n\t\treturn acc;\n\t}, {});\n}", "function reduce(key, arr) {\n return arr.length;\n }", "function countNumOfStrings(array) {\n let count = 0;\n for (let i = 0; i < array.length; i++) {\n let element = array[i];\n if(typeof element === 'string'){\n count ++\n };\n }\n return count\n}", "function runLength(str){\n let resultObj = {};\n str.split(\"\").forEach(function(val,ind,arr){\n resultObj.hasOwnProperty(val)? resultObj[val]+=1: resultObj[val]=1;\n });//end of forEach\n let resultStr = \"\";\n for(let key in resultObj){\n resultStr += resultObj[key] + key;\n }\n return resultStr;\n}//end", "function part2(data) {\n let items = data\n .map(answer => {\n let sorted = answer.join('').split('').sort().join('');\n let letterGroups = sorted.match(/(\\S)\\1*/g);\n return letterGroups.filter(letterGroup => letterGroup.length == answer.length).length;\n })\n .reduce((acc, cur) => acc + cur);\n return items;\n}", "usesAvailableLetters(input, lettersInHand) {\n\n let count = lettersInHand.reduce((tally, letter) => {\n // ????? I don't know exactly how this next line works but it does :| ?????????\n tally[letter] = (tally[letter] || 0) + 1;\n return tally;\n }, {});\n // I learned that using string interpolation requires interpolating specifics\n // or else js just prints 'object' to the console\n console.log(`hash object of tallied available letters in hand: ${Object.entries(count)}`);\n // logging without string interp. gives me what i want tho\n console.log(count);\n // split letters into an array\n const checkLetters = input.split('');\n // loop through checkLetters array\n // decrement count for each letter used\n // return false if a letter is overused or not in checkLetters hash\n for (let letter of checkLetters) {\n // console.log(letter);\n // console.log(count[letter]);\n if (letter in count && count[letter] >= 1) {\n count[letter] -= 1\n } else {\n return false;\n }\n }\n // console.log(count);\n return true\n\n }", "function getCountOfIntegersCountOfStrings(arr) {\n let obj = {Numbers: 0, Strings: 0};\n\n for (let i = 0; i < arr.length; i++) {\n let str = typeof (arr[i]);\n str = str.charAt(0).toUpperCase() + str.slice(1) + 's';\n obj[str]++;\n }\n return obj;\n\n}", "function countingValleys(n, s) {\n // Step 1: Convert string to an array of 1's and -1's\n\n // Step 2: Reduce array. If the current elevation is zero and the current value is -1, increment valleyCount\n\n const { valleyCount } = s\n .split(\"\")\n .map(val => (val === \"U\" ? 1 : -1))\n .reduce(\n (acc, val) => ({\n elevation: acc.elevation + val,\n valleyCount:\n !acc.elevation && val === -1 ? acc.valleyCount + 1 : acc.valleyCount\n }),\n { elevation: 0, valleyCount: 0 }\n );\n\n return valleyCount;\n}", "function tag(strings, ...values) {\n let a = 0;\n for (let i = 0; i < strings.length; ++i) a += strings[i].length;\n return a;\n}", "function countOccurances(main_str, sub_str) \n {\n main_str += '';\n sub_str += '';\n\n if (sub_str.length <= 0) \n {\n return main_str.length + 1;\n }\n\n subStr = sub_str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n return (main_str.match(new RegExp(subStr, 'gi')) || []).length;\n }", "async function s$2(s,n,m){const p=r$1(s);return p$1(p,R.from(n),{...m}).then((o=>o.data.count))}", "function count (string) {\n let stringArray = string.split('');\n let result = string !== '' ? Object.assign(...stringArray.map(item => ({ [item] : 0 }))) : {};\n stringArray.forEach(item => result[item] += 1)\n return result\n}", "function frequencyCounter(arr){\n\n return arr.reduce((accum, next) =>{\n accum[next] = (accum[next] || 0) + 1;\n return accum\n }, {});\n}", "function runLengthEncoding(str) {\n\tvar count = 1;\n\tvar strArr = [];\n\tfor (var i = 0; i < str.length; i++) {\n\t\tif (str[i] === str[i+1]) {\n\t\t\tcount++;\n\t\t} else {\n\t\t\tstrArr.push(count + str[i]);\n\t\t\tcount = 1;\n\t\t}\n\t}\n\treturn strArr.join(\"\");\n}", "function solve(s) {\n let subStrings = [];\n for (let index = 0; index < s.length; index++) {\n for (let index2 = index; index2 < s.length; index2++) {\n let subString = s.slice(index, index2 + 1);\n subStrings.push(subString);\n }\n }\n return subStrings.reduce((count, subStr) => {\n if (Number(subStr) % 2 === 1) {\n count += 1;\n }\n return count;\n }, 0);\n}", "function duplicateCount(str) {\n const string = str.split('').sort()\n const regex = /(.)\\1+/g\n return (string.join('').match(regex) || []).length\n }", "function count (string) { \n r = {};\n string.split('').forEach(c => r[c] = (r[c] || 0) + 1);\n return r;\n}", "function countCharacters(s) {\n return s.ranges.reduce((count, [from,to]) => {\n return count + (to - from);\n }, 0);\n}", "function countCensoredWords(sentence, words){\n if (typeof sentence === 'string' && typeof words === 'object'){\n const results = {}\n for (const key of words){\n results[key] = 0\n }\n results.total = 0\n sentence.toLowerCase().replace(/[^a-z\\s]/g, '').split(' ').map(item => {\n words.map(word => {\n if (item === word){\n results[word]++\n results.total++\n }\n })\n })\n return results\n } else {\n console.log('Please provide a string as the first parameter and a array as the second parameter')\n }\n}", "function getSrepeatCount() {\r\n srepeat_examples = [];\r\n srepeats_for_sentences = [];\r\n result = [];\r\n for(i=0; i<sentences.length; i++) {\r\n sentence = [];\r\n sentence = sentences[i].replace(/[^a-zA-Zа-яА-ЯёЁ \\n']/g, \" \");\r\n sentence = sentence.replace(/\\s+/g, \" \");\r\n sentence = sentence.toLowerCase();\r\n sentence = sentence.substring(0,sentence.length-1);\r\n sentence = sentence.split(\" \");\r\n \r\n sub_result = sentence.reduce(function (acc, el) {\r\n acc[el] = (acc[el] || 0) + 1;\r\n return acc;\r\n }, {});\r\n\r\n tmp = [];\r\n for(key in sub_result) {\r\n if(sub_result[key] > 1 && unions.indexOf(key) == -1 && prepositions.indexOf(key) == -1) {\r\n tmp.push(key);\r\n result.push(key);\r\n }\r\n }\r\n srepeat_examples.push([sentences[i], tmp]);\r\n }\r\n tmp = []\r\n for(key in srepeat_examples) {\r\n tmp = []\r\n for(i=0; i<srepeat_examples[key][1].length; i++){\r\n if(srepeat_examples[key][1].length != 0) {\r\n if(srepeat_examples[key][1][i] != \"'\" || srepeat_examples[key][1][i] == \"i\") {\r\n tmp.push(srepeat_examples[key][1][i])\r\n }\r\n }\r\n }\r\n srepeat_examples[key][1] = tmp;\r\n }\r\n\r\n count = 0;\r\n for(i=0; i<srepeat_examples.length; i++) {\r\n if(srepeat_examples[i][1].length != 0) {\r\n for(j=0; j<srepeat_examples[i][1].length; j++) {\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n return count;\r\n}", "function runLength(string) {\n var output = [];\n var counter = 1;\n if (string === '' || string === null) {\n return string;\n }\n for (var i = 0; i < string.length; i++){\n if(string[i] === string[i+1]){\n counter++;\n }\n output.push(counter + string[i]);\n }\n counter = 1;\n }", "function dualWordReduce(t, i, index, arr) {\n const innerT = t;\n if (arr[index] && arr[index + 1]) {\n if (innerT.every((z) => z.word !== `${arr[index]} ${arr[index + 1]}`)) {\n innerT.push({ word: `${arr[index]} ${arr[index + 1]}`, times: 1 });\n } else {\n const indy = t.findIndex(\n (x) => x.word === `${arr[index]} ${arr[index + 1]}`\n );\n innerT[indy].times += 1;\n }\n }\n return innerT;\n }", "function countOccurrences(wordArr) {\n let wordObj = {};\n\n wordArr.forEach(word => {\n wordObj[word] = wordObj[word] || 0;\n wordObj[word] += 1;\n }) \n \n logOccurrences(wordObj);\n return undefined;\n}", "function countStrings(arr, str) {\n //loop through the array\n let count = 0 \n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === str) {\n // if it is equal to str, add on on to count\n count ++\n // count += 1\n // count = count +1\n }\n // continue loop\n }\n return count\n}", "function countChars(string) {\n var stringArray = string.split(\"\").filter(function(x) {\n if (x !== \" \") {\n return x;\n }\n });\n\n return stringArray.reduce(function(acc, curr) {\n\n if (!acc[curr]) {\n acc[curr] = 1;\n }\n else {\n acc[curr] += 1;\n }\n return acc;\n }, {});\n}", "function duplicateCount(text) {\n text = text.toLowerCase().split(\"\")\n let result = 0 //初始化结果 \n //计算数组中每个元素出现的次数,通过Object.values数组化reduce函数计算的对象结果\n const objArr = Object.values(text.reduce((all_n, n) => {\n n in all_n ? all_n[n]++ : all_n[n] = 1\n return all_n\n }, {}))\n //循环数组,其重复的元素都记为1(无论该元素重复多少次都只记一次,未重复记0)\n objArr.forEach(ele => {\n if(ele == 1){\n ele = 0\n }else{\n ele = 1\n }\n result += ele\n })\n return result\n}", "function runLength( str ) {\n\tvar counter = 1,\n\t\tnewStr = \"\";\n\n\tfor ( var i = 0; i < str.length; i++ ) {\n\t\tif ( str[i] === str[i + 1] ) {\n\t\t\tcounter++;\n\t\t} else {\n\t\t\tnewStr += ( counter + str[i] );\n\t\t\tcounter = 1;\n\t\t}\n\t}\n\treturn newStr;\n}", "function doReduce(array) {\n \n // Since we'll be reducing multiple times and appending to reduced, \n // we empty the array before adding newly reduced values to it\n reduced = [];\n \n // Reduction begins at first and second characters\n let reduction = array.reduce((memo, curr) => {\n \n // If different letters, combine into non-included letter from set of 'abc'\n if ((memo === 'a' && curr === 'b') || (memo === 'b' && curr === 'a')) {\n return 'c';\n } else if ((memo === 'a' && curr === 'c') || (memo === 'c' && curr === 'a')) {\n return 'b';\n } else if ((memo === 'b' && curr === 'c') || (memo === 'c' && curr === 'b')) {\n return 'a';\n \n // If same letters, push one to reduced array and continue reduction\n } else {\n reduced.push(memo)\n return curr;\n }\n });\n \n // Reduction always leaves one final term, which we add\n // to the reduced array before returning it\n reduced.push(reduction)\n return reduced;\n }", "function matchingStrings(strings, queries) {\n return queries.map(q => strings.filter(s => s === q).length);\n}", "function fn(s) {\n\tvar freq = [];\n\t(function(n) {\n\t\twhile (n < 26) {\n\t\t\tfreq.push(0);\n\t\t\tn++;\n\t\t}\n\t})(0);\n\tvar current;\n\tvar dual;\n\tfor (let i = 0; i < s.length; i++) {\n\t\tif (i < s.length - 3 && s[i + 1] === '(') {\n\t\t\tcurrent = freq[s[i] - 1];\n\t\t\tcurrent += +s[i + 2];\n\t\t\tfreq[s[i] - 1] = current;\n\t\t\ti += 3;\n\t\t} else if (i < s.length - 2 && s[i + 2] === '#') {\n\t\t\t\n\t\t\tif (i < s.length - 5 && s[i + 3] === '(') {\n\t\t\t\tdual = s[i] + s[i + 1] - 1;\n\t\t\t\tcurrent = freq[+dual];\n\t\t\t\tcurrent += +s[i + 4];\n\t\t\t\tfreq[+dual] = current;\n\t\t\t\ti += 5;\n\t\t\t} else {\n\t\t\t\tdual = s[i] + s[i + 1] - 1;\n\t\t\t\tcurrent = freq[+dual];\n\t\t\t\tcurrent++\n\t\t\t\tfreq[+dual] = current;\n\t\t\t\ti += 2;\n\t\t\t}\n\n\t\t} else {\n\t\t\tcurrent = freq[s[i] - 1];\n\t\t\tcurrent++\n\t\t\tfreq[s[i] - 1] = current;\n\t\t}\n\t}\n\treturn freq;\n}", "function num_repeats(string) {\n\n}", "function sum (s) { // cheap way to identify identical strings\n return s.replace(/\\s/g, \"\").split(\"\").reduce(function (a,b){\n a = ((a<<5) - a) + b.charCodeAt(0);\n return a&a\n },0);\n}", "function testFreq(string){\n var characters = {};\n\n for (var i=0; i<string.length; i++){\n\n characters[string[i]] = \n (characters[string[i]] === undefined) ?\n 1 : \n characters[string[i]]+1;\n }\n return characters; \n}", "function count (string) { \n var count = {};\n string.split('').forEach(function(s) {\n count[s] ? count[s]++ : count[s] = 1;\n });\n return count;\n}", "function marsExploration(s) {\n let count = 0;\n s = s.split('');\n\n for (let i = 0; i < s.length; i += 3) {\n let newArr = s.slice(i, i + 3);\n if (newArr[0] != 'S') count++;\n if (newArr[1] != 'O') count++;\n if (newArr[2] != 'S') count++;\n }\n return count;\n}", "function countvowels(text){\n var character = text.toLowerCase().split('')\n var vowels = 'aeiou';\n \n var countvowels = character.reduce(function(acc,current){\n return vowels.indexOf(current) > -1 ? acc + 1 : acc;\n },0);\n \n return countvowels;\n}", "function countNumber(str){\n \n str = '' + str;\n var arr = str.split('');\n \n var ret = '';\n var cnt = 1;\n\n for( var i = 1; i < arr.length; i++ ) {\n\n \tif( i === arr.length - 1 ) { // last index\n if( arr[i] !== arr[i-1] ) {\n\t ret += '' + cnt + '' + arr[i-1];\n\t ret += '' + 1 + '' + arr[i];\n\t }\n\t else {\n\t \tcnt++;\n\t \tret += '' + cnt + '' + arr[i];\n\t }\n \t}\n \telse { // not last index\n \t\tif( arr[i] !== arr[i-1] ) {\n\t ret += '' + cnt + '' + arr[i-1];\n\t cnt = 1; \n\t }\n\t else {\n\t \tcnt++;\n\t }\n \t}\n \n }\n\n return ret;\n}", "countQuakes (data, statesObj) {\n return data.features.map(quake => {\n //split string and extract quake location\n //return array of locations\n let place = quake.properties.place.split(', ');\n return place[place.length - 1];\n }).map(occurred => {\n //if location was an abbrev, return corresponding full state name\n let index = statesObj.abbrevs.indexOf(occurred);\n if (index > -1) return statesObj.states[index]; \n else return occurred;\n }).reduce((accumulator, location) => {\n //build accumulator object to tally quakes by location\n //return object with key of location, value of #quakes occurred\n const lower = location.toLowerCase();\n if (accumulator[lower]) { \n accumulator[lower]++;\n return accumulator; \n } else { \n accumulator[lower] = 1;\n return accumulator; \n }\n }, {});\n }", "function getCount(str) {\n return (str.match(/[aeiou]/ig)||[]).length;\n }", "function sherlockAndAnagrams(s) {\n \n var map = new Map();\n var totalCount = 0;\n\n for(var i = 0 ; i < s.length; i++) {\n for(var j=i+1 ; j <= s.length; j++) {\n var SubString = s.substring(i,j);\n\n var chars = [...SubString];\n chars.sort();\n \n SubString = String(chars);\n\n if(map.has(SubString)) {\n var value = map.get(SubString);\n totalCount = totalCount + value;\n\n map.set(SubString, value+1);\n } \n else {\n map.set(SubString, 1);\n }\n }\n }\n return totalCount;\n\n\n}", "function getCount(input){\n\tvar output = _.mapValues(input, (d) => {\n return _.size(d); })\n\treturn output\n}", "function functionalLengths(states) {\n return states.reduce((lengths, state) => {\n lengths[state] = state.length;\n return lengths;\n },{});\n \n}", "function getStrLengthInArray(arr){\n // let len=0;\n // arr.forEach( (val,idx)=>{\n // len += val.length;\n // } )\n // return len;\n\n return arr.reduce( (p, v) => p + v.length , 0);\n}", "function occurrencesDice ( string, subStrings ) {\n var words = (!!string && string != '') ? string.replace(/([^\\w\\d\\s]+)/g, '').replace(/\\s(\\s+)/g, ' ').split(/\\s/) : [];\n var counter = 0;\n var occurrences = [];\n words.forEach ( function ( entry ) {\n if (entry.length > 2) {\n subStrings.forEach ( function ( subString ) {\n var value = compareTwoStrings(entry, subString);\n if (value >= minSimilarity) {\n counter++;\n var index = -1;\n for ( var i = 0; i < occurrences.length; i++ ) {\n if (occurrences[i].name == entry) {\n index = i;\n break;\n }\n }\n if (index < 0) occurrences.push({name: entry, value: 1});\n else occurrences[index].value++;\n }\n });\n }\n });\n return {value: counter, occurrences: occurrences};\n }", "function getCount4(str) {\n const vowels = {\n a: true,\n e: true,\n i: true,\n o: true,\n u: true\n };\n\n return str.split('').filter((currentLetter) => vowels[currentLetter]).length;\n}", "function noOfOccurance(str) {\n\tvar count=0;\n\tfor(let i=0; i<str.length; ++i) {\n\t\tif(str[i]==\"m\") count++\n\t}\n\treturn count;\n}", "function countComSubs(str) {\n var count = 1;\n var spc = \" \";\n var rg = new RegExp(spc, 'g');\n var res = str.match(rg);\n if (res == null) {\n count = -100;\n } else {\n count = res.length;\n }\n return count;\n}", "function getWordCounts(words) {\n return words.reduce((m,w) => {\n const count = m.get(w) || 0;\n m.set(w, count + 1);\n return m;\n }, new Map());\n}", "static countSubString(input, strToCount) {\n if (!input || !strToCount) {\n return 0;\n }\n return (input.match(new RegExp(strToCount, 'g')) || []).length;\n }", "function stringFrequency(){\n for(var i = 0; i < strLength; i++){\n frequencyMap.set(splitStrings[i], 0);\n }\n \n for(var i = 0; i < strLength; i++){\n if(frequencyMap.get(splitStrings[i]) === 0){\n uniqueWords.push(splitStrings[i]);\n }\n frequencyMap.set(splitStrings[i],\n frequencyMap.get(splitStrings[i]) + 1);\n }\n \n console.log(frequencyMap);\n return null;\n }", "function accum(s) {\n\t// capitalize string\n\ts = s.toUpperCase()\n\t// convert string to array\n\tvar newArray = s.split('');\n\t// new variable for storing result\n\tvar result = '';\n\tfor (var i = 0; i < newArray.length; i++) {\n\t\t// return character + character repeated position times \n\t\t//(if position is 0, repeat 0 times, if 1, repeat 1 times)\n\t\t// add -\n\t\tresult += newArray[i] + newArray[i].toLowerCase().repeat(i) + '-';\n\t}\n\t// return result and chop off the last -\n\treturn result.slice(0,result.length-1);\n}", "function accum(s) {\n const splitStr = s.toLowerCase().split(\"\");\n const newStr = [];\n\n let accumulator = 0;\n splitStr.forEach(element => {\n accumulator++;\n newStr.push(element[0].toUpperCase() + element.repeat(accumulator - 1));\n })\n return newStr.join(\"-\");\n}", "function countingValleys(n, s) {\n let steps = s.split('');\n let valleyCount = 0;\n let currentSeaLevel = 0;\n let valleyStatus = false;\n steps.forEach((step) => {\n step === 'U' ? currentSeaLevel++ : currentSeaLevel--;\n if (currentSeaLevel < 0 && !valleyStatus) {\n valleyCount++;\n valleyStatus = true;\n } else if (currentLevel >= 0 && valleyStatus) {\n valleyStatus = false;\n }\n });\n return valleyCount;\n}", "function count(str) {\n return str.length;\n}", "function well(x) {\r\n const num = x.reduce(\r\n (acc, cur) =>\r\n acc +\r\n cur.filter((val) => {\r\n if (typeof val === \"string\") {\r\n return val.toLowerCase() === \"good\";\r\n }\r\n }).length,\r\n 0\r\n );\r\n if (num > 2) {\r\n return \"I smell a series!\";\r\n } else if (num > 0) {\r\n return \"Publish!\";\r\n } else {\r\n return \"Fail!\";\r\n }\r\n}", "function wordLengths(str) {\n let result = str.split(' ').reduce( (acc, word) => {\n acc[word] = word.length;\n return acc;\n }, {})\n return result;\n}", "function countFirstLetter (strs) {\n return strs.reduce((acc, str) => {\n (acc[str[0]]) ? acc[str[0]] += 1 : acc[str[0]] = 1\n return acc\n }, {})\n}", "function howMuchCoffee(events) {\n let count = 0;\n let regex = /\\bother/gi;\n\n let lowerCase = events.filter(e => e === e.toLowerCase() && !e.match(regex)).length;\n console.log(lowerCase)\n count += lowerCase\n let upperCase = events.filter(e => e === e.toUpperCase() && !e.match(regex)).length;\n console.log(upperCase)\n count += upperCase * 2\n\n if (count === 0) return 0;\n if (count === 1) return 1;\n if (count === 2) return 2;\n if (count === 3) return 3;\n return 'You need extra sleep';\n}", "function getCount(str) {\n var vowelsCount = 0;\n\n // enter your majic here\n str.split('').map(function(x) {\n if(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {\n vowelsCount++;\n }\n });\n\n return vowelsCount;\n }", "function count_sets(arr, total){\n\n\n}", "function numStrings(list) {\n var count = 0\n for (var i = 0; i < list.length; i++) {\n if (typeof(list[i]) == \"string\") {\n count++;\n return;\n }\n }\n return count;\n }", "function countNumberOfElements(arr) {\n const newArr = arr.reduce(function (acc) {\n acc++;\n return acc;\n }, 0);\n return newArr;\n}", "function count(string) {\n let string1 = string.split(\"\").sort().join(\"\");\n let counter = 1;\n for (let i = 0; i < string.length; i++) {\n if (string1[i] == string1[i + 1]) {\n counter++;\n } else {\n console.log(string1[i] + \" \" + counter);\n counter = 1;\n }\n }\n}", "function countVowelRecursiveCPS(str, cont = v => v) {\n\tif (str.length == 0) return cont(0);\n\tvar first = isVowel(str[0]) ? 1 : 0;\n\treturn countVowelRecursiveCPS(str.slice(1), function f(v) {\n\t\treturn cont(first + v);\n\t});\n}", "function getCount(str) {\n // regex:\n // 'g' tells to find all matches, not just the first.\n // 'i' tells to be case insensitive.\n // What goes inside the '//'' is the pattern.\n // '[]'' tells to match any character in a set.\n // 'aeiou' are the characters in the set.\n // because of the '^' the replace function removes everything that is NOT within the\n // regex statement\n // without it, the replace function would replace all of the vowels and return only\n // the other characters\n return str.replace(/[^aeiou]/gi, '')\n // then count the length of the remaining string\n .length;\n}", "function solve(n, q, str, queries) {\n let res = []\n\n queries.forEach(query => {\n res.push(str.filter(item => item === query).length)\n })\n\n return res\n}", "function numOfApp(string) {\r\n var total = 0;\r\n for (var i = 0; i < string.length; i++) {\r\n if (string[i] === \"a\") {\r\n total++;\r\n }\r\n }\r\n return total;\r\n}", "function countCons(str) {\n // -------------------- Your Code Here --------------------\n\n var count = 0;\n var cons = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'];\n for(var i = 0; i < str.length; i++){\n if(cons.indexOf(str[i].toLowerCase()) != -1){\n count++;\n }\n }\n\n return count;\n\n // --------------------- End Code Area --------------------\n}", "function sumOfStrings(a, b) {\n\tlet strA = a.toString().split(\"\").reverse().join(\"\");\n\tlet strB = b.toString().split(\"\").reverse().join(\"\");\n\tvar sumCount = [];\n\n\tvar countArr = {};\n\tvar isCarry = 0;\n\n\tlet isFirstLong = strA.length < strB.length ? false : true;\n\tlet numberDigits = isFirstLong ? strB.length : strA.length;\n\n\tfor (let index = 0; index < numberDigits; index++) {\n\t\tconst elementA = strA[index];\n\t\tconst elementB = strB[index];\n\t\tvar result = parseInt(elementA) + parseInt(elementB) + isCarry;\n\t\t/*\n\t\tif (result > 9) {\n\t\t\tisCarry = 1;\n\t\t}\n\t\tif (index == strA.length - 1) {\n\t\t\tresult++;\n\t\t}\n\t\t*/\n\t\tcountArr[index] = result;\n\t}\n\n\tfor (const key in countArr) {\n\t\tif (countArr.hasOwnProperty(key)) {\n\t\t\tsumCount.push(countArr[key]);\n\t\t}\n\t}\n\n\t// Handle the difference in two numbers.\n\tlet diffDigits = Math.abs(strA.length - strB.length);\n\tlet startingIndex = isFirstLong ? strA.length : strB.length;\n\tlet remainingStr = isFirstLong ? strA : strB;\n\n\tfor (let index = startingIndex - diffDigits; index <= diffDigits; index++) {\n\t\tconst element = remainingStr[index];\n\t\tsumCount.push(parseInt(element));\n\t}\n\tconsole.log(sumCount.reverse().join(\"\"));\n\treturn sumCount.join(\"\");\n}", "function repeatedString(s, n) {\n var count = 0;\n var sum = 0;\n var aTail = 0;\n var array = s.split('');\n var sumEnter = (n - n % array.length) / array.length;\n var tail = n - (sumEnter * array.length);\n console.log('sumEnter ' + sumEnter);\n console.log('tail ' + tail);\n\n for (var i = 0; i < array.length; i++) {\n if ('a' == array[i]) {\n count++;\n }\n }\n\n if (n % array.length == 0) {\n sum = count * (n / array.length);\n } else {\n tail = s.substring(0, tail).split('');\n console.log('qwerty' + tail);\n tail.forEach(element => {\n if (element === 'a') {\n aTail++;\n }\n });\n sum = count * sumEnter + aTail;\n }\n console.log('sum ' + sum);\n return sum;\n}", "function repeatedString(s, n) {\n // Write your code here\n let fix = Math.floor(n / s.length);\n let count = countA(s) * fix;\n \n let leftOut = n % s.length;\n count = count + countA(s.substring(0,leftOut));\n return count;\n \n}", "function dualLetterReduce(t, i, index, arr) {\n const innerT = t;\n if (arr[index] && arr[index + 1]) {\n if (innerT.every((z) => z.word !== `${arr[index]}${arr[index + 1]}`)) {\n innerT.push({ word: `${arr[index]}${arr[index + 1]}`, times: 1 });\n } else {\n const indy = t.findIndex(\n (x) => x.word === `${arr[index]}${arr[index + 1]}`\n );\n innerT[indy].times += 1;\n }\n }\n return innerT;\n }", "function duplicateCount(text){\n return (text.toLowerCase().split('').sort().join('').match(/([^])\\1+/g) || []).length;\n}", "function countEmUp(arr){\n var allSpices = spices.join(\"\");\n return allSpices.length;\n}", "function duplicateCount(text){\n return (text.toLowerCase().split('').sort().join('').match(/([^])\\1+/g) || []).length;\n}", "function summy(stringOfInts) {\n var sum = (a, b) => +a + +b;\n return Number.parseInt(stringOfInts.split(\" \").reduce(sum));\n}", "function matchingString(strings, queries) {\n var result = [];\n queries.map(function (query) {\n var noOfresults = 0;\n strings.map(function (string) {\n if (string === query)\n noOfresults++;\n });\n result.push(noOfresults);\n });\n return result;\n}", "function stringShifter(s) {\n let counter = 0;\n for(let i=0; i < s.length; i++) {\n let tempVar = s.substring(i, s.length)+s.slice(0,i);\n if(tempVar[0] === tempVar[tempVar.length-1]) {\n counter++;\n }\n }\n return counter;\n}" ]
[ "0.67465967", "0.65763605", "0.6520738", "0.63153195", "0.62628645", "0.62329996", "0.6200181", "0.61804855", "0.61490303", "0.6143942", "0.6124046", "0.61238724", "0.61191463", "0.6112411", "0.6042359", "0.60151803", "0.59892124", "0.59835213", "0.598021", "0.5959263", "0.5959091", "0.59306586", "0.59075284", "0.5899899", "0.5894306", "0.588167", "0.5878533", "0.58777493", "0.58714557", "0.57867706", "0.5774969", "0.5762972", "0.5755193", "0.57410693", "0.57338285", "0.57334876", "0.57327884", "0.57229626", "0.57191545", "0.5712072", "0.57085717", "0.5698124", "0.5677972", "0.56777084", "0.56741047", "0.56733376", "0.5665842", "0.56580526", "0.56538594", "0.56529576", "0.5649595", "0.5646615", "0.5622767", "0.56211555", "0.5609724", "0.5609462", "0.56077963", "0.55993414", "0.5593267", "0.5591294", "0.55875844", "0.55870086", "0.55812466", "0.55794454", "0.5567968", "0.5567773", "0.55647975", "0.5563391", "0.5560579", "0.5557623", "0.5553454", "0.5551974", "0.55515766", "0.55465114", "0.5543746", "0.5538656", "0.55342156", "0.55314213", "0.5527147", "0.55233675", "0.5520982", "0.55134743", "0.5510568", "0.5502866", "0.5502313", "0.5487818", "0.5486685", "0.5484089", "0.5480622", "0.5476562", "0.54760355", "0.547395", "0.54695386", "0.54670864", "0.54642063", "0.5463008", "0.5458856", "0.5448913", "0.5441579", "0.54300356", "0.54294676" ]
0.0
-1
Same aggregation function used in the string summing example! This function is pure so we can test it to our heart's content. Which is great because most of our application logic lives here.
reduce(state, action) { switch (action) { case 'blue': return Object.assign({}, state, { blue: state.blue + 1 }); case 'red': return Object.assign({}, state, { red: state.red + 1 }); default: return state; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Aggregate() {}", "sum() {}", "function sum() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t return _underscore2.default.reduce(cleanValues, function (a, b) {\n\t return a + b;\n\t }, 0);\n\t };\n\t}", "function sumOfStrings(a, b) {\n\tlet strA = a.toString().split(\"\").reverse().join(\"\");\n\tlet strB = b.toString().split(\"\").reverse().join(\"\");\n\tvar sumCount = [];\n\n\tvar countArr = {};\n\tvar isCarry = 0;\n\n\tlet isFirstLong = strA.length < strB.length ? false : true;\n\tlet numberDigits = isFirstLong ? strB.length : strA.length;\n\n\tfor (let index = 0; index < numberDigits; index++) {\n\t\tconst elementA = strA[index];\n\t\tconst elementB = strB[index];\n\t\tvar result = parseInt(elementA) + parseInt(elementB) + isCarry;\n\t\t/*\n\t\tif (result > 9) {\n\t\t\tisCarry = 1;\n\t\t}\n\t\tif (index == strA.length - 1) {\n\t\t\tresult++;\n\t\t}\n\t\t*/\n\t\tcountArr[index] = result;\n\t}\n\n\tfor (const key in countArr) {\n\t\tif (countArr.hasOwnProperty(key)) {\n\t\t\tsumCount.push(countArr[key]);\n\t\t}\n\t}\n\n\t// Handle the difference in two numbers.\n\tlet diffDigits = Math.abs(strA.length - strB.length);\n\tlet startingIndex = isFirstLong ? strA.length : strB.length;\n\tlet remainingStr = isFirstLong ? strA : strB;\n\n\tfor (let index = startingIndex - diffDigits; index <= diffDigits; index++) {\n\t\tconst element = remainingStr[index];\n\t\tsumCount.push(parseInt(element));\n\t}\n\tconsole.log(sumCount.reverse().join(\"\"));\n\treturn sumCount.join(\"\");\n}", "function NumberAddition(str) {\n\n//remove any non numbers, leave a gap between to distinguish sets of numbers\nvar n = str.replace(/[^0-9]/g, \" \");\n\n//create array, note any nonnumbers will show up in array as \"\". ex. [,,1,,21,]\nvar arr = n.split(\" \");\nvar filtered = [];\nvar answer = 0;\n\n//remove empty strings\nfor (var i = 0; i < arr.length; i++) {\n if (arr[i] !== \"\") {\n filtered.push(arr[i]);\n }\n}\n//!!!All of the above can be achieved by the following!!!\n//str.match returns an array with patterns it finds\n//the + sign means include more than one digit together as a single pattern\n// || [0] means if no matches are found, better = [0]\nvar better = str.match(/[0-9]+/g)|| [0];\n\n//add the numbers in the array. Note they are strings and must be explicitely coerced\nfor (var y = 0; y < better.length; y++) {\n answer += Number(better[y]);\n}\n\nreturn answer;\n}", "function sumLength(string) {\n let sum = 0;\n (string + '').split('').map(e => {\n sum += +e;\n });\n return sum;\n }", "function ave(...arg) {//reduce\n return eval(arg.join('+'))/arg.length\n}", "function calculateSumOfAll()\n{\n var totalSum = 0;\n var numAsArray = numInString.split('');\n for (var i=0; i<numAsArray.length; i++ )\n {\n totalSum += parseInt(numAsArray[i]);\n }\n return totalSum;\n}", "function sumStrings(a,b) {\n \n // any empty strings:\n if(a.trim().length === 0) {\n a = 0;\n }\n \n if(b.trim().length === 0) {\n b = 0;\n }\n \n \n return (BigInt(a) + BigInt(b)).toString(10);\n \n}", "function handler_summarize() {\r\n\t// erase the output field\r\n\tconst $output = $('#output');\r\n\t$output.val('');\r\n\r\n\t// read in the input field\r\n\tconst $input = $('#input');\r\n\tlet list = $input.val().split('\\n');\r\n\r\n\t// remove blank lines\r\n\tlist = list.filter(e => !!e.length);\r\n\r\n\t// remove non-numbers\r\n\tlist = list.filter(e => /^\\d+$/.test(e))\r\n\r\n\t// sort the numbers\r\n\tlist = list.sort((a, b) => a - b);\r\n\r\n\t// remove duplicates\r\n\tlist = [...new Set(list)];\r\n\r\n\t// do we have any patterns to work with?\r\n\tif (list.length === 0)\r\n\t\treturn;\r\n\r\n\t// align all patterns to the length of the first pattern\r\n\tlet pattern_length = list[0].length;\r\n\tlist = list.filter(e => e.length === pattern_length);\r\n\r\n\t// Replace the input with our new/clean input, so the user can see what we're summarizing for them\r\n\t$input.val(list.join(\"\\n\"));\r\n\r\n\t// Summarize the patterns and return the patterns; one per line\r\n\t$output.val(summarize(list).join(\"\\n\"));\r\n\r\n\treturn;\r\n}", "function sumStrings(a,b) {\r\n var lenA = a.length, lenB = b.length;\r\n var digitsA = a.split('').reverse();\r\n var digitsB = b.split('').reverse();\r\n var maxLen = Math.max(lenA, lenB) + 1;\r\n \r\n for (let i = 0; i < maxLen; i++) {\r\n if (!digitsA[i]) digitsA[i] = '0';\r\n if (!digitsB[i]) digitsB[i] = '0';\r\n }\r\n\r\n var carryOver = 0, colSum = 0, sum = '';\r\n for (let i = 0; i < maxLen; i++) {\r\n colSum = parseInt(digitsA[i]) + parseInt(digitsB[i]) + carryOver;\r\n colSum = colSum.toString();\r\n \r\n if (colSum.length > 1) {\r\n sum += colSum[1];\r\n carryOver = parseInt(colSum[0]);\r\n }\r\n\r\n else {\r\n sum += colSum[0];\r\n carryOver = 0;\r\n } \r\n }\r\n\r\n sum = sum.split('').reverse();\r\n if (sum[0] === '0') {\r\n let i = 0;\r\n while (sum[i] === '0') i++;\r\n sum.splice(0, i);\r\n }\r\n\r\n return sum.join('')\r\n}", "function aggregate(data, aggregation_type, string_to_count) {\n console.log(\"data in aggregation\", data)\n console.log(\"aggregation_type \", aggregation_type)\n var sum = 0;\n var normal_data = 0;\n var sum_of_squares = 0.0;\n var len = data.length;\n var new_mean, counter = 0;\n\n if (aggregation_type == 0 ) {\n for (i = 0; i<len; i++) {\n sum += data[i];\n }\n return (sum/data.length)\n }\n\n else if(aggregation_type == 1){\n\n for (i = 0; i<len; i++) {\n\n if(typeof data[i] === 'number'){\n \n sum += data[i];\n console.log(\"Math.pow(data[i],2)\", Math.pow(data[i],2))\n var square = Math.pow(data[i],2);\n sum_of_squares += square;\n console.log(\"sum of squares\", sum_of_squares)\n\n }\n \n } \n console.log(\"sum \", sum, \"len \", len)\n var mean = sum/len;\n console.log(\"mean\", mean)\n variance = stats.variance(data)\n console.log(\"variance\", variance)\n var sd = stats.stdev(data)\n console.log(\"sd\", sd)\n console.log(\"normal values are between :\", mean+sd, \"and \",mean-sd)\n for (i = 0; i<len; i++) {\n if(typeof data[i] === 'number'){\n if((data[i] <= (mean + sd)) && (data[i] >= (mean - sd))){\n console.log(\"normal data : \", data[i])\n normal_data += data[i];\n counter += 1;\n }\n else continue;\n }\n else continue;\n } \n return new_mean = normal_data / counter;\n }\n\n else if (aggregation_type == 2 ){\n var positive_responses = [\"success\",\"yes\",\"1\",\"positive\",\"true\"];\n var negetive_responses = [\"failure\",\"no\",\"0\",\"negetive\",\"unsuccessfull\",\"false\"];\n bool_data = [];\n for(var i=0;i<data.length;i++)\n {\n if(positive_responses.indexOf(data[i]) !== -1)\n {\n bool_data.push(true);\n }\n if(negetive_responses.indexOf(data[i]) !== -1)\n {\n bool_data.push(false);\n }\n }\n console.log(bool_data);\n var set = new Set(bool_data);\n var arr = Array.from(set);\n count_a = 0;\n count_b = 0;\n for(var i=0;i<bool_data.length;i++)\n {\n if(bool_data[i]==arr[0])\n {\n count_a+=1; // 0\n }else{\n count_b+=1; // 1\n }\n }\n if(count_a===count_b)\n {\n console.log(\"Equal Positive and Negative responses, returning :\", arr[1])\n return 2;\n }else if(count_a>count_b)\n {\n console.log(\"Unequal Positive and Negative responses\")\n return arr[0];\n }else{\n console.log(\"Unequal Positive and Negative Responses\")\n return arr[1];\n }\n\n }\n else if (aggregation_type == 3 ){\n return Math.max(...data);\n }\n else if (aggregation_type == 4 ){\n return Math.min(...data);\n }\n else if (aggregation_type == 5 ){\n for (i = 0; i<len; i++) {\n sum += data[i];\n }\n return sum;\n }\n else if (aggregation_type == 6 ){\n return data[0];\n }\n else if (aggregation_type == 7 ){\n return data[len-1];\n }\n else if (aggregation_type == 8 ){\n\n return stats.median(data);\n \n }\n else if (aggregation_type == 9 ){\n console.log(\"handata \",data);\n var modes = [], count = [], i, number, maxIndex = 0;\n \n for (i = 0; i < data.length; i += 1) {\n number = data[i];\n count[number] = (count[number] || 0) + 1;\n if (count[number] > maxIndex) {\n maxIndex = count[number];\n }\n }\n \n for (i in count)\n if (count.hasOwnProperty(i)) {\n if (count[i] === maxIndex) {\n modes.push(Number(i));\n }\n }\n console.log(\"mode arr: \",modes);\n modes.sort();\n console.log(\"modessssssssssss\", modes);\n return modes[(modes.length-1)];\n }\n else if (aggregation_type == 10 ){\n console.log(\"string data: \",data);\n var count = 0;\n for(var i=0;i<data.length;i++)\n {\n if(data[i]==string_to_count)\n {\n count+=1;\n }\n }\n console.log(\"string count is: \",count);\n return count;\n }\n\n else return null\n}", "function accum(s) {\n\tlet result = [];\n \n for(let i = 0; i < s.length; i++) {\n let test = s[i].repeat(i + 1);\n let bucket = test.slice(0, 1).toUpperCase() + test.slice(1).toLowerCase();\n result.push(bucket);\n }\n \n return result.join('-');\n}", "function sum (s) { // cheap way to identify identical strings\n return s.replace(/\\s/g, \"\").split(\"\").reduce(function (a,b){\n a = ((a<<5) - a) + b.charCodeAt(0);\n return a&a\n },0);\n}", "function sum(s, e) {\r\n return s + e;\r\n }", "function fun3(){\n\tvar numbers = prompt('enter the numbers');\n\n\nvar sumNumbers = function(numbers){\nvar regExp = /\\d/g;\nvar arrNumbers = numbers.match(regExp).map(function(elt){ //transformation array with string to array with numbers\n\treturn +(elt);\n\n});\nvar result = arrNumbers.reduce(function(sum,current){ //sum all of numbers in string\n\treturn sum+current; \n},0);\nreturn result;\n\n}\nconsole.log(sumNumbers(numbers));\n\n}", "function sumStrings(a, b) {\n let num = 1n;\n if (a === '') {\n a = '0';\n }\n if (b === '') {\n b = '0';\n }\n a = parseInt(a);\n b = parseInt(b);\n const sum = BigInt(a+b);\n return sum.toString();\n}", "reduce(input) {\n const map = input.reduce((res, { Ingredient, Quantity, ...rest }) => {\n if (res[Ingredient]) {\n res[Ingredient].Quantity += Quantity\n } else {\n res[Ingredient] = { Ingredient, Quantity, ...rest }\n }\n return res\n }, {})\n \n const res = Object.values(map)\n return res;\n }", "function NumberAddition(str) {\n // First we charge our input string into an array by splitting it at every alphabetic character.\n // Note that this regex expression will match any capital or lowercase letter.\n str = str.split(/[a-zA-Z]/);\n // Next, we declare a sum variable to hold our answer.\n var sum = 0;\n\n // After that, we loop through each element in our modified array...\n for (var i = 0; i < str.length; i++) {\n // ...and if it isn't an empty string...\n if (str[i] !== \"\") {\n // ...we parse its value with parseInt and add it to our answer.\n sum += parseInt(str[i]);\n }\n }\n\n // Finally, we return our answer\n return sum;\n}", "function summy(stringOfInts) {\n var sum = (a, b) => +a + +b;\n return Number.parseInt(stringOfInts.split(\" \").reduce(sum));\n}", "function sumStrings(a, b) {\n let portionA = a === '' ? ['0'] : a.split('').reverse(),\n portionB = b === '' ? ['0'] : b.split('').reverse(),\n result = [],\n upOne = 0,\n numA,\n numB\n\n if (portionB.length > portionA.length) {\n const changing = portionB\n portionB = portionA\n portionA = changing\n }\n\n for (i = 0; i < portionA.length; i++) {\n numA = portionA[i] ? parseInt(portionA[i], 10) : 0\n numB = portionB[i] ? parseInt(portionB[i], 10) : 0\n\n const sum = upOne === 0 ? numA + numB : numA + numB + upOne\n\n upOne = 0\n\n if (sum > 9 && i != portionA.length - 1) {\n const sumArr = sum.toString().split('')\n upOne = parseInt(sumArr[0], 10)\n\n result.unshift(sumArr[1].toString())\n } else {\n result.unshift(sum.toString())\n }\n }\n\n return result.join('').replace(/^0+/, '')\n}", "function findSum(str) {\n let sum = 0;\n let val = { 'a': 1,'b': 2,'c':3,'d':4,'e':5,'f':6,\n 'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,\n 'm':13,'n':14,'o':15,'p':16,'q':17,'r':18,\n 's':19,'t':20,'u':21,'v':22,'w':23,'x':24,\n 'y':25,'z':26 };\n \n for (let i = 0; i < str.length; i++) {\n sum += val[str[i]];\n }\n return sum;\n}", "function sum() { push(\"Math\", `${first} + ${second} equals ${String(first + second)}`) }", "function sumSquares(numStr){\n\n let sum = numStr.split(\"\")\n .map((str)=> Number(str))\n .map((num)=> num * num)\n .reduce((num1,num2)=> num1 + num2);\n return sum;\n}", "function weightedUniformStrings(s, queries) {\n\n let weights = new Set();\n let prev = s.charAt(0);\n let sum = 0;\n s=s.toLowerCase();\n for(let i = 0; i < s.length; i++){\n if(s.charAt(i) != prev){\n prev = s.charAt(i);\n sum = 0;\n }\n sum += s.charAt(i).charCodeAt()-97+1;\n weights.add(sum);\n }\n \n let ra=[];\n \n for(let a0 = 0; a0 < queries.length; a0++){\n let x = queries[a0];\n if(weights.has(x)) {\n ra.push(\"Yes\");\n } else {\n ra.push(\"No\");\n }\n \n }\n return ra;\n}", "function sum(num) {\n return String(num).split('')\n .map(Number)\n .reduce((x, y) => { \n return x + y;\n });\n}", "function reduceMergeSum(input, mergeBy, sumProp) {\n return input.reduce((acc, cur) => {\n if (acc.some((element) => element[mergeBy] === cur[mergeBy])) {\n acc.filter((element) => element[mergeBy] === cur[mergeBy])[0][sumProp] += +cur[sumProp];\n } else {\n acc.push({\n [mergeBy]: cur[mergeBy],\n [sumProp]: parseFloat(cur[sumProp]),\n });\n }\n return acc;\n }, [])\n }", "function reduceToBase(recipeString) {\n let reduced\n let ingrediants = []\n let recipe = { ...db.find(recipeString) }\n if (recipe) {\n ingrediants = ingrediants.concat(recipe.ingrediants)\n } else {\n console.log(recipeString, 'not found')\n return\n }\n\n function reduce() {\n reduced = true;\n ingrediants.forEach(function (ingrediant, index) {\n // If they are crafted ingrediants... \n if (ingrediant.type == \"crafted\") {\n reduced = false\n // remove them...\n ingrediants = ingrediants.filter(item => item.name !== ingrediant.name)\n // and replace them in the array with their components\n let newIngrediants = []\n db.find(ingrediant.name).ingrediants.forEach(function (i) {\n newIngrediants.push(i)\n })\n ingrediants = ingrediants.concat(newIngrediants)\n\n } else {\n\n }\n })\n if (!reduced) {\n console.log('reducing')\n reduce()\n } else {\n console.log('reduction complete')\n }\n }\n reduce()\n\n console.log(ingrediants)\n let totals = []\n ingrediants.forEach(function (i) {\n if (!totals.find(total => total.name == i.name)) {\n let emptyTotal = { ...i }\n emptyTotal.qty = 0\n totals.push(emptyTotal)\n }\n })\n console.log(totals)\n ingrediants.forEach(function (i) {\n totals.forEach(function (tot) {\n if (tot.name == i.name) {\n tot.qty += i.qty\n }\n })\n })\n console.log('----final total list----')\n console.log(totals)\n }", "function aggAvg(input) {\n // the average will be the sum / count\n var sum = 0;\n var count = 0;\n var length = input.length;\n for (var i = 0; i < length; i++) {\n var currentItem = input[i];\n var itemIsGroupResult = main_1.Utils.exists(currentItem) && typeof currentItem.value === 'number' && typeof currentItem.count === 'number';\n // skip values that are not numbers (ie skip empty values)\n if (typeof currentItem === 'number') {\n sum += currentItem;\n count++;\n // check if it's a group (ie value is a wrapper object)\n }\n else if (itemIsGroupResult) {\n // we are aggregating groups, so we take the\n // aggregated values to calculated a weighted average\n sum += currentItem.value * currentItem.count;\n count += currentItem.count;\n }\n }\n // avoid divide by zero error\n var value = null;\n if (count !== 0) {\n value = sum / count;\n }\n // the result will be an object. when this cell is rendered, only the avg is shown.\n // however when this cell is part of another aggregation, the count is also needed\n // to create a weighted average for the next level.\n var result = {\n count: count,\n value: value,\n // the grid by default uses toString to render values for an object, so this\n // is a trick to get the default cellRenderer to display the avg value\n toString: function () {\n if (typeof this.value === 'number') {\n return this.value.toString();\n }\n else {\n return '';\n }\n },\n // used for sorting\n toNumber: function () {\n return this.value;\n }\n };\n return result;\n}", "function mapAggregates(thingy, aggregates) {\n if (!thingy)\n return thingy;\n if (thingy.type === 'aggregate') {\n let found = false;\n let v;\n for (let key of Object.keys(aggregates)) {\n if (equal(aggregates[key], thingy)) {\n v = factory.createTerm(key);\n found = true;\n break;\n }\n }\n if (!found) {\n v = generateFreshVar();\n aggregates[rdf_string_1.termToString(v)] = thingy;\n }\n return v;\n }\n // non-aggregate expression\n if (thingy.expression)\n thingy.expression = mapAggregates(thingy.expression, aggregates);\n else if (thingy.args)\n mapAggregates(thingy.args, aggregates);\n else if (Array.isArray(thingy))\n thingy.forEach((subthingy, idx) => thingy[idx] = mapAggregates(subthingy, aggregates));\n return thingy;\n}", "function stringConcat(arr) {\n const result = arr.reduce(function(total, num){\n\t\treturn total += num.toString(); \n\t});\n \treturn result;\n}", "function add(input) {\n const [a, b] = input.split(' ');\n return Number(a) + Number(b);\n}", "function sum() {\r\n\tvar items = sum.arguments.length;\r\n\tvar thissum = 0;\r\n\tvar thisnum;\r\n\tvar usedNums = false;\r\n\tfor (i = 0; i < items; i++) {\r\n\t\tthisnum = sum.arguments[i];\r\n\t\tif (isFloat(thisnum) && thisnum != 'NaN') {\r\n\t\t\tthissum += parseFloat(thisnum);\r\n\t\t\tusedNums = true;\r\n\t\t} else if (thisnum != null && thisnum != \"undefined\" && thisnum != \"\" && thisnum != 'NaN') {\r\n\t\t\treturn 'NaN';\r\n\t\t}\r\n\t}\r\n\treturn (usedNums ? thissum : 'NaN');\t\r\n}", "function reduceProp(input, sumProp) {\n return input.reduce((acc, cur) => {\n return parseFloat(acc) + parseFloat(cur[sumProp]);\n }, 0);\n }", "function sumFunc(substr,pattern){\n console.log(\"sumFunc\");\n console.log(\" parsing string: \"+substr+\" using pattern: \"+pattern);\n var vars = [\"None\",\"None\",\"None\",\"None\"];\n var i = 0;\n\n var bounds = getBounds(substr,1);\n i+= bounds[2];\n\n //code for assumed sum goes here\n //for the defaults i'm using it will throw an error because it doesn't know if i is greater than or less than 0\n //you can use assume(i>0) in sage to fix this.\n\n if(bounds[1] != \"\"){\n if(bounds[1].match(\"=\")!=null){\n if(isVar(bounds[1].substring(0,bounds[1].indexOf(\"=\")))){\n vars[2] = bounds[1].substring(0,bounds[1].indexOf(\"=\"));\n vars[1] = bounds[1].substring(bounds[1].indexOf(\"=\")+1);\n }\n }\n else{\n console.error(\" lower bound is empty\");\n errors.push(\"Sum lower bound is empty.\");\n }\n }\n\n if(bounds[0].length > 0) vars[0] = bounds[0];\n var func = parseLatex(substr.substring(i)); \n \n if(func.length>0){\n vars[3] = func;\n if(vars[3].match(vars[2])==null){\n console.error(\"summation variable does not appear in function\");\n //warnings.push(\"Summation variable does not appear in function.\"); //NOT SURE THAT IT GETS HERE EVER\n }\n }\n else{\n console.error(\"Summation requires a formula\");\n errors.push(\"Summation requires a formula\");\n }\n \n console.log(\"putting variables in pattern: \"+vars); \n return([parsePattern(pattern,vars),substr.length]);\n}", "function part2(data) {\n let items = data\n .map(answer => {\n let sorted = answer.join('').split('').sort().join('');\n let letterGroups = sorted.match(/(\\S)\\1*/g);\n return letterGroups.filter(letterGroup => letterGroup.length == answer.length).length;\n })\n .reduce((acc, cur) => acc + cur);\n return items;\n}", "function sum(arg) {\n return arg.reduce(function (lastValue, curr) { return lastValue + curr; });\n}", "function toSum(sum, item) {\n return sum + item;\n}", "function getAggFunc(a,b){if(void 0===a&&(a=\"sum\"),void 0===b&&(b=null),\"count\"===a)return function(a){return a.length};var c;return c=a in percentiles?function(c,d){var e;return e=b?c.sort(function(a,c){return d3array.ascending(b(a),b(c))}):c.sort(d3array.ascending),d3array.quantile(e,percentiles[a],d)}:d3array[a],b?function(a){return c(a.map(b))}:function(a){return c(a)}}", "function plainSum(num){\n return num;\n}", "function reduceText(accumulator, current) {\n let ckey = accumulator._ckey;\n if (/^[A-Z]/.test(current)) {\n ckey = current.match(/^(?<id>[A-Z]+)/).groups.id;\n accumulator[ckey] = new Array();\n };\n accumulator[ckey].push(current.slice(12));\n accumulator._ckey = ckey;\n return accumulator;\n}", "function kungfoo(input) {\n var sum = input.reduce(function(acc, iter, i){\n return acc + iter*2\n }, 0)\n return sum;\n}", "function orderWeight(strng) {\n\n const sumOf = (str) => {\n let sum =0;\n for(n of str)\n sum=sum+parseInt(n)\n return sum\n }\n\n return strng\n .split(' ')\n .sort((a, b) => {return (\n sumOf(a) === sumOf(b) ?\n a - b : sumOf(a) - sumOf(b)\n )})\n .join(' ')\n}", "function getWeight(str){\n result = 0;\n array = str.split('');\n array.forEach(element => {\n result += Number(element);\n });\n return result;\n}", "function computeSum(first, second) {\n const longer = first.length >= second.length ? first : second;\n const shorter = first.length < second.length ? first : second;\n return longer.reduce((acc, cur, i) => {\n acc.push(shorter[i] ? cur + shorter[i] : cur);\n return acc\n }, [])\n}", "function addsum(n) {\n let sum = 0;\n let parts = n.split('+');\n console.log(parts.length);\n \n for (let i = 0; i < parts.length; i++) {\n \n let num= parseInt(parts[i]);\n sum += num;\n }\n return sum\n}", "function sumStrings(a,b) {\n\n var result = [];\n a = a.replace(/^0+/, '');\n b = b.replace(/^0+/, '');\n a = a.split('').reverse();\n b = b.split('').reverse();\n \n for (var i = 0; (a[i] >= 0) || (b[i] >= 0); i++) {\n var sum = (parseInt(a[i]) || 0) + (parseInt(b[i]) || 0);\n\n if (!result[i]) { result[i] = 0; }\n\n var next = ((result[i] + sum) / 10) | 0;\n result[i] = (result[i] + sum) % 10;\n\n if (next) { result[i + 1] = next; }\n }\n \n return result.reverse().join('');\n}", "function sum(arrayS){\nconst sumArray=(accumulator,currentValue)=>accumulator+currentValue;\nlet sum=arrayS.reduce(sumArray);\nconsole.log(\"sum of Array item is \"+sum)\n}", "function summy(stringOfInts) {\n var total = 0;\n var nums = stringOfInts.split(\" \");\n for (i = 0; i < nums.length; i++) {\n total += parseInt(nums[i]);\n }\n return total;\n}", "function calculate(str) {\n return str.replace(/\\s+/g, \"\").split(\"+\").reduce((a,b)=>a+Number(b),0);\n}", "function sumMix(x){\n return x.reduce(function (total, n) { return total = total + Number(n); }, 0);\n \n \n}", "findSum(operand1, operand2) {\n let result = '';\n let op1 = operand1; let\n op2 = operand2;\n // Swap if first string is larger than second one\n if (op1.length > op2.length) {\n [op1, op2] = [op2, op1];\n }\n\n const n1 = op1.length;\n const n2 = op2.length;\n const diff = n2 - n1;\n\n // Initially take carry zero\n let carry = 0;\n\n // Traverse from end of both Strings\n for (let i = n1 - 1; i >= 0; i--) {\n // Do school mathematics, compute sum of\n // current digits and carry\n const sum = parseInt(op1[i]) + parseInt(op2[i + diff]) + carry;\n result = (sum % 10) + result;\n carry = Math.floor(sum / 10);\n // console.log(sum + \" \" + result+\" \"+carry);\n }\n\n // Add remaining digits of op2[]\n for (let i = n2 - n1 - 1; i >= 0; i--) {\n const sum = parseInt(op2[i]) + carry;\n result = (sum % 10) + result;\n carry = Math.floor(sum / 10);\n // console.log(sum + \" \" + result+\" \"+carry);\n }\n\n // Add remaining carry\n if (carry > 0) result = carry + result;\n\n return result;\n }", "function sum() { return Array.prototype.slice.call(arguments).join('+'); }", "add() {\n var sum = 0;\n // Extracting the number in the string\n if (typeof arguments[0] == \"string\") {\n if (arguments[0].match(/\\d+/)) {\n let slot_num = arguments[0].match(/\\d+/);\n slot_num = Number(slot_num);\n sum = this.get_slot(slot_num) + arguments[1];\n return sum;\n }\n }\n if (arguments[0] == \"LAST\") {\n sum = arguments[1] + this.last();\n return sum;\n }\n for (let i = 0; i < arguments.length; i++) {\n sum += arguments[i];\n }\n this.lastNumber = sum;\n return sum;\n }", "function sum(a) {\n\tvar currentSum = a;\n\n\tfunction addNumber(b){\n\t\tcurrentSum +=b;\n\t\treturn addNumber;\n\t}\n\n addNumber.toString = function(){\n \treturn currentSum;\n }\n return addNumber;\n }", "function add(a,b) {\r\n let [a_str, b_str] = [a, b].map((e) => e.split('').reverse().join(''))\r\n let number = 0\r\n let result = []\r\n for (let i = 0; i < (a.length > b.length ? a.length : b.length); i++) {\r\n let sum = ((+a_str[i] || 0) + (+b_str[i] || 0) + number)\r\n number = sum > 9 ? Math.floor(sum / 10) : 0\r\n result.push(sum % 10)\r\n }\r\n if (number !== 0) result.push(number)\r\n return result.reverse().join('')\r\n}", "function digitSum (str) {\n if (str.length === 1) { return str; }\n else {\n let out = str;\n do {\n out = (out+'').split('').map(el => +el).reduce((a, b) => a + b);\n } while ((out+'').length > 1);\n return out+'';\n }\n}", "_sum (arr) {\r\n return arr.reduce((acc,val) => acc+val)\r\n }", "sum(arr) {\n let add = (a, b) => a + b;\n return arr.reduce(add);\n }", "function divCon(x) {\n console.log(x)\n const numTotal = x.filter(num => typeof num === 'number').reduce((a, b) => a + b, 0)\n\n console.log(numTotal)\n const stringTotal = x.filter(num => typeof num === 'string').map(n => parseInt(n)).reduce((a, b) => a + b, 0)\n console.log(stringTotal)\n\n let result = numTotal - stringTotal\n\n return result\n\n}", "function accum(s) {\n // a place to store the result\n let result = \"\";\n //iterate over sting\n for (let i = 0; i < s.length; i++) {\n // append the current letter i+1 times to the string\n for (let j = 0; j < i + 1; j++) {\n if (j == 0) {\n // ap the first append\n result += s[i].toUpperCase();\n } else {\n result += s[i].toLowerCase();\n }\n }\n // append a dash if it is not the last letter\n if (i != s.length-1) {\n result += '-';\n }\n }\n return result;\n}", "function getTotal(){//basically, if we have a string of 8 + 8 - 5.2, getTotal will then evaluate it and return u a single number\n //we want to evaluate to that with getTotal similar to previous function i think\n //set totalString=inputs array and then join it together as a string\n totalString = inputs.join(\"\");\n //target our steps array and evaluate it and then return the total of it \n //to evaluate a string as a math operator, u r gonna use eval method to do that for u\n $(\"#steps\").html(eval(totalString));\n \n }", "function sumMix(x){\n return x\n .map(el => typeof el === 'string' ? el *=1 : el)\n .reduce((a, b) => a + b)\n}", "function provideSum() {\n return Blockly.Lua.provideFunction_(\n 'math_sum',\n ['function ' + Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_ + '(t)',\n ' local result = 0',\n ' for _, v in ipairs(t) do',\n ' result = result + v',\n ' end',\n ' return result',\n 'end']);\n }", "function processData(input) {\n //Enter your code here\n\n let sum = 0,\n count = 1;\n // console.log(str);\n\n let weight = [];\n\n let chars = \"abcdefghijklmnopqrstuvwxyz\".split(\"\");\n // console.log(chars);\n\n for (let i = 0; i < chars.length; i++) {\n weight.push(count++);\n }\n // console.log(weight);\n\n for (let i = 0; i < input.length; i++) {\n if (chars.indexOf(input[i]) !== -1) {\n sum = sum + weight[chars.indexOf(input[i])];\n console.log([chars.indexOf(input[i])]);\n }\n }\n console.log(sum);\n}", "function accum(s) {\n let upperCaseS = s.toUpperCase();\n let stringToArray = Array.from(upperCaseS); // s.split(\",\");\n let result=\"\";\n let newResult;\n\n\n\n \n for(i=0; i<upperCaseS.length; i++){\n result = result + upperCaseS[i] + upperCaseS[i].repeat(i).toLowerCase();\nresult= result+'-';\n\n\n }\n newResult= result.slice(0, -1);\n return newResult;\n\n}", "function accum(s) {\n // your code\n var accumArray = []\n var accumString = \"\"\n\n for(var i=0;i<s.length;i++) {\n var placeHolder = []\n placeHolder.push(s[i].toUpperCase())\n \n for(var j=0;j<i;j++) {\n placeHolder.push(s[i].toLowerCase()) \n } \n accumArray.push(placeHolder)\n }\n \n for(var i=0;i<accumArray.length-1;i++) {\n accumArray[i].push('-')\n }\n \n for(var i=0;i<accumArray.length;i++) { \n accumString += accumArray[i].join('')\n }\n \nreturn accumString;\n}", "function sum() {\n \n}", "function getSum(a, b ){\n return a + b;\n}", "function accum(s) {\n let arr = s.toString().split(\"\").map(x => x.toLowerCase())\n let result = \"\"\n\n for (i=0; i < arr.length; i++) { //treat each letter individually in s\n let substring = \"\"\n \n for (j=0; j < i+1; j++) { //for loop for the number of times that is j to i+1\n // Add the letter to that string\n if (j===0) {\n substring += arr[i].toUpperCase()\n } else {\n substring += arr[i]\n }\n }\n if (i===0) { \n result += substring\n } else {\n result += \"-\" + substring\n }\n }\n\n return result\n}", "function getSum(accumulator, value){\n return accumulator + value;\n}", "function avg(){\n var a = calc.input.value.toString();\n a=a.split(\"+\");\n calc.input.value=eval(calc.input.value)/a.length;\n end=false;\n \n}", "function addTogether(){\n let args = [...arguments];\n let filtered = args.filter(x => Number.isInteger(x));\n if(filtered.length < args.length){\n return undefined;\n }\n if(args.length === 1){\n return function(y){\n if(Number.isInteger(y)){\n return args[0] + y;\n }\n return undefined;\n }\n }\n return args.reduce((a,b) => a+b);\n}", "function targetSum(str, value) {\n for (let i = 0; i < str.length - 1; i++) {\n let firstValue = str[i];\n\n for (let j = i; j < str.length; j++) {\n let secondValue = str[j];\n\n if (firstValue + secondValue === value) {\n return [firstValue, secondValue];\n }\n }\n }\n\n return [];\n}", "function accum(s) {\n\t// capitalize string\n\ts = s.toUpperCase()\n\t// convert string to array\n\tvar newArray = s.split('');\n\t// new variable for storing result\n\tvar result = '';\n\tfor (var i = 0; i < newArray.length; i++) {\n\t\t// return character + character repeated position times \n\t\t//(if position is 0, repeat 0 times, if 1, repeat 1 times)\n\t\t// add -\n\t\tresult += newArray[i] + newArray[i].toLowerCase().repeat(i) + '-';\n\t}\n\t// return result and chop off the last -\n\treturn result.slice(0,result.length-1);\n}", "function calculateSum(dates){\n dates = dates.replaceAll(\"-\",\"\");\n let sum = 0;\n for(let i=0; i<dates.length; i++){\n sum = sum + Number(dates.charAt(i))\n }\n return sum;\n}", "function f(input) {\n if (input.length !==2 ||\n input.some ((elem) => {return typeof elem !== 'number'})) \n {\n return undefined\n }\n return input.reduce ((sum,curr) => {\n return sum + curr;},\n 0\n )\n ;\n }", "function sum() {\n return mid + final;\n}", "function sumAndMultiply(a,b,c){ //eslint-disable-line\n// You may not use the arithmetic operators +, use sum(), and *, use multiply, in this function\n\n// [0] first element is the sum of those three numbers\n var sumAB = sum(a, b); // function returns array [sum, string], need sumAB[0]\n\n var totalSum = sum(sumAB[0], c); // function returns array [sum, string], need totalSum[0] for int sum, totalSum[1] for string\n console.log('totalSum[0]: ', totalSum[0]);\n console.log('totalSum[1]: ', totalSum[1]);\n\n// [1] second element is the product of those three numbers\n var productAB = multiply(a, b); // function returns array [product, string], need productAB[0]\n\n var totalProduct = multiply(productAB[0], c); // function returns array [product, string], need totalProduct[0] for int product, totalProduct[1] for string\n console.log('totalProduct[0]: ', totalProduct[0]);\n console.log('totalProduct[1]: ', totalProduct[1]);\n\n// [2] third element is \"4 and 7 and 5 sum to 16.\" = a and b and c sum to totalSum.\n console.log('third element: ', 'a + \" and \" + b + \" and \" + c + \" sum to \" + totalSum[0] + \".\"');\n// [3] fourth element is \"The product of 4 and 7 and 5 is 140.\" = the product of a and b and c is totalProduct\n console.log('fourth element: ', '\"The product of \" + a + \" and \" + b + \" and\" + c + \" is \" + totalProduct[0] + \".\"');\n\n// return array [0, 1, 2, 3]\n console.log('look: ', totalSum[0], totalProduct[0], a + ' and ' + b + ' and ' + c + ' sum to ' + totalSum[0] + '.', 'The product of ' + a + ' and ' + b + ' and ' + c + ' is ' + totalProduct[0] + '.');\n\n return [totalSum[0], totalProduct[0], a + ' and ' + b + ' and ' + c + ' sum to ' + totalSum[0] + '.', 'The product of ' + a + ' and ' + b + ' and ' + c + ' is ' + totalProduct[0] + '.'];\n}", "formatRecipeIngredients(){\n const ingLong=['tablespoons','tablespoon','teaspoons','teaspoon','ounces','ounce','cups','cup','cans','can',\n 'kilograms','kilogram','kg','grams','gram','g','pinch','cloves'];\n const ingShort=['tbsp','tbsp','tsp','tsp','oz','oz','cup','cup','can','can','kg','kg','kg','g','g','g','pinch','clove'];\n \n const newIngredient=this.ingredients.map(ing=>{\n //1. make measures standard\n let ingredient= ing.toLowerCase();\n console.log(ingredient);\n ingLong.forEach((el,index)=>{\n ingredient=ingredient.replace(el,ingShort[index]);\n\n });\n\n //2.remove parenthesis\n ingredient=ingredient.replace(/ *\\([^)]*\\) */g, ' ');\n\n //3. separate ingredients into count, unit, and ingredient\n let ingObj;\n const ingArr=ingredient.split(' ');\n const unitIndex=ingArr.findIndex(value=>ingShort.includes(value));\n\n if(unitIndex>-1){\n //unit exists so separate count from unit into countArr\n //EX. [4,1/2,tomato,paste,dip]=> countArr=['4','1/2']\n //eval(countArr.join('+'))=>eval(\"4+1/2\")--> 5\n const countArr=ingArr.slice(0,unitIndex);\n let count;\n if(countArr.length===1){\n //countArr=['4-1/2']\n count=eval(ingArr[0].replace('-','+'));\n }else{\n //countArr=['4','1/2']\n count=eval(ingArr.slice(0,unitIndex).join('+'));\n }\n ingObj={\n count,\n unit:ingArr[unitIndex],\n ingredient:ingArr.splice(unitIndex+1).join(' ')\n };\n\n }else if(parseInt(ingArr[0],10)){//eval(ingArr[0].replace('-','+')),10)\n //no unit exist only number EX. [4,tomato,paste] or[4-1/2,tomato,paste]\n ingObj={\n count:parseInt(ingArr[0],10),\n unit:'',\n ingredient:ingArr.slice(1).join(' ')\n }\n }else if(unitIndex===-1){\n //no unit, no count only ingredient\n ingObj={\n count:1,\n unit:'',\n ingredient:ingredient \n }\n }\n\n return ingObj;\n });\n\n this.ingredients= newIngredient;\n \n }", "function weightedUniformStrings(s, queries) {\n let u;\n let w = [];\n for (let c = 0; c < s.length; c++) {\n if (c == 0 || s[c] != s[c-1]) u = 0;\n u += s[c].charCodeAt(0) - 96;\n w.push(u);\n }\n \n let r = [];\n for (let q = 0; q < queries.length; q++) {\n r.push(w.includes(queries[q]) ? 'Yes' : 'No'); \n }\n return r;\n}", "function getSums (arr){\n var result = []\n if(!arr.length) return result\n\n var totalSum = arr.reduce(function (previous, current){\n result.push(previous)\n return previous + current\n })\n result.push(totalSum) //without this line the last element of the work reduce will not be displayed\n return result\n}", "function calculateValue(value) {\n\n total = 0;\n for( var i = 0; i < value.length; i++){ \n if(!isNaN(value.charAt(i))) {\n\n } else {\n var val = alphabetWithValues.get(value.charAt(i).toLowerCase());\n total = total + val;\n }\n }\n return total;\n\n}", "function avg() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t var sum = _underscore2.default.reduce(cleanValues, function (a, b) {\n\t return a + b;\n\t }, 0);\n\t return sum / cleanValues.length;\n\t };\n\t}", "function summarize(data) {\n if (view.viewFunctions.summarize) {\n var result = [],\n values = $scope.values,\n object = {\n value: 0,\n type: '',\n format: ''\n }\n\n if ($scope.summarize.length > 0) {\n result = $scope.summarize;\n }\n\n for (var i = 0; i < values.length; i++) {\n if (result.length !== values.length) {\n result[i] = object;\n object = {\n value: 0,\n type: '',\n format: ''\n };\n\n result[i].type = values[i].type;\n result[i].format = values[i].format;\n }\n\n for (var j = 0; j < data.length; j++) {\n if (values[i].type === 'digits') {\n var value = findMatch(data[j], values[i].matchValue);\n\n if (value !== null) {\n result[i].value += value;\n }\n } else {\n result[i] = {};\n }\n }\n }\n\n $scope.summarize = result;\n }\n }", "function sumFromString(str){\n var nums = str.match(/\\d+/g);\n if (nums == null){\n return 0;\n } else {\n var sum = 0;\n for (var i = 0; i < nums.length; i ++){\n sum += Number(nums[i]);\n }\n return sum;\n }\n}", "function sumMix(x) {\n var s_new = x.map((x) => parseInt(x)).reduce((sum, number) => sum + number);\n return(s_new)\n}", "function sumData(data) {\n\n return data.reduce(sum);\n }", "convertStrings(array) {\n array.forEach((entry) => {\n entry.total = parseInt(entry.total);\n entry.drove_alone = parseInt(entry.drove_alone);\n entry.taxi = parseInt(entry.taxi);\n entry.total_carpool = parseInt(entry._2_person_carpool)\n + parseInt(entry._3_person_carpool) + parseInt(entry._4_person_carpool)\n + parseInt(entry._5_or_6_person_carpool)\n + parseInt(entry._7_or_more_person_carpool);\n entry.car_total = entry.drove_alone + entry.taxi + entry.total_carpool;\n entry.total_public_transit = parseInt(entry.bus) + parseInt(entry.streetcar_or_trolley)\n + parseInt(entry.subway) + parseInt(entry.railroad);\n entry.bicycle = parseInt(entry.bicycle);\n entry.motorcycle = parseInt(entry.motorcycle);\n entry.worked_at_home = parseInt(entry.worked_at_home);\n });\n }", "function add(s) {\n if (s !== null && s !== '') {\n splitValues = s.split(/,|\\n/);\n return splitValues.reduce((a, b) => a + Number(b), 0);\n } else {\n return 0;\n }\n}", "function accumulativeParser(condition, str) {\n let accumulations = [];\n let accumulator = \"\";\n\n for (let i = 0; i < str.length; ++i) {\n let ch = str[i];\n\n if (condition(ch)) {\n accumulator += ch;\n } else if (accumulator !== \"\") {\n accumulations.push(accumulator);\n accumulator = \"\";\n }\n }\n\n return accumulations;\n}", "function add(a, b) {\n var res = '', c = 0\n a = a.split('')\n b = b.split('')\n while (a.length || b.length || c) {\n c += ~~a.pop() + ~~b.pop()\n res = c % 10 + res\n c = c > 9\n }\n return res \n}", "function sumDigits(num)\n{\n// declaring variable for array and setting it equal to and array of the letters\n var arr = num.toString().split(\"\");\n\n// initialize the sum\n var sum = 0;\n// for loop that adds the digits\n for(var i = 0; i<arr.length; i++) {\n // add each digit to the sum of previous digits\n\t sum = sum + parseInt(arr[i]);\n }\nreturn sum;\n}", "function appetize(total){\n\n}", "function sumMix(x) {\n let sum = 0; \n x.map(function(element){\n sum += parseInt(element);\n })\n return sum; \n}", "function MapSum() {\n const trie = new Trie();\n\n /**\n * @param {string} key\n * @param {number} val\n * @return {void}\n */\n const insert = (key, val) => {\n trie.insert(key, val);\n };\n\n const dfs = node => {\n if (!node) return 0;\n let total = node.val;\n for (const child of node.children) {\n total += dfs(child);\n }\n return total;\n };\n\n /**\n * @param {string} prefix\n * @return {number}\n */\n const sum = prefix => {\n let node = trie.root;\n for (const ch of prefix) {\n node = node.children[ch.charCodeAt() - 97];\n if (!node) return 0;\n }\n return dfs(node);\n };\n\n return { insert, sum };\n}", "function agregateFunc ( row, aggr, value, curr) {\r\n\t\t\t\t// default is sum\r\n\t\t\t\tvar arrln = aggr.length, i, label, j, jv;\r\n\t\t\t\tif($.isArray(value)) {\r\n\t\t\t\t\tjv = value.length;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tjv = 1;\r\n\t\t\t\t}\r\n\t\t\t\tmember = [];\r\n\t\t\t\tmember.root = 0;\r\n\t\t\t\tfor(j=0;j<jv;j++) {\r\n\t\t\t\t\tvar tmpmember = [], vl;\r\n\t\t\t\t\tfor(i=0; i < arrln; i++) {\r\n\t\t\t\t\t\tif(value == null) {\r\n\t\t\t\t\t\t\tlabel = $.trim(aggr[i].member)+\"_\"+aggr[i].aggregator;\r\n\t\t\t\t\t\t\tvl = label;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tvl = value[j].replace(/\\s+/g, '');\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tlabel = (arrln === 1 ? vl : vl+\"_\"+aggr[i].aggregator+\"_\"+i);\r\n\t\t\t\t\t\t\t} catch(e) {}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcurr[label] = tmpmember[label] = calculation( aggr[i].aggregator, curr[label], aggr[i].member, row);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmember[vl] = tmpmember;\r\n\t\t\t\t}\r\n\t\t\t\treturn curr;\r\n\t\t\t}", "function add (stringOfNumbers) {\n var sum = 0\n var arrayOfNumbers = stringOfNumbers.split(',')\n\n for (var i = 0; i < arrayOfNumbers.length; i += 1) {\n sum += parseInt(arrayOfNumbers[i], 10)\n }\n\n return sum\n}", "function splitSum(numString, splitChar){\n var numbers = numString.split(splitChar);\n var sum = numbers.reduce(function(prev, curr){\n return prev*1 + curr*1;\n });\n //could have done:\n // sum = numbers.map(Number) <== 'Number' is a function (built-in)\n // or used parseInt function ==> to convert strings to numbers\n return sum;\n}", "function digitSum(st)\n {\n let sum = 0;\n for(let i = 0; i<st.length; i++)\n {\n sum+=Number(st.charAt(i));\n }\n return sum.toString();\n\n }", "function accum(s) {\n const result = []\n const lowerStr = s.toLowerCase()\n\n for(let i = 0; i < lowerStr.length; i++) {\n let str = lowerStr[i].toUpperCase()\n for(let j = 0; j < i; j++) {\n str += lowerStr[i]\n }\n result.push(str)\n }\n\n return result.join(\"-\")\n}" ]
[ "0.6318301", "0.5813306", "0.57832223", "0.5775831", "0.57717377", "0.57579803", "0.57409316", "0.5715209", "0.5688394", "0.56684715", "0.56453717", "0.564485", "0.563962", "0.56204325", "0.55836797", "0.55479014", "0.5540423", "0.54968804", "0.5464229", "0.5406033", "0.53642404", "0.5361528", "0.53137773", "0.53017145", "0.52952325", "0.5293003", "0.529235", "0.527741", "0.52763677", "0.5267049", "0.525592", "0.52530664", "0.5246296", "0.5239129", "0.5237799", "0.52365303", "0.5224991", "0.52225137", "0.52216244", "0.52160054", "0.5214687", "0.5214467", "0.5198227", "0.519292", "0.5191964", "0.51785654", "0.5178496", "0.5163766", "0.51617014", "0.5160104", "0.5155513", "0.5154084", "0.51539224", "0.51513904", "0.51442844", "0.51397574", "0.51359445", "0.5134881", "0.5129621", "0.5115106", "0.51127225", "0.5112156", "0.51107085", "0.51063794", "0.5104932", "0.51011044", "0.5092926", "0.5092568", "0.5087892", "0.50876385", "0.5086535", "0.5072703", "0.50600135", "0.50595695", "0.50530237", "0.5039649", "0.50360566", "0.50304747", "0.5027993", "0.5026789", "0.5019965", "0.5016161", "0.50072086", "0.5003391", "0.49991518", "0.49948078", "0.49892172", "0.49863294", "0.4985189", "0.49820226", "0.49808133", "0.4979832", "0.49782553", "0.49763843", "0.49744347", "0.49741167", "0.49720362", "0.4968855", "0.49685618", "0.49663162", "0.4961314" ]
0.0
-1
Returns an Observable that emits each updated state
state() { return this._state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor (initialState = {}) {\n this.emitter = new EventEmitter()\n this.updates = new Map()\n this.observers = new Map()\n this.applicators = new Map()\n this.current = initialState\n\n /**\n * Creates a held source stream that holds application state.\n * Held streams output the last value on subscription.\n */\n this.source = hold(\n fromEvent(eventKey, this.emitter)\n .scan((state, event) => {\n /**\n * Actions that request state changes are passed in to the stream with\n * side effects happening within the execution of update functions\n */\n return fold(this.updates.values(), (state, update) => {\n // Apply applicators to each update\n let up = update\n if (this.applicators.size > 0) {\n for (const apply of this.applicators.values()) {\n up = apply(update)\n }\n }\n\n // Execute the update and return the result to the fold\n return up(state, event)\n }, state)\n }, initialState)\n .tap(state => {\n this.current = state\n })\n )\n\n // @TODO investigate why unsubscribing this sole subscriber\n // causes double events when the next observer comes in.\n // @TODO how to utilise these internally\n this.source.subscribe({\n next: function debug () {},\n error: function debug () {}\n })\n // subscription.unsubscribe()\n }", "observeData(state) {\n for (let key in state) {\n if (state.hasOwnProperty(key)) {\n this.makeObservable(key, state);\n }\n }\n return state;\n }", "get update() {\n return this.updateSubject.asObservable();\n }", "_updateChangeSubscription() {\n // Sorting and/or pagination should be watched if MatSort and/or MatPaginator are provided.\n // The events should emit whenever the component emits a change or initializes, or if no\n // component is provided, a stream with just a null event should be provided.\n // The `sortChange` and `pageChange` acts as a signal to the combineLatests below so that the\n // pipeline can progress to the next step. Note that the value from these streams are not used,\n // they purely act as a signal to progress in the pipeline.\n const sortChange = this._sort ?\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"merge\"])(this._sort.sortChange, this._sort.initialized) :\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"of\"])(null);\n const pageChange = this._paginator ?\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"merge\"])(this._paginator.page, this._internalPageChanges, this._paginator.initialized) :\n Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"of\"])(null);\n const dataStream = this._data;\n // Watch for base data or filter changes to provide a filtered set of data.\n const filteredData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([dataStream, this._filter])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._filterData(data)));\n // Watch for filtered data or sort changes to provide an ordered set of data.\n const orderedData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([filteredData, sortChange])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._orderData(data)));\n // Watch for ordered data or page changes to provide a paged set of data.\n const paginatedData = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__[\"combineLatest\"])([orderedData, pageChange])\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__[\"map\"])(([data]) => this._pageData(data)));\n // Watched for paged data changes and send the result to the table to render.\n this._renderChangesSubscription.unsubscribe();\n this._renderChangesSubscription = paginatedData.subscribe(data => this._renderData.next(data));\n }", "function Observable() {\n\t/**\n\t * Lista di osservatori che richiedono di essere notificati ad un cambiamento di stato.\n\t * @type {Array.<Observer>}\n\t * @private\n\t */\n\tthis.observers = [];\n\n}", "function computedObservable () {\n return computedObservableState.getObservableValue()\n }", "notify() {\n this.observer[0].update(this.state);\n }", "function Observable() {\n this.listeners = {};\n }", "function Observable(updateUrl) {\n\tthis.data = null;\n\tthis.observers = [];\n\tthis.updateUrl = updateUrl;\n\n\tthis.notify = function (){\n\t\tfor (var i = 0; i < this.observers.length; i++) {\n\t\t\tthis.observers[i].onChange(this, this.data);\n\t\t}\n\t};\n\tthis.subscribe = function (observer) {\n \tthis.observers.push(observer);\n\t};\n\n\tthis.update = function () {\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: this.updateUrl,\n\t\t\tcomplete: $.proxy(function (msg, status) {\n\t\t\t\ttry {\n\t\t\t\t\tif (status == \"success\") {\n\t\t\t\t\t\tvar res = $.parseJSON(msg.responseText);\n\t\t\t\t\t\tthis.data = res;\n\t\t\t\t\t\tthis.notify();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow \"Bad response: status= \" + status;\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\talert(\"Si e' verificato un errore durante la richiesta della lista giocatori. [\" + err + \"]\");\n\t\t\t\t}\n\n\t\t\t}, this)\n\t\t});\n\t};\n\n}", "function observable (newParameterValue) {\n // Cria Middleware\n const createdMiddleware = middlewareTools.createMiddleware({\n middleware,\n observableState,\n newParameterValue\n })\n\n return initialize.observable({\n observableState,\n newParameterValue,\n createdMiddleware\n })\n }", "emitStateChanges() {\n const currentState = store.getState();\n switch (true) {\n case !this.previousState.slides.length && !!currentState.slides.length:\n this.eventBus.emit(MAIN_CHANNEL, 'initialized');\n break;\n case !_.isEmpty(this.previousState.currentSlide) && !this.engine.slideEquals(currentState.currentSlide, this.previousState.currentSlide):\n this.eventBus.emit(MAIN_CHANNEL, 'gotoSlide', { slide: currentState.currentSlide });\n break;\n }\n this.previousState = currentState;\n }", "function emitChangeEvent() {\n this.setState((state) => {\n // don't interfere with state\n const { selectedToEmit, deselectedToEmit } = state;\n // apply change as side effect\n if (_.isFunction(this.props.onChange) && (selectedToEmit.length || deselectedToEmit.length)) {\n this.props.onChange({\n added: selectedToEmit,\n removed: deselectedToEmit,\n });\n }\n\n return { selectedToEmit: [], deselectedToEmit: [] };\n });\n}", "function observableFromReduxStore(store) {\n return (0, _event.observableFromSubscribeFunction)(store.subscribe).startWith(null) // emit the current state on subscribe\n .map(() => store.getState());\n}", "function Observable()\n{\n\t// list of observers\n\tObject.defineProperty( this, '_observers', {\n\t\tvalue : new Array(),\n\t\tenumerable : false, // property is not enumerable, so it won't appear in JSON\n\t\twritable : false, // can't be replaced with another object, but array can still be changed\n\t\tconfigurable : false, // can't be deleted\n\t});\n}", "function tokenStream() {\n\n return Observable.from(TOKENS);\n}", "function observe(obs, updateCurrent){ \n var next_state = {};\n \n for(var i in current_state){\n next_state[i] = 0;\n }\n \n var total = 0;\n for(var i in transition(false)){\n next_state[i] += transition(false)[i]*observation_model[i][obs]\n total += transition(false)[i]*observation_model[i][obs];\n //console.log(i,current_state[i],observation_model[i][obs]);\n }\n //console.log(total);\n \n for(var i in next_state){\n next_state[i] = next_state[i]/total;\n }\n \n if (updateCurrent){\n current_state = next_state;\n states_array.push(current_state);\n }\n else {return next_state;} \n }", "function createWithObservable() {\n return Object(__WEBPACK_IMPORTED_MODULE_1__streamingComponent__[\"a\" /* streamingComponent */])(props$ => props$.pipe(Object(__WEBPACK_IMPORTED_MODULE_0_rxjs_operators__[\"distinctUntilChanged\"])((props, prevProps) => props.observable === prevProps.observable), Object(__WEBPACK_IMPORTED_MODULE_0_rxjs_operators__[\"switchMap\"])(props => props.observable.pipe(Object(__WEBPACK_IMPORTED_MODULE_0_rxjs_operators__[\"map\"])(observableValue => props.children\n ? props.children(observableValue)\n : id(observableValue))))));\n}", "notifySubscribers() {\n const { subscribers } = this;\n\n for (const subscriber of subscribers) {\n subscriber(this.state, this);\n }\n }", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE)\n d.onBecomeStale();\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE)\n d.onBecomeStale();\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE)\n d.onBecomeStale();\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE)\n d.onBecomeStale();\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "privateSendUpdate () {\n this.emit('update', this.getState())\n }", "getObservable()\n {\n return this.subject.asObservable();\n }", "constructor() {\n super();\n this.clicked = false;\n this.observable = Observable.create(observer => {\n var count = 0;\n observer.next(count);\n setInterval(() => {\n count += 1;\n count = count > 10 ? 0 : count;\n observer.next(count);\n }, 1000);\n });\n this.observable.subscribe(count => {\n store.dispatch(observEvent(count));\n });\n }", "function State(name, initialState, options) {\n var self = this;\n this.name = name;\n this.initialState = \"..$**INITIALSTATE**$..\";\n if (initialState === undefined) {\n initialState = this.initialState;\n }\n\n this.subject = new BehaviorSubject_BehaviorSubject(initialState);\n this.withLogs = options.withLogs === undefined ? true : options.withLogs;\n this.withStringify = options.withStringify === undefined ? true : options.withStringify;\n this.errorHandler = console.error;\n\n function log(m) {\n if (self.withLogs) {\n console.debug(m, [\"Event\", \"State\"]);\n }\n }\n\n function formatData(d) {\n if (self.withStringify) {\n return JSON.stringify(d);\n }\n return d;\n }\n\n function applyOptions(event, options) {\n if (options.builder) {\n event = options.builder(event);\n }\n\n if (options.scheduler) {\n event = s.pipe(observeOn(options.scheduler), subscribeOn(options.scheduler));\n }\n\n return event;\n }\n\n return {\n raw: function raw() {\n log(\"[Raw] @ Raw subscribing to \" + self.name);\n return self.subject.pipe(skipWhile(function (o) {\n return o === self.initialState;\n }), tap(function (o) {\n log(\"[Raw] => Event \" + self.name + \" received (\" + formatData(o) + \")\");\n }, self.errorHandler));\n },\n on: function on(callback, options) {\n options = options || {};\n if (!callback) {\n console.error(\"Event callback is undefined.\");\n return null;\n }\n\n log(\"[On] @ Subscribing to \" + self.name);\n\n var s = self.subject.pipe(skipWhile(function (o) {\n return o === self.initialState;\n }), tap(function (o) {\n log(\"[On] => Event \" + self.name + \" received (\" + formatData(o) + \")\");\n }, self.errorHandler));\n\n s = applyOptions(s, options);\n\n return s.subscribe(callback);\n },\n once: function once(callback, options) {\n options = options || {};\n if (!callback) {\n console.error(\"Event callback is undefined.\");\n return null;\n }\n\n log(\"[Once] @ Subscribing to \" + self.name);\n\n var s = self.subject.pipe(skipWhile(function (o) {\n return o === self.initialState;\n }), tap(function (o) {\n log(\"[Once] => Event \" + self.name + \" received (\" + formatData(o) + \")\");\n }, self.errorHandler), take(1) // initial and new state\n );\n\n s = applyOptions(s, options);\n\n return s.subscribe(callback);\n },\n update: function update(data) {\n if (self.isCompleted) {\n logger.warn(\"The event \" + self.name + \" is actually closed, updating it is impossible.\");\n return;\n }\n\n // Emit\n log(\"[Update] <= Updating \" + self.name + \" (\" + data + \")\");\n self.subject.next(data);\n },\n close: function close() {\n self.subject.complete();\n }\n };\n}", "observe(value) {\n const queries = splitQueries(Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_1__[\"coerceArray\"])(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n let stateObservable = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__[\"combineLatest\"])(observables);\n // Emit the first state immediately, and then debounce the subsequent emissions.\n stateObservable = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__[\"concat\"])(stateObservable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"take\"])(1)), stateObservable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"skip\"])(1), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"debounceTime\"])(0)));\n return stateObservable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"map\"])(breakpointStates => {\n const response = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach(({ matches, query }) => {\n response.matches = response.matches || matches;\n response.breakpoints[query] = matches;\n });\n return response;\n }));\n }", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE) {\n if (d.isTracing !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale();\n }\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "function propagateChanged(observable) {\n // invariantLOS(observable, \"changed start\");\n if (observable.lowestObserverState === IDerivationState.STALE)\n return;\n observable.lowestObserverState = IDerivationState.STALE;\n var observers = observable.observers;\n var i = observers.length;\n while (i--) {\n var d = observers[i];\n if (d.dependenciesState === IDerivationState.UP_TO_DATE) {\n if (d.isTracing !== TraceMode.NONE) {\n logTraceInfo(d, observable);\n }\n d.onBecomeStale();\n }\n d.dependenciesState = IDerivationState.STALE;\n }\n // invariantLOS(observable, \"changed end\");\n}", "trackAll(pollInterval) {\n return timer(0, pollInterval).pipe(\n exhaustMap(() => this.getAll()),\n distinctUntilChanged((a, b) => ArrayDeepEquals(a, b, this.itemEqualityComparer))\n );\n }", "function dirtyUiStream(output$, current$) {\n return xs.combine(output$, current$)\n .map(([output, current]) => !equals(output, current))\n .compose(debounce(10))\n .compose(dropRepeats(equals))\n .startWith(false)\n}", "updateRendererStateObject()\r\n {\r\n // copy keys and values of both subscription returned data into the renderer state so the renderer \r\n // state will fill up with the gathered and always upToDate values\r\n for(var key in this.lastChangedAvTransportData)\r\n {\r\n // check if value has changed or if new key is not existent, if so then we do emit an event with the key and value\r\n if(this.rendererState[key] != this.lastChangedAvTransportData[key])\r\n {\r\n this.logVerbose(key + \" has changed from '\" + this.rendererState[key] + \"' to '\" + this.lastChangedAvTransportData[key] + \"'\");\r\n this.emit(\"rendererStateKeyValueChanged\", this, key, this.rendererState[key], this.lastChangedAvTransportData[key], \"\");\r\n }\r\n this.rendererState[key]=this.lastChangedAvTransportData[key];\r\n }\r\n for(var key in this.lastChangedRenderingControlData)\r\n {\r\n // check if value has changed or if new key is not existent, if so then we do emit an event with the key and value\r\n if(this.rendererState[key] != this.lastChangedRenderingControlData[key])\r\n {\r\n this.logVerbose(key + \" has changed from '\" + this.rendererState[key] + \"' to '\" + this.lastChangedRenderingControlData[key] + \"'\");\r\n this.emit(\"rendererStateKeyValueChanged\", this, key, this.rendererState[key], this.lastChangedRenderingControlData[key], \"\");\r\n }\r\n this.rendererState[key]=this.lastChangedRenderingControlData[key];\r\n }\r\n }", "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "get initState() {\n return this._initState.asObservable();\n }", "updateObservers(update){\n\n this.observers.forEach(function(observer){\n\n observer.getUpdate(update);\n });\n }", "_updateAndEmitSignalingStateChange(state) {\n if (state === this.signalingState) {\n return;\n }\n\n this._signalingState = state;\n\n logger.debug(\n 'emitting \"signalingstatechange\", signalingState:',\n this.signalingState);\n\n const event = new yaeti.Event('signalingstatechange');\n\n this.dispatchEvent(event);\n }", "_emitChange() {\n // Must create array copy so React may detect changes\n const payload = this.queue.map(info => {\n const { stream, ...metaInfo } = info;\n return { ...metaInfo }\n });\n this.onQueueChange(payload);\n }", "rollforward() {\n let next = this.transactions.reduce(this.dispatch.bind(this), this.base)\n\n if (next !== this.state) {\n this.state = next\n this.emit(this.state)\n }\n\n return this\n }", "stateChanges(events) {\n let source = docChanges(this.query, this.afs.schedulers.outsideAngular);\n if (events && events.length > 0) {\n source = source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(actions => actions.filter(change => events.indexOf(change.type) > -1)));\n }\n return source.pipe(\n // We want to filter out empty arrays, but always emit at first, so the developer knows\n // that the collection has been resolve; even if it's empty\n Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"startWith\"])(undefined), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"pairwise\"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])(([prior, current]) => current.length > 0 || !prior), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(([prior, current]) => current), this.afs.keepUnstableUntilFirst);\n }", "getVoteResults() {\n let observable = new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"](observer => {\n this.socket.on('serverSendVoteResults', (results, winners, cardVotingOn) => {\n observer.next([results, winners, cardVotingOn]);\n });\n return () => {\n this.disconnectSocket();\n };\n });\n return observable;\n }", "snapshotChanges(events) {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(this.afs.keepUnstableUntilFirst);\n }", "snapshotChanges(events) {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(this.afs.keepUnstableUntilFirst);\n }", "function IterableChanges() {}", "function IterableChanges() {}", "function IterableChanges() {}", "build() {\n const state = Immutable.from(this.state);\n this.setState(state);\n return state.asMutable();\n }", "function emitChange() {\n TweetStore.emit('change')\n}", "setState (states) {\n if (toString.call(states) === '[object Array]') {\n //TODO Array deep single re-assign or full coverage?\n this._model.splice(0, this._model.length, ...states)\n } else if (toString.call(states) === '[object Object]') {\n Object\n .entries(states)\n .filter(([key, value]) => typeof value !== 'function')\n .forEach(([key, value]) => {\n const isInclude = Object.keys(this._model).includes(key)\n if (!isInclude) return null\n if (typeof value === 'object') {\n this._model[key]['__pipe__'].setState(value)\n } else {\n this._model[key] = value\n }\n })\n }\n return this._model\n }", "snapshotChanges() {\n const scheduledFromDocRef$ = fromDocRef(this.ref, this.afs.schedulers.outsideAngular);\n return scheduledFromDocRef$.pipe(this.afs.keepUnstableUntilFirst);\n }", "get changes() {\n return this._changes || (this._changes = new EventEmitter());\n }", "get changes() {\n return this._changes || (this._changes = new EventEmitter());\n }", "get changes() {\n return this._changes || (this._changes = new EventEmitter());\n }", "get changes() {\n return this._changes || (this._changes = new EventEmitter());\n }", "get changes() {\n return this._changes || (this._changes = new EventEmitter());\n }", "stateChanges(events) {\n if (!events || events.length === 0) {\n return docChanges(this.query, this.afs.schedulers.outsideAngular).pipe(this.afs.keepUnstableUntilFirst);\n }\n return docChanges(this.query, this.afs.schedulers.outsideAngular)\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(actions => actions.filter(change => events.indexOf(change.type) > -1)), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])(changes => changes.length > 0), this.afs.keepUnstableUntilFirst);\n }", "updatedRecipeEmitter() {\n this.recipesChanged.next([...this.recipes]);\n this.recipeCount.next(this.recipes.length);\n }", "function IterableChanges(){}", "constructor() {\n super();\n this.lastTechnology = '';\n this.totalClicks = 0;\n\n //Subscribe the component to the store.\n //If the state changes, it will run the code inside the function\n store.subscribe(() => {\n this.handleUpdatedState(store.getState());\n });\n }", "onStateUpdate(subscriberFn) {\n stateEventEmitter.on(`${storeName}-${storeEvents.STATEUPDATED}`, (newState) => subscriberFn(newState));\n }", "componentDidUpdate() {\n this.store.set(this.state)\n }", "enableObservablesAttributes() {\n this.vGrid.vGridConfig.attributeArray.forEach((property) => {\n let propertyObserver = this.vGrid.observerLocator.getObserver(this.vGrid.currentEntity, property);\n propertyObserver.subscribe((newValue, oldValue) => {\n if (newValue !== oldValue) {\n //check if we should skip it\n if (this.vGrid.skipNextUpdateProperty.indexOf(property) === -1) {\n this.vGrid.currentRowEntity[property] = newValue;\n this.vGrid.vGridGenerator.updateRow(this.vGrid.filterRow, true);\n } else {\n //if skipping we also need to remove it\n this.vGrid.skipNextUpdateProperty.splice(this.vGrid.skipNextUpdateProperty.indexOf(property), 1);\n }\n }\n });\n this.subscriptionsAttributes.push(propertyObserver)\n });\n }", "subscribe () {}", "function IterableChanges() { }", "function IterableChanges() { }", "get changes() { return this.out('changes'); }", "update() {\n this.actionHistory = [];\n this.stateHistory = [];\n this.rewardHistory = [];\n }", "masterUpdate() {\n this.generateGamestate().then((state) => {\n this.masters.forEach(socket => {\n socket.emit('gameUpdate', state);\n });\n });\n }", "update() {\n this.fsm.update();\n }", "update(data = {}) {\n this.state = Object.assign(this.state, data);\n this.notify(this.state);\n }", "syncState() {\n }", "function createState(stateMutators, initialState) {\n return stateMutators\n .scan(function (state, reducer) { return reducer(state); }, initialState)\n .publishReplay(1)\n .refCount();\n}", "auditTrail(events) {\n return this.stateChanges(events).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"scan\"])((current, action) => [...current, ...action], []));\n }", "auditTrail(events) {\n return this.stateChanges(events).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"scan\"])((current, action) => [...current, ...action], []));\n }", "update(object) {\n for (const prop in object){\n this.state[prop] = object[prop];\n }\n //change has been made to data so call handler\n this.fire();\n\n }", "update(object) {\n for (const prop in object){\n this.state[prop] = object[prop];\n }\n //change has been made to data so call handler\n this.fire();\n\n }", "update() {\n if (state.current.moving) {\n updateOnMove.map((object) => object.update());\n }\n }", "someBusinessLogic() {\n console.log('\\nSubject1: doing some business logic.');\n this.state = Math.floor(Math.random() * (10 + 1));\n\n console.log(`Subject1: state changed to: ${this.state}`);\n this.notify();\n }", "function reactWithLatest(request, effects, retryStrategy) {\n var retryer = materializedRetryStrategy(retryStrategy);\n return function (state, scheduler) {\n var events = new rx.Observable(function (observer) {\n var requestLifetimeTracker = {\n isUnsubscribed: false,\n lifetimeByIdentifier: {}\n };\n function unsubscribe() {\n requestLifetimeTracker.isUnsubscribed = true;\n var inFlightRequests = requestLifetimeTracker.lifetimeByIdentifier;\n requestLifetimeTracker.lifetimeByIdentifier = {};\n Object.keys(inFlightRequests).forEach(function (key) { inFlightRequests[key].subscription.unsubscribe(); });\n }\n var subscription = state.pipe(map_1.map(request))\n .subscribe(function (requests) {\n var state = requestLifetimeTracker;\n if (state.isUnsubscribed) {\n return;\n }\n var lifetimeToUnsubscribeByIdentifier = __assign({}, state.lifetimeByIdentifier);\n requests.forEach(function (indexedRequest) {\n var requestID = js_extensions_1.canonicalString(indexedRequest.id);\n var request = indexedRequest.request;\n var requestLifetime = state.lifetimeByIdentifier[requestID];\n if (requestLifetime) {\n delete lifetimeToUnsubscribeByIdentifier[requestID];\n if (js_extensions_1.deepEqual(requestLifetime.latestRequest.value, request)) {\n return;\n }\n requestLifetime.latestRequest.next(request);\n }\n else {\n var subscription_1 = new rx.Subscription();\n var latestRequestSubject = new rxjs_1.BehaviorSubject(request);\n var lifetimeIdentifier_1 = {};\n state.lifetimeByIdentifier[requestID] = {\n subscription: subscription_1,\n lifetimeIdentifier: lifetimeIdentifier_1,\n latestRequest: latestRequestSubject\n };\n var requestsSubscription = effects(request, latestRequestSubject.asObservable(), scheduler)\n .pipe(observeOn_1.observeOn(scheduler), retryer)\n .subscribe(function (event) {\n var lifetime = state.lifetimeByIdentifier[requestID];\n if (!(lifetime && lifetime.lifetimeIdentifier === lifetimeIdentifier_1)) {\n return;\n }\n if (state.isUnsubscribed) {\n return;\n }\n observer.next(event);\n }, function (error) {\n var lifetime = state.lifetimeByIdentifier[requestID];\n if (!(lifetime && lifetime.lifetimeIdentifier === lifetimeIdentifier_1)) {\n return;\n }\n if (state.isUnsubscribed) {\n return;\n }\n observer.error(error);\n });\n subscription_1.add(requestsSubscription);\n }\n });\n var allUnsubscribeKeys = Object.keys(lifetimeToUnsubscribeByIdentifier);\n allUnsubscribeKeys.forEach(function (key) {\n if (state.lifetimeByIdentifier[key]\n && state.lifetimeByIdentifier[key].lifetimeIdentifier === lifetimeToUnsubscribeByIdentifier[key].lifetimeIdentifier) {\n delete state.lifetimeByIdentifier[key];\n }\n lifetimeToUnsubscribeByIdentifier[key].subscription.unsubscribe();\n });\n }, function (error) {\n var state = requestLifetimeTracker;\n if (state.isUnsubscribed) {\n return;\n }\n observer.error(error);\n }, function () {\n observer.complete();\n });\n return new rx.Subscription(function () {\n unsubscribe();\n subscription.unsubscribe();\n });\n });\n return retryer(events);\n };\n }", "update(data={}) {\n this.state = Object.assign(this.state, data);\n\n // notify all the Listeners of updated state\n this.notifyObervers(this.state);\n }", "function BaseObservable() {}", "observableArrayChange (changes) {\n let adds = [];\n let dels = [];\n for (const index in changes) {\n const change = changes[index];\n if (change.status === 'added') {\n adds.push([change.index, change.value]);\n } else {\n dels.unshift([change.index, change.value]);\n }\n }\n dels.forEach(change => this.delChange(...change));\n adds.forEach(change => this.addChange(...change));\n }", "bind() {\n super.bind();\n this.track(this.changes.subscribe());\n return this;\n }", "subscribeAll() {\n this.subscriptions = new Map();\n console.log('Re-subscribing to all');\n // Iterate through the object references and re-subscribe\n this.objectRefs.forEach(objRef => {\n this.subscribe(objRef);\n });\n }", "function memo (newParameterValue) {\n return initialize.observable({\n observableState,\n newParameterValue\n })\n }", "subscribe ({state, commit}) {\n return this.app.$api.service('contributions')\n .on('patched', (res) => {\n commit('updateContribution', res)\n })\n }", "constructor() {\n makeAutoObservable(this);\n }", "constructor() {\n makeAutoObservable(this);\n }", "getdata() {\n return Observable.create((observer) => {\n socket.on('res', (data) => {\n observer.next(data);\n });\n });\n }", "emitUpdate() {\n this._dispatch.call(DISPATCH_EVENT_UPDATE);\n }", "from (obj, clone) {\n return new Observable(obj, clone)\n }", "update() {\n this.poll();\n }", "update(data = {}) {\r\n console.log(data);\r\n this.state = Object.assign(this.state, data);\r\n this.notify(this.state);\r\n }", "emitChanges() {\n this.app.emit(this.changeActionName, this);\n }", "function itemToSourceStreams (addedItem, itemsState$) {\n const itemStateInfinite$ = itemsState$\n .map(items =>\n items.find(item => item[idAttribute] === addedItem[idAttribute])\n );\n // if an item isn't present if a new snapshot, it shall be destroyed\n const _destroy$ = itemStateInfinite$.filter(item => !item).take(1);\n const itemState$ = itemStateInfinite$.endWhen(_destroy$);\n\n return Object.keys(addedItem)\n .reduce((sources, key) => {\n // skip idAttribute\n if (key === idAttribute) {\n return sources;\n }\n\n const stream$ = itemState$\n .map(state => state[key])\n .startWith(addedItem[key])\n // skip the snapshot if the value didn't change\n .compose(dropRepeats(compareJSON))\n .remember();\n\n const sourceKey = transformKey ? transformKey(key) : key;\n\n return {\n ...sources,\n [sourceKey]: adapt(stream$)\n };\n }, {\n _destroy$\n });\n }", "get log() {\n // combineLatest will emit the latest of each\n // whenever either of them updates\n return rxjs_1.combineLatest(this.rxDocs, this.rxSync).pipe(operators_1.mergeMap(x => {\n // human readable text to explain sync number\n let syncText = \"remote couchDB \";\n switch (true) {\n case x[1] < 0:\n syncText += \"offline\";\n break;\n case x[1] === 1:\n syncText += \"online and in sync\";\n break;\n case x[1] > 1:\n syncText += \"uploading\";\n break;\n default:\n syncText += \"downloading\";\n break;\n }\n // assemble a nice JSON object that\n // has the docs and then the sync stuff\n return rxjs_1.of({\n \"PouchDB docs array\": x[0],\n \"sync code\": x[1].toString(),\n \"sync description\": syncText\n });\n }));\n }", "get state() { return this._publicState; }", "get initialized$() {\n return this.initializedSubject.asObservable();\n }", "_changeTrainings(evt) {\n var newState = this._mergeWithCurrentState({\n trainings: evt.target.value\n });\n\n this._emitChange(newState);\n}", "get authState() {\n return this._authState.asObservable();\n }", "fire() {\n this.handlers.forEach(handler => {\n //call handler with new state\n //since we pass in the state, this means we have access directly to an atom's data (aka state) in the handler\n //(including a call to render)\n handler(this.state);\n })\n }", "fire() {\n this.handlers.forEach(handler => {\n //call handler with new state\n //since we pass in the state, this means we have access directly to an atom's data (aka state) in the handler\n //(including a call to render)\n handler(this.state);\n })\n }" ]
[ "0.6698942", "0.62904114", "0.6283264", "0.5805762", "0.57265913", "0.5575637", "0.554832", "0.5543935", "0.5514091", "0.55012506", "0.5348636", "0.53154874", "0.53083175", "0.5295144", "0.5285675", "0.52639", "0.52143186", "0.52107507", "0.5209649", "0.5209649", "0.5209649", "0.5209649", "0.5190864", "0.51642346", "0.51444644", "0.5143783", "0.51387566", "0.5124735", "0.5124735", "0.51074576", "0.51047814", "0.5079681", "0.50206625", "0.5013726", "0.4987985", "0.49655557", "0.49644977", "0.49579582", "0.49540162", "0.494982", "0.49487802", "0.49487802", "0.49340585", "0.49340585", "0.49340585", "0.49163055", "0.49160922", "0.4907215", "0.49018046", "0.48998812", "0.48998812", "0.48998812", "0.48998812", "0.48998812", "0.48989403", "0.48928005", "0.48838568", "0.4882987", "0.4868869", "0.48531258", "0.48471132", "0.48366517", "0.48321655", "0.48321655", "0.4831967", "0.48303178", "0.48296595", "0.48290783", "0.48238474", "0.48236677", "0.48133373", "0.4807645", "0.4807645", "0.48022318", "0.48022318", "0.47957867", "0.47878525", "0.47848254", "0.47778648", "0.47748968", "0.47491366", "0.47438684", "0.4743377", "0.47392634", "0.47384974", "0.47373214", "0.47373214", "0.472907", "0.47233668", "0.4722392", "0.47218996", "0.47095537", "0.4699207", "0.4694112", "0.46894014", "0.468399", "0.46788368", "0.46730006", "0.46698016", "0.46633124", "0.46633124" ]
0.0
-1
Here, our action creators expose an API that allow the UI to push events/actions onto the actions observable.
blueClick() { this._actions.onNext('blue'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createAction() {}", "function actionCreator() {\n return action\n}", "function actionCreator(){\n return action;\n }", "function actionCreator() {\n return action\n }", "function actionCreator() {\n return action;\n }", "bindActions() {\n\t\t// @props\n\t\t// onComplete\n\t\t// buttons\n\t\t// cancelIndex\n\t\t// title\n\t\t// &\n\t\t// this will be an abstraction\n\t\t// so we don't have to worry about\n\t\t// changing props AND showing\n\t\t// the action sheet within other\n\t\t// parts of the app\n\t\t// the action sheet will be shown\n\t\t// after required props have been mounted \n\t\t// to the component\n\t\tActions.ActionSheet = props => this.fromGlobalActionSheet(props)\n\t}", "_registerToActions(action) {\n switch(action.actionType) {\n\n case ActionTypes.GET_USERS:\n this._setUsers(action.payload);\n break;\n case ActionTypes.GET_USER_BY_USERNAME:\n this._setUser(action.payload);\n break;\n case ActionTypes.UPDATE_USER:\n this._updateUser(action.payload);\n break;\n case ActionTypes.ONLINE_USER:\n this._setOnlineUsers(action.payload);\n break;\n case ActionTypes.USER_CREATED:\n setTimeout(() => { // Run after dispatcher has finished\n this.emit(CHANGE);\n }, 0);\n\n default:\n break;\n }\n }", "action(){\n if (!this.memory.actionMemory) this.memory.actionMemory = {}; // Set up an actionMemory\n this.memory.actionMemory.actionName = this.state();\n this.memory.actionMemory.tId = this.taskId();\n if (this.state() in ActionRegistry) {\n return new ActionRegistry[this.state()](this.memory.actionMemory);\n } else {\n Log('Invalid state does not map to an action. ' + this.string());\n }\n }", "handleAction(action) {\n switch(action.type){\n case 'ADD_TODO':\n this.addTodo(action.item)\n break\n case 'REMOVE_TODO':\n this.removeTodo(action.item)\n break\n case 'TOGGLE_TODO':\n this.toggleTodo(action.item)\n break\n case 'SET_FILTER':\n this.setFilter(action.item)\n break\n default:\n break\n }\n this.emitChange()\n }", "_registerToActions(action) {\n switch(action.actionType) {\n case ActionTypes.ADD_NEW_TODO:\n this._addNewTodo(action.payload);\n break;\n case ActionTypes.EDIT_TODO_BY_ID:\n this._editTodoById(action.id, action.description);\n break;\n case ActionTypes.DELETE_TODO_BY_ID:\n this._deleteTodoById(action.id);\n break;\n }\n }", "function actionCreator(action) {\n return action\n}", "function ActionEventRegistry(actions){\n this.registry = {};\n this.actions = actions;\n \n this.actions.forEach(act => {this.registry[act] = void 0;});\n}", "addAction() {\r\n\r\n // Show popup\r\n SelectActionPopup.show({ selectedID: this.state.triggerID, onSelect: plugin => {\r\n\r\n // Add new action\r\n var action = {}\r\n action.id = uuidv4()\r\n action.pluginID = plugin.pluginID\r\n action.options = {}\r\n this.state.actions.push(action)\r\n this.forceUpdate()\r\n\r\n }})\r\n\r\n }", "__onDispatch (action) {\n switch(action.type) {\n\n case ADD_TODO:\n this.addTodo(action.id, action.text);\n this.__emitChange();\n break;\n\n case REMOVE_TODO:\n this.removeTodo(action.id);\n this.__emitChange();\n break;\n\n case TOGGLE_TODO:\n this.toggleTodo(action.id);\n this.__emitChange();\n break;\n }\n }", "__getActionEvent() {\n return this.action.event !== undefined ? this.action.event : this.constructor.defaultAction;\n }", "handleActions(action){\n switch(action.type){\n case \"CREATE_FILE\":{\n this.createFile(action.text);\n }\n case \"RECEIVE_MODEL\":{\n this.model = action.model;\n this.emit(\"change\");\n }\n }\n }", "dispatch(action) {\n this.dispatcher.dispatchEvent(\n new CustomEvent(action.type, {\n detail: action,\n // In case you set a custom dispatcher element\n // and want them to bubble.\n bubbles: true,\n // In case your custom dispatcher is in the\n // Shadow DOM and you want them to bubble between\n // the borders or Shadow DOM and regular DOM.\n compose: true,\n })\n )\n }", "startCreation() {\n ActionsForCreator.create(this.state); //**! Place Action Method Here and pass the state of the component */\n }", "function createAction(options) {\n options = options || {};\n\n if (!_.isObject(options)) {\n options = {\n actionName: options\n };\n }\n\n for (var d in options) {\n if (!allowed[d] && FluxEventEmitter[d]) {\n throw new Error(\"Cannot override API method \" + d + \" in action creation. Use another method name instead.\");\n }\n }\n\n var i = 0;\n var childActions = {};\n options.children = options.children || [];\n for (; i < options.children.length; i++) {\n var name = options.children[i];\n childActions[name] = createAction(name);\n }\n\n var context = _.defaults({\n eventEmitterToken: 'action',\n emitter: _.extend({}, new EventEmitter())\n }, FluxEventEmitter, new EventEmitter(), options);\n\n var functor = function functor() {\n return functor.emit.apply(functor, arguments);\n };\n\n // Extending `context` and `childActions` so we can access child actions using `this` in action listener\n _.extend(functor, context, childActions);\n\n return functor;\n}", "_private_createAction() {\n const template = this.templatePath('../../../src/templates/reactRedux/actionTemplate.js')\n\n const destination = this.destinationPath('dist/actions.js')\n\n this.fs.copyTpl(\n template,\n destination,\n {\n FEATURE: this.STATE.FEATURE,\n ACTIONS: this.STATE.ACTIONS\n }\n )\n }", "function Action() { }", "_registerToActions(action) { \n switch(action.actionType) {\n case ActionTypes.CLASSES_FETCHED:\n this._setClasses(action.payload);\n break;\n case ActionTypes.CLASS_CREATED:\n ClassActions.fetchClasses();\n break;\n case ActionTypes.CLASS_FETCHED:\n this._setClass(action.payload);\n break;\n case ActionTypes.CLASS_STUDENTS_FETCHED:\n this._setClassStudents(action.payload);\n break;\n case ActionTypes.CLASS_INS_FETCHED:\n this._setClassInstructors(action.payload);\n break;\n case ActionTypes.CLASS_INS_ADDED:\n case ActionTypes.CLASS_INS_REMOVED:\n case ActionTypes.CLASS_STUDENT_ADDED:\n case ActionTypes.CLASS_STUDENT_REMOVED:\n\n setTimeout(() => { // Run after dispatcher has finished\n this.emit(CLASS_CHANGED);\n }, 0);\n break;\n }\n }", "handleActions(action){\n switch(action.type){\n case 'ADD_NODE':\n this.addNode(action.data)\n break\n case 'ADD_LINK':\n this.addLink(action.data)\n break\n case 'UPDATE_WEIGHTS':\n this.updateWeights()\n break\n case 'SET_PATH_STATS':\n this.setPathStats(action.newPathStats)\n break\n case 'RESET_PATH_STATS':\n this.resetPathStats()\n break\n case 'ADD_COLORS':\n this.addColors(action.hotLinks)\n break\n case 'ADD_NODE_LOCATION':\n this.addNodeLocation(action.data)\n break\n case 'CLEAR_STATE':\n this.clearState()\n break\n }\n }", "_registerToActions(action) {\n\n switch(action.actionType) {\n \n case ActionTypes.ACCOUNT_SIGN_IN:\n this._setUserid(action.payload);\n break;\n case ActionTypes.ACCOUNT_CREATED:\n this._setUserid(action.payload);\n case ActionTypes.GET_USER:\n this._setUser(action.payload);\n break;\n case ActionTypes.ROLES_RECEIVED:\n this._setRoles(action.payload);\n break;\n default:\n break;\n }\n }", "actions(dispatcher, context) {\n return {\n addTodo(newTodo) {\n dispatcher.dispatch(new Action(\"ADD_TODO_LOADING\"))\n dispatcher.dispatch(new Action(\"ADD_TODO_SUCCESS\", {\n newTodo\n }))\n },\n displayTodoDone() {\n dispatcher.dispatch(new Action(\"DISPLAY_TODO_DONE\"))\n\n },\n displayTodoNotDone() {\n dispatcher.dispatch(new Action(\"DISPLAY_TODO_NOT_DONE\"))\n\n },\n displayAllTodos() {\n dispatcher.dispatch(new Action(\"DISPLAY_ALL_TODO\"))\n }\n }\n }", "action() {}", "onAction(action) {\n switch (action.type) {\n case 'ADD_ACCOUNT':\n this._startUpdateStream(action.id, undefined, undefined)\n return\n case 'DELETE_ACCOUNT':\n this._stopUpdateStream(action.id)\n return\n }\n }", "function ActionComponent(action) {\n\tthis.perform = action;\n\treturn this;\n}", "handleViewAction(action: Action): void {\n this.dispatch({\n source: constants.VIEW_ACTION,\n action: action\n });\n }", "setActions(actions) {\n this.actions = actions\n }", "async applyAction(action){\n this._dispatchAction(action) \n }", "function Actions(editorUi)\n{\n\tthis.editorUi = editorUi;\n\tthis.actions = new Object();\n\tthis.init();\n}", "getAction(name){\n return _useAction.bind(this,name);\n }", "action( data ){\n return data && data.actionNew ?\n ( typeof data.actionNew === 'function' ? data.actionNew() : data.actionNew ) : null;\n }", "get actionInput() {\n return this._action;\n }", "subscribe(actionType, handler) {\n if (this.subscribers[actionType] === undefined) {\n this.subscribers[actionType] = [];\n }\n\n this.subscribers[actionType].push(handler);\n }", "function Action() {\n Action.super.apply(this, arguments);\n}", "function setupactions() {\n\t\tif (ts.ui.appframe) {\n\t\t\tdoaction = function(data) {\n\t\t\t\tgui.Action.ascendGlobal(document, up, data);\n\t\t\t\thandleactions();\n\t\t\t};\n\t\t} else if (ts.ui.subframe) {\n\t\t\tgui.get('main', function(main) {\n\t\t\t\tdoaction = function(data) {\n\t\t\t\t\tmain.action.descendGlobal(down, data);\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t}", "function insertActionToProjection()\n{ \n\tfor(var i=0;i< compositeCollection.length;i++)\n\t{\n\t\tvar compositeName=compositeCollection[i].name;\n\t\tproj.addNewCompositeAction(compositeName,compositeCollection[i].order);\n\t var actions=compositeCollection[i].actionList;\n\t\tfor(var j=0;j< compositeCollection[i].actionList.length;j++)\n\t\t {\n\t\t print('adding the action : ' +actions[j].name);\n\t\t\tproj.addActionToComposite(compositeName,actions[j].type,actions[j].name,actions[j].concept);\n\t\t\tvar ActionConceptsList=actions[j].actionToDo;\n\t\t\tfor(var k=0;k< ActionConceptsList.length;k++)\n\t\t\t {\n\t\t\t\tvar conceptToReceive=ActionConceptsList[k].concept;\n\t\t\t\t print('setting on recieve for the concept : ' +conceptToReceive);\n\t\t\t\tproj.setOnReceiveConcept(compositeName,conceptToReceive);\n\t\t\t\t}\n\t\t}\n\t}\n}", "constructor(props) {\n super(props);\n this.addAction = this.addAction.bind(this);\n }", "action(action, value) {\n\t switch (action) {\n\t // Parent view\n\t case 'parent':\n\t this._parentAction(value);\n\t return;\n\t // Change provider\n\t case 'provider':\n\t if (value !== this.provider) {\n\t this._providerAction(value);\n\t }\n\t return;\n\t // Global search\n\t case 'search':\n\t if (this._sources.api) {\n\t this._searchAction(this.provider, value);\n\t }\n\t return;\n\t // Filter collections\n\t case 'filter':\n\t if (typeof value !== 'string') {\n\t return;\n\t }\n\t value = value.trim().toLowerCase();\n\t if (this.route.params.filter !== value) {\n\t this.route.params.filter = value;\n\t this.blocksRequireUpdate = true;\n\t }\n\t else {\n\t return;\n\t }\n\t break;\n\t // Filter categories\n\t case 'categories':\n\t if ((value === null || typeof value === 'string') &&\n\t value !== this.route.params.category) {\n\t this.route.params.category = value;\n\t this.blocksRequireUpdate = true;\n\t }\n\t else {\n\t return;\n\t }\n\t break;\n\t // Select collection, called from child view\n\t case 'collections-internal':\n\t if (typeof value !== 'string' || value === '') {\n\t return;\n\t }\n\t this._triggerCollectionAction(value, 1);\n\t return;\n\t // Select collection\n\t case 'collections':\n\t if (typeof value !== 'string' || value === '') {\n\t return;\n\t }\n\t this._triggerCollectionAction(value, 0);\n\t return;\n\t default:\n\t return;\n\t }\n\t // Action has changed something - trigger update event\n\t this._triggerUpdated();\n\t }", "registerActions() {\n\n S.addAction(this._createAction.bind(this), {\n handler: '_createAction',\n description: 'Create mocha test for function',\n context: 'function',\n contextAction: 'mocha-create',\n options: [{ // These must be specified in the CLI like this \"-option true\" or \"-o true\"\n }],\n parameters: [ // Use paths when you multiple values need to be input (like an array). Input looks like this: \"serverless custom run module1/function1 module1/function2 module1/function3. Serverless will automatically turn this into an array and attach it to evt.options within your plugin\n {\n parameter: 'paths',\n description: 'Path to function to test. If not defined, test all functions.',\n position: '0->' // Can be: 0, 0-2, 0-> This tells Serverless which params are which. 3-> Means that number and infinite values after it.\n }\n ]\n });\n\n S.addAction(this._runAction.bind(this), {\n handler: '_runAction',\n description: 'Create mocha test for function',\n context: 'function',\n contextAction: 'mocha-run',\n options: [ {\n option: 'region',\n shortcut: 'r',\n description: 'region you want to run your function in'\n },\n {\n option: 'stage',\n shortcut: 's',\n description: 'stage you want to run your function in'\n },\n {\n option: 'reporter',\n shortcut: 'R',\n description: 'specify the reporter to use'\n },\n {\n option: 'reporter-options',\n shortcut: 'O',\n description: 'reporter-specific options'\n }],\n parameters: [ // Use paths when you multiple values need to be input (like an array). Input looks like this: \"serverless custom run module1/function1 module1/function2 module1/function3. Serverless will automatically turn this into an array and attach it to evt.options within your plugin\n {\n parameter: 'paths',\n description: 'Path to function to test. If not defined, test all functions.',\n position: '0->' // Can be: 0, 0-2, 0-> This tells Serverless which params are which. 3-> Means that number and infinite values after it.\n }\n ]\n });\n\n return BbPromise.resolve();\n }", "get userCustomActions() {\r\n return new UserCustomActions(this);\r\n }", "get userCustomActions() {\r\n return new UserCustomActions(this);\r\n }", "get userCustomActions() {\r\n return new UserCustomActions(this);\r\n }", "function Actable(action) {\n\tthis.actableOn = action;\n\treturn this;\n}", "handleServiceAction(action: Action): void {\n this.dispatch({\n source: constants.SERVICE_ACTION,\n action: action\n });\n }", "handleActions(action){\n\t\tswitch(action.type){\n\t\t\tcase \"VIEW_ACTION\":\n\t\t\t\tconsole.log(this.data);\n\t\t\t\tbreak;\n\t\t\tcase \"FILTER_SEARCH\":\n\t\t\t\tthis.bugSearch(action.searchParameters);\n\t\t\t\tbreak;\n\t\t\tcase \"UPDATE_BUGS\":\n\t\t\t\tthis.update(action.dbId, action.issueId, action.date, action.priority, action.summary, action.severity, action.description, action.reporter, action.assignedUser, action.status);\n\t\t\t\tbreak;\n\t\t\tcase \"FILTER_BUGS\":\n\t\t\t\tthis.filter(action.filterText);\n\t\t\t\tbreak;\n\t\t\tcase \"CLEAR_FILTER\":\n\t\t\t\tthis.clearFilter();\n\t\t\t\tbreak;\n\t\t\tcase \"NEW_BUG\":\n\t\t\t\tthis.newBug(action.id, action.issueId, action.date, action.priority, action.summary, action.severity, action.description, action.reporter, action.assignedUser, action.status);\n\t\t\t\tbreak;\n\t\t\tcase \"SORT\":\n\t\t\t\tthis.sort(action.field);\n\t\t\t\tbreak;\n\t\t\tcase \"OUTPUT\":\n\t\t\t\tthis.filter(action.filter);\n\t\t\t\tthis.bugSearch(action.searchText);\n\t\t\t\tthis.sort(action.sort);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}", "updateAction() {}", "handleActions(action){\n\n switch(action.type){\n case \"DISPATCH_SALE\":\n this.dispatchSale(action.id);\n break;\n\n default: break;\n }\n }", "handlePlatformAction(action: Action): void {\n this.dispatch({\n source: constants.PLATFORM_ACTION,\n action: action\n });\n }", "queue(action){\n Mediator.queue.push(action);\n }", "@action updateActions(actions) {\n var that = this;\n this.activeActions = [];\n this.actionHistory = [];\n\n // sort by time\n this.actions = actions\n .sort((a, b) => {\n if (a.scheduledTime < b.scheduledTime) {\n return -1;\n } else if (a.scheduledTime > b.scheduledTime) {\n return 1;\n }\n\n return 0;\n });\n }", "setActions(actions) {\n this.actions = actions;\n }", "handleActions(action) {\n // it is check by a switch and will have a type that id it\n switch(action.type) {\n // call a function\n case 'GET_ALL': {\n this.getAll();\n }\n }\n }", "getActions() {\n return JSON.parse(JSON.stringify(this.actions));\n }", "function ActionBinding(controller, action, controllerFactory) {\n this.controller = controller;\n this.action = action;\n this.controllerFactory = controllerFactory;\n}", "action(id, fn) {\n this._actions[id] = fn;\n return this;\n }", "broadcastUserAction (action) {\n this.dispatch({\n type: EventTypes.USER_EVENT,\n action: action\n });\n }", "function registerActions() {\n actionObjects = [];\n categoryObjects = [];\n var action1 = kony.notificationsettings.createAction({\n \"id\": \"action1\",\n \"label\": \"Check In\",\n \"pspConfig\": {\n \"authenticationRequired\": false,\n \"destructive\": false,\n \"activationMode\": kony.notificationsettings.ACTIVATION_MODE_FORWARDS,\n \"visibleOn\": kony.notificationsettings.BOTH\n }\n });\n var action2 = kony.notificationsettings.createAction({\n \"id\": \"action2\",\n \"label\": \"Open App\",\n \"pspConfig\": {\n \"authenticationRequired\": false,\n \"destructive\": false,\n \"activationMode\": kony.notificationsettings.ACTIVATION_MODE_FORWARDS,\n \"visibleOn\": kony.notificationsettings.BOTH\n }\n });\n actionObjects[0] = action1;\n actionObjects[1] = action2;\n var category = kony.notificationsettings.createCategory({\n \"categoryId\": \"CheckInNotification\",\n \"actions\": actionObjects,\n \"pspConfig\": {\n \"minimalActions\": actionObjects\n }\n });\n categoryObjects[0] = category;\n var regCats = kony.notificationsettings.registerCategory({\n \"categories\": categoryObjects,\n \"pspConfig\": {\n \"types\": [0, 1, 2]\n }\n });\n}", "buttonPress(action) {\n this.props.onPress(\n action,\n this.props.entry.notificationName,\n this.props.entry.email,\n this.props.entry.senderEmail,\n this.props.entry.priority,\n this.props.entry.value,\n this.props.entry.description,\n this.props.entry.redeemed,\n this.props.entry.notificationType,\n this.props.entry.deadline,\n );\n }", "function bindActions(){\r\n $('a.iBtn').each(function(){\r\n var self = this;\r\n $(self).bind(\"hover\", function(){\r\n $(self).tooltip({placement: \"bottom\"})\r\n })\r\n .bind(\"click\", function(event){\r\n event.preventDefault();\r\n handleOnClick($(self).data('action'), $(self).data('cell'))\r\n })\r\n })\r\n // bind the action button too if Shiny is not found\r\n if (window.Shiny == undefined){\r\n $('a.action-button').each(function(){\r\n var self = this;\r\n $(self).bind(\"hover\", function(){\r\n $(self).tooltip({placement: \"bottom\"})\r\n })\r\n .bind(\"click\", function(event){\r\n event.preventDefault();\r\n handleOnClick($(self).data('action'), $(self).data('cell'))\r\n })\r\n })\r\n }\r\n}", "dispatch(action) {\n this.store.dispatch(action);\n }", "function actionSequance(name) { \n\t this.name=name; \n this.actionList=[];\n\t\tcompositeCollection.push(this);\n\t\t}", "onAction(action, entry) {\n switch (action) {\n case 'install':\n return this.model.install(entry);\n case 'uninstall':\n return this.model.uninstall(entry);\n case 'enable':\n return this.model.enable(entry);\n case 'disable':\n return this.model.disable(entry);\n default:\n throw new Error(`Invalid action: ${action}`);\n }\n }", "onAction(action, entry) {\n switch (action) {\n case 'install':\n return this.model.install(entry);\n case 'uninstall':\n return this.model.uninstall(entry);\n case 'enable':\n return this.model.enable(entry);\n case 'disable':\n return this.model.disable(entry);\n default:\n throw new Error(`Invalid action: ${action}`);\n }\n }", "handleActions(action) {\n switch(action.type) {\n case \"NEXT_NODE\": {\n this.toNextNode()\n break\n } case \"PREVIOUS_NODE\": {\n this.toPreviousNode()\n break\n } case \"GO_TO\": {\n this.resetState()\n break\n } case \"RESET\": {\n this.resetState()\n break\n } case \"BACK\": {\n this.resetState()\n break\n }\n }\n }", "function initAction() {\n }", "action(params) {\n this.beforeAction();\n this.setParams(params);\n Dispatcher.action(this, params);\n }", "dispatch(action, parameters) {\n const callbacks = this.events[action];\n\n if (this.disable) {\n return;\n }\n\n if (!callbacks) {\n throw new Error();\n }\n\n for(var index = 0; index < callbacks.length; index++) {\n callbacks[index].apply(this, [this, parameters]);\n }\n }", "function actionFactory(action) {\n return function(data) {\n return { type: action, payload: data }\n }\n}", "add_action(id, message, name, assignee) {\n if (this.valid) {\n const gh_action_id = `${this.date}-${id}`;\n const short_message = `${message} (${name})`;\n const full_message = this.url ? `${short_message} ([see details](${this.url}#${id}))` : short_message;\n this.actions.push({\n title: `${gh_action_id}: ${short_message}`,\n body: `${full_message}\\n\\nCc: @${assignee}`,\n assignee,\n });\n }\n }", "action(action, value) {\n\t switch (action) {\n\t // Navigate to parent view\n\t case 'parent':\n\t this._parentAction(value);\n\t return;\n\t // Change provider\n\t case 'provider':\n\t this._providerAction(value);\n\t return;\n\t }\n\t }", "get action () {\n\t\treturn this._action;\n\t}", "get action () {\n\t\treturn this._action;\n\t}", "get action () {\n\t\treturn this._action;\n\t}", "_onDispatch(action) {\n // In the pursuit of immutability of data, we want to create a new state without mutating the old state\n // So we can grab the current state and \"reduce\" it, using the current state and the provided action\n const newState = this.reduce(this._state, action);\n // Check if the action dispatched described and resulted in any changes \n if(newState !== this._state) {\n // If it did, we want to preserve a copy of the state in history\n this._history.push(this._state);\n // Then update the value of the state\n this._state = newState;\n // Then we emit the changes to notify any listeners \"automatically\" that the state has been updated\n this._emitChange();\n // Otherwise there's nothing to do\n }\n }", "function actions(mActions) {\n\t\tif (!mActions) {\n\t\t\treturn;\n\t\t}\n\t\tconst oDiv = document.getElementById(\"actions\");\n\t\tfor (const [sTitle, fnAction] of Object.entries(mActions)) {\n\t\t\tconst oButton = document.createElement(\"button\");\n\t\t\toButton.innerText = sTitle;\n\t\t\toButton.onclick = fnAction.bind(null, setStatus);\n\t\t\toDiv.appendChild(oButton);\n\t\t}\n\t}", "notifyAction() {\n this.dispatchEvent(\n new CustomEvent('calltoaction', {\n bubbles: true,\n composed: true,\n detail: {\n productId: this.displayData.id,\n productName: this.displayData.name\n }\n })\n );\n }", "function Action(){\n this.actionClass = \"\";\n\tthis.variables = new Array();\n}", "function bindActionCreator(change, type) {\n change.__eduxActionType = type;\n var creator = change.__eduxActionCreator = function () {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return {\n type: type,\n payload: args\n };\n };\n return creator;\n}", "function dispatch(action) {\n console.log('dispatch('+ action.type + ')');\n\n stores.forEach(s => {\n \ts.onAction(action);\n });\n}", "setAction(type, data) {\n this.type = type;\n this.data = data;\n }", "function mapActionToProps(dispatch) { return bindActionCreators({ GetActivityAction }, dispatch); }", "handleServerAction(action: Action): void {\n this.dispatch({\n source: constants.SERVER_ACTION,\n action: action\n });\n }", "function setActions() {\n var actionsCopy = scope.actions;\n scope.actions = [];\n \n _.forEach(actionsCopy, function (action) {\n spReportBuilderService.setAction(action.type, null, action.field);\n }); \n }", "AddAction(Titre, Fct){\n let action = new Object()\n action.Titre = Titre\n action.Fct = Fct\n this._ActionList.push(action)\n }", "function Component_ActionHandler() {\n\n /**\n * @property initialized\n * @type boolean\n * @protected\n */\n this.initialized = false;\n\n /**\n * Counter for delayed/timed actions.\n * @property waitCounter\n * @type number\n * @protected\n */\n this.waitCounter = 0;\n\n /**\n * Indicates if the mouse/touch pointer is inside the UI object's bounds.\n * @property contains\n * @type boolean\n * @protected\n */\n this.containsPointer = false;\n }", "onAction() {\n return this._onAction;\n }", "function actionButton(icon,title,text,action){\n this.icon = icon;\n this.title = title;\n this.text = text;\n this.action = action;\n}", "dispatch(action) {\n this.store.dispatch(action);\n return action;\n }", "dispatch(action) {\n this.store.dispatch(action);\n return action;\n }", "function ACTION() {}", "function dispatch (action) {\n var entries = app.store.state.entries.concat(action)\n app.store.setState({entries: entries})\n}", "function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}", "function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}", "function action(...args) {\n return (type) => createAction(type, ...args);\n}", "@api invoke() {\n console.log(\"Hi, I'm an action. INVOKE HEADLESS\");\n let event = new ShowToastEvent({\n title: 'I am a headless action!',\n message: 'Hi there! Starting...',\n });\n this.dispatchEvent(event);\n // this[NavigationMixin.Navigate]({\n // type: 'standard__objectPage',\n // attributes: {\n // objectApiName: 'Contact',\n // actionName: 'home',\n // },\n // });\n }", "action(action, value) {\n\t switch (action) {\n\t // Change view\n\t case 'parent':\n\t this._parentAction(value);\n\t return;\n\t // Change provider\n\t case 'provider':\n\t this._providerAction(value);\n\t return;\n\t // Set icons\n\t case 'set':\n\t this.setIcons(value);\n\t // Returning because setIcons will trigger event\n\t return;\n\t // Search icons\n\t case 'filter':\n\t if (typeof value !== 'string') {\n\t return;\n\t }\n\t value = value.trim().toLowerCase();\n\t if (value === this.route.params.filter) {\n\t return;\n\t }\n\t this.route.params.filter = value;\n\t this.blocksRequireUpdate = true;\n\t break;\n\t // Change current page\n\t case 'pagination':\n\t if (typeof value === 'string') {\n\t value = parseInt(value);\n\t }\n\t // Check number\n\t if (typeof value !== 'number' ||\n\t isNaN(value) ||\n\t value < 0 ||\n\t value === this.route.params.page) {\n\t return;\n\t }\n\t // Change page\n\t this.route.params.page = value;\n\t this.blocksRequireUpdate = true;\n\t break;\n\t default:\n\t return;\n\t }\n\t // Action has changed something - trigger update event\n\t this._triggerUpdated();\n\t }", "get action() { return this.actionIn; }", "get action() {\n\t\treturn this.__action;\n\t}" ]
[ "0.6954286", "0.6719776", "0.6691922", "0.66513765", "0.6623811", "0.66053516", "0.6485168", "0.64830816", "0.6446682", "0.6436856", "0.63788956", "0.6362903", "0.6333045", "0.6294832", "0.61877054", "0.6186368", "0.6181127", "0.6160792", "0.61441875", "0.6129566", "0.6113814", "0.6098322", "0.60983026", "0.6094507", "0.60870916", "0.60693806", "0.6013003", "0.6006251", "0.6005487", "0.599348", "0.59842384", "0.5982436", "0.5969623", "0.5964289", "0.59140307", "0.5906829", "0.5902616", "0.590245", "0.58928573", "0.5890723", "0.5875319", "0.58665144", "0.58516383", "0.58516383", "0.58516383", "0.5843145", "0.58357906", "0.58332026", "0.58317584", "0.5827305", "0.582389", "0.58167446", "0.58152306", "0.58067876", "0.5795815", "0.5791029", "0.57585907", "0.57583153", "0.5754287", "0.5739697", "0.5737329", "0.57321894", "0.57308465", "0.5722364", "0.57155055", "0.57155055", "0.57091194", "0.57072765", "0.570535", "0.57017374", "0.56945395", "0.5688261", "0.5688068", "0.56789464", "0.56789464", "0.56789464", "0.5676608", "0.5674923", "0.56679684", "0.5665399", "0.5664852", "0.5656307", "0.5652132", "0.5643145", "0.56388664", "0.5632268", "0.56231", "0.56074214", "0.56039345", "0.5602261", "0.5601029", "0.5601029", "0.5600918", "0.5590072", "0.5588798", "0.5588798", "0.557992", "0.5565706", "0.5558203", "0.5553118", "0.5552725" ]
0.0
-1
The main processor of commands.
function processCommand(receivedMessage) { let fullCommand = receivedMessage.content.substr(1) // Remove the leading exclamation mark let splitCommand = fullCommand.split(" ") // Split the message up in to pieces for each space let primaryCommand = splitCommand[0] // The first word directly after the excalamtion is the command let arguments = splitCommand.slice(1) // All other words are arguments/parameters/options for the command console.log("Command received: " + primaryCommand) console.log("Arguments: " + arguments) // There may not be arguments if (primaryCommand == "help") { helpCommand(arguments, receivedMessage) } else if (primaryCommand == "multiply") { multiplyCommand(arguments, receivedMessage) } else if (primaryCommand == "ping") { pingCommand(arguments, receivedMessage) } else { receivedMessage.channel.send("I don't understand the command. Try `!help` or `!multiply`") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CommandProcessor(controller) {\n this.controller = controller;\n}", "function handleCommand() {}", "function Command () {}", "function CommandsProcessor(message)\n{\n\n\n var command = getCommand(message);\n\n /**\n * Returns the name of the command.\n * @returns {String} the command\n */\n this.getCommand = function()\n {\n return command;\n };\n\n\n var messageArgument = message.substr(command.length + 2);\n\n /**\n * Returns the arguments of the command.\n * @returns {string}\n */\n this.getArgument = function()\n {\n return messageArgument;\n };\n}", "execute(){\n this.commands.forEach(c => this.dispatchCommand(c))\n return this.report()\n }", "function CommandProcessor() {\n // contain the spec functions to add after spec definition\n this.functions = [];\n // the specification declarations\n this.specs=[];\n // Since there is not good way to create a function name we will\n // reuse the same name with an index\n this.functionIndex = 1;\n // if defined then the current function being constructed\n this.currentFunction = undefined;\n // the type of the last command processed.\n // Types are:\n // undefined (initial state),\n // spec\n // assert\n // other\n this.lastCommand = undefined;\n\n // If defined the spec comment under construction\n this.specDec = undefined;\n\n this.endFunction = function () {\n if (this.currentFunction !== undefined) {\n if (this.lastCommand !== 'assert') {\n this.currentFunction += indents(2) + \"success\\n\";\n }\n this.currentFunction += indents(1) + \"}\";\n this.functions.push(this.currentFunction);\n this.currentFunction = undefined;\n }\n };\n\n this.repeat = function (c, n) {\n var str = \"\";\n for (var i = 0; i < n; i++) {\n str += c;\n }\n return str;\n };\n\n this.handleSpecDeclaration = function (code) {\n var spec,spaces;\n\n if (this.lastCommand === 'spec') {\n this.specs.push(this.specDec);\n }\n\n this.lastCommand = 'spec';\n // this is a spec comment\n spec = indents(2) + '\"' + trim(code.substr(1)) + '\"';\n spaces = options.rightColumnIndent - spec.length;\n this.specDec = spec + this.repeat(\" \", spaces);\n }\n\n this.processCommand = function (command, code) {\n var methodName;\n\n if (this.lastCommand === undefined && !startsWith(code, \"//-\")) {\n this.handleSpecDeclaration(\"- \"+options.initialSpec);\n }\n\n if (this.specDec !== undefined) {\n methodName = name.replace(/ |\\+|-|\\|/g, '_') + \"_\" + this.functionIndex;\n this.functionIndex += 1;\n this.specDec += \"! \" + methodName;\n\n if (command.command.match(/^(verify|assert)/)) {\n this.lastCommand = 'assert';\n } else {\n this.lastCommand = 'other';\n }\n\n this.currentFunction =\n indents(1) + \"def \" + methodName + \" = {\\n\"+\n indents(2) + \"import selenium._\\n\" +\n indents(2) + code + \"\\n\";\n\n this.specs.push(this.specDec);\n this.specDec = undefined;\n } else {\n \n this.currentFunction += indents(2) + code + \"\\n\";\n }\n };\n\n this.output = function () {\n\t if (this.currentFunction !== undefined) {\n \t this.endFunction();\n \t}\n\n var closeStep = \"\"\n return this.specs.join(\"^\\n\") + closeStep + \"\\n\\n\" + this.functions.join(\"\\n\\n\");\n };\n}", "function listProcessor(commands) {\n\tlet processor = (function() {\n\t\tlet list = [];\n\t\treturn {\n\t\t\tadd: function(str) {\n\t\t\t\tlist.push(str);\n\t\t\t},\n\t\t\tremove: function (str) {\n\t\t\t\tlist = list.filter(x => x !== str);\n\t\t\t},\n\t\t\tprint: function() {\n\t\t\t\tconsole.log(list.toString());\n\t\t\t}\n\t\t};\n\t})();\n\tfor (let command of commands) {\n\t\tlet [c, v] = command.split(/\\s+/);\n\t\tprocessor[c](v);\n\t}\n}", "function processCommand(c) {\n var cmd = c[\"cmd\"]\n var key = c[\"key\"]\n\n switch (cmd) {\n case \"add\": add(key, c[\"title\"], c[\"x\"], c[\"y\"]); break;\n case \"move\": move_to(key, c[\"x\"], c[\"y\"]); break;\n //case \"set_pos_to\": set_pos_to(key, c[\"x\"], c[\"y\"]); break;\n case \"remove\": remove(key); break;\n case \"link\": add_link(c[\"from\"], c[\"to\"]); break;\n case \"change\": change(c[\"key\"], c[\"title\"])\n }\n}", "process() {}", "process() {}", "function _processFinalCommands() {\n while (_finalCommands.length) {\n var command = _finalCommands.pop();\n goradd.processCommand(command);\n }\n }", "processNextCommand() {\n var nextCmd = this._script.commands.shift();\n if (! nextCmd) {\n return;\n }\n\n // Process the next command when the current\n // command resolves.\n $.when(this.commandHandler.handle(nextCmd)).then(() => {\n this.processNextCommand();\n });\n }", "function registerCommands()\n{\n addCMD([\"cmd\", listCmds, \"Prints list of available commands\"]);\n addSynonimOf(\"cmd\", \"cmds\");\n addSynonimOf(\"cmd\", \"commands\");\n\n addCMD([\"test\", test, \"Just a test\"]);\n addCMD([\"invite\", inviteMeLink, \"I'll give you invite link to me!\", [], true]);\n\n addCMD([\"say\", say, \"I'll say some instead you! (attachments also supported!)\\n__*Syntax:*__ say <any your text>\"]);\n addCMD([\"saytts\", sayTTS, \"I'll help to pronuncate you some!\\n__*Syntax:*__ saytts <any your text>\"]);\n addCMD([\"whosaid\", sayLog, \":spy: Shsh! I'll leak you secret - who asked me to say (5 last messages)\\n\"]);\n addCMD([\"setgame\", setPlayingGame, \"I'll play any game you suggesting me!\\n\" +\n \"__*Syntax:*__ setgame <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setmusic\", setListeningMusic,\"I'll listen any music you suggesting me!\\n\" +\n \"__*Syntax:*__ setmusic <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setvideo\", setWatchingVideo, \"I'll watch any video suggesting me!\\n\" +\n \"__*Syntax:*__ setvideo <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setstream\",setStreaming, \"I'll stream anything you ask me!\\n\" +\n \"__*Syntax:*__ setstream <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n\n addCMD([\"remind\", sayDelayd, \":information_desk_person: I'll remeber a thing you request me!\\n__*Syntax:*__ remind <any your text> after <time> <seconds, minutes, hours>\\n\", [], true]);\n addCMD([\"remindme\", sayDelaydME, \":information_desk_person: I'll remeber you personally a thing you request me!\\n__*Syntax:*__ remindMe <any your text> after <time> <seconds, minutes, hours>\\n\", [], true]);\n\n addCMD([\"err\", wrongFunction, \"It hurts me...\"]);\n\n addCMD([\"isbeepboop\",isBeepBoop, \"Check is this server has a beep-boop channel\"]);\n addSynonimOf(\"isbeepboop\",\"isfun\", \"Check is this server has a beep-boop/fun channel\");\n\n addCMD([\"mytime\", myTime, \"Let's check our watches? :clock: :watch: :stopwatch: :clock1: \"]);\n addCMD([\"stats\", aboutBot, \"Just my health state\"]);\n addSynonimOf(\"stats\", \"about\", \"Wanna meet me?\");\n addCMD([\"uptime\", upTimeBot, \"How long I still be here\"]);\n\n addCMD([\"help\", cmdHelp, \"Prints help of command\"]);\n\n addCMD([\"mailwohlstand\", sendEmail, \"Send email to my creator while he is offline. (Attachments are supported!) \\n\" +\n \"__*Syntax:*__ mailwohlstand <any your text>\", [], true]);\n\n addCMD([\"check-in-list\", cachedFiles_Check, \"Check the existing of something in one of built-in lists\", [], true]);\n addCMD([\"reload-lists\", cachedFiles_ReLeload, \"<Owner-Only> Reload built-in lists\", [], true]);\n\n\n foxyLogInfo( Cmds.length + \" command has been registered!\");\n}", "function receiveCommand (_command) {\n\n\n\t\tvar target\t\t= cursor.getCurrent(),\n\t\t\tcmd\t\t\t= _command.name,\n\t\t\targs\t\t= _command.args,\n\t\t\tinfo\t\t= commandBank[cmd];\n\n\t\t// console.log(\"Executing: \" + cmd + \" with\", (args.length) ? args : \"no arguments\");\n\n\t\t// Check command metadata exists\n\t\tif (typeof info === 'undefined') {\n\n\t\t\tApp.console.error(\"Interface.receiveCommand: No entry for '\" + cmd + \"'.\");\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Check node types\n\t\tif (!hasType(target, info.types)) {\n\n\t\t\tApp.console.error(\"Interface.receiveCommand: Node type '\" + target.type + \"' does not accept '\" + cmd + \"'.\");\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Check function arity\n\t\tif (args.length > info.arity) { \n\n\t\t\tApp.console.error(\"Interface.receiveCommand: Too many arguments (\" + args.length + \") for '\" + cmd + \"'.\");\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Check command implementation exists\n\t\tif (typeof commandFunctions[cmd] === 'undefined') {\n\n\t\t\tApp.console.error(\"Interface.receiveCommand: Command implementation not found: '\" + cmd + \"'.\");\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Apply the command\n\t\tcommandFunctions[cmd].apply(target, args);\n\n\n\t\t// Post-execution cleanup\n\t\tif (info.refresh) {\n\n\t\t\tcursor.refreshList();\n\n\t\t}\n\n\t\t// Perform callback if present\n\t\tif (_command.callback) {\n\n\t\t\t_command.callback();\n\n\t\t}\n\n\t}", "function commands(command) {\n switch (command) {\n case \"concert-this\":\n concertSearch();\n break;\n case \"movie-this\":\n movieSearch();\n break;\n case \"spotify-this-song\":\n songSearch();\n break;\n case \"do-what-it-says\":\n doThis();\n break;\n default:\n console.log('Liri needs to be told what to do...');\n };\n}", "_emitCommandsd() {\n const commands = [];\n\n for (const [cmd, { description }] of this.commands) {\n commands.push({ cmd, description });\n }\n\n process.send({ type: 'commands', commands });\n }", "function processCommands(arr) {\r\n let process = (function () {\r\n let text = '';\r\n return {\r\n append: (newText) => text += newText,\r\n removeStart: (count) => text = text.slice(count),\r\n removeEnd: (count) => text =\r\n text.slice(0, text.length - count),\r\n print: () => console.log(text)\r\n\r\n }\r\n })();\r\n for(let cmd of arr){\r\n let [command, count] = cmd.split(' ');\r\n process[command](count);\r\n }\r\n}", "function initCommandParser() {\n var commandParser = {};\n commandParser.commandHolder = initCommandRamHolder();\n commandParser.createCommand = function (code) {\n console.log(code);\n //Код команди виглядає так:\n //addi $t1,$t2,$t3\n //var firstSpilt = code.split(\" \");\n var firstSpaceIndex = code.indexOf(\" \");\n var firstSplit = [code.substring(0,firstSpaceIndex),code.substring(firstSpaceIndex+1)];\n var end = [firstSplit[0]].concat(firstSplit[1].split(commandRegExp));\n console.log(code);\n return end;\n };\n commandParser.parse = function (splitedCode) {\n var code = splitedCode[0];\n switch (code) {\n //TImm Group\n case 'addi':\n case 'addiu':\n case 'andi':\n case 'ori':\n case 'slti':\n case 'sltiu':\n case 'xori':\n return cStart[code] + convertTSImm(splitedCode);\n break;\n //DST Group\n case 'add':\n case 'addu':\n case 'and':\n case 'or':\n case 'sllv':\n case 'slt':\n case 'sltu':\n case 'srlv':\n case 'sub':\n case 'subu':\n case 'xor':\n return cStart[code] + convertDST(splitedCode) + cEnd[code];\n break;\n //SOff Group\n case 'bgez':\n case 'bgezal':\n case 'bgtz':\n case 'blez':\n case 'bltz':\n case 'bltzal':\n var offsetLabel = splitedCode[2];\n if (!numberRegExp.test(offsetLabel)) {\n var currentCommandNumber = this.commandHolder.commandCodeList.length;\n var labelNumber = this.commandHolder.getLabel(offsetLabel);\n var offset = labelNumber - currentCommandNumber;\n splitedCode[2] = parseInt(offset);\n }\n return cStart[code] + convertSOff(splitedCode);\n break;\n //ST Group\n case 'div':\n case 'divu':\n case 'mult':\n case 'multu':\n return cStart[code] + convertST(splitedCode) + cEnd[code];\n break;\n //STOff Group\n case 'beq':\n case 'bne':\n offsetLabel = splitedCode[3];\n if (!numberRegExp.test(offsetLabel)) {\n currentCommandNumber = this.commandHolder.commandCodeList.length;\n labelNumber = this.commandHolder.getLabel(offsetLabel);\n offset = labelNumber - currentCommandNumber;\n splitedCode[3] = parseInt(offset);\n }\n return cStart[code] + convertSTOff(splitedCode);\n break;\n //Target Group\n case 'j':\n case 'jal':\n var targetLabel = splitedCode[1];\n if (!numberRegExp.test(targetLabel)){\n labelNumber = this.commandHolder.getLabel(targetLabel);\n splitedCode[1] = labelNumber;\n }\n return cStart[code] + convertTarget(splitedCode);\n break;\n //TOffS Group\n case 'lw':\n case 'sw':\n case 'lb':\n case 'sb':\n return cStart[code] + convertTOffS(splitedCode);\n break;\n //SorD Group\n case 'mfhi':\n case 'mflo':\n case 'jr':\n return cStart[code] + convertSorD(splitedCode) + cEnd[code];\n break;\n //TImm Group\n case 'lui':\n return cStart[code] + convertTImm(splitedCode);\n break;\n //DTH Group\n case 'sll':\n case 'sra':\n case 'srl':\n return cStart[code] + convertDTH(splitedCode) + cEnd[code];\n break;\n\n }\n };\n return commandParser;\n}", "function executeCommand() {\t\t\t\n\t\t\tswitch(instructions[pointerAddress]) {\n\t\t\t\tcase \">\": //Increment data pointer\t\t\t\t\t\t\n\t\t\t\t\tram.incPointer();\n\t\t\t\t\treturn true;\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tcase \"<\": //Decrement data pointer\n\t\t\t\t\tram.decPointer();\n\t\t\t\t\treturn true;\t\t\t\t\t\t\n\t\t\t\tcase \"+\": //Increment value at data pointer\n\t\t\t\t\tram.incByte();\t\t\t\t\t\t\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"-\": //Decrement value at data pointer\n\t\t\t\t\tram.decByte();\t\t\t\t\t\t\n\t\t\t\t\treturn true;\n\t\t\t\tcase \".\": //output the character the current byte represents\n\t\t\t\t\tui.print(ram.readByte());\n\t\t\t\t\treturn true;\n\t\t\t\tcase \",\": //Take input and store in current data cell\n\t\t\t\t\t//ram.writeByte as callback function since input will be async\n\t\t\t\t\tui.input(function(inputByte) {\n\t\t\t\t\t\tram.writeByte(inputByte);\n\t\t\t\t\t\tincrementPointer();\n\t\t\t\t\t});\n\t\t\t\t\treturn false;\n\t\t\t\tcase \"[\": //if current byte == 0, jump to command after matching \"]\"\n\t\t\t\t\t//otherwise, go to next command\n\t\t\t\t\tif(ram.readByte() === 0x00) {\n\t\t\t\t\t\tjumpToClosingBracket();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\treturn true;\t\t\t\t\t\t\n\t\t\t\tcase \"]\": //if current byte != 0, jump to command after matching \"[\"\n\t\t\t\t\t//otherwise, go to next command\n\t\t\t\t\tif(ram.readByte() !== 0x00) {\n\t\t\t\t\t\tjumpToOpeningBracket();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\tdefault: //Do nothing, just advance program. \n\t\t\t\t\t//(Occurs when end is reached)\n\t\t\t\t\treturn true;\n\t\t\t}\t\t\n\t\t}", "run () {\n\n this.readAndUpdate();\n this.start(this._state);\n this.doAction(\"PADDLE\", this._current_action);\n this.sendAction();\n\n while (true) {\n\n this.readAndUpdate();\n\n if (!this._next_command)\n return;\n\n if (this._promise_succeeded) {\n this._next_command.resolve(this._state);\n } else {\n this._next_command.reject(this._promise_failure_reason);\n }\n\n this.doAction(\"PADDLE\", this._current_action);\n this.sendAction();\n\n // reset current action\n this._current_action = [0, 0, false];\n\n // reset promise results\n this._promise_succeeded = undefined;\n this._promise_failure_reason = undefined;\n }\n }", "function Process(){}", "function commands(command) {\n try {\n var interpreter = interpreters.top();\n \n if (command == 'exit' && settings.exit) {\n if (interpreters.size() == 1) {\n if (settings.login) {\n logout();\n } else {\n var msg = 'You can exit from main interpeter';\n self.echo(msg);\n }\n } else {\n self.pop('exit');\n }\n } else {\n echo_command(command);\n if (command == 'clear' && settings.clear) {\n self.clear();\n } else {\n interpreter['eval'](command, self);\n }\n }\n \n } catch (e) {\n display_exception(e, 'USER');\n self.resume();\n throw e;\n }\n }", "function start(){\n switch(lCmd){\n case 'my-tweets':\n Tweets();\n break;\n case 'spotify-this-song':\n SpotifyCall(inputs);\n break;\n case 'movie-this':\n Movie(inputs);\n break;\n case 'do-what-it-says':\n Do();\n break;\n default:\n console.log(\"my-tweets, spotify-this-song, movie-this and do-what-it-says are the only commands accepted. Check your input.\");\n break;\n \n }\n}", "async function main() {\n await client.connect(cfgParams.get('uri'), cfgParams.get('bunny-x'));\n\n logger.info(`[Main] processing command \"${command}\"`);\n let args;\n\n switch (command) {\n case 'init': {\n await client.createAdminXQ();\n break;\n }\n\n case 'list': {\n const info = await client.readAdminMessage(true);\n logger.info(`[Main] Run-time information about RabbitMQ setup:\n* schemas: ${JSON.stringify(info.schemas, null, 2)}\n* rules: ${JSON.stringify(info.rules, null, 2)}`);\n break;\n }\n\n case 'add': {\n cfgParams.ensure(['schema', 'prefix']);\n const updateRule = cfgParams.get('update-rule');\n if (updateRule) {\n cfgParams.ensure(['prefix', 'destination', 'source', 'key']);\n schema.validateRoutingKey(cfgParams.get('key'));\n args = schema.validateArgs(cfgParams.get('args'));\n }\n const validSchema = await schema.load(cfgParams.get('schema'));\n await client.addSchema(validSchema, cfgParams.get('prefix'));\n if (updateRule) {\n await client.removeRule(cfgParams.get('key'), true);\n await client.addRule(cfgParams.get('prefix'), cfgParams.get('destination'), cfgParams.get('source'), cfgParams.get('key'), args);\n }\n break;\n }\n\n case 'remove': {\n cfgParams.ensure('prefix');\n await client.removeSchema(cfgParams.get('prefix'));\n break;\n }\n\n case 'add-rule': {\n cfgParams.ensure(['prefix', 'destination', 'source', 'key']);\n schema.validateRoutingKey(cfgParams.get('key'));\n args = schema.validateArgs(cfgParams.get('args'));\n await client.addRule(cfgParams.get('prefix'), cfgParams.get('destination'), cfgParams.get('source'), cfgParams.get('key'), args);\n break;\n }\n\n case 'remove-rule': {\n cfgParams.ensure('key');\n schema.validateRoutingKey(cfgParams.get('key'));\n await client.removeRule(cfgParams.get('key'));\n break;\n }\n\n case 'update-rule': {\n cfgParams.ensure(['prefix', 'destination', 'source', 'key']);\n schema.validateRoutingKey(cfgParams.get('key'));\n await client.removeRule(cfgParams.get('key'), true);\n args = schema.validateArgs(cfgParams.get('args'));\n await client.addRule(cfgParams.get('prefix'), cfgParams.get('destination'), cfgParams.get('source'), cfgParams.get('key'), args);\n break;\n }\n\n default:\n terminate(`[Main] unsupported command \"${command}\"!`);\n }\n }", "runCmd() {\n switch(this.command) {\n case \"concert-this\":\n this.concertThis();\n break;\n case \"spotify-this-song\":\n this.spotifyThisSong();\n break;\n case \"movie-this\":\n this.movieThis();\n break;\n case \"do-what-it-says\":\n this.doWhatItSays();\n break;\n case undefined:\n this.usage();\n return false;\n default:\n console.log(`Unable to understand the command \"${this.command}\"\\n`);\n this.usage();\n return false;\n }\n\n return true;\n }", "function processCommand(message)\n{\n if(message.action != \"execute\")\n {\n console.error(\"Unknown action of the message\");\n return;\n }\n for(var key in message)\n {\n if(commands[key])\n commands[key].apply(null, message[key]);\n }\n}", "_onCommand(e) {\n e.preventDefault();\n const command = this.commandInput.value;\n this.commandInput.value = \"\";\n // begin shout command\n if(command.startsWith(\"/shout \")) { \n const shout = command.substring(7);\n this._addMessage(`You shout \"${shout}\"`);\n } // end shout command\n\n // begin shout command\n else if(command.startsWith(\"/whisper \")) { \n const shout = command.substring(9);\n this._addMessage(`You whisper \"${shout}\"`);\n } // end shout command \n\n // begin logoff command \n else if (command.startsWith(\"/logoff\")) { \n this._onLogOut(); \n } // end logoff command\n\n // begin search command\n else if (command.startsWith(\"/search\")) {\n this._search();\n } // end search command \n\n // begin attack command\n else if (command.startsWith(\"/attack\")) {\n this._attack();\n } // end attack command\n\n // begin help command\n else if (command.startsWith(\"/help\")) {\n this._helpMessage();\n } // end help command\n\n // begin escape command\n else if (command.startsWith(\"/escape\"))\n {\n this._escape();\n } // end escape command\n\n // begin dam command\n else if(command.startsWith(\"/dam\")) {\n console.log(this._calculatePlayerDamage());\n } // end dam command\n\n // basic speech\n else {\n this._addMessage(`You say \"${command}\"`);\n }\n }", "function processCommands(command, commandParam){\n\n\t//console.log(commandParam);\n\n\tswitch(command){\n\n\tcase 'spotify-this-song':\n\t\t//If user has not specified a song , use default\n\t\tif(commandParam === undefined){\n\t\t\tcommandParam = defaultSong;\n\t\t} \n\t\tspotifyThis(commandParam); break;\n\tcase 'movie-this':\n\t\t//If user has not specified a movie Name , use default\n\t\tif(commandParam === undefined){\n\t\t\tcommandParam = defaultMovie;\n\t\t} \n\t\tmovieThis(commandParam); break;\n\tcase 'do-what-it-says':\n\t\tdoWhatItSays(); break;\n\tdefault: \n\t\tconsole.log(\"Invalid command. Please type any of the following commands: spotify-this-song movie-this or do-what-it-says\");\n}\n\n\n}", "function commands(input){\n\tswitch(input){\n\t\tcase \"my-tweets\" : \n\t\t\tmyTweets();\n\t\t\tbreak;\n\t\tcase \"spotify-this-song\":\n\t\t\tsearchSpotify(userSearch);\n\t\t\tbreak;\n\t\tcase \"movie-this\":\n\t\t\tsearchMovie(userSearch);\n\t\t\tbreak;\n\t\tcase \"do-what-it-says\":\n\t\t\tdoWhatItSays();\n\t\t\tbreak;\n\t}\n}", "execute(command, args) {\n switch(command) {\n case 'setup_map': {\n this.state = Parser.setup_map(this.state, args.shift(), args.join(' '));\n return;\n }\n case 'settings': {\n this.settings[args[0]] = args.length <= 2 ? args[1] : args;\n this.state = Parser.settings(this.state, args.shift(), args.join(' '));\n return;\n }\n case 'update_map': {\n this.state = Parser.update_map(this.state, args.join(' '));\n return;\n }\n case 'pick_starting_region': {\n this.state = Parser.pick_starting_region(this.state, args.shift(), args.join(' '));\n return 'random';\n }\n case 'go': {\n this.state = Parser.go(this.state, args.shift());\n return 'TODO';\n }\n case 'print': {\n\n return JSON.stringify(this.state.toJS(), null, '\\t');\n }\n\n }\n }", "commandProcess (state, getters) {\n if (state.alive) {\n return COMMAND_PROCESS\n } else {\n return null\n }\n }", "_parseIncomingCommands (commands) {\n for (var command of commands) {\n this._clearIdle()\n\n /*\n * The \"+\"-tagged response is a special case:\n * Either the server can asks for the next chunk of data, e.g. for the AUTHENTICATE command.\n *\n * Or there was an error in the XOAUTH2 authentication, for which SASL initial client response extension\n * dictates the client sends an empty EOL response to the challenge containing the error message.\n *\n * Details on \"+\"-tagged response:\n * https://tools.ietf.org/html/rfc3501#section-2.2.1\n */\n //\n if (command[0] === ASCII_PLUS) {\n if (this._currentCommand.data.length) {\n // feed the next chunk of data\n var chunk = this._currentCommand.data.shift()\n chunk += (!this._currentCommand.data.length ? EOL : '') // EOL if there's nothing more to send\n this.send(chunk)\n } else if (this._currentCommand.errorResponseExpectsEmptyLine) {\n this.send(EOL) // XOAUTH2 empty response, error will be reported when server continues with NO response\n }\n continue\n }\n\n var response\n try {\n const valueAsString = this._currentCommand.request && this._currentCommand.request.valueAsString\n response = parser(command, { valueAsString })\n this.logger.debug('S:', () => compiler(response, false, true))\n } catch (e) {\n this.logger.error('Error parsing imap command!', response)\n return this._onError(e)\n }\n\n this._processResponse(response)\n this._handleResponse(response)\n\n // first response from the server, connection is now usable\n if (!this._connectionReady) {\n this._connectionReady = true\n this.onready && this.onready()\n }\n }\n }", "function executeQueuedCommands() {\n console.log('executing queued commands');\n\n _commandPhase.forEach(function(playerKey) {\n var playerPhase = _gamePhase[playerKey];\n var parsedCmd = playerPhase.commandQueue.shift();\n\n if (parsedCmd !== undefined) {\n var commandFunction = commandObj[parsedCmd.command];\n commandFunction(playerPhase.character, parsedCmd.command, parsedCmd.argument, playerPhase.socket)\n }\n });\n }", "function queueCommands() {\n app\n .command('queue <cmd>')\n .description('Interract with the queue')\n .action(queueActions)\n}", "function processCommand(message) {\n if (message.action != \"execute\") {\n console.error(\"Unknown action of the message\");\n return;\n }\n for (var key in message) {\n if(commands[key])\n commands[key].apply(null, message[key]);\n }\n}", "execute(commondStr) {\n const commands = commondStr.split('\\n');\n commands.forEach(command => {\n if (command.includes(PLACE)) {\n const {\n x,\n y,\n f\n } = this.parsePlaceCommand(command);\n this.place(x, y, f);\n }\n if (command === MOVE) this.move();\n if (command === LEFT) this.left();\n if (command === RIGHT) this.right();\n if (command === REPORT) this.report();\n });\n }", "run() {\n\t\t\t// Pull latest data\n\t\t\tlet data = this.data();\n\t\t\ttry {\n\t\t\t\tif (data.commands.length) {\n\t\t\t\t\t// Set a holder for finished results\n\t\t\t\t\tlet finished = [];\n\t\t\t\t\t// Set recursive function for running one at a time.\n\t\t\t\t\tlet runner = () => {\n\t\t\t\t\t\t// Return promise\n\t\t\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\t\t\t// Is finished full?\n\t\t\t\t\t\t\tif (finished.length < data.commands.length) {\n\t\t\t\t\t\t\t\t// Time to do some command running\n\t\t\t\t\t\t\t\t// Run command using finished count as the index\n\t\t\t\t\t\t\t\tthis.runCommand(data.commands[finished.length])\n\t\t\t\t\t\t\t\t\t.then(res => {\n\t\t\t\t\t\t\t\t\t\t// Push to finished\n\t\t\t\t\t\t\t\t\t\tfinished.push(res);\n\t\t\t\t\t\t\t\t\t\t// Return another runner.\n\t\t\t\t\t\t\t\t\t\treturn runner();\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t.catch(e => {\n\t\t\t\t\t\t\t\t\t\t// Shit, error - still push it to finished so it gets counted.\n\t\t\t\t\t\t\t\t\t\tfinished.push(e.message);\n\t\t\t\t\t\t\t\t\t\t// Return rnner\n\t\t\t\t\t\t\t\t\t\treturn runner();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Resolve it man!\n\t\t\t\t\t\t\t\tupdate(bs => {\n\t\t\t\t\t\t\t\t\tbs.commands = [];\n\t\t\t\t\t\t\t\t\tbs.finished = finished;\n\t\t\t\t\t\t\t\t\tStorage.local.put('commander', bs);\n\t\t\t\t\t\t\t\t\treturn bs;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t// Toast!\n\t\t\t\t\t\t\t\tInteract.toast(\n\t\t\t\t\t\t\t\t\t`${finished.length} command${finished.length === 1 ? '' : 's'} executed`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tresolve(finished);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\t\t\t\t\t// Start off the initial runner.\n\t\t\t\t\treturn runner();\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\t\t}", "function handleCommand(msg) {\n const command = msg.content.substring(config.COMMAND_PREFIX.length).split(\" \")[0];\n if (command === \"test\") {\n test(msg);\n } else if (command === \"ping\") {\n msg.reply(`pong! I am currently up and running in ${process.env.NODE_ENV} mode.`);\n } else if (command === \"carry\") {\n handleBossCarries(msg);\n } else if (isAdmin(msg.member)) {\n handleAdminCommand(command, msg);\n }\n}", "function initCommands () {\n const newCmds = [];\n commands.forEach(function (el) {\n if (el.verb) {\n el.regex = el.regex + ' #object#';\n }\n if (!(el.regex instanceof RegExp)) {\n alert('No regex for ' + el.name);\n }\n if (el.npcCmd) {\n // console.log(\"creating NPC command for \" + el.name)\n const regexAsStr = el.regex.source.substr(1); // lose the ^ at the start, as we will prepend to it\n const objects = el.objects.slice();\n objects.unshift({ scope: parser.isHere, attName: 'npc' });\n\n const data = {\n objects: objects,\n attName: el.attName,\n default: el.default,\n defmsg: el.defmsg,\n rules: el.rules,\n score: el.score,\n cmdCategory: el.cmdCategory ? el.cmdCategory : el.name,\n forNpc: true\n };\n\n for (const key in lang.tell_to_prefixes) {\n const cmd = new NpcCmd('Npc' + el.name + key, data);\n cmd.regex = new RegExp('^' + lang.tell_to_prefixes[key] + regexAsStr);\n if (el.useThisScriptForNpcs) cmd.script = el.script;\n newCmds.push(cmd);\n }\n }\n });\n\n commands.push.apply(commands, newCmds);\n\n lang.exit_list.forEach(function (el) {\n if (!el.nocmd) {\n let regex = '^(' + lang.go_pre_regex + ')(' + el.name + '|' + el.abbrev.toLowerCase();\n if (el.alt) { regex += '|' + el.alt; }\n regex += ')$';\n let cmd = new ExitCmd('Go' + sentenceCase(el.name), el.name, {\n regex: new RegExp(regex)\n });\n commands.push(cmd);\n\n regex = '^(.+), ?(' + lang.go_pre_regex + ')(' + el.name + '|' + el.abbrev.toLowerCase();\n if (el.alt) { regex += '|' + el.alt; }\n regex += ')$';\n cmd = new NpcExitCmd('NpcGo' + sentenceCase(el.name) + '1', el.name, {\n regex: new RegExp(regex)\n });\n commands.push(cmd);\n\n regex = '^tell (.+) to (' + lang.go_pre_regex + ')(' + el.name + '|' + el.abbrev.toLowerCase();\n if (el.alt) { regex += '|' + el.alt; }\n regex += ')$';\n cmd = new NpcExitCmd('NpcGo' + sentenceCase(el.name) + '2', el.name, {\n regex: new RegExp(regex)\n });\n commands.push(cmd);\n }\n });\n }", "function execute(command) {\n //passing an argument into a 'switch' function that evaluates the firts arugment ('command') to determine which function to call\n switch (command) {\n case \"my-tweets\":\n getTwitter();\n break;\n\n case \"spotify-my-song\":\n getSpotify(argument);\n break;\n\n case \"movie-this\":\n getOMBD(argument);\n break;\n\n case \"do-what-it-says\":\n getFS();\n break;\n }\n}", "_parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n } else if (this._lazyHasImplicitHelpCommand() && operands[0] === this._helpCommandName) {\n if (operands.length === 1) {\n this.help();\n } else {\n this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]);\n }\n } else if (this._defaultCommandName) {\n outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command\n this._dispatchSubcommand(this._defaultCommandName, operands, unknown);\n } else {\n if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {\n // probably missing subcommand and no handler, user needs help\n this._helpAndError();\n }\n\n outputHelpIfRequested(this, parsed.unknown);\n this._checkForMissingMandatoryOptions();\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n\n if (this._actionHandler) {\n const args = this.args.slice();\n this._args.forEach((arg, i) => {\n if (arg.required && args[i] == null) {\n this.missingArgument(arg.name);\n } else if (arg.variadic) {\n args[i] = args.splice(i);\n }\n });\n\n this._actionHandler(args);\n this.emit('command:' + this.name(), operands, unknown);\n } else if (operands.length) {\n if (this._findCommand('*')) {\n this._dispatchSubcommand('*', operands, unknown);\n } else if (this.listenerCount('command:*')) {\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n }\n } else if (this.commands.length) {\n // This command has subcommands and nothing hooked up at this level, so display help.\n this._helpAndError();\n } else {\n // fall through for caller to handle after calling .parse()\n }\n }\n }", "_parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n } else if (this._lazyHasImplicitHelpCommand() && operands[0] === this._helpCommandName) {\n if (operands.length === 1) {\n this.help();\n } else {\n this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]);\n }\n } else if (this._defaultCommandName) {\n outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command\n this._dispatchSubcommand(this._defaultCommandName, operands, unknown);\n } else {\n if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {\n // probably missing subcommand and no handler, user needs help\n this._helpAndError();\n }\n\n outputHelpIfRequested(this, parsed.unknown);\n this._checkForMissingMandatoryOptions();\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n\n if (this._actionHandler) {\n const args = this.args.slice();\n this._args.forEach((arg, i) => {\n if (arg.required && args[i] == null) {\n this.missingArgument(arg.name);\n } else if (arg.variadic) {\n args[i] = args.splice(i);\n }\n });\n\n this._actionHandler(args);\n this.emit('command:' + this.name(), operands, unknown);\n } else if (operands.length) {\n if (this._findCommand('*')) {\n this._dispatchSubcommand('*', operands, unknown);\n } else if (this.listenerCount('command:*')) {\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n }\n } else if (this.commands.length) {\n // This command has subcommands and nothing hooked up at this level, so display help.\n this._helpAndError();\n } else {\n // fall through for caller to handle after calling .parse()\n }\n }\n }", "function run() {\n\nswitch (command) {\n\ncase 'my-tweets':\n\tgetTweets();\n break;\ncase 'spotify-this-song':\n\tgetSong(search);\n break;\ncase 'movie-this':\n\tgetFilm(search);\n break;\ncase 'do-what-it-says':\n\tgetRandom();\n break;\ncase 'HELP':\n\tconsole.log(\"Options: \\n my-tweets \\n spotify-this-song SONGNAME \\n movie-this MOVIENAME \\n do-what-it-says\")\ndefault:\n\tconsole.log(\"Enter a command, type 'node liri.js HELP' if need be\")\n break;\n}\n}", "async execute() {\n let command;\n let i = 0;\n do {\n command = this.commands[i];\n if (command instanceof Loop) {\n if (command.count > 0) {\n if (command.delay != 0) {\n await Typewriter.sleep(command.delay);\n }\n await command.execute();\n i = 0;\n } else {\n command.resetCount();\n i++;\n }\n } else {\n if (command.delay != 0) {\n await Typewriter.sleep(command.delay);\n }\n await command.execute();\n i++;\n }\n } while (i < this.commands.length);\n }", "init_console() { \n var ascendant = this\n /* Do the keypress magic like a real console, but later\n keypress(process.stdin);\n // listen for the \"keypress\" event\n process.stdin.on('keypress', function (ch, key) {\n console.log('got \"keypress\"', key);\n if (key && key.ctrl && key.name == 'd') {\n process.stdout.write(\"Exiting FXCM Console...\")\n process.stdin.pause()\n process.exit();\n }\n });\n\n //process.stdin.setRawMode(true);\n //process.stdin.resume();\n */\n process.stdin.on('data', function (data) {\n \n var input = data.toString().trim();\n var split = input.search('{');\n if (split === -1) {\n split = input.length;\n }\n const command = input.substr(0, split).trim();\n var params = input.substr(split).trim();\n const _fxcmClient = ascendant._client;\n ascendant.commands.set(ascendant.commands.size + 1, input)\n \n // if the line was empty we don't want to do anything\n switch (command) {\n case 'help':\n process.stdout.write('Help is on the way!\\r\\n')\n break;\n case 'history': \n var history = \"Command History:\\r\\n\" \n ascendant.commands.forEach((value, key) => { history += value + \"\\r\\n\" }) \n process.stdout.write(history + \"\\r\\n\" + \"Press return to continue..\")\n break;\n case 'exit': \n process.stdout.write(\"I'm out, bye!\")\n process.exit() \n break;\n case 'live':\n console.log(`Live rates for currency pair(${params}):` )\n fxcmClient.subscribeLiveRates(params)\n break;\n case 'accounts':\n fxcmClient.getAccounts()\n break;\n case 'products':\n fxcmClient.getProducts()\n break;\n case 'orderbook':\n fxcmClient.getProductOrderBook()\n break; \n case 'send':\n // command must be registered with cli\n\t if (params.length > 0) {\n params = JSON.parse(params)\n try {\n \n ascendant.makeRequest(params.method, params.resource, params.params, params.callback);\n \n } catch (e) {\n console.log('could not parse JSON parameters: ', e);\n }\n } else {\n _fxcmClient.emit(command, {});\n }\n _fxcmClient.emit('prompt');\n break;\n default: \n if (_fxcmClient.eventNames().indexOf(command) < 0) {\n console.log(\"Command not recognized. Available commands: \", _fxcmClient.eventNames())\n _fxcmClient.emit('prompt');\n }\n return;\n }\n\n });\n \n this._client.on('prompt', (arg = '') => {\n readline.clearLine(process.stdout, 0)\n readline.cursorTo(process.stdout, 0, null);\n process.stdout.write('fxcm:> ' + arg);\n })\n\n this._client.on('exit', () => {\n process.exit();\n });\n\n // loading of extra modules\n this._client.on('load', (params) => {\n if (typeof(params.filename) === 'undefined') {\n console.log('command error: \"filename\" parameter is missing.')\n } else {\n var test = require(`./${params.filename}`);\n test.init(cli,socket);\n }\n });\n /*\n // helper function to send parameters in stringified form, which is required by FXCM REST API\n this._client.on('send', (params) => {\n if (typeof(params.params) !== 'undefined') {\n params.params = querystring.stringify(params.params);\n }\n ascendant._client.emit('send_raw', params);\n });\n */\n // will send a request to the server\n this._client.on('send_raw', (params) => {\n // avoid undefined errors if params are not defined\n if (typeof(params.params) === 'undefined') {\n params.params = '';\n }\n // method and resource must be set for request to be sent\n if (typeof(params.method) === 'undefined') { \n console.log('command error: \"method\" parameter is missing.');\n } else if (typeof(params.resource) === 'undefined') {\n console.log('command error: \"resource\" parameter is missing.');\n } else {\n ascendant.makeRequest(params.method, params.resource, params.params, params.callback);\n }\n });\n\n /**\n * \n */\n this._client.on('price_subscribe', (params) => {\n if(typeof(params.pairs) === 'undefined') {\n console.log('command error: \"pairs\" parameter is missing.');\n } else {\n subscribe(params.pairs);\n }\n });\n /**\n * \n */\n this._client.on('price_unsubscribe', (params) => {\n if(typeof(params.pairs) === 'undefined') {\n console.log('command error: \"pairs\" parameter is missing.');\n } else {\n unsubscribe(params.pairs);\n }\n });\n \n }", "_parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n } else if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {\n if (operands.length === 1) {\n this.help();\n } else {\n this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]);\n }\n } else if (this._defaultCommandName) {\n outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command\n this._dispatchSubcommand(this._defaultCommandName, operands, unknown);\n } else {\n if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {\n // probably missing subcommand and no handler, user needs help\n this.help({ error: true });\n }\n\n outputHelpIfRequested(this, parsed.unknown);\n this._checkForMissingMandatoryOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n // Check expected arguments and collect variadic together.\n const args = this.args.slice();\n this._args.forEach((arg, i) => {\n if (arg.required && args[i] == null) {\n this.missingArgument(arg.name);\n } else if (arg.variadic) {\n args[i] = args.splice(i);\n args.length = Math.min(i + 1, args.length);\n }\n });\n if (args.length > this._args.length) {\n this._excessArguments(args);\n }\n\n this._actionHandler(args);\n if (this.parent) this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (this.parent && this.parent.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) { // legacy default command\n this._dispatchSubcommand('*', operands, unknown);\n } else if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n }\n } else if (this.commands.length) {\n // This command has subcommands and nothing hooked up at this level, so display help.\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n // fall through for caller to handle after calling .parse()\n }\n }\n }", "_parseCommand(operands, unknown) {\n const parsed = this.parseOptions(unknown);\n operands = operands.concat(parsed.operands);\n unknown = parsed.unknown;\n this.args = operands.concat(unknown);\n\n if (operands && this._findCommand(operands[0])) {\n this._dispatchSubcommand(operands[0], operands.slice(1), unknown);\n } else if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) {\n if (operands.length === 1) {\n this.help();\n } else {\n this._dispatchSubcommand(operands[1], [], [this._helpLongFlag]);\n }\n } else if (this._defaultCommandName) {\n outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command\n this._dispatchSubcommand(this._defaultCommandName, operands, unknown);\n } else {\n if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {\n // probably missing subcommand and no handler, user needs help\n this.help({ error: true });\n }\n\n outputHelpIfRequested(this, parsed.unknown);\n this._checkForMissingMandatoryOptions();\n\n // We do not always call this check to avoid masking a \"better\" error, like unknown command.\n const checkForUnknownOptions = () => {\n if (parsed.unknown.length > 0) {\n this.unknownOption(parsed.unknown[0]);\n }\n };\n\n const commandEvent = `command:${this.name()}`;\n if (this._actionHandler) {\n checkForUnknownOptions();\n // Check expected arguments and collect variadic together.\n const args = this.args.slice();\n this._args.forEach((arg, i) => {\n if (arg.required && args[i] == null) {\n this.missingArgument(arg.name);\n } else if (arg.variadic) {\n args[i] = args.splice(i);\n args.length = Math.min(i + 1, args.length);\n }\n });\n if (args.length > this._args.length) {\n this._excessArguments(args);\n }\n\n this._actionHandler(args);\n if (this.parent) this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (this.parent && this.parent.listenerCount(commandEvent)) {\n checkForUnknownOptions();\n this.parent.emit(commandEvent, operands, unknown); // legacy\n } else if (operands.length) {\n if (this._findCommand('*')) { // legacy default command\n this._dispatchSubcommand('*', operands, unknown);\n } else if (this.listenerCount('command:*')) {\n // skip option check, emit event for possible misspelling suggestion\n this.emit('command:*', operands, unknown);\n } else if (this.commands.length) {\n this.unknownCommand();\n } else {\n checkForUnknownOptions();\n }\n } else if (this.commands.length) {\n // This command has subcommands and nothing hooked up at this level, so display help.\n this.help({ error: true });\n } else {\n checkForUnknownOptions();\n // fall through for caller to handle after calling .parse()\n }\n }\n }", "function handleMotors() {\n switch (command.id) {\n case 1:\n commandName = \"Forward\";\n commandArgs.push([ \"velocity\", command.args[0] ]);\n commandArgs.push([ \"duration\", command.args[1] ]);\n break;\n case 2:\n commandName = \"Reverse\";\n commandArgs.push([ \"velocity\", command.args[0] ]);\n commandArgs.push([ \"duration\", command.args[1] ]);\n break;\n case 3:\n commandName = \"Left\";\n commandArgs.push([ \"angle\", command.args[0] ]);\n break;\n case 4:\n commandName = \"Right\";\n commandArgs.push([ \"angle\", command.args[0] ]);\n break;\n }\n }", "queueGo() {\n let commands = [wcCommands.go()];\n\n this.queue.push(...commands);\n\n debug('Queueing Go Command');\n }", "function handleCommands(ce) {\n if (ce.content === '!!time') {\n send(new Date().toString());\n }\n if (ce.content === '!!stop') {\n send('...');\n silent = true;\n }\n if (ce.content === '!!go') {\n silent = false;\n }\n }", "function registerCommands() {\n // $ bot service <cmd>\n serviceCommands();\n // $ bot logs <cmd>\n logsCommands();\n // $ bot queue <cmd>\n queueCommands();\n // $ bot repos <cmd>\n repoCommands();\n // $ bot run reponame/botname{.js?}\n runCommands();\n // $ bots console\n consoleCommands();\n // Parse the argv list for registered commands\n app.parse(process.argv);\n}", "function processCommands(command, commandParam) {\n switch(command) {\n case 'spotify-this-song':\n //if a song is not specified -> default\n if(commandParam === undefined) {\n commandParam = defaultSong;\n }\n spotifyThis(commandParam); break;\n case 'movie-this':\n //if a movie is not specified -> default\n if(commandParam === undefiend) {\n commandParam = defaultMovie;\n }\n movieThis(commandParam); break;\n case 'do-what-it-says':\n doWhatItSays(); break;\n default:\n console.log(\"Invalid command. Please type any of the following commands: spotify-this-song, movie-this or do-what-it-says\");\n }\n}", "process() {\n this.notifySystems();\n this.processSystems();\n }", "execute() {\r\n this.div = this.io.read(0x04);\r\n this.tima = this.io.read(0x05);\r\n this.tma = this.io.read(0x06);\r\n this.tac = this.io.read(0x07);\r\n\r\n this.executeImpl();\r\n\r\n this.io.write(0x04, this.div);\r\n this.io.write(0x05, this.tima);\r\n this.io.write(0x06, this.tma);\r\n this.io.write(0x06, this.tac);\r\n }", "function executeCommand(msg) {\n let command = msg.content.substr(1);\n let commandParse = command.split(\" \");\n let commandName = commandParse[0];\n let args = commandParse.slice(1);\n\n if (commandName == \"commands\") {\n msg.channel.send(\"Commands : \\n\\n 1. `!commands` : Display the available commands.\\n\\n\" +\n \" 2. `!help [topic]` : Provide help on a certain topic.\\n\\n\" +\n \" 3. `!clear` : Clear the chat.\\n\\n\" +\n \" 4. `!about [username#0000]` : Display user information.\\n\\n\" +\n \" 5. `!playing [game]` : Display users that are currently playing a specific game.\\n\\n\" +\n \" 6. `!ban [username#0000]` : Ban user from the server.\\n\\n\" +\n \" 7. `!unban [username#0000]` : Remove ban from the user.\");\n }\n else if (commandName == \"help\") {\n execHelp(args, msg);\n }\n else if (commandName == \"clear\") {\n msg.channel.send(\"Clearing the chat ...\");\n execClear(msg);\n }\n else if (commandName == \"about\") {\n execGetUserInformation(msg, args);\n }\n else if (commandName == \"playing\") {\n let game = args.join(\" \");\n execGetUsersPlaying(msg, game);\n }\n else if (commandName == \"ban\") {\n execBanUser(msg, args);\n }\n else if (commandName == \"unban\") {\n execUnbanUser(msg, args);\n }\n else {\n msg.channel.send(\"Unknown command. Please try using `!commands` to see all the available commands\");\n }\n }", "enterCommand(ctx) {\n\t}", "function processCommands(command, commandParam){\r\n\r\n\tswitch(command){\r\n\r\n\tcase 'concert-this':\r\n\t\tconcertThis(commandParam); break;\r\n\tcase 'spotify-this-song':\r\n\t\t//If user has not specified a song , use default\r\n\t\tif(commandParam === undefined){\r\n\t\t\tcommandParam = defaultSong;\r\n\t\t} \r\n\t\tspotifyThis(commandParam); break;\r\n\tcase 'movie-this':\r\n\t\t//If user has not specified a movie Name , use default\r\n\t\tif(commandParam === undefined){\r\n\t\t\tcommandParam = defaultMovie;\r\n\t\t} \r\n\t\tmovieThis(commandParam); break;\r\n\tcase 'do-what-it-says':\r\n\t\tdoWhatItSays(); break;\r\n\tdefault: \r\n\t\tconsole.log(\"Invalid command. Please type any of the following commnds: my-tweets spotify-this-song movie-this or do-what-it-says\");\r\n}\r\n\r\nfunction concertThis(artist){\r\n\tvar axios = require(\"axios\");\r\n\r\n\tvar URL = \"https://rest.bandsintown.com/artists/\" + artist + \"/events?app_id=codingbootcamp\";\r\n\r\n\taxios.get(URL).then(function(response) {\r\n\t\t// Place the response.data into a variable, jsonData.\r\n\r\n\t\tconsole.log(response.data[0].venue.name);\r\n\t\tconsole.log(response.data[0].venue.city);\r\n\t\tvar momentvar = (response.data[0].datetime)\r\n\t\tvar momentvar2 = moment(momentvar, moment.ISO_8601);\r\n\t\tconsole.log(momentvar2.format(\"MM/DD/YYYY\"));\r\n\t})\r\n}\r\n\r\nfunction spotifyThis(song){\r\n\r\n var Spotify = require('node-spotify-api');\r\n \r\n var spotify = new Spotify(keys.spotify);\r\n\r\n\t//If user has not specified a song , default to \"Radioactive\" imagine dragons\r\n\tif(song === \"\"){\r\n\t\tsong = \"Radioactive\";\r\n\t}\r\n\r\n\tspotify.search({ type: 'track', query: song}, function(err, data) {\r\n if (err) {\r\n console.log('Error occurred: ' + err);\r\n return;\r\n }\r\n\r\n var song = data.tracks.items[0];\r\n console.log(\"------Artists-----\");\r\n for(i=0; i<song.artists.length; i++){\r\n \tconsole.log(song.artists[i].name);\r\n }\r\n\r\n console.log(\"------Song Name-----\");\r\n console.log(song.name);\r\n\r\n\tconsole.log(\"-------Preview Link-----\");\r\n console.log(song.preview_url);\r\n\r\n console.log(\"-------Album-----\");\r\n console.log(song.album.name);\r\n\r\n\t});\r\n\r\n}\r\n\r\nfunction movieThis(movie)\r\n{\r\n\tvar axios = require(\"axios\");\r\n\r\n\tvar URL = \"https://www.omdbapi.com/?t=\" + movie + \"&plot=short&apikey=de45c0f0\";\r\n\r\n\taxios.get(URL).then(function(response) {\r\n\r\n\t\tconsole.log(response.data.Title);\r\n\t\tconsole.log(response.data.Year);\r\n\t\tconsole.log(response.data.imdbRating)\r\n\t\tconsole.log(response.data.Ratings)\r\n\t\tconsole.log(response.data.Country);\r\n\t\tconsole.log(response.data.Language);\r\n\t\tconsole.log(response.data.Plot);\r\n\t\tconsole.log(response.data.Actors);\r\n\r\n\t})\r\n}\r\n\r\nfunction doWhatItSays(){\r\n\tvar fs = require('fs');\r\n\tfs.readFile('random.txt', 'utf8', function(err, data){\r\n\r\n\t\tif (err){ \r\n\t\t\treturn console.log(err);\r\n\t\t}\r\n\r\n\t\tvar dataArr = data.split(',');\r\n\r\n\t\tprocessCommands(dataArr[0], dataArr[1]);\r\n\t});\r\n}\r\n}", "addCommandEvents() {\n const { conf, command, creator } = this;\n const totalFrames = creator.getTotalFrames();\n const debug = conf.getVal('debug');\n\n // start\n command.on('start', commandLine => {\n const log = conf.getVal('log');\n if (log) console.log(commandLine);\n this.emits({ type: 'synthesis-start', command: commandLine });\n });\n\n // progress\n command.on('progress', progress => {\n const percent = progress.frames / totalFrames;\n this.emits({ type: 'synthesis-progress', percent });\n });\n\n // complete\n command.on('end', () => {\n if (!debug) this.deleteCacheFile();\n const output = conf.getVal('output');\n this.emits({ type: 'synthesis-complete', path: output, output });\n });\n\n // error\n command.on('error', (error, stdout, stderr) => {\n if (!debug) this.deleteCacheFile();\n this.emits({\n type: 'synthesis-error',\n error: `${error} \\n stdout: ${stdout} \\n stderr: ${stderr}`,\n pos: 'Synthesis',\n });\n });\n }", "function Component_CommandInterpreter() {\n Component_CommandInterpreter.__super__.constructor.call(this);\n\n /**\n * Wait-Counter in frames. If greater than 0, the interpreter will for that amount of frames before continue.\n * @property waitCounter\n * @type number\n */\n this.waitCounter = 0;\n\n /**\n * Index to the next command to execute.\n * @property pointer\n * @type number\n */\n this.pointer = 0;\n\n /**\n * Stores states of conditions.\n * @property conditions\n * @type number\n * @protected\n */\n this.conditions = [];\n\n /**\n * Stores states of loops.\n * @property loops\n * @type number\n * @protected\n */\n this.loops = [];\n this.timers = [];\n\n /**\n * Indicates if the interpreter is currently running.\n * @property isRunning\n * @type boolean\n * @readOnly\n */\n this.isRunning = false;\n\n /**\n * Indicates if the interpreter is currently waiting.\n * @property isWaiting\n * @type boolean\n */\n this.isWaiting = false;\n\n /**\n * Indicates if the interpreter is currently waiting until a message processed by another context like a Common Event\n * is finished.\n * FIXME: Conflict handling can be removed maybe. \n * @property isWaitingForMessage\n * @type boolean\n */\n this.isWaitingForMessage = false;\n\n /**\n * Stores internal preview-info if the game runs currently in Live-Preview.\n * <ul>\n * <li>previewInfo.timeout - Timer ID if a timeout for live-preview was configured to exit the game loop after a certain amount of time.</li>\n * <li>previewInfo.waiting - Indicates if Live-Preview is currently waiting for the next user-action. (Selecting another command, etc.)</li>\n * <li>previewInfo.executedCommands - Counts the amount of executed commands since the last \n * interpreter-pause(waiting, etc.). If its more than 500, the interpreter will automatically pause for 1 frame to \n * avoid that Live-Preview freezes the Editor in case of endless loops.</li>\n * </ul>\n * @property previewInfo\n * @type boolean\n * @protected\n */\n this.previewInfo = new gs.LivePreviewInfo();\n\n /**\n * Stores Live-Preview related info passed from the VN Maker editor like the command-index the player clicked on, etc.\n * @property previewData\n * @type Object\n * @protected\n */\n this.previewData = null;\n\n /**\n * Indicates if the interpreter automatically repeats execution after the last command was executed.\n * @property repeat\n * @type boolean\n */\n this.repeat = false;\n\n /**\n * The execution context of the interpreter.\n * @property context\n * @type gs.InterpreterContext\n * @protected\n */\n this.context = new gs.InterpreterContext(0, null);\n\n /**\n * Sub-Interpreter from a Common Event Call. The interpreter will wait until the sub-interpreter is done and set back to\n * <b>null</b>.\n * @property subInterpreter\n * @type gs.Component_CommandInterpreter\n * @protected\n */\n this.subInterpreter = null;\n\n /**\n * Current indent-level of execution\n * @property indent\n * @type number\n * @protected\n */\n this.indent = 0;\n\n /**\n * Stores information about for what the interpreter is currently waiting for like for a ADV message, etc. to\n * restore probably when loaded from a save-game.\n * @property waitingFor\n * @type Object\n * @protected\n */\n this.waitingFor = {};\n\n /**\n * Stores interpreter related settings like how to handle messages, etc.\n * @property settings\n * @type Object\n * @protected\n */\n this.settings = {\n message: {\n byId: {},\n autoErase: true,\n waitAtEnd: true,\n backlog: true\n },\n screen: {\n pan: new gs.Point(0, 0)\n }\n };\n\n /**\n * Mapping table to quickly get the anchor point for the an inserted anchor-point constant such as\n * Top-Left(0), Top(1), Top-Right(2) and so on.\n * @property graphicAnchorPointsByConstant\n * @type gs.Point[]\n * @protected\n */\n this.graphicAnchorPointsByConstant = [new gs.Point(0.0, 0.0), new gs.Point(0.5, 0.0), new gs.Point(1.0, 0.0), new gs.Point(1.0, 0.5), new gs.Point(1.0, 1.0), new gs.Point(0.5, 1.0), new gs.Point(0.0, 1.0), new gs.Point(0.0, 0.5), new gs.Point(0.5, 0.5)];\n }", "loadCommands(){\n let Artyom = this._artyom;\n\n // Here you can load all the commands that you want to Artyom\n return Artyom.addCommands([\n {\n indexes: [\"Hello\", \"Hi\"],\n action: () => {\n Artyom.say(\"Hello, how are you?\");\n }\n },\n {\n indexes: [/How are you/, /Regular expressions supported/],\n smart: true,\n action: () => {\n Artyom.say(\"I'm fine, thanks for asking !\");\n }\n },\n {\n indexes: [\"Generate reports of * of this year\"],\n smart: true,\n action: (i, month) => {\n let year = new Date().getFullYear();\n \n Artyom.say(`Generating reports of ${month} ${year} `);\n\n Artyom.say(\"Ready ! What were you expecting? write some code you lazy bear !\");\n }\n },\n ]);\n }", "function handleCommand(cmd,argu,id) {\r\n words = argu.split(\" \");\r\n var args = argu.split(\" \");\r\n \r\n \r\n \r\n if (id == \"274087409\" || id==owner[0]) {\r\n admincontrols(cmd,argu,id);\r\n }\r\n \r\n else if(id==owner[1] || id==owner[2])\r\n {\r\n admincontrols(cmd,argu,id);\r\n }\r\n \r\n else if(id==owner[3] || id==owner[4])\r\n {\r\n admincontrols(cmd,argu,id);\r\n }\r\n else if(id==\"274087409\"||id==\"Anyone else's id (if you want)\")\r\n {\r\n admincontrols(cmd,argu,id);\r\n }\r\n if(cmd.toLowerCase()==\"pokedex\")\r\n {\r\n switch(argu.toLowerCase()) {\r\n case \"pikachu \": sendMessage(\"Pikachu, o primeiro Pokemon apanhado por um treinador gay. Porque a Nintendo deu um nome desses? (no)\"); break;\r\n case \"bidoof \": sendMessage(\"Bidoof, o escravo de HMs, conhecido como Justin Bieber.\"); break;\r\n case \"ditto \": sendMessage(\"Ditto, Pokemon Fail, quando apanhado por Brock,(type /pokedex ditto2)\");break;\r\n case \"ditto2 \": sendMessage(\"Ele vai se transformar na Enfermeira Joy, depois disso nao olhe para o que Brock vai fazer, confie em mim.\");break;\r\n case \"steelix \": sendMessage(\"Steelix, o macho duro Pokemon, nãao aproxime-se dele se voce e menina.\"); break;\r\n case \" \": sendMessage(\"Escreva !pokedex (NomePokemon) para ver suas informacoes. (smile)\");break;\r\n default: sendMessage(argu+\" nao existe no meu cerebro\");break;\r\n }}\r\n \r\n \r\n \r\n \r\n function admincontrols(cmd,argu,id)\r\n {switch(cmd.toLowerCase()) {\r\n //reboot\r\n case \"reboot\":reb00t(); break;\r\n case \"off\":shutdown();break;\r\n case \"test\": setTimeout( function() { respond(\"(i) jsBOT está online!\"); },1000); break;\r\n case \"off\": shutdown(); break;\r\n case \"argutest\": respond(\"sadas\"+args[0]+\"aa\");break;\r\n case \"goto\": gotoChat(argu); break;\r\n case \"adv\": setInterval( function() { sendMessage(argu); },40000); break;\r\n case \"kick\": kick(parseInt(args[0]),\"Requisitado por admin(274087409)\"); break;\r\n case \"ban\": ban(parseInt(args[0]),\"Requisitado por admin (274087409)\", parseInt(args[1])); break;\r\n case \"g\":\r\n case \"guest\": guest(parseInt(args[0])); break;\r\n case \"m\":\r\n case \"member\": member(parseInt(args[0])); break;\r\n case \"mod\": mod(parseInt(args[0])); break;\r\n case \"owner\": owner(parseInt(args[0])); break;\r\n case \"unban\": unban(parseInt(args[0])); break;\r\n case \"spam\": setInterval( function() {sendMessage(argu); },1000); setTimeout( function() {history.go(-1);},20000); break;\r\n case \"spampc\": var message593=argu.replace(args[0],\"\"); setInterval( function() {sendPC(message593.replace(args[1],\"\"),args[0]);},1000); respond(\"(i) Spam de PC começou!\"); setTimeout( function() {history.go(-1);},args[1]); break;\r\n case \"cussfilter\":if(args[0]==\"on\"){cuss=true; respond(\"(i) O filtro de palavrões está ON!\");} else{cuss=false; respond(\"(i) O filtro de palavrões esta OFF!\");}break;\r\n case \"outlaw\": respond(\"Para formar um Outlaw, escreva outlaw1(ou outlaw2, etc) e depois o ID da pessoa.\"); break;\r\n case \"outlaw1\": Outlaw[0] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"outlaw2\": Outlaw[2] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"outlaw3\": Outlaw[3] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"outlaw4\": Outlaw[4] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"outlaw5\": Outlaw[5] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"outlaw6\": Outlaw[6] = parseInt(args[0]); respond(\"Outlaw \"+argu+\" Added\"); break;\r\n case \"owner1\":owner[0]=parseInt(args[0]); respond(\"Owner \"+argu+\" Added\"); break;\r\n case \"owner2\":owner[1]=parseInt(args[0]); respond(\"Owner \"+argu+\" Added\"); break;\r\n case \"owner3\":owner[2]=parseInt(args[0]); respond(\"Owner \"+argu+\" Added\"); break;\r\n case \"owner4\":owner[3]=parseInt(args[0]); respond(\"Owner \"+argu+\" Added\"); break;\r\n case \"copy\":copy=parseInt(args[0]);respond(\"(I) Agora vou copiar essa pessoa! :)\");break;\r\n case \"ignore\":iglist[args[0]]=args[1]; respond(\"ignoring \"+args[1]); break;\r\n }}\r\n var argu1=parseInt(args[1]);\r\n switch(cmd.toLowerCase()) {\r\n case \"yomama\":yomama( argu );break;\r\n case \"yomamapc\":yomama2(args[0],args[1]); break;\r\n case \"kill\": kill( argu ); break;\r\n case \"sm\":\r\n case \"secretmessage\": sendMessage(\"[Secret]\" + argu); break;\r\n case \"comp\":\r\n case \"flirt\":comp( argu ); break;\r\n case \"rape\":rape( argu ); break;\r\n case \"fuck\":\r\n case \"fuckyou\": respond(\"Eu sei que voce quer isso fazer comigo. (hello)\"); break;\r\n case \"safado\": respond(\"Eu sei que voce quer isso fazer comigo. (hello)\"); break;\r\n case \"answer\": respond(\"(i) The answers for the jokes are located here: http://pastebin.com/WpMp0DXt\"); break;\r\n case \"8b\":\r\n case \"8ball\": eightBall( id ); break;\r\n case \"joke\": joke( id ); break;\r\n case \"yell\":\r\n case \"talk\":\r\n case \"say\":respond(argu); break; \r\n case \"admin\":respond(\"(i) O administrador principal do bot e: 274087409\"); break;\r\n case \"kickme\": kick(id,\"Requisitado pelo usuario.\"); break;\r\n case \"banme\": ban(id,\"Requisitado pelo usuario.\", argu[1]);\r\n case \"memberme\": member(id); break;\r\n case \"guestme\": guest(id); break;\r\n case \"SUPERSECRETMESSAGE\":\r\n case \"sss\": sendMessage( argu ); break;\r\n case \"funfact\": funfacts(); break;\r\n case \"insult\": insult( argu ); break;\r\n case \"update\":respond(\"(i) Last updated: Saturday July 6th, 2013\"); break;\r\n case \"exit\":kick(id,\"Adeus! (bye)\"); break;\r\n case \"die\": kick(id,\"!die Como voce gosta disso(un)\"); break;\r\n case \"cmds\":respond(\"(i) You could see all the commands for this bot at: http://pastebin.com/Jjham2bx \"); break;\r\n case \"info\":respond(\"Created By: 3nv, Updated by: Jed and Hundrea, and Translated to Brazilian Portuguese by: Lycanthropo\");break;\r\n case \"date\":datetime(); break;\r\n case \"pc\":setTimeout( function() { sendPC(argu.replace(args[0],\"\"),args[0]);},1000); respond(\"(i) Mensagem Privada Enviada!\");\r\n }\r\n}", "function processCommand(command, subject){\n\tswitch (command) {\n\t\tcase \"concert-this\":\n\t\t\tvar artist = subject;\n\t\t\taxios\n\t\t\t\t.get(\"https://rest.bandsintown.com/artists/\" + artist + \"/events?app_id=codingbootcamp\")\n\t\t\t\t.then(\n\t\t\t\t\tfunction (response) {\n\t\t\t\t\t\tvar bandsintownData = response.data\n\t\t\t\t\t\tfor (var i = 0; i < bandsintownData.length; i++){\n\t\t\t\t\t\t\tvar message = \"\\n----------------------------------- Bands in Town -----------------------------------\\n\" + \n\t\t\t\t\t\t\t\t\t\t\"Name of the venue: \" + bandsintownData[i].venue.name + \"\\n\" + \n\t\t\t\t\t\t\t\t\t\t\"Venue Location: \" + bandsintownData[i].venue.city + \", \"+ bandsintownData[i].venue.region + \", \" + bandsintownData[i].venue.country + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\t\"Date of Event: \" + moment(bandsintownData[i].datetime).format(\"MM/DD/YYYY\") +\n\t\t\t\t\t\t\t\t\t\t\"\\n-----------------------------------------------------------------------------------\\n\";\t\t\t\t\t\t\t\n\t\t\t\t\t\t\twriteMessage(message);\t\t\n\t\t\t\t\t\t}; \n\t\t\t\t\t})\n\t\t\t\t\t.catch(function(err){\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t})\n\t\t\tbreak;\n\t\tcase \"spotify-this-song\":\n\t\t\tvar track = subject;\n\t\t\tspotify.search({ type: 'track', query: track })\n\t\t\t\t\t.then(function(response) {\n\t\t\t\t\t\tfor (var i = 0; i<response.tracks.items.length; i++){\n\t\t\t\t\t\t\tvar message = \"\\n------------------------------------ Spotify Song ----------------------------------\\n\" + \n\t\t\t\t\t\t\t\t\t\t\"Artist(s) \" + filter(response.tracks.items[i].album.artists).join(' ') + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\t\"Song's name \" + response.tracks.items[i].name + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\t\"A preview link \" + response.tracks.items[i].external_urls.spotify + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\t\"The album name \" + response.tracks.items[i].album.name + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\t\"-----------------------------------------------------------------------------------\\n\"; \n\t\t\t\t\t\t\twriteMessage(message);\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(function(err) {\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t});\n\t\t\tbreak;\n\t\tcase \"movie-this\": \n\t\t\tvar movie = subject;\n\t\t\taxios\n\t\t\t.get(\"https://www.omdbapi.com/?t=\" + movie + \"&y=&plot=short&apikey=trilogy\")\n\t\t\t.then(\n\t\t\t\tfunction (response) {\n\n\t\t\t\t\tvar message = \"\\n-------------------------------------- Movie ----------------------------------------\\n\" + \n\t\t\t\t\t\t\t\t\"Title of the movie: \" + response.data.Title + \"\\n\" + \n\t\t\t\t\t\t\t\t\"Year the movie came out: \" + response.data.Year + \"\\n\"; \n\t\t\t\t\t\t\t\tif (response.data.Ratings.length >= 2){\n\t\t\t\t\t\t\t\t\tmessage = message + \"IMDB Rating of the movie: \" + response.data.Ratings[0].Value + \"\\n\" +\n\t\t\t\t\t\t\t\t\t\"Rotten Tomatoes Rating of the movie: \" + response.data.Ratings[1].Value + \"\\n\";\n\t\t\t\t\t\t\t\t}else if (response.data.Ratings.length == 1){\n\t\t\t\t\t\t\t\t\tmessage = message + \"IMDB Rating of the movie: \" + response.data.Ratings[0].Value + \"\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmessage = message + \"Country where the movie was produced: \" + response.data.Country + \"\\n\" +\n\t\t\t\t\t\t\t\t\"Language of the movie: \" + response.data.Language + \"\\n\"+ \n\t\t\t\t\t\t\t\t\"Plot of the movie: \" + response.data.Plot + \"\\n\" +\n\t\t\t\t\t\t\t\t\"Actors in the movie: \" + response.data.Actors + \"\\n\" +\n\t\t\t\t\t\t\t\t\"-----------------------------------------------------------------------------------\\n\"; \n\t\t\t\t\twriteMessage(message);\n\t\t\t\t})\n\t\t\t.catch(function(err){\n\t\t\t\tconsole.log(err);\n\t\t\t})\n\t\t\tbreak;\n\t\tcase \"do-what-it-says\":\n\t\t\tfs.readFile(\"random.txt\", \"utf8\", function(err, data){\n\t\t\t\tvar arr = data.trim().split(\"\\n\"); \n\t\t\t\tfor (var i=0; i<arr.length; i++){\n\t\t\t\t\tx = arr[i].split(\",\");\n\t\t\t\t\tprocessCommand(x[0].trim(), x[1].split(\" \").join(\"+\"))\n\t\t\t\t}\n\t\t\t})\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar message = \"Unknown command '\" + command + \"' submitted.\\n\";\n\t\t\twriteMessage(message);\n\t\t\tbreak;\n\t};\n}", "function processCommand(data) {\n var cmd;\n\n // This is the default response for a failed action\n var response = {\n success: false,\n err: false,\n data: false\n };\n\n try {\n // Parse the command into a JSON object\n cmd = JSON.parse(data.toString('utf-8'));\n } catch (e) {\n // This is where we catch any bad (non-json) input\n response.err = 'not_json'; // Send back an error message\n response.data = data.toString('utf-8'); // Send back the bad command so we can look at it\n console.log('Invalid JSON: '+response.data);\n return response; // Respond to the client\n }\n\n // Let's make sure it specifies some action\n if (!cmd.hasOwnProperty('action')) {\n response.err = 'no_action';\n response.data = cmd;\n console.log('Invalid action: '+JSON.stringify(cmd));\n return response;\n }\n\n /*\n * This is our primary switch case for event processing\n * We can pretty much get away with hooking up most\n * commands right in here.\n */\n switch (cmd.action) {\n // GENERAL COMMANDS\n case 'get_time':\n // Return the rov time for some reason\n response.success = true;\n response.data = {time: Date.now()};\n break;\n case 'get_mem_usage':\n // Get memory usage stats\n response.success = true;\n response.data = {free: os.freemem(), total: os.totalmem()};\n break;\n case 'get_cpu_usage':\n // Get the processor load average\n response.success = true;\n response.data = {cpuload: os.loadavg()};\n break;\n case 'ping':\n // Do nothing, successfully\n response.success = true;\n break;\n case 'echo':\n // echo recieved data, if there was any\n response.success = true;\n if (!cmd.hasOwnProperty('data')) {\n return response;\n }\n response.data = cmd.data;\n return response;\n break;\n\n // HMC6343 COMMANDS\n case 'hmc_init':\n // Initialize magnetometer\n try {\n hmc = new hmc6343('/dev/i2c-1', 0x19);\n }\n // Return error if there was one\n catch (ex) {\n response.err = ex.message\n break;\n }\n response.success = true;\n break;\n case 'hmc_get_accel':\n // Get accelerometer data from magnetometer\n try {\n hmc.readAccel(function(accelData) {\n response.data = accelData;\n response.success = true;\n });\n } catch (ex) {\n response.success = false;\n response.err = ex.message;\n }\n break;\n case 'hmc_get_mag':\n // Get magnetometer data from magnetometer\n try {\n response.success = true;\n hmc.readMag(function(magData) {\n response.data = magData;\n });\n } catch (ex) {\n response.err = ex.message;\n }\n break;\n\n // DS18B20 COMMANDS\n // yeah we'll get to that\n\n // PCA9685 COMMANDS\n case 'pca_init':\n // Initialize pca board\n if (rpi) {\n var options = {\n freq: 50,\n };\n pca = new pca9685(options);\n response.success = true;\n } else {\n response.err = 'PCA is only initializable on the RPI'\n }\n \n break;\n case 'pca_set_pulse':\n // Set Set channel chan to turn on on step cms.stepOn and off on step cmd.stepOff \n /* Usage:\n * {\"action\":\"pca_set_dutyCycle\",\n * \"chan\":\"[channel]\",\n * \"stepOn\":\"[on step]\",\n * \"stepOff\":\"[off step]\"}\n */\n if(!cmd.hasOwnProperty('chan') || !cmd.hasOwnProperty('pulse')) {\n response.err = 'usage: {action:pca_set_dutyCycle, chan:[channel], pulse:[pulse length in ms]}';\n break;\n }\n try {\n response.success = true;\n pca.setPulse(cmd.chan, cmd.pulse);\n } catch (ex) {\n response.err = ex.message;\n }\n break;\n case 'joystick_setData':\n if (cmd.joyData.type === 'button') {\n switch (cmd.joyData.value) {\n case 0:\n console.log('button ' + cmd.joyData.number + ' released');\n break;\n case 1:\n console.log('button ' + cmd.joyData.number + ' released');\n break;\n }\n }\n if (cmd.joyData.type === 'axis') {\n var scale = -(cmd.joyData.value/32767);\n switch (cmd.joyData.number) {\n case 0:\n joyX = scale;\n break;\n case 1:\n joyY = scale;\n break;\n case 3:\n upThrust = (scale * 540 + 1617);\n break;\n }\n }\n lThrust = ((-joyX/2) + (joyY/2)) * 500 + 1617;\n rThrust = ((joyX/2) + (joyY/2)) * 500 + 1617;\n pca.setPulse(1, lThrust);\n pca.setPulse(0, rThrust);\n pca.setPulse(2, upThrust);\n pca.setPulse(3, upThrust);\n break;\n default:\n response.err = 'not_implemented';\n response.data = cmd;\n console.log('Command not implemented: '+cmd.action);\n break;\n }\n\n console.log('Command was: '+JSON.stringify(cmd));\n return response;\n}", "processCommand() {\n if (this.command_stack.length > 0) {\n // check if writing is locked\n if (this.lock === false) {\n // not locked - issue a command and lock the write process\n let command = this.command_stack[0];\n command.processed_at = new Date();\n this.write(command.command);\n this.lock = true;\n } else {\n setTimeout(this.processCommand.bind(this), this.next_command_delay);\n }\n } else {\n // no commands in the stack - unlock command write access\n this.lock = false;\n }\n }", "getCMDs() {\n let cmds = [];\n for (let instruction of this.instructions) {\n if (instruction instanceof cmd_1.Cmd) {\n cmds.push(instruction);\n }\n }\n return cmds;\n }", "function mainLoop() {\n //writingHour();\n if (CommandsLoaded) {\n readChat();\n readPMs();\n }\n}", "addSampleCommands() {\n this.addCommand(new sampleCommands.MagicEightBallCommand());\n this.addCommand(new sampleCommands.RollCommand());\n }", "function startCommand(name, value) {\n lastCommand = name;\n value = jMarker.trim(value);\n switch (name) {\n case 'if':\n body.push('if(' + _expression(value) + '){');\n break;\n case 'else':\n body.push('}else{');\n break;\n case 'elseif':\n body.push('}else if(' + _expression(value) + '){');\n break;\n case 'switch':\n inSwitchCommand = true;\n body.push('switch(' + _expression(value) + '){');\n break;\n case 'case':\n body.push('case ' + _expression(value) + ':');\n break;\n case 'break':\n body.push('break;');\n break;\n case 'default':\n body.push('default:');\n break;\n case 'local':\n case 'assign':\n body.push(startCommandAssign(value));\n break;\n case 'list':\n body.push(startCommandList(value));\n break;\n case 'include':\n pushValue('jMarker.res(' + value + ')(__d)');\n break;\n case 'import':\n body.push(startCommandImport(value));\n break;\n case 'macro':\n body.push(startCommandMacro(value));\n break;\n case 'nested':\n pushValue(startCommandNested(value));\n break;\n case 'function':\n body.push(startCommandFunction(value));\n break;\n case 'return':\n if (value) {\n body.push('return ' + _expression(value) + ';');\n } else {\n body.push('return __o.join(\"\");');\n }\n break;\n default:\n break;\n }\n }", "async execute(){\n\t\tawait this.processRequest();\n\t\tawait this.formatRequest();\n\t\tawait this.processData();\n\t\tawait this.formatResponse();\n\t\tawait this.processResponse();\n\t}", "processCommand(data) {\n var command = data[0];\n\n if (command == Protocol.GET_STATE_COMMAND) {\n return this.processGetStateCommand(data);\n } else if (command == Protocol.SET_CLOCK_COMMAND) {\n return this.processSetClockCommand(data);\n } else if (command == Protocol.SET_MORNING_ALARM_COMMAND) {\n return this.processSetMorningAlarmCommand(data);\n } else if (command == Protocol.SET_NAP_ALARM_COMMAND) {\n return this.processSetNapAlarmCommand(data);\n }\n\n return this._generateResponseData(Protocol.UNKNOWN_COMMAND);\n }", "async exec (args, { Compose }) {\n // Code goes here\n }", "execute_program(){\n\t// execution loop\n\twhile(!this.step()){}\n}", "async function main() {\n for await (const p of walker('elvenware')) {\n const fileName = process.env.HOME + '/Git/CloudNotes/' + p\n debug(getTitleFromPath(fileName));\n const stats = await fsp.stat(fileName);\n debug(stats);\n // execProcess();\n const command = \"sh git-call.sh \" + fileName;\n //const result = await ep.callExec(command);\n const result = await ep.result(command);\n debug('cm result:', result);\n const elfCodes = await getElfCode(fileName);\n await addElfCode(fileName, elfCodes);\n // debug('health codes', elfCodes);\n /* if ((elfCodes.hasElfCode) + (elfCodes.hasTocCode) <= 1) {\n debug('needs work');\n await addElfCode(fileName, elfCodes);\n } */\n /* {\n if(!err){\n debug(response);\n }else {\n debug(err);\n }\n }); */\n return;\n }\n}", "async function runCommand(cmd) {\r\n switch (cmd.toLowerCase()) {\r\n \r\n case \"restart\": \r\n case \"reboot\": \r\n t_println(\"Rebooting. Please wait\");\r\n await t_write(\".....\", 0.5);\r\n t_terminal.innerHTML = terminalDefaultContent;\r\n boot();\r\n break;\r\n\r\n case \"shutdown\": \r\n t_println(\"Shutting down internal services\");\r\n await t_write(\"...\", 1);\r\n t_println(\"Goodbye!\");\r\n await sleep(1);\r\n t_terminal.innerHTML = \"\";\r\n break;\r\n\r\n case \"clear\": \r\n t_terminal.innerHTML = terminalDefaultContent;\r\n init();\r\n runCommand(await t_getln());\r\n break;\r\n\r\n case \"ls\": \r\n t_println(\"This is the return value of the ls command!\");\r\n runCommand(await t_getln());\r\n break;\r\n\r\n\r\n default: // Über JSON File falls kein 'Aktiver' Command (also wenn nur text zurück)\r\n t_println(\"Command not found: \" + cmd);\r\n runCommand(await t_getln()); //Ready for the next input\r\n break;\r\n }\r\n}", "run_pfa_command(cmd){\n switch(cmd){\n case 'build': return this.run_build_pfa()\n case 'open': return film.analyse.openPFA()\n }\n}", "function evaluateCmd(userInput) {\n //parses the user input to understand which command was typed\n const userInputArray = userInput.split(\" \");\n const command = userInputArray[0];\n switch (command) {\n case \"echo\":\n //we will add the functionality of echo next within the \t//object commandLibrary \n commandLibrary.echo(userInputArray.slice(1).join(\" \"));\n break;\n case \"cat\":\n commandLibrary.cat(userInputArray.slice(1));\n break;\n case \"head\":\n commandLibrary.head(userInputArray.slice(1));\n break;\n case \"tail\":\n commandLibrary.tail(userInputArray.slice(1));\n break;\n case \"r\":\n commandLibrary.r(userInputArray.slice(1));\n break;\n default:\n commandLibrary.errorHandler(command);\n break;\n }\n }", "loadCommands(){\n let Artyom = this._artyom;\n\n // Here you can load all the commands that you want to Artyom\n return Artyom.addCommands([\n {\n indexes: [\"hello\", \"hi\"],\n action: () => {\n Artyom.say(\"Hello, how are you?\");\n }\n },\n {\n indexes: [/How are you/, /Regular expressions supported/],\n smart: true,\n action: () => {\n Artyom.say(\"I'm fine, thanks for asking !\");\n }\n },\n {\n indexes: [\"Generate reports of * of this year\"],\n smart: true,\n action: (i, month) => {\n let year = new Date().getFullYear();\n\n Artyom.say(`Generating reports of ${month} ${year} `);\n\n Artyom.say(\"Ready ! What were you expecting? write some code you lazy bear !\");\n }\n },\n {\n indexes: [\"What is the weather like\"],\n action: () => {\n axios.get(\"http://api.openweathermap.org/data/2.5/forecast?id=1880252&APPID=6feeacb3997e0e4f4a7f9e9c4b193934\")\n .then(result=>{\n let data = Math.floor(result.data.list[0].main.temp) - 273\n Artyom.say(`Temperature is ${data} degrees celcius`);\n })\n\n }\n }\n ]);\n }", "async execute(message, args, extra) {\n \n }", "async function _commandHandler(msg, label, args, jerry) {\n if (label === \"help\" && args.length === 0) {\n return await generalHelp(msg, jerry);\n }\n if (label === \"help\" && args.length !== 0) {\n const command = findCommand(args[0], jerry);\n if (!command) {\n return;\n }\n return await commandHelp(msg, command);\n }\n const command = findCommand(label, jerry);\n if (!command) {\n return \"no command\";\n }\n if (command.commandType === \"dev\") {\n if (!checkDev(msg.member)) {\n return \"unauthorized: dev\";\n }\n }\n if (command.requiredUsers.length !== 0) {\n if (!checkRequiredUsers(msg.member, command)) {\n return \"unauthorized: not a required user\";\n }\n }\n if (!(msg.channel.type === 5 || msg.channel.type === 0)) {\n return;\n }\n const ctx = {\n msg: msg,\n channel: msg.channel,\n guild: msg.channel.guild,\n member: msg.member,\n user: msg.author,\n content: msg.content,\n args: args,\n dev: false\n };\n //@ts-ignore\n await command.execute(jerry, ctx, false).catch((err) => {\n jerry.logger.error(\"Jerry Error\", ` command error from message ${msg.content}`);\n });\n //signale.error(`[Hyperion] command error on guild ${msg.channel.guild.id} from message ${msg.content}`);\n //signale.error(err);\n}", "function main(operation, argument) {\n console.clear();\n console.log();\n console.log(\n \" ██ ██ ██ ██ ██████ ██ ©\"\n .rainbow\n );\n console.log(\n \" ██ ██ ██ ██ ██ ██ ██\"\n .rainbow\n );\n console.log(\n \" ██ ██ ██ ██ ██████ ██\"\n .rainbow\n );\n console.log(\n \" ██ ██ ██ ██ ██ ██ ██\"\n .rainbow\n );\n console.log(\n \" ███████ ██████ ██ ██ ██ ██\"\n .rainbow + \" Like siri but better.\".rainbow\n );\n console.log(\"\");\n console.log(\n \" Made in America\"\n .america,\n \" by Luis Suarez.\".zebra\n );\n console.log(\"\");\n console.log(\n \" For help or more commands type:\",\n \"luiri help\".red\n );\n\n // o8o .o88o.\n // `\"' 888 `\"\n // oooo o888oo .oooo.o\n // `888 888 d88( \"8\n // 888 888 `\"Y88b.\n // 888 888 o. )88b\n // o888o o888o 8\"\"888P'\n\n if (operation == \"tweets\") {\n player.play(\"./audio/mp3/twitter.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n\n myTweets();\n }\n\n if (operation == \"twitterTrack\") {\n player.play(\"./audio/mp3/twitterTrack.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n\n twitterTrack(argument);\n }\n\n if (operation == \"spotify\") {\n player.play(\"./audio/mp3/spotify.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n\n if (argument != undefined) {\n thisSong(argument);\n } else {\n thisSong(\"The Sign Ace\");\n }\n }\n\n if (operation == \"movie\") {\n player.play(\"./audio/mp3/movie.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n if (argument != undefined) {\n thisMovie(argument);\n } else {\n thisMovie(\"Mr. Nobody\");\n }\n }\n\n if (operation == \"saved\") {\n saved();\n }\n\n if (operation == \"log\") {\n player.play(\"./audio/mp3/log.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n\n displayLog();\n }\n\n if (operation == \"help\") {\n player.play(\"./audio/mp3/luiri.mp3\", err => {\n if (err) console.log(`Could not play sound: ${err}`);\n });\n\n help();\n }\n}", "execute (args, props)\n {\n super.execute();\n\n const commands = require('../modules/commands.js').commands;\n const keys = Object.keys(commands);\n\n // Loop through the keys.\n for (let i = 0; i < keys.length; i++) \n {\n // If we have no args, give the description of this command.\n if(!args.length > 0)\n {\n this.chat(`${this.description}`);\n break;\n }\n\n // Find a match of the arg and chat the description.\n if(args[0] === commands[keys[i]].name || commands[keys[i].includes(args[0])])\n {\n this.chat(commands[keys[i]].getDescription());\n return;\n }\n }\n\n this.chat('/me Could not find that command.');\n }", "function initializeCommands() {\n CommandManager.register(Strings.CMD_TOGGLE_PURE_CODE, CMD_TOGGLE_PURE_CODE, _togglePureCode);\n CommandManager.register(Strings.CMD_TOGGLE_PANELS, CMD_TOGGLE_PANELS, _togglePanels);\n\n Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).addMenuItem(CMD_TOGGLE_PANELS, \"\", Menus.AFTER, Commands.VIEW_HIDE_SIDEBAR);\n Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).addMenuItem(CMD_TOGGLE_PURE_CODE, \"\", Menus.AFTER, CMD_TOGGLE_PANELS);\n\n KeyBindingManager.addBinding(CMD_TOGGLE_PURE_CODE, [ {key: togglePureCodeKey}, {key: togglePureCodeKeyMac, platform: \"mac\"} ]);\n\n //default toggle panel shortcut was ctrl+shift+` as it is present in one vertical line in the keyboard. However, we later learnt\n //from IQE team than non-English keyboards does not have the ` char. So added one more shortcut ctrl+shift+1 which will be preferred\n KeyBindingManager.addBinding(CMD_TOGGLE_PANELS, [ {key: togglePanelsKey}, {key: togglePanelsKeyMac, platform: \"mac\"} ]);\n KeyBindingManager.addBinding(CMD_TOGGLE_PANELS, [ {key: togglePanelsKey_EN}, {key: togglePanelsKeyMac_EN, platform: \"mac\"} ]);\n }", "run() {\n\t\tthis.executeCreeps();\n\t\tthis.manageCreeps();\n\t}", "async execute(msg, client, CONFIG, npm, mmbr) {\n ////////////////////////////////////\n //We fetch the channel here\n //We can easely send with this const\n ////////////////////////////////////\n const snd = await client.channels.cache.get(msg.channel_id);\n\n ////////////////////////////////////\n //Defining the arguments here\n //Splits can happen later if needed\n ////////////////////////////////////\n const prefix = await CONFIG.PREFIX(msg.guild_id);\n const comName = module.exports.name;\n const arguments = await msg.content.slice(\n prefix.length + comName.length + 1\n );\n\n ////////////////////////////////////\n //Main command starts here\n //Comments might get smaller here\n ////////////////////////////////////\n const gld = await client.guilds.cache.get(msg.guild_id); //Get guild\n if (!gld) return;\n\n migrateDB = await require(\"better-sqlite3\")(\n \"/home/librorum/Documents/Art-re/scores.sqlite\"\n );\n\n //phase 1\n aa = await migrateDB.prepare(\"SELECT * FROM admincases;\").all();\n\n await aa.forEach((A) => {\n buildCase = {\n guildidcaseid: `${A.guildidcaseid}`,\n caseid: `${A.caseid}`,\n guildid: `${A.guildid}`,\n userid: `${A.userid}`,\n username: `${A.username}`,\n type: `${A.type}`,\n reason: `${A.reason}`,\n date: `${A.date}`,\n judge: `NONE`,\n };\n\n setACase.run(buildCase);\n });\n\n await snd.send(\"Phase 1 complete.\");\n\n //phase 2\n bb = await migrateDB.prepare(\"SELECT * FROM scores;\").all();\n\n await bb.forEach((B) => {\n processID = B.id.split(\"-\");\n final = `${processID[1]}-${processID[0]}`;\n score = {\n id: `${final}`,\n user: `${B.user}`,\n guild: `${B.guild}`,\n points: B.points,\n level: B.level,\n warning: 0,\n muted: 0,\n permit: 0,\n bonus: 0,\n };\n setScore.run(score);\n });\n\n await snd.send(\"Phase 2 complete.\");\n\n //phase 3\n cc = await migrateDB.prepare(\"SELECT * FROM supcase;\").all();\n\n await cc.forEach((C) => {\n numGet = {\n caseid: C.scase,\n userid: C.askby,\n username: C.askby,\n attachments: \"NONE\",\n casemessage: C.question,\n date: `${moment().format(\"MMMM Do YYYY, HH:mm:ss\")}`,\n solvedby: C.solveby,\n solution: C.answer,\n };\n\n setSCase.run(numGet);\n });\n\n await snd.send(\"Phase 3 complete.\");\n\n //phase 4\n dd = await migrateDB.prepare(\"SELECT * FROM guildhub;\").all();\n\n await dd.forEach((D) => {\n thisGuild = {\n guild: `${D.guild}`,\n generalChannel: `${D.generalChannel}`,\n highlightChannel: `${D.highlightChannel}`,\n muteChannel: `${D.muteChannel}`,\n logsChannel: `${D.logsChannel}`,\n streamChannel: `${D.streamChannel}`,\n reactionChannel: `${D.reactionChannel}`,\n verificationChannel: `${D.muteChannel}`,\n supportChannel: ``,\n supportInUseChannel: ``,\n };\n\n setGuild.run(thisGuild);\n });\n\n await snd.send(\"Phase 4 complete.\");\n\n //phase 5\n ee = await migrateDB.prepare(\"SELECT * FROM guildhub;\").all();\n\n await ee.forEach((E) => {\n if (E.streamHere == \"2\") {\n streamping = \"ON\";\n } else {\n streamping = \"OFF\";\n }\n\n if (E.autoMod == \"2\") {\n am = \"ON\";\n } else {\n am = \"OFF\";\n }\n\n if (E.leveling == \"2\") {\n le = \"OFF\";\n } else {\n le = \"ON\";\n }\n\n thisGuildS = {\n guildid: `${E.guild}`,\n artemisTalks: `ON`,\n streamHere: `${streamping}`,\n autoMod: `${am}`,\n prefix: `${E.prefix}`,\n leveling: `${le}`,\n wmessage: `${E.wmessage}`,\n wimage: `NONE`,\n defaultrole: `${E.defaultrole}`,\n bonuspoints: 50,\n };\n\n setSettings.run(thisGuildS);\n });\n\n await snd.send(\"Phase 5 complete.\");\n\n //phase 6\n ff = await migrateDB.prepare(\"SELECT * FROM streamers;\").all();\n\n await ff.forEach((F) => {\n streamerAdd = {\n streamerguild: `${F.streamerguild}`,\n streamer: `${F.streamer}`,\n guild: `${F.guild}`,\n status: `offline`,\n };\n\n setStream.run(streamerAdd);\n });\n\n await snd.send(\"Phase 6 complete.\");\n }", "function processCommand(receivedMessage) {\n\tlet fullCommand = receivedMessage.content.substr(1) // Remove the leading exclamation mark\n\tlet splitCommand = fullCommand.split(\" \") // Split the message up in to pieces for each space\n\tlet primaryCommand = splitCommand[0].toLowerCase() // The first word directly after the exclamation is the command\n\tlet arguments = splitCommand.slice(1) // All other words are arguments/parameters/options for the command\n\tlet re = new RegExp(\"^[a-zA-Z0-9]*$\")\n\n\tif (fullCommand == null || fullCommand.startsWith(\"%\", 0) || !re.test(primaryCommand)) {\n\t\treturn;\n\t}\n\telse {\n\t\tconsole.log(\"Command Received from User: \" + receivedMessage.author.id + \" \\n --Command: \" + primaryCommand + \" with Arguments: \" + arguments)\n\t\tswitch (primaryCommand) {\n\t\t\tcase \"test\":\n\t\t\t\ttestCommand(arguments, receivedMessage);\n\t\t\t\tbreak;\n\t\t\tcase \"create\":\n\t\t\t\tcreateMatch(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"players\":\n\t\t\t\tprintUserRoles(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"team\":\n\t\t\t\tteamCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"start\":\n\t\t\t\tstartMatchCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"mvp\":\n\t\t\t\tmvpCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"ace\":\n\t\t\t\taceCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"roles\":\n\t\t\t\trolesCommand(arguments, receivedMessage);\n\t\t\t\tbreak;\n\t\t\tcase \"stats\":\n\t\t\t\tstatsCommand(arguments, receivedMessage);\n\t\t\t\tbreak;\n\t\t\tcase \"leaderboard\":\n\t\t\t\tleaderboardCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"help\":\n\t\t\t\thelpCommand(arguments, receivedMessage);\n\t\t\t\tif(receivedMessage.channel.type != \"dm\"){\n\t\t\t\t\treceivedMessage.delete();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treceivedMessage.author.send(\"type %help to get the list of commands\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n}", "async advance() {\n const line = await this._getNextLine()\n const statement = this._trimSpace(line)\n const elements = statement.split(/\\s+/)\n\n switch (elements[0]) {\n case '':\n // if no command, advance to next line\n return await this.advance()\n case 'add':\n case 'sub':\n case 'eq':\n case 'lt':\n case 'gt':\n case 'neg':\n case 'and':\n case 'or':\n case 'not':\n this._currentCommandType = COMMAND_TYPE.C_ARITHMETIC\n break\n case 'push':\n this._currentCommandType = COMMAND_TYPE.C_PUSH\n break\n case 'pop':\n this._currentCommandType = COMMAND_TYPE.C_POP\n break\n case 'label':\n this._currentCommandType = COMMAND_TYPE.C_LABEL\n break\n case 'goto':\n this._currentCommandType = COMMAND_TYPE.C_GOTO\n break\n case 'if-goto':\n this._currentCommandType = COMMAND_TYPE.C_IF\n break\n case 'function':\n this._currentCommandType = COMMAND_TYPE.C_FUNCTION\n break\n case 'call':\n this._currentCommandType = COMMAND_TYPE.C_CALL\n break\n case 'return':\n this._currentCommandType = COMMAND_TYPE.C_RETURN\n break\n default:\n }\n\n this.elements = elements\n }", "function ProcessController() {}", "runCmdProgram(cmdProgram) {\n this.reset();\n this.eventScheduler.add(undefined, this.tStateCount + this.clockHz * 0.1, () => {\n this.cls();\n for (const chunk of cmdProgram.chunks) {\n if (chunk instanceof trs80_base_1.CmdLoadBlockChunk) {\n this.writeMemoryBlock(chunk.address, chunk.loadData);\n }\n else if (chunk instanceof trs80_base_1.CmdTransferAddressChunk) {\n this.startExecutable(chunk.address);\n // Don't load any more after this. I assume on a real machine the jump\n // happens immediately and CMD parsing ends.\n break;\n }\n }\n });\n }", "function handleCommand(command, fromUserId, groupInfo, messageLiteral, api = gapi) {\n const attachments = messageLiteral.attachments; // For commands that take attachments\n // Command preprocessing to compare command grammars against input and check for matches\n const co = commands.commands; // Short var names since I'll be typing them a lot\n for (let c in co) {\n if (co.hasOwnProperty(c)) {\n // Check whether command is sudo-protected and, if so, whether the user is the owner\n if (!co[c].sudo || (co[c].sudo && fromUserId == config.owner.id)) {\n // Set match vals\n // fromStart will concatenate a 'start of string' operator to the beginning\n // of the regular expression used to match commands if contextless grammar\n // is turned off in the config (off by default)\n let regex = Array.isArray(co[c].regex) ? co[c].regex[0] : co[c].regex;\n if (typeof regex == \"string\") { regex = new RegExp(regex); }\n const fromStart = config.contextless ? regex : new RegExp(\"^\" + regex.source, regex.flags);\n if (co[c].user_input.accepts) { // Takes a match from the members dict\n if (Array.isArray(co[c].regex)) { // Also has a regex suffix (passed as length 2 array)\n co[c].m = utils.matchesWithUser(fromStart, command, fromUserId, groupInfo, co[c].user_input.optional, \" \", co[c].regex[1]);\n } else { // Just a standard regex prefex as a string + name\n co[c].m = utils.matchesWithUser(fromStart, command, fromUserId, groupInfo, co[c].user_input.optional);\n }\n } else {\n co[c].m = command.match(fromStart);\n }\n } else { // User not authorized\n // Set match to null to prevent checking issues\n co[c].m = null;\n }\n // Update usage statistics if command is matched\n if (co[c].m) {\n utils.updateStats(c, fromUserId);\n }\n }\n }\n debugCommandOutput(false);\n // Check commands for matches & eval\n runner.run(api, co, groupInfo, fromUserId, attachments, messageLiteral);\n}", "hasMoreCommands() {\n return true;\n }", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "function DeviceProcessor() {\n\tvar builder = new processor.Chain();\n\tbuilder.Add(save_flags);\n\tbuilder.Add(strip_syslog_priority);\n\tbuilder.Add(chain1);\n\tbuilder.Add(populate_fields);\n\tbuilder.Add(restore_flags);\n\tvar chain = builder.Build();\n\treturn {\n\t\tprocess: chain.Run,\n\t}\n}", "run_build_command(what, extra, option1){\n // console.log(\"-> run_build_command(what=%s, extra=%s, option1=%s)\", what, extra, option1)\n switch(what){\n case 'all': return this.run_build_all()\n case 'books': case 'livres': return this.run_build_books()\n case 'book': case 'livre':\n if ( option1 == '-update'){\n return this.run_build_all(extra, option1)\n } else {\n return this.run_build_books(extra, option1)\n }\n case 'document':case'documents': return this.run_build_documents(extra,option1)\n case 'pfa': return film.analyse.buildPFA(null, extra)\n case 'cover': case 'couverture': return this.run_build_cover()\n case 'sequencier': return this.run_build_sequencier()\n case 'statistiques': case 'stats': return this.run_build_statistiques(extra)\n case 'synopsis': return this.run_build_synopsis()\n case 'traitement':case'treatment': return this.run_build_traitement()\n case 'quatrieme': return this.run_build_quatrieme()\n case 'frontispice': return this.run_build_frontispice()\n default: erreur(`Je ne sais pas comment construire un ou une ${what}`)\n }\n}", "function toCommand(commandName,action,res){\n if(!action) console.error(commandName,' does not have an \"action\" to perform, please assign it one');\n /* exit process on command action of 'exit' */\n if(!action || action.toLowerCase() === 'exit'){\n console.error('Exiting process due to command; ',commandName);\n process.exit(1);\n }\n\n /* go to final task command with values upon seeing an 'end' action */\n else if(action.toLowerCase() === 'end'){\n _command(_values);\n }\n\n /* go the the next command specified in 'action' */\n else{\n _currentTaskCommand = action;\n if(_taskCommands[_currentTaskCommand] === undefined){\n console.error('No command exists by the name of ',_currentTaskCommand);\n process.exit(1);\n }\n\n if(_values[_currentTaskCommand] === undefined || typeof _values[_currentTaskCommand] === 'object' || _taskCommands[_currentTaskCommand].repeatable){\n runCommand(_currentTaskCommand,_taskCommands[_currentTaskCommand]);\n }\n else{\n res = _values[_currentTaskCommand];\n toCommand(_currentTaskCommand,(typeof _taskCommands[_currentTaskCommand].action === 'function' ? _taskCommands[_currentTaskCommand].action(res,_values) : _taskCommands[_currentTaskCommand].action),res);\n }\n }\n }", "function adminCommands(msg){\n\tif(!('text' in msg)) return;\n\t// if(gameChatID == 0 && msg.text == '/newGame') {\n\t// \t//game hasn't been initialized\n\t// \tlet sender = await bot.getChatMember(msg.chat.id, msg.from.id);\n\t// \tif(sender.status == 'creator' || sender.status == 'administrator') {\n\n\t// \t}\n\t// }\n\tif(msg.from.username != ADMIN_USERNAME) return;\n\tif(!msg.text.startsWith(\"@wordCentBot\") && msg.chat.id != msg.from.id) return;\n\tlet command = msg.text;\n\tif(msg.text.startsWith(\"@wordCentBot\")){\n\t\tcommand = msg.text.substring(\"@wordCentBot \".length);\n\t}\n\tswitch(command){\n\t\tcase '/newGame':\n\t\t\tsetupNewGame(msg);\n\t\t\treturn;\n\t\tcase '/show': // log data for debugging. (don't call this in the chat or you will reveal answers)\n\t\t\tlet message = \"\\nplayers:\\n\" +JSON.stringify(players)+\"\\nwords:\\n\"+JSON.stringify(words)+\"\\nopen words:\\n\"+JSON.stringify(openWords);\n\t\t\tbot.sendMessage(msg.chat.id,message);\n\t\t\treturn;\n\t\tcase '/giveNewClue':\n\t\t\tgiveNewClue();\n\t\t\treturn;\n\t\tcase '/giveWarning':\n\t\t\tgiveWarning();\n\t\t\treturn;\n\t\tcase '/giveLeaderboard':\n\t\t\tgiveLeaderboard();\n\t\t\treturn;\n\t\tcase '/automaticHints':\n\t\t\tstartAutomaticHints();\n\t\t\treturn;\n\t\tcase '/saveData':\n\t\t\tsaveData();\n\t\t\treturn;\n\t\tcase '/restartGame':\n\t\t\trestartGame();\n\t\t\treturn;\n\t\tdefault:\n\t\t\treturn;\n\t}\n}", "function commandMe(command, commandArg){\n switch(command){\n case 'my-tweets':\n twit.twitterLogic();\n break;\n case 'spotify-this-song':\n spot.spotifyLogic(commandArg);\n break;\n case 'movie-this':\n omdb.omdbLogic(commandArg);\n break;\n case 'do-what-it-says':\n case 'obey':\n obey.readFromRandom();\n break;\n default:\n console.log('Follow the directions.');\n }\n}", "process(cmdr, rec) {\n try {\n if (rec.event === 'Scan') return this.proc_Scan(cmdr, rec);\n if (rec.event === 'SellExplorationData') return this.proc_SellExplorationData(cmdr, rec);\n if (rec.event === 'FSDJump') return this.proc_FSDJump(cmdr, rec);\n if (rec.event === 'Location') return this.proc_Location(cmdr, rec);\n if (rec.event === 'ApproachBody') return this.proc_ApproachBody(cmdr, rec);\n if (rec.event === 'LeaveBody') return this.proc_LeaveBody(cmdr, rec);\n if (rec.event === 'DiscoveryScan') return this.proc_DiscoveryScan(cmdr, rec);\n if (rec.event === 'NavBeaconScan') return this.proc_NavBeaconScan(cmdr, rec);\n if (rec.event === 'Docked') return this.proc_Docked(cmdr, rec);\n if (rec.event === 'Undocked') return this.proc_Undocked(cmdr, rec);\n if (rec.event === 'SupercruiseExit') return this.proc_SupercruiseExit(cmdr, rec);\n } catch (e) {\n clog('UNI.process()', rec.event, e);\n }\n return null;\n }", "async function main() {\n // Encode a bunch of token mints and burns.\n const mintSignature = 'mint(address,uint256)'\n const burnSignature = 'burn(address,uint256)'\n const calldatum = await Promise.all([\n ...mints.map(([receiverAddress, amount]) =>\n encodeActCall(mintSignature, [receiverAddress, amount]),\n ),\n ...burns.map(([holderAddress, amount]) =>\n encodeActCall(burnSignature, [holderAddress, amount]),\n ),\n ])\n\n const actions = calldatum.map(calldata => ({\n to: tokenManagerAddress,\n calldata,\n }))\n\n // Encode all actions into a single EVM script.\n const script = encodeCallScript(actions)\n console.log(\n `npx dao exec ${daoAddress} ${votingAddress} newVote ${script} MintsAndBurns --environment aragon:${environment} `,\n )\n\n process.exit()\n}", "async handleCommandKeyDown (e) {\n if (e.key === 'Enter') {\n // _this.submitMsg()\n // console.log(\"Enter key\");\n\n // Send a chat message to the chat pubsub room.\n // const now = new Date();\n // const msg = `Message from BROWSER at ${now.toLocaleString()}`\n const msg = _this.state.commandInput\n // console.log(`Sending this message: ${msg}`);\n\n // _this.handleCommandLog(`me: ${msg}`);\n\n console.log('_this: ', _this)\n console.log('_this.commandRouter: ', _this.commandRouter)\n const outMsg = await _this.commandRouter.route(msg, _this.ipfsControl)\n\n if (outMsg === 'clear') {\n _this.props.handleLog('')\n } else {\n _this.handleCommandLog(`\\n${outMsg}`)\n }\n\n // Clear the input text box.\n _this.setState({\n commandInput: ''\n })\n }\n }" ]
[ "0.656522", "0.645407", "0.6356635", "0.6344436", "0.63089496", "0.62207615", "0.61820775", "0.60718256", "0.6071718", "0.6071718", "0.6065387", "0.6064824", "0.59894633", "0.59594554", "0.5957238", "0.59568363", "0.59453076", "0.5944164", "0.5905963", "0.58969057", "0.58780813", "0.5873667", "0.5861443", "0.5829032", "0.5821543", "0.5813232", "0.5803152", "0.5794914", "0.57940054", "0.5789071", "0.5784351", "0.5754072", "0.5750365", "0.5745518", "0.572943", "0.5722457", "0.5713849", "0.5708461", "0.5679264", "0.56697094", "0.56659675", "0.56659675", "0.5665098", "0.56615716", "0.5622263", "0.5621437", "0.5621437", "0.5601896", "0.55924505", "0.55797315", "0.55747104", "0.55705035", "0.5558572", "0.5557482", "0.5557169", "0.5554352", "0.55404794", "0.552846", "0.5514866", "0.55065733", "0.55000216", "0.5497688", "0.54924405", "0.549175", "0.54913414", "0.5488455", "0.5486287", "0.5479873", "0.546885", "0.5440721", "0.54348314", "0.5433985", "0.54238933", "0.5423433", "0.5415577", "0.54035723", "0.5401773", "0.5383607", "0.537951", "0.5375116", "0.537036", "0.53658354", "0.5360067", "0.5357551", "0.53479266", "0.53468436", "0.5342229", "0.53417397", "0.53382987", "0.5338213", "0.53371847", "0.53371847", "0.53371847", "0.53369343", "0.5332248", "0.53240466", "0.53235537", "0.5322936", "0.5320247", "0.5314695" ]
0.57894444
29
The help command should list all the commands available without an argument, and accept a command as an argument to display said commands usage.
function helpCommand(arguments, receivedMessage) { if (arguments.length > 0) { receivedMessage.channelsend("It looks like you might need help with " + arguments) } else { receivedMessage.channel.send("I'm not sure what you need help with. Try `!help [topic]`") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addImplicitHelpCommand() {\n this.command('help [cmd]', 'display help for [cmd]');\n }", "function help() {\n\tvar commandsArray = ['Help: List of available commands', '>help', '>about', '>contact', '>ping', '>time', '>clear', '>say'];\n\tfor (var i = 0; i < commandsArray.length; i++) {\n\t\tvar out = '<span>' + commandsArray[i] + '</span><br/>'\n\t\tOutput(out);\n\t}\n}", "function showHelp() {\n\t//Use figlet npm package to convert text to art/drawing.\n\tfiglet('LIRI help', function (err, data) {\n\t\tif (err) {\n\t\t\tconsole.log('Something went wrong...');\n\t\t\tconsole.dir(err);\n\t\t\treturn;\n\t\t}\n\t\tconsole.log(data)\n\t});\n\tvar helpInfo = \"Usage: node liri.js <command> [arguments]\"\n\tvar helpColumns = columnify([{\n\t\tCommand: 'my-tweets',\n\t\tDescription: \"Shows the last 20 tweets from Twitter timeline and when they were created.\"\n\t}, {\n\n\t\tCommand: \"movie-this [movie_name]\",\n\t\tDescription: \"Shows information about the specifid movie. If no movie is specified, Mr. Nobody is displayed by default.\"\n\t}, {\n\n\t\tCommand: \"spotify-this-song [song_name]\",\n\t\tDescription: \"Shows top 10 songs on Spotify that have specified name. If no song is specified, The Sign by Ace of Base is displayed by default.\"\n\t}, {\n\n\t\tCommand: 'do-what-it-says',\n\t\tDescription: \"Shows the top 10 songs on Spotify for the song, 'I want it that way.'\"\n\t}])\n\tconsole.log(\"==================================================================================================\");\n\tconsole.log(helpInfo);\n\tconsole.log(\"==================================================================================================\");\n\tconsole.log(helpColumns);\n}", "function help(command) {\n // Show info about CLI.\n if (!command) {\n config.console.log(config.description)\n config.console.log()\n }\n\n // Display CLI version.\n if (!command) {\n config.console.log('VERSION'.bold)\n config.console.log(` ${config.pkgname}@${config.version} ${process?.platform}-${process?.arch} ${process?.release?.name}-${process?.version}`)\n config.console.log()\n }\n\n // Show command usage.\n usage(command)\n}", "function help() {\n\tvar commandsArray = ['Help: List of available commands',\n\t\t'<span class=\"green\">>about</span>',\n\t\t'<span class=\"yellow\">>contact</span>',\n\t\t'<span class=\"purple\">>projects</span>',\n\t\t'<span class=\"orange\">>skills</span>',\n\t\t'<span class=\"blue\">>experiences</span>',\n\t\t'>help',\n\t\t'>ping',\n\t\t'>time',\n\t\t'>clear',\n\t\t'>say',\n\t\t'>info',\n\t\t'>exit'];\n\tseperator();\n\tfor (var i = 0; i < commandsArray.length; i++) {\n\t\tvar out = '<span>' + commandsArray[i] + '</span><br/>'\n\t\tOutput(out);\n\t}\n}", "function help(args, cb) {\n const self = this;\n if (args.command) {\n args.command = args.command.join(' ');\n var name = _.find(this.parent.commands, {_name: String(args.command).toLowerCase().trim()});\n if (name && !name._hidden) {\n if (_.isFunction(name._help)) {\n name._help(args.command, function (str) {\n self.log(str);\n cb();\n });\n return;\n }\n this.log(name.helpInformation());\n } else {\n this.log(this.parent._commandHelp(args.command));\n }\n } else {\n this.log(this.parent._commandHelp(args.command));\n }\n cb();\n}", "help() {\n return util.call('help')\n }", "commandHelp() {\n if (!this.commands.length) return '';\n const commands = this.prepareCommands();\n const width = this.padWidth();\n return ['Commands:', commands.map(cmd => {\n const desc = cmd[1] ? ` ${cmd[1]}` : '';\n return (desc ? pad(cmd[0], width) : cmd[0]) + desc;\n }).join('\\n').replace(/^/gm, ' '), ''].join('\\n');\n }", "function help(target, context) {\r\n const commands = Object.keys(knownCommands);\r\n\r\n let commandList = \"\";\r\n commands.forEach(command => {\r\n commandList += ` !${command}`;\r\n });\r\n\r\n const message = `We support the following commands: ${commandList}`;\r\n sendMessage(target, context, message);\r\n}", "function do_help(cmd) {\n let helptext = [\n \"sofa-tool make-workset <container_url> <workset_name>\",\n \"sofa-tool add-fragment <workset_url> <fragment_url> <fragment_name>\",\n // \"\",\n // \"\",\n ];\n helptext.forEach(\n (txt) => { console.log(txt); }\n );\n return Promise.resolve(null)\n .then(() => meld.process_exit(meld.EXIT_STS.SUCCESS, \"Help OK\"))\n ;\n}", "function genericHelp(commands) {\n var message = '';\n for (let command in commands) {\n console.log('processing ' + command);\n if (!commands[command].hasOwnProperty('description')) continue;\n message += command + ': ' + commands[command].description + '\\n';\n }\n message += '\\nFor more information about specific commands, use `help <command>`';\n return message;\n}", "function help () {\n program.parse(process.argv)\n if (program.args.length < 1) return program.help()\n}", "function help() {\n printLine('The following commands work. Hover them for more information.');\n printLine('' +\n ' <span class=\"yellow\" title=\"Explain the list of commands\">help</span>,' +\n ' <span class=\"yellow\" title=\"Clear the screen for freshness\">clear</span>,' +\n ' <span class=\"yellow\" title=\"List all the files in this directory\">ls</span>,' +\n ' <span class=\"yellow\" title=\"List all links on the website\">tree</span>,' +\n ' <span class=\"yellow\" title=\"Change directory to `dirname`\">cd </span>' +\n '<span class=\"blue\" title=\"Change directory to `dirname`\"><em>dirname</em></span>,' +\n ' <span class=\"yellow\" title=\"Show the contents of `filename`\">cat </span>' +\n '<span class=\"green\" title=\"Show the contents of `filename`\"><em>filename</em></span>'\n );\n printLine('<br>');\n printLine('You can also use the' +\n ' <kbd class=\"cyan\">Up</kbd> and' +\n ' <kbd class=\"cyan\">Down</kbd>' +\n ' keys to navigate through your command history.'\n );\n printLine('You can click on tree nodes if CLI is not your thing.' +\n ' You\\'ll still need to hit <kbd class=\"cyan\">Enter</kbd>.'\n );\n}", "addBasicCommands() {\n this.addCommand(new commands.HelpCommand());\n }", "function help() {\n console.log(`Today I Learned\n\n Run locally with:\n\n node ./til.js\n\n Usage:\n\n til add \"something cool i learned today\"\n adds an entry to your TIL DB\n til list\n shows all entries, day by day\n til help\n shows this message\n `)\n process.exit(0);\n}", "constructor() {\n super('help', ['h']);\n this.setDescription('Do you really need to know how to ask for help?');\n }", "function execHelp(args, msg) {\n if (args.length == 0) msg.channel.send(\"Please provide some more information, try using `!help [topic]`\");\n else msg.channel.send(\"Dont worry i'm here to help you with \" + args + \"!\");\n }", "function help() {\n console.log(\n \"\\n\" +\n \"STRUCTURE\" +\n \"\\033[38;5;6m\" + \"\\n node liri.js (command) + (search(artist, concert, movie))\\n\" + \"\\033[0m\" +\n \"\\nCOMMAND OPTIONS\" +\n \"\\033[38;5;10m\" +\n \"\\n spotify-this-song\" + \"\\033[0m\" + \" search for artist details\" +\n \"\\033[38;5;10m\" +\n \"\\n concert-this\" + \"\\033[0m\" + \" search for concert details\" +\n \"\\033[38;5;10m\" +\n \"\\n movie-this\" + \"\\033[0m\" + \" search for movie details\" +\n \"\\033[38;5;10m\" +\n \"\\n do-what-it-says\" + \"\\033[0m\" + \" run a search based on what is written in 'random.txt'\"\n )\n}", "function help() {\n console.log(\"joy \\n\\\n \\n \\\n Usage:\\n \\\n joy new <name>...\\n \\\n joy build \\n \\\n joy serve \\n \\\n joy tidy \\n \\\n joy help \\n \\\n \\n \\\n joy -h | --help \\n \\\n joy --version \\n \\\n \\n \\\n Options: \\n \\\n -h --help Show this screen. \\n \\\n --version Show version.\\n \\\n \");\n}", "_helpAndError() {\n this.outputHelp();\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(1, 'commander.help', '(outputHelp)');\n }", "_helpAndError() {\n this.outputHelp();\n // message: do not have all displayed text available so only passing placeholder.\n this._exit(1, 'commander.help', '(outputHelp)');\n }", "function $help() {\n process.stdout.write(`\nCommands:\n\ndev Run a local development server with HMR\nbuild Generate client and server-side compatible bundles\nlist List the pages in your SSR app\n\nOptions:\n\n--root Project root directory (default: \\`cwd\\`)\n--src Directory to read source files (default: src)\n--public-dir Directory to serve as plain static assets (default: public)\n`);\n}", "function listCommands() {\n console.log(\n 'List of commands available:\\n' +\n '[-help] - Lists all the available commands.\\n' +\n '[Github URL] - Lists the commits for the provided GitHub URL.\\n' +\n '[Github URL] [nocache] - Lists the commits for the provided GitHub URL, ignoring cached values.\\n' +\n '[exit] - Ends Application\\n'\n )\n}", "function helpRun(command) {\n return preCommand + \" \" + command;\n}", "function usage(){\n\tmsg.setBodyAsHTML('Bash Help:');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display a Quote: /bash [integer]');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display a Random Quote: /bash random');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Display Help: /bash help');\n\tview.echoSentMessageToDisplay(msg);\n\tmsg.setBodyAsHTML(' Ex: /bash 5273');\n\tview.echoSentMessageToDisplay(msg);\n}", "function help() {\n\tvar fpath = path.join( __dirname, 'usage.txt' );\n\tfs.createReadStream( fpath )\n\t\t.pipe( process.stdout )\n\t\t.on( 'close', onClose );\n\n\tfunction onClose() {\n\t\tprocess.exit( 0 );\n\t}\n}", "function help() {\n\tvar fpath = path.join( __dirname, 'usage.txt' );\n\tfs.createReadStream( fpath )\n\t\t.pipe( process.stdout )\n\t\t.on( 'close', onClose );\n\n\tfunction onClose() {\n\t\tprocess.exit( 0 );\n\t}\n}", "function displayHelp() {\n var pkg = require(__dirname + \"/../package.json\");\n grunt.log.writeln();\n grunt.log.writeln(pkg.description);\n grunt.log.writeln((\" \" + pkg.name + \" \").green.inverse\n + \" Version - \" + pkg.version);\n\n // Borrowed heavily from the Grunt help source.\n var col1len = 0;\n\n var opts = Object.keys(grunt.cli.optlist).map(function(long) {\n var o = grunt.cli.optlist[long];\n var col1 = '--' + (o.negate ? 'no-' : '') + long + (o.short ? ', -' + o.short : '');\n col1len = Math.max(col1len, col1.length);\n return [col1, o.info];\n });\n\n var widths = [1, col1len, 2, 76 - col1len];\n\n var gruntTasks = Object.keys(grunt.task._tasks).sort()\n // var tasksList = Object.keys(grunt.task._tasks).slice(8);\n\n if (gruntTasks.length) {\n displayTasks(\"Towelie\", gruntTasks);\n }\n \n // if (gruntTasks.length) {\n // displayTasks(\"Grunt\", gruntTasks);\n // }\n\n function displayTasks(name, tasksList) {\n var tasks = tasksList.map(function(name) {\n col1len = Math.max(col1len, name.length);\n var info = grunt.task._tasks[name].info;\n\n return [name, info.blue];\n });\n\n grunt.log.header((name + \" tasks:\").yellow);\n grunt.log.writeln();\n\n tasks.forEach(function(a) {\n grunt.log.writetableln(widths,\n ['', grunt.utils._.pad(a[0], col1len), '', a[1]]\n );\n });\n }\n\n grunt.log.writeln();\n}", "function commandHelp(msg) {\n return msg.channel.sendMessage(HELP_MESSAGE);\n}", "function displayHelp() {\n /* eslint-disable no-console */\n console.log(\n /* eslint-disable indent */\n`Usage: node generate_full_demo.js [options]\nOptions:\n -h, --help Display this help\n -m, --minify Minify the built demo\n -p, --production-mode Build all files in production mode (less runtime checks, mostly).\n -w, --watch Re-build each time either the demo or library files change`,\n /* eslint-enable indent */\n );\n /* eslint-enable no-console */\n}", "function ListHelp() {\n}", "function help_menu() {\n console.log('Please use one of the following commands:')\n console.log('Summary: ./pandlss.sh -s <date> <time>')\n console.log('Breakdown: ./pandlss.sh -b <date> <time> <increment>')\n console.log('Breakdown one stock: ./pandlss.sh -b-os <stock> <date> <time> <increment>')\n}", "static getHelp({ client, command, prefix, t }) {\n command = typeof command === 'string' ? client.commands.fetch(command) : command;\n if (command.name === 'help') throw new CommandError('commands:help.commandHelp');\n\n const embed = new SimplicityEmbed({ author: client.user, t })\n .setDescription(`commands:${command.name}.description`)\n .setTitle(fixText(command.name), {}, false);\n\n // Add arguments\n const usage = CommandUtils.getUsage({ command, prefix, t });\n if (usage) embed.addField('common:usage', usage, true);\n\n // Add aliases\n if (!isEmpty(command.aliases)) {\n embed.addField('common:aliases', command.aliases.map((a) => `\\`${a}\\``).join(' '), true);\n }\n\n // Add examples\n const examples = getTranslation(`commands:${command.name}.examples`, t, { returnObjects: true });\n if (examples.lenght) {\n const examplesFixed = examples.map((e) => `${prefix}${command.name} ${e}`).join('\\n');\n embed.addField('common:examples', examplesFixed, true);\n }\n\n // Add subcommands\n const subcommands = command.subcommands && command.subcommands.map((sub) => {\n const commandName = `\\`${prefix + command.name} ${sub.name}\\` `;\n return `${commandName} ${t(`commands:${command.name}-${sub.name}.description`)}`;\n });\n\n if (!isEmpty(subcommands)) {\n embed.addField('common:subcommands', subcommands.join('\\n'));\n }\n return embed;\n }", "function help() {\n\n}", "function printHelpFor(command, aliases) {\n if (command.description) {\n console.log('');\n console.log(command.description);\n }\n console.log('');\n console.log(`${cliui_1.logger.colors.yellow('Usage:')} ${command.commandName} ${cliui_1.logger.colors.dim(command.args.map(wrapArg).join(' '))}`);\n const flags = getFlagsForDisplay(command.flags);\n const args = getArgsForDisplay(command.args);\n /**\n * Getting max width to keep flags and args symmetric\n */\n const maxWidth = Math.max.apply(Math, flags.concat(args).map(({ width }) => width));\n /**\n * Size of the terminal columns. Max width is the width of the command\n * name and the extra four is whitespace around the command name.\n *\n * This gives the columns size for the description section\n */\n const descriptionColumnsSize = term_size_1.default().columns - (maxWidth + 5);\n const commandAliases = getCommandAliases(command.commandName, aliases);\n if (commandAliases.length) {\n console.log('');\n console.log(`${cliui_1.logger.colors.yellow('Aliases:')} ${cliui_1.logger.colors.green(commandAliases.join(', '))}`);\n }\n if (args.length) {\n console.log('');\n console.log(cliui_1.logger.colors.bold(cliui_1.logger.colors.yellow('Arguments')));\n args.forEach(({ displayName, description = '', width }) => {\n const whiteSpace = ''.padEnd(maxWidth - width, ' ');\n const descriptionRow = descriptionToRows(description, {\n nameColumnSize: maxWidth + 5,\n descriptionColumnsSize,\n });\n console.log(` ${cliui_1.logger.colors.green(displayName)} ${whiteSpace} ${cliui_1.logger.colors.dim(descriptionRow)}`);\n });\n }\n if (flags.length) {\n console.log('');\n console.log(cliui_1.logger.colors.bold(cliui_1.logger.colors.yellow('Flags')));\n flags.forEach(({ displayName, displayType, description = '', width }) => {\n const whiteSpace = ''.padEnd(maxWidth - width, ' ');\n const descriptionRow = descriptionToRows(description, {\n nameColumnSize: maxWidth + 5,\n descriptionColumnsSize,\n });\n console.log(` ${cliui_1.logger.colors.green(displayName)} ${cliui_1.logger.colors.dim(displayType)}${whiteSpace} ${cliui_1.logger.colors.dim(descriptionRow)}`);\n });\n }\n}", "function help() {\n console.log(`\n TO ADD A NOTE:\n node index.js --add <ADD YOUR NOTE HERE> --category <ADD YOUR CATEGORY HERE>\n OR\n node index.js --a <ADD YOUR NOTE HERE> --c <ADD YOUR CATEGORY HERE>\n \n TO DELETE A NOTE:\n node index.js --delete <NOTE ID> \n OR\n node index.js --d <NOTE ID> \n TO LIST NOTES:\n node index.js --list \n node index.js --list <certain category> \n OR\n node index.js --l\n node index.js --l <certain category> \n `);\n process.exit();\n}", "function helpCommand(arg, messageReceived) {\n let helpContent = '```List of commands:\\n\\n';\n const commands = new Help.Helps();\n\n for (var prop in commands.listOfResponses){\n \n let commandDescription = `!${prop} - ${commands.listOfResponses[prop].description}\\n`;\n //console.log('success2');\n console.log(commandDescription);\n helpContent += commandDescription;\n console.log(helpContent);\n };\n helpContent += '```'\n messageReceived.channel.send(helpContent);\n}", "printHelp(obj){\n console.log();\n this.terminal.green(\"Usage: %s [options]\\n\", obj.cmd ? obj.cmd : \"\");\n if( obj.desc ){\n this.terminal.brightBlack(\"\\t%s\\n\", obj.desc);\n }\n if( obj.opts && obj.opts.length > 0 ){\n this.terminal.black(\"\\nOptions:\\n\");\n let opt;\n for( let i = 0; i < obj.opts.length; i++ ){\n opt = obj.opts[i];\n if( !opt.cmd )\n continue;\n\n this.terminal.green(\"%s\\t%s\\n\", opt.cmd, opt.desc ? opt.desc : \"\");\n }\n }\n }", "function outputHelpIfNecessary(cmd, options = []) {\n for (let i = 0; i < options.length; i++) {\n if (options[i] === '--help' || options[i] === '-h') {\n cmd.outputHelp();\n process.exit(0);\n }\n }\n}", "function help() {\n var helpmsg =\n '!ouste : déconnecte le bot\\n' +\n '!twss : ajoute la dernière phrase dans la liste des TWSS\\n' +\n '!nwss : ajoute la dernière phrase dans la liste des Non-TWSS\\n' +\n '!chut : désactive le bot\\n' +\n '!parle : réactive le bot\\n' +\n '!eval : évalue la commande suivante\\n' +\n '!dbg : met le bot en debug-mode, permettant de logger toute son activité\\n' +\n '!undbg : quitte le debug-mode\\n' +\n '!help : affiche ce message d\\'aide';\n client.say(channel, helpmsg);\n bot.log('message d\\'aide envoyé');\n}", "help(cb) {\n this.outputHelp(cb);\n process.exit(1);\n }", "function showHelp() {\n console.log(optimist.help().trim());\n process.exit(0);\n}", "function displayHelpText() {\n console.log();\n console.log(' Usage: astrum figma [command]');\n console.log();\n console.log(' Commands:');\n console.log(' info\\tdisplays current Figma settings');\n console.log(' edit\\tedits Figma settings');\n console.log();\n}", "getHelp ( input, output ) {\n output.standardOutput.writeLine( 'Usage:' );\n this.getUsage().split( '\\n' ).forEach( line => output.standardOutput.writeLine( line ) );\n output.standardOutput.writeLine( '' );\n\n if ( this.getDescription() ) {\n output.standardOutput.writeLine( 'Description:' );\n output.standardOutput.writeLine( this.getDescription() );\n }\n\n output.standardOutput.writeLine( '' );\n }", "function printHelp(commands, flags, aliases) {\n const flagsList = getFlagsForDisplay(flags);\n const commandsList = getCommandsForDisplay(commands, aliases);\n /**\n * Get width of longest command name.\n */\n const maxWidth = Math.max.apply(Math, flagsList.concat(commandsList).map(({ width }) => width));\n /**\n * Size of the terminal columns. Max width is the width of the command\n * name and the extra four is whitespace around the command name.\n *\n * This gives the columns size for the description section\n */\n const descriptionColumnsSize = term_size_1.default().columns - (maxWidth + 4);\n /**\n * Sort commands and group them, so that we can print them as per\n * the namespace they belongs to\n */\n sortAndGroupCommands_1.sortAndGroupCommands(commands).forEach(({ group, commands: groupCommands }) => {\n console.log('');\n if (group === 'root') {\n console.log(cliui_1.logger.colors.bold(cliui_1.logger.colors.yellow('Available commands')));\n }\n else {\n console.log(cliui_1.logger.colors.bold(cliui_1.logger.colors.yellow(group)));\n }\n groupCommands.forEach(({ commandName, description }) => {\n const commandAliases = getCommandAliases(commandName, aliases);\n const aliasesString = commandAliases.length ? ` [${commandAliases.join(', ')}]` : '';\n const displayName = `${commandName}${aliasesString}`;\n const whiteSpace = ''.padEnd(maxWidth - displayName.length, ' ');\n const descriptionRows = descriptionToRows(description, {\n nameColumnSize: maxWidth + 4,\n descriptionColumnsSize,\n });\n console.log(` ${cliui_1.logger.colors.green(displayName)} ${whiteSpace} ${cliui_1.logger.colors.dim(descriptionRows)}`);\n });\n });\n if (flagsList.length) {\n console.log('');\n console.log(cliui_1.logger.colors.bold(cliui_1.logger.colors.yellow('Global Flags')));\n flagsList.forEach(({ displayName, displayType, description = '', width }) => {\n const whiteSpace = ''.padEnd(maxWidth - width, ' ');\n const descriptionRows = descriptionToRows(description, {\n nameColumnSize: maxWidth + 4,\n descriptionColumnsSize,\n });\n console.log(` ${cliui_1.logger.colors.green(displayName)} ${cliui_1.logger.colors.dim(displayType)}${whiteSpace} ${cliui_1.logger.colors.dim(descriptionRows)}`);\n });\n }\n}", "function help() {\r\n common.displayHelp('tsu-amqp');\r\n }", "static help() {\n console.log(\n`Usage: \n\\nversion [ -v semver ] [-p [ 0 => PATCH, 1 => MINOR, 2 => MAJOR ] ]\nE.g version -v 0.2.3 -p 1 ## 0.3.3\n\nversion [ -f file ] [ -d delimeter ]\n `);\n }", "function help() {\n console.log(`\n notes USAGE: notes \n\n --add | -a <your note> - add an entry to your notes\n --category <category name> - give your note a category\n\n --list | -l <optional category> - list all notes | list all notes in category\n\n --update | u <note id> update note. id required plus at least one option\n --note <note text> - will update the note's text content\n --category <category name> - will update the note's category\n\n --delete | -d <note id> - delete note by id\n `);\n\n process.exit();\n}", "function outputHelp(){\n print([\n \"\\nUsage: csslint-rhino.js [options]* [file|dir]*\",\n \" \",\n \"Global Options\",\n \" --help Displays this information.\",\n \" --format=<format> Indicate which format to use for output.\",\n \" --list-rules Outputs all of the rules available.\",\n \" --rules=<rule[,rule]+> Indicate which rules to include.\",\n \" --version Outputs the current version number.\"\n ].join(\"\\n\") + \"\\n\");\n}", "function showHelpUsage() {\n let helpString = \"Hei, olen Relluassari! Yritän auttaa sinua relaatioiden ratkonnassa ;) \\n\" +\n \"<<< Koska olen vielä beta, älä pahastu jos en osaa jotain, tai kaadun kesken kaiken >>> \\n\" +\n \" \\n Miten kutsua minut apuun? \\n \" +\n \" TL;DR? Klikkaa tunnettua -> klikkaa tuntematonta -> klikkaa tuntematonta -> ... -> Repeat \\n\" +\n \" \\nEli miten? \\n\" +\n \" 1) Klikkaa graafista tunnettua sanaa \\n\" +\n \" -> Relluassari tekee Wikipediasta, Bingistä, Wiktionarystä ja Ratkojista lähdehaut ko. sanalla. \\n\" +\n \" 2) Kun haku valmis, klikkaa graafista tunnettuun kytkettyä tuntematonta sanaa \\n\" +\n \" -> Relluassari parsii hakutuloksista klikatun pituiset sanat ja brutettaa rellua niillä. \\n\" +\n \" 3) Kun brutetus valmis, klikkaa seuraavaa tunnettuun kytkettyä tuntematonta \\n\" +\n \" -> Relluassari parsii hakutuloksista klikatun pituiset sanat ja brutettaa rellua niillä. \\n\" +\n \" 4) Valitse uusi tunnettu sana lähteeksi ja siirry kohtaan 1) \\n\" +\n \"\\nAdvanced usage: \\n\" +\n \" Menu>Suorita lähdehaku (teemasana) - tekee lähdehaun vain teemasanalla \\n\" +\n \" Menu>Suorita lähdehaku (oma sana) - tekee lähdehaun syöttämälläsi sanalla/sanoilla (esim. usean sanan hakuun Bingistä) \\n\" +\n \" Menu>Parsi hakutulos sanoiksi - parsii hakutuloksesta *kaikkien* näkyvien tuntemattomien pituiset sanat \\n\" +\n \" Menu>Bruteta sanalista - brutettaa rellua sen hetken muistissa olevalla koko sanalistalla \\n\";\n alert(helpString);\n}", "function help() {\n bot.chat.send(channel, {\n body: \"Enter: !mix <val> xlm <arg>\"\n });\n}", "function listCommands() {\n console.log(`${mainDivider}\\n${\"WELCOME TO LIRI-BOT! HERE'S WHAT I CAN DO!\"}\\n${mainDivider}`)\n console.log(`${\"Use the following commands to run Liri-Bot:\"}\\n${minorDivider}\\n${\"'my-tweets' : To list the last 20 tweets\"}\\n${minorDivider}\\n${\"'spotify-this-song' + 'song name': To lists the Artist, Song Name, Preview Link, and Album\"}\\n${minorDivider}\\n${\"'movie-this' + 'movie title': To lists the Movie Title, Release Year, IMDB Rating, Rotten Tomatoes Rating, Country, Language, Plot, Cast\"}\\n${mainDivider}`);\n}", "function help () {\n return `INSTRUCTIONS:\n Blacksmith is a simple text base game. \n \n As a blacksmith you convert ore and wood into swords and axes. You buy your resources using gold and sell your weapons for gold.\n \n COMMANDS:\n - buy(item)\n - make(item)\n - sell(item)\n - fire()\n - inventory()\n - help()`\n }", "args(command) {\n let reply = `Arguments missing for command: ${command.name}`\n if (command.usage) {\n reply += `\\nUsage: \\`${prefix}${command.name} ${command.usage}\\``\n }\n return reply\n }", "printHelpText() {\n const helpText = fs.readFileSync(\n path.join(__dirname, 'cli-help.txt'), 'utf8');\n logHelper.info(helpText);\n }", "helpInformation() {\n let desc = [];\n\n if (this._description) {\n desc = [this._description, ''];\n const {\n argsDescription\n } = this;\n\n if (argsDescription && this._args.length) {\n const width = this.padWidth();\n desc.push('Arguments:');\n desc.push('');\n\n this._args.forEach(({\n name\n }) => {\n desc.push(` ${pad(name, width)} ${argsDescription[name]}`);\n });\n\n desc.push('');\n }\n }\n\n let cmdName = this._name;\n\n if (this._alias) {\n cmdName = `${cmdName}|${this._alias}`;\n }\n\n const usage = [`Usage: ${cmdName} ${this.getUsage()}`, ''];\n let cmds = [];\n const commandHelp = this.commandHelp();\n if (commandHelp) cmds = [commandHelp];\n const options = ['Options:', `${this.optionHelp().replace(/^/gm, ' ')}`, ''];\n return usage.concat(desc).concat(options).concat(cmds).join('\\n');\n }", "function help(channel){\n\tchannel.send(\"Welcome to bitchBot, created by Alex.\\nHere are some commands that could be useful:\\n\\n \\\n\t```!pic [Tag a Person]``` - Sends a random, gay photo of the person\");\n}", "function multiCommandCliHelp(args) {\n let { config } = args;\n let { commands } = config;\n let defaultCommand = commands[\"index\"];\n let options = {\n ...(defaultCommand && defaultCommand.meta.options),\n help: helpFlag,\n version: versionFlag,\n };\n function createSubCommandsHelp() {\n return Object.keys(commands)\n .filter((c) => c !== \"index\")\n .reduce((acc, commandName) => {\n let command = commands[commandName];\n acc.push({\n name: commandName,\n title: command.meta.title,\n });\n return acc;\n }, []);\n }\n return args.helpFormatter({\n cliName: config.cliName,\n cliVersion: config.cliVersion,\n cliDescription: config.cliDescription,\n commands: createSubCommandsHelp(),\n options: formatOptions(options),\n usage: defaultCommand && defaultCommand.meta.usage,\n examples: (defaultCommand && defaultCommand.meta.examples) || [],\n });\n}", "function subCommandHelp(args) {\n let { commandName, config } = args;\n let command = config.commands[commandName];\n let help = args.helpFormatter({\n commandName,\n cliName: config.cliName,\n cliVersion: config.cliName,\n title: command.meta.title,\n description: command.meta.description,\n options: formatOptions(command.meta.options || {}),\n usage: command.meta.usage,\n examples: command.meta.examples || [],\n });\n if (!help.length) {\n return [\"\", \"No help provided for this command!\"];\n }\n return help;\n}", "help(command, resonance) {\n return __awaiter(this, void 0, void 0, function* () {\n // Get configuration.\n const config = yield command.getActiveConfigForBot(resonance.bot);\n const parameterConfig = yield command.getActiveParameterConfig(resonance.bot);\n // Start building the usage text by getting the command prefix.\n let usageText = `\\`${yield resonance.bot.getCommandPrefix(resonance)}${config.key}`;\n // If there is input defined for this command, we will add them to the help text.\n if (parameterConfig.input) {\n parameterConfig.input.requests.every((request) => {\n usageText += ` {${request.replace(\" \", \"_\")\n .toLowerCase()}}\\`\\n`;\n });\n }\n else {\n usageText += \"`\\n\";\n }\n // If there are aliases defined for this command, add all usage examples to the help text.\n if (config.aliases) {\n const original = usageText;\n config.aliases.every((alias) => {\n usageText += original.replace(`${config.key}`, alias);\n return true;\n });\n }\n // Set the usage section.\n const fields = [\n {\n name: yield Yoshida_1.Yoshida.translate(\"Usage\", resonance.locale),\n text: usageText,\n },\n ];\n // If there are options defined for this command, we add a section for options.\n if (parameterConfig.options) {\n let optionsList = \"\";\n yield Promise.all(parameterConfig.options.map((option) => __awaiter(this, void 0, void 0, function* () {\n const description = yield Yoshida_1.Yoshida.translate(option.description, resonance.locale);\n const name = yield Yoshida_1.Yoshida.translate(option.name, resonance.locale);\n optionsList += `**${name}** \\`-${option.key} {${option.expects.replace(\" \", \"_\")\n .toLowerCase()}}\\` - ${description}\\n\\n`;\n })));\n fields.push({\n name: yield Yoshida_1.Yoshida.translate(\"Options\", resonance.locale),\n text: optionsList,\n });\n }\n // If there are flags defi-...You get the idea.\n if (parameterConfig.flags) {\n let flagsList = \"\";\n yield Promise.all(parameterConfig.flags.map((flag) => __awaiter(this, void 0, void 0, function* () {\n const description = yield Yoshida_1.Yoshida.translate(flag.description, resonance.locale);\n const name = yield Yoshida_1.Yoshida.translate(flag.name, resonance.locale);\n flagsList += `**${name}** \\`-${flag.key}\\` - ${description}\\n\\n`;\n })));\n fields.push({\n name: yield Yoshida_1.Yoshida.translate(\"Flags\", resonance.locale),\n text: flagsList,\n });\n }\n // Finally, send the embed.\n yield this.sendEmbed(resonance.message.channel, {\n description: yield Yoshida_1.Yoshida.translate(`${config.description}`, resonance.locale),\n fields,\n header: {\n icon: this.connector.user.avatarURL,\n text: yield Yoshida_1.Yoshida.translate(\"{{bot}} Guide\", { bot: resonance.bot.config.name }, resonance.locale),\n },\n thumbnail: this.connector.user.avatarURL,\n title: yield Yoshida_1.Yoshida.translate(`${config.name}`, resonance.locale),\n });\n });\n }", "handler_HELP(command, callback) {\n this.send(214, 'See https://tools.ietf.org/html/rfc5321 for details');\n callback();\n }", "function help(user, userID, channelID, args, evt) {\n message = 'Available commands:' +\n '\\r\\n`p!ping`: Checks to see if the bot is running' +\n '\\r\\n`p!sub add <pokemon>`: Add a subscription for the specified <pokemon>. You will receive a confirmation DM.' +\n '\\r\\n`p!sub remove <pokemon>`: Removes a subscription for the specified <pokemon>. You will receive a confirmation DM.' +\n '\\r\\n`p!sub list`: Sends a DM with a list of all pokemon you are subscribed to.' +\n '\\r\\n`p!spawn <pokemon>`: Sends a DM to all people subscribed to the specified <pokemon> indicating that one has spawned. If sent as a comment on an image, the uploaded image will also be included in the DM.' +\n '\\r\\n`p!stats`: Sends a DM with some general usage statistics for the bot.'\n\n bot.sendMessage({ to: channelID, message: message });\n}", "function help() {\n\tvar message;\n\tmessage = \"The following are valid text commands: N or n to move North, S or s to move South, W or w to move West, E or e to move East, or T or t to take an item at a given location.\";\n\tdocument.getElementById(\"Help\").innerHTML = message;\n}", "function displayHelp(withFlags) {\n var pkg = require(path.normalize(__dirname + '/../package.json'));\n grunt.log.writeln();\n grunt.log.writeln(template('<%= _.capitalize(name).blue.inverse %> - version: <%= version %> - <%= description %>', pkg));\n\n var col1len = 1;\n var widths;\n\n var map = function(list, defs, flagify){\n var tasks = list.map(function(name) {\n // console.log(name, defs);\n var defObject = defs[name];\n var taskName = flagify ? '--' + (defObject.negate ? 'no-' : '') + name + (defObject.short ? ', -' + defObject.short : '') : name;\n var info = defObject.info;\n col1len = Math.max(col1len, taskName.length);\n widths = [1, col1len, 2, 76 - col1len];\n\n return {\n name: taskName,\n desc: info.blue\n };\n });\n return tasks;\n };\n\n var enyoTasks = [\n 'init',\n 'add',\n 'concat',\n 'min',\n 'server',\n 'lint',\n 'watch',\n 'debug'\n ];\n\n var enyoInits = [\n 'init:enyo',\n 'init:bootplate',\n 'init:module'\n ];\n\n var enyoAdds = [\n 'add:layout',\n 'add:onyx',\n 'add:fu',\n 'add:canvas',\n 'add:extra',\n ];\n\n var enyoOptions = [\n 'help',\n 'base',\n 'color',\n 'config',\n 'debug',\n 'force',\n 'tasks',\n 'npm',\n 'write',\n 'verbose',\n 'version'\n ];\n\n var initDefs = {\n 'init:enyo': {\n info: 'Basic Enyo application ' + '(Default)'.cyan\n },\n 'init:bootplate': {\n info: 'Enyo application based on Bootplate'\n },\n 'init:module': {\n info: 'Structure for Enyo modules'\n }\n };\n\n var addDefs = {\n 'add:layout': {\n info: 'Add layout package to you project'\n },\n 'add:onyx': {\n info: 'Add onyx package to you project'\n },\n 'add:fu': {\n info: 'Add fu package to you project'\n },\n 'add:canvas': {\n info: 'Add canvas package to you project'\n },\n 'add:extra': {\n info: 'Add extra package to you project'\n },\n };\n\n var tasks = map(enyoTasks, grunt.task._tasks);\n var inits = map(enyoInits, initDefs);\n var add = map(enyoAdds, addDefs);\n var opts = map(enyoOptions, grunt.cli.optlist, true);\n\n if(enyoTasks.length){\n displayTasks('Enyo tasks:', tasks);\n }\n\n if(enyoInits.length){\n displayTasks('Init templates:', inits);\n }\n\n if(enyoAdds.length){\n displayTasks('Packages:', add);\n }\n\n if(withFlags && enyoOptions.length){\n displayTasks('Flags:', opts);\n }\n\n function displayTasks(header, tasks) {\n\n grunt.log.header(header.cyan.bold);\n grunt.log.writeln();\n\n tasks.forEach(function(task) {\n grunt.log.writetableln(widths, ['', _.pad(task.name, col1len), '', task.desc]);\n });\n }\n\n grunt.log.writeln();\n}", "function optionHelp() {\n console.log(\"usage: \" + appName + \" [<argv-options-list>]\" );\n console.log(argvOptionHelp + \", \" + argvOptionHelpWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionHelpDescription);\n console.log(argvOptionDebuglevel + \", \" + argvOptionDebuglevelWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionDebuglevelDescription);\n //\n console.log(argvOptionTcpaddress + \", \" + argvOptionTcpaddressWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionTcpaddressDescription);\n console.log(argvOptionTcpport + \", \" + argvOptionTcpportWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionTcpportDescription);\n console.log(argvOptionQuantity + \", \" + argvOptionQuantityWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionQuantityDescription);\n console.log(argvOptionUsers + \", \" + argvOptionUsersWord.concat(\" \".repeat(10)).substring(0,10) + \" \" + argvOptionUsersDescription);\n}", "help(text) {\n return this.lib.help(text, __dirname);\n }", "outputHelp(cb) {\n if (!cb) {\n cb = passthru => passthru;\n }\n\n process.stdout.write(cb(this.helpInformation()));\n this.emit('--help');\n }", "function showHelp() {\r\n console.log(\"\\nUsage: \");\r\n console.log(\"\\t phantomjs \" + args[0] + \" <user_number> <user_password>\");\r\n}", "function usage() {\n const desc = {\n h: 'Print this help message and exit.',\n m: 'Regular expression to use to match scanned files.',\n mflags: 'Flags to use in regular expression matching.',\n p: 'Port on which to serve the site.',\n s: 'Scan the files directory for new files.',\n r: 'Whether to scan recursively for files.',\n q: 'Quiet mode; don\\'t output anything to stdout.'\n };\n\n console.log(\n '\\nUsage: audiovisual [flags] [directory]\\n\\n'\n + '\\t[directory]: Directory from which to serve audio files.\\n'\n + '\\t\\tIf omitted, no audio files will be served.\\n'\n + '\\nFlags:'\n );\n Object.keys(desc).forEach(key => {\n const flag = key.length === 1\n ? `-${key}`\n : `--${key}`;\n const value = key in argvConfig.default\n ? `=${argvConfig.default[key]}`\n : '';\n\n console.log(`\\t${flag}${value}\\t${desc[key]}\\n`);\n });\n}", "getUsage() {\n const args = this._args.map(arg => humanReadableArgName(arg));\n\n const usage = `[options]${this.commands.length ? ' [command]' : ''}${this._args.length ? ` ${args.join(' ')}` : ''}`;\n return this._usage || usage;\n }", "function print_help(argc, argv) {\n\n //\n // Print help\n //\n console.log(\"\");\n console.log(\" USAGE: node start.js <options>\");\n console.log(\" -----\");\n console.log(\"\");\n console.log(\" OPTIONS \");\n console.log(\" ------- \");\n console.log(\" --help :: display this help screen\");\n console.log(\" --master <ip> :: connect to a master\");\n console.log(\" --reset :: reset crawl\");\n console.log(\" --init-db :: initialize database\");\n console.log(\"\");\n\n //\n // Exit the process\n //\n process.exit();\n\n}", "function printHelp() {\n var help = [\n 'Usage: reltoabs base-url source-file [dest-file]',\n '',\n 'Searches through the given source-file replacing any href=\"\" relative links with',\n 'absolute links. It will output it to the given dest-file. If no dest-file is provided',\n 'it will send it to absolute/source-file.',\n '',\n 'Options:',\n ' --help, -h - open this help file then exit.',\n ''\n ].join('\\n');\n\n console.log(help);\n}", "function build_help(userID, channelID, message, parameter_set){\n log_event(\"Help requested in channel: \" + channelID)\n HELP_MESSAGE = \"Here are my supported commands:\\n\\n\"\n whitespace_cmd = new Array(COMMAND_SIZE_COL + 1).join('\\xa0');\n whitespace_usg = new Array(USAGE_SIZE_COL + 1).join('\\xa0');\n for(module in command_dict){\n HELP_MESSAGE += \"**\" + module + \":**\\n```\"\n for(command in command_dict[module]){\n HELP_MESSAGE += (command + whitespace_cmd).substring(0, COMMAND_SIZE_COL) \n + \" USAGE: \" + (format_usage(command, false) + whitespace_usg).substring(0, USAGE_SIZE_COL) \n if(command_dict[module][command]['desc'] != null)\n HELP_MESSAGE += \" | \" + command_dict[module][command]['desc']\n HELP_MESSAGE += \"\\n\"\n }\n HELP_MESSAGE += \"```\\n\"\n }\n bot.sendMessage({ to:channelID, message: HELP_MESSAGE })\n}", "function commandHelp(player_ID, executeCommand) {\n\n getPlayer(player_ID, function(playerfound) {\n let currentRoom = playerfound.room;\n\n let output = ['Here is a list of commands:',\n '----------------------',\n '| - - - command - - -| - - function - - |',\n '| ' + commands.command1 + ' - - - - - - - | list content of folder |',\n '| ' + commands.command2 + ' [folder name] | move to folder |',\n '| ' + commands.command2 + ' [..] - - - - -| go back |',\n '| ' + commands.command3 + ' [file name] - | open/run file |',\n '----------------------'\n ];\n\n executeCommand(output, currentRoom);\n }); \n return \n}", "function usage(arg, invalid) {\n // parse arguments\n invalid = typeof invalid === 'undefined' ? false : invalid;\n if (invalid) console.log(\"Invalid command!\");\n\n // define usage strings\n var usage = new Array();\n\n // help for search keyword\n usage['search'] = new Array();\n usage['search'][0] = \"\\ttim search [client] (-c|--client pattern)|(-s|--short key)\";\n\n // help for add keyword\n usage['add'] = new Array();\n usage['add'][0] = \"\\ttim add client --name ClientName [--street1 value] [--street2 value] [--zip zip] [--city city] [--short shortkey]\";\n\n // start keyword\n usage['start'] = new Array();\n usage['start'][0] = \"\\ttim start ((-c|--client ClientName)|(-s|--short ShortKey)) -t|--title Title [--description Description] [--start StartTime]\";\n\n usage['status'] = new Array();\n usage['status'][0] = \"\\ttim status\";\n\n usage['stop'] = new Array();\n usage['stop'][0] = \"\\ttim stop [--end EndTime]\";\n\n usage['list'] = new Array();\n usage['list'][0] = \"\\ttim list [filters]\";\n\n usage['commit'] = new Array();\n usage['commit'].push(\"\\ttim commit - Combines tracked times into an invoice position\");\n usage['commit'].push(\"\\ttim commit times|pos (-c|--client clientName)|(-s|--short shortKey)\");\n\n // output usage / help\n console.log(\"Usage - incomplete but please go ahead and read what's already there:\\n\");\n if (arg && usage[arg] != undefined) {\n console.log(\"Usage for tim \" + arg + \":\");\n usage[arg].forEach(function (val) {\n console.log(val);\n });\n }\n else {\n for (var usg in usage) {\n usage[usg].forEach(function (val) {\n console.log(val);\n });\n }\n }\n\n process.exit(invalid ? -1 : 0);\n}", "function replyInvalidCommand(err=null){\n if(err){\n message.reply(err)\n }else{\n message.reply('Please enter valid command.\\nCommand for help: >help');\n }\n }", "function singleCommandCliHelp(args) {\n let { config, commandName } = args;\n let command = config.commands[commandName];\n let options = {\n ...(command && command.meta.options),\n help: helpFlag,\n version: versionFlag,\n };\n let meta = (command && command.meta) || {};\n return args.helpFormatter({\n cliName: config.cliName,\n cliVersion: config.cliVersion,\n cliDescription: config.cliDescription,\n options: formatOptions(options),\n usage: meta.usage,\n examples: meta.examples || [],\n });\n}", "optionHelp() {\n const width = this.padWidth(); // Append the help information\n\n return this.options.map(({\n flags,\n description,\n bool,\n defaultValue\n }) => `${pad(flags, width)} ${description}${bool && defaultValue !== undefined ? ` (default: ${JSON.stringify(defaultValue)})` : ''}`).concat([`${`${pad('-h, --help', width)} `}output usage information`]).join('\\n');\n }", "get help() {\n\t\tlet response = \"\"\n\t\tif (this._description) { \n\t\t\tresponse = this._description; \n\t\t}\n\n\t\tresponse += \" - Usage: \" + this.format;\n\t\tresponse += \" - Ex: \" + this.example;\n\n\t\treturn response;\n\t}", "help() {\n return \"Remove the given directory<br/>usage: rmdir [-r][-f] filename\";\n }", "function showHelp(){\n showListHelp();\n}", "function help() {\n console.log(`usage: har-to-node [<file path>]\n file path:\n \\t Provide a <file path> for your HAR file. \n \\t If no <file path> is passes, the script won't be able to convert your HAR file`)\n}", "function listHelpMessage() {\n\n\t// log the message to display\n\tconsole.log(\n\t\t\"-----------------------------------------------\" + \"\\n\" +\n\t\t\"------ gitrc ------\" + \"\\n\" +\n\t\t\"-----------------------------------------------\" + \"\\n\\n\" +\n\t\t\"Easily switch between different gitconfig files\" + \"\\n\\n\" +\n\t\t\"Usage:\" + \"\\n\" +\n\t\t\" gitrc List all profiles\" + \"\\n\" +\n\t\t\" gitrc [name] Switch to profile\" + \"\\n\" +\n\t\t\" gitrc -n [name] Create a new profile\" + \"\\n\" +\n\t\t\" gitrc -d [name] Delete the profile\" + \"\\n\" +\n\t\t\" gitrc -h Display this screen\" + \"\\n\"\n\t);\n\n\t// successful exit\n\tprocess.exit( 0 );\n}", "function badUsage(message) {\n console.log(`${message}\nUse -h to get an overview of the command.`);\n}", "function man(arguments, self)\n\t{\n\t\tvar consoleCommands = self.commands;\n\t\tvar command = arguments[1];\n\t\tself.write(\"\\n\");\n\t\tif( command !== undefined && command.trim() != \"\")\n\t\t{\n\t\t\t// Does the command we're trying to search information about exist?\t\n\t\t\tvar commandIndex = $.inArray(command, $.map(consoleCommands,function(item,index){ return item.name;}));\n\t\t\tif(commandIndex != -1)\n\t\t\t{\n\t\t\t\tself.write(consoleCommands[commandIndex].man);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tself.write(\"No manual entry for \" + command);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tself.write(\"What manual page do you want?\");\n\t\t}\n\t}", "function displayHelp()\n{\n dwscripts.displayDWHelp(HELP_DOC);\n}", "function displayHelp()\n{\n // Replace the following call if you are modifying this file for your own use.\n dwscripts.displayDWHelp(HELP_DOC);\n}", "execute(message, args, client, MessageEmbed) {\n \n const Info = client.commands.filter(c => c.category === 'info').size\n const Mod = client.commands.filter(c => c.category === 'mod').size\n const Fun = client.commands.filter(c => c.category === 'fun').size\n const Misc = client.commands.filter(c => c.category === 'misc').size\n \n let prefix;\n if(message.guild) prefix = client.serverconfig.get(message.guild.id,'prefix')\n if(!message.guild) prefix = '!'\n \n \n if(!args[0]){\n const embed = new MessageEmbed()\n .setTitle(client.user.username + `'s commands`)\n .setColor('#008000')\n .addField(`Mod (${Mod})`, 'Moderation commands only available to members with special permissions', true)\n .addField(`\\u200b`, `\\u200b`, true)\n .addField(`Info (${Info})`, 'Informational commands available to everyone such as userinfo or serverinfo', true)\n .addField(`Fun (${Fun})`, 'Fun commands thats just gonna make you laugh your ass off (Warning this bot takes no responsibility if you loose your ass during usage)', true)\n .addField(`\\u200b`, `\\u200b`, true)\n .addField(`Misc (${Misc})`, 'Commands that didnt fit into any category', true)\n .setThumbnail(client.user.avatarURL())\n .setDescription(`Use ${prefix}help {category/command} for command list/help`)\n \n message.author.send(embed).catch(e => message.channel.send(embed))\n }\n \n if(!args[0]) return;\n let helpC = args[0]\n helpC = helpC.toLowerCase()\n \n if(client.commands.filter(c => c.category === helpC).size <= 0) {\n \n const cmd = client.commands.get(helpC) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(helpC))\n \n if(!cmd){\n const embed = new MessageEmbed()\n .setTitle(`${helpC} is not a valid category/command`)\n .setColor('#FF0000')\n \n return message.channel.send(embed)\n }\n \n if(cmd.ownerOnly && message.author.id !== '232466273479426049') {\n const embed = new MessageEmbed()\n .setTitle(`${helpC} is not a valid category/command`)\n .setColor('#FF0000')\n \n return message.channel.send(embed)\n }\n \n if(cmd) {\n const embed = new MessageEmbed()\n .setTitle(`Information about the **${cmd.name}** command`)\n .setColor('#008000')\n .addField('Alias(es)', cmd.aliases.join('\\n'))\n .addField('Guild only', cmd.guildOnly)\n .setDescription(cmd.description)\n \n return message.author.send(embed).catch(e => message.channel.send(embed))\n }\n \n\n }\n \n const embed = new MessageEmbed()\n .setTitle(`Commands in the ${helpC} category`)\n .setDescription(client.commands.filter(c => c.category === helpC).map(c => c.name).join('\\n'))\n .setColor('#008000')\n .setFooter(`Use ${prefix}help {command/alias} to get info about the command\n`)\n \n\n message.author.send(embed).catch(e => message.channel.send(embed))\n }", "async function helpCommand(message) {\n if (message.member.roles.cache.some(role => role.name === \"Committee\")) {\n message.channel.send({ embed: {\n color: 3066993,\n title: \"Admin Command List\",\n fields: [{\n name: \"!list\",\n value: \"Present all pending problems\"\n },\n {\n name: \"!read (id)\",\n value: \"Find a specific problem for verification\"\n },\n {\n name: \"!testcases (id)\",\n value: \"List the test cases for a specific problem\"\n },\n {\n name: \"!init\",\n value: \"Gather players for a game of BlitzProg\"\n },\n {\n name: \"!start\",\n value: \"Start a game of BlitzProg with the current players\"\n },\n {\n name: \"!submit\",\n value: \"Submit your code for the current round and have it tested\"\n },\n {\n name: \"!end\",\n value: \"End the current game of BlitzProg \"\n }\n ]\n }});\n } else {\n message.channel.send({ embed: {\n color: 15158332,\n title: \"Player Command List\",\n fields: [{\n name: \"!init\",\n value: \"Gather players for a game of BlitzProg\"\n },\n {\n name: \"!start\",\n value: \"Start a game of BlitzProg with the current players\"\n },\n {\n name: \"!submit\",\n value: \"Submit your code for the current round and have it tested\"\n },\n {\n name: \"!end\",\n value: \"End the current game of BlitzProg \"\n }\n ]\n }});\n } \n}", "static get usage () {\n return ['[<pkgname> [<pkgname> ...]]']\n }", "function displayHelp()\r\n{\r\n dwscripts.displayDWHelp(HELP_DOC);\r\n}", "function Help() {\n}", "function Help() {\n}", "function logHelp() {\r\n console.log([\r\n ' ', ' Houston :: A cool static files server', ' ', ' Available options:', '\\t --port, -p \\t Listening port to Houston, default to 8000 ', '\\t --path, -d \\t Dir of starting point to Houston, default to actual dir', '\\t --browser,-b \\t open browser window, (true,false) default to true', '\\t --help, -h \\t show this info', '\\t --version,-v \\t Show the current version of Houston', ' ', ' :: end of help ::'\r\n ].join('\\n'));\r\n process.kill(0);\r\n }", "function HelperFn() {\n console.log(\n chalk.bold.blue(`\n\n All the commands available:\n\n `)\n );\n console.log(\n chalk.yellowBright(`\n 1. tree 'dir path' \n this will return you tree veiw of the folder\n\n\n 2. organize 'dir path'\n this will help you to organize the folder according to their extension\n\n\n 3. Help Cmd\n `)\n );\n}", "function usage() {\n return util.format([\n 'Usage: %s',\n '',\n 'Tap on the command line to calculate BPM',\n '',\n 'Options',\n ' --help | -h: Print this help message and exit',\n ' --version | -v: Print the version number and exit',\n ''\n ].join('\\n'), path.basename(process.argv[1]));\n}", "getHelpText(){\n return \"Tree Authoring Shell: Commands: cd {id} | @{id}. set tag {tags} | #{tag}, set value {variable} {value} | ${variable}: {value}, rm {id}, link {id} {id} | {id} > {id}, stash, unstash, prior | <, search {type} {variable} {value}\";\n\n }", "function showUsage() {\n\tconsole.log(\"Usage: ./tests/testClient hostname port baseurl all|user|category|product|offer\");\n\treturn;\n}", "outputHelp(cb) {\n if (!cb) {\n cb = (passthru) => {\n return passthru;\n };\n }\n const cbOutput = cb(this.helpInformation());\n if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n process.stdout.write(cbOutput);\n this.emit(this._helpLongFlag);\n }", "outputHelp(cb) {\n if (!cb) {\n cb = (passthru) => {\n return passthru;\n };\n }\n const cbOutput = cb(this.helpInformation());\n if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) {\n throw new Error('outputHelp callback must return a string or a Buffer');\n }\n process.stdout.write(cbOutput);\n this.emit(this._helpLongFlag);\n }" ]
[ "0.8007304", "0.77485216", "0.7647215", "0.76334184", "0.7555876", "0.75035346", "0.74084127", "0.7399205", "0.73620594", "0.7333159", "0.730623", "0.72821474", "0.723349", "0.72274303", "0.7214048", "0.7201404", "0.71871066", "0.718445", "0.7157682", "0.7102523", "0.7102523", "0.71017694", "0.70203143", "0.7013169", "0.70058435", "0.6999693", "0.6999693", "0.6957342", "0.6949024", "0.69095755", "0.68965155", "0.6896317", "0.68873894", "0.6852773", "0.6847484", "0.6814831", "0.6796859", "0.67824376", "0.676154", "0.6757007", "0.66945344", "0.6679109", "0.66348416", "0.6619995", "0.66072303", "0.6605325", "0.6593922", "0.658441", "0.6580695", "0.6505169", "0.6500733", "0.6449231", "0.6437632", "0.6437359", "0.64298385", "0.64085025", "0.6407067", "0.6364531", "0.63539934", "0.6347484", "0.6346989", "0.6344585", "0.63356537", "0.63339543", "0.63194394", "0.6305287", "0.62897086", "0.62679815", "0.6264684", "0.62629604", "0.62617135", "0.6234722", "0.62293243", "0.6205323", "0.61900353", "0.6186745", "0.61812216", "0.6178392", "0.6163577", "0.61483103", "0.61345875", "0.61279327", "0.60825914", "0.6065727", "0.6063725", "0.6059506", "0.60493344", "0.6048303", "0.60461974", "0.60413057", "0.6033204", "0.6012126", "0.6012126", "0.6007459", "0.59974307", "0.59755015", "0.5972703", "0.5968454", "0.59552586", "0.59552586" ]
0.74989164
6
Takes any number of passed in arguments that are numbers, and multiplies them.
function multiplyCommand(arguments, receivedMessage) { if (arguments.length < 2) { receivedMessage.channel.send("Not enough values to multiply. Try !`multiply 2 4 10` or `!multiply 5.2 7`") return } let product = 1 arguments.forEach((value) => { product = product * parseFloat(value) }) if (isNaN(product)) { receivedMessage.channel.send("Please input numbers instead.") } else { receivedMessage.channel.send("The product of " + arguments + " multiplied together is: " + product.toString()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mul() {\n var res = 1;\n var count = 0;\n for (var i = 0; i < arguments.length; i++){\n if (typeof(arguments[i])===\"number\"){\n res *=arguments[i];\n count++;\n }\n }\n if (count == 0) return 0;\n return res;\n}", "function multiplyAll() {\n if (arguments.length === 0) {\n return 0\n }\n let total = 1;\n for (let i = 0; i < arguments.length; i++) {\n total *= arguments[i]\n }\n return total;\n}", "function multiplyArguments() {\n\tif(arguments.length === 0)\n\t\treturn 0;\n\tif(arguments.length === 1)\n\t\treturn arguments[arguments.length - 1];\n\tvar product = 1;\n\tfor(var i = 0; i < arguments.length; i++){\n\t\tproduct *= arguments[i];\n\t}\n\treturn product;\n // use the arguments keyword to multiply all of the arguments together and return the product\n // if no arguments are passed in return 0\n // if one argument is passed in just return it\n}", "function multiplyAll() {\n var sum = 1;\n for (var i = 0; i < arguments.length; i++) {\n sum *= arguments[i];\n }\n return sum;\n\n}", "function multiply(...args){\n return args.reduce((total,curVal)=>{\n return total*curVal; \n })\n}", "function multiply() {\n return Array.from( arguments ).reduce( ( a, b ) => {\n return ( +a * +b );\n }, 1 );\n}", "multiplyMany(...numbers) {\n\n }", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(x => multiplier * x);\n}", "multiply() {\n var product = 1;\n // Extracting the number in the string\n if (typeof arguments[0] == \"string\") {\n if (arguments[0].match(/\\d+/)) {\n let slot_num = arguments[0].match(/\\d+/);\n slot_num = Number(slot_num);\n product = this.get_slot(slot_num) * arguments[1];\n return product;\n }\n }\n\n if (arguments[0] == \"LAST\") {\n product = arguments[1] * this.last();\n return product;\n }\n for (let i = 0; i < arguments.length; i++) {\n product = product * arguments[i];\n }\n this.lastNumber = product;\n return product;\n }", "function multiple() {\n let result = 1;\n for (let i = 0; i < arguments.length; i++)\n\t\tresult *= arguments[i];\n return result;\n}", "multiply() {\n this.result = arguments[0];\n\n for (let i = 0; i < arguments.length; i++) {\n this.result *= arguments[i];\n }\n return this.result;\n }", "function multiply(multi,...args){\n\treturn args.map(arg => arg * multi)\n}", "function productOfOtherNumbers(arg){\n\n}", "function sc_multi() {\n var product = 1;\n for (var i = 0; i < arguments.length; i++)\n\tproduct *= arguments[i];\n return product;\n}", "function mul() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var acc = args[0];\n for (var i = 1; i < args.length; i++) {\n acc = _mul_two(acc, args[i]);\n }\n return acc;\n}", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(function(element) {\n return multiplier * element;\n });\n}", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(function (element) {\n return multiplier * element;\n });\n}", "function multiply(multiplier, ...theArg){\n return theArg.map(num => multiplier * num);\n}", "function multiply(multiplier, ...theArgs) {\n return theArgs.map((element) => {\n return multiplier * element;\n });\n}", "function multiplyNums(a, b, c) {\n return c(a, b)\n }", "function mul (...all) {\n let newArr = all.filter(function(number){\n if (typeof number == \"number\"){\n return number;\t\t\n };\n });\n let res = 1;\n if (typeof newArr[0] == \"number\"){\n function mult (value) {\n return res *= value;\n };\n newArr.forEach(mult);\n return res;\n } else if (typeof newArr[0] != \"number\"){\n return res = 0;\n };\n}", "multiply(times) {\n\n }", "function product(factor,...arg){\n // arg is an array of arguments\n // reduce is an accumulate function\n return arg.reduce((a,b)=>a*b+factor)\n}", "function product( ...numbers ) {\n\n return numbers.reduce( ( acc, number ) => {\n return acc * number;\n }, 1 );\n}", "function mul(firstNumber){\n return helperMul(firstNumber);\n}", "function multNums(a, b) {\n let product = a * b;\n return product\n}", "multiply() {\n\n let result=1;\n let digit;\n \n for (let i = 0; i < arguments.length; i++) \n \n if(arguments[i]===\"LAST\"){\n result *= parseInt(this.last());\n }\n else \n if(arguments[i]!==\"LAST\"&&typeof(arguments[i])=='string'){\n \n digit = arguments[i].match(this.regex)\n result *= this.memory[parseInt(digit) - 1]\n \n \n }else{\n result *= arguments[i];\n \n }\n this.total = result;\n return parseInt(this.total);\n }", "function multiply(numbers){\n return numbers.reduce((a,b) => a * b);\n}", "function specialMultiply() {\n if (arguments.length === 2) {\n return arguments[0] * arguments[1];\n }\n if (arguments.length === 1) {\n const outerNum = arguments[0];\n return function(num) {\n return outerNum * num;\n }\n }\n}", "function multiplyNumbers(num1, num2) {\n return num1 * num2\n }", "function product(numbers) {\n var result = 1;\n numbers.forEach(function (number) {\n result *= number;\n });\n return result;\n}", "function multiply (num) {\n let total = 1;\n for (let i=0; i< num.length; i++) {\n total *= num[i]\n } \n return total;\n}", "function multiplier(multiplyBy, num) {\n return num * multiplyBy;\n}", "function multiplyNumbers(numberList){\n var multiplied = 1;\n for(i=0; i<numberList.length; i++){\n multiplied *= numberList[i]\n }\n return multiplied\n}", "function multiplyNumbers (firstNumber, secondNumber) {\n\treturn firstNumber * secondNumber;\n}", "function multiplyTwoNumbs(a,b){\n return a *b;\n}", "function simpleMultiplication(){\n return arguments[0] % 2 === 0 ? arguments[0] * 8 : arguments[0] * 9\n}", "function magic_multiply(x, y){\n var result = 0\n if(typeof x===\"number\" && typeof y===\"number\"){\n \tresult = x*y;\n \tif (result == 0){result=\"All inputs 0\"}\n }\n else if(x.constructor === Array && typeof y===\"number\"){\n \tresult = [];\n \tfor (var i=0;i<x.length;i++){\n \t\tresult.push(x[i]*y);\n \t}\n \t\n }\n else if(typeof x===\"number\" || typeof y===\"string\"){\n \tresult=\"Error, can not multiple by string\"\n }\n else if(typeof x===\"string\" || typeof y===\"number\"){\n \tresult =\"\"\n \tfor (var i=0;i<y;i++){\n \t\tresult+=x\n \t}\n }\n return result;\n}", "function multiply (num1, num2) {\n return num1 * num2\n}", "function multNums(n1,n2) {\n return (n1*n2)\n}", "function multiply(first_operand , second_operand){\n return first_operand * second_operand\n}", "function multy2(...numbers) {\n console.log(numbers);\n console.log(\n numbers.reduce(function (value, curretValue) {\n return value * curretValue;\n })\n );\n}", "function multiply(paramOne, paramTwo, paramThree) {\n return paramOne * paramTwo * paramThree;\n}", "function multiply(num1, num2) {\n return num1 * num2; \n }", "function multiply(num1, num2) {\r\n return num1 * num2;\r\n}", "function multiply(num1, num2) {\r\n return num1 * num2;\r\n}", "function multiple(a, b){\n return a*b;\n}", "function multiply(number1, number2) {\n return number1 * number2;\n}", "function multiply(number1, number2) {\n return number1 * number2;\n}", "function multiply(first, second) {\n return first * second;\n}", "function multiply(num1, num2) {\n return num1 * num2;\n}", "function multiply(num1, num2) {\n return num1 * num2;\n}", "function multiply(num1, num2) {\n return num1 * num2;\n}", "function multiplier(x, y, z){\r\n\t\t\t// multipler takes the arguments then prints out their product\r\n\t\t\tconsole.log(x * y * z);\r\n\t\t}", "function multiply(input) {\n return input * 10;\n}", "function multiply(nums) {\r\n let m = 1;\r\n for (let i = 0 ; i < nums.length ; i++) {\r\n m *= nums[i];\r\n }\r\n return m;\r\n}", "function mul(num1, num2) {\n return num1 * num2;\n}", "function multiply(a,b) { \n return a * b\n}", "function mult(a,b){\n return a*b;\n}", "function multiply(num1, num2) {\n\n return num1 * num2;\n\n}", "function mult(num1, num2){\n return num1*num2;\n}", "function mul(n1, n2){\n return n1 * n2;\n}", "function multiplyTwoNumbers(a, b) {\nreturn a * b\n}", "function multiply(a, b){\n return a * b\n}", "function multiplyThree(firstNumber, secondNumber, thirdNumber){\n return firstNumber * secondNumber * thirdNumber;\n}", "function mul(num1,num2)\n{\n return num1 * num2;\n}", "function multiply(a, b) {\n var product = parseInt(a) * parseInt(b);\n return product;\n}", "function mul(n1, n2) {\n return n1 * n2;\n}", "function multiply(a,b){\n return a * b\n}", "function sumallmulti(a,b,...args){\n sum =0;\n let multi = a*b;\n for(const arg of args){\n sum+=arg;\n }\n return [multi,sum];\n }", "function product(nums) {\n return nums.reduce(function(prod, curr) { return prod *= curr })\n}", "multiply(a, b) {\n return a * b\n }", "function multiply(num1, num2) { \n var sum = num1 * num2;\n return sum; \n}", "function calculateMultiply(num1, num2){\n return num1 * num2\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function mul(a, b) {\n return a * b;\n}", "function mul(a, b) {\n return a * b;\n}", "function multiply(n1, n2){\n return n1 * n2;\n}", "function multipleNum(a, b) {\n\tconsole.log(a*b);\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b) {\n return a * b;\n}", "function multiply(a, b){\n return a * b;\n}", "function multiplicacion (numero1, numero2) {\n var resultado = numero1 * numero2\n console.log(resultado)\n}", "function multiply (a, b) {\n return a * b;\n}", "function mul(n1,n2) {\n return n1*n2; \n}", "function multiply(n1, n2) {\n return n1 * n2;\n}", "function multi(x=null, y=null){\n\treturn x * y;\n}", "function multiply(a,b){\n return a * b;\n}", "function multiply (a, b) {\n\treturn a * b;\n}", "function multiply (a, b) {\n\treturn a * b;\n}", "function multiply(a, b) {\n // When this code runs, they are called arguments.\n return a * b;\n}", "function multiply(a, b, c) {\n return (a * b * c);\n}", "function multiply(a, b){\n return a * b;\n }", "function product(num1, num2) {\r\n return num1 * num2\r\n}", "function multiplication(number1, number2) {\n return number1 * number2;\n}" ]
[ "0.8401136", "0.8034047", "0.795346", "0.7931022", "0.7829133", "0.78238165", "0.77966255", "0.76907176", "0.767811", "0.7623502", "0.75973105", "0.75830686", "0.7569053", "0.7513881", "0.74896085", "0.7456117", "0.7455235", "0.74446195", "0.7433075", "0.73673373", "0.7358504", "0.7350884", "0.7194713", "0.7142835", "0.7139717", "0.7137062", "0.7119684", "0.71179247", "0.70745313", "0.70457697", "0.70165807", "0.700493", "0.700309", "0.6984343", "0.697361", "0.69070286", "0.690049", "0.6894036", "0.68837935", "0.6883399", "0.6880161", "0.686255", "0.68599933", "0.6857109", "0.68275946", "0.68275946", "0.6823523", "0.6811904", "0.6811904", "0.68018156", "0.6800315", "0.6800315", "0.6800315", "0.67954254", "0.6791336", "0.67895323", "0.6779735", "0.67732096", "0.67668885", "0.676169", "0.67582244", "0.67419666", "0.6727118", "0.67243195", "0.6721531", "0.67195", "0.6713281", "0.67110026", "0.67069095", "0.6706887", "0.669451", "0.6690589", "0.665293", "0.6640284", "0.66401565", "0.66401565", "0.66401565", "0.66401565", "0.66401565", "0.66401565", "0.66380113", "0.66380113", "0.6627961", "0.662327", "0.6620005", "0.6620005", "0.66133726", "0.6610851", "0.6607703", "0.66059005", "0.66050965", "0.6602276", "0.6602196", "0.65968937", "0.65968937", "0.6595403", "0.65901357", "0.6584984", "0.65832937", "0.65688986" ]
0.7161548
23
Returns Pong! to the user.
function pingCommand(arguments, receivedMessage) { receivedMessage.channel.send("Pong!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendPong() {\n const pong = { type: SOCKET_MESSAGE_TYPES.PONG };\n this.send(pong);\n }", "function _wsPong() {\n log.verbose(LOG_PREFIX, 'Pong.');\n _self.emit('pong');\n }", "function pong(user, userID, channelID, args, evt) {\n bot.sendMessage({\n to: channelID,\n message: 'Pong!'\n });\n}", "function pong(){primus.timers.clear(\"pong\");//\n// The network events already captured the offline event.\n//\nif(!primus.online)return;primus.online=false;primus.emit(\"offline\");primus.emit(\"incoming::end\")}", "function pong() {\n\tOutput('<span>pong</span></br><span class=\"pong\"><b class=\"left\">|</b><b class=\"right\">|</b></span></br>');\n}", "function pong() {\n return 'pong';\n}", "function drawPong(force) {\n if (running || force) {\n clear(contextPong);\n movePlayers(player1, player2);\n collision(ball, player1, player2);\n redrawPong(contextPong);\n } else {\n clearInterval(drawLoopPong);\n drawLoopPong = 0;\n jQuery('#clickMe').show();\n initObjects();\n }\n}", "function Pong(config) {\r\n \r\n this.config = config = merge( defaults, config );\r\n \r\n this.canvas = document.createElement('canvas');\r\n this.height = config.height;\r\n this.width = config.width;\r\n \r\n this.paddleSpeed = config.paddleSpeed;\r\n this.ballSpeed = config.ballSpeed;\r\n \r\n this.context = this.canvas.getContext('2d');\r\n \r\n this.canvas.height = this.height;\r\n this.canvas.width = this.width;\r\n \r\n this.newGame();\r\n \r\n }", "function pingPong(t, length) {\n t = repeat(t, length * 2);\n t = length - Math.abs(t - length);\n return t;\n }", "async execute(message, args, connection) \t\t\t\t\t\t\t\t\t// Function Goes Here\n\t{\n\t\tmessage.channel.send('Pong!');\n\t}", "static async ping(req, res) {\n return res.sendResponse({\n success: true,\n message: 'Pong'\n });\n }", "ping(){\n\t\tLogger.debug(`Message with ping request being responded to by pong...`);\n\t\tthis.send('pong', Global.mac);\n\t}", "sendPing(){\n if(!this.isAlive()){\n this.emit('noPong');\n if(this.state === CONST.STATE.CONNECTED){\n this.state = CONST.STATE.NOT_CONNECTED;\n }\n return;\n }\n this.setHalfDead();\n this.ping();\n }", "function ping(){\n \t//Sends postRequest to finds info about game\n sendMessage(\"get\",{\n \tkey: \"ping\",\n \tgameHash: GAME_HASH,\n \tplayerId: PLAYER_ID\n }, pingCallback);\n \n \n }", "function onPause() {\n\n\t\tthis.draw = function() {\n\t\t\tdrawScreen(\"rgba(0, 0, 0, 0.5)\");\n\t\t\tdrawPaddle(player_1);\n\t\t\tdrawPaddle(player_2);\n\t\t\tdrawBall();\n\t\t\tdrawScreen(\"rgba(100, 0, 100, 0.6)\");\n\t\t\twriteText(\"P A U S E\", 40, 450, 100, 3);\n\t\t}\n\t}", "function pongPlay(userId) {\n if(!this.users.has(userId))return;\n this.users.get(userId).setTime(new Date().getTime());\n}", "function _clearPingPong() {\n if (_interval) {\n clearInterval(_interval);\n _interval = null;\n }\n }", "function lobbyPing(){\n \n \tsendMessage(\"get\",{\n \t\tkey: \"lobbyPing\",\n \t\tgameHash: GAME_HASH,\n \t\tplayerId: PLAYER_ID\n \t}, lobbyPingCallback);\n }", "function onPing(req, res) {\n req.setEncoding('utf8');\n res.writeHead( 200, {'Content-Type': 'text/plain'} );\n res.end( \"PONG\" );\n}", "function replyPing(){\n message.channel.send('pong! I am Crypto Bot.\\nType: \">help\" for help(without double quotes)') ;\n }", "ping() {\n return \"pong!\"\n }", "function initPingPong() {\n Log.debug(\"init ping pong...\");\n ExtMsg.listen('content.ping', function(message) {\n return new Promise((resolve, _) => {\n if (message.type == 'ping') {\n Log.debug(\"sending pong\");\n resolve('pong');\n }\n });\n });\n}", "function pong()\n{\n document.getElementById('ZoneJeu').innerHTML = '<iframe id=\"Pong\" width=\"700px\" height=\"510px\"></iframe>';\n document.getElementById('Pong').src = \"Pongulus.html?Prenom=\" + EnfantConnecte.Prenom;\n}", "onGameWon() {\n window.location.href = 'https://www.youtube.com/watch?v=IMZo-aBp9OQ';\n }", "function paddleDown(Player){\r\n\tif (Player == 2){$.ajax({ url: Host + \"/\" + GameKey + \"/player/\" + Name2 + \"/\" + SecretKey2 + \"/down\"});}\r\n\telse {$.ajax({ url: Host + \"/\" + GameKey + \"/player/\" + Name + \"/\" + SecretKey + \"/down\"});}\r\n\r\n}", "function onPing () {\n util.log('Player ' + this.id +' has pinged.')\n //this.broadcast.emit('pong');\n socket.sockets.emit('pong');\n\n}", "function pingCheck() {\n if (timer) { clearTimeout(timer);}\n var pong = new Date() - start;\n if (typeof callback === \"function\") {\n callback(pong);\n }\n }", "function displayLost() {\n\tif (!modeGOT) {\n\t\t$txt.style.color = \"orange\";\n\t\t$txt.innerHTML = \"Essaie encore\".toUpperCase();\n\t\t$ostMain.pause();\n\t\t$ostGameover.play();\n\t}\n}", "function Pong(){\n // initialize the pong ball at a random\n this.x = parseFloat((Math.random() * 750).toFixed(0));\n this.y = parseFloat((Math.random() * 100).toFixed(0));\n this.render = function() {\n //console.log(this.y);\n context.fillStyle = \"orange\";\n context.beginPath();\n context.arc(this.x,this.y,25,0,2*Math.PI);\n context.closePath();\n context.fill();\n //console.log(\"Pong: \" + this.x + \" \" + this.y)\n }\n }", "sendPing() {\n this._sendMessage({\n msg: 'ping',\n id: Random.default().id(20),\n });\n }", "function paddleUp(Player){\r\n\tif (Player == 2){$.ajax({ url: Host + \"/\" + GameKey + \"/player/\" + Name2 + \"/\" + SecretKey2 + \"/up\"});}\r\n\telse {$.ajax({ url: Host + \"/\" + GameKey + \"/player/\" + Name + \"/\" + SecretKey + \"/up\"});}\r\n\t\r\n}", "function Paddle(pong, config, position){\r\n \r\n this.config = config;\r\n this.width = config.width;\r\n this.height = config.height;\r\n this.x = position.x;\r\n this.y = position.y;\r\n this.pong = pong;\r\n \r\n }", "function draw() {\n pong.draw();\n\n if (pong.isStarted) {\n ball.move();\n leftPaddle.move();\n rightPaddle.move();\n } else {\n // Show paddles at startup and redraw paddles once a player won/lost actual round.\n leftPaddle.draw();\n rightPaddle.draw();\n }\n}", "function opponentPaddleMovement()\r\n{\r\n\tif(can_move){\r\n\t\t// Lerp towards the Football on the y plane\r\n\t\tpaddle2DirY = (Football.position.y - paddle2.position.y) * 0.2;\r\n\t\t\r\n\r\n\t\tif (Math.abs(paddle2DirY) <= paddleSpeed)\r\n\t\t{\t\r\n\t\t\tpaddle2.position.y += paddle2DirY;\r\n\t\t\tdaste2.position.y += paddle2DirY;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// if paddle is lerping in +ve direction\r\n\t\t\tif (paddle2DirY > paddleSpeed)\r\n\t\t\t{\r\n\t\t\t\tpaddle2.position.y += paddleSpeed;\r\n\t\t\t\tdaste2.position.y += paddleSpeed;\r\n\t\t\t}\r\n\t\t\t// if paddle is lerping in -ve direction\r\n\t\t\telse if (paddle2DirY < -paddleSpeed)\r\n\t\t\t{\r\n\t\t\t\tpaddle2.position.y -= paddleSpeed;\r\n\t\t\t\tdaste2.position.y -= paddleSpeed;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function togglePause() {\n\n ball.body.enable = ball.body.enable ? false: true;\n ball2.body.enable = ball2.body.enable ? false: true;\n\n pauseText.text === \"Pause\" ? pauseText.setText(\" Cont.\") : pauseText.setText(\"Pause\") ;\n}", "function updatePauseOverlay() {\n Engine.GetGUIObjectByName(\"pauseButton\").caption = g_Paused\n ? translate(\"Resume\")\n : translate(\"Pause\");\n Engine.GetGUIObjectByName(\"resumeMessage\").hidden = !g_Paused;\n\n Engine.GetGUIObjectByName(\"pausedByText\").hidden = !g_IsNetworked;\n Engine.GetGUIObjectByName(\"pausedByText\").caption = sprintf(\n translate(\"Paused by %(players)s\"),\n {\n players: g_PausingClients\n .map(guid => colorizePlayernameByGUID(guid))\n .join(translateWithContext(\"Separator for a list of players\", \", \"))\n }\n );\n\n Engine.GetGUIObjectByName(\"pauseOverlay\").hidden = !(\n g_Paused || g_PausingClients.length\n );\n Engine.GetGUIObjectByName(\"pauseOverlay\").onPress = g_Paused\n ? togglePause\n : function() {};\n}", "get isAway () {\n return this._isAway\n }", "updatepaddle(){\n var data = {\n \"paddle_y\" : this.paddle.getY()\n };\n this.socket.emit('updatepaddle', data);\n }", "function playAgainYes() {\n assistant.ask(\"Great! What's number on your mind?\");\n }", "pauseSong(){\n spotifyApi.pause({});\n }", "function pingCallback() {\n\n $.get('Window/ping/ ', function(response) {\n\n if (response == \"blocked\") {\n $('#block').triggerHandler('click');\n return;\n }\n\n if (response == 'dead') {\n\n alertify.alert('Sua sessão expirou, favor fazer login novamente.', function() {\n window.close();\n });\n }\n }, 'text');\n\n }", "hitPaddle() {\n this._reverseY();\n }", "function botPaddle()\r\n\t\t{\r\n\t\t\tif(paddle1Y < y && paddle1Y <= 400-paddle1YDimension)\r\n\t\t\t{\r\n\t\t\t\t//move down\r\n\t\t\t\tpaddle1Y = paddle1Y + paddleSpeed\r\n\t\t\t}\r\n\t\t\tif(paddle1Y > y && paddle1Y >= 0)\r\n\t\t\t{\r\n\t\t\t\t//move up \r\n\t\t\t\tpaddle1Y = paddle1Y - paddleSpeed\r\n\t\t\t}\r\n\t\t}", "function looper(){\n\t\tif(!vid.loop){\n\t\t\tvid.loop = true;\n\t\t\t$('#loop_video').attr('value', 'Don\\'t Loop!');\n\t\t} else{\n\t\t\tvid.loop = false;\n\t\t\t$('#loop_video').attr('value', 'Loop!');\n\t\t}\n\t}", "function moveOpponentPaddle() {\n if (opponentPaddle.y < 0 || \n opponentPaddle.y + PADDLE_HEIGHT > canvas.height) {\n opponentPaddleDY = -opponentPaddleDY;\n }\n // optional to get the paddle to chase the ball\n else if ((ballY < opponentPaddle.y && opponentPaddleDY > 0) ||\n (ballY > opponentPaddle.y + PADDLE_HEIGHT && opponentPaddleDY < 0)) {\n opponentPaddleDY = -opponentPaddleDY;\n }\n\n opponentPaddle.y += opponentPaddleDY;\n}", "function ping(websiteState) {\n websiteState.pingLoop = setTimeout(() => fetchCurrentlyPlaying(websiteState),\n websiteState.api.pingDelay);\n}", "function dislikeSong(){\n\tvar ban_song_request = \"http://developer.echonest.com/api/v4/playlist/dynamic/feedback?api_key=7VI2RLSXC4GBPF6S7&format=json&session_id=\" + session_id + \"&ban_song=last\";\n\t$.getJSON(ban_song_request + \"&_=\" + Math.floor(Math.random()*1000000), function(data) {\n\t\tif (data.response.status.message === \"Success\"){\n\t\t\tconsole.log(\"Dislike successufully\");\n\t\t\tconsole.log(data);\n\t\t}\n\t});\n}", "function playAgainNo() {\n assistant.tell(\"Oh well...Everything good has to come to an end sometime. Good bye!\");\n }", "function ping() {\n return 'pong';\n}", "Ping() {\n\t\tServer.SendMessage(\"/ping\");\n\t}", "showLoggedOff() {\n this.show('ALERT: Logged Off!', 'You are logged off of MTURK so need to log back in as soon as possible', 'loggedoff', '3alert3', true);\n }", "gameOver(gameWon) {\n const overlay = document.getElementById('overlay');\n const gameOverMessage = document.getElementById(\"game-over-message\");\n if (gameWon === false) {\n gameOverMessage.textContent = 'Sorry, better luck next time!';\n overlay.className = \"lose\";\n overlay.style.display = '';\n } else if (gameWon === true) {\n gameOverMessage.textContent = 'Great job!';\n overlay.className = \"win\";\n overlay.style.display = '';\n }\n }", "function gameOver() {\n if (leftPaddle.losses > 10 || rightPaddle.losses > 10) {\n\n gameLost = true;\n\n textAlign(CENTER);\n\n push();\n background(0);\n textSize(60);\n textFont(wordFont);\n fill(random(200,255),15,random(10,50));\n text(\"GAME OVER :C\",width/2, height/2);\n pop();\n\n push();\n textSize(20);\n textFont(wordFont);\n fill(random(200,255),15,random(10,50));\n text(\"press enter to beeoopboopbeep again\",width/2,300);\n pop();\n }\n }", "function drawPlayersPaddle() {\n\t// Paddle\n\tcolorRect(paddleX, paddleY, paddleWidth, paddleHeight, '#eee');\n\t// Center line\n\tcolorRect(paddleX + (paddleWidth / 2) - 2, canvas.height - (paddleHeight / 2), 4, paddleHeight / 2, '#333');\n}", "function playerLoses() {\n if (strictMode === \"no\") {\n document.getElementById(\"counterLabel\").innerHTML = \"Try Again!\";\n setTimeout(recallComputerTurn, 1000);\n } else if (strictMode === \"yes\") {\n document.getElementById(\"counterLabel\").innerHTML = \"Game Over!\";\n setTimeout(resetGame, 1000);\n }\n}", "function toggleYTBSP() {\n if (isNative) {\n hidenative();\n if ((/^\\/?watch$/u).test(location.pathname)) {\n player.showPeekPlayer();\n }\n } else {\n shownative();\n if ((/^\\/?watch$/u).test(location.pathname)) {\n player.showNativePlayer();\n }\n }\n}", "function ping() {\n var ping = new Audio();\n ping.src = \"audio/ping.mp3\";\n ping.play();\n }", "gameOver(gameWon){\n \t\tconst divOverlay = document.getElementById('overlay')\n\n \t\t//display the divOverlay\n \t\tdivOverlay.style.display = '';\n\n \t\t//changes the h1 message depending on the outcome of the game\n \t\tif(gameWon === true){\n \t\t\tdivOverlay.className = 'win';\n \t\t\tdivOverlay.querySelector('h1').innerText = \"By the bear of Zeus, you did it!\";\n \t\t}else{\n \t\t\tdivOverlay.className = 'lose';\n \t\t\tdivOverlay.querySelector('h1').innerText = \"Stay classy by trying again.\";\n \t\t}\n\n \t\t//Give the button on div overlay a 'Play Again?' message\n \t\tdocument.getElementById('btn__reset').innerText = 'Play Again?';\n\n\n \t}", "function draw() {\n\n\tif ((ball.x + ball.radius < paddle.x || \n\t\t ball.x - ball.radius > paddle.x + paddle.width) &&\n\t\tball.y + ball.radius > paddle.y) {\n\t\tplaying = false;\n\t\tcontext.fillStyle = \"black\";\n \t\tcontext.font = \"normal 25px Verdana\";\n \t\tcontext.textAlign = \"center\";\n \t\tcontext.fillText(\"Go outside and enjoy the sun!\", canvas.width/2, 200);\n\t}\n\n\tif (playing) {\n\t\t// Update ball location\n\t\tball.x += ball.dx;\n\t\tball.y += ball.dy;\n\t\tgetSurprise()\n\t\t// Clear the canvas\n\t\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\t\t// Draw ball and paddle\n\t\tball.draw(context);\n\t\tpaddle.draw(context);\n\t}\n}", "function endGame() {\n pongball.x = width / 2;\n pongball.y = -20;\n window.location.reload();\n}", "function showDialog()\n{\n ball.body.velocity.set(0, 0); // stop the ball\n var option = confirm(\"Play again?\\n\" +\n \"Press OK to play again\\n\" +\n \"Press Cancel to go to main menu\");\n if(option == true) // play again\n {\n location.reload();\n }\n else // go to main menu\n {\n window.location.href = \"index.html\";\n }\n}", "function longPauseGame() {\n var stopGameMesage = new GameMessage(GameMessage.StopGameMessage);\n that.connection.send(stopGameMesage);\n }", "botvbot() {\n if(this.pente.active_game) {\n this.pente.bot()\n .then(() => {\n this.board.updateBoard(this.pente.board);\n this.pente.gameover().then(r => {\n if(!r) {\n this.botvbot();\n }\n this.updateMessage();\n })\n }) \n }\n }", "function ping() {\n return \"pong\";\n}", "function endGame() {\n paddle.width = (canvas.width - rightWall.width - leftWall.width);\n paddle.x = rightWall.width;\n paddle.extent[0] = (paddle.width / 2);\n paddle.center[0] = (paddle.x + paddle.extent[0]);\n ball.velocity = ball.INITIAL_VELOCITY;\n ball.visible = true;\n ball.endGameMode = true;\n }", "unsetAway () {\n this.client.unsetAway()\n }", "function displayGameover() {\n\t$btnStart.innerHTML = \"RESTART\";\n\tif (modeGOT) {\n\t\t$txt.style.color = \"skyblue\";\n\t\t$txt.innerHTML = \"V. Morghulis\".toUpperCase();\n\t\t$gotOstMain.pause();\n\t\t$gotOstGameover.play();\n\t} else {\n\t\t$txt.style.color = \"red\";\n\t\t$txt.innerHTML = \"Oh non...\".toUpperCase();\n\t\t$ostMain.pause();\n\t\t$ostGameover.play();\n\t}\n}", "gameOver() {\n const overlay = document.getElementById('overlay');\n const message = document.querySelector('h1');\n document.querySelector('button').textContent = 'Play Again?';\n overlay.style.display = 'block';\n //If the player wins, show win phrase and overlay\n if (this.checkForWin()) {\n overlay.className = 'win';\n message.innerHTML = `You guessed the affirmation! </br>\n \"${this.activePhrase.phrase.toUpperCase()}.\" </br>\n Cultivate positive self talk by repeating this phrase to yourself often.`\n //If not, that means they lost and lose phrase and overlay is shown \n } else {\n overlay.className = 'lose';\n message.innerHTML = `Everything is impermanent, the affirmation floated away. </br> \n Better luck next time!`\n }\n this.resetGame();\n }", "play(): void {\n var message = Protocol.createMessage(\n false,\n this.clientID,\n 0,\n Protocol.PLAY\n );\n this.socket.emit('postData', JSON.stringify(message));\n }", "function pp(){\n if(config.site ==='twitch'){\n $(\".qa-pause-play-button\").click();\n } else if(config.site ==='netflix'){\n return;\n }\n else {\n if(myPlayer.paused){\n myPlayer.play();\n } else {\n myPlayer.pause();\n }\n }\n log(\"play/pause triggered\");\n}", "function pIngPong(i) {\n if (i % 15 === 0){\n return \"PingPong\" //if the number is divisible by 15, print out a range and include PingPong\n } else if(i % 5 === 0){\n return (\"<li>'Pong’</li>\"); //if function is divisible by 5, print out a range and include Pong\n } else if (i % 3 === 0){\n return (\"<li>‘Ping’</li>\"); //if function is divisible by 3, print out a range and include Ping\n } else if {\n return i;\n }\n}", "function displayPing(message, pingMessage) {\n message.channel.send(Tools.setupDefaultEmbed().setDescription(pingMessage)).then(msg => {\n let pingValue = calculateTimeDifferenceBetweenTwoMessages(message, msg);\n msg.edit(Tools.setupDefaultEmbed().setDescription(pingMessage + \" | \" + pingValue + \" ms\"));\n })\n\n}", "checkInput(player, ball) {\n\t\tswitch (player.id) {\n\t\t\tcase 1: // Linker speler (Mens)\n\t\t\t\tplayer.velocity.y = 0;\n\t\t\t\tplayer.velocity.y += this.keys[38] === true ? -400 : 0;\n\t\t\t\tplayer.velocity.y += this.keys[40] === true ? 400 : 0;\n\t\t\t\tbreak;\n\t\t\tcase 2: // Rechter speler (Ai)\n\t\t\t\tif (player.locked) {\n\t\t\t\t\tif (--player.stickyFrames === 0) {\n\t\t\t\t\t\tplayer.velocity.y = 0;\n\t\t\t\t\t\tplayer.locked = false;\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tplayer.velocity.y = 0;\n\t\t\t\t\tplayer.velocity.y += ball.position.y < player.top ? -400 : 0;\n\t\t\t\t\tplayer.velocity.y += ball.position.y > player.bottom ? 400 : 0;\n\t\t\t\t\tplayer.stickyFrames = getRandomNumBetween(5, 20);\n\t\t\t\t\tplayer.locked = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}", "function ping(){var value=+new Date;primus.timers.clear(\"ping\");primus._write(\"primus::ping::\"+value);primus.emit(\"outgoing::ping\",value);primus.timers.setTimeout(\"pong\",pong,primus.options.pong)}", "function ballPaddleCollision() {\n if (ball.x < paddle.x + paddle.width && ball.x > paddle.x && paddle.y < paddle.y + paddle.height && ball.y > paddle.y) {\n\n // JOUER LE SON\n PADDLE_HIT.play();\n\n // CHECK WHERE THE BALL HIT THE PADDLE\n let collidePoint = ball.x - (paddle.x + paddle.width / 2);\n\n // NORMALIZE THE VALUES\n collidePoint = collidePoint / (paddle.width / 2);\n\n // CALCULATE THE ANGLE OF THE BALL\n let angle = collidePoint * Math.PI / 3;\n\n\n ball.dx = ball.speed * Math.sin(angle);\n ball.dy = -ball.speed * Math.cos(angle);\n }\n}", "function getServerOTP() {\n var authnData = {\n \"authId\": AUTH_ID,\n \"hint\": \"GET_SERVER_OTP\" //dont change this value.\n };\n authenticate(authnData);\n}", "set isAway (value) {\n this._isAway = value\n /**\n * @event IrcUser#isAway\n */\n this.emit('isAway')\n }", "function pingsong(duration, display, type, id) {\n id = id.trim();\n clearInterval(interval_pingsong);\n var start = Date.now(),\n diff,\n minutes,\n seconds;\n interval_pingsong = \"\";\n function timer() {\n // get the number of seconds that have elapsed since \n // startTimer() was called\n diff = duration - (((Date.now() - start) / 1000) | 0);\n current_song_time_left = current_song_time_left -1;\n // does the same job as parseInt truncates the float\n minutes = (diff / 60) | 0;\n seconds = (diff % 60) | 0;\n\n minutes = minutes < 10 ? \"0\" + minutes : minutes;\n seconds = seconds < 10 ? \"0\" + seconds : seconds;\n if(type == \"conversation\")\n {\n display.textContent = minutes + \":\" + seconds; \n if (diff%3 ==0 && diff != 0) {\n \n $.post( \"/pingsong_conversation.json?id=\" + id, function( data ) {\n if (data.html != \"\")\n {\n if(data.html.indexOf(\"join conversation\") != -1)\n {\n if($('.user_join').length <=0)\n {\n var user_join = \"<center><div class='user_join text-success'>\" + data.html + \"</div>\";\n\n $(user_join).appendTo('.messages').slideDown();\n $('.chat-wrapper').scrollTop($('.messages').height());\n } \n }\n else if($('.user_has_left').length <= 0)\n {\n var user_has_left = \"<center><div class='user_has_left text-danger'><strong>\" + data.html +\"</strong> has left</div></ center>\";\n\n $(user_has_left).appendTo('.messages').slideDown();\n $('.chat-wrapper').scrollTop($('.messages').height());\n } \n }\n });\n\n $.post( \"/get_new_song.json?id=\" + id, function( data ) {\n if (data.html != \"\")\n {\n for (i = 0; i < data.html.length; i++) { \n var minutes = ~~(data.html[i].length/60)\n var seconds = data.html[i].length %60\n var newsong = \"<li class='next-song'><div class='next-song-time'> \" +minutes + \":\" + seconds + \"</div> <div class='next-song-name'>\" + data.html[i].name + \" </div><div class='next-song-id'>\"+ data.html[i].utubeid + \"</div></li>\";\n var current_time_left = $(\"#timeleft\").text();\n var total_second_left = parseInt(current_time_left.split(':')[0]) *60 + parseInt(current_time_left.split(':')[1]);\n total_second_left = total_second_left + parseInt(data.html[i].length);\n display = document.querySelector('#timeleft');\n var converid = $(\"#current_song\").text();\n\n pingsong(total_second_left, display, \"conversation\", converid);\n\n $(newsong).appendTo('.songlist');\n\n var current_time_left = $(\"#timeleft\").text();\n var total_second_left = parseInt(current_time_left.split(':')[0]) *60 + parseInt(current_time_left.split(':')[1]);\n total_second_left = total_second_left + parseInt(data.html[i].length);\n display = document.querySelector('#timeleft');\n var converid = $(\"#current_song\").text();\n\n pingsong(total_second_left, display, \"conversation\", converid);\n \n }\n }\n });\n\n \n } \n if (minutes == 00 && seconds ==15){\n var time_say_bye = \"<center><div style='max-width: 300px' class='time_say_bye text-danger text-inline'>15s left, time to say goobye forever'</div></center>\"\n $(time_say_bye).appendTo('.messages').slideDown();\n $('.chat-wrapper').scrollTop($('.messages').height());\n }\n if (current_song_time_left <=0) \n {\n playlist = $('.next-song');\n if(playlist.length >0)\n {\n $('.next-song').eq(0).slideUp();\n $('.next-song').eq(0).remove();\n current_time_left = $(\"#timeleft\").text();\n next_song_time = $('.next-song-time').eq(0).text().trim();\n current_song_time_left = parseInt(next_song_time.split(':')[0]) *60 + parseInt(next_song_time.split(':')[1]);\n next_song_utubeid = $('.next-song-id').eq(0).text();\n document.getElementById('iframe_video').src = \"http://www.youtube.com/embed/\" + next_song_utubeid + \"?autoplay=1&cc_load_policy=1&fs=0\"; \n $('.next-song').eq(0).addClass(\"active-song\")\n \n }\n\n }\n if (diff <= 0) {\n // add one second so that the count down starts at the full duration\n // example 05:00 not 04:59\n // start = Date.now() + 1000;\n display.textContent = \"00:00\"; \n $(\".time_say_bye\").remove();\n $('#new_message').hide();\n $('#btn-add-song').hide();\n \n if($('.conversation_over').length <= 0)\n {\n var conversation_over = \"<center><div class='conversation_over text-info'>End</div></ center>\";\n $(conversation_over).appendTo('.messages').slideDown();\n $('.chat-wrapper').scrollTop($('.messages').height());\n }\n clearInterval(interval_pingsong);\n }\n }\n else if(type == \"song\")\n {\n if (diff%2 ==0 && diff != 0 ) \n {\n $.post( \"/pingsong.json?id=\" + id, function( data ) {\n if (data.html != \"\" && !$(\"#conversation-modal\").is(':visible'))\n {\n\n var go_Conversation = document.getElementById(\"go_conversation\");\n go_Conversation.setAttribute(\"href\", \"/conversations/\" + data.html);\n\n // var go_Conversation = document.getElementById(\"cancel_conversation\");\n // go_Conversation.setAttribute(\"href\", \".conversations/cancel\");\n $(\"#conversation-modal\").modal({show: true});\n }\n });\n }\n if(diff <=0)\n {\n clearInterval(interval_pingsong);\n }\n }\n };\n // we don't want to wait a full second before the timer starts\n \n window.onbeforeunload = function() {\n console.log('window.onbeforeunload');\n clearInterval(interval_pingsong);\n }\n $(document).on('page:before-unload', function(event) {\n //alert('hello turbolink');\n console.log('page:before-unload');\n clearInterval(interval_pingsong);\n });\n interval_pingsong = setInterval(timer, 1000);\n \n\n }", "function sendToServer_pause() {\r\n socket.emit('control', {\r\n 'room': ROOM_ID,\r\n 'username': USER,\r\n 'category': PAUSE,\r\n 'playtime': audio.currentTime\r\n });\r\n}", "setGameOver() {\n if (!this.isGameOver) {\n this.isGameOver = true;\n stopSong();\n playGameOver();\n }\n }", "toggle() {\n const maxRounds = this.state.maxRounds;\n // eslint-disable-next-line\n this.state.round == maxRounds ? this.endSession() : this.break();\n }", "function isLoser() {\n // if the numGuessesRemaining is 0 then -1 numLosses and switch isFinished to true\n if(numGuessesRemaining <= 0) {\n numLosses++;\n isFinished = true;\n //play the loser gif\n document.getElementById(\"giphy-embed\").src = \"https://giphy.com/embed/bBPKIt6h9yCcw\";\n document.getElementById(\"numLosses\").style.color = \"#e12d2e\";\n playAudio();\n }\n \n\n}", "function gameLose() {\n //Says \"Game over\", displays score, and allows user to click screen to play again.\n background(0);\n textSize(32);\n text(\"GAME OVER\", 100, 200);\n text(\"Score: \", 100, 300);\n text(gameScore, 300, 300);\n text(\"Click mouse to play again!\", 100, 500);\n\n\n //help to isolate the ball.\n myBall.x = -10;\n myBall.y = -10;\n myBall.vx = 0;\n myBall.vy = 0;\n}", "function pollGamepads() {\n\t\t\tvar gamepads = navigator.getGamepads();\n\t\t\tmsg = String((gamepads[0].axes[0] - rest).toFixed(3)) + String((gamepads[0].axes[2] - rest).toFixed(3)) + String((gamepads[0].axes[1] - rest).toFixed(3)) + \"0.000\" + \"0.000\" + String((gamepads[0].axes[3] - rest).toFixed(3)) + \"?\";\n\t\t\t//console.log(msg);\n\t\t\tsocket.emit('send',msg);\n\t\t}", "function winLose() {\n\t\tvar ul = $('.pastGuess').eq(guessLog);\n\t\tvar cloud = '-='+50*turn;\n\t\tif(correct === 5) {\n\t\t\tsetTimeout(function() {\n\t\t\t\t$('.win').removeClass('disable');\n\t\t\t\t$('body').css('backgroundColor', 'rgb(69, 130, 166)');\n\t\t\t\t$(ul).children().css('backgroundColor', 'transparent');\n\t\t\t\t$('#glowcloud').addClass('disable');\n\t\t\t}, 3000);\n\t\t} else if (turn === 5 && user.toString() != computer.toString()) {\n\t\t\tsetTimeout(function() {\n\t\t\t\t$('.lose').removeClass('disable');\n\t\t\t\t$('body').css('backgroundColor', '#000000;')\n\t\t\t\t}, 3000);\n\t\t\t}\n\n\t}", "go() {\n if (game.pause===true) {\n game.message = '';\n game.pause=false;\n game.generateEntities(false,true);\n game.autoMove();\n console.log('Game Status: ', game.status());\n }\n }", "function handleVoteSkip() {\n if (currentSong) {\n const vote = !voteSkip;\n setVoteSkip((v) => !v);\n const payload = {\n roomID: currentRoom._id,\n password: currentRoom.password,\n voteType: \"skip\",\n vote: vote,\n song: currentSong,\n };\n socket.emit(\"Vote\", payload);\n } else {\n setDisplayNoCurrentSongAlert(true);\n setTimeout(() => setDisplayNoCurrentSongAlert(false), 2000);\n }\n }", "function Restart()\n {\n paddle.x = 10;\n paddle.y = 0;\n paddle2.x = 400;\n paddle2.y = 291;\n ball.speedX = 1;\n ball.speedY = 1;\n ball.x = 210;\n ball.y = 210;\n BallStartPosition()\n console.log(\"New Game\");\n }", "function PendingPlayerState() { }", "#determineIfGameOver() {\n const p1victory = this.players[1].gameboard.allShipsSunk();\n const p2victory = this.players[0].gameboard.allShipsSunk();\n \n if (p1victory) {\n this.#page.setDialog(GAME_STATE.p1victory);\n this.#isWinnerP1 = true;\n } else if (p2victory) {\n this.#page.setDialog(GAME_STATE.p2victory);\n this.#isWinnerP1 = false;\n }\n\n if (p1victory || p2victory) {\n this.#gameOver = true;\n this.#endGame();\n }\n }", "function draw() {\n backgroundGradient();\n\n leftPaddle.handleInput();\n rightPaddle.handleInput();\n\n ball.update();\n leftPaddle.update();\n rightPaddle.update();\n\n if (ball.isOffScreen()) {\n ball.reset();\n }\n\n ball.handleBallPaddleCollision(leftPaddle);\n ball.handleBallPaddleCollision(rightPaddle);\n\n ball.display();\n leftPaddle.display();\n rightPaddle.display();\n ball.determineWinner();\n}", "function lost(){\n pause();\n playing = false;\n lose = true;\n setHighscore();\n html('rows','Game Over')\n }", "function sendNowPlaying() {\n if (isIgnoreLastFm(song.info)) return;\n lastfm.track.updateNowPlaying(getSongLastFmParams(), {\n success: function() { GA.event(GA_CAT_LASTFM, \"NowPlayingOK\"); },\n error: function(code) {\n console.warn(\"Error on now playing '\" + song.info.title + \"': \" + code);\n GA.event(GA_CAT_LASTFM, \"NowPlayingError-\" + code);\n }\n });\n }", "function drawPaddle() {\n\t\tctx.beginPath();\n\t\tctx.rect(paddle.x, paddle.y, paddle.w, paddle.h);\n\t\tctx.fillStyle = '#555';\n\t\tctx.fill();\n\t\tctx.closePath();\n\t}", "playerLoses() {\n this.roundEnds('LOSER');\n }", "function pot(extraLives) {\n view.fadeOut();\n\n ws.send(JSON.stringify({\n type: \"pot\",\n extraLives: extraLives\n }));\n }", "function togglePause() {\n isGamePaused = !isGamePaused;\n }", "function gameOver() {\n\tctx.fillStlye = \"white\";\n\tctx.font = \"20px Arial, sans-serif\";\n\tctx.textAlign = \"center\";\n\tctx.textBaseline = \"middle\";\n\n\tvar playerWinner = (score_jugadores[0] > score_jugadores[1])?\"P1\":\"P2\";\n\tplayerWinner += \" wins!!!\";\n\tvar messageGame = \"\";\n\tif(usuario_id === -1)\n\t\tmessageGame = playerWinner;\n\telse\n\t\tmessageGame = playerWinner +\" - Game Over - You scored \"+score_jugadores[usuario_id -1]+\" points!\"\n\tctx.fillText( messageGame , W/2, H/2 + 25 );\n\t\n\t// Stop the Animation\n\t\t\n\tvar playPromise = perder.play();\n\n\t if (playPromise !== undefined) {\n\t playPromise.then(_ => {\n\t perder.pause();\n\t })\n\t .catch(error => {\n\t // Auto-play was prevented\n\t // Show paused UI.\n\t console.log(\"Error...\");\n\t });\n\t }\n\tcancelRequestAnimFrame(init);\n\t\n\n\t// Set the over flag\n\tover = 1;\n\t\n\t// Show the restart button\n\tif(usuario_id !== -1)\n\t\trestartBtn.draw();\n}", "function longBeep() {\n beep (220, 200)\n}", "function playAgain () {\n var yesno = prompt(\"Would you like to play again: Yes/No Y/N\")\n if (yesno.toLowerCase() === \"yes\" || yesno.toLowerCase() === \"y\") {\n location.reload(true);\n }\n}" ]
[ "0.7041321", "0.69286495", "0.6809028", "0.6798936", "0.6554113", "0.640804", "0.58560777", "0.5795214", "0.57801706", "0.56441015", "0.5631033", "0.56156516", "0.5552069", "0.5540989", "0.5497749", "0.5458213", "0.5425959", "0.541008", "0.53341025", "0.5325144", "0.52942973", "0.528575", "0.523927", "0.5202337", "0.51947796", "0.5192228", "0.5095437", "0.50883985", "0.5080591", "0.50785446", "0.5075461", "0.505102", "0.50420517", "0.4984092", "0.49804515", "0.49446487", "0.49300697", "0.49186912", "0.49028134", "0.48875508", "0.48862633", "0.486904", "0.48637325", "0.48574632", "0.4852974", "0.48525032", "0.48407272", "0.48241135", "0.4823573", "0.4819736", "0.48129988", "0.47989944", "0.47927174", "0.47903952", "0.47858927", "0.47667083", "0.47634113", "0.47561508", "0.47459364", "0.4742748", "0.4741395", "0.4736871", "0.47322747", "0.4731415", "0.4730825", "0.4722892", "0.47126716", "0.47060022", "0.46951512", "0.46933785", "0.46853024", "0.468128", "0.46671492", "0.4658749", "0.4648671", "0.46451908", "0.46441162", "0.46380967", "0.46379656", "0.46370953", "0.4635969", "0.46303853", "0.46179673", "0.46177414", "0.46175173", "0.46145138", "0.46127167", "0.46093342", "0.4607026", "0.45972097", "0.45949137", "0.45929635", "0.4591776", "0.45881024", "0.4580735", "0.45779312", "0.4577634", "0.45656723", "0.4564264", "0.45583305" ]
0.53205335
20
Handler for internal server errors
function errorHandler(err, req, res, next) { console.error(err.message) console.error(err.stack) res.status(500).render('error_template', { error: err }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function erroHandler(err, request, response, next) {\n response.status(500).send(\"Server Error! Please Try again later!!\");\n}", "function ErrorHandler() {}", "static serverError(message, res) {\n res.writeHead(500, {'Content-Type': 'text/html'});\n res.write(message);\n res.end();\n }", "function errorHandler(error, request, response) {\n response.status(500).send(error);\n}", "function errorHandler(error, request, response) {\n response.status(500).send(error);\n}", "onError( error, request, response ) {\n\n\t\tconsole.log( chalk.red.bold( \"Global Error Handler:\" ) );\n\t\tconsole.log( error );\n\n\t\t// If the headers have already been sent, it's too late to adjust the output, so\n\t\t// just end the response so it doesn't hang.\n\t\tif ( response.headersSent ) {\n\n\t\t\treturn( response.end() );\n\n\t\t}\n\n\t\t// Render the not found error page.\n\t\tif ( error.message === \"Not Found\" ) {\n\n\t\t\tresponse.status( 404 );\n\t\t\tresponse.setView( \"common:error.notfound\" );\n\n\t\t} else {\n\n\t\t\t// Render the fatal error page.\n\t\t\tresponse.rc.title = \"Server Error\";\n\t\t\tresponse.rc.description = \"An unexpected error occurred. Our team is looking into it.\";\n\t\t\tresponse.status( 500 );\n\t\t\tresponse.setView( \"common:error.fatal\" );\n\n\t\t}\n\t\t\n\t}", "function errorHandler(err, req, res) {\n res.status(500).send(err);\n }", "function errorHandler (error, request, response, next) {\n const message = error ? error.message : 'Ha ocurrido un error interno del servidor'\n\n response\n .status(HttpStatus.INTERNAL_SERVER_ERROR)\n .json({ message })\n}", "function errorHandler (err, req, res, next) {\n\tif(req.ws){\n\t\tconsole.error(\"ERROR from WS route - \", err);\n\t} else {\n\t\tconsole.error(err);\n\t\tres.setHeader('Content-Type', 'text/plain');\n\t\tres.status(500).send(err.stack);\n\t}\n}", "function handleError(err){\n\tconsole.log(`Request failed: ${err}`);\n}", "function handle_error(error) {\n console.log(\"Error from server\", error);\n}", "_handleRequestError(err, request, response) {\n\t\tconst url_parts = url.parse(request.url, true);\n\t\tlet payload = '';\n\n\t\tif (!!request.post) payload = request.post.Value;\n\n\t\tthis._requestslog('error', err.message, { error: err, client: url_parts, payload: payload });\n\n\t\tresponse.writeHead(err.code, { 'Content-Type': 'text/plain' });\n\t\tresponse.write(err.message);\n\t\tresponse.end();\n\t}", "function handleError(err, req, res, next) {\n console.error(err.stack)\n res.status(500).json({err: err.message})\n }", "function _handleErrors(e, res){\n console.log('Error', e.name, e.message);\n if (e.name === 'MethodNotAllowedError') {\n // Method not allowed\n res.writeHead(405, {'Content-Type': 'text/plain'});\n res.write(e + '\\n');\n res.end();\n } else if (e.name === 'FileNotFoundError') {\n // File not found\n res.writeHead(404, {'Content-Type': 'text/plain'});\n res.write(e + '\\n');\n res.end();\n } else if (e.name === 'UnprocessableEntityError') {\n // Unprocessable entity\n let html = HtmlGen.getNoPostVarHtml(e.message);\n res.writeHead(422, {'Content-Type': 'text/html'});\n res.write(html);\n res.end();\n } else if (e.name === 'EntityTooLargeError') {\n // Request entity too large\n res.writeHead(413, {'Content-Type': 'text/plain'});\n res.write(e + '\\n');\n res.end();\n req.connection.destroy();\n }\n else {\n // All other errors\n res.writeHead(500, { 'Content-Type': 'text/plain' });\n res.write(e + '\\n');\n res.end();\n }\n}", "function errorHandler(err, req, res, next) {\n res.status(500).send('Error!\\n\\n' + err.stack)\n}", "function handleError(err, res) {\r\n console.error(err);\r\n if (res) res.status(500).send('⚠︎ So terriably sorry, something has gone very wrong and you should turn back. Now. ⚠');\r\n}", "function error(err) {\n res.statusCode = err.status || 500;\n res.end(err.message);\n }", "function handleError(err, res) {\r\n console.error(err);\r\n if (res) res.status(500).send('Sorry, something went wrong');\r\n}", "function errorHandler(error, req, res, next) {\n console.log(\"\\n\" + JSON.stringify(error, null, 2) + \"\\n\");\n res.status(500).end();\n}", "serverInternalError () {\n const serverErrors = this.root.querySelector('.js-store-errors');\n serverErrors.innerHTML = 'Упс! Сервер устал, подождите и попробуйте заново!';\n }", "function handleError(err, req, res) {\n logService.log(`${err}`, \"error\");\n \n const statusCode = err.statusCode || 500;\n const errorMessage = err.message || \"Internal Server Error\";\n\n res.writeHead(statusCode, errorMessage, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ error: errorMessage }));\n}", "handle (error, { response }) {\n return response.status(500).json({\n status : 'InternalServerError',\n data: null,\n error: 'Internal Server Error'\n })\n }", "error_handler(err) {\n console.log(`Problem encountered. Detail:${err.message}`);\n }", "function handleError(err){\n console.log(`Request failed: ${err}`)\n}", "$errorHandler(e, url, config, request) {\r\n if (e instanceof ResponseError) {\r\n throw e;\r\n }\r\n else {\r\n // Network error!\r\n throw new ResponseError('Unkown Error: ', ResponseErrors.UnknownError, e, {\r\n url, config, request\r\n });\r\n }\r\n }", "handleAppErrors() {\r\n this.app.on('error', (err, ctx) => {\r\n logger.error(`Application Error: ${ err.name } @ ${ ctx.method }:${ ctx.url }`);\r\n logger.error(err.stack);\r\n });\r\n }", "function errorHandler(err, req, res, next) {\n console.error(`Error: ${err.stack}`);\n res.status(err.response ? err.response.status : 500);\n res.json({ error: err.message });\n}", "function errorHandler(err, req, res, next) {\n if (res.headersSent) {\n return next(err);\n }\n console.error(\"errorHandler\", err);\n res.status(500).send({ errors: `Error running your code. ${err}` });\n}", "function productionErrorHandler(err, req, res, next) {\n res.status(err.status || 500);\n res.json({\n message: err.message,\n error: {}\n });\n}", "function errorHandler(err, req, res, next) {\n const statusCode = res.statusCode !== 200 ? res.statusCode : 500;\n console.log('You have reached the error handler', err.message);\n res.status(statusCode);\n res.json({\n message: err.message,\n stack: process.env.NODE_ENV === 'production' ? 'stack' : err.stack\n });\n}", "function errorHandler(err, req, res, next) {\n console.error(err.message);\n console.error(err.stack);\n res.status(500).render('error_template', { error: err });\n }", "function clientErrorHandler(err, req, res, next) {\n if (req.xhr) {\n res.status(err.status || 500).send({ error: 'Something blew up!' });\n } else {\n next(err);\n }\n}", "errorPageHandler(err, req, res, next) {\n res.status(500);\n res.render('error', {error: err.stack});\n }", "function devolverError(err) {\n res.header('Connection', 'close');\n res.status = 500;\n res.writeHead(500, { \"Content-Type\": \"application/json\" });\n res.write(JSON.stringify({ status: err.codError, descStatus: err.message }));\n res.end();\n }", "function errorHandler(err, req, res) {\n res.status(err.status || 500).send(`\n <h1>${ err.message }</h1>\n <h2>${ err.status }</h2>\n <pre>${ err.stack }</pre>\n `);\n}", "function errorHandler(err, req, res, next) {\n res.status(500);\n res.render('error', { error: err });\n}", "function errorHandler (data, status) {\n $log.error('Failed to get %s with, error code %s', url, status);\n }", "_errorHandling(res, err){\n res.locals.message = err.message;\n res.locals.status = err.status || 500;\n \n res.status(err.status || 500);\n res.render('error');\n }", "function errorHandler(error, req, res, next) {\n res.status(400).send(\"Bad panda!\");\n}", "function handleError(err, res) {\r\n console.error(err);\r\n if (res) res.status(500).send('sorry, something broke');\r\n}", "exceptionHandler() {\n this.server.use(async (err, req, res, _next) => {\n if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {\n const errors = await new Youch(err, req).toJSON();\n return res.status(500).json(errors);\n }\n\n return res.status(500).json({ error: 'Internal server error' });\n });\n }", "function handle500(err, req, res) {\n res.status(err.status || 500);\n var csrftokenizer = (csrf())(req, res, function(err) {\n // error doesn't matter since we're sending an error page\n res.locals.csrftoken = req.csrfToken();\n var serverTime = moment().utc().format('YYYY MMMM D, h:mm:ss A ZZ');\n res.render('error', {\n errorMsg: err.message || 'Internal Server Error',\n serverTime: serverTime,\n browsePrefix: req.browsePrefix,\n user: req.user\n });\n });\n}", "function errorHandler(err, req, res, next) {\n logger.error(err);\n\n res.status(err.status || httpStatus.INTERNAL_SERVER_ERROR);\n\n res.json({\n message: err.message,\n error: process.env.NODE_ENV === 'development' ? err : {},\n });\n}", "function errorHandler(err, req,res, next)\r\n{\r\nconsole.error(err.message);\r\nconsole.error(err.stack);\r\nres.status(500);\r\nres.render('error',{message:err});\r\n}", "function handleError(res, err) {\n console.error(err);\n return res.status(500).send(\"server error\");\n}", "function handleError(res, err) {\n console.error(err);\n return res.status(500).send(\"server error\");\n}", "setErrorRoutes() {\n this.app.use((err, req, res, next) => {\n // pass error if headers already sent.\n if (res.headersSent) {\n return next(err);\n }\n\n // TODO: change behaviour via plugins (parse & log error instead of revealing to front-end).\n res.status(500).json({\n err: new AppError({\n type: 'Applicaion.ErrorRoute',\n message: 'Server error. Contact server administrator.',\n detal: err.message,\n extendedInfo: err.stack,\n errorCode: err.code\n })\n });\n });\n }", "function errorHandler (error) {\n console.error(error)\n throw new Error('Failed at server side')\n}", "function errorHandler(err, req, res, next) {\n console.error(err.message);\n console.error(err.stack);\n res.status(500).render('error_template', { error: err });\n}", "function errorHandler(error, request, response, next) {\n console.error(error.message);\n console.error(error.stack);\n response.status(500).render('error_template', { error: error });\n}", "function serviceClientErrorHandler(err, req, res, next) {\n\tif (req.xhr) {\n\t\treq.soajs.log.error(core.error.generate(150));\n\t\tres.status(500).send(req.soajs.buildResponse(core.error.getError(150)));\n\t} else {\n\t\treturn next(err);\n\t}\n}", "function errorHandler(data) {\n\t\tvar server = data.url.split(\"=\")[1];\n\t\tif(assocList.hasOwnProperty(server)) {\n\t\t\tvar metric = assocList[server];\n\t\t\tif(window.location.protocol == data.url.split(\":\")[0]+\":\"){\n\t\t\t\tvar url = \"/getStatus\";\n\t\t\t\tvar serverURL = getHttpConnString(metric);\n\t\t\t\tserverURL += \"://\"+metric.host+\":\"+metric.port+\"/healthinfo\"\n\t\t\t\tvar params = {\"server\":server,\"url\":serverURL};\n\t\t\t\tvar callerId = server+\"_getstatus\";\n\t\t\t\treqManager.sendPost(callerId, url, params, getStatusSuccessHandler, getStatusErrorHandler, null);\n\t\t\t} else {\n\t\t\t\tvar final = $.extend({}, assocList[server], {DbStatus :\"UNREACHiABLE\",Status:false});\n\t\t\t\tvar alertObj = $(\"#\"+server).find(\".cluster-alert\");\n\t\t\t\tassocList[server] = final;\n\t\t\t\tupdateHealthInfo(final);\n\t\t\t\talertObj.text(\"!\");\n\t\t\t\talertObj.addClass(\"alertNotifier\");\n\t\t\t\talertObj.attr(\"title\",\"This cluster requesting to load HTTP content from secured tunnel:Mixed content prasent. To allow access disable protection for this multiCluster site.\");\n\t\t\t}\n\t\t}\n\t}", "function request_error_handler(error, script_name)\n{\n\t// Handle individual errors here.\n\tif ( error == 'db_connect' )\n\t\talert('ERROR: Could not process request at this time. Database unavailable.');\n\telse if ( error == 'script_not_found' )\n\t\talert('ERROR: The script specified to handle this request does not exist.');\n\telse if ( error == 'login_required' )\n\t\talert('ERROR: Your session has timed out. Please log in again.');\n\telse if ( error == 'dirty_script_name' )\n\t\talert('ERROR: Invalid characters in script name: '+ script_name);\n\telse if ( error == 'AJAX_failed' )\n\t\talert('ERROR: The AJAX request could not be completed: '+ script_name);\n\telse\n\t\talert('ERROR: '+ error);\n}", "configureErrorBoundary(err, _, res, next) {\n const statusCode = err.statusCode || 500;\n const message = err.message || \"Internal Server Error\";\n\n res.status(statusCode).json({ message, statusCode });\n console.log(err.stack);\n next();\n }", "function errorHandler(err, req, res, next) {\n logger.error(err);\n res.status(err.statusCode || 500).send({\n error: err.message\n });\n}", "function generalHandler(error) {\n // TODO - Handle variety of errors properly.\n console.log(error);\n\n if ($.isEmptyObject(error.errorMsg)) {\n Notification.notifyFailure('INTERNAL_ERROR');\n }\n else {\n Notification.notifyFailure(error.errorMsg, error.prefix, error.suffix);\n }\n\n Status.resetStatus();\n\n return $q.reject('Internal error');\n }", "function commonErrorHandler (err) {\n console.log(err); \n resetToLibraryIndexPage();\n }", "function errorHandler(err, req, res, next) {\n console.log(err.message);\n console.log(err.stack);\n res.status(500).render('error_template', { error: err });\n}", "function developmentErrorHandler(err, req, res, next) {\n res.status(err.status || 500);\n res.json({\n message: err.message,\n error: err\n });\n}", "function internalServerError(err) {\n console.log(\"err:\", err.response.data);\n if (err.response && err.response.data && err.response.data.errorMessage) {\n return {\n status: false,\n errorMessage: err.response.data.errorMessage,\n };\n } else\n return {\n status: false,\n errorMessage: \"Internal server error. Please check your server\",\n };\n}", "handleErrorDesigned(error) {\n\n const response = error.response;\n\n // catch 4xx and 5xx status codes\n\n if (response && !!`${response.status}`.match(/^[4|5]\\d{2}$/)) {\n if (response.data.status) {\n this.setState({errorMessageError: response.data.message})\n } else {\n this.setState({errorMessageError: response.data})\n }\n } else {\n if (error.message.match(/Network Error/)) {\n alert('The server cannot be reached. Did you start it?');\n }\n console.log('Something else happened.', error);\n }\n }", "function error( error, res ) {\n\tif ( error ) {\n\t\tres.status( 500 ).type( 'text/plain' );\n\t\tres.end( error.message );\n\t\tconsole.log( error.stackTrace );\n\t}\n}", "function logRequestError(err) {\n\n\tvar {response} = err;\n\tif (!response) {\n\t\tlogger.warning(`TritonAgent raised exception for URL ${this._urlPath}`, err);\n\t} else if (response.notFound) {\n\t\t// 404? don't care about response\n\t\tlogger.warning(`Resource not found on server: ${this._urlPath}`);\n\t} else if (response.serverError) {\n\t\tlogger.warning(`Received server error for URL ${this._urlPath}`, err);\n\t} else {\n\t\tlogger.warning(`Unexpected status code returned for URL ${this._urlPath}`, err);\n\t}\n}", "handleError(error) {\n throw error.response.data;\n }", "function internalServerError(err) {\n console.log(\"err:\", err.response.data);\n if (err.response && err.response.data && err.response.data.errorMessage) {\n return {\n status: false,\n errorMessage: err.response.data.errorMessage,\n };\n }\n return {\n status: false,\n errorMessage: \"Internal server error. Please check your server\",\n };\n}", "function internalServerError(err) {\n console.log(\"err:\", err.response.data);\n if (err.response && err.response.data && err.response.data.errorMessage) {\n return {\n status: false,\n errorMessage: err.response.data.errorMessage,\n };\n }\n return {\n status: false,\n errorMessage: \"Internal server error. Please check your server\",\n };\n}", "onRequestError(err) {\n log('request error', err)\n this.emit('error', err)\n if (err.status === 401) this.onUnauthorized()\n else this.reopen()\n }", "function onErrorRequest(error) {\r\n\t\t\tconsole.log(\"err [\" + error.name + \"] msg[\" + error.message + \"]\");\r\n\t\t}", "function errorhandler(jqXHR) {\r\n\t\tif(jqXHR.status !== null && jqXHR.status == 403)\r\n\t\t{\r\n\t\t\ttest.log(\"error_server_error_403\");\r\n\t\t}\r\n\t\telse if(jqXHR.status !== null && jqXHR.status == 401)\r\n\t\t{\r\n\t\t\ttest.log(\"error_password_or_login_not_correct\");\r\n\t\t}\r\n\t\telse if(jqXHR.status !== null && jqXHR.status == 400)\r\n\t\t{\r\n\t\t\ttest.log(\"error_server_error_400\");\r\n\t\t}\r\n\t\telse if(jqXHR.status !== null && jqXHR.status == 404)\r\n\t\t{\r\n\t\t\ttest.log(\"error_server_error_404\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ttest.log(\"error_server_error\");\r\n\t\t}\r\n\t}", "function handleError(_e,_xhr,_custom) {\n\t\t\tif (_custom) {\n\t\t\t\t_custom(e,xhr);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tTi.API.error('Error: '+JSON.stringify(_e)+'\\nServer response: '+_xhr.responseText);\n\t\t\t\tapp.ui.alert(L('error'), L('error_general'));\n\t\t\t\tTi.App.fireEvent('app:hide.loader');\n\t\t\t}\n\t\t}", "function errHandler(err) {\n console.error('There was an error performing the operation');\n console.log(err);\n console.log(err.code);\n console.error(err.message);\n}", "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason)\n res.status(code || 500).json({\"error\": message})\n }", "function handleError( res, reason, message, code ) {\n\tconsole.log( 'ERROR: ' + reason );\n\tres.status( code || 500 ).json({ error: message });\n}", "function onFailure(err) {\n onTimelyResponse(spec.code);\n Object(__WEBPACK_IMPORTED_MODULE_11__utils_js__[\"logError\"])(\"Server call for \".concat(spec.code, \" failed: \").concat(err, \". Continuing without bids.\"));\n onResponse();\n }", "static handler1() {\n let res = CGIError.config.res\n res.header('Status', CGIError.config.status)\n res.respondWith(CGIError.config.safeMessage)\n }", "function errHandler(err) {\n console.error('There was an error performing the operation');\n console.log(err);\n console.log(err.code);\n console.error(err.message);\n}", "function handelError(res) {\n return err => {\n //log error\n console.log(err)\n // let user know we messed up\n res.status(500).render(\"pages/error\", { err: err });\n };\n}", "function logoutErrorHandler(data,status,response){\n\t\tconsole.log(\"Logout Error\");\n\t}", "handleErrors(response) {\n this.logService.log(\"handleErrors: \", response);\n let ok = response.ok;\n if (!ok) {\n let status = response.status;\n let statusText = response.statusText;\n\n if (status >= 500) {\n throw new Error(`ServerError: ErrorMsg ${statusText} & status code ${status}`);\n }\n if (status <= 501) {\n throw new Error(`ApplicationError: ErrorMsg ${statusText} & status code ${status}`);\n }\n throw new Error(`NetworkError: ErrorMsg ${statusText} & status code ${status}`);\n }\n return response;\n }", "function onError(error) {\n self.error('Error : ' + error.status + ' ' + error.statusText);\n }", "function errorHandler(err, req, res, next){\n console.log(err);\n res.status(500).render('error_template', { error: err});\n // error is a variable to store the error message and render in in the html error template.\n}", "function handleError(msg) {\n console.log('API call failed with message: ' + msg);\n res.writeHead(400, {'Content-Type': 'application/json'});\n res.write(JSON.stringify(respData));\n res.end();\n return false;\n }", "function Error(error, response) {\n console.error(error);\n return response.status(500).send('Oops! Something went wrong! Please try again in 401');\n}", "function next(err) {\n if (err) return on500(req, res, err);\n handle();\n }", "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n }", "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n }", "function handleError(res, reason, message, code) {\n console.log(\"ERROR: \" + reason);\n res.status(code || 500).json({\"error\": message});\n }", "function handleError(err) {\n // Print the error to the console so we can debug it.\n console.log(\"Error: \", err);\n }", "function onApiError(reason) {\n $log.error(reason);\n }", "function handleError(res, reason, message, code) {\r\n console.log(\"ERROR: \" + reason);\r\n res.status(code || 500).json({\"error\": message});\r\n}", "function handleError(res, reason, message, code) {\r\n console.log(\"ERROR: \" + reason);\r\n res.status(code || 500).json({\"error\": message});\r\n}", "_reportInternalError(socket, message) {\n if(message === undefined) {\n message = '';\n }\n let errBuf = Buffer.from(message, 'utf8');\n socket.write(kHTTP500TextMessage);\n socket.write('' + errBuf.length + '\\r\\n\\r\\n');\n socket.write(errBuf);\n socket.end(\"\\r\\n\");\n }", "function _500(err, req, res, next) {\n // treat as 404\n if (err.message\n && (~err.message.indexOf('not found')\n || (~err.message.indexOf('Cast to ObjectId failed')))) {\n return next();\n }\n\n console.error(err.stack);\n // error page\n res.status(500).render('500', { error: err.stack });\n}", "function handleError(res, reason, message, code) {\n console.log(`ERROR: ${reason}`);\n res.status(code || 500).json({ error: message });\n }", "function errorHandler(err, req, res, next) {\n // Checks if err is of type CustomError\n if (err instanceof custom_error_1.CustomError) {\n // Calls serializeErrors method, inserts results into errors object, sends back to user\n return res.status(err.statusCode).send(err.serializeError());\n }\n console.error(err);\n var _a = new unknown_error_1.UnknownError(), statusCode = _a.statusCode, serializeError = _a.serializeError;\n res.status(statusCode).send(serializeError());\n}", "function handleError(res, err, custommessage, code) {\n\t\tconsole.log(\"ERROR: \" + err.message);\n\t\tconsole.log(\"message: \" + custommessage);\n\t\tconsole.log(\"stack: \" + err.stack);\n\t\tres.status(code || 500).json({\"error\": err.message});\n\t}", "function handleError(res, err, custommessage, code) {\n\t\tconsole.log(\"ERROR: \" + err.message);\n\t\tconsole.log(\"message: \" + custommessage);\n\t\tconsole.log(\"stack: \" + err.stack);\n\t\tres.status(code || 500).json({\"error\": err.message});\n\t}", "function handleError(res, err, custommessage, code) {\n\t\tconsole.log(\"ERROR: \" + err.message);\n\t\tconsole.log(\"message: \" + custommessage);\n\t\tconsole.log(\"stack: \" + err.stack);\n\t\tres.status(code || 500).json({\"error\": err.message});\n\t}", "function handleError(response, status, error) {\n reportError(response, status, error);\n console.log(\"handleError firing\");\n setRoute(state, 'error');\n renderApp(state, PAGE_ELEMENTS);\n}", "function handleError(err, req, res, next) {\n var output = {\n error: {\n name: err.name,\n message: err.message,\n text: err.toString(),\n },\n };\n var statusCode = err.status || 500;\n res.status(statusCode).json(output);\n}" ]
[ "0.78414315", "0.73446363", "0.72819155", "0.7269763", "0.7269763", "0.7257347", "0.7202326", "0.7199615", "0.71955085", "0.7185981", "0.7173113", "0.7088391", "0.70506644", "0.7044177", "0.70228547", "0.7022297", "0.6996022", "0.6987262", "0.69870025", "0.6978417", "0.6976947", "0.6976669", "0.6971582", "0.69682896", "0.69640195", "0.6963302", "0.69562155", "0.694828", "0.6945839", "0.69134927", "0.69095117", "0.69083685", "0.6901746", "0.6894539", "0.6894309", "0.68940514", "0.68867236", "0.6881254", "0.68800724", "0.6866507", "0.68655705", "0.68516976", "0.6838012", "0.68333554", "0.6828582", "0.6828582", "0.6827169", "0.682064", "0.68058246", "0.68026286", "0.6797444", "0.67967725", "0.6795441", "0.678966", "0.6777165", "0.6753536", "0.67509246", "0.674795", "0.67413044", "0.67319083", "0.67310697", "0.67284495", "0.6722945", "0.6719225", "0.6715916", "0.6715916", "0.6704182", "0.66910434", "0.6679822", "0.667873", "0.6675102", "0.66744506", "0.66681087", "0.6668078", "0.6667897", "0.66671073", "0.66623014", "0.6662021", "0.6660994", "0.66576093", "0.66557264", "0.66478235", "0.6627088", "0.66264856", "0.66201943", "0.66201943", "0.66201943", "0.6607701", "0.65993625", "0.6581334", "0.6581334", "0.6577888", "0.6565382", "0.6562313", "0.65587926", "0.6557677", "0.6557677", "0.6557677", "0.6554104", "0.65529895" ]
0.684494
42
Note: due to BigNumber config the max decimals is 8
readableCrypto(value, decimals = 8) { if (value) { const bigNumberValue = BigNumber.make(value); const normalizedValue = Number(bigNumberValue.dividedBy(1e8)).toLocaleString(constants.LOCALE, { maximumFractionDigits: decimals }); return normalizedValue; } return value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bigNumber(value) {\n return __WEBPACK_IMPORTED_MODULE_1__ethersproject_bignumber__[\"a\" /* BigNumber */].from(value);\n }", "bigNumber(value) {\n return bignumber[\"a\" /* BigNumber */].from(value);\n }", "makeBigNumber(amount, decimals) {\n // Allow .0\n if (amount.substr(0, 1) === \".\") {\n let a = \"0\" + amount;\n amount = a;\n }\n let pieces = amount.split(\".\");\n let d = parseInt(decimals);\n if (pieces.length === 1) {\n amount = parseInt(amount);\n if (isNaN(amount) || amount < 0) {\n // error message\n return;\n }\n amount = new BN(amount + \"0\".repeat(parseInt(decimals)));\n } else if (pieces.length > 2) {\n return;\n } else if (pieces[1].length > d) {\n return;\n } else {\n let dec = parseInt(pieces[1]);\n let reg = new RegExp(\"^\\\\d+$\"); // numbers only\n if (isNaN(pieces[1]) || dec < 0 || !reg.test(pieces[1])) {\n return;\n }\n dec = pieces[1];\n let declen = d - dec.toString().length;\n amount = parseInt(pieces[0]);\n if (isNaN(amount) || amount < 0) {\n // error message\n return;\n }\n amount = new BN(amount + dec + \"0\".repeat(parseInt(declen)));\n }\n return amount;\n }", "convert(value) {\n const factor = this._useGb ? 1000 : 1024;\n return (value / factor / factor / factor).toFixed(2);\n }", "exponent() { return ((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?new Decimal(1.4):new Decimal(1.85) }", "fromBigInt(units) {\n const s = units.toString().padStart(this.decimals+1, \"0\");\n return s.slice(0, -this.decimals) + \".\" + s.slice(-this.decimals);\n }", "function getBigNumber(amount, decimals = 18) {\n return BigNumber.from(amount).mul(BigNumber.from(BASE_TEN).pow(decimals))\n}", "function getBigNumber(amount, decimals = 18) {\n return BigNumber.from(amount).mul(BigNumber.from(BASE_TEN).pow(decimals))\n}", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.008:.0075) }", "function Column_DECIMAL() {}", "applyPrecisionDigits(precisionDigits) {\n const that = this;\n\n precisionDigits = Math.max(0, Math.min(precisionDigits, 20));\n\n let renderedValue = parseFloat(that.numericValue).toFixed(precisionDigits);\n\n if (that.isENotation(renderedValue)) {\n renderedValue = that.largeExponentialToDecimal(renderedValue) + '.' + '0'.repeat(precisionDigits);\n }\n\n return renderedValue;\n }", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?1.07:1.1) }", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.2:.125) }", "static get wholeNumberDecimal() {\n return /^\\+?\\d*\\.\\d+$/;\n }", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?1.4:1.85) }", "function bigNum(x) {\n if (x < 1e+6) {\n return x.toLocaleString();\n }\n \n let digits = Math.floor(Math.log10(x));\n let thousands = Math.floor(digits / 3);\n let mantissa = x / Math.pow(10, thousands * 3);\n return `${+mantissa.toFixed(2)} ${POWERS[thousands - 1]}`;\n}", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.025:.02) }", "bigNumberToExponent(significantDigits, forceExponentialResult) {\n let value = this.numericValue;\n\n if (value.constructor !== JQX.Utilities.BigNumber) {\n value = new JQX.Utilities.BigNumber(value);\n }\n\n const numberLength = value._f;\n let numericString = value.toString();\n\n if (numberLength <= 10) {\n // 32-bit or lower\n if (forceExponentialResult) {\n return parseFloat(numericString).toExponential(significantDigits !== null ? significantDigits - 1 : undefined);\n }\n else {\n return new JQX.Utilities.NumberRenderer(parseFloat(numericString)).toDigits(significantDigits);\n }\n }\n else {\n // 64-bit\n if (significantDigits >= numberLength && !forceExponentialResult) {\n return numericString;\n }\n else {\n let sign;\n if (value._s === false) {\n sign = '';\n }\n else {\n sign = '-';\n numericString = numericString.slice(1);\n }\n\n const nextDigit = parseFloat(numericString.slice(significantDigits, significantDigits + 1));\n\n if (nextDigit >= 5) {\n numericString = new JQX.Utilities.BigNumber(numericString.slice(0, significantDigits)).add(1).toString();\n }\n\n let digitsAfterDecimalSeparator = numericString.slice(1, significantDigits);\n\n if (forceExponentialResult) {\n significantDigits--;\n\n if (digitsAfterDecimalSeparator.length > 0 && significantDigits > digitsAfterDecimalSeparator.length) {\n digitsAfterDecimalSeparator = digitsAfterDecimalSeparator + ('0').repeat(significantDigits - digitsAfterDecimalSeparator.length);\n }\n else if (digitsAfterDecimalSeparator.length === 0) {\n digitsAfterDecimalSeparator = ('0').repeat(significantDigits);\n }\n }\n else {\n while (digitsAfterDecimalSeparator.length > 0 && digitsAfterDecimalSeparator.charAt(digitsAfterDecimalSeparator.length - 1) === '0') {\n digitsAfterDecimalSeparator = digitsAfterDecimalSeparator.slice(0, digitsAfterDecimalSeparator.length - 1);\n }\n }\n\n const decimalSeparator = digitsAfterDecimalSeparator.length > 0 ? '.' : '',\n power = numberLength - 1;\n\n return sign + numericString.slice(0, 1) + decimalSeparator + digitsAfterDecimalSeparator + 'E+' + power;\n }\n }\n }", "function toBigNumber(value) {\n return web3.utils.toBN(value);\n}", "constructor(n, p, r) {\n var o = this, i;\n\n if (JQX.Utilities.BigNumber.bigIntSupport) {\n if (n instanceof JQX.Utilities.BigNumber) {\n if (Array.isArray(n._d)) {\n n = (n._s ? '-' : '') + (n._d.slice(0, n._f).join('') || '0') + (n._f != n._d.length ? '.' + n._d.slice(n._f).join('') : '');\n }\n else {\n return new JQX.Utilities.BigNumber(n._d);\n }\n }\n\n try {\n if (n === null) {\n o._d = BigInt(0);\n }\n else if (typeof n === 'string' && n.toLowerCase().indexOf('e') !== -1) {\n o._d = BigInt(parseFloat(n));\n }\n else {\n o._d = BigInt(n);\n }\n }\n catch (error) {\n try {\n const numberParts = n.toString().split('.');\n let result = BigInt(numberParts[0]),\n firstDecimalDigit = parseInt(numberParts[1].charAt(0));\n\n if (result > 0 && firstDecimalDigit >= 5) {\n result = result + BigInt(1);\n }\n else if (result < 0) {\n if (firstDecimalDigit > 5) {\n result = result - BigInt(1);\n }\n else if (firstDecimalDigit === 5) {\n let iterator = 1,\n nextChar = numberParts[1].charAt(iterator),\n roundDown = false;\n\n while (nextChar !== '') {\n iterator++;\n nextChar = numberParts[1].charAt(iterator);\n\n if (nextChar !== '0') {\n roundDown = true;\n break;\n }\n }\n\n if (roundDown) {\n result = result - BigInt(1);\n }\n }\n }\n\n o._d = result;\n }\n catch (error) {\n o._d = BigInt(0);\n }\n }\n\n o._f = o._d.toString().replace('-', '').length;\n o._s = o._d < 0;\n return;\n }\n\n if (n instanceof JQX.Utilities.BigNumber) {\n if (typeof n._d === 'bigint') {\n return new JQX.Utilities.BigNumber(n._d.toString());\n }\n\n for (i in { precision: 0, roundType: 0, _s: 0, _f: 0 }) o[i] = n[i];\n o._d = n._d.slice();\n\n if (n._s && n._d.length === 1 && n._d[0] === 0) {\n // n is -0\n o._s = false;\n }\n\n return;\n }\n\n if (n !== undefined) {\n if (n === '-0') {\n n = '0';\n }\n\n // exponential notation support\n if (new RegExp(/e/i).test(n)) {\n var stringExponential = n.toString().toLowerCase(),\n indexOfE = stringExponential.indexOf('e'),\n mantissa = new JQX.Utilities.BigNumber(stringExponential.slice(0, indexOfE)),\n exponent = stringExponential.slice(indexOfE + 2),\n sign = stringExponential.slice(indexOfE + 1, indexOfE + 2),\n bigTen = new JQX.Utilities.BigNumber(10),\n multyplyBy = bigTen.pow(sign + exponent),\n result = mantissa.multiply(multyplyBy);\n\n n = result.toString();\n }\n }\n\n o.precision = isNaN(p = Math.abs(p)) ? JQX.Utilities.BigNumber.defaultPrecision : p;\n o.roundType = isNaN(r = Math.abs(r)) ? JQX.Utilities.BigNumber.defaultRoundType : r;\n o._s = (n += '').charAt(0) == '-';\n o._f = ((n = n.replace(/[^\\d.]/g, '').split('.', 2))[0] = n[0].replace(/^0+/, '') || '0').length;\n for (i = (n = o._d = (n.join('') || '0').split('')).length; i; n[--i] = +n[i]);\n o.round();\n }", "toBigInt(amount) {\n let [ints, decis] = String(amount).split(\".\").concat(\"\");\n return BigInt(ints + decis.padEnd(this.decimals, \"0\").slice(0, this.decimals)) + BigInt(this.rounded && decis[this.decimals] >= \"5\");\n }", "static get decimal() {\n return /^[\\+\\-]?\\d*\\.\\d+$/;\n }", "get decimals() { return this.#format.decimals; }", "function transformGasDecimal(num) {\n if (num.length <= 8) {\n return \"0.\" + num.padStart(8, \"0\");\n }\n const decimalPoint = num.length - 8;\n return (\n num.substring(0, decimalPoint) +\n \".\" +\n num.substring(decimalPoint, num.length)\n );\n}", "function limitDigitDisplay(numb){\n return new Intl.NumberFormat('en-US', {minimumFractionDigits: 0,maximumFractionDigits: 8}).format(numb);\n}", "function formatDecimal(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}", "function e(e,l){return Number(e.toFixed(l))}", "function insertDecimal(num) {\n return (num / 100).toFixed(8);\n}", "function fixDecimal(value) {\r\n if (value < 2) {\r\n return 1;\r\n }\r\n return value;\r\n }", "exponent(){\n if(hasUpgrade(this.layer,12)){\n if(getBuyableAmount(this.layer,11).gte(1)){\n return new Decimal.add(0.1,Decimal.mul(0.5,Decimal.add(Decimal.mul(0.1,getBuyableAmount(this.layer, 11)),0.3)))\n }else{\n return new Decimal(1.5);\n }\n }else{\n if(getBuyableAmount(this.layer,11).gte(1)){\n return new Decimal.add(1,Decimal.mul(0.5,Decimal.add(Decimal.mul(0.1,getBuyableAmount(this.layer, 11)),1)))\n }else{\n return new Decimal(1.5);\n }\n }\n }", "function defineDecimals( num, decimals = 2 ) {\n // .toFixed(decimals)\n return (num).toFixed(decimals)\n }", "function getMultiplier(decimals) {\n if (typeof (decimals) !== \"number\") {\n try {\n decimals = _bignumber__WEBPACK_IMPORTED_MODULE_3__[/* BigNumber */ \"a\"].from(decimals).toNumber();\n }\n catch (e) { }\n }\n if (typeof (decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n return logger.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}", "get valueDecimal () {\r\n\t\treturn this.__valueDecimal;\r\n\t}", "function nFor(number, decimals, decPoint, thousandsSep,num) {\n \n decimals = ( set.page.cat == 'market' || set.page.mod == 'sepet' ) ? app.market.onda : decimals;\n \n //decimals = Math.abs(decimals) || ( decimals === false ? 2 : decimals );\n \n decimals = decimals || decimals===0 ? Math.abs(decimals) : 2;\n\n number = parseFloat(number);\n\n if (!decPoint || !thousandsSep) {\n decPoint = ',';\n thousandsSep = '.';\n }\n\n var roundedNumber = Math.round(Math.abs(number) * ('1e' + decimals)) + '';\n \n while (roundedNumber.length < decimals) {\n roundedNumber = '0' + roundedNumber;\n }\n\n var numbersString = decimals ? (roundedNumber.slice(0, decimals * -1) || 0) : roundedNumber;\n var decimalsString = decimals ? roundedNumber.slice(decimals * -1) : '';\n var formattedNumber = \"\";\n\n while (numbersString.length > 3) {\n formattedNumber += thousandsSep + numbersString.slice(-3)\n numbersString = numbersString.slice(0, -3);\n }\n\n if (decimals && decimalsString.length === 1) {\n while (decimalsString.length < decimals) {\n decimalsString = decimalsString + decimalsString;\n }\n }\n\n var str = (number < 0 ? '-' : '') + numbersString + formattedNumber + (decimalsString ? (decPoint + decimalsString) : '');\n\n return num ? str.replace(',','') : str;\n}", "function precise() {\n var num1 = 13495439.346983409;\n\n document.getElementById(\"precision\").innerHTML = num1.toPrecision(10);\n}", "formatValue(value) {\n let precision = 2;\n if (value >= 1) {\n precision = 3;\n }\n if (value >= 9) {\n precision = 4;\n }\n let convertedValue = value.toPrecision(precision).toString();\n return parseFloat(convertedValue);\n }", "function field_decimal(data,editable,config) {\n\tif (typeof data == 'string') data = parseFloat(data);\n\tif (isNaN(data)) data = null;\n\tif (config && typeof config.min == 'string') config.min = parseFloat(config.min);\n\tif (config && typeof config.max == 'string') config.max = parseFloat(config.max);\n\ttyped_field.call(this, data, editable, config);\n}", "function another(configObj) {\n\t var div,\n\n\t // id tracks the caller function, so its name can be included in error messages.\n\t id = 0,\n\t P = BigNumber.prototype,\n\t ONE = new BigNumber(1),\n\n\n\t /********************************* EDITABLE DEFAULTS **********************************/\n\n\n\t /*\n\t * The default values below must be integers within the inclusive ranges stated.\n\t * The values can also be changed at run-time using BigNumber.config.\n\t */\n\n\t // The maximum number of decimal places for operations involving division.\n\t DECIMAL_PLACES = 20, // 0 to MAX\n\n\t /*\n\t * The rounding mode used when rounding to the above decimal places, and when using\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n\t * UP 0 Away from zero.\n\t * DOWN 1 Towards zero.\n\t * CEIL 2 Towards +Infinity.\n\t * FLOOR 3 Towards -Infinity.\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n\t */\n\t ROUNDING_MODE = 4, // 0 to 8\n\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n\t // The exponent value at and beneath which toString returns exponential notation.\n\t // Number type: -7\n\t TO_EXP_NEG = -7, // 0 to -MAX\n\n\t // The exponent value at and above which toString returns exponential notation.\n\t // Number type: 21\n\t TO_EXP_POS = 21, // 0 to MAX\n\n\t // RANGE : [MIN_EXP, MAX_EXP]\n\n\t // The minimum exponent value, beneath which underflow to zero occurs.\n\t // Number type: -324 (5e-324)\n\t MIN_EXP = -1e7, // -1 to -MAX\n\n\t // The maximum exponent value, above which overflow to Infinity occurs.\n\t // Number type: 308 (1.7976931348623157e+308)\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n\t MAX_EXP = 1e7, // 1 to MAX\n\n\t // Whether BigNumber Errors are ever thrown.\n\t ERRORS = true, // true or false\n\n\t // Change to intValidatorNoErrors if ERRORS is false.\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n\t // Whether to use cryptographically-secure random number generation, if available.\n\t CRYPTO = false, // true or false\n\n\t /*\n\t * The modulo mode used when calculating the modulus: a mod n.\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n\t * The remainder (r) is calculated as: r = a - n * q.\n\t *\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\n\t * DOWN 1 The remainder has the same sign as the dividend.\n\t * This modulo mode is commonly known as 'truncated division' and is\n\t * equivalent to (a % n) in JavaScript.\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n\t * The remainder is always positive.\n\t *\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n\t * modes are commonly used for the modulus operation.\n\t * Although the other rounding modes can also be used, they may not give useful results.\n\t */\n\t MODULO_MODE = 1, // 0 to 9\n\n\t // The maximum number of significant digits of the result of the toPower operation.\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\n\t POW_PRECISION = 100, // 0 to MAX\n\n\t // The format specification used by the BigNumber.prototype.toFormat method.\n\t FORMAT = {\n\t decimalSeparator: '.',\n\t groupSeparator: ',',\n\t groupSize: 3,\n\t secondaryGroupSize: 0,\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\n\t fractionGroupSize: 0\n\t };\n\n\n\t /******************************************************************************************/\n\n\n\t // CONSTRUCTOR\n\n\n\t /*\n\t * The BigNumber constructor and exported function.\n\t * Create and return a new instance of a BigNumber object.\n\t *\n\t * n {number|string|BigNumber} A numeric value.\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n\t */\n\t function BigNumber( n, b ) {\n\t var c, e, i, num, len, str,\n\t x = this;\n\n\t // Enable constructor usage without new.\n\t if ( !( x instanceof BigNumber ) ) {\n\n\t // 'BigNumber() constructor call without new: {n}'\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\n\t return new BigNumber( n, b );\n\t }\n\n\t // 'new BigNumber() base not an integer: {b}'\n\t // 'new BigNumber() base out of range: {b}'\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n\t // Duplicate.\n\t if ( n instanceof BigNumber ) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = ( n = n.c ) ? n.slice() : n;\n\t id = 0;\n\t return;\n\t }\n\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n\t // Fast path for integers.\n\t if ( n === ~~n ) {\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n\t x.e = e;\n\t x.c = [n];\n\t id = 0;\n\t return;\n\t }\n\n\t str = n + '';\n\t } else {\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\t } else {\n\t b = b | 0;\n\t str = n + '';\n\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n\t // Allow exponential notation to be used with base 10 argument.\n\t if ( b == 10 ) {\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n\t }\n\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n\t // Any number in exponential form will fail due to the [Ee][+-].\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n\t return parseNumeric( x, str, num, b );\n\t }\n\n\t if (num) {\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t raise( id, tooManyDigits, n );\n\t }\n\n\t // Prevent later check for length on converted number.\n\t num = false;\n\t } else {\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\n\t str = convertBase( str, 10, b, x.s );\n\t }\n\n\t // Decimal point?\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n\t // Exponential form?\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n\t // Determine exponent.\n\t if ( e < 0 ) e = i;\n\t e += +str.slice( i + 1 );\n\t str = str.substring( 0, i );\n\t } else if ( e < 0 ) {\n\n\t // Integer.\n\t e = str.length;\n\t }\n\n\t // Determine leading zeros.\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n\t // Determine trailing zeros.\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\n\t str = str.slice( i, len + 1 );\n\n\t if (str) {\n\t len = str.length;\n\n\t // Disallow numbers with over 15 significant digits if number type.\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n\t e = e - i - 1;\n\n\t // Overflow?\n\t if ( e > MAX_EXP ) {\n\n\t // Infinity.\n\t x.c = x.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t } else {\n\t x.e = e;\n\t x.c = [];\n\n\t // Transform base\n\n\t // e is the base 10 exponent.\n\t // i is where to slice str to get the first element of the coefficient array.\n\t i = ( e + 1 ) % LOG_BASE;\n\t if ( e < 0 ) i += LOG_BASE;\n\n\t if ( i < len ) {\n\t if (i) x.c.push( +str.slice( 0, i ) );\n\n\t for ( len -= LOG_BASE; i < len; ) {\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\n\t }\n\n\t str = str.slice(i);\n\t i = LOG_BASE - str.length;\n\t } else {\n\t i -= len;\n\t }\n\n\t for ( ; i--; str += '0' );\n\t x.c.push( +str );\n\t }\n\t } else {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t }\n\n\t id = 0;\n\t }\n\n\n\t // CONSTRUCTOR PROPERTIES\n\n\n\t BigNumber.another = another;\n\n\t BigNumber.ROUND_UP = 0;\n\t BigNumber.ROUND_DOWN = 1;\n\t BigNumber.ROUND_CEIL = 2;\n\t BigNumber.ROUND_FLOOR = 3;\n\t BigNumber.ROUND_HALF_UP = 4;\n\t BigNumber.ROUND_HALF_DOWN = 5;\n\t BigNumber.ROUND_HALF_EVEN = 6;\n\t BigNumber.ROUND_HALF_CEIL = 7;\n\t BigNumber.ROUND_HALF_FLOOR = 8;\n\t BigNumber.EUCLID = 9;\n\n\n\t /*\n\t * Configure infrequently-changing library-wide settings.\n\t *\n\t * Accept an object or an argument list, with one or many of the following properties or\n\t * parameters respectively:\n\t *\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n\t * ERRORS {boolean|number} true, false, 1 or 0\n\t * CRYPTO {boolean|number} true, false, 1 or 0\n\t * MODULO_MODE {number} 0 to 9 inclusive\n\t * POW_PRECISION {number} 0 to MAX inclusive\n\t * FORMAT {object} See BigNumber.prototype.toFormat\n\t * decimalSeparator {string}\n\t * groupSeparator {string}\n\t * groupSize {number}\n\t * secondaryGroupSize {number}\n\t * fractionGroupSeparator {string}\n\t * fractionGroupSize {number}\n\t *\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\n\t *\n\t * E.g.\n\t * BigNumber.config(20, 4) is equivalent to\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n\t *\n\t * Ignore properties/parameters set to null or undefined.\n\t * Return an object with the properties current values.\n\t */\n\t BigNumber.config = function () {\n\t var v, p,\n\t i = 0,\n\t r = {},\n\t a = arguments,\n\t o = a[0],\n\t has = o && typeof o == 'object'\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\n\t // 'config() DECIMAL_PLACES out of range: {v}'\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t DECIMAL_PLACES = v | 0;\n\t }\n\t r[p] = DECIMAL_PLACES;\n\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n\t // 'config() ROUNDING_MODE not an integer: {v}'\n\t // 'config() ROUNDING_MODE out of range: {v}'\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n\t ROUNDING_MODE = v | 0;\n\t }\n\t r[p] = ROUNDING_MODE;\n\n\t // EXPONENTIAL_AT {number|number[]}\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n\t TO_EXP_NEG = v[0] | 0;\n\t TO_EXP_POS = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n\t }\n\t }\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n\t // 'config() RANGE not an integer: {v}'\n\t // 'config() RANGE cannot be zero: {v}'\n\t // 'config() RANGE out of range: {v}'\n\t if ( has( p = 'RANGE' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n\t MIN_EXP = v[0] | 0;\n\t MAX_EXP = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n\t }\n\t }\n\t r[p] = [ MIN_EXP, MAX_EXP ];\n\n\t // ERRORS {boolean|number} true, false, 1 or 0.\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\n\t if ( has( p = 'ERRORS' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t id = 0;\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = ERRORS;\n\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\n\t // 'config() crypto unavailable: {crypto}'\n\t if ( has( p = 'CRYPTO' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = CRYPTO;\n\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n\t // 'config() MODULO_MODE not an integer: {v}'\n\t // 'config() MODULO_MODE out of range: {v}'\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n\t MODULO_MODE = v | 0;\n\t }\n\t r[p] = MODULO_MODE;\n\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n\t // 'config() POW_PRECISION not an integer: {v}'\n\t // 'config() POW_PRECISION out of range: {v}'\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t POW_PRECISION = v | 0;\n\t }\n\t r[p] = POW_PRECISION;\n\n\t // FORMAT {object}\n\t // 'config() FORMAT not an object: {v}'\n\t if ( has( p = 'FORMAT' ) ) {\n\n\t if ( typeof v == 'object' ) {\n\t FORMAT = v;\n\t } else if (ERRORS) {\n\t raise( 2, p + ' not an object', v );\n\t }\n\t }\n\t r[p] = FORMAT;\n\n\t return r;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the maximum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the minimum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n\t /*\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n\t * zeros are produced).\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t *\n\t * 'random() decimal places not an integer: {dp}'\n\t * 'random() decimal places out of range: {dp}'\n\t * 'random() crypto unavailable: {crypto}'\n\t */\n\t BigNumber.random = (function () {\n\t var pow2_53 = 0x20000000000000;\n\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n\t // Check if Math.random() produces more than 32 bits of randomness.\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n\t (Math.random() * 0x800000 | 0); };\n\n\t return function (dp) {\n\t var a, b, e, k, v,\n\t i = 0,\n\t c = [],\n\t rand = new BigNumber(ONE);\n\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n\t k = mathceil( dp / LOG_BASE );\n\n\t if (CRYPTO) {\n\n\t // Browsers supporting crypto.getRandomValues.\n\t if ( crypto && crypto.getRandomValues ) {\n\n\t a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n\t for ( ; i < k; ) {\n\n\t // 53 bits:\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n\t // 11111 11111111 11111111\n\t // 0x20000 is 2^21.\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n\t // Rejection sampling:\n\t // 0 <= v < 9007199254740992\n\t // Probability that v >= 9e15, is\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\t if ( v >= 9e15 ) {\n\t b = crypto.getRandomValues( new Uint32Array(2) );\n\t a[i] = b[0];\n\t a[i + 1] = b[1];\n\t } else {\n\n\t // 0 <= v <= 8999999999999999\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 2;\n\t }\n\t }\n\t i = k / 2;\n\n\t // Node.js supporting crypto.randomBytes.\n\t } else if ( crypto && crypto.randomBytes ) {\n\n\t // buffer\n\t a = crypto.randomBytes( k *= 7 );\n\n\t for ( ; i < k; ) {\n\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n\t // 0 <= v < 9007199254740992\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n\t if ( v >= 9e15 ) {\n\t crypto.randomBytes(7).copy( a, i );\n\t } else {\n\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 7;\n\t }\n\t }\n\t i = k / 7;\n\t } else if (ERRORS) {\n\t raise( 14, 'crypto unavailable', crypto );\n\t }\n\t }\n\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n\t if (!i) {\n\n\t for ( ; i < k; ) {\n\t v = random53bitInt();\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\n\t }\n\t }\n\n\t k = c[--i];\n\t dp %= LOG_BASE;\n\n\t // Convert trailing digits to zeros according to dp.\n\t if ( k && dp ) {\n\t v = POWS_TEN[LOG_BASE - dp];\n\t c[i] = mathfloor( k / v ) * v;\n\t }\n\n\t // Remove trailing elements which are zero.\n\t for ( ; c[i] === 0; c.pop(), i-- );\n\n\t // Zero?\n\t if ( i < 0 ) {\n\t c = [ e = 0 ];\n\t } else {\n\n\t // Remove leading elements which are zero and adjust exponent accordingly.\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n\t // Count the digits of the first element of c to determine leading zeros, and...\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n\t // adjust the exponent accordingly.\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\n\t }\n\n\t rand.e = e;\n\t rand.c = c;\n\t return rand;\n\t };\n\t })();\n\n\n\t // PRIVATE FUNCTIONS\n\n\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\n\t function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }\n\n\n\t // Perform division in the specified base. Called by div and convertBase.\n\t div = (function () {\n\n\t // Assume non-zero x and k.\n\t function multiply( x, k, base ) {\n\t var m, temp, xlo, xhi,\n\t carry = 0,\n\t i = x.length,\n\t klo = k % SQRT_BASE,\n\t khi = k / SQRT_BASE | 0;\n\n\t for ( x = x.slice(); i--; ) {\n\t xlo = x[i] % SQRT_BASE;\n\t xhi = x[i] / SQRT_BASE | 0;\n\t m = khi * xlo + xhi * klo;\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n\t x[i] = temp % base;\n\t }\n\n\t if (carry) x.unshift(carry);\n\n\t return x;\n\t }\n\n\t function compare( a, b, aL, bL ) {\n\t var i, cmp;\n\n\t if ( aL != bL ) {\n\t cmp = aL > bL ? 1 : -1;\n\t } else {\n\n\t for ( i = cmp = 0; i < aL; i++ ) {\n\n\t if ( a[i] != b[i] ) {\n\t cmp = a[i] > b[i] ? 1 : -1;\n\t break;\n\t }\n\t }\n\t }\n\t return cmp;\n\t }\n\n\t function subtract( a, b, aL, base ) {\n\t var i = 0;\n\n\t // Subtract b from a.\n\t for ( ; aL--; ) {\n\t a[aL] -= i;\n\t i = a[aL] < b[aL] ? 1 : 0;\n\t a[aL] = i * base + a[aL] - b[aL];\n\t }\n\n\t // Remove leading zeros.\n\t for ( ; !a[0] && a.length > 1; a.shift() );\n\t }\n\n\t // x: dividend, y: divisor.\n\t return function ( x, y, dp, rm, base ) {\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n\t yL, yz,\n\t s = x.s == y.s ? 1 : -1,\n\t xc = x.c,\n\t yc = y.c;\n\n\t // Either NaN, Infinity or 0?\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n\t return new BigNumber(\n\n\t // Return NaN if either NaN, or both Infinity or 0.\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n\t );\n\t }\n\n\t q = new BigNumber(s);\n\t qc = q.c = [];\n\t e = x.e - y.e;\n\t s = dp + e + 1;\n\n\t if ( !base ) {\n\t base = BASE;\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n\t s = s / LOG_BASE | 0;\n\t }\n\n\t // Result exponent may be one less then the current value of e.\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n\t if ( s < 0 ) {\n\t qc.push(1);\n\t more = true;\n\t } else {\n\t xL = xc.length;\n\t yL = yc.length;\n\t i = 0;\n\t s += 2;\n\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n\t n = mathfloor( base / ( yc[0] + 1 ) );\n\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n\t if ( n > 1 ) {\n\t yc = multiply( yc, n, base );\n\t xc = multiply( xc, n, base );\n\t yL = yc.length;\n\t xL = xc.length;\n\t }\n\n\t xi = yL;\n\t rem = xc.slice( 0, yL );\n\t remL = rem.length;\n\n\t // Add zeros to make remainder as long as divisor.\n\t for ( ; remL < yL; rem[remL++] = 0 );\n\t yz = yc.slice();\n\t yz.unshift(0);\n\t yc0 = yc[0];\n\t if ( yc[1] >= base / 2 ) yc0++;\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n\t do {\n\t n = 0;\n\n\t // Compare divisor and remainder.\n\t cmp = compare( yc, rem, yL, remL );\n\n\t // If divisor < remainder.\n\t if ( cmp < 0 ) {\n\n\t // Calculate trial digit, n.\n\n\t rem0 = rem[0];\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n\t // n is how many times the divisor goes into the current remainder.\n\t n = mathfloor( rem0 / yc0 );\n\n\t // Algorithm:\n\t // 1. product = divisor * trial digit (n)\n\t // 2. if product > remainder: product -= divisor, n--\n\t // 3. remainder -= product\n\t // 4. if product was < remainder at 2:\n\t // 5. compare new remainder and divisor\n\t // 6. If remainder > divisor: remainder -= divisor, n++\n\n\t if ( n > 1 ) {\n\n\t // n may be > base only when base is 3.\n\t if (n >= base) n = base - 1;\n\n\t // product = divisor * trial digit.\n\t prod = multiply( yc, n, base );\n\t prodL = prod.length;\n\t remL = rem.length;\n\n\t // Compare product and remainder.\n\t // If product > remainder.\n\t // Trial digit n too high.\n\t // n is 1 too high about 5% of the time, and is not known to have\n\t // ever been more than 1 too high.\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\n\t n--;\n\n\t // Subtract divisor from product.\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\n\t prodL = prod.length;\n\t cmp = 1;\n\t }\n\t } else {\n\n\t // n is 0 or 1, cmp is -1.\n\t // If n is 0, there is no need to compare yc and rem again below,\n\t // so change cmp to 1 to avoid it.\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\n\t if ( n == 0 ) {\n\n\t // divisor < remainder, so n must be at least 1.\n\t cmp = n = 1;\n\t }\n\n\t // product = divisor\n\t prod = yc.slice();\n\t prodL = prod.length;\n\t }\n\n\t if ( prodL < remL ) prod.unshift(0);\n\n\t // Subtract product from remainder.\n\t subtract( rem, prod, remL, base );\n\t remL = rem.length;\n\n\t // If product was < remainder.\n\t if ( cmp == -1 ) {\n\n\t // Compare divisor and new remainder.\n\t // If divisor < new remainder, subtract divisor from remainder.\n\t // Trial digit n too low.\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\n\t n++;\n\n\t // Subtract divisor from remainder.\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\n\t remL = rem.length;\n\t }\n\t }\n\t } else if ( cmp === 0 ) {\n\t n++;\n\t rem = [0];\n\t } // else cmp === 1 and n will be 0\n\n\t // Add the next digit, n, to the result array.\n\t qc[i++] = n;\n\n\t // Update the remainder.\n\t if ( rem[0] ) {\n\t rem[remL++] = xc[xi] || 0;\n\t } else {\n\t rem = [ xc[xi] ];\n\t remL = 1;\n\t }\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n\t more = rem[0] != null;\n\n\t // Leading zero?\n\t if ( !qc[0] ) qc.shift();\n\t }\n\n\t if ( base == BASE ) {\n\n\t // To calculate q.e, first get the number of digits of qc[0].\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n\t // Caller is convertBase.\n\t } else {\n\t q.e = e;\n\t q.r = +more;\n\t }\n\n\t return q;\n\t };\n\t })();\n\n\n\t /*\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\n\t * notation rounded to the specified decimal places or significant digits.\n\t *\n\t * n is a BigNumber.\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\n\t * rm is the rounding mode.\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n\t */\n\t function format( n, i, rm, caller ) {\n\t var c0, e, ne, len, str;\n\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n\t ? rm | 0 : ROUNDING_MODE;\n\n\t if ( !n.c ) return n.toString();\n\t c0 = n.c[0];\n\t ne = n.e;\n\n\t if ( i == null ) {\n\t str = coeffToString( n.c );\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n\t ? toExponential( str, ne )\n\t : toFixedPoint( str, ne );\n\t } else {\n\t n = round( new BigNumber(n), i, rm );\n\n\t // n.e may have changed if the value was rounded up.\n\t e = n.e;\n\n\t str = coeffToString( n.c );\n\t len = str.length;\n\n\t // toPrecision returns exponential notation if the number of significant digits\n\t // specified is less than the number of digits necessary to represent the integer\n\t // part of the value in fixed-point notation.\n\n\t // Exponential notation.\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n\t // Append zeros?\n\t for ( ; len < i; str += '0', len++ );\n\t str = toExponential( str, e );\n\n\t // Fixed-point notation.\n\t } else {\n\t i -= ne;\n\t str = toFixedPoint( str, e );\n\n\t // Append zeros?\n\t if ( e + 1 > len ) {\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n\t } else {\n\t i += e - len;\n\t if ( i > 0 ) {\n\t if ( e + 1 == len ) str += '.';\n\t for ( ; i--; str += '0' );\n\t }\n\t }\n\t }\n\t }\n\n\t return n.s < 0 && c0 ? '-' + str : str;\n\t }\n\n\n\t // Handle BigNumber.max and BigNumber.min.\n\t function maxOrMin( args, method ) {\n\t var m, n,\n\t i = 0;\n\n\t if ( isArray( args[0] ) ) args = args[0];\n\t m = new BigNumber( args[0] );\n\n\t for ( ; ++i < args.length; ) {\n\t n = new BigNumber( args[i] );\n\n\t // If any number is NaN, return NaN.\n\t if ( !n.s ) {\n\t m = n;\n\t break;\n\t } else if ( method.call( m, n ) ) {\n\t m = n;\n\t }\n\t }\n\n\t return m;\n\t }\n\n\n\t /*\n\t * Return true if n is an integer in range, otherwise throw.\n\t * Use for argument validation when ERRORS is true.\n\t */\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\n\t if ( n < min || n > max || n != truncate(n) ) {\n\t raise( caller, ( name || 'decimal places' ) +\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n\t }\n\n\t return true;\n\t }\n\n\n\t /*\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n\t * Called by minus, plus and times.\n\t */\n\t function normalise( n, c, e ) {\n\t var i = 1,\n\t j = c.length;\n\n\t // Remove trailing zeros.\n\t for ( ; !c[--j]; c.pop() );\n\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n\t // Overflow?\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n\t // Infinity.\n\t n.c = n.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t n.c = [ n.e = 0 ];\n\t } else {\n\t n.e = e;\n\t n.c = c;\n\t }\n\n\t return n;\n\t }\n\n\n\t // Handle values that fail the validity test in BigNumber.\n\t parseNumeric = (function () {\n\t var basePrefix = /^(-?)0([xbo])/i,\n\t dotAfter = /^([^.]+)\\.$/,\n\t dotBefore = /^\\.([^.]+)$/,\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n\t whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n\t return function ( x, str, num, b ) {\n\t var base,\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n\t // No exception on ±Infinity or NaN.\n\t if ( isInfinityOrNaN.test(s) ) {\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n\t } else {\n\t if ( !num ) {\n\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n\t return !b || b == base ? p1 : m;\n\t });\n\n\t if (b) {\n\t base = b;\n\n\t // E.g. '1.' to '1', '.1' to '0.1'\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n\t }\n\n\t if ( str != s ) return new BigNumber( s, base );\n\t }\n\n\t // 'new BigNumber() not a number: {n}'\n\t // 'new BigNumber() not a base {b} number: {n}'\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n\t x.s = null;\n\t }\n\n\t x.c = x.e = null;\n\t id = 0;\n\t }\n\t })();\n\n\n\t // Throw a BigNumber Error.\n\t function raise( caller, msg, val ) {\n\t var error = new Error( [\n\t 'new BigNumber', // 0\n\t 'cmp', // 1\n\t 'config', // 2\n\t 'div', // 3\n\t 'divToInt', // 4\n\t 'eq', // 5\n\t 'gt', // 6\n\t 'gte', // 7\n\t 'lt', // 8\n\t 'lte', // 9\n\t 'minus', // 10\n\t 'mod', // 11\n\t 'plus', // 12\n\t 'precision', // 13\n\t 'random', // 14\n\t 'round', // 15\n\t 'shift', // 16\n\t 'times', // 17\n\t 'toDigits', // 18\n\t 'toExponential', // 19\n\t 'toFixed', // 20\n\t 'toFormat', // 21\n\t 'toFraction', // 22\n\t 'pow', // 23\n\t 'toPrecision', // 24\n\t 'toString', // 25\n\t 'BigNumber' // 26\n\t ][caller] + '() ' + msg + ': ' + val );\n\n\t error.name = 'BigNumber Error';\n\t id = 0;\n\t throw error;\n\t }\n\n\n\t /*\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\n\t */\n\t function round( x, sd, rm, r ) {\n\t var d, i, j, k, n, ni, rd,\n\t xc = x.c,\n\t pows10 = POWS_TEN;\n\n\t // if x is not Infinity or NaN...\n\t if (xc) {\n\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\n\t // ni is the index of n within x.c.\n\t // d is the number of digits of n.\n\t // i is the index of rd within n including leading zeros.\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\n\t out: {\n\n\t // Get the number of digits of the first element of xc.\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n\t i = sd - d;\n\n\t // If the rounding digit is in the first element of xc...\n\t if ( i < 0 ) {\n\t i += LOG_BASE;\n\t j = sd;\n\t n = xc[ ni = 0 ];\n\n\t // Get the rounding digit at index j of n.\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\n\t } else {\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n\t if ( ni >= xc.length ) {\n\n\t if (r) {\n\n\t // Needed by sqrt.\n\t for ( ; xc.length <= ni; xc.push(0) );\n\t n = rd = 0;\n\t d = 1;\n\t i %= LOG_BASE;\n\t j = i - LOG_BASE + 1;\n\t } else {\n\t break out;\n\t }\n\t } else {\n\t n = k = xc[ni];\n\n\t // Get the number of digits of n.\n\t for ( d = 1; k >= 10; k /= 10, d++ );\n\n\t // Get the index of rd within n.\n\t i %= LOG_BASE;\n\n\t // Get the index of rd within n, adjusted for leading zeros.\n\t // The number of leading zeros of n is given by LOG_BASE - d.\n\t j = i - LOG_BASE + d;\n\n\t // Get the rounding digit at index j of n.\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n\t }\n\t }\n\n\t r = r || sd < 0 ||\n\n\t // Are there any non-zero digits after the rounding digit?\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n\t r = rm < 4\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n\t // Check whether the digit to the left of the rounding digit is odd.\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( sd < 1 || !xc[0] ) {\n\t xc.length = 0;\n\n\t if (r) {\n\n\t // Convert sd to decimal places.\n\t sd -= x.e + 1;\n\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\t xc[0] = pows10[ sd % LOG_BASE ];\n\t x.e = -sd || 0;\n\t } else {\n\n\t // Zero.\n\t xc[0] = x.e = 0;\n\t }\n\n\t return x;\n\t }\n\n\t // Remove excess digits.\n\t if ( i == 0 ) {\n\t xc.length = ni;\n\t k = 1;\n\t ni--;\n\t } else {\n\t xc.length = ni + 1;\n\t k = pows10[ LOG_BASE - i ];\n\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n\t // j > 0 means i > number of leading zeros of n.\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n\t }\n\n\t // Round up?\n\t if (r) {\n\n\t for ( ; ; ) {\n\n\t // If the digit to be rounded up is in the first element of xc...\n\t if ( ni == 0 ) {\n\n\t // i will be the length of xc[0] before k is added.\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n\t j = xc[0] += k;\n\t for ( k = 1; j >= 10; j /= 10, k++ );\n\n\t // if i != k the length has increased.\n\t if ( i != k ) {\n\t x.e++;\n\t if ( xc[0] == BASE ) xc[0] = 1;\n\t }\n\n\t break;\n\t } else {\n\t xc[ni] += k;\n\t if ( xc[ni] != BASE ) break;\n\t xc[ni--] = 0;\n\t k = 1;\n\t }\n\t }\n\t }\n\n\t // Remove trailing zeros.\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\n\t }\n\n\t // Overflow? Infinity.\n\t if ( x.e > MAX_EXP ) {\n\t x.c = x.e = null;\n\n\t // Underflow? Zero.\n\t } else if ( x.e < MIN_EXP ) {\n\t x.c = [ x.e = 0 ];\n\t }\n\t }\n\n\t return x;\n\t }\n\n\n\t // PROTOTYPE/INSTANCE METHODS\n\n\n\t /*\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\n\t */\n\t P.absoluteValue = P.abs = function () {\n\t var x = new BigNumber(this);\n\t if ( x.s < 0 ) x.s = 1;\n\t return x;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of Infinity.\n\t */\n\t P.ceil = function () {\n\t return round( new BigNumber(this), this.e + 1, 2 );\n\t };\n\n\n\t /*\n\t * Return\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * 0 if they have the same value,\n\t * or null if the value of either is NaN.\n\t */\n\t P.comparedTo = P.cmp = function ( y, b ) {\n\t id = 1;\n\t return compare( this, new BigNumber( y, b ) );\n\t };\n\n\n\t /*\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\n\t * of this BigNumber is ±Infinity or NaN.\n\t */\n\t P.decimalPlaces = P.dp = function () {\n\t var n, v,\n\t c = this.c;\n\n\t if ( !c ) return null;\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n\t // Subtract the number of trailing zeros of the last number.\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n\t if ( n < 0 ) n = 0;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * n / 0 = I\n\t * n / N = N\n\t * n / I = 0\n\t * 0 / n = 0\n\t * 0 / 0 = N\n\t * 0 / N = N\n\t * 0 / I = 0\n\t * N / n = N\n\t * N / 0 = N\n\t * N / N = N\n\t * N / I = N\n\t * I / n = I\n\t * I / 0 = I\n\t * I / N = N\n\t * I / I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.dividedBy = P.div = function ( y, b ) {\n\t id = 3;\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\n\t * BigNumber by the value of BigNumber(y, b).\n\t */\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n\t id = 4;\n\t return div( this, new BigNumber( y, b ), 0, 1 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.equals = P.eq = function ( y, b ) {\n\t id = 5;\n\t return compare( this, new BigNumber( y, b ) ) === 0;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of -Infinity.\n\t */\n\t P.floor = function () {\n\t return round( new BigNumber(this), this.e + 1, 3 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.greaterThan = P.gt = function ( y, b ) {\n\t id = 6;\n\t return compare( this, new BigNumber( y, b ) ) > 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n\t id = 7;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n\t */\n\t P.isFinite = function () {\n\t return !!this.c;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\n\t */\n\t P.isInteger = P.isInt = function () {\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\n\t */\n\t P.isNaN = function () {\n\t return !this.s;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\n\t */\n\t P.isNegative = P.isNeg = function () {\n\t return this.s < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n\t */\n\t P.isZero = function () {\n\t return !!this.c && this.c[0] == 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.lessThan = P.lt = function ( y, b ) {\n\t id = 8;\n\t return compare( this, new BigNumber( y, b ) ) < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n\t id = 9;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n\t };\n\n\n\t /*\n\t * n - 0 = n\n\t * n - N = N\n\t * n - I = -I\n\t * 0 - n = -n\n\t * 0 - 0 = 0\n\t * 0 - N = N\n\t * 0 - I = -I\n\t * N - n = N\n\t * N - 0 = N\n\t * N - N = N\n\t * N - I = N\n\t * I - n = I\n\t * I - 0 = I\n\t * I - N = N\n\t * I - I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.minus = P.sub = function ( y, b ) {\n\t var i, j, t, xLTy,\n\t x = this,\n\t a = x.s;\n\n\t id = 10;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.plus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Either Infinity?\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n\t // Either zero?\n\t if ( !xc[0] || !yc[0] ) {\n\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n\t ROUNDING_MODE == 3 ? -0 : 0 );\n\t }\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Determine which is the bigger number.\n\t if ( a = xe - ye ) {\n\n\t if ( xLTy = a < 0 ) {\n\t a = -a;\n\t t = xc;\n\t } else {\n\t ye = xe;\n\t t = yc;\n\t }\n\n\t t.reverse();\n\n\t // Prepend zeros to equalise exponents.\n\t for ( b = a; b--; t.push(0) );\n\t t.reverse();\n\t } else {\n\n\t // Exponents equal. Check digit by digit.\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n\t for ( a = b = 0; b < j; b++ ) {\n\n\t if ( xc[b] != yc[b] ) {\n\t xLTy = xc[b] < yc[b];\n\t break;\n\t }\n\t }\n\t }\n\n\t // x < y? Point xc to the array of the bigger number.\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n\t b = ( j = yc.length ) - ( i = xc.length );\n\n\t // Append zeros to xc if shorter.\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n\t b = BASE - 1;\n\n\t // Subtract yc from xc.\n\t for ( ; j > a; ) {\n\n\t if ( xc[--j] < yc[j] ) {\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\n\t --xc[i];\n\t xc[j] += BASE;\n\t }\n\n\t xc[j] -= yc[j];\n\t }\n\n\t // Remove leading zeros and adjust exponent accordingly.\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\n\n\t // Zero?\n\t if ( !xc[0] ) {\n\n\t // Following IEEE 754 (2008) 6.3,\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\n\t y.c = [ y.e = 0 ];\n\t return y;\n\t }\n\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n\t // for finite x and y.\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * n % 0 = N\n\t * n % N = N\n\t * n % I = n\n\t * 0 % n = 0\n\t * -0 % n = -0\n\t * 0 % 0 = N\n\t * 0 % N = N\n\t * 0 % I = 0\n\t * N % n = N\n\t * N % 0 = N\n\t * N % N = N\n\t * N % I = N\n\t * I % n = N\n\t * I % 0 = N\n\t * I % N = N\n\t * I % I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n\t */\n\t P.modulo = P.mod = function ( y, b ) {\n\t var q, s,\n\t x = this;\n\n\t id = 11;\n\t y = new BigNumber( y, b );\n\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\n\t return new BigNumber(NaN);\n\n\t // Return x if y is Infinity or x is zero.\n\t } else if ( !y.c || x.c && !x.c[0] ) {\n\t return new BigNumber(x);\n\t }\n\n\t if ( MODULO_MODE == 9 ) {\n\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\n\t // r = x - qy where 0 <= r < abs(y)\n\t s = y.s;\n\t y.s = 1;\n\t q = div( x, y, 0, 3 );\n\t y.s = s;\n\t q.s *= s;\n\t } else {\n\t q = div( x, y, 0, MODULO_MODE );\n\t }\n\n\t return x.minus( q.times(y) );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\n\t * i.e. multiplied by -1.\n\t */\n\t P.negated = P.neg = function () {\n\t var x = new BigNumber(this);\n\t x.s = -x.s || null;\n\t return x;\n\t };\n\n\n\t /*\n\t * n + 0 = n\n\t * n + N = N\n\t * n + I = I\n\t * 0 + n = n\n\t * 0 + 0 = 0\n\t * 0 + N = N\n\t * 0 + I = I\n\t * N + n = N\n\t * N + 0 = N\n\t * N + N = N\n\t * N + I = N\n\t * I + n = I\n\t * I + 0 = I\n\t * I + N = N\n\t * I + I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.plus = P.add = function ( y, b ) {\n\t var t,\n\t x = this,\n\t a = x.s;\n\n\t id = 12;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.minus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Return ±Infinity if either ±Infinity.\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n\t // Either zero?\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\t if ( a = xe - ye ) {\n\t if ( a > 0 ) {\n\t ye = xe;\n\t t = yc;\n\t } else {\n\t a = -a;\n\t t = xc;\n\t }\n\n\t t.reverse();\n\t for ( ; a--; t.push(0) );\n\t t.reverse();\n\t }\n\n\t a = xc.length;\n\t b = yc.length;\n\n\t // Point xc to the longer array, and b to the shorter length.\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\t for ( a = 0; b; ) {\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n\t xc[b] %= BASE;\n\t }\n\n\t if (a) {\n\t xc.unshift(a);\n\t ++ye;\n\t }\n\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\t // ye = MAX_EXP + 1 possible\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * Return the number of significant digits of the value of this BigNumber.\n\t *\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n\t */\n\t P.precision = P.sd = function (z) {\n\t var n, v,\n\t x = this,\n\t c = x.c;\n\n\t // 'precision() argument not a boolean or binary digit: {z}'\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\n\t if ( z != !!z ) z = null;\n\t }\n\n\t if ( !c ) return null;\n\t v = c.length - 1;\n\t n = v * LOG_BASE + 1;\n\n\t if ( v = c[v] ) {\n\n\t // Subtract the number of trailing zeros of the last element.\n\t for ( ; v % 10 == 0; v /= 10, n-- );\n\n\t // Add the number of digits of the first element.\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\n\t }\n\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n\t * omitted.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'round() decimal places out of range: {dp}'\n\t * 'round() decimal places not an integer: {dp}'\n\t * 'round() rounding mode not an integer: {rm}'\n\t * 'round() rounding mode out of range: {rm}'\n\t */\n\t P.round = function ( dp, rm ) {\n\t var n = new BigNumber(this);\n\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n\t round( n, ~~dp + this.e + 1, rm == null ||\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n\t }\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n\t *\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t *\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n\t * otherwise.\n\t *\n\t * 'shift() argument not an integer: {k}'\n\t * 'shift() argument out of range: {k}'\n\t */\n\t P.shift = function (k) {\n\t var n = this;\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\n\t ? n.times( '1e' + truncate(k) )\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\n\t : n );\n\t };\n\n\n\t /*\n\t * sqrt(-n) = N\n\t * sqrt( N) = N\n\t * sqrt(-I) = N\n\t * sqrt( I) = I\n\t * sqrt( 0) = 0\n\t * sqrt(-0) = -0\n\t *\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.squareRoot = P.sqrt = function () {\n\t var m, n, r, rep, t,\n\t x = this,\n\t c = x.c,\n\t s = x.s,\n\t e = x.e,\n\t dp = DECIMAL_PLACES + 4,\n\t half = new BigNumber('0.5');\n\n\t // Negative/NaN/Infinity/zero?\n\t if ( s !== 1 || !c || !c[0] ) {\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n\t }\n\n\t // Initial estimate.\n\t s = Math.sqrt( +x );\n\n\t // Math.sqrt underflow/overflow?\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\t if ( s == 0 || s == 1 / 0 ) {\n\t n = coeffToString(c);\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\n\t s = Math.sqrt(n);\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n\t if ( s == 1 / 0 ) {\n\t n = '1e' + e;\n\t } else {\n\t n = s.toExponential();\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n\t }\n\n\t r = new BigNumber(n);\n\t } else {\n\t r = new BigNumber( s + '' );\n\t }\n\n\t // Check for zero.\n\t // r could be zero if MIN_EXP is changed after the this value was created.\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n\t // coeffToString to throw.\n\t if ( r.c[0] ) {\n\t e = r.e;\n\t s = e + dp;\n\t if ( s < 3 ) s = 0;\n\n\t // Newton-Raphson iteration.\n\t for ( ; ; ) {\n\t t = r;\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\n\n\t // The exponent of r may here be one less than the final result exponent,\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n\t // are indexed correctly.\n\t if ( r.e < e ) --s;\n\t n = n.slice( s - 3, s + 1 );\n\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n\t // iteration.\n\t if ( n == '9999' || !rep && n == '4999' ) {\n\n\t // On the first iteration only, check to see if rounding up gives the\n\t // exact result as the nines may infinitely repeat.\n\t if ( !rep ) {\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n\t if ( t.times(t).eq(x) ) {\n\t r = t;\n\t break;\n\t }\n\t }\n\n\t dp += 4;\n\t s += 4;\n\t rep = 1;\n\t } else {\n\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n\t // result. If not, then there are further digits and m will be truthy.\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n\t // Truncate to the first rounding digit.\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\n\t m = !r.times(r).eq(x);\n\t }\n\n\t break;\n\t }\n\t }\n\t }\n\t }\n\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n\t };\n\n\n\t /*\n\t * n * 0 = 0\n\t * n * N = N\n\t * n * I = I\n\t * 0 * n = 0\n\t * 0 * 0 = 0\n\t * 0 * N = N\n\t * 0 * I = N\n\t * N * n = N\n\t * N * 0 = N\n\t * N * N = N\n\t * N * I = N\n\t * I * n = I\n\t * I * 0 = N\n\t * I * N = N\n\t * I * I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\n\t * BigNumber(y, b).\n\t */\n\t P.times = P.mul = function ( y, b ) {\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n\t base, sqrtBase,\n\t x = this,\n\t xc = x.c,\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n\t // Either NaN, ±Infinity or ±0?\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n\t y.c = y.e = y.s = null;\n\t } else {\n\t y.s *= x.s;\n\n\t // Return ±Infinity if either is ±Infinity.\n\t if ( !xc || !yc ) {\n\t y.c = y.e = null;\n\n\t // Return ±0 if either is ±0.\n\t } else {\n\t y.c = [0];\n\t y.e = 0;\n\t }\n\t }\n\n\t return y;\n\t }\n\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n\t y.s *= x.s;\n\t xcL = xc.length;\n\t ycL = yc.length;\n\n\t // Ensure xc points to longer array and xcL to its length.\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n\t // Initialise the result array with zeros.\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n\t base = BASE;\n\t sqrtBase = SQRT_BASE;\n\n\t for ( i = ycL; --i >= 0; ) {\n\t c = 0;\n\t ylo = yc[i] % sqrtBase;\n\t yhi = yc[i] / sqrtBase | 0;\n\n\t for ( k = xcL, j = i + k; j > i; ) {\n\t xlo = xc[--k] % sqrtBase;\n\t xhi = xc[k] / sqrtBase | 0;\n\t m = yhi * xlo + xhi * ylo;\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n\t zc[j--] = xlo % base;\n\t }\n\n\t zc[j] = c;\n\t }\n\n\t if (c) {\n\t ++e;\n\t } else {\n\t zc.shift();\n\t }\n\n\t return normalise( y, zc, e );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toDigits() precision out of range: {sd}'\n\t * 'toDigits() precision not an integer: {sd}'\n\t * 'toDigits() rounding mode not an integer: {rm}'\n\t * 'toDigits() rounding mode out of range: {rm}'\n\t */\n\t P.toDigits = function ( sd, rm ) {\n\t var n = new BigNumber(this);\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n\t return sd ? round( n, sd, rm ) : n;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in exponential notation and\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toExponential() decimal places not an integer: {dp}'\n\t * 'toExponential() decimal places out of range: {dp}'\n\t * 'toExponential() rounding mode not an integer: {rm}'\n\t * 'toExponential() rounding mode out of range: {rm}'\n\t */\n\t P.toExponential = function ( dp, rm ) {\n\t return format( this,\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFixed() decimal places not an integer: {dp}'\n\t * 'toFixed() decimal places out of range: {dp}'\n\t * 'toFixed() rounding mode not an integer: {rm}'\n\t * 'toFixed() rounding mode out of range: {rm}'\n\t */\n\t P.toFixed = function ( dp, rm ) {\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n\t * of the FORMAT object (see BigNumber.config).\n\t *\n\t * FORMAT = {\n\t * decimalSeparator : '.',\n\t * groupSeparator : ',',\n\t * groupSize : 3,\n\t * secondaryGroupSize : 0,\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\n\t * fractionGroupSize : 0\n\t * };\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFormat() decimal places not an integer: {dp}'\n\t * 'toFormat() decimal places out of range: {dp}'\n\t * 'toFormat() rounding mode not an integer: {rm}'\n\t * 'toFormat() rounding mode out of range: {rm}'\n\t */\n\t P.toFormat = function ( dp, rm ) {\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\n\n\t if ( this.c ) {\n\t var i,\n\t arr = str.split('.'),\n\t g1 = +FORMAT.groupSize,\n\t g2 = +FORMAT.secondaryGroupSize,\n\t groupSeparator = FORMAT.groupSeparator,\n\t intPart = arr[0],\n\t fractionPart = arr[1],\n\t isNeg = this.s < 0,\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\n\t len = intDigits.length;\n\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n\t if ( g1 > 0 && len > 0 ) {\n\t i = len % g1 || g1;\n\t intPart = intDigits.substr( 0, i );\n\n\t for ( ; i < len; i += g1 ) {\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\n\t }\n\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n\t if (isNeg) intPart = '-' + intPart;\n\t }\n\n\t str = fractionPart\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n\t '$&' + FORMAT.fractionGroupSeparator )\n\t : fractionPart )\n\t : intPart;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\n\t * an integer numerator and an integer denominator. The denominator will be a positive\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\n\t * denominator is not specified, the denominator will be the lowest value necessary to\n\t * represent the number exactly.\n\t *\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n\t *\n\t * 'toFraction() max denominator not an integer: {md}'\n\t * 'toFraction() max denominator out of range: {md}'\n\t */\n\t P.toFraction = function (md) {\n\t var arr, d0, d2, e, exp, n, n0, q, s,\n\t k = ERRORS,\n\t x = this,\n\t xc = x.c,\n\t d = new BigNumber(ONE),\n\t n1 = d0 = new BigNumber(ONE),\n\t d1 = n0 = new BigNumber(ONE);\n\n\t if ( md != null ) {\n\t ERRORS = false;\n\t n = new BigNumber(md);\n\t ERRORS = k;\n\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n\t if (ERRORS) {\n\t raise( 22,\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n\t }\n\n\t // ERRORS is false:\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n\t }\n\t }\n\n\t if ( !xc ) return x.toString();\n\t s = coeffToString(xc);\n\n\t // Determine initial denominator.\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\t e = d.e = s.length - x.e - 1;\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n\t exp = MAX_EXP;\n\t MAX_EXP = 1 / 0;\n\t n = new BigNumber(s);\n\n\t // n0 = d1 = 0\n\t n0.c[0] = 0;\n\n\t for ( ; ; ) {\n\t q = div( n, d, 0, 1 );\n\t d2 = d0.plus( q.times(d1) );\n\t if ( d2.cmp(md) == 1 ) break;\n\t d0 = d1;\n\t d1 = d2;\n\t n1 = n0.plus( q.times( d2 = n1 ) );\n\t n0 = d2;\n\t d = n.minus( q.times( d2 = d ) );\n\t n = d2;\n\t }\n\n\t d2 = div( md.minus(d0), d1, 0, 1 );\n\t n0 = n0.plus( d2.times(n1) );\n\t d0 = d0.plus( d2.times(d1) );\n\t n0.s = n1.s = x.s;\n\t e *= 2;\n\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n\t ? [ n1.toString(), d1.toString() ]\n\t : [ n0.toString(), d0.toString() ];\n\n\t MAX_EXP = exp;\n\t return arr;\n\t };\n\n\n\t /*\n\t * Return the value of this BigNumber converted to a number primitive.\n\t */\n\t P.toNumber = function () {\n\t var x = this;\n\n\t // Ensure zero has correct sign.\n\t return +x || ( x.s ? x.s * 0 : NaN );\n\t };\n\n\n\t /*\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n\t * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n\t *\n\t * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n\t * (Performs 54 loop iterations for n of 9007199254740992.)\n\t *\n\t * 'pow() exponent not an integer: {n}'\n\t * 'pow() exponent out of range: {n}'\n\t */\n\t P.toPower = P.pow = function (n) {\n\t var k, y,\n\t i = mathfloor( n < 0 ? -n : +n ),\n\t x = this;\n\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n\t parseFloat(n) != n && !( n = NaN ) ) ) {\n\t return new BigNumber( Math.pow( +x, n ) );\n\t }\n\n\t // Truncating each coefficient array to a length of k after each multiplication equates\n\t // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n\t // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n\t k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n\t y = new BigNumber(ONE);\n\n\t for ( ; ; ) {\n\n\t if ( i % 2 ) {\n\t y = y.times(x);\n\t if ( !y.c ) break;\n\t if ( k && y.c.length > k ) y.c.length = k;\n\t }\n\n\t i = mathfloor( i / 2 );\n\t if ( !i ) break;\n\n\t x = x.times(x);\n\t if ( k && x.c && x.c.length > k ) x.c.length = k;\n\t }\n\n\t if ( n < 0 ) y = ONE.div(y);\n\t return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\n\t * exponential notation.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toPrecision() precision not an integer: {sd}'\n\t * 'toPrecision() precision out of range: {sd}'\n\t * 'toPrecision() rounding mode not an integer: {rm}'\n\t * 'toPrecision() rounding mode out of range: {rm}'\n\t */\n\t P.toPrecision = function ( sd, rm ) {\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n\t ? sd | 0 : null, rm, 24 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n\t * TO_EXP_NEG, return exponential notation.\n\t *\n\t * [b] {number} Integer, 2 to 64 inclusive.\n\t *\n\t * 'toString() base not an integer: {b}'\n\t * 'toString() base out of range: {b}'\n\t */\n\t P.toString = function (b) {\n\t var str,\n\t n = this,\n\t s = n.s,\n\t e = n.e;\n\n\t // Infinity or NaN?\n\t if ( e === null ) {\n\n\t if (s) {\n\t str = 'Infinity';\n\t if ( s < 0 ) str = '-' + str;\n\t } else {\n\t str = 'NaN';\n\t }\n\t } else {\n\t str = coeffToString( n.c );\n\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n\t ? toExponential( str, e )\n\t : toFixedPoint( str, e );\n\t } else {\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n\t }\n\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n\t * number.\n\t */\n\t P.truncated = P.trunc = function () {\n\t return round( new BigNumber(this), this.e + 1, 1 );\n\t };\n\n\n\n\t /*\n\t * Return as toString, but do not accept a base argument.\n\t */\n\t P.valueOf = P.toJSON = function () {\n\t return this.toString();\n\t };\n\n\n\t // Aliases for BigDecimal methods.\n\t //P.add = P.plus; // P.add included above\n\t //P.subtract = P.minus; // P.sub included above\n\t //P.multiply = P.times; // P.mul included above\n\t //P.divide = P.div;\n\t //P.remainder = P.mod;\n\t //P.compareTo = P.cmp;\n\t //P.negate = P.neg;\n\n\n\t if ( configObj != null ) BigNumber.config(configObj);\n\n\t return BigNumber;\n\t }", "function another(configObj) {\n\t var div,\n\n\t // id tracks the caller function, so its name can be included in error messages.\n\t id = 0,\n\t P = BigNumber.prototype,\n\t ONE = new BigNumber(1),\n\n\n\t /********************************* EDITABLE DEFAULTS **********************************/\n\n\n\t /*\n\t * The default values below must be integers within the inclusive ranges stated.\n\t * The values can also be changed at run-time using BigNumber.config.\n\t */\n\n\t // The maximum number of decimal places for operations involving division.\n\t DECIMAL_PLACES = 20, // 0 to MAX\n\n\t /*\n\t * The rounding mode used when rounding to the above decimal places, and when using\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n\t * UP 0 Away from zero.\n\t * DOWN 1 Towards zero.\n\t * CEIL 2 Towards +Infinity.\n\t * FLOOR 3 Towards -Infinity.\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n\t */\n\t ROUNDING_MODE = 4, // 0 to 8\n\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n\t // The exponent value at and beneath which toString returns exponential notation.\n\t // Number type: -7\n\t TO_EXP_NEG = -7, // 0 to -MAX\n\n\t // The exponent value at and above which toString returns exponential notation.\n\t // Number type: 21\n\t TO_EXP_POS = 21, // 0 to MAX\n\n\t // RANGE : [MIN_EXP, MAX_EXP]\n\n\t // The minimum exponent value, beneath which underflow to zero occurs.\n\t // Number type: -324 (5e-324)\n\t MIN_EXP = -1e7, // -1 to -MAX\n\n\t // The maximum exponent value, above which overflow to Infinity occurs.\n\t // Number type: 308 (1.7976931348623157e+308)\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n\t MAX_EXP = 1e7, // 1 to MAX\n\n\t // Whether BigNumber Errors are ever thrown.\n\t ERRORS = true, // true or false\n\n\t // Change to intValidatorNoErrors if ERRORS is false.\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n\t // Whether to use cryptographically-secure random number generation, if available.\n\t CRYPTO = false, // true or false\n\n\t /*\n\t * The modulo mode used when calculating the modulus: a mod n.\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n\t * The remainder (r) is calculated as: r = a - n * q.\n\t *\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\n\t * DOWN 1 The remainder has the same sign as the dividend.\n\t * This modulo mode is commonly known as 'truncated division' and is\n\t * equivalent to (a % n) in JavaScript.\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n\t * The remainder is always positive.\n\t *\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n\t * modes are commonly used for the modulus operation.\n\t * Although the other rounding modes can also be used, they may not give useful results.\n\t */\n\t MODULO_MODE = 1, // 0 to 9\n\n\t // The maximum number of significant digits of the result of the toPower operation.\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\n\t POW_PRECISION = 100, // 0 to MAX\n\n\t // The format specification used by the BigNumber.prototype.toFormat method.\n\t FORMAT = {\n\t decimalSeparator: '.',\n\t groupSeparator: ',',\n\t groupSize: 3,\n\t secondaryGroupSize: 0,\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\n\t fractionGroupSize: 0\n\t };\n\n\n\t /******************************************************************************************/\n\n\n\t // CONSTRUCTOR\n\n\n\t /*\n\t * The BigNumber constructor and exported function.\n\t * Create and return a new instance of a BigNumber object.\n\t *\n\t * n {number|string|BigNumber} A numeric value.\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n\t */\n\t function BigNumber( n, b ) {\n\t var c, e, i, num, len, str,\n\t x = this;\n\n\t // Enable constructor usage without new.\n\t if ( !( x instanceof BigNumber ) ) {\n\n\t // 'BigNumber() constructor call without new: {n}'\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\n\t return new BigNumber( n, b );\n\t }\n\n\t // 'new BigNumber() base not an integer: {b}'\n\t // 'new BigNumber() base out of range: {b}'\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n\t // Duplicate.\n\t if ( n instanceof BigNumber ) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = ( n = n.c ) ? n.slice() : n;\n\t id = 0;\n\t return;\n\t }\n\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n\t // Fast path for integers.\n\t if ( n === ~~n ) {\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n\t x.e = e;\n\t x.c = [n];\n\t id = 0;\n\t return;\n\t }\n\n\t str = n + '';\n\t } else {\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\t } else {\n\t b = b | 0;\n\t str = n + '';\n\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n\t // Allow exponential notation to be used with base 10 argument.\n\t if ( b == 10 ) {\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n\t }\n\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n\t // Any number in exponential form will fail due to the [Ee][+-].\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n\t return parseNumeric( x, str, num, b );\n\t }\n\n\t if (num) {\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t raise( id, tooManyDigits, n );\n\t }\n\n\t // Prevent later check for length on converted number.\n\t num = false;\n\t } else {\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\n\t str = convertBase( str, 10, b, x.s );\n\t }\n\n\t // Decimal point?\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n\t // Exponential form?\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n\t // Determine exponent.\n\t if ( e < 0 ) e = i;\n\t e += +str.slice( i + 1 );\n\t str = str.substring( 0, i );\n\t } else if ( e < 0 ) {\n\n\t // Integer.\n\t e = str.length;\n\t }\n\n\t // Determine leading zeros.\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n\t // Determine trailing zeros.\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\n\t str = str.slice( i, len + 1 );\n\n\t if (str) {\n\t len = str.length;\n\n\t // Disallow numbers with over 15 significant digits if number type.\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n\t e = e - i - 1;\n\n\t // Overflow?\n\t if ( e > MAX_EXP ) {\n\n\t // Infinity.\n\t x.c = x.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t } else {\n\t x.e = e;\n\t x.c = [];\n\n\t // Transform base\n\n\t // e is the base 10 exponent.\n\t // i is where to slice str to get the first element of the coefficient array.\n\t i = ( e + 1 ) % LOG_BASE;\n\t if ( e < 0 ) i += LOG_BASE;\n\n\t if ( i < len ) {\n\t if (i) x.c.push( +str.slice( 0, i ) );\n\n\t for ( len -= LOG_BASE; i < len; ) {\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\n\t }\n\n\t str = str.slice(i);\n\t i = LOG_BASE - str.length;\n\t } else {\n\t i -= len;\n\t }\n\n\t for ( ; i--; str += '0' );\n\t x.c.push( +str );\n\t }\n\t } else {\n\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t }\n\n\t id = 0;\n\t }\n\n\n\t // CONSTRUCTOR PROPERTIES\n\n\n\t BigNumber.another = another;\n\n\t BigNumber.ROUND_UP = 0;\n\t BigNumber.ROUND_DOWN = 1;\n\t BigNumber.ROUND_CEIL = 2;\n\t BigNumber.ROUND_FLOOR = 3;\n\t BigNumber.ROUND_HALF_UP = 4;\n\t BigNumber.ROUND_HALF_DOWN = 5;\n\t BigNumber.ROUND_HALF_EVEN = 6;\n\t BigNumber.ROUND_HALF_CEIL = 7;\n\t BigNumber.ROUND_HALF_FLOOR = 8;\n\t BigNumber.EUCLID = 9;\n\n\n\t /*\n\t * Configure infrequently-changing library-wide settings.\n\t *\n\t * Accept an object or an argument list, with one or many of the following properties or\n\t * parameters respectively:\n\t *\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n\t * ERRORS {boolean|number} true, false, 1 or 0\n\t * CRYPTO {boolean|number} true, false, 1 or 0\n\t * MODULO_MODE {number} 0 to 9 inclusive\n\t * POW_PRECISION {number} 0 to MAX inclusive\n\t * FORMAT {object} See BigNumber.prototype.toFormat\n\t * decimalSeparator {string}\n\t * groupSeparator {string}\n\t * groupSize {number}\n\t * secondaryGroupSize {number}\n\t * fractionGroupSeparator {string}\n\t * fractionGroupSize {number}\n\t *\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\n\t *\n\t * E.g.\n\t * BigNumber.config(20, 4) is equivalent to\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n\t *\n\t * Ignore properties/parameters set to null or undefined.\n\t * Return an object with the properties current values.\n\t */\n\t BigNumber.config = function () {\n\t var v, p,\n\t i = 0,\n\t r = {},\n\t a = arguments,\n\t o = a[0],\n\t has = o && typeof o == 'object'\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\n\t // 'config() DECIMAL_PLACES out of range: {v}'\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t DECIMAL_PLACES = v | 0;\n\t }\n\t r[p] = DECIMAL_PLACES;\n\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n\t // 'config() ROUNDING_MODE not an integer: {v}'\n\t // 'config() ROUNDING_MODE out of range: {v}'\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n\t ROUNDING_MODE = v | 0;\n\t }\n\t r[p] = ROUNDING_MODE;\n\n\t // EXPONENTIAL_AT {number|number[]}\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n\t TO_EXP_NEG = v[0] | 0;\n\t TO_EXP_POS = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n\t }\n\t }\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n\t // 'config() RANGE not an integer: {v}'\n\t // 'config() RANGE cannot be zero: {v}'\n\t // 'config() RANGE out of range: {v}'\n\t if ( has( p = 'RANGE' ) ) {\n\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n\t MIN_EXP = v[0] | 0;\n\t MAX_EXP = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n\t }\n\t }\n\t r[p] = [ MIN_EXP, MAX_EXP ];\n\n\t // ERRORS {boolean|number} true, false, 1 or 0.\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\n\t if ( has( p = 'ERRORS' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t id = 0;\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = ERRORS;\n\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\n\t // 'config() crypto unavailable: {crypto}'\n\t if ( has( p = 'CRYPTO' ) ) {\n\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = CRYPTO;\n\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n\t // 'config() MODULO_MODE not an integer: {v}'\n\t // 'config() MODULO_MODE out of range: {v}'\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n\t MODULO_MODE = v | 0;\n\t }\n\t r[p] = MODULO_MODE;\n\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n\t // 'config() POW_PRECISION not an integer: {v}'\n\t // 'config() POW_PRECISION out of range: {v}'\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t POW_PRECISION = v | 0;\n\t }\n\t r[p] = POW_PRECISION;\n\n\t // FORMAT {object}\n\t // 'config() FORMAT not an object: {v}'\n\t if ( has( p = 'FORMAT' ) ) {\n\n\t if ( typeof v == 'object' ) {\n\t FORMAT = v;\n\t } else if (ERRORS) {\n\t raise( 2, p + ' not an object', v );\n\t }\n\t }\n\t r[p] = FORMAT;\n\n\t return r;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the maximum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the minimum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n\t /*\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n\t * zeros are produced).\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t *\n\t * 'random() decimal places not an integer: {dp}'\n\t * 'random() decimal places out of range: {dp}'\n\t * 'random() crypto unavailable: {crypto}'\n\t */\n\t BigNumber.random = (function () {\n\t var pow2_53 = 0x20000000000000;\n\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n\t // Check if Math.random() produces more than 32 bits of randomness.\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n\t (Math.random() * 0x800000 | 0); };\n\n\t return function (dp) {\n\t var a, b, e, k, v,\n\t i = 0,\n\t c = [],\n\t rand = new BigNumber(ONE);\n\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n\t k = mathceil( dp / LOG_BASE );\n\n\t if (CRYPTO) {\n\n\t // Browsers supporting crypto.getRandomValues.\n\t if ( crypto && crypto.getRandomValues ) {\n\n\t a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n\t for ( ; i < k; ) {\n\n\t // 53 bits:\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n\t // 11111 11111111 11111111\n\t // 0x20000 is 2^21.\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n\t // Rejection sampling:\n\t // 0 <= v < 9007199254740992\n\t // Probability that v >= 9e15, is\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\t if ( v >= 9e15 ) {\n\t b = crypto.getRandomValues( new Uint32Array(2) );\n\t a[i] = b[0];\n\t a[i + 1] = b[1];\n\t } else {\n\n\t // 0 <= v <= 8999999999999999\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 2;\n\t }\n\t }\n\t i = k / 2;\n\n\t // Node.js supporting crypto.randomBytes.\n\t } else if ( crypto && crypto.randomBytes ) {\n\n\t // buffer\n\t a = crypto.randomBytes( k *= 7 );\n\n\t for ( ; i < k; ) {\n\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n\t // 0 <= v < 9007199254740992\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n\t if ( v >= 9e15 ) {\n\t crypto.randomBytes(7).copy( a, i );\n\t } else {\n\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 7;\n\t }\n\t }\n\t i = k / 7;\n\t } else if (ERRORS) {\n\t raise( 14, 'crypto unavailable', crypto );\n\t }\n\t }\n\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n\t if (!i) {\n\n\t for ( ; i < k; ) {\n\t v = random53bitInt();\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\n\t }\n\t }\n\n\t k = c[--i];\n\t dp %= LOG_BASE;\n\n\t // Convert trailing digits to zeros according to dp.\n\t if ( k && dp ) {\n\t v = POWS_TEN[LOG_BASE - dp];\n\t c[i] = mathfloor( k / v ) * v;\n\t }\n\n\t // Remove trailing elements which are zero.\n\t for ( ; c[i] === 0; c.pop(), i-- );\n\n\t // Zero?\n\t if ( i < 0 ) {\n\t c = [ e = 0 ];\n\t } else {\n\n\t // Remove leading elements which are zero and adjust exponent accordingly.\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n\t // Count the digits of the first element of c to determine leading zeros, and...\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n\t // adjust the exponent accordingly.\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\n\t }\n\n\t rand.e = e;\n\t rand.c = c;\n\t return rand;\n\t };\n\t })();\n\n\n\t // PRIVATE FUNCTIONS\n\n\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\n\t function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }\n\n\n\t // Perform division in the specified base. Called by div and convertBase.\n\t div = (function () {\n\n\t // Assume non-zero x and k.\n\t function multiply( x, k, base ) {\n\t var m, temp, xlo, xhi,\n\t carry = 0,\n\t i = x.length,\n\t klo = k % SQRT_BASE,\n\t khi = k / SQRT_BASE | 0;\n\n\t for ( x = x.slice(); i--; ) {\n\t xlo = x[i] % SQRT_BASE;\n\t xhi = x[i] / SQRT_BASE | 0;\n\t m = khi * xlo + xhi * klo;\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n\t x[i] = temp % base;\n\t }\n\n\t if (carry) x.unshift(carry);\n\n\t return x;\n\t }\n\n\t function compare( a, b, aL, bL ) {\n\t var i, cmp;\n\n\t if ( aL != bL ) {\n\t cmp = aL > bL ? 1 : -1;\n\t } else {\n\n\t for ( i = cmp = 0; i < aL; i++ ) {\n\n\t if ( a[i] != b[i] ) {\n\t cmp = a[i] > b[i] ? 1 : -1;\n\t break;\n\t }\n\t }\n\t }\n\t return cmp;\n\t }\n\n\t function subtract( a, b, aL, base ) {\n\t var i = 0;\n\n\t // Subtract b from a.\n\t for ( ; aL--; ) {\n\t a[aL] -= i;\n\t i = a[aL] < b[aL] ? 1 : 0;\n\t a[aL] = i * base + a[aL] - b[aL];\n\t }\n\n\t // Remove leading zeros.\n\t for ( ; !a[0] && a.length > 1; a.shift() );\n\t }\n\n\t // x: dividend, y: divisor.\n\t return function ( x, y, dp, rm, base ) {\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n\t yL, yz,\n\t s = x.s == y.s ? 1 : -1,\n\t xc = x.c,\n\t yc = y.c;\n\n\t // Either NaN, Infinity or 0?\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n\t return new BigNumber(\n\n\t // Return NaN if either NaN, or both Infinity or 0.\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n\t );\n\t }\n\n\t q = new BigNumber(s);\n\t qc = q.c = [];\n\t e = x.e - y.e;\n\t s = dp + e + 1;\n\n\t if ( !base ) {\n\t base = BASE;\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n\t s = s / LOG_BASE | 0;\n\t }\n\n\t // Result exponent may be one less then the current value of e.\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n\t if ( s < 0 ) {\n\t qc.push(1);\n\t more = true;\n\t } else {\n\t xL = xc.length;\n\t yL = yc.length;\n\t i = 0;\n\t s += 2;\n\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n\t n = mathfloor( base / ( yc[0] + 1 ) );\n\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n\t if ( n > 1 ) {\n\t yc = multiply( yc, n, base );\n\t xc = multiply( xc, n, base );\n\t yL = yc.length;\n\t xL = xc.length;\n\t }\n\n\t xi = yL;\n\t rem = xc.slice( 0, yL );\n\t remL = rem.length;\n\n\t // Add zeros to make remainder as long as divisor.\n\t for ( ; remL < yL; rem[remL++] = 0 );\n\t yz = yc.slice();\n\t yz.unshift(0);\n\t yc0 = yc[0];\n\t if ( yc[1] >= base / 2 ) yc0++;\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n\t do {\n\t n = 0;\n\n\t // Compare divisor and remainder.\n\t cmp = compare( yc, rem, yL, remL );\n\n\t // If divisor < remainder.\n\t if ( cmp < 0 ) {\n\n\t // Calculate trial digit, n.\n\n\t rem0 = rem[0];\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n\t // n is how many times the divisor goes into the current remainder.\n\t n = mathfloor( rem0 / yc0 );\n\n\t // Algorithm:\n\t // 1. product = divisor * trial digit (n)\n\t // 2. if product > remainder: product -= divisor, n--\n\t // 3. remainder -= product\n\t // 4. if product was < remainder at 2:\n\t // 5. compare new remainder and divisor\n\t // 6. If remainder > divisor: remainder -= divisor, n++\n\n\t if ( n > 1 ) {\n\n\t // n may be > base only when base is 3.\n\t if (n >= base) n = base - 1;\n\n\t // product = divisor * trial digit.\n\t prod = multiply( yc, n, base );\n\t prodL = prod.length;\n\t remL = rem.length;\n\n\t // Compare product and remainder.\n\t // If product > remainder.\n\t // Trial digit n too high.\n\t // n is 1 too high about 5% of the time, and is not known to have\n\t // ever been more than 1 too high.\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\n\t n--;\n\n\t // Subtract divisor from product.\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\n\t prodL = prod.length;\n\t cmp = 1;\n\t }\n\t } else {\n\n\t // n is 0 or 1, cmp is -1.\n\t // If n is 0, there is no need to compare yc and rem again below,\n\t // so change cmp to 1 to avoid it.\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\n\t if ( n == 0 ) {\n\n\t // divisor < remainder, so n must be at least 1.\n\t cmp = n = 1;\n\t }\n\n\t // product = divisor\n\t prod = yc.slice();\n\t prodL = prod.length;\n\t }\n\n\t if ( prodL < remL ) prod.unshift(0);\n\n\t // Subtract product from remainder.\n\t subtract( rem, prod, remL, base );\n\t remL = rem.length;\n\n\t // If product was < remainder.\n\t if ( cmp == -1 ) {\n\n\t // Compare divisor and new remainder.\n\t // If divisor < new remainder, subtract divisor from remainder.\n\t // Trial digit n too low.\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\n\t n++;\n\n\t // Subtract divisor from remainder.\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\n\t remL = rem.length;\n\t }\n\t }\n\t } else if ( cmp === 0 ) {\n\t n++;\n\t rem = [0];\n\t } // else cmp === 1 and n will be 0\n\n\t // Add the next digit, n, to the result array.\n\t qc[i++] = n;\n\n\t // Update the remainder.\n\t if ( rem[0] ) {\n\t rem[remL++] = xc[xi] || 0;\n\t } else {\n\t rem = [ xc[xi] ];\n\t remL = 1;\n\t }\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n\t more = rem[0] != null;\n\n\t // Leading zero?\n\t if ( !qc[0] ) qc.shift();\n\t }\n\n\t if ( base == BASE ) {\n\n\t // To calculate q.e, first get the number of digits of qc[0].\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n\t // Caller is convertBase.\n\t } else {\n\t q.e = e;\n\t q.r = +more;\n\t }\n\n\t return q;\n\t };\n\t })();\n\n\n\t /*\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\n\t * notation rounded to the specified decimal places or significant digits.\n\t *\n\t * n is a BigNumber.\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\n\t * rm is the rounding mode.\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n\t */\n\t function format( n, i, rm, caller ) {\n\t var c0, e, ne, len, str;\n\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n\t ? rm | 0 : ROUNDING_MODE;\n\n\t if ( !n.c ) return n.toString();\n\t c0 = n.c[0];\n\t ne = n.e;\n\n\t if ( i == null ) {\n\t str = coeffToString( n.c );\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n\t ? toExponential( str, ne )\n\t : toFixedPoint( str, ne );\n\t } else {\n\t n = round( new BigNumber(n), i, rm );\n\n\t // n.e may have changed if the value was rounded up.\n\t e = n.e;\n\n\t str = coeffToString( n.c );\n\t len = str.length;\n\n\t // toPrecision returns exponential notation if the number of significant digits\n\t // specified is less than the number of digits necessary to represent the integer\n\t // part of the value in fixed-point notation.\n\n\t // Exponential notation.\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n\t // Append zeros?\n\t for ( ; len < i; str += '0', len++ );\n\t str = toExponential( str, e );\n\n\t // Fixed-point notation.\n\t } else {\n\t i -= ne;\n\t str = toFixedPoint( str, e );\n\n\t // Append zeros?\n\t if ( e + 1 > len ) {\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n\t } else {\n\t i += e - len;\n\t if ( i > 0 ) {\n\t if ( e + 1 == len ) str += '.';\n\t for ( ; i--; str += '0' );\n\t }\n\t }\n\t }\n\t }\n\n\t return n.s < 0 && c0 ? '-' + str : str;\n\t }\n\n\n\t // Handle BigNumber.max and BigNumber.min.\n\t function maxOrMin( args, method ) {\n\t var m, n,\n\t i = 0;\n\n\t if ( isArray( args[0] ) ) args = args[0];\n\t m = new BigNumber( args[0] );\n\n\t for ( ; ++i < args.length; ) {\n\t n = new BigNumber( args[i] );\n\n\t // If any number is NaN, return NaN.\n\t if ( !n.s ) {\n\t m = n;\n\t break;\n\t } else if ( method.call( m, n ) ) {\n\t m = n;\n\t }\n\t }\n\n\t return m;\n\t }\n\n\n\t /*\n\t * Return true if n is an integer in range, otherwise throw.\n\t * Use for argument validation when ERRORS is true.\n\t */\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\n\t if ( n < min || n > max || n != truncate(n) ) {\n\t raise( caller, ( name || 'decimal places' ) +\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n\t }\n\n\t return true;\n\t }\n\n\n\t /*\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n\t * Called by minus, plus and times.\n\t */\n\t function normalise( n, c, e ) {\n\t var i = 1,\n\t j = c.length;\n\n\t // Remove trailing zeros.\n\t for ( ; !c[--j]; c.pop() );\n\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n\t // Overflow?\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n\t // Infinity.\n\t n.c = n.e = null;\n\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\n\t // Zero.\n\t n.c = [ n.e = 0 ];\n\t } else {\n\t n.e = e;\n\t n.c = c;\n\t }\n\n\t return n;\n\t }\n\n\n\t // Handle values that fail the validity test in BigNumber.\n\t parseNumeric = (function () {\n\t var basePrefix = /^(-?)0([xbo])/i,\n\t dotAfter = /^([^.]+)\\.$/,\n\t dotBefore = /^\\.([^.]+)$/,\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n\t whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n\t return function ( x, str, num, b ) {\n\t var base,\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n\t // No exception on ±Infinity or NaN.\n\t if ( isInfinityOrNaN.test(s) ) {\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n\t } else {\n\t if ( !num ) {\n\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n\t return !b || b == base ? p1 : m;\n\t });\n\n\t if (b) {\n\t base = b;\n\n\t // E.g. '1.' to '1', '.1' to '0.1'\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n\t }\n\n\t if ( str != s ) return new BigNumber( s, base );\n\t }\n\n\t // 'new BigNumber() not a number: {n}'\n\t // 'new BigNumber() not a base {b} number: {n}'\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n\t x.s = null;\n\t }\n\n\t x.c = x.e = null;\n\t id = 0;\n\t }\n\t })();\n\n\n\t // Throw a BigNumber Error.\n\t function raise( caller, msg, val ) {\n\t var error = new Error( [\n\t 'new BigNumber', // 0\n\t 'cmp', // 1\n\t 'config', // 2\n\t 'div', // 3\n\t 'divToInt', // 4\n\t 'eq', // 5\n\t 'gt', // 6\n\t 'gte', // 7\n\t 'lt', // 8\n\t 'lte', // 9\n\t 'minus', // 10\n\t 'mod', // 11\n\t 'plus', // 12\n\t 'precision', // 13\n\t 'random', // 14\n\t 'round', // 15\n\t 'shift', // 16\n\t 'times', // 17\n\t 'toDigits', // 18\n\t 'toExponential', // 19\n\t 'toFixed', // 20\n\t 'toFormat', // 21\n\t 'toFraction', // 22\n\t 'pow', // 23\n\t 'toPrecision', // 24\n\t 'toString', // 25\n\t 'BigNumber' // 26\n\t ][caller] + '() ' + msg + ': ' + val );\n\n\t error.name = 'BigNumber Error';\n\t id = 0;\n\t throw error;\n\t }\n\n\n\t /*\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\n\t */\n\t function round( x, sd, rm, r ) {\n\t var d, i, j, k, n, ni, rd,\n\t xc = x.c,\n\t pows10 = POWS_TEN;\n\n\t // if x is not Infinity or NaN...\n\t if (xc) {\n\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\n\t // ni is the index of n within x.c.\n\t // d is the number of digits of n.\n\t // i is the index of rd within n including leading zeros.\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\n\t out: {\n\n\t // Get the number of digits of the first element of xc.\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n\t i = sd - d;\n\n\t // If the rounding digit is in the first element of xc...\n\t if ( i < 0 ) {\n\t i += LOG_BASE;\n\t j = sd;\n\t n = xc[ ni = 0 ];\n\n\t // Get the rounding digit at index j of n.\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\n\t } else {\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n\t if ( ni >= xc.length ) {\n\n\t if (r) {\n\n\t // Needed by sqrt.\n\t for ( ; xc.length <= ni; xc.push(0) );\n\t n = rd = 0;\n\t d = 1;\n\t i %= LOG_BASE;\n\t j = i - LOG_BASE + 1;\n\t } else {\n\t break out;\n\t }\n\t } else {\n\t n = k = xc[ni];\n\n\t // Get the number of digits of n.\n\t for ( d = 1; k >= 10; k /= 10, d++ );\n\n\t // Get the index of rd within n.\n\t i %= LOG_BASE;\n\n\t // Get the index of rd within n, adjusted for leading zeros.\n\t // The number of leading zeros of n is given by LOG_BASE - d.\n\t j = i - LOG_BASE + d;\n\n\t // Get the rounding digit at index j of n.\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n\t }\n\t }\n\n\t r = r || sd < 0 ||\n\n\t // Are there any non-zero digits after the rounding digit?\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n\t r = rm < 4\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n\t // Check whether the digit to the left of the rounding digit is odd.\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( sd < 1 || !xc[0] ) {\n\t xc.length = 0;\n\n\t if (r) {\n\n\t // Convert sd to decimal places.\n\t sd -= x.e + 1;\n\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\t xc[0] = pows10[ sd % LOG_BASE ];\n\t x.e = -sd || 0;\n\t } else {\n\n\t // Zero.\n\t xc[0] = x.e = 0;\n\t }\n\n\t return x;\n\t }\n\n\t // Remove excess digits.\n\t if ( i == 0 ) {\n\t xc.length = ni;\n\t k = 1;\n\t ni--;\n\t } else {\n\t xc.length = ni + 1;\n\t k = pows10[ LOG_BASE - i ];\n\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n\t // j > 0 means i > number of leading zeros of n.\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n\t }\n\n\t // Round up?\n\t if (r) {\n\n\t for ( ; ; ) {\n\n\t // If the digit to be rounded up is in the first element of xc...\n\t if ( ni == 0 ) {\n\n\t // i will be the length of xc[0] before k is added.\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n\t j = xc[0] += k;\n\t for ( k = 1; j >= 10; j /= 10, k++ );\n\n\t // if i != k the length has increased.\n\t if ( i != k ) {\n\t x.e++;\n\t if ( xc[0] == BASE ) xc[0] = 1;\n\t }\n\n\t break;\n\t } else {\n\t xc[ni] += k;\n\t if ( xc[ni] != BASE ) break;\n\t xc[ni--] = 0;\n\t k = 1;\n\t }\n\t }\n\t }\n\n\t // Remove trailing zeros.\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\n\t }\n\n\t // Overflow? Infinity.\n\t if ( x.e > MAX_EXP ) {\n\t x.c = x.e = null;\n\n\t // Underflow? Zero.\n\t } else if ( x.e < MIN_EXP ) {\n\t x.c = [ x.e = 0 ];\n\t }\n\t }\n\n\t return x;\n\t }\n\n\n\t // PROTOTYPE/INSTANCE METHODS\n\n\n\t /*\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\n\t */\n\t P.absoluteValue = P.abs = function () {\n\t var x = new BigNumber(this);\n\t if ( x.s < 0 ) x.s = 1;\n\t return x;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of Infinity.\n\t */\n\t P.ceil = function () {\n\t return round( new BigNumber(this), this.e + 1, 2 );\n\t };\n\n\n\t /*\n\t * Return\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * 0 if they have the same value,\n\t * or null if the value of either is NaN.\n\t */\n\t P.comparedTo = P.cmp = function ( y, b ) {\n\t id = 1;\n\t return compare( this, new BigNumber( y, b ) );\n\t };\n\n\n\t /*\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\n\t * of this BigNumber is ±Infinity or NaN.\n\t */\n\t P.decimalPlaces = P.dp = function () {\n\t var n, v,\n\t c = this.c;\n\n\t if ( !c ) return null;\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n\t // Subtract the number of trailing zeros of the last number.\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n\t if ( n < 0 ) n = 0;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * n / 0 = I\n\t * n / N = N\n\t * n / I = 0\n\t * 0 / n = 0\n\t * 0 / 0 = N\n\t * 0 / N = N\n\t * 0 / I = 0\n\t * N / n = N\n\t * N / 0 = N\n\t * N / N = N\n\t * N / I = N\n\t * I / n = I\n\t * I / 0 = I\n\t * I / N = N\n\t * I / I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.dividedBy = P.div = function ( y, b ) {\n\t id = 3;\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\n\t * BigNumber by the value of BigNumber(y, b).\n\t */\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n\t id = 4;\n\t return div( this, new BigNumber( y, b ), 0, 1 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.equals = P.eq = function ( y, b ) {\n\t id = 5;\n\t return compare( this, new BigNumber( y, b ) ) === 0;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of -Infinity.\n\t */\n\t P.floor = function () {\n\t return round( new BigNumber(this), this.e + 1, 3 );\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.greaterThan = P.gt = function ( y, b ) {\n\t id = 6;\n\t return compare( this, new BigNumber( y, b ) ) > 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n\t id = 7;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n\t */\n\t P.isFinite = function () {\n\t return !!this.c;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\n\t */\n\t P.isInteger = P.isInt = function () {\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\n\t */\n\t P.isNaN = function () {\n\t return !this.s;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\n\t */\n\t P.isNegative = P.isNeg = function () {\n\t return this.s < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n\t */\n\t P.isZero = function () {\n\t return !!this.c && this.c[0] == 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.lessThan = P.lt = function ( y, b ) {\n\t id = 8;\n\t return compare( this, new BigNumber( y, b ) ) < 0;\n\t };\n\n\n\t /*\n\t * Return true if the value of this BigNumber is less than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n\t id = 9;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n\t };\n\n\n\t /*\n\t * n - 0 = n\n\t * n - N = N\n\t * n - I = -I\n\t * 0 - n = -n\n\t * 0 - 0 = 0\n\t * 0 - N = N\n\t * 0 - I = -I\n\t * N - n = N\n\t * N - 0 = N\n\t * N - N = N\n\t * N - I = N\n\t * I - n = I\n\t * I - 0 = I\n\t * I - N = N\n\t * I - I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.minus = P.sub = function ( y, b ) {\n\t var i, j, t, xLTy,\n\t x = this,\n\t a = x.s;\n\n\t id = 10;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.plus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Either Infinity?\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n\t // Either zero?\n\t if ( !xc[0] || !yc[0] ) {\n\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n\t ROUNDING_MODE == 3 ? -0 : 0 );\n\t }\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Determine which is the bigger number.\n\t if ( a = xe - ye ) {\n\n\t if ( xLTy = a < 0 ) {\n\t a = -a;\n\t t = xc;\n\t } else {\n\t ye = xe;\n\t t = yc;\n\t }\n\n\t t.reverse();\n\n\t // Prepend zeros to equalise exponents.\n\t for ( b = a; b--; t.push(0) );\n\t t.reverse();\n\t } else {\n\n\t // Exponents equal. Check digit by digit.\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n\t for ( a = b = 0; b < j; b++ ) {\n\n\t if ( xc[b] != yc[b] ) {\n\t xLTy = xc[b] < yc[b];\n\t break;\n\t }\n\t }\n\t }\n\n\t // x < y? Point xc to the array of the bigger number.\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n\t b = ( j = yc.length ) - ( i = xc.length );\n\n\t // Append zeros to xc if shorter.\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n\t b = BASE - 1;\n\n\t // Subtract yc from xc.\n\t for ( ; j > a; ) {\n\n\t if ( xc[--j] < yc[j] ) {\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\n\t --xc[i];\n\t xc[j] += BASE;\n\t }\n\n\t xc[j] -= yc[j];\n\t }\n\n\t // Remove leading zeros and adjust exponent accordingly.\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\n\n\t // Zero?\n\t if ( !xc[0] ) {\n\n\t // Following IEEE 754 (2008) 6.3,\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\n\t y.c = [ y.e = 0 ];\n\t return y;\n\t }\n\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n\t // for finite x and y.\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * n % 0 = N\n\t * n % N = N\n\t * n % I = n\n\t * 0 % n = 0\n\t * -0 % n = -0\n\t * 0 % 0 = N\n\t * 0 % N = N\n\t * 0 % I = 0\n\t * N % n = N\n\t * N % 0 = N\n\t * N % N = N\n\t * N % I = N\n\t * I % n = N\n\t * I % 0 = N\n\t * I % N = N\n\t * I % I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n\t */\n\t P.modulo = P.mod = function ( y, b ) {\n\t var q, s,\n\t x = this;\n\n\t id = 11;\n\t y = new BigNumber( y, b );\n\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\n\t return new BigNumber(NaN);\n\n\t // Return x if y is Infinity or x is zero.\n\t } else if ( !y.c || x.c && !x.c[0] ) {\n\t return new BigNumber(x);\n\t }\n\n\t if ( MODULO_MODE == 9 ) {\n\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\n\t // r = x - qy where 0 <= r < abs(y)\n\t s = y.s;\n\t y.s = 1;\n\t q = div( x, y, 0, 3 );\n\t y.s = s;\n\t q.s *= s;\n\t } else {\n\t q = div( x, y, 0, MODULO_MODE );\n\t }\n\n\t return x.minus( q.times(y) );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\n\t * i.e. multiplied by -1.\n\t */\n\t P.negated = P.neg = function () {\n\t var x = new BigNumber(this);\n\t x.s = -x.s || null;\n\t return x;\n\t };\n\n\n\t /*\n\t * n + 0 = n\n\t * n + N = N\n\t * n + I = I\n\t * 0 + n = n\n\t * 0 + 0 = 0\n\t * 0 + N = N\n\t * 0 + I = I\n\t * N + n = N\n\t * N + 0 = N\n\t * N + N = N\n\t * N + I = N\n\t * I + n = I\n\t * I + 0 = I\n\t * I + N = N\n\t * I + I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.plus = P.add = function ( y, b ) {\n\t var t,\n\t x = this,\n\t a = x.s;\n\n\t id = 12;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.minus(y);\n\t }\n\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\n\t if ( !xe || !ye ) {\n\n\t // Return ±Infinity if either ±Infinity.\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n\t // Either zero?\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n\t }\n\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\t if ( a = xe - ye ) {\n\t if ( a > 0 ) {\n\t ye = xe;\n\t t = yc;\n\t } else {\n\t a = -a;\n\t t = xc;\n\t }\n\n\t t.reverse();\n\t for ( ; a--; t.push(0) );\n\t t.reverse();\n\t }\n\n\t a = xc.length;\n\t b = yc.length;\n\n\t // Point xc to the longer array, and b to the shorter length.\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\t for ( a = 0; b; ) {\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n\t xc[b] %= BASE;\n\t }\n\n\t if (a) {\n\t xc.unshift(a);\n\t ++ye;\n\t }\n\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\t // ye = MAX_EXP + 1 possible\n\t return normalise( y, xc, ye );\n\t };\n\n\n\t /*\n\t * Return the number of significant digits of the value of this BigNumber.\n\t *\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n\t */\n\t P.precision = P.sd = function (z) {\n\t var n, v,\n\t x = this,\n\t c = x.c;\n\n\t // 'precision() argument not a boolean or binary digit: {z}'\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\n\t if ( z != !!z ) z = null;\n\t }\n\n\t if ( !c ) return null;\n\t v = c.length - 1;\n\t n = v * LOG_BASE + 1;\n\n\t if ( v = c[v] ) {\n\n\t // Subtract the number of trailing zeros of the last element.\n\t for ( ; v % 10 == 0; v /= 10, n-- );\n\n\t // Add the number of digits of the first element.\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\n\t }\n\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n\t * omitted.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'round() decimal places out of range: {dp}'\n\t * 'round() decimal places not an integer: {dp}'\n\t * 'round() rounding mode not an integer: {rm}'\n\t * 'round() rounding mode out of range: {rm}'\n\t */\n\t P.round = function ( dp, rm ) {\n\t var n = new BigNumber(this);\n\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n\t round( n, ~~dp + this.e + 1, rm == null ||\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n\t }\n\n\t return n;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n\t *\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t *\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n\t * otherwise.\n\t *\n\t * 'shift() argument not an integer: {k}'\n\t * 'shift() argument out of range: {k}'\n\t */\n\t P.shift = function (k) {\n\t var n = this;\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\n\t ? n.times( '1e' + truncate(k) )\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\n\t : n );\n\t };\n\n\n\t /*\n\t * sqrt(-n) = N\n\t * sqrt( N) = N\n\t * sqrt(-I) = N\n\t * sqrt( I) = I\n\t * sqrt( 0) = 0\n\t * sqrt(-0) = -0\n\t *\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.squareRoot = P.sqrt = function () {\n\t var m, n, r, rep, t,\n\t x = this,\n\t c = x.c,\n\t s = x.s,\n\t e = x.e,\n\t dp = DECIMAL_PLACES + 4,\n\t half = new BigNumber('0.5');\n\n\t // Negative/NaN/Infinity/zero?\n\t if ( s !== 1 || !c || !c[0] ) {\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n\t }\n\n\t // Initial estimate.\n\t s = Math.sqrt( +x );\n\n\t // Math.sqrt underflow/overflow?\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\t if ( s == 0 || s == 1 / 0 ) {\n\t n = coeffToString(c);\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\n\t s = Math.sqrt(n);\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n\t if ( s == 1 / 0 ) {\n\t n = '1e' + e;\n\t } else {\n\t n = s.toExponential();\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n\t }\n\n\t r = new BigNumber(n);\n\t } else {\n\t r = new BigNumber( s + '' );\n\t }\n\n\t // Check for zero.\n\t // r could be zero if MIN_EXP is changed after the this value was created.\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n\t // coeffToString to throw.\n\t if ( r.c[0] ) {\n\t e = r.e;\n\t s = e + dp;\n\t if ( s < 3 ) s = 0;\n\n\t // Newton-Raphson iteration.\n\t for ( ; ; ) {\n\t t = r;\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\n\n\t // The exponent of r may here be one less than the final result exponent,\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n\t // are indexed correctly.\n\t if ( r.e < e ) --s;\n\t n = n.slice( s - 3, s + 1 );\n\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n\t // iteration.\n\t if ( n == '9999' || !rep && n == '4999' ) {\n\n\t // On the first iteration only, check to see if rounding up gives the\n\t // exact result as the nines may infinitely repeat.\n\t if ( !rep ) {\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n\t if ( t.times(t).eq(x) ) {\n\t r = t;\n\t break;\n\t }\n\t }\n\n\t dp += 4;\n\t s += 4;\n\t rep = 1;\n\t } else {\n\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n\t // result. If not, then there are further digits and m will be truthy.\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n\t // Truncate to the first rounding digit.\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\n\t m = !r.times(r).eq(x);\n\t }\n\n\t break;\n\t }\n\t }\n\t }\n\t }\n\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n\t };\n\n\n\t /*\n\t * n * 0 = 0\n\t * n * N = N\n\t * n * I = I\n\t * 0 * n = 0\n\t * 0 * 0 = 0\n\t * 0 * N = N\n\t * 0 * I = N\n\t * N * n = N\n\t * N * 0 = N\n\t * N * N = N\n\t * N * I = N\n\t * I * n = I\n\t * I * 0 = N\n\t * I * N = N\n\t * I * I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\n\t * BigNumber(y, b).\n\t */\n\t P.times = P.mul = function ( y, b ) {\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n\t base, sqrtBase,\n\t x = this,\n\t xc = x.c,\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n\t // Either NaN, ±Infinity or ±0?\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n\t y.c = y.e = y.s = null;\n\t } else {\n\t y.s *= x.s;\n\n\t // Return ±Infinity if either is ±Infinity.\n\t if ( !xc || !yc ) {\n\t y.c = y.e = null;\n\n\t // Return ±0 if either is ±0.\n\t } else {\n\t y.c = [0];\n\t y.e = 0;\n\t }\n\t }\n\n\t return y;\n\t }\n\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n\t y.s *= x.s;\n\t xcL = xc.length;\n\t ycL = yc.length;\n\n\t // Ensure xc points to longer array and xcL to its length.\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n\t // Initialise the result array with zeros.\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n\t base = BASE;\n\t sqrtBase = SQRT_BASE;\n\n\t for ( i = ycL; --i >= 0; ) {\n\t c = 0;\n\t ylo = yc[i] % sqrtBase;\n\t yhi = yc[i] / sqrtBase | 0;\n\n\t for ( k = xcL, j = i + k; j > i; ) {\n\t xlo = xc[--k] % sqrtBase;\n\t xhi = xc[k] / sqrtBase | 0;\n\t m = yhi * xlo + xhi * ylo;\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n\t zc[j--] = xlo % base;\n\t }\n\n\t zc[j] = c;\n\t }\n\n\t if (c) {\n\t ++e;\n\t } else {\n\t zc.shift();\n\t }\n\n\t return normalise( y, zc, e );\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toDigits() precision out of range: {sd}'\n\t * 'toDigits() precision not an integer: {sd}'\n\t * 'toDigits() rounding mode not an integer: {rm}'\n\t * 'toDigits() rounding mode out of range: {rm}'\n\t */\n\t P.toDigits = function ( sd, rm ) {\n\t var n = new BigNumber(this);\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n\t return sd ? round( n, sd, rm ) : n;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in exponential notation and\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toExponential() decimal places not an integer: {dp}'\n\t * 'toExponential() decimal places out of range: {dp}'\n\t * 'toExponential() rounding mode not an integer: {rm}'\n\t * 'toExponential() rounding mode out of range: {rm}'\n\t */\n\t P.toExponential = function ( dp, rm ) {\n\t return format( this,\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFixed() decimal places not an integer: {dp}'\n\t * 'toFixed() decimal places out of range: {dp}'\n\t * 'toFixed() rounding mode not an integer: {rm}'\n\t * 'toFixed() rounding mode out of range: {rm}'\n\t */\n\t P.toFixed = function ( dp, rm ) {\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n\t * of the FORMAT object (see BigNumber.config).\n\t *\n\t * FORMAT = {\n\t * decimalSeparator : '.',\n\t * groupSeparator : ',',\n\t * groupSize : 3,\n\t * secondaryGroupSize : 0,\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\n\t * fractionGroupSize : 0\n\t * };\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFormat() decimal places not an integer: {dp}'\n\t * 'toFormat() decimal places out of range: {dp}'\n\t * 'toFormat() rounding mode not an integer: {rm}'\n\t * 'toFormat() rounding mode out of range: {rm}'\n\t */\n\t P.toFormat = function ( dp, rm ) {\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\n\n\t if ( this.c ) {\n\t var i,\n\t arr = str.split('.'),\n\t g1 = +FORMAT.groupSize,\n\t g2 = +FORMAT.secondaryGroupSize,\n\t groupSeparator = FORMAT.groupSeparator,\n\t intPart = arr[0],\n\t fractionPart = arr[1],\n\t isNeg = this.s < 0,\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\n\t len = intDigits.length;\n\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n\t if ( g1 > 0 && len > 0 ) {\n\t i = len % g1 || g1;\n\t intPart = intDigits.substr( 0, i );\n\n\t for ( ; i < len; i += g1 ) {\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\n\t }\n\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n\t if (isNeg) intPart = '-' + intPart;\n\t }\n\n\t str = fractionPart\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n\t '$&' + FORMAT.fractionGroupSeparator )\n\t : fractionPart )\n\t : intPart;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\n\t * an integer numerator and an integer denominator. The denominator will be a positive\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\n\t * denominator is not specified, the denominator will be the lowest value necessary to\n\t * represent the number exactly.\n\t *\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n\t *\n\t * 'toFraction() max denominator not an integer: {md}'\n\t * 'toFraction() max denominator out of range: {md}'\n\t */\n\t P.toFraction = function (md) {\n\t var arr, d0, d2, e, exp, n, n0, q, s,\n\t k = ERRORS,\n\t x = this,\n\t xc = x.c,\n\t d = new BigNumber(ONE),\n\t n1 = d0 = new BigNumber(ONE),\n\t d1 = n0 = new BigNumber(ONE);\n\n\t if ( md != null ) {\n\t ERRORS = false;\n\t n = new BigNumber(md);\n\t ERRORS = k;\n\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n\t if (ERRORS) {\n\t raise( 22,\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n\t }\n\n\t // ERRORS is false:\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n\t }\n\t }\n\n\t if ( !xc ) return x.toString();\n\t s = coeffToString(xc);\n\n\t // Determine initial denominator.\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\t e = d.e = s.length - x.e - 1;\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n\t exp = MAX_EXP;\n\t MAX_EXP = 1 / 0;\n\t n = new BigNumber(s);\n\n\t // n0 = d1 = 0\n\t n0.c[0] = 0;\n\n\t for ( ; ; ) {\n\t q = div( n, d, 0, 1 );\n\t d2 = d0.plus( q.times(d1) );\n\t if ( d2.cmp(md) == 1 ) break;\n\t d0 = d1;\n\t d1 = d2;\n\t n1 = n0.plus( q.times( d2 = n1 ) );\n\t n0 = d2;\n\t d = n.minus( q.times( d2 = d ) );\n\t n = d2;\n\t }\n\n\t d2 = div( md.minus(d0), d1, 0, 1 );\n\t n0 = n0.plus( d2.times(n1) );\n\t d0 = d0.plus( d2.times(d1) );\n\t n0.s = n1.s = x.s;\n\t e *= 2;\n\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n\t ? [ n1.toString(), d1.toString() ]\n\t : [ n0.toString(), d0.toString() ];\n\n\t MAX_EXP = exp;\n\t return arr;\n\t };\n\n\n\t /*\n\t * Return the value of this BigNumber converted to a number primitive.\n\t */\n\t P.toNumber = function () {\n\t var x = this;\n\n\t // Ensure zero has correct sign.\n\t return +x || ( x.s ? x.s * 0 : NaN );\n\t };\n\n\n\t /*\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n\t * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n\t *\n\t * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n\t * (Performs 54 loop iterations for n of 9007199254740992.)\n\t *\n\t * 'pow() exponent not an integer: {n}'\n\t * 'pow() exponent out of range: {n}'\n\t */\n\t P.toPower = P.pow = function (n) {\n\t var k, y,\n\t i = mathfloor( n < 0 ? -n : +n ),\n\t x = this;\n\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n\t parseFloat(n) != n && !( n = NaN ) ) ) {\n\t return new BigNumber( Math.pow( +x, n ) );\n\t }\n\n\t // Truncating each coefficient array to a length of k after each multiplication equates\n\t // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n\t // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n\t k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n\t y = new BigNumber(ONE);\n\n\t for ( ; ; ) {\n\n\t if ( i % 2 ) {\n\t y = y.times(x);\n\t if ( !y.c ) break;\n\t if ( k && y.c.length > k ) y.c.length = k;\n\t }\n\n\t i = mathfloor( i / 2 );\n\t if ( !i ) break;\n\n\t x = x.times(x);\n\t if ( k && x.c && x.c.length > k ) x.c.length = k;\n\t }\n\n\t if ( n < 0 ) y = ONE.div(y);\n\t return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\n\t * exponential notation.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toPrecision() precision not an integer: {sd}'\n\t * 'toPrecision() precision out of range: {sd}'\n\t * 'toPrecision() rounding mode not an integer: {rm}'\n\t * 'toPrecision() rounding mode out of range: {rm}'\n\t */\n\t P.toPrecision = function ( sd, rm ) {\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n\t ? sd | 0 : null, rm, 24 );\n\t };\n\n\n\t /*\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n\t * TO_EXP_NEG, return exponential notation.\n\t *\n\t * [b] {number} Integer, 2 to 64 inclusive.\n\t *\n\t * 'toString() base not an integer: {b}'\n\t * 'toString() base out of range: {b}'\n\t */\n\t P.toString = function (b) {\n\t var str,\n\t n = this,\n\t s = n.s,\n\t e = n.e;\n\n\t // Infinity or NaN?\n\t if ( e === null ) {\n\n\t if (s) {\n\t str = 'Infinity';\n\t if ( s < 0 ) str = '-' + str;\n\t } else {\n\t str = 'NaN';\n\t }\n\t } else {\n\t str = coeffToString( n.c );\n\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n\t ? toExponential( str, e )\n\t : toFixedPoint( str, e );\n\t } else {\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n\t }\n\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\n\t }\n\n\t return str;\n\t };\n\n\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n\t * number.\n\t */\n\t P.truncated = P.trunc = function () {\n\t return round( new BigNumber(this), this.e + 1, 1 );\n\t };\n\n\n\n\t /*\n\t * Return as toString, but do not accept a base argument.\n\t */\n\t P.valueOf = P.toJSON = function () {\n\t return this.toString();\n\t };\n\n\n\t // Aliases for BigDecimal methods.\n\t //P.add = P.plus; // P.add included above\n\t //P.subtract = P.minus; // P.sub included above\n\t //P.multiply = P.times; // P.mul included above\n\t //P.divide = P.div;\n\t //P.remainder = P.mod;\n\t //P.compareTo = P.cmp;\n\t //P.negate = P.neg;\n\n\n\t if ( configObj != null ) BigNumber.config(configObj);\n\n\t return BigNumber;\n\t }", "function decimals(n) {\n\treturn web3.utils.toWei(n,'ether')\n}", "function setDecimalLength(num) {\n if (isNaN(num)) {\n num = \"Error\";\n } else if (!isFinite(num)) {\n num = \"Overflow\";\n } else {\n var numType = typeof num;\n if (numType === \"number\") {\n num = parseFloat(num.toFixed(10));\n }\n }\n return num;\n }", "function another(configObj) {\n\t var div,\n\t\n\t // id tracks the caller function, so its name can be included in error messages.\n\t id = 0,\n\t P = BigNumber.prototype,\n\t ONE = new BigNumber(1),\n\t\n\t\n\t /********************************* EDITABLE DEFAULTS **********************************/\n\t\n\t\n\t /*\n\t * The default values below must be integers within the inclusive ranges stated.\n\t * The values can also be changed at run-time using BigNumber.config.\n\t */\n\t\n\t // The maximum number of decimal places for operations involving division.\n\t DECIMAL_PLACES = 20, // 0 to MAX\n\t\n\t /*\n\t * The rounding mode used when rounding to the above decimal places, and when using\n\t * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n\t * UP 0 Away from zero.\n\t * DOWN 1 Towards zero.\n\t * CEIL 2 Towards +Infinity.\n\t * FLOOR 3 Towards -Infinity.\n\t * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n\t * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n\t * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n\t * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n\t * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n\t */\n\t ROUNDING_MODE = 4, // 0 to 8\n\t\n\t // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\t\n\t // The exponent value at and beneath which toString returns exponential notation.\n\t // Number type: -7\n\t TO_EXP_NEG = -7, // 0 to -MAX\n\t\n\t // The exponent value at and above which toString returns exponential notation.\n\t // Number type: 21\n\t TO_EXP_POS = 21, // 0 to MAX\n\t\n\t // RANGE : [MIN_EXP, MAX_EXP]\n\t\n\t // The minimum exponent value, beneath which underflow to zero occurs.\n\t // Number type: -324 (5e-324)\n\t MIN_EXP = -1e7, // -1 to -MAX\n\t\n\t // The maximum exponent value, above which overflow to Infinity occurs.\n\t // Number type: 308 (1.7976931348623157e+308)\n\t // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n\t MAX_EXP = 1e7, // 1 to MAX\n\t\n\t // Whether BigNumber Errors are ever thrown.\n\t ERRORS = true, // true or false\n\t\n\t // Change to intValidatorNoErrors if ERRORS is false.\n\t isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\t\n\t // Whether to use cryptographically-secure random number generation, if available.\n\t CRYPTO = false, // true or false\n\t\n\t /*\n\t * The modulo mode used when calculating the modulus: a mod n.\n\t * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n\t * The remainder (r) is calculated as: r = a - n * q.\n\t *\n\t * UP 0 The remainder is positive if the dividend is negative, else is negative.\n\t * DOWN 1 The remainder has the same sign as the dividend.\n\t * This modulo mode is commonly known as 'truncated division' and is\n\t * equivalent to (a % n) in JavaScript.\n\t * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n\t * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n\t * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n\t * The remainder is always positive.\n\t *\n\t * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n\t * modes are commonly used for the modulus operation.\n\t * Although the other rounding modes can also be used, they may not give useful results.\n\t */\n\t MODULO_MODE = 1, // 0 to 9\n\t\n\t // The maximum number of significant digits of the result of the toPower operation.\n\t // If POW_PRECISION is 0, there will be unlimited significant digits.\n\t POW_PRECISION = 100, // 0 to MAX\n\t\n\t // The format specification used by the BigNumber.prototype.toFormat method.\n\t FORMAT = {\n\t decimalSeparator: '.',\n\t groupSeparator: ',',\n\t groupSize: 3,\n\t secondaryGroupSize: 0,\n\t fractionGroupSeparator: '\\xA0', // non-breaking space\n\t fractionGroupSize: 0\n\t };\n\t\n\t\n\t /******************************************************************************************/\n\t\n\t\n\t // CONSTRUCTOR\n\t\n\t\n\t /*\n\t * The BigNumber constructor and exported function.\n\t * Create and return a new instance of a BigNumber object.\n\t *\n\t * n {number|string|BigNumber} A numeric value.\n\t * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n\t */\n\t function BigNumber( n, b ) {\n\t var c, e, i, num, len, str,\n\t x = this;\n\t\n\t // Enable constructor usage without new.\n\t if ( !( x instanceof BigNumber ) ) {\n\t\n\t // 'BigNumber() constructor call without new: {n}'\n\t if (ERRORS) raise( 26, 'constructor call without new', n );\n\t return new BigNumber( n, b );\n\t }\n\t\n\t // 'new BigNumber() base not an integer: {b}'\n\t // 'new BigNumber() base out of range: {b}'\n\t if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\t\n\t // Duplicate.\n\t if ( n instanceof BigNumber ) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = ( n = n.c ) ? n.slice() : n;\n\t id = 0;\n\t return;\n\t }\n\t\n\t if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n\t x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\t\n\t // Fast path for integers.\n\t if ( n === ~~n ) {\n\t for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n\t x.e = e;\n\t x.c = [n];\n\t id = 0;\n\t return;\n\t }\n\t\n\t str = n + '';\n\t } else {\n\t if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\t } else {\n\t b = b | 0;\n\t str = n + '';\n\t\n\t // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n\t // Allow exponential notation to be used with base 10 argument.\n\t if ( b == 10 ) {\n\t x = new BigNumber( n instanceof BigNumber ? n : str );\n\t return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n\t }\n\t\n\t // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n\t // Any number in exponential form will fail due to the [Ee][+-].\n\t if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n\t !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n\t '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n\t return parseNumeric( x, str, num, b );\n\t }\n\t\n\t if (num) {\n\t x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\t\n\t if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\t\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t raise( id, tooManyDigits, n );\n\t }\n\t\n\t // Prevent later check for length on converted number.\n\t num = false;\n\t } else {\n\t x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n\t }\n\t\n\t str = convertBase( str, 10, b, x.s );\n\t }\n\t\n\t // Decimal point?\n\t if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\t\n\t // Exponential form?\n\t if ( ( i = str.search( /e/i ) ) > 0 ) {\n\t\n\t // Determine exponent.\n\t if ( e < 0 ) e = i;\n\t e += +str.slice( i + 1 );\n\t str = str.substring( 0, i );\n\t } else if ( e < 0 ) {\n\t\n\t // Integer.\n\t e = str.length;\n\t }\n\t\n\t // Determine leading zeros.\n\t for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\t\n\t // Determine trailing zeros.\n\t for ( len = str.length; str.charCodeAt(--len) === 48; );\n\t str = str.slice( i, len + 1 );\n\t\n\t if (str) {\n\t len = str.length;\n\t\n\t // Disallow numbers with over 15 significant digits if number type.\n\t // 'new BigNumber() number type has more than 15 significant digits: {n}'\n\t if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\t\n\t e = e - i - 1;\n\t\n\t // Overflow?\n\t if ( e > MAX_EXP ) {\n\t\n\t // Infinity.\n\t x.c = x.e = null;\n\t\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\t\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t } else {\n\t x.e = e;\n\t x.c = [];\n\t\n\t // Transform base\n\t\n\t // e is the base 10 exponent.\n\t // i is where to slice str to get the first element of the coefficient array.\n\t i = ( e + 1 ) % LOG_BASE;\n\t if ( e < 0 ) i += LOG_BASE;\n\t\n\t if ( i < len ) {\n\t if (i) x.c.push( +str.slice( 0, i ) );\n\t\n\t for ( len -= LOG_BASE; i < len; ) {\n\t x.c.push( +str.slice( i, i += LOG_BASE ) );\n\t }\n\t\n\t str = str.slice(i);\n\t i = LOG_BASE - str.length;\n\t } else {\n\t i -= len;\n\t }\n\t\n\t for ( ; i--; str += '0' );\n\t x.c.push( +str );\n\t }\n\t } else {\n\t\n\t // Zero.\n\t x.c = [ x.e = 0 ];\n\t }\n\t\n\t id = 0;\n\t }\n\t\n\t\n\t // CONSTRUCTOR PROPERTIES\n\t\n\t\n\t BigNumber.another = another;\n\t\n\t BigNumber.ROUND_UP = 0;\n\t BigNumber.ROUND_DOWN = 1;\n\t BigNumber.ROUND_CEIL = 2;\n\t BigNumber.ROUND_FLOOR = 3;\n\t BigNumber.ROUND_HALF_UP = 4;\n\t BigNumber.ROUND_HALF_DOWN = 5;\n\t BigNumber.ROUND_HALF_EVEN = 6;\n\t BigNumber.ROUND_HALF_CEIL = 7;\n\t BigNumber.ROUND_HALF_FLOOR = 8;\n\t BigNumber.EUCLID = 9;\n\t\n\t\n\t /*\n\t * Configure infrequently-changing library-wide settings.\n\t *\n\t * Accept an object or an argument list, with one or many of the following properties or\n\t * parameters respectively:\n\t *\n\t * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n\t * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n\t * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n\t * [integer -MAX to 0 incl., 0 to MAX incl.]\n\t * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n\t * ERRORS {boolean|number} true, false, 1 or 0\n\t * CRYPTO {boolean|number} true, false, 1 or 0\n\t * MODULO_MODE {number} 0 to 9 inclusive\n\t * POW_PRECISION {number} 0 to MAX inclusive\n\t * FORMAT {object} See BigNumber.prototype.toFormat\n\t * decimalSeparator {string}\n\t * groupSeparator {string}\n\t * groupSize {number}\n\t * secondaryGroupSize {number}\n\t * fractionGroupSeparator {string}\n\t * fractionGroupSize {number}\n\t *\n\t * (The values assigned to the above FORMAT object properties are not checked for validity.)\n\t *\n\t * E.g.\n\t * BigNumber.config(20, 4) is equivalent to\n\t * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n\t *\n\t * Ignore properties/parameters set to null or undefined.\n\t * Return an object with the properties current values.\n\t */\n\t BigNumber.config = function () {\n\t var v, p,\n\t i = 0,\n\t r = {},\n\t a = arguments,\n\t o = a[0],\n\t has = o && typeof o == 'object'\n\t ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n\t : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\t\n\t // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n\t // 'config() DECIMAL_PLACES not an integer: {v}'\n\t // 'config() DECIMAL_PLACES out of range: {v}'\n\t if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t DECIMAL_PLACES = v | 0;\n\t }\n\t r[p] = DECIMAL_PLACES;\n\t\n\t // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n\t // 'config() ROUNDING_MODE not an integer: {v}'\n\t // 'config() ROUNDING_MODE out of range: {v}'\n\t if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n\t ROUNDING_MODE = v | 0;\n\t }\n\t r[p] = ROUNDING_MODE;\n\t\n\t // EXPONENTIAL_AT {number|number[]}\n\t // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n\t // 'config() EXPONENTIAL_AT not an integer: {v}'\n\t // 'config() EXPONENTIAL_AT out of range: {v}'\n\t if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\t\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n\t TO_EXP_NEG = v[0] | 0;\n\t TO_EXP_POS = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n\t }\n\t }\n\t r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\t\n\t // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n\t // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n\t // 'config() RANGE not an integer: {v}'\n\t // 'config() RANGE cannot be zero: {v}'\n\t // 'config() RANGE out of range: {v}'\n\t if ( has( p = 'RANGE' ) ) {\n\t\n\t if ( isArray(v) ) {\n\t if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n\t MIN_EXP = v[0] | 0;\n\t MAX_EXP = v[1] | 0;\n\t }\n\t } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n\t if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n\t else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n\t }\n\t }\n\t r[p] = [ MIN_EXP, MAX_EXP ];\n\t\n\t // ERRORS {boolean|number} true, false, 1 or 0.\n\t // 'config() ERRORS not a boolean or binary digit: {v}'\n\t if ( has( p = 'ERRORS' ) ) {\n\t\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t id = 0;\n\t isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = ERRORS;\n\t\n\t // CRYPTO {boolean|number} true, false, 1 or 0.\n\t // 'config() CRYPTO not a boolean or binary digit: {v}'\n\t // 'config() crypto unavailable: {crypto}'\n\t if ( has( p = 'CRYPTO' ) ) {\n\t\n\t if ( v === !!v || v === 1 || v === 0 ) {\n\t CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n\t if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n\t } else if (ERRORS) {\n\t raise( 2, p + notBool, v );\n\t }\n\t }\n\t r[p] = CRYPTO;\n\t\n\t // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n\t // 'config() MODULO_MODE not an integer: {v}'\n\t // 'config() MODULO_MODE out of range: {v}'\n\t if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n\t MODULO_MODE = v | 0;\n\t }\n\t r[p] = MODULO_MODE;\n\t\n\t // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n\t // 'config() POW_PRECISION not an integer: {v}'\n\t // 'config() POW_PRECISION out of range: {v}'\n\t if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n\t POW_PRECISION = v | 0;\n\t }\n\t r[p] = POW_PRECISION;\n\t\n\t // FORMAT {object}\n\t // 'config() FORMAT not an object: {v}'\n\t if ( has( p = 'FORMAT' ) ) {\n\t\n\t if ( typeof v == 'object' ) {\n\t FORMAT = v;\n\t } else if (ERRORS) {\n\t raise( 2, p + ' not an object', v );\n\t }\n\t }\n\t r[p] = FORMAT;\n\t\n\t return r;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the maximum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the minimum of the arguments.\n\t *\n\t * arguments {number|string|BigNumber}\n\t */\n\t BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\t\n\t\n\t /*\n\t * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n\t * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n\t * zeros are produced).\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t *\n\t * 'random() decimal places not an integer: {dp}'\n\t * 'random() decimal places out of range: {dp}'\n\t * 'random() crypto unavailable: {crypto}'\n\t */\n\t BigNumber.random = (function () {\n\t var pow2_53 = 0x20000000000000;\n\t\n\t // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n\t // Check if Math.random() produces more than 32 bits of randomness.\n\t // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n\t // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\t var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n\t ? function () { return mathfloor( Math.random() * pow2_53 ); }\n\t : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n\t (Math.random() * 0x800000 | 0); };\n\t\n\t return function (dp) {\n\t var a, b, e, k, v,\n\t i = 0,\n\t c = [],\n\t rand = new BigNumber(ONE);\n\t\n\t dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n\t k = mathceil( dp / LOG_BASE );\n\t\n\t if (CRYPTO) {\n\t\n\t // Browsers supporting crypto.getRandomValues.\n\t if ( crypto && crypto.getRandomValues ) {\n\t\n\t a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\t\n\t for ( ; i < k; ) {\n\t\n\t // 53 bits:\n\t // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n\t // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n\t // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n\t // 11111 11111111 11111111\n\t // 0x20000 is 2^21.\n\t v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\t\n\t // Rejection sampling:\n\t // 0 <= v < 9007199254740992\n\t // Probability that v >= 9e15, is\n\t // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\t if ( v >= 9e15 ) {\n\t b = crypto.getRandomValues( new Uint32Array(2) );\n\t a[i] = b[0];\n\t a[i + 1] = b[1];\n\t } else {\n\t\n\t // 0 <= v <= 8999999999999999\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 2;\n\t }\n\t }\n\t i = k / 2;\n\t\n\t // Node.js supporting crypto.randomBytes.\n\t } else if ( crypto && crypto.randomBytes ) {\n\t\n\t // buffer\n\t a = crypto.randomBytes( k *= 7 );\n\t\n\t for ( ; i < k; ) {\n\t\n\t // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n\t // 0x100000000 is 2^32, 0x1000000 is 2^24\n\t // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n\t // 0 <= v < 9007199254740992\n\t v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n\t ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n\t ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\t\n\t if ( v >= 9e15 ) {\n\t crypto.randomBytes(7).copy( a, i );\n\t } else {\n\t\n\t // 0 <= (v % 1e14) <= 99999999999999\n\t c.push( v % 1e14 );\n\t i += 7;\n\t }\n\t }\n\t i = k / 7;\n\t } else if (ERRORS) {\n\t raise( 14, 'crypto unavailable', crypto );\n\t }\n\t }\n\t\n\t // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n\t if (!i) {\n\t\n\t for ( ; i < k; ) {\n\t v = random53bitInt();\n\t if ( v < 9e15 ) c[i++] = v % 1e14;\n\t }\n\t }\n\t\n\t k = c[--i];\n\t dp %= LOG_BASE;\n\t\n\t // Convert trailing digits to zeros according to dp.\n\t if ( k && dp ) {\n\t v = POWS_TEN[LOG_BASE - dp];\n\t c[i] = mathfloor( k / v ) * v;\n\t }\n\t\n\t // Remove trailing elements which are zero.\n\t for ( ; c[i] === 0; c.pop(), i-- );\n\t\n\t // Zero?\n\t if ( i < 0 ) {\n\t c = [ e = 0 ];\n\t } else {\n\t\n\t // Remove leading elements which are zero and adjust exponent accordingly.\n\t for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\t\n\t // Count the digits of the first element of c to determine leading zeros, and...\n\t for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\t\n\t // adjust the exponent accordingly.\n\t if ( i < LOG_BASE ) e -= LOG_BASE - i;\n\t }\n\t\n\t rand.e = e;\n\t rand.c = c;\n\t return rand;\n\t };\n\t })();\n\t\n\t\n\t // PRIVATE FUNCTIONS\n\t\n\t\n\t // Convert a numeric string of baseIn to a numeric string of baseOut.\n\t function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\t\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\t\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\t\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\t\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\t\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\t\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\t\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\t\n\t d = e + dp + 1;\n\t\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\t\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( d < 1 || !xc[0] ) {\n\t\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\t\n\t if (r) {\n\t\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\t\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\t\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\t\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\t\n\t // The caller will add the sign.\n\t return str;\n\t }\n\t\n\t\n\t // Perform division in the specified base. Called by div and convertBase.\n\t div = (function () {\n\t\n\t // Assume non-zero x and k.\n\t function multiply( x, k, base ) {\n\t var m, temp, xlo, xhi,\n\t carry = 0,\n\t i = x.length,\n\t klo = k % SQRT_BASE,\n\t khi = k / SQRT_BASE | 0;\n\t\n\t for ( x = x.slice(); i--; ) {\n\t xlo = x[i] % SQRT_BASE;\n\t xhi = x[i] / SQRT_BASE | 0;\n\t m = khi * xlo + xhi * klo;\n\t temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n\t carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n\t x[i] = temp % base;\n\t }\n\t\n\t if (carry) x.unshift(carry);\n\t\n\t return x;\n\t }\n\t\n\t function compare( a, b, aL, bL ) {\n\t var i, cmp;\n\t\n\t if ( aL != bL ) {\n\t cmp = aL > bL ? 1 : -1;\n\t } else {\n\t\n\t for ( i = cmp = 0; i < aL; i++ ) {\n\t\n\t if ( a[i] != b[i] ) {\n\t cmp = a[i] > b[i] ? 1 : -1;\n\t break;\n\t }\n\t }\n\t }\n\t return cmp;\n\t }\n\t\n\t function subtract( a, b, aL, base ) {\n\t var i = 0;\n\t\n\t // Subtract b from a.\n\t for ( ; aL--; ) {\n\t a[aL] -= i;\n\t i = a[aL] < b[aL] ? 1 : 0;\n\t a[aL] = i * base + a[aL] - b[aL];\n\t }\n\t\n\t // Remove leading zeros.\n\t for ( ; !a[0] && a.length > 1; a.shift() );\n\t }\n\t\n\t // x: dividend, y: divisor.\n\t return function ( x, y, dp, rm, base ) {\n\t var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n\t yL, yz,\n\t s = x.s == y.s ? 1 : -1,\n\t xc = x.c,\n\t yc = y.c;\n\t\n\t // Either NaN, Infinity or 0?\n\t if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\t\n\t return new BigNumber(\n\t\n\t // Return NaN if either NaN, or both Infinity or 0.\n\t !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\t\n\t // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n\t xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n\t );\n\t }\n\t\n\t q = new BigNumber(s);\n\t qc = q.c = [];\n\t e = x.e - y.e;\n\t s = dp + e + 1;\n\t\n\t if ( !base ) {\n\t base = BASE;\n\t e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n\t s = s / LOG_BASE | 0;\n\t }\n\t\n\t // Result exponent may be one less then the current value of e.\n\t // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\t for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n\t if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\t\n\t if ( s < 0 ) {\n\t qc.push(1);\n\t more = true;\n\t } else {\n\t xL = xc.length;\n\t yL = yc.length;\n\t i = 0;\n\t s += 2;\n\t\n\t // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\t\n\t n = mathfloor( base / ( yc[0] + 1 ) );\n\t\n\t // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n\t // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n\t if ( n > 1 ) {\n\t yc = multiply( yc, n, base );\n\t xc = multiply( xc, n, base );\n\t yL = yc.length;\n\t xL = xc.length;\n\t }\n\t\n\t xi = yL;\n\t rem = xc.slice( 0, yL );\n\t remL = rem.length;\n\t\n\t // Add zeros to make remainder as long as divisor.\n\t for ( ; remL < yL; rem[remL++] = 0 );\n\t yz = yc.slice();\n\t yz.unshift(0);\n\t yc0 = yc[0];\n\t if ( yc[1] >= base / 2 ) yc0++;\n\t // Not necessary, but to prevent trial digit n > base, when using base 3.\n\t // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\t\n\t do {\n\t n = 0;\n\t\n\t // Compare divisor and remainder.\n\t cmp = compare( yc, rem, yL, remL );\n\t\n\t // If divisor < remainder.\n\t if ( cmp < 0 ) {\n\t\n\t // Calculate trial digit, n.\n\t\n\t rem0 = rem[0];\n\t if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\t\n\t // n is how many times the divisor goes into the current remainder.\n\t n = mathfloor( rem0 / yc0 );\n\t\n\t // Algorithm:\n\t // 1. product = divisor * trial digit (n)\n\t // 2. if product > remainder: product -= divisor, n--\n\t // 3. remainder -= product\n\t // 4. if product was < remainder at 2:\n\t // 5. compare new remainder and divisor\n\t // 6. If remainder > divisor: remainder -= divisor, n++\n\t\n\t if ( n > 1 ) {\n\t\n\t // n may be > base only when base is 3.\n\t if (n >= base) n = base - 1;\n\t\n\t // product = divisor * trial digit.\n\t prod = multiply( yc, n, base );\n\t prodL = prod.length;\n\t remL = rem.length;\n\t\n\t // Compare product and remainder.\n\t // If product > remainder.\n\t // Trial digit n too high.\n\t // n is 1 too high about 5% of the time, and is not known to have\n\t // ever been more than 1 too high.\n\t while ( compare( prod, rem, prodL, remL ) == 1 ) {\n\t n--;\n\t\n\t // Subtract divisor from product.\n\t subtract( prod, yL < prodL ? yz : yc, prodL, base );\n\t prodL = prod.length;\n\t cmp = 1;\n\t }\n\t } else {\n\t\n\t // n is 0 or 1, cmp is -1.\n\t // If n is 0, there is no need to compare yc and rem again below,\n\t // so change cmp to 1 to avoid it.\n\t // If n is 1, leave cmp as -1, so yc and rem are compared again.\n\t if ( n == 0 ) {\n\t\n\t // divisor < remainder, so n must be at least 1.\n\t cmp = n = 1;\n\t }\n\t\n\t // product = divisor\n\t prod = yc.slice();\n\t prodL = prod.length;\n\t }\n\t\n\t if ( prodL < remL ) prod.unshift(0);\n\t\n\t // Subtract product from remainder.\n\t subtract( rem, prod, remL, base );\n\t remL = rem.length;\n\t\n\t // If product was < remainder.\n\t if ( cmp == -1 ) {\n\t\n\t // Compare divisor and new remainder.\n\t // If divisor < new remainder, subtract divisor from remainder.\n\t // Trial digit n too low.\n\t // n is 1 too low about 5% of the time, and very rarely 2 too low.\n\t while ( compare( yc, rem, yL, remL ) < 1 ) {\n\t n++;\n\t\n\t // Subtract divisor from remainder.\n\t subtract( rem, yL < remL ? yz : yc, remL, base );\n\t remL = rem.length;\n\t }\n\t }\n\t } else if ( cmp === 0 ) {\n\t n++;\n\t rem = [0];\n\t } // else cmp === 1 and n will be 0\n\t\n\t // Add the next digit, n, to the result array.\n\t qc[i++] = n;\n\t\n\t // Update the remainder.\n\t if ( rem[0] ) {\n\t rem[remL++] = xc[xi] || 0;\n\t } else {\n\t rem = [ xc[xi] ];\n\t remL = 1;\n\t }\n\t } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\t\n\t more = rem[0] != null;\n\t\n\t // Leading zero?\n\t if ( !qc[0] ) qc.shift();\n\t }\n\t\n\t if ( base == BASE ) {\n\t\n\t // To calculate q.e, first get the number of digits of qc[0].\n\t for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n\t round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\t\n\t // Caller is convertBase.\n\t } else {\n\t q.e = e;\n\t q.r = +more;\n\t }\n\t\n\t return q;\n\t };\n\t })();\n\t\n\t\n\t /*\n\t * Return a string representing the value of BigNumber n in fixed-point or exponential\n\t * notation rounded to the specified decimal places or significant digits.\n\t *\n\t * n is a BigNumber.\n\t * i is the index of the last digit required (i.e. the digit that may be rounded up).\n\t * rm is the rounding mode.\n\t * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n\t */\n\t function format( n, i, rm, caller ) {\n\t var c0, e, ne, len, str;\n\t\n\t rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n\t ? rm | 0 : ROUNDING_MODE;\n\t\n\t if ( !n.c ) return n.toString();\n\t c0 = n.c[0];\n\t ne = n.e;\n\t\n\t if ( i == null ) {\n\t str = coeffToString( n.c );\n\t str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n\t ? toExponential( str, ne )\n\t : toFixedPoint( str, ne );\n\t } else {\n\t n = round( new BigNumber(n), i, rm );\n\t\n\t // n.e may have changed if the value was rounded up.\n\t e = n.e;\n\t\n\t str = coeffToString( n.c );\n\t len = str.length;\n\t\n\t // toPrecision returns exponential notation if the number of significant digits\n\t // specified is less than the number of digits necessary to represent the integer\n\t // part of the value in fixed-point notation.\n\t\n\t // Exponential notation.\n\t if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\t\n\t // Append zeros?\n\t for ( ; len < i; str += '0', len++ );\n\t str = toExponential( str, e );\n\t\n\t // Fixed-point notation.\n\t } else {\n\t i -= ne;\n\t str = toFixedPoint( str, e );\n\t\n\t // Append zeros?\n\t if ( e + 1 > len ) {\n\t if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n\t } else {\n\t i += e - len;\n\t if ( i > 0 ) {\n\t if ( e + 1 == len ) str += '.';\n\t for ( ; i--; str += '0' );\n\t }\n\t }\n\t }\n\t }\n\t\n\t return n.s < 0 && c0 ? '-' + str : str;\n\t }\n\t\n\t\n\t // Handle BigNumber.max and BigNumber.min.\n\t function maxOrMin( args, method ) {\n\t var m, n,\n\t i = 0;\n\t\n\t if ( isArray( args[0] ) ) args = args[0];\n\t m = new BigNumber( args[0] );\n\t\n\t for ( ; ++i < args.length; ) {\n\t n = new BigNumber( args[i] );\n\t\n\t // If any number is NaN, return NaN.\n\t if ( !n.s ) {\n\t m = n;\n\t break;\n\t } else if ( method.call( m, n ) ) {\n\t m = n;\n\t }\n\t }\n\t\n\t return m;\n\t }\n\t\n\t\n\t /*\n\t * Return true if n is an integer in range, otherwise throw.\n\t * Use for argument validation when ERRORS is true.\n\t */\n\t function intValidatorWithErrors( n, min, max, caller, name ) {\n\t if ( n < min || n > max || n != truncate(n) ) {\n\t raise( caller, ( name || 'decimal places' ) +\n\t ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n\t }\n\t\n\t return true;\n\t }\n\t\n\t\n\t /*\n\t * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n\t * Called by minus, plus and times.\n\t */\n\t function normalise( n, c, e ) {\n\t var i = 1,\n\t j = c.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; !c[--j]; c.pop() );\n\t\n\t // Calculate the base 10 exponent. First get the number of digits of c[0].\n\t for ( j = c[0]; j >= 10; j /= 10, i++ );\n\t\n\t // Overflow?\n\t if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\t\n\t // Infinity.\n\t n.c = n.e = null;\n\t\n\t // Underflow?\n\t } else if ( e < MIN_EXP ) {\n\t\n\t // Zero.\n\t n.c = [ n.e = 0 ];\n\t } else {\n\t n.e = e;\n\t n.c = c;\n\t }\n\t\n\t return n;\n\t }\n\t\n\t\n\t // Handle values that fail the validity test in BigNumber.\n\t parseNumeric = (function () {\n\t var basePrefix = /^(-?)0([xbo])/i,\n\t dotAfter = /^([^.]+)\\.$/,\n\t dotBefore = /^\\.([^.]+)$/,\n\t isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n\t whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\t\n\t return function ( x, str, num, b ) {\n\t var base,\n\t s = num ? str : str.replace( whitespaceOrPlus, '' );\n\t\n\t // No exception on ±Infinity or NaN.\n\t if ( isInfinityOrNaN.test(s) ) {\n\t x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n\t } else {\n\t if ( !num ) {\n\t\n\t // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n\t s = s.replace( basePrefix, function ( m, p1, p2 ) {\n\t base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n\t return !b || b == base ? p1 : m;\n\t });\n\t\n\t if (b) {\n\t base = b;\n\t\n\t // E.g. '1.' to '1', '.1' to '0.1'\n\t s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n\t }\n\t\n\t if ( str != s ) return new BigNumber( s, base );\n\t }\n\t\n\t // 'new BigNumber() not a number: {n}'\n\t // 'new BigNumber() not a base {b} number: {n}'\n\t if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n\t x.s = null;\n\t }\n\t\n\t x.c = x.e = null;\n\t id = 0;\n\t }\n\t })();\n\t\n\t\n\t // Throw a BigNumber Error.\n\t function raise( caller, msg, val ) {\n\t var error = new Error( [\n\t 'new BigNumber', // 0\n\t 'cmp', // 1\n\t 'config', // 2\n\t 'div', // 3\n\t 'divToInt', // 4\n\t 'eq', // 5\n\t 'gt', // 6\n\t 'gte', // 7\n\t 'lt', // 8\n\t 'lte', // 9\n\t 'minus', // 10\n\t 'mod', // 11\n\t 'plus', // 12\n\t 'precision', // 13\n\t 'random', // 14\n\t 'round', // 15\n\t 'shift', // 16\n\t 'times', // 17\n\t 'toDigits', // 18\n\t 'toExponential', // 19\n\t 'toFixed', // 20\n\t 'toFormat', // 21\n\t 'toFraction', // 22\n\t 'pow', // 23\n\t 'toPrecision', // 24\n\t 'toString', // 25\n\t 'BigNumber' // 26\n\t ][caller] + '() ' + msg + ': ' + val );\n\t\n\t error.name = 'BigNumber Error';\n\t id = 0;\n\t throw error;\n\t }\n\t\n\t\n\t /*\n\t * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n\t * If r is truthy, it is known that there are more digits after the rounding digit.\n\t */\n\t function round( x, sd, rm, r ) {\n\t var d, i, j, k, n, ni, rd,\n\t xc = x.c,\n\t pows10 = POWS_TEN;\n\t\n\t // if x is not Infinity or NaN...\n\t if (xc) {\n\t\n\t // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n\t // n is a base 1e14 number, the value of the element of array x.c containing rd.\n\t // ni is the index of n within x.c.\n\t // d is the number of digits of n.\n\t // i is the index of rd within n including leading zeros.\n\t // j is the actual index of rd within n (if < 0, rd is a leading zero).\n\t out: {\n\t\n\t // Get the number of digits of the first element of xc.\n\t for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n\t i = sd - d;\n\t\n\t // If the rounding digit is in the first element of xc...\n\t if ( i < 0 ) {\n\t i += LOG_BASE;\n\t j = sd;\n\t n = xc[ ni = 0 ];\n\t\n\t // Get the rounding digit at index j of n.\n\t rd = n / pows10[ d - j - 1 ] % 10 | 0;\n\t } else {\n\t ni = mathceil( ( i + 1 ) / LOG_BASE );\n\t\n\t if ( ni >= xc.length ) {\n\t\n\t if (r) {\n\t\n\t // Needed by sqrt.\n\t for ( ; xc.length <= ni; xc.push(0) );\n\t n = rd = 0;\n\t d = 1;\n\t i %= LOG_BASE;\n\t j = i - LOG_BASE + 1;\n\t } else {\n\t break out;\n\t }\n\t } else {\n\t n = k = xc[ni];\n\t\n\t // Get the number of digits of n.\n\t for ( d = 1; k >= 10; k /= 10, d++ );\n\t\n\t // Get the index of rd within n.\n\t i %= LOG_BASE;\n\t\n\t // Get the index of rd within n, adjusted for leading zeros.\n\t // The number of leading zeros of n is given by LOG_BASE - d.\n\t j = i - LOG_BASE + d;\n\t\n\t // Get the rounding digit at index j of n.\n\t rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n\t }\n\t }\n\t\n\t r = r || sd < 0 ||\n\t\n\t // Are there any non-zero digits after the rounding digit?\n\t // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n\t // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n\t xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\t\n\t r = rm < 4\n\t ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\t\n\t // Check whether the digit to the left of the rounding digit is odd.\n\t ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( sd < 1 || !xc[0] ) {\n\t xc.length = 0;\n\t\n\t if (r) {\n\t\n\t // Convert sd to decimal places.\n\t sd -= x.e + 1;\n\t\n\t // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\t xc[0] = pows10[ sd % LOG_BASE ];\n\t x.e = -sd || 0;\n\t } else {\n\t\n\t // Zero.\n\t xc[0] = x.e = 0;\n\t }\n\t\n\t return x;\n\t }\n\t\n\t // Remove excess digits.\n\t if ( i == 0 ) {\n\t xc.length = ni;\n\t k = 1;\n\t ni--;\n\t } else {\n\t xc.length = ni + 1;\n\t k = pows10[ LOG_BASE - i ];\n\t\n\t // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n\t // j > 0 means i > number of leading zeros of n.\n\t xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n\t }\n\t\n\t // Round up?\n\t if (r) {\n\t\n\t for ( ; ; ) {\n\t\n\t // If the digit to be rounded up is in the first element of xc...\n\t if ( ni == 0 ) {\n\t\n\t // i will be the length of xc[0] before k is added.\n\t for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n\t j = xc[0] += k;\n\t for ( k = 1; j >= 10; j /= 10, k++ );\n\t\n\t // if i != k the length has increased.\n\t if ( i != k ) {\n\t x.e++;\n\t if ( xc[0] == BASE ) xc[0] = 1;\n\t }\n\t\n\t break;\n\t } else {\n\t xc[ni] += k;\n\t if ( xc[ni] != BASE ) break;\n\t xc[ni--] = 0;\n\t k = 1;\n\t }\n\t }\n\t }\n\t\n\t // Remove trailing zeros.\n\t for ( i = xc.length; xc[--i] === 0; xc.pop() );\n\t }\n\t\n\t // Overflow? Infinity.\n\t if ( x.e > MAX_EXP ) {\n\t x.c = x.e = null;\n\t\n\t // Underflow? Zero.\n\t } else if ( x.e < MIN_EXP ) {\n\t x.c = [ x.e = 0 ];\n\t }\n\t }\n\t\n\t return x;\n\t }\n\t\n\t\n\t // PROTOTYPE/INSTANCE METHODS\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the absolute value of this BigNumber.\n\t */\n\t P.absoluteValue = P.abs = function () {\n\t var x = new BigNumber(this);\n\t if ( x.s < 0 ) x.s = 1;\n\t return x;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of Infinity.\n\t */\n\t P.ceil = function () {\n\t return round( new BigNumber(this), this.e + 1, 2 );\n\t };\n\t\n\t\n\t /*\n\t * Return\n\t * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * 0 if they have the same value,\n\t * or null if the value of either is NaN.\n\t */\n\t P.comparedTo = P.cmp = function ( y, b ) {\n\t id = 1;\n\t return compare( this, new BigNumber( y, b ) );\n\t };\n\t\n\t\n\t /*\n\t * Return the number of decimal places of the value of this BigNumber, or null if the value\n\t * of this BigNumber is ±Infinity or NaN.\n\t */\n\t P.decimalPlaces = P.dp = function () {\n\t var n, v,\n\t c = this.c;\n\t\n\t if ( !c ) return null;\n\t n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\t\n\t // Subtract the number of trailing zeros of the last number.\n\t if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n\t if ( n < 0 ) n = 0;\n\t\n\t return n;\n\t };\n\t\n\t\n\t /*\n\t * n / 0 = I\n\t * n / N = N\n\t * n / I = 0\n\t * 0 / n = 0\n\t * 0 / 0 = N\n\t * 0 / N = N\n\t * 0 / I = 0\n\t * N / n = N\n\t * N / 0 = N\n\t * N / N = N\n\t * N / I = N\n\t * I / n = I\n\t * I / 0 = I\n\t * I / N = N\n\t * I / I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n\t * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.dividedBy = P.div = function ( y, b ) {\n\t id = 3;\n\t return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the integer part of dividing the value of this\n\t * BigNumber by the value of BigNumber(y, b).\n\t */\n\t P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n\t id = 4;\n\t return div( this, new BigNumber( y, b ), 0, 1 );\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.equals = P.eq = function ( y, b ) {\n\t id = 5;\n\t return compare( this, new BigNumber( y, b ) ) === 0;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n\t * number in the direction of -Infinity.\n\t */\n\t P.floor = function () {\n\t return round( new BigNumber(this), this.e + 1, 3 );\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.greaterThan = P.gt = function ( y, b ) {\n\t id = 6;\n\t return compare( this, new BigNumber( y, b ) ) > 0;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is greater than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n\t id = 7;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\t\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n\t */\n\t P.isFinite = function () {\n\t return !!this.c;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is an integer, otherwise return false.\n\t */\n\t P.isInteger = P.isInt = function () {\n\t return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is NaN, otherwise returns false.\n\t */\n\t P.isNaN = function () {\n\t return !this.s;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is negative, otherwise returns false.\n\t */\n\t P.isNegative = P.isNeg = function () {\n\t return this.s < 0;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n\t */\n\t P.isZero = function () {\n\t return !!this.c && this.c[0] == 0;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n\t * otherwise returns false.\n\t */\n\t P.lessThan = P.lt = function ( y, b ) {\n\t id = 8;\n\t return compare( this, new BigNumber( y, b ) ) < 0;\n\t };\n\t\n\t\n\t /*\n\t * Return true if the value of this BigNumber is less than or equal to the value of\n\t * BigNumber(y, b), otherwise returns false.\n\t */\n\t P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n\t id = 9;\n\t return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n\t };\n\t\n\t\n\t /*\n\t * n - 0 = n\n\t * n - N = N\n\t * n - I = -I\n\t * 0 - n = -n\n\t * 0 - 0 = 0\n\t * 0 - N = N\n\t * 0 - I = -I\n\t * N - n = N\n\t * N - 0 = N\n\t * N - N = N\n\t * N - I = N\n\t * I - n = I\n\t * I - 0 = I\n\t * I - N = N\n\t * I - I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.minus = P.sub = function ( y, b ) {\n\t var i, j, t, xLTy,\n\t x = this,\n\t a = x.s;\n\t\n\t id = 10;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\t\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\t\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.plus(y);\n\t }\n\t\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\t\n\t if ( !xe || !ye ) {\n\t\n\t // Either Infinity?\n\t if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\t\n\t // Either zero?\n\t if ( !xc[0] || !yc[0] ) {\n\t\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\t\n\t // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n\t ROUNDING_MODE == 3 ? -0 : 0 );\n\t }\n\t }\n\t\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\t\n\t // Determine which is the bigger number.\n\t if ( a = xe - ye ) {\n\t\n\t if ( xLTy = a < 0 ) {\n\t a = -a;\n\t t = xc;\n\t } else {\n\t ye = xe;\n\t t = yc;\n\t }\n\t\n\t t.reverse();\n\t\n\t // Prepend zeros to equalise exponents.\n\t for ( b = a; b--; t.push(0) );\n\t t.reverse();\n\t } else {\n\t\n\t // Exponents equal. Check digit by digit.\n\t j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\t\n\t for ( a = b = 0; b < j; b++ ) {\n\t\n\t if ( xc[b] != yc[b] ) {\n\t xLTy = xc[b] < yc[b];\n\t break;\n\t }\n\t }\n\t }\n\t\n\t // x < y? Point xc to the array of the bigger number.\n\t if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\t\n\t b = ( j = yc.length ) - ( i = xc.length );\n\t\n\t // Append zeros to xc if shorter.\n\t // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\t if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n\t b = BASE - 1;\n\t\n\t // Subtract yc from xc.\n\t for ( ; j > a; ) {\n\t\n\t if ( xc[--j] < yc[j] ) {\n\t for ( i = j; i && !xc[--i]; xc[i] = b );\n\t --xc[i];\n\t xc[j] += BASE;\n\t }\n\t\n\t xc[j] -= yc[j];\n\t }\n\t\n\t // Remove leading zeros and adjust exponent accordingly.\n\t for ( ; xc[0] == 0; xc.shift(), --ye );\n\t\n\t // Zero?\n\t if ( !xc[0] ) {\n\t\n\t // Following IEEE 754 (2008) 6.3,\n\t // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n\t y.s = ROUNDING_MODE == 3 ? -1 : 1;\n\t y.c = [ y.e = 0 ];\n\t return y;\n\t }\n\t\n\t // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n\t // for finite x and y.\n\t return normalise( y, xc, ye );\n\t };\n\t\n\t\n\t /*\n\t * n % 0 = N\n\t * n % N = N\n\t * n % I = n\n\t * 0 % n = 0\n\t * -0 % n = -0\n\t * 0 % 0 = N\n\t * 0 % N = N\n\t * 0 % I = 0\n\t * N % n = N\n\t * N % 0 = N\n\t * N % N = N\n\t * N % I = N\n\t * I % n = N\n\t * I % 0 = N\n\t * I % N = N\n\t * I % I = N\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n\t * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n\t */\n\t P.modulo = P.mod = function ( y, b ) {\n\t var q, s,\n\t x = this;\n\t\n\t id = 11;\n\t y = new BigNumber( y, b );\n\t\n\t // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\t if ( !x.c || !y.s || y.c && !y.c[0] ) {\n\t return new BigNumber(NaN);\n\t\n\t // Return x if y is Infinity or x is zero.\n\t } else if ( !y.c || x.c && !x.c[0] ) {\n\t return new BigNumber(x);\n\t }\n\t\n\t if ( MODULO_MODE == 9 ) {\n\t\n\t // Euclidian division: q = sign(y) * floor(x / abs(y))\n\t // r = x - qy where 0 <= r < abs(y)\n\t s = y.s;\n\t y.s = 1;\n\t q = div( x, y, 0, 3 );\n\t y.s = s;\n\t q.s *= s;\n\t } else {\n\t q = div( x, y, 0, MODULO_MODE );\n\t }\n\t\n\t return x.minus( q.times(y) );\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber negated,\n\t * i.e. multiplied by -1.\n\t */\n\t P.negated = P.neg = function () {\n\t var x = new BigNumber(this);\n\t x.s = -x.s || null;\n\t return x;\n\t };\n\t\n\t\n\t /*\n\t * n + 0 = n\n\t * n + N = N\n\t * n + I = I\n\t * 0 + n = n\n\t * 0 + 0 = 0\n\t * 0 + N = N\n\t * 0 + I = I\n\t * N + n = N\n\t * N + 0 = N\n\t * N + N = N\n\t * N + I = N\n\t * I + n = I\n\t * I + 0 = I\n\t * I + N = N\n\t * I + I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n\t * BigNumber(y, b).\n\t */\n\t P.plus = P.add = function ( y, b ) {\n\t var t,\n\t x = this,\n\t a = x.s;\n\t\n\t id = 12;\n\t y = new BigNumber( y, b );\n\t b = y.s;\n\t\n\t // Either NaN?\n\t if ( !a || !b ) return new BigNumber(NaN);\n\t\n\t // Signs differ?\n\t if ( a != b ) {\n\t y.s = -b;\n\t return x.minus(y);\n\t }\n\t\n\t var xe = x.e / LOG_BASE,\n\t ye = y.e / LOG_BASE,\n\t xc = x.c,\n\t yc = y.c;\n\t\n\t if ( !xe || !ye ) {\n\t\n\t // Return ±Infinity if either ±Infinity.\n\t if ( !xc || !yc ) return new BigNumber( a / 0 );\n\t\n\t // Either zero?\n\t // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\t if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n\t }\n\t\n\t xe = bitFloor(xe);\n\t ye = bitFloor(ye);\n\t xc = xc.slice();\n\t\n\t // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\t if ( a = xe - ye ) {\n\t if ( a > 0 ) {\n\t ye = xe;\n\t t = yc;\n\t } else {\n\t a = -a;\n\t t = xc;\n\t }\n\t\n\t t.reverse();\n\t for ( ; a--; t.push(0) );\n\t t.reverse();\n\t }\n\t\n\t a = xc.length;\n\t b = yc.length;\n\t\n\t // Point xc to the longer array, and b to the shorter length.\n\t if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\t\n\t // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\t for ( a = 0; b; ) {\n\t a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n\t xc[b] %= BASE;\n\t }\n\t\n\t if (a) {\n\t xc.unshift(a);\n\t ++ye;\n\t }\n\t\n\t // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n\t // ye = MAX_EXP + 1 possible\n\t return normalise( y, xc, ye );\n\t };\n\t\n\t\n\t /*\n\t * Return the number of significant digits of the value of this BigNumber.\n\t *\n\t * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n\t */\n\t P.precision = P.sd = function (z) {\n\t var n, v,\n\t x = this,\n\t c = x.c;\n\t\n\t // 'precision() argument not a boolean or binary digit: {z}'\n\t if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n\t if (ERRORS) raise( 13, 'argument' + notBool, z );\n\t if ( z != !!z ) z = null;\n\t }\n\t\n\t if ( !c ) return null;\n\t v = c.length - 1;\n\t n = v * LOG_BASE + 1;\n\t\n\t if ( v = c[v] ) {\n\t\n\t // Subtract the number of trailing zeros of the last element.\n\t for ( ; v % 10 == 0; v /= 10, n-- );\n\t\n\t // Add the number of digits of the first element.\n\t for ( v = c[0]; v >= 10; v /= 10, n++ );\n\t }\n\t\n\t if ( z && x.e + 1 > n ) n = x.e + 1;\n\t\n\t return n;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n\t * omitted.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'round() decimal places out of range: {dp}'\n\t * 'round() decimal places not an integer: {dp}'\n\t * 'round() rounding mode not an integer: {rm}'\n\t * 'round() rounding mode out of range: {rm}'\n\t */\n\t P.round = function ( dp, rm ) {\n\t var n = new BigNumber(this);\n\t\n\t if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n\t round( n, ~~dp + this.e + 1, rm == null ||\n\t !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n\t }\n\t\n\t return n;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n\t * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n\t *\n\t * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n\t *\n\t * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n\t * otherwise.\n\t *\n\t * 'shift() argument not an integer: {k}'\n\t * 'shift() argument out of range: {k}'\n\t */\n\t P.shift = function (k) {\n\t var n = this;\n\t return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\t\n\t // k < 1e+21, or truncate(k) will produce exponential notation.\n\t ? n.times( '1e' + truncate(k) )\n\t : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n\t ? n.s * ( k < 0 ? 0 : 1 / 0 )\n\t : n );\n\t };\n\t\n\t\n\t /*\n\t * sqrt(-n) = N\n\t * sqrt( N) = N\n\t * sqrt(-I) = N\n\t * sqrt( I) = I\n\t * sqrt( 0) = 0\n\t * sqrt(-0) = -0\n\t *\n\t * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n\t * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n\t */\n\t P.squareRoot = P.sqrt = function () {\n\t var m, n, r, rep, t,\n\t x = this,\n\t c = x.c,\n\t s = x.s,\n\t e = x.e,\n\t dp = DECIMAL_PLACES + 4,\n\t half = new BigNumber('0.5');\n\t\n\t // Negative/NaN/Infinity/zero?\n\t if ( s !== 1 || !c || !c[0] ) {\n\t return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n\t }\n\t\n\t // Initial estimate.\n\t s = Math.sqrt( +x );\n\t\n\t // Math.sqrt underflow/overflow?\n\t // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\t if ( s == 0 || s == 1 / 0 ) {\n\t n = coeffToString(c);\n\t if ( ( n.length + e ) % 2 == 0 ) n += '0';\n\t s = Math.sqrt(n);\n\t e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\t\n\t if ( s == 1 / 0 ) {\n\t n = '1e' + e;\n\t } else {\n\t n = s.toExponential();\n\t n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n\t }\n\t\n\t r = new BigNumber(n);\n\t } else {\n\t r = new BigNumber( s + '' );\n\t }\n\t\n\t // Check for zero.\n\t // r could be zero if MIN_EXP is changed after the this value was created.\n\t // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n\t // coeffToString to throw.\n\t if ( r.c[0] ) {\n\t e = r.e;\n\t s = e + dp;\n\t if ( s < 3 ) s = 0;\n\t\n\t // Newton-Raphson iteration.\n\t for ( ; ; ) {\n\t t = r;\n\t r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\t\n\t if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n\t coeffToString( r.c ) ).slice( 0, s ) ) {\n\t\n\t // The exponent of r may here be one less than the final result exponent,\n\t // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n\t // are indexed correctly.\n\t if ( r.e < e ) --s;\n\t n = n.slice( s - 3, s + 1 );\n\t\n\t // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n\t // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n\t // iteration.\n\t if ( n == '9999' || !rep && n == '4999' ) {\n\t\n\t // On the first iteration only, check to see if rounding up gives the\n\t // exact result as the nines may infinitely repeat.\n\t if ( !rep ) {\n\t round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\t\n\t if ( t.times(t).eq(x) ) {\n\t r = t;\n\t break;\n\t }\n\t }\n\t\n\t dp += 4;\n\t s += 4;\n\t rep = 1;\n\t } else {\n\t\n\t // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n\t // result. If not, then there are further digits and m will be truthy.\n\t if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\t\n\t // Truncate to the first rounding digit.\n\t round( r, r.e + DECIMAL_PLACES + 2, 1 );\n\t m = !r.times(r).eq(x);\n\t }\n\t\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t\n\t return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n\t };\n\t\n\t\n\t /*\n\t * n * 0 = 0\n\t * n * N = N\n\t * n * I = I\n\t * 0 * n = 0\n\t * 0 * 0 = 0\n\t * 0 * N = N\n\t * 0 * I = N\n\t * N * n = N\n\t * N * 0 = N\n\t * N * N = N\n\t * N * I = N\n\t * I * n = I\n\t * I * 0 = N\n\t * I * N = N\n\t * I * I = I\n\t *\n\t * Return a new BigNumber whose value is the value of this BigNumber times the value of\n\t * BigNumber(y, b).\n\t */\n\t P.times = P.mul = function ( y, b ) {\n\t var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n\t base, sqrtBase,\n\t x = this,\n\t xc = x.c,\n\t yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\t\n\t // Either NaN, ±Infinity or ±0?\n\t if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\t\n\t // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n\t if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n\t y.c = y.e = y.s = null;\n\t } else {\n\t y.s *= x.s;\n\t\n\t // Return ±Infinity if either is ±Infinity.\n\t if ( !xc || !yc ) {\n\t y.c = y.e = null;\n\t\n\t // Return ±0 if either is ±0.\n\t } else {\n\t y.c = [0];\n\t y.e = 0;\n\t }\n\t }\n\t\n\t return y;\n\t }\n\t\n\t e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n\t y.s *= x.s;\n\t xcL = xc.length;\n\t ycL = yc.length;\n\t\n\t // Ensure xc points to longer array and xcL to its length.\n\t if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\t\n\t // Initialise the result array with zeros.\n\t for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\t\n\t base = BASE;\n\t sqrtBase = SQRT_BASE;\n\t\n\t for ( i = ycL; --i >= 0; ) {\n\t c = 0;\n\t ylo = yc[i] % sqrtBase;\n\t yhi = yc[i] / sqrtBase | 0;\n\t\n\t for ( k = xcL, j = i + k; j > i; ) {\n\t xlo = xc[--k] % sqrtBase;\n\t xhi = xc[k] / sqrtBase | 0;\n\t m = yhi * xlo + xhi * ylo;\n\t xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n\t c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n\t zc[j--] = xlo % base;\n\t }\n\t\n\t zc[j] = c;\n\t }\n\t\n\t if (c) {\n\t ++e;\n\t } else {\n\t zc.shift();\n\t }\n\t\n\t return normalise( y, zc, e );\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n\t * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toDigits() precision out of range: {sd}'\n\t * 'toDigits() precision not an integer: {sd}'\n\t * 'toDigits() rounding mode not an integer: {rm}'\n\t * 'toDigits() rounding mode out of range: {rm}'\n\t */\n\t P.toDigits = function ( sd, rm ) {\n\t var n = new BigNumber(this);\n\t sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n\t rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n\t return sd ? round( n, sd, rm ) : n;\n\t };\n\t\n\t\n\t /*\n\t * Return a string representing the value of this BigNumber in exponential notation and\n\t * rounded using ROUNDING_MODE to dp fixed decimal places.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toExponential() decimal places not an integer: {dp}'\n\t * 'toExponential() decimal places out of range: {dp}'\n\t * 'toExponential() rounding mode not an integer: {rm}'\n\t * 'toExponential() rounding mode out of range: {rm}'\n\t */\n\t P.toExponential = function ( dp, rm ) {\n\t return format( this,\n\t dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n\t };\n\t\n\t\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounding\n\t * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n\t *\n\t * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n\t * but e.g. (-0.00001).toFixed(0) is '-0'.\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFixed() decimal places not an integer: {dp}'\n\t * 'toFixed() decimal places out of range: {dp}'\n\t * 'toFixed() rounding mode not an integer: {rm}'\n\t * 'toFixed() rounding mode out of range: {rm}'\n\t */\n\t P.toFixed = function ( dp, rm ) {\n\t return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n\t ? ~~dp + this.e + 1 : null, rm, 20 );\n\t };\n\t\n\t\n\t /*\n\t * Return a string representing the value of this BigNumber in fixed-point notation rounded\n\t * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n\t * of the FORMAT object (see BigNumber.config).\n\t *\n\t * FORMAT = {\n\t * decimalSeparator : '.',\n\t * groupSeparator : ',',\n\t * groupSize : 3,\n\t * secondaryGroupSize : 0,\n\t * fractionGroupSeparator : '\\xA0', // non-breaking space\n\t * fractionGroupSize : 0\n\t * };\n\t *\n\t * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toFormat() decimal places not an integer: {dp}'\n\t * 'toFormat() decimal places out of range: {dp}'\n\t * 'toFormat() rounding mode not an integer: {rm}'\n\t * 'toFormat() rounding mode out of range: {rm}'\n\t */\n\t P.toFormat = function ( dp, rm ) {\n\t var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n\t ? ~~dp + this.e + 1 : null, rm, 21 );\n\t\n\t if ( this.c ) {\n\t var i,\n\t arr = str.split('.'),\n\t g1 = +FORMAT.groupSize,\n\t g2 = +FORMAT.secondaryGroupSize,\n\t groupSeparator = FORMAT.groupSeparator,\n\t intPart = arr[0],\n\t fractionPart = arr[1],\n\t isNeg = this.s < 0,\n\t intDigits = isNeg ? intPart.slice(1) : intPart,\n\t len = intDigits.length;\n\t\n\t if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\t\n\t if ( g1 > 0 && len > 0 ) {\n\t i = len % g1 || g1;\n\t intPart = intDigits.substr( 0, i );\n\t\n\t for ( ; i < len; i += g1 ) {\n\t intPart += groupSeparator + intDigits.substr( i, g1 );\n\t }\n\t\n\t if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n\t if (isNeg) intPart = '-' + intPart;\n\t }\n\t\n\t str = fractionPart\n\t ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n\t ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n\t '$&' + FORMAT.fractionGroupSeparator )\n\t : fractionPart )\n\t : intPart;\n\t }\n\t\n\t return str;\n\t };\n\t\n\t\n\t /*\n\t * Return a string array representing the value of this BigNumber as a simple fraction with\n\t * an integer numerator and an integer denominator. The denominator will be a positive\n\t * non-zero value less than or equal to the specified maximum denominator. If a maximum\n\t * denominator is not specified, the denominator will be the lowest value necessary to\n\t * represent the number exactly.\n\t *\n\t * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n\t *\n\t * 'toFraction() max denominator not an integer: {md}'\n\t * 'toFraction() max denominator out of range: {md}'\n\t */\n\t P.toFraction = function (md) {\n\t var arr, d0, d2, e, exp, n, n0, q, s,\n\t k = ERRORS,\n\t x = this,\n\t xc = x.c,\n\t d = new BigNumber(ONE),\n\t n1 = d0 = new BigNumber(ONE),\n\t d1 = n0 = new BigNumber(ONE);\n\t\n\t if ( md != null ) {\n\t ERRORS = false;\n\t n = new BigNumber(md);\n\t ERRORS = k;\n\t\n\t if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\t\n\t if (ERRORS) {\n\t raise( 22,\n\t 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n\t }\n\t\n\t // ERRORS is false:\n\t // If md is a finite non-integer >= 1, round it to an integer and use it.\n\t md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n\t }\n\t }\n\t\n\t if ( !xc ) return x.toString();\n\t s = coeffToString(xc);\n\t\n\t // Determine initial denominator.\n\t // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\t e = d.e = s.length - x.e - 1;\n\t d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n\t md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\t\n\t exp = MAX_EXP;\n\t MAX_EXP = 1 / 0;\n\t n = new BigNumber(s);\n\t\n\t // n0 = d1 = 0\n\t n0.c[0] = 0;\n\t\n\t for ( ; ; ) {\n\t q = div( n, d, 0, 1 );\n\t d2 = d0.plus( q.times(d1) );\n\t if ( d2.cmp(md) == 1 ) break;\n\t d0 = d1;\n\t d1 = d2;\n\t n1 = n0.plus( q.times( d2 = n1 ) );\n\t n0 = d2;\n\t d = n.minus( q.times( d2 = d ) );\n\t n = d2;\n\t }\n\t\n\t d2 = div( md.minus(d0), d1, 0, 1 );\n\t n0 = n0.plus( d2.times(n1) );\n\t d0 = d0.plus( d2.times(d1) );\n\t n0.s = n1.s = x.s;\n\t e *= 2;\n\t\n\t // Determine which fraction is closer to x, n0/d0 or n1/d1\n\t arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n\t div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n\t ? [ n1.toString(), d1.toString() ]\n\t : [ n0.toString(), d0.toString() ];\n\t\n\t MAX_EXP = exp;\n\t return arr;\n\t };\n\t\n\t\n\t /*\n\t * Return the value of this BigNumber converted to a number primitive.\n\t */\n\t P.toNumber = function () {\n\t var x = this;\n\t\n\t // Ensure zero has correct sign.\n\t return +x || ( x.s ? x.s * 0 : NaN );\n\t };\n\t\n\t\n\t /*\n\t * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n\t * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n\t * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n\t *\n\t * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n\t * (Performs 54 loop iterations for n of 9007199254740992.)\n\t *\n\t * 'pow() exponent not an integer: {n}'\n\t * 'pow() exponent out of range: {n}'\n\t */\n\t P.toPower = P.pow = function (n) {\n\t var k, y,\n\t i = mathfloor( n < 0 ? -n : +n ),\n\t x = this;\n\t\n\t // Pass ±Infinity to Math.pow if exponent is out of range.\n\t if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n\t ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n\t parseFloat(n) != n && !( n = NaN ) ) ) {\n\t return new BigNumber( Math.pow( +x, n ) );\n\t }\n\t\n\t // Truncating each coefficient array to a length of k after each multiplication equates\n\t // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n\t // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n\t k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n\t y = new BigNumber(ONE);\n\t\n\t for ( ; ; ) {\n\t\n\t if ( i % 2 ) {\n\t y = y.times(x);\n\t if ( !y.c ) break;\n\t if ( k && y.c.length > k ) y.c.length = k;\n\t }\n\t\n\t i = mathfloor( i / 2 );\n\t if ( !i ) break;\n\t\n\t x = x.times(x);\n\t if ( k && x.c && x.c.length > k ) x.c.length = k;\n\t }\n\t\n\t if ( n < 0 ) y = ONE.div(y);\n\t return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n\t };\n\t\n\t\n\t /*\n\t * Return a string representing the value of this BigNumber rounded to sd significant digits\n\t * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n\t * necessary to represent the integer part of the value in fixed-point notation, then use\n\t * exponential notation.\n\t *\n\t * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n\t * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n\t *\n\t * 'toPrecision() precision not an integer: {sd}'\n\t * 'toPrecision() precision out of range: {sd}'\n\t * 'toPrecision() rounding mode not an integer: {rm}'\n\t * 'toPrecision() rounding mode out of range: {rm}'\n\t */\n\t P.toPrecision = function ( sd, rm ) {\n\t return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n\t ? sd | 0 : null, rm, 24 );\n\t };\n\t\n\t\n\t /*\n\t * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n\t * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n\t * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n\t * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n\t * TO_EXP_NEG, return exponential notation.\n\t *\n\t * [b] {number} Integer, 2 to 64 inclusive.\n\t *\n\t * 'toString() base not an integer: {b}'\n\t * 'toString() base out of range: {b}'\n\t */\n\t P.toString = function (b) {\n\t var str,\n\t n = this,\n\t s = n.s,\n\t e = n.e;\n\t\n\t // Infinity or NaN?\n\t if ( e === null ) {\n\t\n\t if (s) {\n\t str = 'Infinity';\n\t if ( s < 0 ) str = '-' + str;\n\t } else {\n\t str = 'NaN';\n\t }\n\t } else {\n\t str = coeffToString( n.c );\n\t\n\t if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n\t str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n\t ? toExponential( str, e )\n\t : toFixedPoint( str, e );\n\t } else {\n\t str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n\t }\n\t\n\t if ( s < 0 && n.c[0] ) str = '-' + str;\n\t }\n\t\n\t return str;\n\t };\n\t\n\t\n\t /*\n\t * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n\t * number.\n\t */\n\t P.truncated = P.trunc = function () {\n\t return round( new BigNumber(this), this.e + 1, 1 );\n\t };\n\t\n\t\n\t\n\t /*\n\t * Return as toString, but do not accept a base argument.\n\t */\n\t P.valueOf = P.toJSON = function () {\n\t return this.toString();\n\t };\n\t\n\t\n\t // Aliases for BigDecimal methods.\n\t //P.add = P.plus; // P.add included above\n\t //P.subtract = P.minus; // P.sub included above\n\t //P.multiply = P.times; // P.mul included above\n\t //P.divide = P.div;\n\t //P.remainder = P.mod;\n\t //P.compareTo = P.cmp;\n\t //P.negate = P.neg;\n\t\n\t\n\t if ( configObj != null ) BigNumber.config(configObj);\n\t\n\t return BigNumber;\n\t }", "get decimals() {\n return this.getDecimals();\n }", "roundNumber(num, scale)\n {\n if(!(\"\" + num).includes(\"e\")) { //isn't 'e' number\n let ret = +(Math.round(num + \"e+\" + scale) + \"e-\" + scale);\n let decPlaces = (\"\" + ret).split(\".\"); //bc JS is weird\n if(decPlaces.length > 1) {\n ret = decPlaces[1].length === 1 ? ret + \"0\" : ret; //Add 0 on the end so not to get confused for user.\n }\n return ret;\n }\n else {\n var arr = (\"\" + num).split(\"e\"); //Lack of being typestrong strikes again.\n var sig = \"\";\n if(+arr[1] + scale > 0) {\n sig = \"+\";\n }\n return +(Math.round(+arr[0] + \"e\" + sig + (+arr[1] + scale)) + \"e-\" + scale);\n }\n }", "function getMultiplier(decimals) {\n if (typeof (decimals) !== \"number\") {\n try {\n decimals = __WEBPACK_IMPORTED_MODULE_3__bignumber__[\"a\" /* BigNumber */].from(decimals).toNumber();\n }\n catch (e) { }\n }\n if (typeof (decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n return logger.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}", "function disableDecimal() {\n decimalEnabled = false;\n}", "loadAmount() {\n const { item } = this.state;\n if (item.price !== undefined) {\n var num_parts = item.price.amount.toString().split(\".\");\n num_parts[0] = num_parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \".\");\n return num_parts.join(\".\");\n }\n }", "get defaultValueDecimal() {\n\t\treturn this.__defaultValueDecimal;\n\t}", "function precise(x) {\n return Number.parseFloat(x).toFixed(8);\n}", "function convert(amount) {\n return Number(amount) * 1e12;\n}", "bigNumberToScientific() {\n const that = this,\n power = that.numericValue._f - 1,\n remainderPower = parseInt(power, 10) % 3,\n finalPower = parseInt(power, 10) - remainderPower;\n let stringRepresentation = that.numericValue.toString(),\n sign, scientificValue;\n\n if (stringRepresentation.charAt(0) === '-') {\n sign = '-';\n stringRepresentation = stringRepresentation.slice(1);\n }\n else {\n sign = '';\n }\n\n if (arguments[0] !== null) {\n scientificValue = stringRepresentation.slice(0, arguments[0]);\n\n if (parseFloat(stringRepresentation.slice(arguments[0], arguments[0] + 1)) >= 5) {\n scientificValue = new JQX.Utilities.BigNumber(scientificValue).add(1).toString();\n }\n\n while (scientificValue.length > 1 + remainderPower && scientificValue.charAt(scientificValue.length - 1) === '0') {\n scientificValue = scientificValue.slice(0, scientificValue.length - 1);\n }\n }\n else if (arguments[1] !== null) {\n scientificValue = stringRepresentation.slice(0, arguments[1] + 1);\n\n if (parseFloat(stringRepresentation.slice(arguments[1] + 1, arguments[1] + 2)) >= 5) {\n scientificValue = new JQX.Utilities.BigNumber(scientificValue).add(1).toString();\n }\n\n if (arguments[1] + remainderPower > scientificValue.length - 1) {\n scientificValue = scientificValue + ('0').repeat(arguments[1] + remainderPower - scientificValue.length + 1);\n }\n }\n\n if (scientificValue.length > 1 + remainderPower) {\n scientificValue = scientificValue.slice(0, 1 + remainderPower) + '.' + scientificValue.slice(1 + remainderPower);\n }\n\n return sign + scientificValue + that.powersToPrefixes[finalPower.toString()];\n }", "toFixed(digits = 0) {\n if (digits < 0) {\n throw new RangeError('toFixed() digits argument must be non-negative');\n }\n\n if (this.isZero()) {\n return '0' + (digits > 1 ? '.' + '0'.repeat(digits) : '');\n }\n let {sign, accuracy} = this;\n let string = this.toString();\n let padding = digits - accuracy;\n if (padding < 0) {\n let rounding = +string.charAt(string.length + padding);\n if (rounding >= 5) {\n string = this.add(Decimal.exp(-digits).set('sign', sign)).toString();\n }\n return string.slice(0, padding).replace(/\\.$/, '');\n } else if (padding > 0) {\n return string + (this.isReal() ? '' : '.') + '0'.repeat(padding);\n }\n return string;\n }", "function getTens(decimals) {\n let result = Zeros;\n while (result.length < decimals) {\n result += result;\n }\n return BigInt(\"1\" + result.substring(0, decimals));\n}", "function decimal(num) {\n // convert to a string\n num = '' + num;\n\n // find decimal point\n var dec = num.indexOf('.');\n\n if (dec >= 0) {\n // take out the decimal point\n num = num.replace('.', '');\n var precision = num.length - dec;\n } else {\n var precision = 0;\n }\n\n return new Decimal(bigint(num), precision);\n}", "get valueDecimal() {\n\t\treturn this.__valueDecimal;\n\t}", "formatDecimalToBD(str) {\n if(str == null || str == '' || str == 0){\n return 0;\n }else{\n return str.replace(\".\", \"\").replace(\",\", \".\");\n } \n }", "largeExponentialToDecimal(exponential) {\n let validateExponent;\n\n if (exponential === undefined) {\n exponential = this.numericValue;\n validateExponent = true;\n }\n\n let stringExponential = exponential.toString().toLowerCase(),\n indexOfE = stringExponential.indexOf('e'),\n mantissa = new JQX.Utilities.BigNumber(stringExponential.slice(0, indexOfE)),\n sign = stringExponential.slice(indexOfE + 1, indexOfE + 2);\n\n if (sign !== '+' && sign !== '-') {\n stringExponential = stringExponential.slice(0, indexOfE) + 'e+' + stringExponential.slice(indexOfE + 1);\n sign = '+';\n }\n\n let exponent = stringExponential.slice(indexOfE + 2),\n bigTen = new JQX.Utilities.BigNumber(10),\n multyplyBy = bigTen.pow(sign + (validateExponent ? Math.min(20, exponent) : exponent)),\n result = mantissa.multiply(multyplyBy);\n\n return result.toString();\n }", "num_decimals(num) {\n if (!this.is_numeric(num)) return false;\n let text = num.toString()\n if (text.indexOf('e-') > -1) {\n let [base, trail] = text.split('e-')\n let elen = parseInt(trail, 10)\n let idx = base.indexOf(\".\")\n return idx == -1 ? 0 + elen : (base.length - idx - 1) + elen\n }\n let index = text.indexOf(\".\")\n return index == -1 ? 0 : (text.length - index - 1)\n }", "number(number) {\n if (number === \"0x\") {\n return 0;\n }\n return __WEBPACK_IMPORTED_MODULE_1__ethersproject_bignumber__[\"a\" /* BigNumber */].from(number).toNumber();\n }", "function toGB(value,floatSize){\n if(floatSize===undefined)\n floatSize = 0;\n var GBRaw = value / 1024 / 1024 / 1024;\n fsmod = Math.pow(10,floatSize);\n GBRaw = Math.round(GBRaw*fsmod)/fsmod;\n return GBRaw;\n}", "dollars(num) {\n if(this.state.active === false) {\n return (num).toFixed(2);\n } else {\n return num;\n }\n }", "function another(configObj) {\n var div,\n\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20,\n // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4,\n // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7,\n // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21,\n // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7,\n // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7,\n // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true,\n // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors,\n // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false,\n // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1,\n // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100,\n // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n /******************************************************************************************/\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber(n, b) {\n var c,\n e,\n i,\n num,\n len,\n str,\n x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof BigNumber)) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise(26, 'constructor call without new', n);\n return new BigNumber(n, b);\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if (b == null || !isValidInt(b, 2, 64, id, 'base')) {\n\n // Duplicate.\n if (n instanceof BigNumber) {\n x.s = n.s;\n x.e = n.e;\n x.c = (n = n.c) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ((num = typeof n == 'number') && n * 0 == 0) {\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\n\n // Fast path for integers.\n if (n === ~~n) {\n for (e = 0, i = n; i >= 10; i /= 10, e++) {}\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, num);\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if (b == 10) {\n x = new BigNumber(n instanceof BigNumber ? n : str);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ((num = typeof n == 'number') && n * 0 != 0 || !new RegExp('^-?' + (c = '[' + ALPHABET.slice(0, b) + ']+') + '(?:\\\\.' + c + ')?$', b < 37 ? 'i' : '').test(str)) {\n return parseNumeric(x, str, num, b);\n }\n\n if (num) {\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\n\n if (ERRORS && str.replace(/^0\\.0*|\\./, '').length > 15) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise(id, tooManyDigits, n);\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n str = convertBase(str, 10, b, x.s);\n }\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n\n // Exponential form?\n if ((i = str.search(/e/i)) > 0) {\n\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for (i = 0; str.charCodeAt(i) === 48; i++) {}\n\n // Determine trailing zeros.\n for (len = str.length; str.charCodeAt(--len) === 48;) {}\n str = str.slice(i, len + 1);\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if (num && ERRORS && len > 15) raise(id, tooManyDigits, x.s * n);\n\n e = e - i - 1;\n\n // Overflow?\n if (e > MAX_EXP) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE;\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0') {}\n x.c.push(+str);\n }\n } else {\n\n // Zero.\n x.c = [x.e = 0];\n }\n\n id = 0;\n }\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v,\n p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) == 'object' ? function () {\n if (o.hasOwnProperty(p)) return (v = o[p]) != null;\n } : function () {\n if (a.length > i) return (v = a[i++]) != null;\n };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if (has(p = 'DECIMAL_PLACES') && isValidInt(v, 0, MAX, 2, p)) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if (has(p = 'ROUNDING_MODE') && isValidInt(v, 0, 8, 2, p)) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if (has(p = 'EXPONENTIAL_AT')) {\n\n if (isArray(v)) {\n if (isValidInt(v[0], -MAX, 0, 2, p) && isValidInt(v[1], 0, MAX, 2, p)) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if (isValidInt(v, -MAX, MAX, 2, p)) {\n TO_EXP_NEG = -(TO_EXP_POS = (v < 0 ? -v : v) | 0);\n }\n }\n r[p] = [TO_EXP_NEG, TO_EXP_POS];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if (has(p = 'RANGE')) {\n\n if (isArray(v)) {\n if (isValidInt(v[0], -MAX, -1, 2, p) && isValidInt(v[1], 1, MAX, 2, p)) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if (isValidInt(v, -MAX, MAX, 2, p)) {\n if (v | 0) MIN_EXP = -(MAX_EXP = (v < 0 ? -v : v) | 0);else if (ERRORS) raise(2, p + ' cannot be zero', v);\n }\n }\n r[p] = [MIN_EXP, MAX_EXP];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if (has(p = 'ERRORS')) {\n\n if (v === !!v || v === 1 || v === 0) {\n id = 0;\n isValidInt = (ERRORS = !!v) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise(2, p + notBool, v);\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if (has(p = 'CRYPTO')) {\n\n if (v === !!v || v === 1 || v === 0) {\n CRYPTO = !!(v && crypto && (typeof crypto === 'undefined' ? 'undefined' : _typeof(crypto)) == 'object');\n if (v && !CRYPTO && ERRORS) raise(2, 'crypto unavailable', crypto);\n } else if (ERRORS) {\n raise(2, p + notBool, v);\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if (has(p = 'MODULO_MODE') && isValidInt(v, 0, 9, 2, p)) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if (has(p = 'POW_PRECISION') && isValidInt(v, 0, MAX, 2, p)) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if (has(p = 'FORMAT')) {\n\n if ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) == 'object') {\n FORMAT = v;\n } else if (ERRORS) {\n raise(2, p + ' not an object', v);\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = Math.random() * pow2_53 & 0x1fffff ? function () {\n return mathfloor(Math.random() * pow2_53);\n } : function () {\n return (Math.random() * 0x40000000 | 0) * 0x800000 + (Math.random() * 0x800000 | 0);\n };\n\n return function (dp) {\n var a,\n b,\n e,\n k,\n v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt(dp, 0, MAX, 14) ? DECIMAL_PLACES : dp | 0;\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto && crypto.getRandomValues) {\n\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto && crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = (a[i] & 31) * 0x1000000000000 + a[i + 1] * 0x10000000000 + a[i + 2] * 0x100000000 + a[i + 3] * 0x1000000 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise(14, 'crypto unavailable', crypto);\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n }\n\n // Remove trailing elements which are zero.\n for (; c[i] === 0; c.pop(), i--) {}\n\n // Zero?\n if (i < 0) {\n c = [e = 0];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1; c[0] === 0; c.shift(), e -= LOG_BASE) {}\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++) {}\n\n // adjust the exponent accordingly.\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n }();\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if (baseIn < 37) str = str.toLowerCase();\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop()) {}\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];) {}\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {}\n str = toFixedPoint(str, e);\n }\n\n // The caller will add the sign.\n return str;\n }\n\n // Perform division in the specified base. Called by div and convertBase.\n div = function () {\n\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m,\n temp,\n xlo,\n xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for (i = cmp = 0; i < aL; i++) {\n\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0;\n\n // Subtract b from a.\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for (; !a[0] && a.length > 1; a.shift()) {}\n }\n\n // x: dividend, y: divisor.\n return function (x, y, dp, rm, base) {\n var cmp,\n e,\n i,\n more,\n n,\n prod,\n prodL,\n q,\n qc,\n rem,\n remL,\n rem0,\n xi,\n xL,\n yc0,\n yL,\n yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if (!xc || !xc[0] || !yc || !yc[0]) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0);\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for (i = 0; yc[i] == (xc[i] || 0); i++) {}\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1));\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for (; remL < yL; rem[remL++] = 0) {}\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare(yc, rem, yL, remL);\n\n // If divisor < remainder.\n if (cmp < 0) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor(rem0 / yc0);\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if (n > 1) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while (compare(prod, rem, prodL, remL) == 1) {\n n--;\n\n // Subtract divisor from product.\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract(rem, prod, remL, base);\n remL = rem.length;\n\n // If product was < remainder.\n if (cmp == -1) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++;\n\n // Subtract divisor from remainder.\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null;\n\n // Leading zero?\n if (!qc[0]) qc.shift();\n }\n\n if (base == BASE) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) {}\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n }();\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format(n, i, rm, caller) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt(rm, 0, 8, caller, roundingMode) ? rm | 0 : ROUNDING_MODE;\n\n if (!n.c) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG ? toExponential(str, ne) : toFixedPoint(str, ne);\n } else {\n n = round(new BigNumber(n), i, rm);\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString(n.c);\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if (caller == 19 || caller == 24 && (i <= e || e <= TO_EXP_NEG)) {\n\n // Append zeros?\n for (; len < i; str += '0', len++) {}\n str = toExponential(str, e);\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e);\n\n // Append zeros?\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0') {}\n } else {\n i += e - len;\n if (i > 0) {\n if (e + 1 == len) str += '.';\n for (; i--; str += '0') {}\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin(args, method) {\n var m,\n n,\n i = 0;\n\n if (isArray(args[0])) args = args[0];\n m = new BigNumber(args[0]);\n\n for (; ++i < args.length;) {\n n = new BigNumber(args[i]);\n\n // If any number is NaN, return NaN.\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors(n, min, max, caller, name) {\n if (n < min || n > max || n != truncate(n)) {\n raise(caller, (name || 'decimal places') + (n < min || n > max ? ' out of range' : ' not an integer'), n);\n }\n\n return true;\n }\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise(n, c, e) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for (; !c[--j]; c.pop()) {}\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for (j = c[0]; j >= 10; j /= 10, i++) {}\n\n // Overflow?\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function (x, str, num, b) {\n var base,\n s = num ? str : str.replace(whitespaceOrPlus, '');\n\n // No exception on ±Infinity or NaN.\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if (!num) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise(id, 'not a' + (b ? ' base ' + b : '') + ' number', str);\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n };\n }();\n\n // Throw a BigNumber Error.\n function raise(caller, msg, val) {\n var error = new Error(['new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val);\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round(x, sd, rm, r) {\n var d,\n i,\n j,\n k,\n n,\n ni,\n rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) {}\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n\n if (r) {\n\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0)) {}\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for (d = 1; k >= 10; k /= 10, d++) {}\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n\n r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[sd % LOG_BASE];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for (;;) {\n\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) {}\n j = xc[0] += k;\n for (k = 1; j >= 10; j /= 10, k++) {}\n\n // if i != k the length has increased.\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for (i = xc.length; xc[--i] === 0; xc.pop()) {}\n }\n\n // Overflow? Infinity.\n if (x.e > MAX_EXP) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round(new BigNumber(this), this.e + 1, 2);\n };\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function (y, b) {\n id = 1;\n return compare(this, new BigNumber(y, b));\n };\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n,\n v,\n c = this.c;\n\n if (!c) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) {}\n if (n < 0) n = 0;\n\n return n;\n };\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function (y, b) {\n id = 3;\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function (y, b) {\n id = 4;\n return div(this, new BigNumber(y, b), 0, 1);\n };\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function (y, b) {\n id = 5;\n return compare(this, new BigNumber(y, b)) === 0;\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round(new BigNumber(this), this.e + 1, 3);\n };\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function (y, b) {\n id = 6;\n return compare(this, new BigNumber(y, b)) > 0;\n };\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function (y, b) {\n id = 7;\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n };\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function (y, b) {\n id = 8;\n return compare(this, new BigNumber(y, b)) < 0;\n };\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function (y, b) {\n id = 9;\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function (y, b) {\n var i,\n j,\n t,\n xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\n\n // Either zero?\n if (!xc[0] || !yc[0]) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if (a = xe - ye) {\n\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for (b = a; b--; t.push(0)) {}\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = (j = yc.length) - (i = xc.length);\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if (b > 0) for (; b--; xc[i++] = 0) {}\n b = BASE - 1;\n\n // Subtract yc from xc.\n for (; j > a;) {\n\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b) {}\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for (; xc[0] == 0; xc.shift(), --ye) {}\n\n // Zero?\n if (!xc[0]) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise(y, xc, ye);\n };\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function (y, b) {\n var q,\n s,\n x = this;\n\n id = 11;\n y = new BigNumber(y, b);\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n return x.minus(q.times(y));\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function (y, b) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0);\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for (; a--; t.push(0)) {}\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise(y, xc, ye);\n };\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n,\n v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if (z != null && z !== !!z && z !== 1 && z !== 0) {\n if (ERRORS) raise(13, 'argument' + notBool, z);\n if (z != !!z) z = null;\n }\n\n if (!c) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--) {}\n\n // Add the number of digits of the first element.\n for (v = c[0]; v >= 10; v /= 10, n++) {}\n }\n\n if (z && x.e + 1 > n) n = x.e + 1;\n\n return n;\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function (dp, rm) {\n var n = new BigNumber(this);\n\n if (dp == null || isValidInt(dp, 0, MAX, 15)) {\n round(n, ~~dp + this.e + 1, rm == null || !isValidInt(rm, 0, 8, 15, roundingMode) ? ROUNDING_MODE : rm | 0);\n }\n\n return n;\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument')\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times('1e' + truncate(k)) : new BigNumber(n.c && n.c[0] && (k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER) ? n.s * (k < 0 ? 0 : 1 / 0) : n);\n };\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m,\n n,\n r,\n rep,\n t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n }\n\n // Initial estimate.\n s = Math.sqrt(+x);\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0;\n\n // Newton-Raphson iteration.\n for (;;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e) --s;\n n = n.slice(s - 3, s + 1);\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if (n == '9999' || !rep && n == '4999') {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function (y, b) {\n var c,\n e,\n i,\n j,\n k,\n m,\n xcL,\n xlo,\n xhi,\n ycL,\n ylo,\n yhi,\n zc,\n base,\n sqrtBase,\n x = this,\n xc = x.c,\n yc = (id = 17, y = new BigNumber(y, b)).c;\n\n // Either NaN, ±Infinity or ±0?\n if (!xc || !yc || !xc[0] || !yc[0]) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if (!xc || !yc) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for (i = xcL + ycL, zc = []; i--; zc.push(0)) {}\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise(y, zc, e);\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function (sd, rm) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt(sd, 1, MAX, 18, 'precision') ? null : sd | 0;\n rm = rm == null || !isValidInt(rm, 0, 8, 18, roundingMode) ? ROUNDING_MODE : rm | 0;\n return sd ? round(n, sd, rm) : n;\n };\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function (dp, rm) {\n return format(this, dp != null && isValidInt(dp, 0, MAX, 19) ? ~~dp + 1 : null, rm, 19);\n };\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function (dp, rm) {\n return format(this, dp != null && isValidInt(dp, 0, MAX, 20) ? ~~dp + this.e + 1 : null, rm, 20);\n };\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function (dp, rm) {\n var str = format(this, dp != null && isValidInt(dp, 0, MAX, 21) ? ~~dp + this.e + 1 : null, rm, 21);\n\n if (this.c) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n\n for (; i < len; i += g1) {\n intPart += groupSeparator + intDigits.substr(i, g1);\n }\n\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize) ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'), '$&' + FORMAT.fractionGroupSeparator) : fractionPart) : intPart;\n }\n\n return str;\n };\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr,\n d0,\n d2,\n e,\n exp,\n n,\n n0,\n q,\n s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if (md != null) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if (!(k = n.isInt()) || n.lt(ONE)) {\n\n if (ERRORS) {\n raise(22, 'max denominator ' + (k ? 'out of range' : 'not an integer'), md);\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round(n, n.e + 1, 1).gte(ONE) ? n : null;\n }\n }\n\n if (!xc) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.cmp(d) > 0 ? e > 0 ? d : n1 : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for (;;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.cmp(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().cmp(div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1.toString(), d1.toString()] : [n0.toString(), d0.toString()];\n\n MAX_EXP = exp;\n return arr;\n };\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || (x.s ? x.s * 0 : NaN);\n };\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k,\n y,\n i = mathfloor(n < 0 ? -n : +n),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if (!isValidInt(n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent') && (!isFinite(n) || i > MAX_SAFE_INTEGER && (n /= 0) || parseFloat(n) != n && !(n = NaN))) {\n return new BigNumber(Math.pow(+x, n));\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil(POW_PRECISION / LOG_BASE + 2) : 0;\n y = new BigNumber(ONE);\n\n for (;;) {\n\n if (i % 2) {\n y = y.times(x);\n if (!y.c) break;\n if (k && y.c.length > k) y.c.length = k;\n }\n\n i = mathfloor(i / 2);\n if (!i) break;\n\n x = x.times(x);\n if (k && x.c && x.c.length > k) x.c.length = k;\n }\n\n if (n < 0) y = ONE.div(y);\n return k ? round(y, POW_PRECISION, ROUNDING_MODE) : y;\n };\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function (sd, rm) {\n return format(this, sd != null && isValidInt(sd, 1, MAX, 24, 'precision') ? sd | 0 : null, rm, 24);\n };\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if (e === null) {\n\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString(n.c);\n\n if (b == null || !isValidInt(b, 2, 64, 25, 'base')) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e);\n } else {\n str = convertBase(toFixedPoint(str, e), b | 0, 10, s);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round(new BigNumber(this), this.e + 1, 1);\n };\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if (configObj != null) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function getMultiplier(decimals) {\n if (typeof (decimals) !== \"number\") {\n try {\n decimals = bignumber_1.BigNumber.from(decimals).toNumber();\n }\n catch (e) { }\n }\n if (typeof (decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n return logger.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}", "function getMultiplier(decimals) {\n if (typeof (decimals) !== \"number\") {\n try {\n decimals = bignumber_1.BigNumber.from(decimals).toNumber();\n }\n catch (e) { }\n }\n if (typeof (decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n return logger.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}", "function presicion_method(){\n var number=123456.7890;\n document.getElementById(\"presicion_method\").innerHTML = number.toPrecision(7);\n}", "moneyFormat(value, decimals = 3) {\n if(!isFinite(value)) return `N/A`;\n\n const absValue = Math.abs(value);\n\n if(absValue >= 1.0e+9){\n return `${(value / 1.0e+9).toFixed(decimals)}B`;\n }\n\n if(absValue >= 1.0e+6){\n return `${(value / 1.0e+6).toFixed(decimals)}M`;\n }\n\n if(absValue >= 1.0e+3){\n return `${(value / 1.0e+3).toFixed(decimals)}K`;\n }\n\n return value.toFixed(decimals);\n }", "static toDecimalString(value) {\n const stringValue = value.toString()\n if (stringValue.match(/^-?\\d+$/)) {\n return stringValue\n }\n\n return value.toFixed(2).replace(/0+$/g, '').replace(/\\.$/g, '')\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem.push(xc[xi] || 0);\n remL = remL + 1;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }", "money(event, d = 2, sm = '.', sd = ','){\r\n let decimal = d,\r\n separator_milhar = sd,\r\n separator_decimal = sd,\r\n decimal_potention = Math.pow(10, decimal),\r\n separator_thousend = `$1` + separator_milhar,\r\n override_value,\r\n value_pointer,\r\n blocks,\r\n parts,\r\n isObj = typeof event == 'object',\r\n isEmpty = event.target.value.length <= 0;\r\n\r\n if(!isObj || isEmpty){\r\n throw new Error('Bad format object');\r\n }\r\n\r\n event.target.setAttribute('maxLength', 20);\r\n\r\n override_value = event.target.value.replace(/\\D/g, '');\r\n value_pointer = (override_value / decimal_potention).toFixed(decimal);\r\n blocks = value_pointer.split('.');\r\n parts = blocks[0]\r\n .toString()\r\n .replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, separator_thousend);\r\n\r\n event.target.value = `R$ ${typeof blocks[1] === 'undefined' ? parts : parts + separator_decimal + blocks[1]}`;\r\n }", "function getMultiplier(decimals) {\n if (typeof (decimals) !== \"number\") {\n try {\n decimals = bignumber_1.BigNumber.from(decimals).toNumber();\n }\n catch (e) { }\n }\n if (typeof (decimals) === \"number\" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {\n return (\"1\" + zeros.substring(0, decimals));\n }\n return errors.throwArgumentError(\"invalid decimal size\", \"decimals\", decimals);\n}", "applySignificantDigits(significantDigits) {\n const that = this;\n\n significantDigits = Math.max(1, Math.min(significantDigits, 21));\n\n // removes insignificant trailing zeroes\n function removeTrailingZeroes(value) {\n while (value.charAt(value.length - 1) === '0') {\n value = value.slice(0, -1);\n }\n if (value.charAt(value.length - 1) === '.') {\n value = value.slice(0, -1);\n }\n return value;\n }\n\n let renderedValue = parseFloat(that.numericValue).toPrecision(significantDigits).toUpperCase();\n\n if (renderedValue.indexOf('.') !== -1) {\n if (that.isENotation(renderedValue)) {\n const indexOfDecimalSeparator = renderedValue.indexOf('.'),\n indexOfE = renderedValue.indexOf('E')\n\n let digitsAfterDecimalSeparator = renderedValue.slice(indexOfDecimalSeparator, indexOfE);\n digitsAfterDecimalSeparator = removeTrailingZeroes(digitsAfterDecimalSeparator);\n renderedValue = renderedValue.slice(0, indexOfDecimalSeparator) + digitsAfterDecimalSeparator + renderedValue.slice(indexOfE);\n }\n else {\n renderedValue = removeTrailingZeroes(renderedValue);\n }\n }\n\n return renderedValue;\n }", "function clone(configObject) {\n var div,\n convertBase,\n parseNumeric,\n P = BigNumber.prototype = {\n constructor: BigNumber,\n toString: null,\n valueOf: null\n },\n ONE = new BigNumber(1),\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\n // The default values below must be integers within the inclusive ranges stated.\n // The values can also be changed at run-time using BigNumber.set.\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20,\n // 0 to MAX\n // The rounding mode used when rounding to the above decimal places, and when using\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\n // UP 0 Away from zero.\n // DOWN 1 Towards zero.\n // CEIL 2 Towards +Infinity.\n // FLOOR 3 Towards -Infinity.\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n ROUNDING_MODE = 4,\n // 0 to 8\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7,\n // 0 to -MAX\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21,\n // 0 to MAX\n // RANGE : [MIN_EXP, MAX_EXP]\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7,\n // -1 to -MAX\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7,\n // 1 to MAX\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false,\n // true or false\n // The modulo mode used when calculating the modulus: a mod n.\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n // The remainder (r) is calculated as: r = a - n * q.\n //\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\n // DOWN 1 The remainder has the same sign as the dividend.\n // This modulo mode is commonly known as 'truncated division' and is\n // equivalent to (a % n) in JavaScript.\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n // The remainder is always positive.\n //\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\n // modes are commonly used for the modulus operation.\n // Although the other rounding modes can also be used, they may not give useful results.\n MODULO_MODE = 1,\n // 0 to 9\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0,\n // 0 to MAX\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n prefix: '',\n groupSize: 3,\n secondaryGroupSize: 0,\n groupSeparator: ',',\n decimalSeparator: '.',\n fractionGroupSize: 0,\n fractionGroupSeparator: '\\xA0',\n // non-breaking space\n suffix: ''\n },\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\n // '-', '.', whitespace, or repeated character.\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; //------------------------------------------------------------------------------------------\n // CONSTRUCTOR\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * v {number|string|BigNumber} A numeric value.\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\n */\n\n function BigNumber(v, b) {\n var alphabet,\n c,\n caseChanged,\n e,\n i,\n isNum,\n len,\n str,\n x = this; // Enable constructor call without `new`.\n\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\n\n if (b == null) {\n if (v && v._isBigNumber === true) {\n x.s = v.s;\n\n if (!v.c || v.e > MAX_EXP) {\n x.c = x.e = null;\n } else if (v.e < MIN_EXP) {\n x.c = [x.e = 0];\n } else {\n x.e = v.e;\n x.c = v.c.slice();\n }\n\n return;\n }\n\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\n // Use `1 / n` to handle minus zero also.\n x.s = 1 / v < 0 ? (v = -v, -1) : 1; // Fast path for integers, where n < 2147483648 (2**31).\n\n if (v === ~~v) {\n for (e = 0, i = v; i >= 10; i /= 10, e++) {\n ;\n }\n\n if (e > MAX_EXP) {\n x.c = x.e = null;\n } else {\n x.e = e;\n x.c = [v];\n }\n\n return;\n }\n\n str = String(v);\n } else {\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\n } // Decimal point?\n\n\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); // Exponential form?\n\n if ((i = str.search(/e/i)) > 0) {\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n // Integer.\n e = str.length;\n }\n } else {\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n intCheck(b, 2, ALPHABET.length, 'Base'); // Allow exponential notation to be used with base 10 argument, while\n // also rounding to DECIMAL_PLACES as with other bases.\n\n if (b == 10) {\n x = new BigNumber(v);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n str = String(v);\n\n if (isNum = typeof v == 'number') {\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\n throw Error(tooManyDigits + v);\n }\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n alphabet = ALPHABET.slice(0, b);\n e = i = 0; // Check that str is a valid base b number.\n // Don't use RegExp, so alphabet can contain special characters.\n\n for (len = str.length; i < len; i++) {\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\n if (c == '.') {\n // If '.' is not the first character and it has not be found before.\n if (i > e) {\n e = len;\n continue;\n }\n } else if (!caseChanged) {\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\n if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {\n caseChanged = true;\n i = -1;\n e = 0;\n continue;\n }\n }\n\n return parseNumeric(x, String(v), isNum, b);\n }\n } // Prevent later check for length on converted number.\n\n\n isNum = false;\n str = convertBase(str, b, 10, x.s); // Decimal point?\n\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');else e = str.length;\n } // Determine leading zeros.\n\n\n for (i = 0; str.charCodeAt(i) === 48; i++) {\n ;\n } // Determine trailing zeros.\n\n\n for (len = str.length; str.charCodeAt(--len) === 48;) {\n ;\n }\n\n if (str = str.slice(i, ++len)) {\n len -= i; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n\n if (isNum && BigNumber.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\n throw Error(tooManyDigits + x.s * v);\n } // Overflow?\n\n\n if ((e = e - i - 1) > MAX_EXP) {\n // Infinity.\n x.c = x.e = null; // Underflow?\n } else if (e < MIN_EXP) {\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = []; // Transform base\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE; // i < 1\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n i = LOG_BASE - (str = str.slice(i)).length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0') {\n ;\n }\n\n x.c.push(+str);\n }\n } else {\n // Zero.\n x.c = [x.e = 0];\n }\n } // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.clone = clone;\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object with the following optional properties (if the value of a property is\n * a number, it must be an integer within the inclusive range stated):\n *\n * DECIMAL_PLACES {number} 0 to MAX\n * ROUNDING_MODE {number} 0 to 8\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\n * CRYPTO {boolean} true or false\n * MODULO_MODE {number} 0 to 9\n * POW_PRECISION {number} 0 to MAX\n * ALPHABET {string} A string of two or more unique characters which does\n * not contain '.'.\n * FORMAT {object} An object with some of the following properties:\n * prefix {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * groupSeparator {string}\n * decimalSeparator {string}\n * fractionGroupSize {number}\n * fractionGroupSeparator {string}\n * suffix {string}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\n *\n * Return an object with the properties current values.\n */\n\n BigNumber.config = BigNumber.set = function (obj) {\n var p, v;\n\n if (obj != null) {\n if (typeof obj == 'object') {\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n DECIMAL_PLACES = v;\n } // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\n v = obj[p];\n intCheck(v, 0, 8, p);\n ROUNDING_MODE = v;\n } // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\n v = obj[p];\n\n if (v && v.pop) {\n intCheck(v[0], -MAX, 0, p);\n intCheck(v[1], 0, MAX, p);\n TO_EXP_NEG = v[0];\n TO_EXP_POS = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\n }\n } // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'RANGE')) {\n v = obj[p];\n\n if (v && v.pop) {\n intCheck(v[0], -MAX, -1, p);\n intCheck(v[1], 1, MAX, p);\n MIN_EXP = v[0];\n MAX_EXP = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n\n if (v) {\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\n } else {\n throw Error(bignumberError + p + ' cannot be zero: ' + v);\n }\n }\n } // CRYPTO {boolean} true or false.\n // '[BigNumber Error] CRYPTO not true or false: {v}'\n // '[BigNumber Error] crypto unavailable'\n\n\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\n v = obj[p];\n\n if (v === !!v) {\n if (v) {\n if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = v;\n } else {\n CRYPTO = !v;\n throw Error(bignumberError + 'crypto unavailable');\n }\n } else {\n CRYPTO = v;\n }\n } else {\n throw Error(bignumberError + p + ' not true or false: ' + v);\n }\n } // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\n v = obj[p];\n intCheck(v, 0, 9, p);\n MODULO_MODE = v;\n } // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n POW_PRECISION = v;\n } // FORMAT {object}\n // '[BigNumber Error] FORMAT not an object: {v}'\n\n\n if (obj.hasOwnProperty(p = 'FORMAT')) {\n v = obj[p];\n if (typeof v == 'object') FORMAT = v;else throw Error(bignumberError + p + ' not an object: ' + v);\n } // ALPHABET {string}\n // '[BigNumber Error] ALPHABET invalid: {v}'\n\n\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\n v = obj[p]; // Disallow if less than two characters,\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\n\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\n ALPHABET = v;\n } else {\n throw Error(bignumberError + p + ' invalid: ' + v);\n }\n }\n } else {\n // '[BigNumber Error] Object expected: {v}'\n throw Error(bignumberError + 'Object expected: ' + obj);\n }\n }\n\n return {\n DECIMAL_PLACES: DECIMAL_PLACES,\n ROUNDING_MODE: ROUNDING_MODE,\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\n RANGE: [MIN_EXP, MAX_EXP],\n CRYPTO: CRYPTO,\n MODULO_MODE: MODULO_MODE,\n POW_PRECISION: POW_PRECISION,\n FORMAT: FORMAT,\n ALPHABET: ALPHABET\n };\n };\n /*\n * Return true if v is a BigNumber instance, otherwise return false.\n *\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\n *\n * v {any}\n *\n * '[BigNumber Error] Invalid BigNumber: {v}'\n */\n\n\n BigNumber.isBigNumber = function (v) {\n if (!v || v._isBigNumber !== true) return false;\n if (!BigNumber.DEBUG) return true;\n var i,\n n,\n c = v.c,\n e = v.e,\n s = v.s;\n\n out: if ({}.toString.call(c) == '[object Array]') {\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\n // If the first element is zero, the BigNumber value must be zero.\n if (c[0] === 0) {\n if (e === 0 && c.length === 1) return true;\n break out;\n } // Calculate number of digits that c[0] should have, based on the exponent.\n\n\n i = (e + 1) % LOG_BASE;\n if (i < 1) i += LOG_BASE; // Calculate number of digits of c[0].\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\n\n if (String(c[0]).length == i) {\n for (i = 0; i < c.length; i++) {\n n = c[i];\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\n } // Last element cannot be zero, unless it is the only element.\n\n\n if (n !== 0) return true;\n }\n } // Infinity/NaN\n\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\n return true;\n }\n\n throw Error(bignumberError + 'Invalid BigNumber: ' + v);\n };\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.maximum = BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.minimum = BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\n * '[BigNumber Error] crypto unavailable'\n */\n\n\n BigNumber.random = function () {\n var pow2_53 = 0x20000000000000; // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\n var random53bitInt = Math.random() * pow2_53 & 0x1fffff ? function () {\n return mathfloor(Math.random() * pow2_53);\n } : function () {\n return (Math.random() * 0x40000000 | 0) * 0x800000 + (Math.random() * 0x800000 | 0);\n };\n return function (dp) {\n var a,\n b,\n e,\n k,\n v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n if (dp == null) dp = DECIMAL_PLACES;else intCheck(dp, 0, MAX);\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11); // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n\n i = k / 2; // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = (a[i] & 31) * 0x1000000000000 + a[i + 1] * 0x10000000000 + a[i + 2] * 0x100000000 + a[i + 3] * 0x1000000 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n\n i = k / 7;\n } else {\n CRYPTO = false;\n throw Error(bignumberError + 'crypto unavailable');\n }\n } // Use Math.random.\n\n\n if (!CRYPTO) {\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE; // Convert trailing digits to zeros according to dp.\n\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n } // Remove trailing elements which are zero.\n\n\n for (; c[i] === 0; c.pop(), i--) {\n ;\n } // Zero?\n\n\n if (i < 0) {\n c = [e = 0];\n } else {\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) {\n ;\n } // Count the digits of the first element of c to determine leading zeros, and...\n\n\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++) {\n ;\n } // adjust the exponent accordingly.\n\n\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n }();\n /*\n * Return a BigNumber whose value is the sum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.sum = function () {\n var i = 1,\n args = arguments,\n sum = new BigNumber(args[0]);\n\n for (; i < args.length;) {\n sum = sum.plus(args[i++]);\n }\n\n return sum;\n }; // PRIVATE FUNCTIONS\n // Called by BigNumber and BigNumber.prototype.toString.\n\n\n convertBase = function () {\n var decimal = '0123456789';\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\n */\n\n function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) {\n ;\n }\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n } // Convert a numeric string of baseIn to a numeric string of baseOut.\n // If the caller is toString, we are converting from base 10 to baseOut.\n // If the caller is BigNumber, we are converting from baseIn to base 10.\n\n\n return function (str, baseIn, baseOut, sign, callerIsToString) {\n var alphabet,\n d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE; // Non-integer.\n\n if (i >= 0) {\n k = POW_PRECISION; // Unlimited precision.\n\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k; // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), 10, baseOut, decimal);\n y.e = y.c.length;\n } // Convert the number as integer.\n\n\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET)); // xc now represents str as an integer and converted to baseOut. e is the exponent.\n\n e = k = xc.length; // Remove trailing zeros.\n\n for (; xc[--k] == 0; xc.pop()) {\n ;\n } // Zero?\n\n\n if (!xc[0]) return alphabet.charAt(0); // Does str represent an integer? If so, no need for the division.\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e; // The sign is needed for correct rounding.\n\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n } // xc now represents str converted to baseOut.\n // THe index of the rounding digit.\n\n\n d = e + dp + 1; // The rounding digit: the digit to the right of the digit that may be rounded up.\n\n i = xc[d]; // Look at the rounding digits and mode to determine whether to round up.\n\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7)); // If the index of the rounding digit is not greater than zero, or xc represents\n // zero, then the result of the base conversion is zero or, if rounding up, a value\n // such as 0.00001.\n\n if (d < 1 || !xc[0]) {\n // 1^-dp or 0\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\n } else {\n // Truncate xc to the required number of decimal places.\n xc.length = d; // Round up?\n\n if (r) {\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n } // Determine trailing zeros.\n\n\n for (k = xc.length; !xc[--k];) {\n ;\n } // E.g. [4, 11, 15] becomes 4bf.\n\n\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])) {\n ;\n } // Add leading zeros, decimal point and trailing zeros as required.\n\n\n str = toFixedPoint(str, e, alphabet.charAt(0));\n } // The caller will add the sign.\n\n\n return str;\n };\n }(); // Perform division in the specified base. Called by div and convertBase.\n\n\n div = function () {\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m,\n temp,\n xlo,\n xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n for (i = cmp = 0; i < aL; i++) {\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0; // Subtract b from a.\n\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n } // Remove leading zeros.\n\n\n for (; !a[0] && a.length > 1; a.splice(0, 1)) {\n ;\n }\n } // x: dividend, y: divisor.\n\n\n return function (x, y, dp, rm, base) {\n var cmp,\n e,\n i,\n more,\n n,\n prod,\n prodL,\n q,\n qc,\n rem,\n remL,\n rem0,\n xi,\n xL,\n yc0,\n yL,\n yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c; // Either NaN, Infinity or 0?\n\n if (!xc || !xc[0] || !yc || !yc[0]) {\n return new BigNumber( // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0);\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n } // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\n\n for (i = 0; yc[i] == (xc[i] || 0); i++) {\n ;\n }\n\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2; // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1)); // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\n\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length; // Add zeros to make remainder as long as divisor.\n\n for (; remL < yL; rem[remL++] = 0) {\n ;\n }\n\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++; // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\n\n do {\n n = 0; // Compare divisor and remainder.\n\n cmp = compare(yc, rem, yL, remL); // If divisor < remainder.\n\n if (cmp < 0) {\n // Calculate trial digit, n.\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); // n is how many times the divisor goes into the current remainder.\n\n n = mathfloor(rem0 / yc0); // Algorithm:\n // product = divisor multiplied by trial digit (n).\n // Compare product and remainder.\n // If product is greater than remainder:\n // Subtract divisor from product, decrement trial digit.\n // Subtract product from remainder.\n // If product was less than remainder at the last compare:\n // Compare new remainder and divisor.\n // If remainder is greater than divisor:\n // Subtract divisor from remainder, increment trial digit.\n\n if (n > 1) {\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1; // product = divisor * trial digit.\n\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length; // Compare product and remainder.\n // If product > remainder then trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n\n while (compare(prod, rem, prodL, remL) == 1) {\n n--; // Subtract divisor from product.\n\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n } // product = divisor\n\n\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod = [0].concat(prod); // Subtract product from remainder.\n\n subtract(rem, prod, remL, base);\n remL = rem.length; // If product was < remainder.\n\n if (cmp == -1) {\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++; // Subtract divisor from remainder.\n\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n // Add the next digit, n, to the result array.\n\n\n qc[i++] = n; // Update the remainder.\n\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null; // Leading zero?\n\n if (!qc[0]) qc.splice(0, 1);\n }\n\n if (base == BASE) {\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) {\n ;\n }\n\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n }();\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n: a BigNumber.\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\n * rm: the rounding mode.\n * id: 1 (toExponential) or 2 (toPrecision).\n */\n\n\n function format(n, i, rm, id) {\n var c0, e, ne, len, str;\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n if (!n.c) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, '0');\n } else {\n n = round(new BigNumber(n), i, rm); // n.e may have changed if the value was rounded up.\n\n e = n.e;\n str = coeffToString(n.c);\n len = str.length; // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n // Exponential notation.\n\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\n // Append zeros?\n for (; len < i; str += '0', len++) {\n ;\n }\n\n str = toExponential(str, e); // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e, '0'); // Append zeros?\n\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0') {\n ;\n }\n } else {\n i += e - len;\n\n if (i > 0) {\n if (e + 1 == len) str += '.';\n\n for (; i--; str += '0') {\n ;\n }\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n } // Handle BigNumber.max and BigNumber.min.\n\n\n function maxOrMin(args, method) {\n var n,\n i = 1,\n m = new BigNumber(args[0]);\n\n for (; i < args.length; i++) {\n n = new BigNumber(args[i]); // If any number is NaN, return NaN.\n\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n\n\n function normalise(n, c, e) {\n var i = 1,\n j = c.length; // Remove trailing zeros.\n\n for (; !c[--j]; c.pop()) {\n ;\n } // Calculate the base 10 exponent. First get the number of digits of c[0].\n\n\n for (j = c[0]; j >= 10; j /= 10, i++) {\n ;\n } // Overflow?\n\n\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n // Infinity.\n n.c = n.e = null; // Underflow?\n } else if (e < MIN_EXP) {\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n } // Handle values that fail the validity test in BigNumber.\n\n\n parseNumeric = function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n return function (x, str, isNum, b) {\n var base,\n s = isNum ? str : str.replace(whitespaceOrPlus, ''); // No exception on ±Infinity or NaN.\n\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if (!isNum) {\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b; // E.g. '1.' to '1', '.1' to '0.1'\n\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n } // '[BigNumber Error] Not a number: {n}'\n // '[BigNumber Error] Not a base {b} number: {n}'\n\n\n if (BigNumber.DEBUG) {\n throw Error(bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\n } // NaN\n\n\n x.s = null;\n }\n\n x.c = x.e = null;\n };\n }();\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n\n\n function round(x, sd, rm, r) {\n var d,\n i,\n j,\n k,\n n,\n ni,\n rd,\n xc = x.c,\n pows10 = POWS_TEN; // if x is not Infinity or NaN...\n\n if (xc) {\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) {\n ;\n }\n\n i = sd - d; // If the rounding digit is in the first element of xc...\n\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0]; // Get the rounding digit at index j of n.\n\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n if (r) {\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0)) {\n ;\n }\n\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni]; // Get the number of digits of n.\n\n for (d = 1; k >= 10; k /= 10, d++) {\n ;\n } // Get the index of rd within n.\n\n\n i %= LOG_BASE; // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n\n j = i - LOG_BASE + d; // Get the rounding digit at index j of n.\n\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.\n (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n // Convert sd to decimal places.\n sd -= x.e + 1; // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\n x.e = -sd || 0;\n } else {\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n } // Remove excess digits.\n\n\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i]; // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n } // Round up?\n\n\n if (r) {\n for (;;) {\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) {\n ;\n }\n\n j = xc[0] += k;\n\n for (k = 1; j >= 10; j /= 10, k++) {\n ;\n } // if i != k the length has increased.\n\n\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n } // Remove trailing zeros.\n\n\n for (i = xc.length; xc[--i] === 0; xc.pop()) {\n ;\n }\n } // Overflow? Infinity.\n\n\n if (x.e > MAX_EXP) {\n x.c = x.e = null; // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n function valueOf(n) {\n var str,\n e = n.e;\n if (e === null) return n.toString();\n str = coeffToString(n.c);\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, '0');\n return n.s < 0 ? '-' + str : str;\n } // PROTOTYPE/INSTANCE METHODS\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n\n\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n\n\n P.comparedTo = function (y, b) {\n return compare(this, new BigNumber(y, b));\n };\n /*\n * If dp is undefined or null or true or false, return the number of decimal places of the\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n *\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.decimalPlaces = P.dp = function (dp, rm) {\n var c,\n n,\n v,\n x = this;\n\n if (dp != null) {\n intCheck(dp, 0, MAX);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(new BigNumber(x), dp + x.e + 1, rm);\n }\n\n if (!(c = x.c)) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; // Subtract the number of trailing zeros of the last number.\n\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) {\n ;\n }\n if (n < 0) n = 0;\n return n;\n };\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n\n\n P.dividedBy = P.div = function (y, b) {\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n\n\n P.dividedToIntegerBy = P.idiv = function (y, b) {\n return div(this, new BigNumber(y, b), 0, 1);\n };\n /*\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\n *\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\n *\n * n {number|string|BigNumber} The exponent. An integer.\n * [m] {number|string|BigNumber} The modulus.\n *\n * '[BigNumber Error] Exponent not an integer: {n}'\n */\n\n\n P.exponentiatedBy = P.pow = function (n, m) {\n var half,\n isModExp,\n i,\n k,\n more,\n nIsBig,\n nIsNeg,\n nIsOdd,\n y,\n x = this;\n n = new BigNumber(n); // Allow NaN and ±Infinity, but not other non-integers.\n\n if (n.c && !n.isInteger()) {\n throw Error(bignumberError + 'Exponent not an integer: ' + valueOf(n));\n }\n\n if (m != null) m = new BigNumber(m); // Exponent of MAX_SAFE_INTEGER is 15.\n\n nIsBig = n.e > 14; // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\n\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\n // The sign of the result of pow when x is negative depends on the evenness of n.\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\n return m ? y.mod(m) : y;\n }\n\n nIsNeg = n.s < 0;\n\n if (m) {\n // x % m returns NaN if abs(m) is zero, or m is NaN.\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\n if (isModExp) x = x.mod(m); // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 // [1, 240000000]\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 // [80000000000000] [99999750000000]\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\n // If x is negative and n is odd, k = -0, else k = 0.\n k = x.s < 0 && isOdd(n) ? -0 : 0; // If x >= 1, k = ±Infinity.\n\n if (x.e > -1) k = 1 / k; // If n is negative return ±0, else return ±Infinity.\n\n return new BigNumber(nIsNeg ? 1 / k : k);\n } else if (POW_PRECISION) {\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\n }\n\n if (nIsBig) {\n half = new BigNumber(0.5);\n if (nIsNeg) n.s = 1;\n nIsOdd = isOdd(n);\n } else {\n i = Math.abs(+valueOf(n));\n nIsOdd = i % 2;\n }\n\n y = new BigNumber(ONE); // Performs 54 loop iterations for n of 9007199254740991.\n\n for (;;) {\n if (nIsOdd) {\n y = y.times(x);\n if (!y.c) break;\n\n if (k) {\n if (y.c.length > k) y.c.length = k;\n } else if (isModExp) {\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (i) {\n i = mathfloor(i / 2);\n if (i === 0) break;\n nIsOdd = i % 2;\n } else {\n n = n.times(half);\n round(n, n.e + 1, 1);\n\n if (n.e > 14) {\n nIsOdd = isOdd(n);\n } else {\n i = +valueOf(n);\n if (i === 0) break;\n nIsOdd = i % 2;\n }\n }\n\n x = x.times(x);\n\n if (k) {\n if (x.c && x.c.length > k) x.c.length = k;\n } else if (isModExp) {\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (isModExp) return y;\n if (nIsNeg) y = ONE.div(y);\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\n */\n\n\n P.integerValue = function (rm) {\n var n = new BigNumber(this);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(n, n.e + 1, rm);\n };\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isEqualTo = P.eq = function (y, b) {\n return compare(this, new BigNumber(y, b)) === 0;\n };\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\n */\n\n\n P.isFinite = function () {\n return !!this.c;\n };\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isGreaterThan = P.gt = function (y, b) {\n return compare(this, new BigNumber(y, b)) > 0;\n };\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n\n\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n };\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n\n\n P.isInteger = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isLessThan = P.lt = function (y, b) {\n return compare(this, new BigNumber(y, b)) < 0;\n };\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n\n\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n /*\n * Return true if the value of this BigNumber is NaN, otherwise return false.\n */\n\n\n P.isNaN = function () {\n return !this.s;\n };\n /*\n * Return true if the value of this BigNumber is negative, otherwise return false.\n */\n\n\n P.isNegative = function () {\n return this.s < 0;\n };\n /*\n * Return true if the value of this BigNumber is positive, otherwise return false.\n */\n\n\n P.isPositive = function () {\n return this.s > 0;\n };\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\n */\n\n\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n\n\n P.minus = function (y, b) {\n var i,\n j,\n t,\n xLTy,\n x = this,\n a = x.s;\n y = new BigNumber(y, b);\n b = y.s; // Either NaN?\n\n if (!a || !b) return new BigNumber(NaN); // Signs differ?\n\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); // Either zero?\n\n if (!xc[0] || !yc[0]) {\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice(); // Determine which is the bigger number.\n\n if (a = xe - ye) {\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse(); // Prepend zeros to equalise exponents.\n\n for (b = a; b--; t.push(0)) {\n ;\n }\n\n t.reverse();\n } else {\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n } // x < y? Point xc to the array of the bigger number.\n\n\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n b = (j = yc.length) - (i = xc.length); // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\n if (b > 0) for (; b--; xc[i++] = 0) {\n ;\n }\n b = BASE - 1; // Subtract yc from xc.\n\n for (; j > a;) {\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b) {\n ;\n }\n\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n } // Remove leading zeros and adjust exponent accordingly.\n\n\n for (; xc[0] == 0; xc.splice(0, 1), --ye) {\n ;\n } // Zero?\n\n\n if (!xc[0]) {\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n } // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n\n\n return normalise(y, xc, ye);\n };\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n\n\n P.modulo = P.mod = function (y, b) {\n var q,\n s,\n x = this;\n y = new BigNumber(y, b); // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN); // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n y = x.minus(q.times(y)); // To match JavaScript %, ensure sign of zero is sign of dividend.\n\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\n return y;\n };\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\n * of BigNumber(y, b).\n */\n\n\n P.multipliedBy = P.times = function (y, b) {\n var c,\n e,\n i,\n j,\n k,\n m,\n xcL,\n xlo,\n xhi,\n ycL,\n ylo,\n yhi,\n zc,\n base,\n sqrtBase,\n x = this,\n xc = x.c,\n yc = (y = new BigNumber(y, b)).c; // Either NaN, ±Infinity or ±0?\n\n if (!xc || !yc || !xc[0] || !yc[0]) {\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s; // Return ±Infinity if either is ±Infinity.\n\n if (!xc || !yc) {\n y.c = y.e = null; // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length; // Ensure xc points to longer array and xcL to its length.\n\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; // Initialise the result array with zeros.\n\n for (i = xcL + ycL, zc = []; i--; zc.push(0)) {\n ;\n }\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise(y, zc, e);\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n\n\n P.negated = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n\n\n P.plus = function (y, b) {\n var t,\n x = this,\n a = x.s;\n y = new BigNumber(y, b);\n b = y.s; // Either NaN?\n\n if (!a || !b) return new BigNumber(NaN); // Signs differ?\n\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0); // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice(); // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n\n for (; a--; t.push(0)) {\n ;\n }\n\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length; // Point xc to the longer array, and b to the shorter length.\n\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a; // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n } // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n\n\n return normalise(y, xc, ye);\n };\n /*\n * If sd is undefined or null or true or false, return the number of significant digits of\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n * If sd is true include integer-part trailing zeros in the count.\n *\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\n * boolean: whether to count integer-part trailing zeros: true or false.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n\n\n P.precision = P.sd = function (sd, rm) {\n var c,\n n,\n v,\n x = this;\n\n if (sd != null && sd !== !!sd) {\n intCheck(sd, 1, MAX);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(new BigNumber(x), sd, rm);\n }\n\n if (!(c = x.c)) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--) {\n ;\n } // Add the number of digits of the first element.\n\n\n for (v = c[0]; v >= 10; v /= 10, n++) {\n ;\n }\n }\n\n if (sd && x.e + 1 > n) n = x.e + 1;\n return n;\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\n */\n\n\n P.shiftedBy = function (k) {\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n return this.times('1e' + k);\n };\n /*\n * sqrt(-n) = N\n * sqrt(N) = N\n * sqrt(-I) = N\n * sqrt(I) = I\n * sqrt(0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n\n\n P.squareRoot = P.sqrt = function () {\n var m,\n n,\n r,\n rep,\n t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5'); // Negative/NaN/Infinity/zero?\n\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n } // Initial estimate.\n\n\n s = Math.sqrt(+valueOf(x)); // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(+n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '5e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n } // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n\n\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0; // Newton-Raphson iteration.\n\n for (;;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e) --s;\n n = n.slice(s - 3, s + 1); // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n\n if (n == '9999' || !rep && n == '4999') {\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.toExponential = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp++;\n }\n\n return format(this, dp, rm, 1);\n };\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.toFixed = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp = dp + this.e + 1;\n }\n\n return format(this, dp, rm);\n };\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the format or FORMAT object (see BigNumber.set).\n *\n * The formatting object may contain some or all of the properties shown below.\n *\n * FORMAT = {\n * prefix: '',\n * groupSize: 3,\n * secondaryGroupSize: 0,\n * groupSeparator: ',',\n * decimalSeparator: '.',\n * fractionGroupSize: 0,\n * fractionGroupSeparator: '\\xA0', // non-breaking space\n * suffix: ''\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n * [format] {object} Formatting options. See FORMAT pbject above.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n * '[BigNumber Error] Argument not an object: {format}'\n */\n\n\n P.toFormat = function (dp, rm, format) {\n var str,\n x = this;\n\n if (format == null) {\n if (dp != null && rm && typeof rm == 'object') {\n format = rm;\n rm = null;\n } else if (dp && typeof dp == 'object') {\n format = dp;\n dp = rm = null;\n } else {\n format = FORMAT;\n }\n } else if (typeof format != 'object') {\n throw Error(bignumberError + 'Argument not an object: ' + format);\n }\n\n str = x.toFixed(dp, rm);\n\n if (x.c) {\n var i,\n arr = str.split('.'),\n g1 = +format.groupSize,\n g2 = +format.secondaryGroupSize,\n groupSeparator = format.groupSeparator || '',\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = x.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n\n for (; i < len; i += g1) {\n intPart += groupSeparator + intDigits.substr(i, g1);\n }\n\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'), '$&' + (format.fractionGroupSeparator || '')) : fractionPart) : intPart;\n }\n\n return (format.prefix || '') + str + (format.suffix || '');\n };\n /*\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\n * fraction with an integer numerator and an integer denominator.\n * The denominator will be a positive non-zero value less than or equal to the specified\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\n * the lowest value necessary to represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\n *\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\n */\n\n\n P.toFraction = function (md) {\n var d,\n d0,\n d1,\n d2,\n e,\n exp,\n n,\n n0,\n n1,\n q,\n r,\n s,\n x = this,\n xc = x.c;\n\n if (md != null) {\n n = new BigNumber(md); // Throw if md is less than one or is not an integer, unless it is Infinity.\n\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\n throw Error(bignumberError + 'Argument ' + (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\n }\n }\n\n if (!xc) return new BigNumber(x);\n d = new BigNumber(ONE);\n n1 = d0 = new BigNumber(ONE);\n d1 = n0 = new BigNumber(ONE);\n s = coeffToString(xc); // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s); // n0 = d1 = 0\n\n n0.c[0] = 0;\n\n for (;;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.comparedTo(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e = e * 2; // Determine which fraction is closer to x, n0/d0 or n1/d1\n\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\n MAX_EXP = exp;\n return r;\n };\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n\n\n P.toNumber = function () {\n return +valueOf(this);\n };\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n\n\n P.toPrecision = function (sd, rm) {\n if (sd != null) intCheck(sd, 1, MAX);\n return format(this, sd, rm, 2);\n };\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\n *\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n */\n\n\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e; // Infinity or NaN?\n\n if (e === null) {\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n if (b == null) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, '0');\n } else if (b === 10) {\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\n } else {\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n\n\n P.valueOf = P.toJSON = function () {\n return valueOf(this);\n };\n\n P._isBigNumber = true;\n if (configObject != null) BigNumber.set(configObject);\n return BigNumber;\n } // PRIVATE HELPER FUNCTIONS", "function formDecimalString(scale, sign, hi32, lo64high, lo64low){\n var dec = bn.dec(bn.add(bn.add(bn.shl(bn.n2a(hi32), 8), bn.shl(bn.n2a(lo64high), 4)), bn.n2a(lo64low)));\n if(scale > 0) {\n if (scale < dec.length) {\n dec = dec.slice(0, dec.length - scale) + '.' + dec.slice(-scale);\n } else if (scale > dec.length) {\n dec = \"0.\" + new Array(scale - dec.length + 1).join(\"0\") + dec;\n } else /* scale == dec.length */\n dec = \"0.\" + dec;\n }\n if(sign == 0x80)\n dec = '-' + dec;\n return dec;\n}", "getValue() {\n let value = super.getValue()\n\n if (value) {\n value = parseFloat(value)\n value = value.toFixed(2)\n }\n\n return parseFloat(value)\n }", "money( num, fixed ) {\n num = parseFloat( num ) || 0;\n fixed = parseInt( fixed ) || 0;\n let o = { style: 'decimal', minimumFractionDigits: fixed, maximumFractionDigits: fixed };\n return new Intl.NumberFormat( 'en-US', o ).format( num );\n }", "function analyzeDecimal() {\n for (var i = 0; i < results.length; i++) {\n if (Math.floor(results[i]) !== results[i]) {\n if (results[i].toString().split(\".\")[1].length > 3) {\n results[i] = parseFloat(results[i].toFixed(3));\n }\n }\n }\n}", "function clone(configObject) {\n var div,\n convertBase,\n parseNumeric,\n P = BigNumber.prototype = {\n constructor: BigNumber,\n toString: null,\n valueOf: null\n },\n ONE = new BigNumber(1),\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\n // The default values below must be integers within the inclusive ranges stated.\n // The values can also be changed at run-time using BigNumber.set.\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20,\n // 0 to MAX\n // The rounding mode used when rounding to the above decimal places, and when using\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\n // UP 0 Away from zero.\n // DOWN 1 Towards zero.\n // CEIL 2 Towards +Infinity.\n // FLOOR 3 Towards -Infinity.\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n ROUNDING_MODE = 4,\n // 0 to 8\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7,\n // 0 to -MAX\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21,\n // 0 to MAX\n // RANGE : [MIN_EXP, MAX_EXP]\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7,\n // -1 to -MAX\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7,\n // 1 to MAX\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false,\n // true or false\n // The modulo mode used when calculating the modulus: a mod n.\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n // The remainder (r) is calculated as: r = a - n * q.\n //\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\n // DOWN 1 The remainder has the same sign as the dividend.\n // This modulo mode is commonly known as 'truncated division' and is\n // equivalent to (a % n) in JavaScript.\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n // The remainder is always positive.\n //\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\n // modes are commonly used for the modulus operation.\n // Although the other rounding modes can also be used, they may not give useful results.\n MODULO_MODE = 1,\n // 0 to 9\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0,\n // 0 to MAX\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n prefix: '',\n groupSize: 3,\n secondaryGroupSize: 0,\n groupSeparator: ',',\n decimalSeparator: '.',\n fractionGroupSize: 0,\n fractionGroupSeparator: '\\xA0',\n // non-breaking space\n suffix: ''\n },\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\n // '-', '.', whitespace, or repeated character.\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'; //------------------------------------------------------------------------------------------\n // CONSTRUCTOR\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * v {number|string|BigNumber} A numeric value.\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\n */\n\n function BigNumber(v, b) {\n var alphabet,\n c,\n caseChanged,\n e,\n i,\n isNum,\n len,\n str,\n x = this; // Enable constructor call without `new`.\n\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\n\n if (b == null) {\n if (v && v._isBigNumber === true) {\n x.s = v.s;\n\n if (!v.c || v.e > MAX_EXP) {\n x.c = x.e = null;\n } else if (v.e < MIN_EXP) {\n x.c = [x.e = 0];\n } else {\n x.e = v.e;\n x.c = v.c.slice();\n }\n\n return;\n }\n\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\n // Use `1 / n` to handle minus zero also.\n x.s = 1 / v < 0 ? (v = -v, -1) : 1; // Fast path for integers, where n < 2147483648 (2**31).\n\n if (v === ~~v) {\n for (e = 0, i = v; i >= 10; i /= 10, e++);\n\n if (e > MAX_EXP) {\n x.c = x.e = null;\n } else {\n x.e = e;\n x.c = [v];\n }\n\n return;\n }\n\n str = String(v);\n } else {\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\n } // Decimal point?\n\n\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); // Exponential form?\n\n if ((i = str.search(/e/i)) > 0) {\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n // Integer.\n e = str.length;\n }\n } else {\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n intCheck(b, 2, ALPHABET.length, 'Base'); // Allow exponential notation to be used with base 10 argument, while\n // also rounding to DECIMAL_PLACES as with other bases.\n\n if (b == 10) {\n x = new BigNumber(v);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n str = String(v);\n\n if (isNum = typeof v == 'number') {\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\n throw Error(tooManyDigits + v);\n }\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n alphabet = ALPHABET.slice(0, b);\n e = i = 0; // Check that str is a valid base b number.\n // Don't use RegExp, so alphabet can contain special characters.\n\n for (len = str.length; i < len; i++) {\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\n if (c == '.') {\n // If '.' is not the first character and it has not be found before.\n if (i > e) {\n e = len;\n continue;\n }\n } else if (!caseChanged) {\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\n if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {\n caseChanged = true;\n i = -1;\n e = 0;\n continue;\n }\n }\n\n return parseNumeric(x, String(v), isNum, b);\n }\n } // Prevent later check for length on converted number.\n\n\n isNum = false;\n str = convertBase(str, b, 10, x.s); // Decimal point?\n\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');else e = str.length;\n } // Determine leading zeros.\n\n\n for (i = 0; str.charCodeAt(i) === 48; i++); // Determine trailing zeros.\n\n\n for (len = str.length; str.charCodeAt(--len) === 48;);\n\n if (str = str.slice(i, ++len)) {\n len -= i; // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n\n if (isNum && BigNumber.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\n throw Error(tooManyDigits + x.s * v);\n } // Overflow?\n\n\n if ((e = e - i - 1) > MAX_EXP) {\n // Infinity.\n x.c = x.e = null; // Underflow?\n } else if (e < MIN_EXP) {\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = []; // Transform base\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE; // i < 1\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n i = LOG_BASE - (str = str.slice(i)).length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0');\n\n x.c.push(+str);\n }\n } else {\n // Zero.\n x.c = [x.e = 0];\n }\n } // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.clone = clone;\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object with the following optional properties (if the value of a property is\n * a number, it must be an integer within the inclusive range stated):\n *\n * DECIMAL_PLACES {number} 0 to MAX\n * ROUNDING_MODE {number} 0 to 8\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\n * CRYPTO {boolean} true or false\n * MODULO_MODE {number} 0 to 9\n * POW_PRECISION {number} 0 to MAX\n * ALPHABET {string} A string of two or more unique characters which does\n * not contain '.'.\n * FORMAT {object} An object with some of the following properties:\n * prefix {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * groupSeparator {string}\n * decimalSeparator {string}\n * fractionGroupSize {number}\n * fractionGroupSeparator {string}\n * suffix {string}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\n *\n * Return an object with the properties current values.\n */\n\n BigNumber.config = BigNumber.set = function (obj) {\n var p, v;\n\n if (obj != null) {\n if (typeof obj == 'object') {\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n DECIMAL_PLACES = v;\n } // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\n v = obj[p];\n intCheck(v, 0, 8, p);\n ROUNDING_MODE = v;\n } // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\n v = obj[p];\n\n if (v && v.pop) {\n intCheck(v[0], -MAX, 0, p);\n intCheck(v[1], 0, MAX, p);\n TO_EXP_NEG = v[0];\n TO_EXP_POS = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\n }\n } // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'RANGE')) {\n v = obj[p];\n\n if (v && v.pop) {\n intCheck(v[0], -MAX, -1, p);\n intCheck(v[1], 1, MAX, p);\n MIN_EXP = v[0];\n MAX_EXP = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n\n if (v) {\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\n } else {\n throw Error(bignumberError + p + ' cannot be zero: ' + v);\n }\n }\n } // CRYPTO {boolean} true or false.\n // '[BigNumber Error] CRYPTO not true or false: {v}'\n // '[BigNumber Error] crypto unavailable'\n\n\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\n v = obj[p];\n\n if (v === !!v) {\n if (v) {\n if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = v;\n } else {\n CRYPTO = !v;\n throw Error(bignumberError + 'crypto unavailable');\n }\n } else {\n CRYPTO = v;\n }\n } else {\n throw Error(bignumberError + p + ' not true or false: ' + v);\n }\n } // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\n v = obj[p];\n intCheck(v, 0, 9, p);\n MODULO_MODE = v;\n } // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\n\n\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n POW_PRECISION = v;\n } // FORMAT {object}\n // '[BigNumber Error] FORMAT not an object: {v}'\n\n\n if (obj.hasOwnProperty(p = 'FORMAT')) {\n v = obj[p];\n if (typeof v == 'object') FORMAT = v;else throw Error(bignumberError + p + ' not an object: ' + v);\n } // ALPHABET {string}\n // '[BigNumber Error] ALPHABET invalid: {v}'\n\n\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\n v = obj[p]; // Disallow if only one character,\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\n\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\n ALPHABET = v;\n } else {\n throw Error(bignumberError + p + ' invalid: ' + v);\n }\n }\n } else {\n // '[BigNumber Error] Object expected: {v}'\n throw Error(bignumberError + 'Object expected: ' + obj);\n }\n }\n\n return {\n DECIMAL_PLACES: DECIMAL_PLACES,\n ROUNDING_MODE: ROUNDING_MODE,\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\n RANGE: [MIN_EXP, MAX_EXP],\n CRYPTO: CRYPTO,\n MODULO_MODE: MODULO_MODE,\n POW_PRECISION: POW_PRECISION,\n FORMAT: FORMAT,\n ALPHABET: ALPHABET\n };\n };\n /*\n * Return true if v is a BigNumber instance, otherwise return false.\n *\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\n *\n * v {any}\n *\n * '[BigNumber Error] Invalid BigNumber: {v}'\n */\n\n\n BigNumber.isBigNumber = function (v) {\n if (!v || v._isBigNumber !== true) return false;\n if (!BigNumber.DEBUG) return true;\n var i,\n n,\n c = v.c,\n e = v.e,\n s = v.s;\n\n out: if ({}.toString.call(c) == '[object Array]') {\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\n // If the first element is zero, the BigNumber value must be zero.\n if (c[0] === 0) {\n if (e === 0 && c.length === 1) return true;\n break out;\n } // Calculate number of digits that c[0] should have, based on the exponent.\n\n\n i = (e + 1) % LOG_BASE;\n if (i < 1) i += LOG_BASE; // Calculate number of digits of c[0].\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\n\n if (String(c[0]).length == i) {\n for (i = 0; i < c.length; i++) {\n n = c[i];\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\n } // Last element cannot be zero, unless it is the only element.\n\n\n if (n !== 0) return true;\n }\n } // Infinity/NaN\n\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\n return true;\n }\n\n throw Error(bignumberError + 'Invalid BigNumber: ' + v);\n };\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.maximum = BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.minimum = BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\n * '[BigNumber Error] crypto unavailable'\n */\n\n\n BigNumber.random = function () {\n var pow2_53 = 0x20000000000000; // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n\n var random53bitInt = Math.random() * pow2_53 & 0x1fffff ? function () {\n return mathfloor(Math.random() * pow2_53);\n } : function () {\n return (Math.random() * 0x40000000 | 0) * 0x800000 + (Math.random() * 0x800000 | 0);\n };\n return function (dp) {\n var a,\n b,\n e,\n k,\n v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n if (dp == null) dp = DECIMAL_PLACES;else intCheck(dp, 0, MAX);\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11); // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n\n i = k / 2; // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = (a[i] & 31) * 0x1000000000000 + a[i + 1] * 0x10000000000 + a[i + 2] * 0x100000000 + a[i + 3] * 0x1000000 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n\n i = k / 7;\n } else {\n CRYPTO = false;\n throw Error(bignumberError + 'crypto unavailable');\n }\n } // Use Math.random.\n\n\n if (!CRYPTO) {\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE; // Convert trailing digits to zeros according to dp.\n\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n } // Remove trailing elements which are zero.\n\n\n for (; c[i] === 0; c.pop(), i--); // Zero?\n\n\n if (i < 0) {\n c = [e = 0];\n } else {\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE); // Count the digits of the first element of c to determine leading zeros, and...\n\n\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++); // adjust the exponent accordingly.\n\n\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n }();\n /*\n * Return a BigNumber whose value is the sum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n\n\n BigNumber.sum = function () {\n var i = 1,\n args = arguments,\n sum = new BigNumber(args[0]);\n\n for (; i < args.length;) sum = sum.plus(args[i++]);\n\n return sum;\n }; // PRIVATE FUNCTIONS\n // Called by BigNumber and BigNumber.prototype.toString.\n\n\n convertBase = function () {\n var decimal = '0123456789';\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\n */\n\n function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n } // Convert a numeric string of baseIn to a numeric string of baseOut.\n // If the caller is toString, we are converting from base 10 to baseOut.\n // If the caller is BigNumber, we are converting from baseIn to base 10.\n\n\n return function (str, baseIn, baseOut, sign, callerIsToString) {\n var alphabet,\n d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE; // Non-integer.\n\n if (i >= 0) {\n k = POW_PRECISION; // Unlimited precision.\n\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k; // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'), 10, baseOut, decimal);\n y.e = y.c.length;\n } // Convert the number as integer.\n\n\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET)); // xc now represents str as an integer and converted to baseOut. e is the exponent.\n\n e = k = xc.length; // Remove trailing zeros.\n\n for (; xc[--k] == 0; xc.pop()); // Zero?\n\n\n if (!xc[0]) return alphabet.charAt(0); // Does str represent an integer? If so, no need for the division.\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e; // The sign is needed for correct rounding.\n\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n } // xc now represents str converted to baseOut.\n // THe index of the rounding digit.\n\n\n d = e + dp + 1; // The rounding digit: the digit to the right of the digit that may be rounded up.\n\n i = xc[d]; // Look at the rounding digits and mode to determine whether to round up.\n\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7)); // If the index of the rounding digit is not greater than zero, or xc represents\n // zero, then the result of the base conversion is zero or, if rounding up, a value\n // such as 0.00001.\n\n if (d < 1 || !xc[0]) {\n // 1^-dp or 0\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\n } else {\n // Truncate xc to the required number of decimal places.\n xc.length = d; // Round up?\n\n if (r) {\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n } // Determine trailing zeros.\n\n\n for (k = xc.length; !xc[--k];); // E.g. [4, 11, 15] becomes 4bf.\n\n\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++])); // Add leading zeros, decimal point and trailing zeros as required.\n\n\n str = toFixedPoint(str, e, alphabet.charAt(0));\n } // The caller will add the sign.\n\n\n return str;\n };\n }(); // Perform division in the specified base. Called by div and convertBase.\n\n\n div = function () {\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m,\n temp,\n xlo,\n xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n for (i = cmp = 0; i < aL; i++) {\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0; // Subtract b from a.\n\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n } // Remove leading zeros.\n\n\n for (; !a[0] && a.length > 1; a.splice(0, 1));\n } // x: dividend, y: divisor.\n\n\n return function (x, y, dp, rm, base) {\n var cmp,\n e,\n i,\n more,\n n,\n prod,\n prodL,\n q,\n qc,\n rem,\n remL,\n rem0,\n xi,\n xL,\n yc0,\n yL,\n yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c; // Either NaN, Infinity or 0?\n\n if (!xc || !xc[0] || !yc || !yc[0]) {\n return new BigNumber( // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0);\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n } // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n\n\n for (i = 0; yc[i] == (xc[i] || 0); i++);\n\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2; // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1)); // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\n\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length; // Add zeros to make remainder as long as divisor.\n\n for (; remL < yL; rem[remL++] = 0);\n\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++; // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\n\n do {\n n = 0; // Compare divisor and remainder.\n\n cmp = compare(yc, rem, yL, remL); // If divisor < remainder.\n\n if (cmp < 0) {\n // Calculate trial digit, n.\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); // n is how many times the divisor goes into the current remainder.\n\n n = mathfloor(rem0 / yc0); // Algorithm:\n // product = divisor multiplied by trial digit (n).\n // Compare product and remainder.\n // If product is greater than remainder:\n // Subtract divisor from product, decrement trial digit.\n // Subtract product from remainder.\n // If product was less than remainder at the last compare:\n // Compare new remainder and divisor.\n // If remainder is greater than divisor:\n // Subtract divisor from remainder, increment trial digit.\n\n if (n > 1) {\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1; // product = divisor * trial digit.\n\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length; // Compare product and remainder.\n // If product > remainder then trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n\n while (compare(prod, rem, prodL, remL) == 1) {\n n--; // Subtract divisor from product.\n\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n } // product = divisor\n\n\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod = [0].concat(prod); // Subtract product from remainder.\n\n subtract(rem, prod, remL, base);\n remL = rem.length; // If product was < remainder.\n\n if (cmp == -1) {\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++; // Subtract divisor from remainder.\n\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n // Add the next digit, n, to the result array.\n\n\n qc[i++] = n; // Update the remainder.\n\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null; // Leading zero?\n\n if (!qc[0]) qc.splice(0, 1);\n }\n\n if (base == BASE) {\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\n\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more); // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n }();\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n: a BigNumber.\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\n * rm: the rounding mode.\n * id: 1 (toExponential) or 2 (toPrecision).\n */\n\n\n function format(n, i, rm, id) {\n var c0, e, ne, len, str;\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n if (!n.c) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, '0');\n } else {\n n = round(new BigNumber(n), i, rm); // n.e may have changed if the value was rounded up.\n\n e = n.e;\n str = coeffToString(n.c);\n len = str.length; // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n // Exponential notation.\n\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\n // Append zeros?\n for (; len < i; str += '0', len++);\n\n str = toExponential(str, e); // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e, '0'); // Append zeros?\n\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0');\n } else {\n i += e - len;\n\n if (i > 0) {\n if (e + 1 == len) str += '.';\n\n for (; i--; str += '0');\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n } // Handle BigNumber.max and BigNumber.min.\n\n\n function maxOrMin(args, method) {\n var n,\n i = 1,\n m = new BigNumber(args[0]);\n\n for (; i < args.length; i++) {\n n = new BigNumber(args[i]); // If any number is NaN, return NaN.\n\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n\n\n function normalise(n, c, e) {\n var i = 1,\n j = c.length; // Remove trailing zeros.\n\n for (; !c[--j]; c.pop()); // Calculate the base 10 exponent. First get the number of digits of c[0].\n\n\n for (j = c[0]; j >= 10; j /= 10, i++); // Overflow?\n\n\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n // Infinity.\n n.c = n.e = null; // Underflow?\n } else if (e < MIN_EXP) {\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n } // Handle values that fail the validity test in BigNumber.\n\n\n parseNumeric = function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n return function (x, str, isNum, b) {\n var base,\n s = isNum ? str : str.replace(whitespaceOrPlus, ''); // No exception on ±Infinity or NaN.\n\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if (!isNum) {\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b; // E.g. '1.' to '1', '.1' to '0.1'\n\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n } // '[BigNumber Error] Not a number: {n}'\n // '[BigNumber Error] Not a base {b} number: {n}'\n\n\n if (BigNumber.DEBUG) {\n throw Error(bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\n } // NaN\n\n\n x.s = null;\n }\n\n x.c = x.e = null;\n };\n }();\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n\n\n function round(x, sd, rm, r) {\n var d,\n i,\n j,\n k,\n n,\n ni,\n rd,\n xc = x.c,\n pows10 = POWS_TEN; // if x is not Infinity or NaN...\n\n if (xc) {\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\n\n i = sd - d; // If the rounding digit is in the first element of xc...\n\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0]; // Get the rounding digit at index j of n.\n\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n if (r) {\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0));\n\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni]; // Get the number of digits of n.\n\n for (d = 1; k >= 10; k /= 10, d++); // Get the index of rd within n.\n\n\n i %= LOG_BASE; // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n\n j = i - LOG_BASE + d; // Get the rounding digit at index j of n.\n\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.\n (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n // Convert sd to decimal places.\n sd -= x.e + 1; // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\n x.e = -sd || 0;\n } else {\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n } // Remove excess digits.\n\n\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i]; // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n } // Round up?\n\n\n if (r) {\n for (;;) {\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\n\n j = xc[0] += k;\n\n for (k = 1; j >= 10; j /= 10, k++); // if i != k the length has increased.\n\n\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n } // Remove trailing zeros.\n\n\n for (i = xc.length; xc[--i] === 0; xc.pop());\n } // Overflow? Infinity.\n\n\n if (x.e > MAX_EXP) {\n x.c = x.e = null; // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n function valueOf(n) {\n var str,\n e = n.e;\n if (e === null) return n.toString();\n str = coeffToString(n.c);\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, '0');\n return n.s < 0 ? '-' + str : str;\n } // PROTOTYPE/INSTANCE METHODS\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n\n\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n\n\n P.comparedTo = function (y, b) {\n return compare(this, new BigNumber(y, b));\n };\n /*\n * If dp is undefined or null or true or false, return the number of decimal places of the\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n *\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.decimalPlaces = P.dp = function (dp, rm) {\n var c,\n n,\n v,\n x = this;\n\n if (dp != null) {\n intCheck(dp, 0, MAX);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(new BigNumber(x), dp + x.e + 1, rm);\n }\n\n if (!(c = x.c)) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE; // Subtract the number of trailing zeros of the last number.\n\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\n if (n < 0) n = 0;\n return n;\n };\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n\n\n P.dividedBy = P.div = function (y, b) {\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n\n\n P.dividedToIntegerBy = P.idiv = function (y, b) {\n return div(this, new BigNumber(y, b), 0, 1);\n };\n /*\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\n *\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\n *\n * n {number|string|BigNumber} The exponent. An integer.\n * [m] {number|string|BigNumber} The modulus.\n *\n * '[BigNumber Error] Exponent not an integer: {n}'\n */\n\n\n P.exponentiatedBy = P.pow = function (n, m) {\n var half,\n isModExp,\n i,\n k,\n more,\n nIsBig,\n nIsNeg,\n nIsOdd,\n y,\n x = this;\n n = new BigNumber(n); // Allow NaN and ±Infinity, but not other non-integers.\n\n if (n.c && !n.isInteger()) {\n throw Error(bignumberError + 'Exponent not an integer: ' + valueOf(n));\n }\n\n if (m != null) m = new BigNumber(m); // Exponent of MAX_SAFE_INTEGER is 15.\n\n nIsBig = n.e > 14; // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\n\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\n // The sign of the result of pow when x is negative depends on the evenness of n.\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\n return m ? y.mod(m) : y;\n }\n\n nIsNeg = n.s < 0;\n\n if (m) {\n // x % m returns NaN if abs(m) is zero, or m is NaN.\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\n if (isModExp) x = x.mod(m); // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 // [1, 240000000]\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 // [80000000000000] [99999750000000]\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\n // If x is negative and n is odd, k = -0, else k = 0.\n k = x.s < 0 && isOdd(n) ? -0 : 0; // If x >= 1, k = ±Infinity.\n\n if (x.e > -1) k = 1 / k; // If n is negative return ±0, else return ±Infinity.\n\n return new BigNumber(nIsNeg ? 1 / k : k);\n } else if (POW_PRECISION) {\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\n }\n\n if (nIsBig) {\n half = new BigNumber(0.5);\n if (nIsNeg) n.s = 1;\n nIsOdd = isOdd(n);\n } else {\n i = Math.abs(+valueOf(n));\n nIsOdd = i % 2;\n }\n\n y = new BigNumber(ONE); // Performs 54 loop iterations for n of 9007199254740991.\n\n for (;;) {\n if (nIsOdd) {\n y = y.times(x);\n if (!y.c) break;\n\n if (k) {\n if (y.c.length > k) y.c.length = k;\n } else if (isModExp) {\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (i) {\n i = mathfloor(i / 2);\n if (i === 0) break;\n nIsOdd = i % 2;\n } else {\n n = n.times(half);\n round(n, n.e + 1, 1);\n\n if (n.e > 14) {\n nIsOdd = isOdd(n);\n } else {\n i = +valueOf(n);\n if (i === 0) break;\n nIsOdd = i % 2;\n }\n }\n\n x = x.times(x);\n\n if (k) {\n if (x.c && x.c.length > k) x.c.length = k;\n } else if (isModExp) {\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (isModExp) return y;\n if (nIsNeg) y = ONE.div(y);\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\n */\n\n\n P.integerValue = function (rm) {\n var n = new BigNumber(this);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(n, n.e + 1, rm);\n };\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isEqualTo = P.eq = function (y, b) {\n return compare(this, new BigNumber(y, b)) === 0;\n };\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\n */\n\n\n P.isFinite = function () {\n return !!this.c;\n };\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isGreaterThan = P.gt = function (y, b) {\n return compare(this, new BigNumber(y, b)) > 0;\n };\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n\n\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n };\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n\n\n P.isInteger = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise return false.\n */\n\n\n P.isLessThan = P.lt = function (y, b) {\n return compare(this, new BigNumber(y, b)) < 0;\n };\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n\n\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n /*\n * Return true if the value of this BigNumber is NaN, otherwise return false.\n */\n\n\n P.isNaN = function () {\n return !this.s;\n };\n /*\n * Return true if the value of this BigNumber is negative, otherwise return false.\n */\n\n\n P.isNegative = function () {\n return this.s < 0;\n };\n /*\n * Return true if the value of this BigNumber is positive, otherwise return false.\n */\n\n\n P.isPositive = function () {\n return this.s > 0;\n };\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\n */\n\n\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n\n\n P.minus = function (y, b) {\n var i,\n j,\n t,\n xLTy,\n x = this,\n a = x.s;\n y = new BigNumber(y, b);\n b = y.s; // Either NaN?\n\n if (!a || !b) return new BigNumber(NaN); // Signs differ?\n\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN); // Either zero?\n\n if (!xc[0] || !yc[0]) {\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x : // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice(); // Determine which is the bigger number.\n\n if (a = xe - ye) {\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse(); // Prepend zeros to equalise exponents.\n\n for (b = a; b--; t.push(0));\n\n t.reverse();\n } else {\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n } // x < y? Point xc to the array of the bigger number.\n\n\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n b = (j = yc.length) - (i = xc.length); // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n\n if (b > 0) for (; b--; xc[i++] = 0);\n b = BASE - 1; // Subtract yc from xc.\n\n for (; j > a;) {\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b);\n\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n } // Remove leading zeros and adjust exponent accordingly.\n\n\n for (; xc[0] == 0; xc.splice(0, 1), --ye); // Zero?\n\n\n if (!xc[0]) {\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n } // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n\n\n return normalise(y, xc, ye);\n };\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n\n\n P.modulo = P.mod = function (y, b) {\n var q,\n s,\n x = this;\n y = new BigNumber(y, b); // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN); // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n y = x.minus(q.times(y)); // To match JavaScript %, ensure sign of zero is sign of dividend.\n\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\n return y;\n };\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\n * of BigNumber(y, b).\n */\n\n\n P.multipliedBy = P.times = function (y, b) {\n var c,\n e,\n i,\n j,\n k,\n m,\n xcL,\n xlo,\n xhi,\n ycL,\n ylo,\n yhi,\n zc,\n base,\n sqrtBase,\n x = this,\n xc = x.c,\n yc = (y = new BigNumber(y, b)).c; // Either NaN, ±Infinity or ±0?\n\n if (!xc || !yc || !xc[0] || !yc[0]) {\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s; // Return ±Infinity if either is ±Infinity.\n\n if (!xc || !yc) {\n y.c = y.e = null; // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length; // Ensure xc points to longer array and xcL to its length.\n\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i; // Initialise the result array with zeros.\n\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise(y, zc, e);\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n\n\n P.negated = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n\n\n P.plus = function (y, b) {\n var t,\n x = this,\n a = x.s;\n y = new BigNumber(y, b);\n b = y.s; // Either NaN?\n\n if (!a || !b) return new BigNumber(NaN); // Signs differ?\n\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0); // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice(); // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n\n for (; a--; t.push(0));\n\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length; // Point xc to the longer array, and b to the shorter length.\n\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a; // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n } // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n\n\n return normalise(y, xc, ye);\n };\n /*\n * If sd is undefined or null or true or false, return the number of significant digits of\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n * If sd is true include integer-part trailing zeros in the count.\n *\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\n * boolean: whether to count integer-part trailing zeros: true or false.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n\n\n P.precision = P.sd = function (sd, rm) {\n var c,\n n,\n v,\n x = this;\n\n if (sd != null && sd !== !!sd) {\n intCheck(sd, 1, MAX);\n if (rm == null) rm = ROUNDING_MODE;else intCheck(rm, 0, 8);\n return round(new BigNumber(x), sd, rm);\n }\n\n if (!(c = x.c)) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--); // Add the number of digits of the first element.\n\n\n for (v = c[0]; v >= 10; v /= 10, n++);\n }\n\n if (sd && x.e + 1 > n) n = x.e + 1;\n return n;\n };\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\n */\n\n\n P.shiftedBy = function (k) {\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n return this.times('1e' + k);\n };\n /*\n * sqrt(-n) = N\n * sqrt(N) = N\n * sqrt(-I) = N\n * sqrt(I) = I\n * sqrt(0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n\n\n P.squareRoot = P.sqrt = function () {\n var m,\n n,\n r,\n rep,\n t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5'); // Negative/NaN/Infinity/zero?\n\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n } // Initial estimate.\n\n\n s = Math.sqrt(+valueOf(x)); // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(+n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n } // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n\n\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0; // Newton-Raphson iteration.\n\n for (;;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e) --s;\n n = n.slice(s - 3, s + 1); // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n\n if (n == '9999' || !rep && n == '4999') {\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.toExponential = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp++;\n }\n\n return format(this, dp, rm, 1);\n };\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n\n\n P.toFixed = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp = dp + this.e + 1;\n }\n\n return format(this, dp, rm);\n };\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the format or FORMAT object (see BigNumber.set).\n *\n * The formatting object may contain some or all of the properties shown below.\n *\n * FORMAT = {\n * prefix: '',\n * groupSize: 3,\n * secondaryGroupSize: 0,\n * groupSeparator: ',',\n * decimalSeparator: '.',\n * fractionGroupSize: 0,\n * fractionGroupSeparator: '\\xA0', // non-breaking space\n * suffix: ''\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n * [format] {object} Formatting options. See FORMAT pbject above.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n * '[BigNumber Error] Argument not an object: {format}'\n */\n\n\n P.toFormat = function (dp, rm, format) {\n var str,\n x = this;\n\n if (format == null) {\n if (dp != null && rm && typeof rm == 'object') {\n format = rm;\n rm = null;\n } else if (dp && typeof dp == 'object') {\n format = dp;\n dp = rm = null;\n } else {\n format = FORMAT;\n }\n } else if (typeof format != 'object') {\n throw Error(bignumberError + 'Argument not an object: ' + format);\n }\n\n str = x.toFixed(dp, rm);\n\n if (x.c) {\n var i,\n arr = str.split('.'),\n g1 = +format.groupSize,\n g2 = +format.secondaryGroupSize,\n groupSeparator = format.groupSeparator || '',\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = x.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\n\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize) ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'), '$&' + (format.fractionGroupSeparator || '')) : fractionPart) : intPart;\n }\n\n return (format.prefix || '') + str + (format.suffix || '');\n };\n /*\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\n * fraction with an integer numerator and an integer denominator.\n * The denominator will be a positive non-zero value less than or equal to the specified\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\n * the lowest value necessary to represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\n *\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\n */\n\n\n P.toFraction = function (md) {\n var d,\n d0,\n d1,\n d2,\n e,\n exp,\n n,\n n0,\n n1,\n q,\n r,\n s,\n x = this,\n xc = x.c;\n\n if (md != null) {\n n = new BigNumber(md); // Throw if md is less than one or is not an integer, unless it is Infinity.\n\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\n throw Error(bignumberError + 'Argument ' + (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\n }\n }\n\n if (!xc) return new BigNumber(x);\n d = new BigNumber(ONE);\n n1 = d0 = new BigNumber(ONE);\n d1 = n0 = new BigNumber(ONE);\n s = coeffToString(xc); // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s); // n0 = d1 = 0\n\n n0.c[0] = 0;\n\n for (;;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.comparedTo(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e = e * 2; // Determine which fraction is closer to x, n0/d0 or n1/d1\n\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\n MAX_EXP = exp;\n return r;\n };\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n\n\n P.toNumber = function () {\n return +valueOf(this);\n };\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n\n\n P.toPrecision = function (sd, rm) {\n if (sd != null) intCheck(sd, 1, MAX);\n return format(this, sd, rm, 2);\n };\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\n *\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n */\n\n\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e; // Infinity or NaN?\n\n if (e === null) {\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n if (b == null) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, '0');\n } else if (b === 10) {\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\n } else {\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n\n\n P.valueOf = P.toJSON = function () {\n return valueOf(this);\n };\n\n P._isBigNumber = true;\n if (configObject != null) BigNumber.set(configObject);\n return BigNumber;\n } // PRIVATE HELPER FUNCTIONS", "function putCommasToBigNumbers( theNumber, toFloatDigits )\n {\n if( typeof theNumber === 'number' )\n {\n var numbStr = typeof toFloatDigits === 'number' ?\n theNumber.toFixed( toFloatDigits ) : theNumber + '';\n } else {\n var numbStr = theNumber;\n }\n if( numbStr.indexOf('e') > -1 || numbStr.indexOf('E') > -1 ) return numbStr;\n\n var decPoint = numbStr.indexOf('.');\n decPoint = decPoint === -1 ? numbStr.length : decPoint;\n if( decPoint < 4 ) return numbStr;\n var result = numbStr.substring( decPoint, numbStr.length );\n for( var ix=0; ix<decPoint; ix++ ) {\n var char = numbStr.charAt( decPoint - ix - 1 );\n if( char!=='-' ) {\n if( !( ix%3 ) && ix !== 0 ) { result = ',' + result; }\n }\n result = char + result; \n }\n return result;\n }", "function formatDecimal(val, n) {\r\n\t\t\tn = n || 2;\r\n\t\t\t\tvar str = \"\" + Math.round ( parseFloat(val) * Math.pow(10, n) );\r\n\t\t\t\twhile (str.length <= n) {\r\n\t\t\t\t\tstr = \"0\" + str;\r\n\t\t\t\t}\r\n\t\t\t\tvar pt = str.length - n;\r\n\t\t\treturn str.slice(0,pt) + \".\" + str.slice(pt);\r\n\t\t}", "function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc.unshift(1);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }", "function formatDecimal(val, n) {\n n = n || 2;\n var str = \"\" + Math.round(parseFloat(val) * Math.pow(10, n));\n while (str.length <= n) {\n str = \"0\" + str;\n }\n var pt = str.length - n;\n return str.slice(0, pt) + \".\" + str.slice(pt);\n }", "function fixPrice(num) {\n return Number.parseInt(num.replace(/[\\.]/g, ''));\n }", "static fStr(x, n) {\nreturn x.toFixed(n);\n}", "static fStr(x, n) {\nreturn x.toFixed(n);\n}", "function cleanNum(val) {\n return val.toFixed(2);\n }", "USD(b) {\n if (!b) { return '0.00' }\n else {\n // BOLT has 8 decimals right now\n b /= Math.pow(10, 8);\n b = b.toFixed(2)\n return String(b)\n }\n }", "function getDecimalPoints(value) {\r\n var index = value.toString().indexOf(\".\");\r\n return index === -1 ? 0 : value.toString().length - index - 1;\r\n }", "function de_exponentize(number) {\n\treturn number * 10000000;\n}", "function clone(configObject) {\n var div, convertBase, parseNumeric,\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\n ONE = new BigNumber(1),\n\n\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\n\n\n // The default values below must be integers within the inclusive ranges stated.\n // The values can also be changed at run-time using BigNumber.set.\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n // The rounding mode used when rounding to the above decimal places, and when using\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\n // UP 0 Away from zero.\n // DOWN 1 Towards zero.\n // CEIL 2 Towards +Infinity.\n // FLOOR 3 Towards -Infinity.\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n // The modulo mode used when calculating the modulus: a mod n.\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n // The remainder (r) is calculated as: r = a - n * q.\n //\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\n // DOWN 1 The remainder has the same sign as the dividend.\n // This modulo mode is commonly known as 'truncated division' and is\n // equivalent to (a % n) in JavaScript.\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n // The remainder is always positive.\n //\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\n // modes are commonly used for the modulus operation.\n // Although the other rounding modes can also be used, they may not give useful results.\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 0, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n prefix: '',\n groupSize: 3,\n secondaryGroupSize: 0,\n groupSeparator: ',',\n decimalSeparator: '.',\n fractionGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n suffix: ''\n },\n\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\n // '-', '.', whitespace, or repeated character.\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\n\n\n //------------------------------------------------------------------------------------------\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\n */\n function BigNumber(n, b) {\n var alphabet, c, caseChanged, e, i, isNum, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof BigNumber)) {\n\n // Don't throw on constructor call without new (#81).\n // '[BigNumber Error] Constructor call without new: {n}'\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\n return new BigNumber(n, b);\n }\n\n if (b == null) {\n\n // Duplicate.\n if (n instanceof BigNumber) {\n x.s = n.s;\n x.e = n.e;\n x.c = (n = n.c) ? n.slice() : n;\n return;\n }\n\n isNum = typeof n == 'number';\n\n if (isNum && n * 0 == 0) {\n\n // Use `1 / n` to handle minus zero also.\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\n\n // Faster path for integers.\n if (n === ~~n) {\n for (e = 0, i = n; i >= 10; i /= 10, e++);\n x.e = e;\n x.c = [n];\n return;\n }\n\n str = String(n);\n } else {\n str = String(n);\n if (!isNumeric.test(str)) return parseNumeric(x, str, isNum);\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\n }\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n\n // Exponential form?\n if ((i = str.search(/e/i)) > 0) {\n\n // Determine exponent.\n if (e < 0) e = i;\n e += +str.slice(i + 1);\n str = str.substring(0, i);\n } else if (e < 0) {\n\n // Integer.\n e = str.length;\n }\n\n } else {\n\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = String(n);\n\n // Allow exponential notation to be used with base 10 argument, while\n // also rounding to DECIMAL_PLACES as with other bases.\n if (b == 10) {\n x = new BigNumber(n instanceof BigNumber ? n : str);\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\n }\n\n isNum = typeof n == 'number';\n\n if (isNum) {\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\n\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\n throw Error\n (tooManyDigits + n);\n }\n\n // Prevent later check for length on converted number.\n isNum = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\n }\n\n alphabet = ALPHABET.slice(0, b);\n e = i = 0;\n\n // Check that str is a valid base b number.\n // Don't use RegExp so alphabet can contain special characters.\n for (len = str.length; i < len; i++) {\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\n if (c == '.') {\n\n // If '.' is not the first character and it has not be found before.\n if (i > e) {\n e = len;\n continue;\n }\n } else if (!caseChanged) {\n\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\n str == str.toLowerCase() && (str = str.toUpperCase())) {\n caseChanged = true;\n i = -1;\n e = 0;\n continue;\n }\n }\n\n return parseNumeric(x, String(n), isNum, b);\n }\n }\n\n str = convertBase(str, b, 10, x.s);\n\n // Decimal point?\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\n else e = str.length;\n }\n\n // Determine leading zeros.\n for (i = 0; str.charCodeAt(i) === 48; i++);\n\n // Determine trailing zeros.\n for (len = str.length; str.charCodeAt(--len) === 48;);\n\n str = str.slice(i, ++len);\n\n if (str) {\n len -= i;\n\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\n if (isNum && BigNumber.DEBUG &&\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\n throw Error\n (tooManyDigits + (x.s * n));\n }\n\n e = e - i - 1;\n\n // Overflow?\n if (e > MAX_EXP) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n x.c = [x.e = 0];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = (e + 1) % LOG_BASE;\n if (e < 0) i += LOG_BASE;\n\n if (i < len) {\n if (i) x.c.push(+str.slice(0, i));\n\n for (len -= LOG_BASE; i < len;) {\n x.c.push(+str.slice(i, i += LOG_BASE));\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for (; i--; str += '0');\n x.c.push(+str);\n }\n } else {\n\n // Zero.\n x.c = [x.e = 0];\n }\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.clone = clone;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object with the following optional properties (if the value of a property is\n * a number, it must be an integer within the inclusive range stated):\n *\n * DECIMAL_PLACES {number} 0 to MAX\n * ROUNDING_MODE {number} 0 to 8\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\n * CRYPTO {boolean} true or false\n * MODULO_MODE {number} 0 to 9\n * POW_PRECISION {number} 0 to MAX\n * ALPHABET {string} A string of two or more unique characters which does\n * not contain '.'.\n * FORMAT {object} An object with some of the following properties:\n * prefix {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * groupSeparator {string}\n * decimalSeparator {string}\n * fractionGroupSize {number}\n * fractionGroupSeparator {string}\n * suffix {string}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\n *\n * Return an object with the properties current values.\n */\n BigNumber.config = BigNumber.set = function (obj) {\n var p, v;\n\n if (obj != null) {\n\n if (typeof obj == 'object') {\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n DECIMAL_PLACES = v;\n }\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\n v = obj[p];\n intCheck(v, 0, 8, p);\n ROUNDING_MODE = v;\n }\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\n v = obj[p];\n if (v && v.pop) {\n intCheck(v[0], -MAX, 0, p);\n intCheck(v[1], 0, MAX, p);\n TO_EXP_NEG = v[0];\n TO_EXP_POS = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\n }\n }\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\n if (obj.hasOwnProperty(p = 'RANGE')) {\n v = obj[p];\n if (v && v.pop) {\n intCheck(v[0], -MAX, -1, p);\n intCheck(v[1], 1, MAX, p);\n MIN_EXP = v[0];\n MAX_EXP = v[1];\n } else {\n intCheck(v, -MAX, MAX, p);\n if (v) {\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\n } else {\n throw Error\n (bignumberError + p + ' cannot be zero: ' + v);\n }\n }\n }\n\n // CRYPTO {boolean} true or false.\n // '[BigNumber Error] CRYPTO not true or false: {v}'\n // '[BigNumber Error] crypto unavailable'\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\n v = obj[p];\n if (v === !!v) {\n if (v) {\n if (typeof crypto != 'undefined' && crypto &&\n (crypto.getRandomValues || crypto.randomBytes)) {\n CRYPTO = v;\n } else {\n CRYPTO = !v;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n } else {\n CRYPTO = v;\n }\n } else {\n throw Error\n (bignumberError + p + ' not true or false: ' + v);\n }\n }\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\n v = obj[p];\n intCheck(v, 0, 9, p);\n MODULO_MODE = v;\n }\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\n v = obj[p];\n intCheck(v, 0, MAX, p);\n POW_PRECISION = v;\n }\n\n // FORMAT {object}\n // '[BigNumber Error] FORMAT not an object: {v}'\n if (obj.hasOwnProperty(p = 'FORMAT')) {\n v = obj[p];\n if (typeof v == 'object') FORMAT = v;\n else throw Error\n (bignumberError + p + ' not an object: ' + v);\n }\n\n // ALPHABET {string}\n // '[BigNumber Error] ALPHABET invalid: {v}'\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\n v = obj[p];\n\n // Disallow if only one character,\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\n ALPHABET = v;\n } else {\n throw Error\n (bignumberError + p + ' invalid: ' + v);\n }\n }\n\n } else {\n\n // '[BigNumber Error] Object expected: {v}'\n throw Error\n (bignumberError + 'Object expected: ' + obj);\n }\n }\n\n return {\n DECIMAL_PLACES: DECIMAL_PLACES,\n ROUNDING_MODE: ROUNDING_MODE,\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\n RANGE: [MIN_EXP, MAX_EXP],\n CRYPTO: CRYPTO,\n MODULO_MODE: MODULO_MODE,\n POW_PRECISION: POW_PRECISION,\n FORMAT: FORMAT,\n ALPHABET: ALPHABET\n };\n };\n\n\n /*\n * Return true if v is a BigNumber instance, otherwise return false.\n *\n * v {any}\n */\n BigNumber.isBigNumber = function (v) {\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.maximum = BigNumber.max = function () {\n return maxOrMin(arguments, P.lt);\n };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.minimum = BigNumber.min = function () {\n return maxOrMin(arguments, P.gt);\n };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\n * '[BigNumber Error] crypto unavailable'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor(Math.random() * pow2_53); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n if (dp == null) dp = DECIMAL_PLACES;\n else intCheck(dp, 0, MAX);\n\n k = mathceil(dp / LOG_BASE);\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if (crypto.getRandomValues) {\n\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\n\n for (; i < k;) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if (v >= 9e15) {\n b = crypto.getRandomValues(new Uint32Array(2));\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if (crypto.randomBytes) {\n\n // buffer\n a = crypto.randomBytes(k *= 7);\n\n for (; i < k;) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\n\n if (v >= 9e15) {\n crypto.randomBytes(7).copy(a, i);\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push(v % 1e14);\n i += 7;\n }\n }\n i = k / 7;\n } else {\n CRYPTO = false;\n throw Error\n (bignumberError + 'crypto unavailable');\n }\n }\n\n // Use Math.random.\n if (!CRYPTO) {\n\n for (; i < k;) {\n v = random53bitInt();\n if (v < 9e15) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if (k && dp) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor(k / v) * v;\n }\n\n // Remove trailing elements which are zero.\n for (; c[i] === 0; c.pop(), i--);\n\n // Zero?\n if (i < 0) {\n c = [e = 0];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if (i < LOG_BASE) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n /*\n * Return a BigNumber whose value is the sum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.sum = function () {\n var i = 1,\n args = arguments,\n sum = new BigNumber(args[0]);\n for (; i < args.length;) sum = sum.plus(args[i++]);\n return sum;\n };\n\n\n // PRIVATE FUNCTIONS\n\n\n // Called by BigNumber and BigNumber.prototype.toString.\n convertBase = (function () {\n var decimal = '0123456789';\n\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\n */\n function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n // If the caller is toString, we are converting from base 10 to baseOut.\n // If the caller is BigNumber, we are converting from baseIn to base 10.\n return function (str, baseIn, baseOut, sign, callerIsToString) {\n var alphabet, d, e, k, r, x, xc, y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\n 10, baseOut, decimal);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\n ? (alphabet = ALPHABET, decimal)\n : (alphabet = decimal, ALPHABET));\n\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop());\n\n // Zero?\n if (!xc[0]) return alphabet.charAt(0);\n\n // Does str represent an integer? If so, no need for the division.\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // The sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n // xc now represents str converted to baseOut.\n\n // THe index of the rounding digit.\n d = e + dp + 1;\n\n // The rounding digit: the digit to the right of the digit that may be rounded up.\n i = xc[d];\n\n // Look at the rounding digits and mode to determine whether to round up.\n\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n // If the index of the rounding digit is not greater than zero, or xc represents\n // zero, then the result of the base conversion is zero or, if rounding up, a value\n // such as 0.00001.\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\n } else {\n\n // Truncate xc to the required number of decimal places.\n xc.length = d;\n\n // Round up?\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];);\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\n\n // Add leading zeros, decimal point and trailing zeros as required.\n str = toFixedPoint(str, e, alphabet.charAt(0));\n }\n\n // The caller will add the sign.\n return str;\n };\n })();\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply(x, k, base) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for (x = x.slice(); i--;) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x = [carry].concat(x);\n\n return x;\n }\n\n function compare(a, b, aL, bL) {\n var i, cmp;\n\n if (aL != bL) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for (i = cmp = 0; i < aL; i++) {\n\n if (a[i] != b[i]) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n\n return cmp;\n }\n\n function subtract(a, b, aL, base) {\n var i = 0;\n\n // Subtract b from a.\n for (; aL--;) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for (; !a[0] && a.length > 1; a.splice(0, 1));\n }\n\n // x: dividend, y: divisor.\n return function (x, y, dp, rm, base) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if (!xc || !xc[0] || !yc || !yc[0]) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if (!base) {\n base = BASE;\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for (i = 0; yc[i] == (xc[i] || 0); i++);\n\n if (yc[i] > (xc[i] || 0)) e--;\n\n if (s < 0) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor(base / (yc[0] + 1));\n\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\n if (n > 1) {\n yc = multiply(yc, n, base);\n xc = multiply(xc, n, base);\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice(0, yL);\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for (; remL < yL; rem[remL++] = 0);\n yz = yc.slice();\n yz = [0].concat(yz);\n yc0 = yc[0];\n if (yc[1] >= base / 2) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare(yc, rem, yL, remL);\n\n // If divisor < remainder.\n if (cmp < 0) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor(rem0 / yc0);\n\n // Algorithm:\n // product = divisor multiplied by trial digit (n).\n // Compare product and remainder.\n // If product is greater than remainder:\n // Subtract divisor from product, decrement trial digit.\n // Subtract product from remainder.\n // If product was less than remainder at the last compare:\n // Compare new remainder and divisor.\n // If remainder is greater than divisor:\n // Subtract divisor from remainder, increment trial digit.\n\n if (n > 1) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply(yc, n, base);\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder then trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while (compare(prod, rem, prodL, remL) == 1) {\n n--;\n\n // Subtract divisor from product.\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if (n == 0) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if (prodL < remL) prod = [0].concat(prod);\n\n // Subtract product from remainder.\n subtract(rem, prod, remL, base);\n remL = rem.length;\n\n // If product was < remainder.\n if (cmp == -1) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while (compare(yc, rem, yL, remL) < 1) {\n n++;\n\n // Subtract divisor from remainder.\n subtract(rem, yL < remL ? yz : yc, remL, base);\n remL = rem.length;\n }\n }\n } else if (cmp === 0) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if (rem[0]) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [xc[xi]];\n remL = 1;\n }\n } while ((xi++ < xL || rem[0] != null) && s--);\n\n more = rem[0] != null;\n\n // Leading zero?\n if (!qc[0]) qc.splice(0, 1);\n }\n\n if (base == BASE) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\n\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n: a BigNumber.\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\n * rm: the rounding mode.\n * id: 1 (toExponential) or 2 (toPrecision).\n */\n function format(n, i, rm, id) {\n var c0, e, ne, len, str;\n\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n if (!n.c) return n.toString();\n\n c0 = n.c[0];\n ne = n.e;\n\n if (i == null) {\n str = coeffToString(n.c);\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\n ? toExponential(str, ne)\n : toFixedPoint(str, ne, '0');\n } else {\n n = round(new BigNumber(n), i, rm);\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString(n.c);\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\n\n // Append zeros?\n for (; len < i; str += '0', len++);\n str = toExponential(str, e);\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint(str, e, '0');\n\n // Append zeros?\n if (e + 1 > len) {\n if (--i > 0) for (str += '.'; i--; str += '0');\n } else {\n i += e - len;\n if (i > 0) {\n if (e + 1 == len) str += '.';\n for (; i--; str += '0');\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin(args, method) {\n var n,\n i = 1,\n m = new BigNumber(args[0]);\n\n for (; i < args.length; i++) {\n n = new BigNumber(args[i]);\n\n // If any number is NaN, return NaN.\n if (!n.s) {\n m = n;\n break;\n } else if (method.call(m, n)) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise(n, c, e) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for (; !c[--j]; c.pop());\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for (j = c[0]; j >= 10; j /= 10, i++);\n\n // Overflow?\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if (e < MIN_EXP) {\n\n // Zero.\n n.c = [n.e = 0];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\n\n return function (x, str, isNum, b) {\n var base,\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\n\n // No exception on ±Infinity or NaN.\n if (isInfinityOrNaN.test(s)) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n x.c = x.e = null;\n } else {\n if (!isNum) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace(basePrefix, function (m, p1, p2) {\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\n }\n\n if (str != s) return new BigNumber(s, base);\n }\n\n // '[BigNumber Error] Not a number: {n}'\n // '[BigNumber Error] Not a base {b} number: {n}'\n if (BigNumber.DEBUG) {\n throw Error\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\n }\n\n // NaN\n x.c = x.e = x.s = null;\n }\n }\n })();\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round(x, sd, rm, r) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if (i < 0) {\n i += LOG_BASE;\n j = sd;\n n = xc[ni = 0];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[d - j - 1] % 10 | 0;\n } else {\n ni = mathceil((i + 1) / LOG_BASE);\n\n if (ni >= xc.length) {\n\n if (r) {\n\n // Needed by sqrt.\n for (; xc.length <= ni; xc.push(0));\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for (d = 1; k >= 10; k /= 10, d++);\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\n\n r = rm < 4\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\n rm == (x.s < 0 ? 8 : 7));\n\n if (sd < 1 || !xc[0]) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if (i == 0) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[LOG_BASE - i];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for (; ;) {\n\n // If the digit to be rounded up is in the first element of xc...\n if (ni == 0) {\n\n // i will be the length of xc[0] before k is added.\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\n j = xc[0] += k;\n for (k = 1; j >= 10; j /= 10, k++);\n\n // if i != k the length has increased.\n if (i != k) {\n x.e++;\n if (xc[0] == BASE) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if (xc[ni] != BASE) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for (i = xc.length; xc[--i] === 0; xc.pop());\n }\n\n // Overflow? Infinity.\n if (x.e > MAX_EXP) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if (x.e < MIN_EXP) {\n x.c = [x.e = 0];\n }\n }\n\n return x;\n }\n\n\n function valueOf(n) {\n var str,\n e = n.e;\n\n if (e === null) return n.toString();\n\n str = coeffToString(n.c);\n\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(str, e)\n : toFixedPoint(str, e, '0');\n\n return n.s < 0 ? '-' + str : str;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if (x.s < 0) x.s = 1;\n return x;\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = function (y, b) {\n return compare(this, new BigNumber(y, b));\n };\n\n\n /*\n * If dp is undefined or null or true or false, return the number of decimal places of the\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n *\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.decimalPlaces = P.dp = function (dp, rm) {\n var c, n, v,\n x = this;\n\n if (dp != null) {\n intCheck(dp, 0, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), dp + x.e + 1, rm);\n }\n\n if (!(c = x.c)) return null;\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\n if (n < 0) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function (y, b) {\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.idiv = function (y, b) {\n return div(this, new BigNumber(y, b), 0, 1);\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\n *\n * If m is present, return the result modulo m.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\n *\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\n *\n * n {number|string|BigNumber} The exponent. An integer.\n * [m] {number|string|BigNumber} The modulus.\n *\n * '[BigNumber Error] Exponent not an integer: {n}'\n */\n P.exponentiatedBy = P.pow = function (n, m) {\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\n x = this;\n\n n = new BigNumber(n);\n\n // Allow NaN and ±Infinity, but not other non-integers.\n if (n.c && !n.isInteger()) {\n throw Error\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\n }\n\n if (m != null) m = new BigNumber(m);\n\n // Exponent of MAX_SAFE_INTEGER is 15.\n nIsBig = n.e > 14;\n\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\n\n // The sign of the result of pow when x is negative depends on the evenness of n.\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\n return m ? y.mod(m) : y;\n }\n\n nIsNeg = n.s < 0;\n\n if (m) {\n\n // x % m returns NaN if abs(m) is zero, or m is NaN.\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\n\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\n\n if (isModExp) x = x.mod(m);\n\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\n // [1, 240000000]\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\n // [80000000000000] [99999750000000]\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\n\n // If x is negative and n is odd, k = -0, else k = 0.\n k = x.s < 0 && isOdd(n) ? -0 : 0;\n\n // If x >= 1, k = ±Infinity.\n if (x.e > -1) k = 1 / k;\n\n // If n is negative return ±0, else return ±Infinity.\n return new BigNumber(nIsNeg ? 1 / k : k);\n\n } else if (POW_PRECISION) {\n\n // Truncating each coefficient array to a length of k after each multiplication\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\n // i.e. there will be a minimum of 28 guard digits retained.\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\n }\n\n if (nIsBig) {\n half = new BigNumber(0.5);\n if (nIsNeg) n.s = 1;\n nIsOdd = isOdd(n);\n } else {\n i = Math.abs(+valueOf(n));\n nIsOdd = i % 2;\n }\n\n y = new BigNumber(ONE);\n\n // Performs 54 loop iterations for n of 9007199254740991.\n for (; ;) {\n\n if (nIsOdd) {\n y = y.times(x);\n if (!y.c) break;\n\n if (k) {\n if (y.c.length > k) y.c.length = k;\n } else if (isModExp) {\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (i) {\n i = mathfloor(i / 2);\n if (i === 0) break;\n nIsOdd = i % 2;\n } else {\n n = n.times(half);\n round(n, n.e + 1, 1);\n\n if (n.e > 14) {\n nIsOdd = isOdd(n);\n } else {\n i = +valueOf(n);\n if (i === 0) break;\n nIsOdd = i % 2;\n }\n }\n\n x = x.times(x);\n\n if (k) {\n if (x.c && x.c.length > k) x.c.length = k;\n } else if (isModExp) {\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\n }\n }\n\n if (isModExp) return y;\n if (nIsNeg) y = ONE.div(y);\n\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\n */\n P.integerValue = function (rm) {\n var n = new BigNumber(this);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n return round(n, n.e + 1, rm);\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isEqualTo = P.eq = function (y, b) {\n return compare(this, new BigNumber(y, b)) === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isGreaterThan = P.gt = function (y, b) {\n return compare(this, new BigNumber(y, b)) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = function () {\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise return false.\n */\n P.isLessThan = P.lt = function (y, b) {\n return compare(this, new BigNumber(y, b)) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise return false.\n */\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise return false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise return false.\n */\n P.isNegative = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is positive, otherwise return false.\n */\n P.isPositive = function () {\n return this.s > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = function (y, b) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Either Infinity?\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\n\n // Either zero?\n if (!xc[0] || !yc[0]) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0);\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if (a = xe - ye) {\n\n if (xLTy = a < 0) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for (b = a; b--; t.push(0));\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\n\n for (a = b = 0; b < j; b++) {\n\n if (xc[b] != yc[b]) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = (j = yc.length) - (i = xc.length);\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if (b > 0) for (; b--; xc[i++] = 0);\n b = BASE - 1;\n\n // Subtract yc from xc.\n for (; j > a;) {\n\n if (xc[--j] < yc[j]) {\n for (i = j; i && !xc[--i]; xc[i] = b);\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\n\n // Zero?\n if (!xc[0]) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [y.e = 0];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise(y, xc, ye);\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function (y, b) {\n var q, s,\n x = this;\n\n y = new BigNumber(y, b);\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if (!x.c || !y.s || y.c && !y.c[0]) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if (!y.c || x.c && !x.c[0]) {\n return new BigNumber(x);\n }\n\n if (MODULO_MODE == 9) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div(x, y, 0, 3);\n y.s = s;\n q.s *= s;\n } else {\n q = div(x, y, 0, MODULO_MODE);\n }\n\n y = x.minus(q.times(y));\n\n // To match JavaScript %, ensure sign of zero is sign of dividend.\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\n\n return y;\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\n * of BigNumber(y, b).\n */\n P.multipliedBy = P.times = function (y, b) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = (y = new BigNumber(y, b)).c;\n\n // Either NaN, ±Infinity or ±0?\n if (!xc || !yc || !xc[0] || !yc[0]) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if (!xc || !yc) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for (i = ycL; --i >= 0;) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for (k = xcL, j = i + k; j > i;) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.splice(0, 1);\n }\n\n return normalise(y, zc, e);\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = function (y, b) {\n var t,\n x = this,\n a = x.s;\n\n y = new BigNumber(y, b);\n b = y.s;\n\n // Either NaN?\n if (!a || !b) return new BigNumber(NaN);\n\n // Signs differ?\n if (a != b) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if (!xe || !ye) {\n\n // Return ±Infinity if either ±Infinity.\n if (!xc || !yc) return new BigNumber(a / 0);\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if (a = xe - ye) {\n if (a > 0) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for (; a--; t.push(0));\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for (a = 0; b;) {\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\n }\n\n if (a) {\n xc = [a].concat(xc);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise(y, xc, ye);\n };\n\n\n /*\n * If sd is undefined or null or true or false, return the number of significant digits of\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\n * If sd is true include integer-part trailing zeros in the count.\n *\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\n * ROUNDING_MODE if rm is omitted.\n *\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\n * boolean: whether to count integer-part trailing zeros: true or false.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.precision = P.sd = function (sd, rm) {\n var c, n, v,\n x = this;\n\n if (sd != null && sd !== !!sd) {\n intCheck(sd, 1, MAX);\n if (rm == null) rm = ROUNDING_MODE;\n else intCheck(rm, 0, 8);\n\n return round(new BigNumber(x), sd, rm);\n }\n\n if (!(c = x.c)) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if (v = c[v]) {\n\n // Subtract the number of trailing zeros of the last element.\n for (; v % 10 == 0; v /= 10, n--);\n\n // Add the number of digits of the first element.\n for (v = c[0]; v >= 10; v /= 10, n++);\n }\n\n if (sd && x.e + 1 > n) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\n */\n P.shiftedBy = function (k) {\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\n return this.times('1e' + k);\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt(N) = N\n * sqrt(-I) = N\n * sqrt(I) = I\n * sqrt(0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if (s !== 1 || !c || !c[0]) {\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\n }\n\n // Initial estimate.\n s = Math.sqrt(+valueOf(x));\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if (s == 0 || s == 1 / 0) {\n n = coeffToString(c);\n if ((n.length + e) % 2 == 0) n += '0';\n s = Math.sqrt(+n);\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\n\n if (s == 1 / 0) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice(0, n.indexOf('e') + 1) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber(s + '');\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if (r.c[0]) {\n e = r.e;\n s = e + dp;\n if (s < 3) s = 0;\n\n // Newton-Raphson iteration.\n for (; ;) {\n t = r;\n r = half.times(t.plus(div(x, t, dp, 1)));\n\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if (r.e < e) --s;\n n = n.slice(s - 3, s + 1);\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if (n == '9999' || !rep && n == '4999') {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if (!rep) {\n round(t, t.e + DECIMAL_PLACES + 2, 0);\n\n if (t.times(t).eq(x)) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\n\n // Truncate to the first rounding digit.\n round(r, r.e + DECIMAL_PLACES + 2, 1);\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toExponential = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp++;\n }\n return format(this, dp, rm, 1);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n */\n P.toFixed = function (dp, rm) {\n if (dp != null) {\n intCheck(dp, 0, MAX);\n dp = dp + this.e + 1;\n }\n return format(this, dp, rm);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the format or FORMAT object (see BigNumber.set).\n *\n * The formatting object may contain some or all of the properties shown below.\n *\n * FORMAT = {\n * prefix: '',\n * groupSize: 3,\n * secondaryGroupSize: 0,\n * groupSeparator: ',',\n * decimalSeparator: '.',\n * fractionGroupSize: 0,\n * fractionGroupSeparator: '\\xA0', // non-breaking space\n * suffix: ''\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n * [format] {object} Formatting options. See FORMAT pbject above.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\n * '[BigNumber Error] Argument not an object: {format}'\n */\n P.toFormat = function (dp, rm, format) {\n var str,\n x = this;\n\n if (format == null) {\n if (dp != null && rm && typeof rm == 'object') {\n format = rm;\n rm = null;\n } else if (dp && typeof dp == 'object') {\n format = dp;\n dp = rm = null;\n } else {\n format = FORMAT;\n }\n } else if (typeof format != 'object') {\n throw Error\n (bignumberError + 'Argument not an object: ' + format);\n }\n\n str = x.toFixed(dp, rm);\n\n if (x.c) {\n var i,\n arr = str.split('.'),\n g1 = +format.groupSize,\n g2 = +format.secondaryGroupSize,\n groupSeparator = format.groupSeparator || '',\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = x.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if (g1 > 0 && len > 0) {\n i = len % g1 || g1;\n intPart = intDigits.substr(0, i);\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\n '$&' + (format.fractionGroupSeparator || ''))\n : fractionPart)\n : intPart;\n }\n\n return (format.prefix || '') + str + (format.suffix || '');\n };\n\n\n /*\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\n * fraction with an integer numerator and an integer denominator.\n * The denominator will be a positive non-zero value less than or equal to the specified\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\n * the lowest value necessary to represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\n *\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\n */\n P.toFraction = function (md) {\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\n x = this,\n xc = x.c;\n\n if (md != null) {\n n = new BigNumber(md);\n\n // Throw if md is less than one or is not an integer, unless it is Infinity.\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\n throw Error\n (bignumberError + 'Argument ' +\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\n }\n }\n\n if (!xc) return new BigNumber(x);\n\n d = new BigNumber(ONE);\n n1 = d0 = new BigNumber(ONE);\n d1 = n0 = new BigNumber(ONE);\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for (; ;) {\n q = div(n, d, 0, 1);\n d2 = d0.plus(q.times(d1));\n if (d2.comparedTo(md) == 1) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus(q.times(d2 = n1));\n n0 = d2;\n d = n.minus(q.times(d2 = d));\n n = d2;\n }\n\n d2 = div(md.minus(d0), d1, 0, 1);\n n0 = n0.plus(d2.times(n1));\n d0 = d0.plus(d2.times(d1));\n n0.s = n1.s = x.s;\n e = e * 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\n\n MAX_EXP = exp;\n\n return r;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n return +valueOf(this);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\n */\n P.toPrecision = function (sd, rm) {\n if (sd != null) intCheck(sd, 1, MAX);\n return format(this, sd, rm, 2);\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\n *\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if (e === null) {\n if (s) {\n str = 'Infinity';\n if (s < 0) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n if (b == null) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential(coeffToString(n.c), e)\n : toFixedPoint(coeffToString(n.c), e, '0');\n } else if (b === 10) {\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\n } else {\n intCheck(b, 2, ALPHABET.length, 'Base');\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\n }\n\n if (s < 0 && n.c[0]) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return as toString, but do not accept a base argument, and include the minus sign for\n * negative zero.\n */\n P.valueOf = P.toJSON = function () {\n return valueOf(this);\n };\n\n\n P._isBigNumber = true;\n\n if (typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol') {\n P[Symbol.toStringTag] = 'BigNumber';\n // Node.js v10.12.0+\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\n }\n\n if (configObject != null) BigNumber.set(configObject);\n\n return BigNumber;\n }", "_toBigNumberDecimal(number, radix) {\n const that = this;\n let result;\n\n if (radix === 10) {\n result = new JQX.Utilities.BigNumber(number);\n }\n else {\n if (that._unsigned || that._isNegative(number, radix) === false) {\n if (that._wordLengthNumber < 64) {\n result = parseInt(number, radix);\n result = new JQX.Utilities.BigNumber(result);\n }\n else {\n result = that._getBigNumberFrom64BitBinOctHex(number, radix);\n }\n }\n else {\n result = that._getNegativeDecimal(number, radix);\n result = new JQX.Utilities.BigNumber(result);\n }\n\n }\n return result;\n }", "function decimalFrom1e7(digit1e7, needLeadingZeros) {\n var partial = digit1e7 ? String(digit1e7) : '';\n if (needLeadingZeros) {\n return '0000000'.slice(partial.length) + partial;\n }\n return partial;\n }", "function toStringBinary(x, baseOut, sd, rm) {\r\n var base, e, i, k, len, roundUp, str, xd, y,\r\n Ctor = x.constructor,\r\n isExp = sd !== void 0;\r\n\r\n if (isExp) {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n } else {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n }\r\n\r\n if (!x.isFinite()) {\r\n str = nonFiniteToString(x);\r\n } else {\r\n str = finiteToString(x);\r\n i = str.indexOf('.');\r\n\r\n // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:\r\n // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))\r\n // minBinaryExponent = floor(decimalExponent * log[2](10))\r\n // log[2](10) = 3.321928094887362347870319429489390175864\r\n\r\n if (isExp) {\r\n base = 2;\r\n if (baseOut == 16) {\r\n sd = sd * 4 - 3;\r\n } else if (baseOut == 8) {\r\n sd = sd * 3 - 2;\r\n }\r\n } else {\r\n base = baseOut;\r\n }\r\n\r\n // Convert the number as an integer then divide the result by its base raised to a power such\r\n // that the fraction part will be restored.\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n str = str.replace('.', '');\r\n y = new Ctor(1);\r\n y.e = str.length - i;\r\n y.d = convertBase(finiteToString(y), 10, base);\r\n y.e = y.d.length;\r\n }\r\n\r\n xd = convertBase(str, 10, base);\r\n e = len = xd.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] == 0;) xd.pop();\r\n\r\n if (!xd[0]) {\r\n str = isExp ? '0p+0' : '0';\r\n } else {\r\n if (i < 0) {\r\n e--;\r\n } else {\r\n x = new Ctor(x);\r\n x.d = xd;\r\n x.e = e;\r\n x = divide(x, y, sd, rm, 0, base);\r\n xd = x.d;\r\n e = x.e;\r\n roundUp = inexact;\r\n }\r\n\r\n // The rounding digit, i.e. the digit after the digit that may be rounded up.\r\n i = xd[sd];\r\n k = base / 2;\r\n roundUp = roundUp || xd[sd + 1] !== void 0;\r\n\r\n roundUp = rm < 4\r\n ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))\r\n : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||\r\n rm === (x.s < 0 ? 8 : 7));\r\n\r\n xd.length = sd;\r\n\r\n if (roundUp) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (; ++xd[--sd] > base - 1;) {\r\n xd[sd] = 0;\r\n if (!sd) {\r\n ++e;\r\n xd.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n\r\n // Add binary exponent suffix?\r\n if (isExp) {\r\n if (len > 1) {\r\n if (baseOut == 16 || baseOut == 8) {\r\n i = baseOut == 16 ? 4 : 3;\r\n for (--len; len % i; len++) str += '0';\r\n xd = convertBase(str, base, baseOut);\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // xd[0] will always be be 1\r\n for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n } else {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n }\r\n\r\n str = str + (e < 0 ? 'p' : 'p+') + e;\r\n } else if (e < 0) {\r\n for (; ++e;) str = '0' + str;\r\n str = '0.' + str;\r\n } else {\r\n if (++e > len) for (e -= len; e-- ;) str += '0';\r\n else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;\r\n }\r\n\r\n return x.s < 0 ? '-' + str : str;\r\n }", "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n },\r\n\r\n // The alphabet used for base conversion.\r\n // It must be at least 2 characters long, with no '.' or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(n, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof BigNumber)) {\r\n\r\n // Don't throw on constructor call without new (#81).\r\n // '[BigNumber Error] Constructor call without new: {n}'\r\n //throw Error(bignumberError + ' Constructor call without new: ' + n);\r\n return new BigNumber(n, b);\r\n }\r\n\r\n if (b == null) {\r\n\r\n // Duplicate.\r\n if (n instanceof BigNumber) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = (n = n.c) ? n.slice() : n;\r\n return;\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum && n * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / n < 0 ? (n = -n, -1) : 1;\r\n\r\n // Faster path for integers.\r\n if (n === ~~n) {\r\n for (e = 0, i = n; i >= 10; i /= 10, e++);\r\n x.e = e;\r\n x.c = [n];\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if (!isNumeric.test(str = n + '')) return parseNumeric(x, str, isNum);\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = n + '';\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(n instanceof BigNumber ? n : str);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n isNum = typeof n == 'number';\r\n\r\n if (isNum) {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (n * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + n);\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, n + '', isNum, b);\r\n }\r\n }\r\n\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n str = str.slice(i, ++len);\r\n\r\n if (str) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {\r\n throw Error\r\n (tooManyDigits + (x.s * n));\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if (e > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (isArray(v)) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character, or contains '.' or a repeated character.\r\n if (typeof v == 'string' && !/^.$|\\.|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * v {any}\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n return v instanceof BigNumber || v && v._isBigNumber === true || false;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0))\r\n : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && ne <= TO_EXP_NEG\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var m, n,\r\n i = 0;\r\n\r\n if (isArray(args[0])) args = args[0];\r\n m = new BigNumber(args[0]);\r\n\r\n for (; ++i < args.length;) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n x.c = x.e = null;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.c = x.e = x.s = null;\r\n }\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + n);\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+x.valueOf(), nIsBig ? 2 - isOdd(n) : +n));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n nIsOdd = isOdd(n);\r\n } else {\r\n nIsOdd = n % 2;\r\n }\r\n\r\n if (nIsNeg) n.s = 1;\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (nIsBig) {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n if (!n.c[0]) break;\r\n nIsBig = n.e > 14;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n n = mathfloor(n / 2);\r\n if (!n) break;\r\n nIsOdd = n % 2;\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c ).slice(0, s) === (n =\r\n coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.set).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFormat = function (dp, rm) {\r\n var str = this.toFixed(dp, rm);\r\n\r\n if (this.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n\r\n for (; i < len; i += g1) {\r\n intPart += groupSeparator + intDigits.substr(i, g1);\r\n }\r\n\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ((g2 = +FORMAT.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + FORMAT.fractionGroupSeparator)\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d, d0, d1, d2, e, exp, n, n0, n1, q, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + md);\r\n }\r\n }\r\n\r\n if (!xc) return x.toString();\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1\r\n ? [n1.toString(), d1.toString()]\r\n : [n0.toString(), d0.toString()];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString(n.c);\r\n\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(str, e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (hasSymbol) {\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n }\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }", "function clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if only one character,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.$|[+-.\\s]|(.).*\\1/.test(v)) {\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, P.lt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, P.gt);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin(args, method) {\r\n var n,\r\n i = 1,\r\n m = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n n = new BigNumber(args[i]);\r\n\r\n // If any number is NaN, return NaN.\r\n if (!n.s) {\r\n m = n;\r\n break;\r\n } else if (method.call(m, n)) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[d - j - 1] % 10 | 0;\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n }" ]
[ "0.69678116", "0.68826973", "0.68603146", "0.67189133", "0.65545577", "0.65459454", "0.6496998", "0.6496998", "0.64896846", "0.6451051", "0.643658", "0.6387632", "0.6380323", "0.6357161", "0.6324254", "0.63214487", "0.6309649", "0.62712514", "0.62406933", "0.62240386", "0.62229383", "0.6183336", "0.6169684", "0.61565214", "0.6120457", "0.6113262", "0.6089441", "0.60795116", "0.60690784", "0.6006606", "0.5993137", "0.59582436", "0.59533465", "0.5950564", "0.5950488", "0.594977", "0.5946491", "0.5945066", "0.5945066", "0.5942326", "0.59301615", "0.59216994", "0.5901975", "0.5878563", "0.58738965", "0.58666766", "0.5861075", "0.58497435", "0.58404344", "0.5837834", "0.5821705", "0.5818361", "0.58141476", "0.5804459", "0.5803415", "0.57926714", "0.579077", "0.57868403", "0.57844925", "0.57830733", "0.57613987", "0.57549864", "0.57480764", "0.57480764", "0.5736333", "0.573383", "0.5727084", "0.5724975", "0.5724975", "0.5724975", "0.5724975", "0.5724975", "0.5724975", "0.57210326", "0.57186073", "0.5716673", "0.57108605", "0.5707223", "0.5707223", "0.5706014", "0.5704802", "0.5703291", "0.5693249", "0.5693129", "0.5688735", "0.5684607", "0.56776494", "0.56746507", "0.56746507", "0.56713325", "0.5671171", "0.56686854", "0.5667562", "0.56635386", "0.56596625", "0.56587285", "0.5657598", "0.5654693", "0.5654693", "0.5654693" ]
0.61264294
24
Takes the response from api calls to the cart and replaces the clients cart render with the new cart html supplied. Note: this is some horribly dirty corner cutting hackery of which I am not proud. Don't judge me.
async function _reRenderCartWithResponse(response) { // Do nothing if not 200 if (response.status !== 200) return; // Convert response stream to text, which will contain the current html state of the cart let text = await response.text(); // Remove the current cart from the nav let cart = document.getElementById('nav-cart'); let show = document.getElementById('cart-wrapper'); show = show ? show.classList.contains('active') : false; if (cart) { while (cart.nextSibling) cart.parentNode.removeChild(cart.nextSibling); cart.parentNode.removeChild(cart); } if (!text) return; // Inject the new cart const template = document.createElement('template'); template.innerHTML = text; if (show) template.content.getElementById('cart-wrapper').classList.add('active'); for (const replacement of template.content.childNodes) { document.querySelector('nav').appendChild(replacement); } // The script included with the cart will not evaluate when injected via innerHTML, so regex // out its content and eval it. const script = text.match(/<script>([\s\S]*)<\/script>/); if (script) window.eval(script[1]); // Give the cart nav icon an animation for some responsiveness if ((cart = document.getElementById('nav-cart'))) cart.classList.add('animate'); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCart() {\n\n\t$('contentMinicart').innerHTML = \"<div align='center' class='zajax_loading'>Loading... Please Wait<\\/div>\";\n\tnew Effect.Highlight($('contentMinicart'));\n\t\n\t// this gets called by handleResponse (which is in zoovy.js)\n var postBody = 'm=RenderElement&format=WRAPPER&docid='+DOCID+'&element=IMAGECART&targetDiv=contentMinicart';\n\tnew Ajax.Request(magic_url+'/ajax/RenderElement', { postBody: postBody, asynchronous: 1,\n\t\tonComplete: function(request){handleResponse(request.responseText);} }\n\t\t) ;\n\t}", "function updateCartHtml(data) {\n var obj = JSON.parse(data);\n $(\"#subTotalPrice\").html('$' + obj.subTotal);\n $(\"#TotalPrice\").html('$' + obj.totalPrice);\n $(\"#cartCount\").html(' (' + obj.totalItems + ')');\n $(\"#vat\").html('$' + obj.vat);\n $(\"#itemsCount\").html('Cart (' + obj.totalItems + ' items)');\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n cart.updateCounter();\n}", "function renderCart() {\n\n loadCart();\n clearCart();\n showCart();\n updateCounter();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n \n}", "function updateCart() {\r\n\t$('PUTCARTHERE').innerHTML = 'Updating - please wait!';\r\n//This is the update for the hidden cart element.\r\n\tvar postBody = 'm=RenderElement&format=WRAPPER&docid='+DOCID+'&element=IMAGECART&targetDiv=PUTCARTHERE';\r\n\tnew Ajax.Request('/ajax/RenderElement', { postBody: postBody, asynchronous: 1,\r\n\t\tonComplete: function(request){handleResponse(request.responseText);} });\r\n\r\n//this is the update for the visible cart element.\r\n\tvar postBody = 'm=RenderElement&format=WRAPPER&docid='+DOCID+'&element=VISIBLE_CART_ELEMENT&targetDiv=VISIBLE_CART';\r\n\tnew Ajax.Request('/ajax/RenderElement', { postBody: postBody, asynchronous: 1,\r\n\t\tonComplete: function(request){handleResponse(request.responseText);} });\r\n\r\n\t}", "refreshContent(remove) {\n const $cartItemsRows = $('[data-item-row]', this.$cartContent),\n options = {\n template: {\n content: 'cart/content',\n totals: 'cart/footer',\n }\n };\n\n // Remove last item from cart? Reload\n if (remove && $cartItemsRows.length == 1) {\n return window.location.reload();\n }\n\n utils.api.cart.getContent(options, (err, response) => {\n\n this.$cartContent.html(response.content);\n this.$cartTotals.html(response.totals);\n\n const quantity = $('[data-cart-quantity]', this.$cartContent).data('cart-quantity') || 0;\n this.bindEstimatorEvents();\n this.giftWrap.init();\n this.$cartContent.removeClass('deactivated');\n this.$cartTotals.removeClass('deactivated');\n $('body').trigger('cart-quantity-update');\n });\n }", "function renderCart() {\r\n loadCart();\r\n clearCart();\r\n showCart();\r\n}", "function renderCartItems() {\r\n\t var $cartItemContainer = $('.cart-item-container');\r\n\t $cartItemContainer.empty();\r\n\t var lineItemEmptyTemplate = $('#CartItemTemplate').html();\r\n\t var $cartLineItems = cart.lineItems.map(function (lineItem, index) {\r\n\t return renderCartItem(lineItem);\r\n\t });\r\n\t $cartItemContainer.append($cartLineItems);\r\n\r\n\t setTimeout(function () {\r\n\t $cartItemContainer.find('.js-hidden').removeClass('js-hidden');\r\n\t }, 0)\r\n\t updateTotalCartPricing();\r\n\t }", "function renderCart() {\n loadCart();\n showCart();\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n const item = selectElement.options[selectElement.selectedIndex].text;\n const quantity = parseInt(document.getElementById('quantity').value);\n createTheElement('p', `Item: ${item} \\u00A0 \\u00A0 \\u00A0 Quantity: ${quantity}`, cartContents);\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n\n //create for process order\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n let product = document.getElementById('items').value;\n let quantity = document.getElementById('quantity').value;\n // TODO: Add a new element to the cartContents div with that information\n let cartContents = document.querySelector('#cartContents');\n let newContent = document.createElement('p');\n newContent.innerText = `${quantity}: ${product}`;\n cartContents.appendChild(newContent);\n\n}", "function refreshCart(){\n var cartBody = $(\".cartBody\")\n // var cartList = cartBody.find(\".cartList\")\n var subtotal = $(\".subtotal\")\n var total = $(\".total\")\n\n $.ajax({\n url: \"/api/cart/\",\n method: \"GET\",\n success: function(data){\n var removeForm = $(\".remove-form\");\n var length = data.products.length;\n\n if (length > 0){\n cartBody.html(\" \");\n i = length\n $.each(data.products, function(index, value){\n var productRemoveForm = removeForm.clone();\n productRemoveForm.find(\".product_id\").val(value.id);\n console.log(productRemoveForm.html());\n cartBody.prepend('<tr><th scope=\"row\">'+ i +'</th><td><a href=\"'+value.url+'\">'+value.name+'</a>'+productRemoveForm.html()+'</td><td>'+value.price+'</td></tr>')\n i--\n });\n total.text(data.total);\n subtotal.text(data.subtotal);\n } else {\n console.log(\"else \");\n console.log(window.location.href);\n window.location.href='./';\n }\n },\n\n error: function(errorData){\n alert(\"An Error Occured\")\n // console.log(\"error\")\n // console.log(errorData)\n },\n })\n }", "function updateCartPreview(productName, productQuantity) {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n\n const cartContentsDiv = document.getElementById('cartContents');\n // pointer to where you will be putting the element, \"parent\"\n const productDivElem = document.createElement('div');\n // creating the child element\n productDivElem.textContent = productName;\n\n\n cartContentsDiv.appendChild(productDivElem);\n // populating the child element, appending to parent\n\n // lazy loaded, not loaded until they're called\n}", "function renderCartItem(lineItem) {\r\n\t var lineItemEmptyTemplate = $('#CartItemTemplate').html();\r\n\t var $lineItemTemplate = $(lineItemEmptyTemplate);\r\n\t var itemImage = lineItem.image.src;\r\n\t // console.log(lineItem.product_id);\r\n\t // console.log(lineItem);\r\n\t // client.fetchProduct(lineItem.product_id).then(product => {\r\n\t // \tconsole.log(product)\r\n\t // });\r\n\t $lineItemTemplate.attr('data-variant-id', lineItem.variant_id);\r\n\t $lineItemTemplate.addClass('js-hidden');\r\n\t $lineItemTemplate.find('.cart-item__img').css('background-image', 'url(' + lineItem.image.src + ')');\r\n\t $lineItemTemplate.find('.cart-item__title').text(lineItem.title);\r\n\t $lineItemTemplate.find('.cart-item__variant-title').text(lineItem.variant_title);\r\n\t $lineItemTemplate.find('.cart-item__price').text(formatAsMoney(lineItem.line_price));\r\n\t $lineItemTemplate.find('.cart-item__quantity').attr('value', lineItem.quantity);\r\n\t $lineItemTemplate.find('.quantity-decrement').attr('data-variant-id', lineItem.variant_id);\r\n\t $lineItemTemplate.find('.quantity-increment').attr('data-variant-id', lineItem.variant_id);\r\n\r\n\t return $lineItemTemplate;\r\n\t }", "function updateCart(cartJson) {\n \n console.log(\"Update cart\");\n \n // Handle the Json Object, parse its properties\n var jsonCart = JSON.parse(cartJson.data);\n var generated = jsonCart.cart.generated;\n \n if (generated > lastCartUpdate) {\n \n lastCartUpdate = generated;\n \n // Clear the HTML list used to display the cart contents\n var contents = document.getElementById(\"contents\");\n contents.innerHTML = \"\";\n \n // Loop over the items in the cart\n var items = jsonCart.cart.cartItem;\n for (var I = 0 ; I < items.length ; I++) {\n var item = items[I];\n \n // Extract the text nodes from the name and quantity elements\n var name = item.name;\n var quantity = item.quantity;\n \n // Create and add a list item HTML element for this cart item\n var listItem = document.createElement(\"li\");\n listItem.appendChild(document.createTextNode(name+\" x \"+quantity));\n contents.appendChild(listItem);\n }\n }\n \n // Update the cart's total using the value from the cart document\n document.getElementById(\"total\").innerHTML = jsonCart.cart.total;\n}", "function renderCart() {\n var prices = [];\n\n cartContent.innerHTML = \"\";\n\n cart.items.forEach(function(item) {\n var itemPrice = parseFloat(item.price.replace(\"$ \", \"\")),\n itemQuantity = parseInt(item.quantity);\n\n prices.push(itemPrice * itemQuantity);\n cartContent.innerHTML += \"<li class='cart-item' id='cart-\" + item.id + \"'><p class='cart-item-name'>\" + item.name + \"</p><img class='cart-item-img' src='http://vignette1.wikia.nocookie.net/clubpenguin/images/5/5f/Red_X.png/revision/latest?cb=20120514130731'><input type='number' class='inset quantity' min='0' max='50' value=\" + item.quantity + \"></li>\";\n })\n\n var totalPrice = prices.reduce(function(a, b) {\n return a + b;\n }, 0);\n\n cart.total = totalPrice.toFixed(2);\n cartTotal.innerHTML = \"$ \" + cart.total;\n }", "function renderCart(cart, container) {\n var idx, item;\n \n //empty the container of whatever is there currently\n container.empty();\n\n //for each item in the cart...\n var instance;\n var subTotal = 0;\n var str;\n for (idx = 0; idx < cart.items.length; ++idx) {\n item = cart.items[idx];\n subTotal += +item.price; //Unary operator convert to int\n instance = $(\"#template-cart-item\").clone();\n\n //Concatenate display string\n str = item.name + \" (\";\n if (item.size != null) {\n \tstr += item.size + \" - \";\n }\n str += \"$\" + item.price + \")\";\n\n\t\t//Display the cart item\n instance.html(\"<img src=img/x.png>\" + str);\n\t\tvar tempImg = instance.find(\"img\");\n\t\ttempImg.attr(\"data-index\", idx);\n\t\ttempImg.addClass(\"delete-me\");\n\n instance.removeClass(\"js-template\");\n\t\tcontainer.append(instance);\n\n\t\t//Delete item from cart\n\t\t$(\".delete-me\").click(function() {\n\t\t var idxToRemove = +(this.getAttribute('data-index'));\n\t\t cart.items.splice(idxToRemove, 1);\n\t renderCart(cart, $('.cart-container'));\n\t\t});\n } //for each cart item\n\n\n $(\"#cart-sub-total\").html(\"Sub-Total: $\" + subTotal);\n var tax = (subTotal * .095).toFixed(2);\n $(\"#cart-tax\").html(\"Tax: $\" + tax);\n $(\"#cart-total\").html(\"Total: $\" + (+subTotal + +tax)); //Unary operators convert to int\n} //renderCart()", "function updateCart(cartJSON) {\n // Get the entire json object from the document\n var cartJsonObj = jsonParse(cartJSON);\n // Read cart generated timestamp value from cartJsonObj\n var generated = cartJsonObj[\"cart generated\"];\n // Check that a more recent cart document hasn't been processed\n // already\n if (generated > lastCartUpdate) {\n lastCartUpdate = generated;\n\n // Clear the HTML list used to display the cart contents\n var contents = document.getElementById(\"contents\");\n contents.innerHTML = \"\";\n\n // Fetch items array from cartJsonObj\n var items = cartJsonObj.items;\n selectedFeeds = new Array();\n // Loop over the items fetched\n for (var I = 0; I < items.length; I++) {\n\n var item = items[I];\n // Extract the values of name and quantity from item json object\n var name = item.name;\n\n selectedFeeds.push(item[\"item code\"]);\n // Create and add a list item HTML element for this cart item\n var listItem = document.createElement(\"li\");\n listItem.appendChild(document.createTextNode(name));\n contents.appendChild(listItem);\n }\n\n }\n // Update the cart's total using the value from the cartJsonObj\n document.getElementById(\"total\").innerHTML = cartJsonObj.total;\n}", "function renderCart(cart, container) {\n var idx, item;\n\n \n //empty the container of whatever is there currently\n container.empty();\n\n //for each item in the cart...\n var template = $('.cart-item-template');\n var instance;\n for (idx = 0; idx < cart.items.length; ++idx) {\n item = cart.items[idx];\n\n //TODO: code to render the cart item\n instance = template.clone();\n instance.find('.title').html(item.name);\n instance.find('.price').html(item.price);\n instance.find('.size').html(item.size);\n instance.find('.remove-item').attr({\n 'data-index': idx \n });\n container.append(instance);\n\n\n\n } \n\n $('.remove-item').click(function(){\n var idxToRemove = this.getAttribute('data-index');\n cart.items.splice(idxToRemove, 1);\n renderCart(cart, $('.cart-items-container'));\n });\n\n\n var total = 0;\n for(var idx = 0; idx < cart.items.length; idx++){\n var item = cart.items[idx].price;\n total += parseInt(item);\n\n }\n\n var num = total * 0.095;\n var taxes = num.toFixed(2);\n var grandTotal = parseFloat(total) + parseFloat(taxes);\n\n $('.total-price').html(total);\n $('.total-tax').html(taxes);\n $('.total-grand').html(grandTotal);\n\n //TODO: code to render sub-total price of the cart\n //the tax amount (see instructions), \n //and the grand total\n\n\n} //renderCart()", "function handleCart(eachProduct) {\n var cartItemsContainer = document.querySelector('.cart-container .cart-items');\n var itemToAdd = '<li class=\"list-group-item\"><div class=\"item d-flex justify-content-between\" id=\"%id%\"><div class=\"item-img\"><img src=\"img/%img-path%\" alt=\"item-img\" width=\"40\"></div><div class=\"item-name text-left text-truncate\">%item-name%</div><div class=\"item-price text-left text-muted\">%item-price%</div><div class=\"each-item-numbers w-50\"><select class=\"numberOfItems\"><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"5+\">5+</option></select></div><img src=\"../img/icons/x-circle.svg\" class=\"remove-cart-item\"></div></li>';\n\n console.log(eachProduct)\n\n var item = itemToAdd.replace('%id%', eachProduct.id);\n item = item.replace('%img-path%', eachProduct.img);\n item = item.replace('%item-name%', eachProduct.name);\n item = item.replace('%item-price%', eachProduct.price);\n cartItemsContainer.innerHTML += item;\n }", "function renderCart(cartItems) {\n let cartContainer = document.querySelector(\"#cart\");\n cartContainer.innerHTML = \"\";\n if (cartItems.length > 0) {\n cartItems.map((cartItem) => {\n cartContainer.innerHTML += `\n <div class = \"products\">\n <img src=\"${cartItem.image}\" class = \"product-image\">\n <div class = \"product-content\"> \n <h4 class = \"product-title\"> ${cartItem.product_name}</h4>\n <p class = \"product-description\"> ${cartItem.brand}</p>\n <p class = \"product-price\">R${cartItem.price} </p>\n <button class =\"revome_cart\" onclick=\"removeItem(${cartItems.prod_id})\">Remove item</button>\n </div>\n \n </div>\n \n \n `;\n });\n let totalPrice = cartItems.reduce((total, item) => total + item.price, 0);\n cartContainer.innerHTML += `<h3> Your total is: ${totalPrice} </h3>`;\n } else {\n cartContainer.innerHTML = \"<h2> No items in cart</h2>\";\n }\n}", "function updateCartPreview() {\n // DONE: Get the item and quantity from the form\n // DONE: Add a new element to the cartContents div with that information\n\n var itemAddedDisplayEl = document.getElementById('cartContents');\n var itemsEl = document.getElementById('items').value;\n var quantityEl = document.getElementById('quantity').value;\n itemAddedDisplayEl.textContent ='Item: ' + itemsEl + ' Quantity: ' + quantityEl;\n}", "function displayCart(){\r\n let cartItems = localStorage.getItem(\"productsInCart\");\r\n cartItems = JSON.parse(cartItems);\r\n let productContainer = document.querySelector\r\n (\".product\");\r\n let cartCost = localStorage.getItem('totalCost');\r\n\r\n console.log(cartItems);\r\n if( cartItems && productContainer){\r\n productContainer.innerHTML = '';\r\n Object.values(cartItems).map(item =>{\r\n productContainer.innerHTML += ` \r\n <div class = \"product\">\r\n <ion-icon name=\"close-circle\"></ion-icon>\r\n <span>${item.name}M</span>\r\n </div>\r\n <div class=\"price\">P${item.price}.00</div>\r\n <div class=\"quantity\">\r\n <span>${item.inCart}</span>\r\n </div>\r\n <div class=\"total\">\r\n P${item.inCart * item.price}.00\r\n </div> \r\n `;\r\n });\r\n\r\n productContainer.innerHTML += ` \r\n <div class=\"basketTotalContainer\">\r\n <h4 class=\"basketTotalTitle\">\r\n Basket Total\r\n </h4>\r\n <h4 class=\"basketTotal\">\r\n P${cartCost}.00\r\n </h4>\r\n `;\r\n }\r\n}", "function updateCart(cartJSON) {\n \n var shopCart = jsonParse(cartJSON);\n var generated = shopCart.generated;\n \n if (generated > lastCartUpdate) {\n lastCartUpdate = generated;\n var contents = document.getElementById(\"contents\");\n contents.innerHTML = \"\";\n\n var cartItems = shopCart.cart;\n for (var i in cartItems) {\n if (i%2 == 1) {\n var itemDetails = cartItems[i];\n \n var name = itemDetails.name;\n var quantity = itemDetails.quantity;\n\n var listItem = document.createElement(\"li\");\n listItem.appendChild(document.createTextNode(name+\" x \"+quantity));\n contents.appendChild(listItem);\n }\n }\n\n }\n\n document.getElementById(\"total\").innerHTML = shopCart.total;\n}", "function updateCart($){\n \n var data = { \n getBlocks: {}\n };\n\n // add placeholders\n var counter = 0;\n $('.placeholder').each(function() {\n var id = $(this).attr('id');\n if (!id) {\n // create dynamic id\n id = 'ph_' + counter;\n $(this).attr('id', id);\n }\n var rel = $(this).attr('rel');\n if (rel) {\n data.getBlocks[id] = rel;\n counter++;\n } else {\n throw 'Found placeholder without rel attribute';\n }\n });\n\n // add current product\n if (typeof CURRENTPRODUCTID !== 'undefined' && CURRENTPRODUCTID) {\n data.currentProductId = CURRENTPRODUCTID;\n }\n\n // E.T. phone home\n\t\tif(typeof(AJAXHOME_URL) != undefined) {\n\t\t\tif (typeof data.currentProductId !== 'undefined' || counter > 0) {\n\t\t\t\t$.get(\n\t\t\t\t\tAJAXHOME_URL,\n\t\t\t\t\tdata,\n\t\t\t\t\tfunction (response) {\n\t\t\t\t\t\tfor(var id in response.blocks) {\n\t\t\t\t\t\t\t$('#' + id).html(response.blocks[id]);\n\t\t\t\t\t\t\tresponse.blocks[id].evalScripts();\n\t\t\t\t\t\t}\n\t\t\t\t\t// inject session if (TODO: check if this is really needed)\n\t\t\t\t\t// $.cookie('frontend', response.sid, { path: '/' });\n\n\t\t\t\t\t// TODO: trigger event\n\t\t\t\t\t},\n\t\t\t\t\t'json'\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\n}", "function displayCart() {\r\n\tlet cartItems = localStorage.getItem(\"productsInCart\");\r\n\tcartItems = JSON.parse(cartItems);\r\n\tlet productContainer = document.querySelector(\".products\");\r\n\tif(cartItems && productContainer) {\r\n\t\tproductContainer.innerHTML = '';\r\n\t\tObject.values(cartItems).map(item => {\r\n\t\t\tproductContainer.innerHTML += `\r\n\t\t\t<div class=\"product\">\r\n\t\t\t\t<ion-icon name=\"close-circle\"></ion-icon>\r\n\t\t\t\t<img src=\"./images/${item.tag}.jpg\">\r\n\t\t\t\t${item.name}\r\n\t\t\t</div>\r\n\t\t\t<div class=\"price\">\r\n\t\t\t\tPrice per: ${item.price}\r\n\t\t\t</div>\r\n\t\t\t<div class=\"quantity\"> \r\n\t\t\t\tAmount: ${item.inCart}\r\n\t\t\t</div>\r\n\t\t\t<div class=\"total\">\r\n\t\t\t\tTotal: ${item.inCart * item.price}\r\n\t\t\t</div>\r\n\t\t\t\r\n\t\t\t`\r\n\t\t\t});\r\n\t\t\t\r\n\t\t}\r\n}", "function loadCartResponseREST(xhr) {\r\n\tvar cart=JSON.parse(xhr.responseText);\r\n\tvar theTable=\"<table border='1'>\";\r\n\tfor (var i=0; i<cart.count; i++) {\r\n\t\ttheTable+=\"<tr><td>\";\r\n\t\ttheTable+=cart.items[i].name;\r\n\t\ttheTable+=\"</td><td>\";\r\n\t\ttheTable+=cart.items[i].count;\r\n\t\ttheTable+=\"</td><td>\";\r\n\t\ttheTable+=\"$\"+cart.items[i].cost;\r\n\t\ttheTable+=\"</td><td><button onClick=\\\"removeItemForCustomer('\";\r\n\t\ttheTable+=cart.items[i].name;\r\n\t\ttheTable+=\"')\\\">Remove from cart</button>\";\r\n\t\ttheTable+=\"</td><td><button onClick=\\\"removeItemForCustomerREST('\";\r\n\t\ttheTable+=cart.items[i].name;\r\n\t\ttheTable+=\"')\\\">Remove from cart REST</button>\";\r\n\t\ttheTable+=\"</td></tr>\";\r\n\t}\r\n\ttheTable+=\"<tr><td>Totals</td><td>\";\r\n\ttheTable+=cart.totalItemCount;\r\n\ttheTable+=\"</td><td>\";\r\n\ttheTable+=\"$\"+cart.totalCost;\r\n\ttheTable+=\"</td><td/></tr>\";\r\n\ttheTable+=\"<tr><td>Reward Points:</td><td colspan=\\\"3\\\">\";\r\n\ttheTable+=cart.rewards;\r\n\ttheTable+=\"</td></tr></table>\";\r\n\tvar inventoryListingsDiv = document.getElementById(\"cartListingsDiv\");\r\n\tinventoryListingsDiv.innerHTML=theTable;\r\n}", "function updateAddToCartText() {\n var addToCart = $(ADD_TO_CART_INNER_SEL)[0];\n\n if (!addToCart) {\n return;\n }\n\n var addToCartHTML = addToCart.innerHTML;\n\n if ((/add(ing|ed)/i).test(addToCartHTML)) {\n setTimeout(updateAddToCartText, 100);\n return;\n }\n\n addToCart.innerHTML = ADD_TO_CART_HTML;\n}", "function renderCart(cartItems) {\n let cartContainer = document.querySelector(\"#cart\");\n cartContainer.innerHTML = \"\";\n if (cartItems.length > 0) {\n \n cartItems.map((cartItem) => {\n cartContainer.innerHTML += `\n <div class = \"products\"> \n <div class=\"image-div\">\n <img src=\"${cartItem.image}\" class = \"product-image\">\n </div>\n <div class=\"cart-content\">\n <div class = \"product-content\"> \n \n <h4 class = \"product-title\"> ${cartItem.product_name}</h4>\n <p class = \"product-description\"> ${cartItem.brand}</p>\n <p class = \"product-price\">R${cartItem.price} </p>\n </div>\n\n <div class=\"cart-btns\">\n <button class =\"revome_cart\" onclick=\"removeItem(${cartItem.prod_id})\">Remove item</button>\n <button class=\"checkout-button\" onlcick=\"\">Checkout</button>\n </div>\n\n <div class=\"container\">\n\t\t\t\t <input type=\"button\" onclick=\"decrementValue()\" value=\"-\" />\n\t\t\t\t <input type=\"text\" name=\"quantity\" value=\"1\" maxlength=\"2\" max=\"10\" size=\"1\" id=\"number\" />\n\t\t\t\t <input type=\"button\" onclick=\"incrementValue()\" value=\"+\" />\n\t\t\t\t </div>\n </div>\n \n \n \n \n \n </div>\n\t\t\t \n\t\t \n\n `;\n });\n let totalPrice = cartItems.reduce((total, item) => total + item.price, 0);\n cartContainer.innerHTML += `<h3> Your total is: ${totalPrice} </h3>`;\n } else {\n cartContainer.innerHTML = \"<h2> No items in cart</h2>\";\n }\n}", "function displayQuote(responseJson){\r\n console.log(responseJson);\r\n $('#quote').empty();\r\n if (responseJson.quoteResponse.result.length === 0){\r\n $('#js-quote-error-message').text(`We don't recognize that ticker. Please try another`);\r\n } else {\r\n const currentStock = responseJson.quoteResponse.result[0];\r\n $('#js-quote-error-message').empty();\r\n $('#quote').html(\r\n `<h3 class=\"long-name\">${currentStock.longName}</h3>\r\n <hr>\r\n <div class=\"group\">\r\n <div class=\"item\">Ticker: ${currentStock.symbol}</div>\r\n <div class=\"item\">Current Price: ${currentStock.regularMarketPrice} </div>\r\n <div class=\"item\">% Change: ${currentStock.regularMarketChangePercent.toFixed(2)}</div>\r\n </div>\r\n <hr>\r\n `\r\n )\r\n $('#quote').removeClass('hidden');\r\n }\r\n \r\n}", "function refreshcart() {\n var cartTable = $(\".cart-table\");\n var cartBody = $(\".cart-body\");\n var cartTotal = $(\".cart-total\");\n var productRow = cartBody.find(\".cart-product\");\n var currentUrl = window.location.href;\n\n //Creating our ajax for cart refresh\n var refreshCartUrl = \"/api/cart\";\n var refreshCartMethod = \"GET\";\n var data = {};\n\n $.ajax({\n url: refreshCartUrl,\n method: refreshCartMethod,\n data: data,\n success: function (data) {\n var hiddenCartItemRemoveForm = $(\".cart-item-remove-form\");\n if (data.products.length > 0) {\n productRow.html(\"\");\n i = data.products.length;\n $.each(data.products, function (index, value) {\n var newCartItemRemove = hiddenCartItemRemoveForm.clone();\n newCartItemRemove.css(\"display\", \"block\");\n newCartItemRemove.find(\".cart-item-product-id\").val(value.id);\n\n cartBody.prepend(\n \"<tr class='cart-product'><td><a href='\" +\n value.url +\n \"'><figure class='media'><div class='img-wrap'><img src='\" +\n value.image +\n \"' class='img-thumbnail img-sm'/></div><figcaption class='media-body'> <h6 class='title text-truncate'> <a href='\" +\n value.url +\n \"'>\" +\n value.name +\n \"</a></h6></figcaption> </figure></a></td><td><div class='price-wrap'><var class='price'>GHC\" +\n value.price +\n \"</var></div></td><td class='text-right'>\" +\n newCartItemRemove.html() +\n \"</td> </tr>\"\n );\n i--;\n });\n //End f looping through products\n\n cartTotal.text(data.total);\n } else {\n window.location.href = currentUrl;\n }\n },\n error: function (errorData) {\n $.alert({\n title: 'Sorry',\n content: 'An Error Occured',\n theme: 'dark'\n })\n }\n }); //End of ajax for refresh cart\n }", "function showProducts(response) {\n // console.log(response);\n // define local variables for headers and html\n // let headers = Object.keys(response.products[0]);\n let products = response.products;\n // id, title, price, desc are all the same for all the showProducts\n let html = \"\";\n // loop through products and create card for each\n for (let i=0; i<products.length; i++) {\n // open row for each third product\n if (i % 3 == 0) {\n html += '<div class=\"row\">'\n }\n html += `\n <div class=\"card col-md-4\">\n <div class=\"card-img-top\">\n <img src=\"http://placehold.it/1x1\" alt=\"Placeholder\" class=\"card-img\" />\n </div>\n <div class=\"card-title\">${products[i].title}</div>\n <div class=\"card-subtitle\">$${products[i].price}</div>\n <div class=\"card-text\">${products[i].description}</div>\n <button onclick=\"addToCart(${products[i].id})\" class=\"btn btn-primary\">Add To Cart</button>\n </div> <!-- End of card -->\n `;\n // close row after three products have been added\n // because 0,1,2 is a row, use i+1 to check if your are at the end of the row\n if ((i + 1) % 3 == 0) {\n html += '</div>';\n }\n }\n // inject html string into products using the html variable we created above\n $(\"#products\").html(html);\n}", "static get template() {\n\t\treturn html `\n\t\t\t<style include=\"fairshop-styles\">\n\t\t\t\t#backBtn {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tright: 1.2rem;\n\t\t\t\t\ttop: 5rem;\n\t\t\t\t\t_background-color: var(--paper-grey-50);\n\t\t\t\t\tz-index: 50;\n\t\t\t\t}\n\t\t\t\t#shopping,\n\t\t\t\t#cartTable,\n\t\t\t\t#cartButtons {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tmin-height: 3rem;\n\t\t\t\t}\n\t\t\t\t#cartButtons {\n\t\t\t\t\tmargin-top: 2rem;\n\t\t\t\t}\n\t\t\t\t.sum {\n\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\ttext-align: right;\n\t\t\t\t\tmargin-right: 3.8rem;\n\t\t\t\t}\n\t\t\t\t.item {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tborder-bottom: solid;\n\t\t\t\t\tborder-width: .5px;\n\t\t\t\t\tborder-color: #888;\n\t\t\t\t}\n\t\t\t\t.item>div {\n\t\t\t\t\tpadding: .5rem;\n\t\t\t\t}\n\t\t\t\tfairshop-image {\n\t\t\t\t\twidth: 4rem;\n\t\t\t\t\theight: 4rem;\n\t\t\t\t}\n\t\t\t\t.item>.image {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t\tpadding: 0 .5rem;\n\t\t\t\t}\n\t\t\t\t.prod-id {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t}\n\t\t\t\t.name {\n\t\t\t\t\tflex-grow: 4;\n\t\t\t\t}\n\t\t\t\t.count {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.one-price {\n\t\t\t\t\twidth: 6rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.all-netto-price {\n\t\t\t\t\twidth: 6rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.discount {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.tax {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.all-price {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t}\n\t\t\t\t.remove {\n\t\t\t\t\twidth: 5rem;\n\t\t\t\t}\n\t\t\t</style>\n\n\t\t\t<fairshop-cart-service id=\"cartService\" rest-url=\"[[restUrl]]\" toast=\"[[toast]]\" session=\"[[session]]\" unauthorized=\"{{unauthorized}}\" csrf=\"{{csrf}}\" image-url=\"[[imageUrl]]\" cart=\"{{_cart}}\"></fairshop-cart-service>\n\t\t\t\n\t\t\t<paper-button id=\"backBtn\" aria-label=\"Go back\" on-click=\"_goBack\" raised>Weiter einkaufen</paper-button>\n\n\t\t\t<h1>Warenkorb</h1>\n\n\t\t\t<h2>Artikelliste</h2>\n\t\t\t<!-- Table header -->\n\t\t\t<div class=\"item\">\n\t\t\t\t<div class=\"image\">&nbsp;</div>\n\t\t\t\t<div class=\"prod-id\"><h3>ID</h3></div>\n\t\t\t\t<div class=\"name\"><h3>Name</h3></div>\n\t\t\t\t<div class=\"count\"><h3>Anzahl</h3></div>\n\t\t\t\t<div class=\"one-price\"><h3>UVP</h3></div>\n\t\t\t\t<div class=\"discount\"><h3>Rabatt</h3></div>\n\t\t\t\t<div class=\"all-netto-price\"><h3>Netto</h3></div>\n\t\t\t\t<div class=\"tax\"><h3>MwSt.</h3></div>\n\t\t\t\t<div class=\"all-price\"><h3>Brutto</h3></div>\n\t\t\t\t<div class=\"remove\">&nbsp;</div>\n\t\t\t</div>\n\t\t\t<div id=\"cartTable\">\n\t\t\t\t<!-- Items go here -->\n\t\t\t\t<template is=\"dom-repeat\" items=\"[[_cart.items]]\" as=\"item\">\n\t\t\t\t\t<fairshop-cart-item rest-url=\"[[restUrl]]\" image-url=\"[[imageUrl]]\" cart=\"{{_cart}}\" item=\"{{item}}\"></fairshop-cart-item>\n\t\t\t\t</template>\n\t\t\t</div>\n\t\t\t<!-- Table footer -->\n\t\t\t<div class=\"item\">\n\t\t\t\t<div class=\"image\">&nbsp;</div>\n\t\t\t\t<div class=\"prod-id\">&nbsp;</div>\n\t\t\t\t<div class=\"name\">Artikelzahl: [[_cart.count]]</div>\n\t\t\t\t<div class=\"count\"><h3>Summe</h3></div>\n\t\t\t\t<div class=\"one-price\"><h3>Netto:</h3></div>\n\t\t\t\t<div class=\"discount\"></div>\n\t\t\t\t<div class=\"all-netto-price\"><h3>[[_cart.nettoSum]]€</h3></div>\n\t\t\t\t<div class=\"tax\"><h3>Brutto:</h3></div>\n\t\t\t\t<div class=\"all-price\"><h3>[[_cart.sum]]€</h3></div>\n\t\t\t\t<div class=\"remove\">&nbsp;</div>\n\t\t\t</div>\n\n\t\t\t<div id=\"cartButtons\">\n\t\t\t\t<paper-button id=\"emptyCart\" on-click=\"_empty\">Leeren</paper-button>\n\t\t\t\t<paper-button id=\"buy\" on-click=\"_checkout\" raised>Kaufen</paper-button>\n\t\t\t</div>\n\t\t`;\n\t}", "function updateMiniCarts() {\n\t\tvar callbackCart = { \n\t\t\tsuccess : function(o) {\n\t\t\t\tcarts = document.getElementsByClassName( 'vmCartModule' );\n\t\t\t\tif( carts ) {\n\t\t\t\t\t\tfor (var i=0; i<carts.length; i++){\n\t\t\t\t\t\t\t\tcarts[i].innerHTML = o.responseText;\n\t\t\t\t\t\t\t\tnew Effect.Highlight( carts[i] );\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tfailure : function( hxr ) { alert( hxr.statusText ) }\n\t\t}\n\t\toption = { method: 'get', onSuccess: callbackCart.success,onFailure: callbackCart.failure }\n\t\tnew Ajax.Request('index2.php?only_page=1&page=shop.basket_short&option=com_virtuemart', option);\n\t\t\n}", "function getCart() {\r\n if (sessionStorage.getItem(\"vneck\") != null) {\r\n let cartItem1 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem1);\r\n cartItem1.innerHTML = sessionStorage.getItem(\"vneck\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"African\") != null) {\r\n let cartItem2 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem2);\r\n cartItem2.innerHTML = sessionStorage.getItem(\"African\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"kapi\") != null) {\r\n let cartItem3 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem3);\r\n cartItem3.innerHTML = sessionStorage.getItem(\"kapi\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"formal\") != null) {\r\n let cartItem4 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem4);\r\n cartItem4.innerHTML = sessionStorage.getItem(\"formal\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"fiasco\") != null) {\r\n let cartItem5 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem5);\r\n cartItem5.innerHTML = sessionStorage.getItem(\"fiasco\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"nice\") != null) {\r\n let cartItem6 = document.createElement(\"p\");\r\n whatsInCart.appendChild(cartItem6);\r\n cartItem6.innerHTML = sessionStorage.getItem(\"nice\");\r\n ItemStyler();\r\n }\r\n\r\n if (sessionStorage.getItem(\"design\") != null) {\r\n let choicesTotal = document.createElement(\"p\");\r\n cartPrice.appendChild(choicesTotal);\r\n choicesTotal.innerHTML = \"Total: R\" + myPrice;\r\n PriceStyler();\r\n\r\n } else { //Should the cart be empty, display the following message in a pragraph that is appended to the selected ID\r\n let empty = document.createElement(\"p\");\r\n empty.innerHTML = \"Your Cart is currently empty\";\r\n whatsInCart.appendChild(empty);\r\n ItemStyler();\r\n $(\"#orderOptions\").hide();\r\n $(\".firstBigHeading\").hide();\r\n }\r\n\r\n}", "function renderCart(cart, container) {\n var idx, item;\n var template = $('.cart-item-template');\n var instance;\n var subtotal = 0; //keeps track of subtotal of all items\n \n //empty the container of whatever is there currently\n container.empty();\n\n //for each item in the cart...\n for (idx = 0; idx < cart.items.length; ++idx) {\n item = cart.items[idx];\n instance = template.clone();\n\n instance.find('.title').html(item.name);\n instance.find('.price').html(item.price);\n instance.find('.remove-item').attr('data-index', idx);\n subtotal += parseInt(item.price, 10);\n console.log(subtotal);\n instance.removeClass('cart-item-template');\n container.append(instance);\n } //for each cart item\n\n //renders tax and total price for the order\n var tax = subtotal * 0.095; // calculate tax\n var total=subtotal+tax; //add tax to subtotal\n $('.subtotal-amount').html(subtotal.toFixed(2));\n $('.tax-amount').html(tax.toFixed(2));\n $('.total-price').html(total.toFixed(2));\n\n //removes the selected item from the cart and\n //re-renders it\n $('.remove-item').click(function(){\n var idxToRemove = this.getAttribute('data-index');\n cart.items.splice(idxToRemove, 1);\n\n renderCart(cart, $('.cart-container'));\n });\n\n} //renderCart()", "function processCartPage() {\n var _this = this;\n // Check current page is cart page\n if (!isCartPage()) {\n goToCartPage();\n return;\n }\n // Get the body element\n var content = document.querySelector(\"body\");\n var html = \"<body>\" + content.innerHTML + \"</body>\";\n (function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, sendCartDetailsToApi(html)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })();\n}", "function setCartHTML(cartProducts) {\n \n let cartEl = document.querySelector(\"#cart\");\n let fetches = [];\n\n // Permet d'ajouter l'article selectionner depuis le panier dans le panierHTML\n for (let index = 0; index < cartProducts.length; index++) {\n let cartProduct = cartProducts[index];\n fetches.push(\n\n // Ajout de l'id a l'url de l'API\n fetch(\"http://localhost:3000/api/furniture/\" + cartProduct.id)\n .then((resp) => resp.json())\n .then(function(data) {\n priceById[data._id] = data.price / 100;\n\n let articleHTML = `\n <div class=\"full_box\">\n\n <div class=\"box_2\" data-id=\"${data._id}\" data-varnish=\"${cartProduct.varnish}\">\n <a class=\"box_2_image\" href=\"info.html?id=${cartProduct.id}\">\n <img class=\"box_2_image_oak\" src=\"${data.imageUrl}\" />\n </a>\n <div class=\"box_2_name\">${data.name}</div>\n <div class=\"box_2_price\">${data.price / 100}€</div>\n <div class=\"box_2_details\">\n <a class=\"box_2_label_details\">Description du produit</a>\n ${data.description}</div>\n\n <form class=\"deleteFromCart\">\n <input type=\"hidden\" value=\"${data._id}\" name=\"id\" />\n <input type=\"hidden\" value=\"${cartProduct.varnish}\" name=\"varnish\" />\n <button class=\"deleteBtn\" type=\"submit\">Supprimer du panier</button>\n </form>\n </br>\n <form class=\"updateQuantity\">\n <input class=\"box__input\" type=\"number\" min=\"1\" value=\"${cartProduct.quantity}\" name=\"quantity\">\n <input type=\"hidden\" value=\"${data._id}\" name=\"id\" />\n <input type=\"hidden\" value=\"${cartProduct.varnish}\" name=\"varnish\" />\n </form>\n <div class=\"box_2_varnish\">\n <a class=\"box_2_label_varnish\">Varnish:</a>\n ${cartProduct.varnish}</div>\n </div>\n\n </div>\n `;\n \n cartEl.innerHTML = cartEl.innerHTML + articleHTML \n\n })\n ) \n }\n\n // Tous les fetch sont revenus\n Promise.all(fetches).then(function() {\n initdeleteFromCart();\n initUpdateQuantity();\n renderHtmlTotalPrice(getCart());\n })\n}", "function updateCartPreview() {\n\n // Get the item and quantity from the form\n\n var productPicked = document.getElementById('items').value;\n var quantityPicked = document.getElementById('quantity').value;\n \n // Add a new element to the cartContents div with that information\n\n var cartPreview = document.getElementById('cartContents');\n var itemInCart = document.createElement('h4');\n\n itemInCart.textContent= 'Item: ' + productPicked + '. Quantity Selected: ' + quantityPicked;\n\n cartPreview.appendChild(itemInCart);\n\n}", "function displayCart(){\n let cartItems = localStorage.getItem(\"productsInCart\");\n cartItems = JSON.parse(cartItems);\n let productContainer = document.querySelector(\".products\");\n let cartCost = localStorage.getItem('totalCost');\n if(cartItems && productContainer ){\n productContainer.innerHTML = '';\n Object.values(cartItems).map(item => {\n productContainer.innerHTML += `\n <div class=\"product\">\n <ion-icon name=\"close-circle-outline\"></ion-icon>\n <img scr=\"products/productsAlgemeen/dist/productFotos/${imagePath+images.Afbeeldingsnaam}.jpg\">\n <span>${item.Productnaam}</span>\n </div>\n <div class=\"price\">$${item.Eenheidsprijs},00</div>\n <div class=\"quantity\">\n <ion-icon class=\"decrease\" name=\"arrow-dropleft-circle\"></ion-icon>\n <span>${item.inCart}</span>\n <ion-icon class=\"increase\" name=\"arrow-dropright-circle\"></ion-icon>\n </div>\n <div class=\"total\">\n $${item.inCart * item.Eenheidsprijs},00\n </div>\n `;\n });\n\n productContainer.innerHTML += `\n <div class=\"basketTotalContainer\">\n <h4 class=\"basketTotalTitle\">Basket Total</h4>\n <h4 class=\"basketTotal\">€${cartCost},00</h4>\n `;\n\n }\n}", "function updateCarts() {\r\n\t$(\"#cart_items\").text('???');\r\n\r\n\t$.ajax({\r\n\t\turl : \"/procurement/pr/update-cart\",\r\n\t\tsuccess : function(text) {\r\n\t\t\tvar obj = eval(text);\r\n\t\t\tvar total_cart_items = obj['total_cart_items'];\r\n\r\n\t\t\t$(\"#cart_items\").text(total_cart_items);\r\n\t\t\t$(\"#cart_items\").attr('class', 'label label-warning');\r\n\t\t}\r\n\t});\r\n}", "function renderShoppingList() {\n // loop through store using map to generate html to be placed on page\n const items = STORE.map(listItemToHTML);\n // place html on page\n $('ul.shopping-list').html(items.join(''));\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n let quantity1 = document.getElementById('quantity');\n let iteam1 = document.getElementById('items');\n\n \n // TODO: Add a new element to the cartContents div with that information\n let cartContent = document.getElementById('cartContents');\n let pEle= document.createElement('p');\n pEle.textContent= quantity1.value +\" : \"+ iteam1.value; \n cartContent.appendChild(pEle);\n}", "function onGetMinicart (response) {\n var responseText = JSON.parse(response.responseText),\n cartTotal = 0;\n\n //calculate new minicart total\n for (var i = 0; i < responseText.length; i++) {\n cartTotal += +responseText[i].product.intPrice;\n } \n\n cartTotal = formatTotalPrice(cartTotal); // ex: \"1000\" -> \"$1,000\", for display purpose\n\n loadMinicartTemplate({\n cartTotal: cartTotal,\n productCount: responseText.length,\n cartProducts: responseText\n });\n }", "function appendToCart(){\n ui.cartItems.innerHTML = \"\";\n cart.forEach((item)=>{\n ui.appendToCart(item.imgSrc,item.title,item.size,item.price,item.id,item.numberOfUnits);\n })\n}", "function show(data) { \n let card = ``; \n \n // Loop through all products\n for (let p of data) { \n card += `\n <div class=\"card\">\n <a href=\"detail.html\">\n <img src=\"${p.image}\" alt=\"${p.name}\">\n </a> \n <h1>${p.name}</h1>\n <p class=\"price\">\\$${p.price}</p>\n <p>${p.description}</p>\n <button class=\"addToCart\">Add to Cart</button>\n </div>`; \n } \n // Setting innerHTML as card variable \n document.getElementById(\"productContainer\").innerHTML = card; \n}", "displayProductToTheCart(item) {\n const createDiv = document.createElement(\"div\");\n createDiv.classList.add(\"cart-item\");\n createDiv.innerHTML = ` \n <img src=${item.image} alt=\"product\">\n <div>\n <h4>${item.title}</h4>\n <h5>${item.price} Ft</h5>\n <span class=\"remove-item\" data-id=${item.id}>remove</span>\n </div>\n <div>\n <i class=\"fas fa-chevron-up\" data-id=${item.id}></i>\n <p class=\"item-amount\">${item.amount}</p>\n <i class=\"fas fa-chevron-down\" data-id=${item.id}></i>\n </div>`;\n cartContent.appendChild(createDiv);\n }", "function displayCart() {\n let cartItems = localStorage.getItem(\"productsInCart\");\n cartItems = JSON.parse(cartItems);\nconsole.log(cartItems);\nlet cartCost = localStorage.getItem(\"totalCost\");\nlet productContainer = document.querySelector(\".products\");\n\n\nif(cartIems && productContainer){\n productContainer.innerHTML = '';\n\n Object.values(cartItems)\n .map(item=>{productContainer.innerHTML += `<div class=\"product\"> <ion-icon name=\"close-circle\"></ion-icon>\n <img src=\"./images/${item.tag}.jpg\"> \n <span>${item.name}</span></div>`\n\n `<div class = \"price\">$${item.price}.00</div>`\n `<div class = \"quantity\"><ion-ionic class=\"decrease\" name=\"arrow-dropleft-circle\"></ion-icon>\n <span>${item.inCart}</span>\n\n <ion-ionic class=\"increase\" name=\"arrow-dropright-circle\"> </ion-icon></div>`\n `<div class=\"total\"> $${item.inCart * item.price},00 </div>` \n });\n\n productContainer.innerHTML += `<div class=\"basketTotalContanier\">\n <h4 class =\"basketTotalTitle\"> Basket Total </h4>\n <h4 class =\"basketTotal\">$${cartCost}.00 </h4>`;\nconsole.log(productContainer);\n}\n}", "function refresh_cart_fragment() {\n var $fragment_refresh = {\n url: wc_cart_fragments_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_refreshed_fragments' ),\n type: 'POST',\n data: {\n time: new Date().getTime()\n },\n timeout: wc_cart_fragments_params.request_timeout,\n success: function( data ) {\n if ( data && data.fragments ) {\n\n $.each( data.fragments, function( key, value ) {\n $( key ).replaceWith( value );\n });\n\n if ( $supports_html5_storage ) {\n sessionStorage.setItem( wc_cart_fragments_params.fragment_name, JSON.stringify( data.fragments ) );\n set_cart_hash( data.cart_hash );\n\n if ( data.cart_hash ) {\n set_cart_creation_timestamp();\n }\n }\n\n $( document.body ).trigger( 'wc_fragments_refreshed' );\n quantity_cart();\n }\n },\n error: function() {\n $( document.body ).trigger( 'wc_fragments_ajax_error' );\n }\n };\n $.ajax( $fragment_refresh );\n\n }", "function refreshCartMsg(cart,cartstatus,diffValue){\n\t// get headline locresource\n\tvar headlineText = null,\n\t\tcartContent = \"\";\n\n\t// get headline depending on Cart-Status\n\tswitch(cartstatus){\n\t\tcase 'success': headlineText= loctext[\"checkout.popup.headline.addedToCart\"]; break;\n\t\tcase 'warning_stock': headlineText=\tloctext[\"checkout.popup.headline.warning\"]; break;\n\t\tcase 'warning': headlineText= loctext[\"checkout.popup.headline.reducedValue\"]; break;\n\t\tcase 'error' :\theadlineText= loctext[\"checkout.popup.headline.error\"]; break;\n\t\tcase 'deleted': headlineText= loctext[\"checkout.popup.headline.deletedFromCart\"]; break;\n case 'bonusItem_Warning': headlineText= loctext[\"checkout.bonusitem.message.error\"]; break;\n\t\tdefault\t\t : headlineText= loctext[\"checkout.popup.headline.addedToCart\"]; break;\n\t}\n\n\t// Set new Title & replace param-placeholder\n\tif (document.getElementById(\"cartTitleText\")){\n\t\tdocument.getElementById(\"cartTitleText\").innerHTML = headlineText.replace(\"{0}\", diffValue);\n\t}\n\n\t// change Title Background (class)\n $(\".cart-popover\").removeClass('success');\n $(\".cart-popover\").removeClass('warning_stock');\n $(\".cart-popover\").removeClass('warning');\n $(\".cart-popover\").removeClass('error');\n $(\".cart-popover\").removeClass('deleted');\n $(\".cart-popover\").removeClass('bonusItem_Warning');\n $(\".cart-popover\").addClass(cartstatus);\n\n\n\t// show CART - added OR deleted OR reduced\n\tif(cartstatus === 'success' || (cartstatus === 'warning') || cartstatus === 'deleted' ){\n\t\t// Normal Cart\n\t\tcartContent += '<table class=\"table-cart\">';\n cartContent += '<thead><tr><th colspan=\"2\">' + loctext[\"checkout.popup.checkoutOverview\"] + '</th></tr></thead>';\n cartContent += '<tbody>';\n\t\tcartContent += '<tr><td class=\"label\" >'+loctext[\"checkout.popup.quantity\"]+'</td><td class=\"amount\"><span id=\"customerCartCountMsg\">'+cart.articleCount+'</span></td></tr>';\n\t\tcartContent += '<tr><td class=\"label\" >'+loctext[\"checkout.popup.shipping\"]+'</td><td class=\"amount\"><span id=\"customerCartShippingMsg\">'+cart.shippingCostsFormatted+'</span></td></tr>';\n\t\tcartContent += '<tr class=\"total\"><td class=\"label\" >'+loctext[\"checkout.popup.total\"]+'</td><td class=\"amount\"><span id=\"customerCartValueMsg\">'+cart.subTotalFormatted+'</span></td></tr>';\n\t\tcartContent += '</tbody>';\n\t}\n\n\t// if not that many Products in Stock get available Amount and display warning\n\tif(cartstatus === 'warning_stock'){\n\t\t//Warning Stock-Count Low\n\t\tcartContent += '<p>';\n\t\tcartContent += loctext[\"checkout.popup.message.stockWarning\"].replace(/\\{0\\}/g, diffValue);\n\t\tcartContent += '</p>';\n\t}\n\n\t// something goes wrong during AddToCart-Process\n\tif(cartstatus === 'error'){\n\t\t//Error - temporarily not available\n\t\tcartContent += '<p>';\n\t\tcartContent += loctext[\"checkout.popup.message.error\"];\n\t\tcartContent += '</p>'\t;\n\t}\n // According to less points and customer addeed many produts\n if(cartstatus === 'bonusItem_Warning'){\n\t\t//Error - temporarily not available\n\t\tcartContent += '<p>';\n\t\tcartContent += loctext[\"checkout.bonusitem.message.error\"];\n\t\tcartContent += '</p>'\t;\n\t}\n\n\t// change Content\n\tif (document.getElementById(\"cartContent\")){\n\t\tdocument.getElementById(\"cartContent\").innerHTML = cartContent;\n\t}\n}", "function displayCart() {\n let cartItems = JSON.parse(localStorage.getItem('inCart')) || [];\n console.log(cartItems)\n let items = document.getElementsByClassName(\"items\")\n console.log(items)\n if (cartItems && items) {\n items.innerHTML = '';\n Object.values(cartItems).map(item => {\n let newItem = \n `<div class=\"item\"> \n <img class=\"item-img\" src=\"${item.img}\"> \n <p class=\"item-roll\"> ${item.name} ${item.glaze}</p>\n <p class=\"item-price\"> $${item.price}.00 </p>\n <p class=\"item-quantity\">${item.qt } </p>\n <button class=\"remove\" ${onclick=removeItem()}>REMOVE</button>\n </div>`\n items.innerHTML += newItem\n console.log(items.innerHTML)\n })\n let total = '<div class = \"totalPrice\"> ${item.price}.00 </div> ' \n }\n}", "function checkout(response, request) {\n fs.readFile(\n __dirname + '/../view/checkout.html',\n function (error, htmlData) {\n if (error)\n throw error;\n fs.readFile('cart.txt', function (error, data) {\n if (error)\n throw error;\n var cookies = utils.parseCookies(request);\n var sid = cookies['sessionid'];\n var str = data.toString();\n if (!str) {\n\n str = '{}';\n }\n var cartData = JSON.parse(str);\n var cart = cartData[sid];\n var len = '(0)';\n if (cart.length) {\n\n len = 0;\n cart.forEach(function (element) {\n len += element.quantity;\n });\n len = '(' + len + ')';\n }\n var html = htmlData.toString().replace('{{ cart }}', JSON.stringify(cart));\n html = html.replace('{{ count }}', len);\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.write(html);\n response.end();\n });\n }\n );\n}", "function update_cart(data) {\n $.ajax({\n url: setting.ajax_url,\n type: 'post',\n data: {data: data, action: 'add_to_cart', _token: setting.token},\n success: function (resulf) {\n if (resulf) {\n resulf = JSON.parse(resulf);\n console.log(resulf);\n if (resulf['success']) {\n $('.mini-cart').text(cart.products ? cart.products.length : 0);\n location.href = setting.cart;\n }\n }\n }\n })\n}", "function updateCart(){\n\t\tstorage(['items', 'subtotal'], function(err, col){\n\t\t\t//console.log(\"Cart Collection - \" + JSON.stringify(col));\n\n\t\t\t//items = col[0];\n\t\t\t//subtotal = col[1];\n\n\t\t\tif(console) console.log(\"Items in Cart: \" + items);\n\t\t\tif(console) console.log(\"Subtotal of Cart: \" + subtotal);\n\t\t\t\n\t\t\t// update DOM Here\n\t\t\tdocument.getElementById( _options.itemsEleId ).innerHTML = items;\n\t\t\tdocument.getElementById( _options.subtotalEleId ).value = \"$\" + subtotal.toFixed(2);\n\n\t\t\t// reset default quantity input fields of products\n\t\t\tPRODUCTS.updateProducts();\n\t\t});\n\t}", "handleShoppingCartResponse(response) {\n this.$refs.spinner.hideSpinner();\n if (response && response.data) {\n this.shoppingCartData = response.data;\n if (this.shoppingCartData.appliedOrderPromotions) {\n this.shoppingCartData.appliedOrderPromotions.map((promotion) => {\n if (promotion.giveAwayCouponCodes.length && promotion.description) {\n this.giveAwayCouponDescription = promotion.description;\n }\n });\n }\n eventBus.$emit('cart-details', this.shoppingCartData.entries);\n cartEventBus.$emit('total-items-updated', response.data.totalItems);\n if (this.shoppingCartData.entries.length !== 0) {\n this.cartHasVisibleItems = true;\n } else {\n this.cartHasVisibleItems = false;\n }\n this.$root.$emit('cartHasVisibleItems', this.cartHasVisibleItems);\n this.$root.$emit('full-cart-called', this.shoppingCartData);\n this.$root.$emit('cart-reloaded', true);\n }\n }", "function updateCartGlaze() {\n var cartItems = sessionStorage.getObj(\"cartItems\"); // retrieve cart items\n for (var i = 0; i < cartItems.length; i++)\n {\n \tvar originalGlaze = document.getElementsByClassName(\"glaze2\")[i]; //retrieve glaze options in cart page\n \tvar currentGlaze = originalGlaze.options[originalGlaze.selectedIndex].text; //retrieve selected page\n \tvar currentPicture = document.getElementsByClassName(\"itemImage\")[i]; //retrieve displayed image\n\n // update displayed image of glaze\n \tif (currentGlaze==\"none\")\n \t{\n \t\tcurrentPicture.src=\"Assets/images/smallnone.png\";\n \t}\n \telse if (currentGlaze==\"vanilla-milk\")\n \t{\n \t\tcurrentPicture.src=\"Assets/images/smalloriginal.png\";\n \t}\n \telse if (currentGlaze==\"sugar-milk\")\n \t{\n \t\tcurrentPicture.src=\"Assets/images/smallsugar.png\";\n \t}\n \telse if (currentGlaze==\"double-chocolate\")\n \t{\n \t\tcurrentPicture.src=\"Assets/images/smallchoco.png\";\n \t}\n\n \tcartItems[i].glaze = currentGlaze; // update current selected glaze\n cartItems[i].image = currentPicture.src // update current picture\n \tsessionStorage.setObj(\"cartItems\", cartItems) //save changes to array\n }\n}", "function updateCart(){\n reset();\n cart.forEach(product =>{\n appendProduct(product);\n }); \n}", "function matchCartArraytoCartDisplay(){\n for (var item =0; item<cart.length; item++) {\n //add html\n $('.order').append(\"\\\n <div id='item'>\\\n <h3></h3>\\\n <p></p>\\\n </div>\\\n <div>\\\n <p></p>\\\n <p id='editor'> x </p>\\\n <p id='editor'> Edit </p>\\\n <p>\\\n </div>\");\n }\n}", "function updateShoppingCart(){\n\t\"use strict\";\n\n\t\t$j('body').bind('added_to_cart', add_to_cart);\n\t\tfunction add_to_cart(event, parts, hash) {\n\t\t\tvar miniCart = $j('.shopping_cart_header');\n\t\t\tif ( parts['div.widget_shopping_cart_content'] ) {\n\t\t\t\tvar $cartContent = jQuery(parts['div.widget_shopping_cart_content']),\n\t\t\t\t$itemsList = $cartContent .find('.cart_list'),\n\t\t\t\t$total = $cartContent.find('.total').contents(':not(strong)').text();\n\t\t\tminiCart.find('.shopping_cart_dropdown_inner').html('').append($itemsList);\n\t\t\tminiCart.find('.total span').html('').append($total);\n\t\t\t}\n\t\t}\n}", "function loadShoppingCart() {\n console.log('setShoppingcart')\n \n // reset cart and values\n document.getElementsByClassName('all-cart-product')[0].innerHTML = \"\";\n total_items = 0;\n total = 0;\n\n // render cartItem to cart\n for (var i= 0; i< cart.length; i++){\n\n //update total numer of items\n total_items = total_items + cart[i].quantity;\n\n //update total price\n total = total + (cart[i].price * cart[i].quantity);\n\n var display_individualisation = cart[i].hasIndividualisation === false ? 'none': 'block';\n\n var individualisationwrapper = '';\n for (var k = 0; k < cart[i].individualisation.length; k++){\n individualisationwrapper+= '<p style=\"display:'+display_individualisation+'; font-family: '+cart[i].individualisation[k].font+'; font-size: 1.1em;\">'+cart[i].individualisation[k].value+'</p>';\n }\n \n\n var div = document.createElement('div');\n div.className = \"single-cart clearfix\";\n div.innerHTML = '<div class=\"single-cart clearfix\">\\\n <div class=\"cart-photo\">\\\n <a href=\"#\"><img src=\"img/cart/'+ cart[i].image +'\" alt=\"\"></a>\\\n </div>\\\n <div class=\"cart-info\">\\\n <h5><a href=\"#\">'+ cart[i].productname +'</a></h5>\\\n <p class=\"mb-0\">#'+ cart[i].itemId +' </p>\\\n <p class=\"mb-0\"><span data-i18n=\"cart-price-label\">Preis:</span> '+ cart[i].price.toLocaleString('de-DE', {maximumFractionDigits: 2, minimumFractionDigits: 2, minimumIntegerDigits:1 }) +' €</p>\\\n <p class=\"mb-0\"><span data-i18n=\"cart-quantity-label\">Stück:</span> '+ cart[i].quantity +' </p>\\\n <p style=\"display:'+display_individualisation+'; class=\"mt-20\">'+ individualisationwrapper +' </p>\\\n <span data-cartItemId=\"'+cart[i].cartItemId +'\" onclick=\"removeItemfromCart(this)\" class=\"cart-delete\"><a href=\"#\"><i class=\"zmdi zmdi-close\"></i></a></span>\\\n <img style=\"display:'+display_individualisation+'; height:25px; width: 100%\" src=\"'+cart[i].decorImage+'\">\\\n </div>\\\n </div>'\n document.getElementsByClassName('all-cart-product')[0].appendChild(div);\n\n } // End for-loop\n\n // set badge number\n document.getElementsByClassName('cart-icon')[0].querySelector('span').innerHTML = total_items;\n\n //set number in detail hover view\n document.getElementsByClassName('cart-items')[0].querySelector('p').innerHTML = $.i18n( 'you have $1 {{plural:$1|item|items}} in your shopping bag', total_items );\n \n // render total price\n document.getElementsByClassName('cart-totals')[0].querySelector('span').innerHTML = total.toLocaleString('de-DE', {maximumFractionDigits: 2, minimumFractionDigits: 2, minimumIntegerDigits:1 }) + ' €';\n\n //disable cart button if cart is empty\n if(total_items === 0){\n document.getElementsByClassName('cart-bottom')[0].style.display = 'none';\n document.getElementsByClassName('all-cart-product')[0].style.display = 'none';\n \n }else{\n document.getElementsByClassName('cart-bottom')[0].style.display = 'block';\n document.getElementsByClassName('all-cart-product')[0].style.display = 'block';\n }\n \n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n let data = localStorage.getItem('cart');\n let parsedArray = JSON.parse(data);\n let list = document.getElementById('listContents')\n list.textContent = \"\"; \n let ddlProducts = document.getElementById(\"items\");\n for (let i = 0; i < parsedArray.length; i++) {\n let listElement = document.createElement('li');\n list.appendChild(listElement);\n listElement.textContent = `Selected item: ${parsedArray[i].product} with a quantity of: ${parsedArray[i].quantity}`;\n\n let idIMG = ddlProducts.options[ddlProducts.selectedIndex].id;\n let img = document.createElement('img');\n listElement.appendChild(img); \n img.src = Product.allProducts[idIMG].filePath;;\n img.width = 100;\n img.height = 100;\n //NOT FINISHED\n }\n\n}", "function view() {\n let main = document.querySelector('main .container');\n let header = document.querySelector('header');\n fetch('https://server-for-okr.herokuapp.com/',)\n //https://aqueous-shelf-54848.herokuapp.com/\n .then((response) => {\n console.log(response);\n return response.json();\n })\n .then((data) => {\n header.innerHTML = '';\n main.innerHTML = (\n DOMcreator('h3', 'IN CART') +\n DOMcreator('div',\n DOMcreator('div',\n DOMcreator('div', null, 'wrapper')\n , 'carousel'),\n 'catalog slides')\n );\n if (JSON.parse(window.localStorage.getItem('order')).cart.length===0){\n main.querySelector('.wrapper').innerHTML = (DOMcreator('div',DOMcreator('h2','EMPTY'),'item',{'style':'width: 100%'}));\n }\n for (let i in JSON.parse(window.localStorage.getItem('order')).cart) {\n console.log('print i '+i);\n for (let key in data) {\n data[key].forEach((product) => {\n if (JSON.parse(window.localStorage.getItem('order')).cart[i][0]===(product['id'])) {\n main.querySelector('.wrapper').innerHTML += (\n DOMcreator('div',\n DOMcreator('a', DOMcreator('img', null, null, {\n 'src': product['img'],\n 'alt': product['model']\n }), null, {'href': product['url']}) +\n DOMcreator('br') +\n DOMcreator('h2', product['brand']) +\n DOMcreator('br') +\n DOMcreator('h3', product['model']) +\n DOMcreator('br') +\n DOMcreator('p', product['price']) +\n DOMcreator('button', 'REMOVE', 'removebutton', null ,''+product['id'])\n , 'item', null, 'item_' + product['id'])\n );\n }\n\n\n });\n }\n }\n if (JSON.parse(window.localStorage.getItem('order')).cart.length!==0) {\n let el = document.createElement('div');\n el.innerHTML =(DOMcreator('a','CONFIRM ORDER', null,{'href':'#order'},'confirmorder'));\n document.querySelector('main #main_container').appendChild(el);\n }\n\n });\n\n}", "function displayCartItems () {\r\n // get cart items div and clear it\r\n const cartItemsDiv = document.getElementById('cartItems')\r\n cartItemsDiv.innerHTML = ''\r\n\r\n // retrive the cart and the catalogue fro storage\r\n const cart = JSON.parse(sessionStorage.getItem('cart'))\r\n const catalogue = JSON.parse(sessionStorage.getItem('catalogue'))\r\n\r\n // check if the cart is not empty\r\n if (cart.length !== 0) {\r\n let id = 0 // initiaise the id\r\n // iterate through the cart list\r\n cart.forEach(index => {\r\n // retrive the item object based on the index\r\n const item = catalogue[Number(index)]\r\n // display the item\r\n displayItem(item, id)\r\n // increment the id\r\n id++\r\n })\r\n\r\n // display the checkout div\r\n $('#checkoutDiv').css({ visibility: 'visible' })\r\n // get the total div and clear it\r\n const divTotal = document.getElementById('divTotal')\r\n divTotal.innerHTML = ''\r\n\r\n // create a h5 elemnt for the sub-total\r\n const subTotal = document.createElement('h5')\r\n subTotal.setAttribute('id', 'subtotalCartPrice')\r\n subTotal.style.textAlign = 'right'\r\n\r\n // create a h5 elemnt for the VAT\r\n const VATtotal = document.createElement('h5')\r\n VATtotal.setAttribute('id', 'VAT')\r\n VATtotal.style.textAlign = 'right'\r\n\r\n // create a h5 elemnt for the discount\r\n const discount = document.createElement('h5')\r\n discount.setAttribute('id', 'discount')\r\n discount.style.textAlign = 'right'\r\n discount.style.color = 'green'\r\n\r\n // create a h4 elemnt for the total\r\n const total = document.createElement('h4')\r\n total.setAttribute('id', 'totalCartPrice')\r\n total.style.textAlign = 'right'\r\n\r\n // create a check-out button\r\n const checkOutButton = document.createElement('button')\r\n checkOutButton.setAttribute('class', 'btn btn-outline-secondary')\r\n checkOutButton.setAttribute('onclick', 'checkout()') // handler function on click\r\n checkOutButton.setAttribute('id', 'checkOutButton')\r\n checkOutButton.style.float = 'right'\r\n checkOutButton.style.color = 'green'\r\n\r\n // create a cart icon\r\n const cartIcon = document.createElement('i')\r\n cartIcon.setAttribute('class', 'fas fa-shopping-cart')\r\n cartIcon.innerHTML = ' CHECKOUT'\r\n\r\n // add the icon the button\r\n checkOutButton.appendChild(cartIcon)\r\n\r\n // apped to the total div\r\n divTotal.appendChild(subTotal)\r\n divTotal.appendChild(VATtotal)\r\n divTotal.appendChild(discount)\r\n divTotal.appendChild(total)\r\n divTotal.appendChild(checkOutButton)\r\n\r\n // calculate the total & display it\r\n getCartTotal()\r\n } else {\r\n // hide notification and checkout div if cart is empty\r\n $('#checkoutDiv').css({ visibility: 'hidden' })\r\n $('#cartCounter').css({ visibility: 'hidden' })\r\n\r\n // if cart empty, clear the cart items div\r\n cartItemsDiv.innerHTML = ''\r\n // create a h4 element to display the 'cart empty' text\r\n const text = document.createElement('h4')\r\n text.setAttribute('class', 'text-center')\r\n text.innerHTML = 'Cart Empty'\r\n // add the text to the cart items div\r\n cartItemsDiv.appendChild(text)\r\n }\r\n}", "function showCart() {\n let cart = getCart();\n let cartList = $(\"#cartList\");\n let listString = \"\";\n\n if(cart === null){\n cartList.html(\"<p> No items in cart </p>\");\n } else {\n for(let item of cart){\n listString += \"<li>\" + \"<strong>\" + item.name + \"</strong>\" + \" \" +\n \"$\" + item.price + \"/hour\";\n }\n listString += \"</li>\";\n cartList.html(listString);\n }\n\n let totalHTML = $(\"#total\");\n let total = 0.0;\n for(let item of cart){\n let p = parseFloat(item.price);\n total += p;\n }\n totalHTML.html(\"$\" + total.toString() + \" Per Hour\");\n\n $(\"#clearCart\").click(clearCart);\n }", "_loadCustomerCarts(currentCartId) {\n const customerId = this.customerId;\n\n this.customerRenderer.showLoadingCarts();\n $.get(this.router.generate('admin_customers_carts', {customerId})).then((response) => {\n this.customerRenderer.renderCarts(response.carts, currentCartId);\n }).catch((e) => {\n showErrorMessage(e.responseJSON.message);\n });\n }", "function renderCart(container, storeInstance) {\n console.log(\"update cart\", storeInstance);\n var cartTable = document.createElement(\"table\");\n var cartItemsTable = document.createElement(\"table\");\n var cartItemsTableRow1 = document.createElement(\"tr\");\n var cartItemsTableRow1Col1 = document.createElement(\"td\");\n cartItemsTableRow1Col1.textContent = \"name\";\n var cartItemsTableRow1Col2 = document.createElement(\"td\");\n cartItemsTableRow1Col2.textContent = \"quantity\";\n var cartItemsTableRow1Col3 = document.createElement(\"td\");\n cartItemsTableRow1Col3.textContent = \"price\";\n var cartItemsTableRow1Col4 = document.createElement(\"td\");\n cartItemsTableRow1Col4.textContent = \"add / delete\";\n cartItemsTableRow1.appendChild(cartItemsTableRow1Col1);\n cartItemsTableRow1.appendChild(cartItemsTableRow1Col2);\n cartItemsTableRow1.appendChild(cartItemsTableRow1Col3);\n cartItemsTableRow1.appendChild(cartItemsTableRow1Col4);\n cartTable.appendChild(cartItemsTableRow1);\n var totalPrice = 0;\n for (var key in storeInstance.cart) {\n if (storeInstance.cart.hasOwnProperty(key)) {\n var cartItemsTableRowN = document.createElement(\"tr\");\n cartItemsTableRowN.setAttribute(\"id\", key);\n var cartItemsTableRowNCol1 = document.createElement(\"td\");\n cartItemsTableRowNCol1.textContent = storeInstance.stock[key].label;\n var cartItemsTableRowNCol2 = document.createElement(\"td\");\n cartItemsTableRowNCol2.textContent = storeInstance.cart[key];\n var cartItemsTableRowNCol3 = document.createElement(\"td\");\n cartItemsTableRowNCol3.textContent = storeInstance.cart[key] * storeInstance.stock[key].price;\n totalPrice += storeInstance.cart[key] * storeInstance.stock[key].price;\n var cartItemsTableRowNCol4 = document.createElement(\"td\");\n var addOne = document.createElement(\"button\");\n addOne.setAttribute(\"class\", \"addOne\");\n addOne.textContent = \"+\";\n //addOne.addEventListener(\"click\", storeInstance.addItemToCart(key));\n var delOne = document.createElement(\"button\");\n delOne.setAttribute(\"class\", \"delOne\");\n //addOne.addEventListener(\"click\", storeInstance.removeItemFromCart(key));\n delOne.textContent = \"-\";\n cartItemsTableRowNCol4.append(addOne);\n cartItemsTableRowNCol4.append(delOne);\n cartItemsTableRowN.appendChild(cartItemsTableRowNCol1);\n cartItemsTableRowN.appendChild(cartItemsTableRowNCol2);\n cartItemsTableRowN.appendChild(cartItemsTableRowNCol3);\n cartItemsTableRowN.appendChild(cartItemsTableRowNCol4);\n cartTable.appendChild(cartItemsTableRowN);\n }\n }\n var cartItemsTableRowLast = document.createElement(\"tr\");\n var cartItemsTableRowLastCol1 = document.createElement(\"td\");\n cartItemsTableRowLastCol1.textContent = \"Total Price\";\n var cartItemsTableRowLastCol2 = document.createElement(\"td\");\n cartItemsTableRowLastCol2.textContent = \"\";\n var cartItemsTableRowLastCol3 = document.createElement(\"td\");\n cartItemsTableRowLastCol3.textContent = totalPrice;\n var cartItemsTableRowLastCol4 = document.createElement(\"td\");\n cartItemsTableRowLastCol4.textContent = \"\";\n cartItemsTableRowLast.appendChild(cartItemsTableRowLastCol1);\n cartItemsTableRowLast.appendChild(cartItemsTableRowLastCol2);\n cartItemsTableRowLast.appendChild(cartItemsTableRowLastCol3);\n cartItemsTableRowLast.appendChild(cartItemsTableRowLastCol4);\n cartTable.appendChild(cartItemsTableRowLast);\n while (container.firstChild) container.firstChild.remove();\n container.appendChild(cartTable);\n var btnCheckOut = document.createElement(\"button\");\n btnCheckOut.setAttribute(\"id\", \"btn-check-out\");\n btnCheckOut.textContent = \"Check out\";\n container.appendChild(btnCheckOut);\n btnCheckOut.addEventListener(\"click\", function () {\n event.target.disabled = true;\n storeInstance.checkOut();\n });\n}", "function renderCard (phone) {\n var imgContainer = document.getElementById('imgContainer');\n const addBtn = document.createElement('button');\n addBtn.innerText = 'Adaugă în coș';\n addBtn.setAttribute('id', phone._id);\n imgContainer.appendChild(addBtn);\n\n const imageImg = document.getElementById('imageImg');\n imageImg.src = phone.image;\n\n const price = document.getElementById('priceH3');\n price.innerText = `Preț: ${phone.price} RON`;\n\n const tdBrand = document.getElementById('tdBrand'); \n const tdModel = document.getElementById('tdModel');\n const tdRam = document.getElementById('tdRam');\n const tdCpu = document.getElementById('tdCpu'); \n const tdSize = document.getElementById('tdSize');\n const tdCamera = document.getElementById('tdCamera');\n\n tdBrand.innerText = phone.brand;\n tdModel.innerText = phone.model;\n tdRam.innerText = phone.ram;\n tdCpu.innerText = phone.cpu;\n tdCamera.innerText = phone.camera;\n tdSize.innerText = phone.size;\n//send user id and item id to server so it can add that item in user's cart\n addBtn.addEventListener('click', event => {\n location.reload();//repair this shit\n fetch(\"http://192.168.0.104:3028/api/user/cartAdd\", {\n method: 'POST',\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": \"Bearer \" + sessionStorage.getItem('token')\n },\n body: JSON.stringify({\n userId: sessionStorage.getItem('userId'),\n productId: event.target.id\n })\n })\n .then(response => response.json())\n .then(r => console.log(r))\n .catch(err => console.log(err))\n })\n}", "function displayProductDetails (itemsInProductStorage, displayEl) {\r\n\r\n let divEl = `\r\n <div class= \"cart\">\r\n <div class=\"cart-item\">\r\n <div class=\"cart-item-img\">\r\n <img src=\"${itemsInProductStorage.imageSrc}\" alt=\"studded shoe\">\r\n </div>\r\n <div class=\"cart-item-desc\">\r\n <p>${itemsInProductStorage.nameValue}</p>\r\n <p>${itemsInProductStorage.pricePerUnit}</p>\r\n <span data-Id=\"${itemsInProductStorage.id}\"></span>\r\n </div>\r\n <div class=\"btn-center\">\r\n <button class=\"cart-item-btn\">add to cart</button>\r\n </div>\r\n </div>\r\n </div>\r\n `;\r\n\r\n displayEl.insertAdjacentHTML('beforeend', divEl);\r\n}", "function displayCart() {\r\n if (cart.products.length == 0) {\r\n document.getElementById('cart').innerHTML = '<h3>No Product </h3>';\r\n document.getElementById('order').style.display = 'none';\r\n } else {\r\n var cartCode = \"\";\r\n for (var i = 0; i < cart.products.length; i++) {\r\n var product = cart.products[i];\r\n var div = \"<div><strong>\" + product.title + \"</strong> : \" + product.price + \"</div>\";\r\n cartCode += div;\r\n }\r\n\r\n cartCode += \"<h2>TOTAL : \" + cart.total.toString() + \" TND</h2>\";\r\n\r\n document.getElementById('cart').innerHTML = cartCode;\r\n document.getElementById('order').style.display = 'block';\r\n }\r\n }", "function showSuccessPage() {\n $.get('/checkout/successful', function(data) {\n if(data){\n // Update Shopping Cart Badge\n $('#contentData').html(data);\n\n // Empty Shopping Cart\n $('#cartBadge').html(0);\n\n }\n });\n}", "function updateCartDB() {\n\tconsole.log(\"Updating backend\")\n var shoppingCartJson = {};\n var Items = {};\n shoppingCartJson[\"ShopperID\"] = document.getElementById('Shop_User').innerText\n console.log(shoppingCartJson)\n\n var cartItemContainer = document.getElementsByClassName('cart-items')[0]\n var cartRows = cartItemContainer.getElementsByClassName('cart-row')\n for (var i = 0; i < cartRows.length; i++) {\n var cartRow = cartRows[i]\n var itemName = cartRow.getElementsByClassName('cart-item-title')[0].innerText\n var priceElement = cartRow.getElementsByClassName('cart-price')[0]\n var quantityElement = cartRow.getElementsByClassName('cart-quantity-input')[0]\n var price = parseFloat(priceElement.innerText.replace('$', ''))\n var quantity = quantityElement.value\n var description = cartRow.getElementsByClassName('cart-description')[0].innerText\n console.log(\"Checking updateCartTotal\")\n console.log(itemName)\n console.log(price)\n console.log(quantity)\n console.log(description)\n var item = {}\n var itemDetails = {}\n itemDetails[\"Name\"] = itemName;\n itemDetails[\"Description\"] = description;\n itemDetails[\"Quantity\"] = parseInt(quantity);\n itemDetails[\"Price\"] = parseFloat(price);\n Items[itemName] = itemDetails;\n console.log(Items)\n }\n shoppingCartJson[\"Items\"] = Items;\n versionHTML = document.getElementById(\"version\")\n if (versionHTML.innerText.length != 0) {\n VersionJSON = JSON.parse(versionHTML.innerText)\n console.log(\"Version JSON is\"+VersionJSON)\n shoppingCartJson[\"Version\"] = VersionJSON;\n } else{\n shoppingCartJson[\"Version\"] = {\"Vector\":{}};\n }\n shoppingCartJsonString = JSON.stringify(shoppingCartJson);\n var xhr = new XMLHttpRequest();\n\n\txhr.onreadystatechange = function() {\n\t if (this.readyState == 4 && this.status == 200) {\n console.log(this.responseText);\t\n var shoppingCart = JSON.parse(JSON.parse(this.responseText));\n var shoppingCartVersion = shoppingCart[\"Version\"]\n console.log(shoppingCartVersion)\n var versionHTML = document.getElementById(\"version\")\n versionHTML.innerText = JSON.stringify(shoppingCartVersion)\n\t }\n\t};\n\n xhr.open(\"POST\",\"http://localhost:9000/put\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send(shoppingCartJsonString);\n\n \n console.log(shoppingCartJsonString)\n}", "getProductHtml() {\n\n var self = this;\n \n return Object.entries(self.state.filteredProducts)\n .map(([key, value]) => {\n \n return <div key={key} className=\"rounded overflow-hidden shadow-lg bg-white w-5/6 mx-auto my-4\">\n <Link to={'/products/detail/?productId='+ value._id}>\n <img className=\"w-full\" src={'https://digital-commerce-platform-back.herokuapp.com/api/productimage?productId='+value._id} alt=\"\"/>\n </Link>\n <div className=\"px-6 py-4\">\n <div className=\"font-bold text-xl mb-2\">{value.name}</div>\n <p className=\"text-gray-700 text-base\">{value.description}</p>\n <p className=\"mt-4 font-bold text-2xl\">£{value.price}</p>\n </div>\n <div className=\"px-6 pb-4\">\n <Link to={'/products/detail/?productId='+ value._id} className=\"whitespace-nowrap inline-flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-base text-white bg-indigo-600 hover:bg-indigo-700\">\n View\n </Link>\n {(this.state.currentUser !== null && (\n <button onClick={() => this.addToShoppingCart(value._id)} className=\"my-4 flex ml-2 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 border border-transparent rounded-md shadow-sm text-base font-medium text-indigo-700 bg-indigo-200 hover:bg-indigo-300\">\n Add to Cart\n </button>\n ))}\n </div>\n </div>;\n });\n\n }", "updateCachedHtml() {\n if (!this.el.caching) return;\n debug('update cached html');\n var items = this.el.querySelectorAll('.gfl-item, .gfl-section');\n var html = [].map.call(items, el => el.outerHTML).join('');\n this.setCache('html', html);\n }", "function updateCart(){\n \n if( cart.length > 0 ){\n section('aside').classList.add('show');\n // zerando o cart para depois adicionar com append\n section('.cart').innerHTML = '';\n\n let subtotal = 0;\n let desconto = 0;\n let total = 0;\n\n for(let i in cart){\n let pizzaItem = pizzaJson.find( (item) => {\n return item.id == cart[i].id\n });\n\n subtotal = pizzaItem.price * cart[i].quantidade;\n\n console.log(pizzaItem);\n\n let cartItem = section('.models .cart--item').cloneNode(true);\n\n let pizzaSizeName;\n\n switch (cart[i].size) {\n case 0:\n pizzaSizeName = 'P';\n break;\n\n case 1:\n pizzaSizeName = 'M';\n break;\n \n default:\n pizzaSizeName = 'G';\n break;\n }\n\n let pizzaName = `${pizzaItem.name} (${pizzaSizeName}) `;\n\n cartItem.querySelector('img').src = pizzaItem.img;\n cartItem.querySelector('.cart--item-nome').innerHTML = pizzaName;\n cartItem.querySelector('.cart--item--qt').innerHTML = cart[i].quantidade;\n\n cartItem.querySelector('.cart--item-qtmenos').addEventListener('click', () => {\n \n if(cart[i].quantidade > 1 ){\n cart[i].quantidade--;\n } else {\n cart.splice(i, 1);\n }\n updateCart();\n });\n\n cartItem.querySelector('.cart--item-qtmais').addEventListener('click', () => {\n cart[i].quantidade++;\n updateCart();\n });\n\n // Adicionando os itens que pegamos do JSON na div CART\n section('.cart').append(cartItem);\n\n }\n\n desconto = subtotal * 0.1;\n total = subtotal - desconto; \n\n section('.subtotal span:last-child').innerHTML = `R$ ${subtotal.toFixed(2)}`;\n section('.desconto span:last-child').innerHTML = `R$ ${desconto.toFixed(2)}`;\n section('.total span:last-child').innerHTML = `R$ ${total.toFixed(2)}`;\n\n } else {\n section('aside').classList.remove('show');\n }\n}", "function loadCart() {\n\tvar _cart = JSON.parse(getCookie(\"cart\"));\n\tfor(var i in _cart){\n\t\tconsole.log(_cart[i])\n\t\tconsole.log(i)\n\t}\n\t//\tconsole.log(_cart)\n\tvar _str = JSON.stringify(_cart)\n\t\t//\tconsole.log(typeof _str)\n\t\t//\talert(_str == \"{}\")\n\t\t//\tvar _str = \"\"\n\tif (!_cart || _str == \"{}\") {\n\t\t$(\".shopping_box\").html(\"\")\n\t\t$(\".shopping_box\").css(\"display\", \"none\")\n\t\t$(\".login_tips\").css(\"display\", \"block\")\n\t\t$(\".shopping_total\").css(\"display\", \"none\")\n\t\t$(\".pay_box\").css(\"display\", \"none\")\n\t\t$(\".exchange\").css(\"display\", \"none\")\n\t\t\t//\t\t$(\".shopping_box\").attr(\"asd\",\"asd32r\")\n\t} else {\n\t\t$(\".shopping_box\").css(\"display\", \"block\")\n\t\t$(\".login_tips\").css(\"display\", \"none\")\n\t\t$(\".shopping_total\").css(\"display\", \"block\")\n\t\t$(\".pay_box\").css(\"display\", \"block\")\n\t\t\t//\t\talert($)\n\t\t$(\".shopping_box\").html(\"\")\n\t\t\t//\t\t$(\".cart_box_has\").html(\"\");\n\t\t$.ajax({\n\t\t\turl: \"json/cart.json\",\n\t\t\tsuccess: function(date) {\n\t\t\t\tvar _len = date.length\n\t\t\t\tvar _date_index = 0;\n\t\t\t\t$(\".shopping_box\").html(\"\")\n\t\t\t\tfor (var i = 0; i < _len; i++) {\n\t\t\t\t\tif (_cart[date[i].id]) {\n\t\t\t\t\t\t_str1 = \"\"\n\t\t\t\t\t\tvar _total = parseInt(_cart[date[i].id]) * parseInt(date[i].list.newprice)\n\t\t\t\t\t\t_str1 = \"<div date_index ='\" + _date_index + \"' class='cart_good clearfix'><div class='cart_code'>\" + date[i].id + \"</div><div class='cart_name clearfix'><div class='cart_good_img'><a href='javascript:;'><img src='\" + date[i].list.src[0] + \"'/></a><div class='cart_good_sec'><img src='\" + date[i].list.src[0] + \"'/></div></div><div class='cart_good_txt'>\" + date[i].list.name + \"</div></div><div class='cart_oldp'>¥<span>\" + date[i].list.oldprice + \"</span></div><div class='cart_newp'>¥<span>\" + date[i].list.newprice + \"</span></div><div class='cart_num'><div class='cart_num_addsub'><span class='sub_btn' date_index = '\" + _date_index + \"'><img src='img/cart/btn_minus.gif'/></span><input type='text' readonly='readonly' id='cart_good_num' value='\" + _cart[date[i].id] + \"' /><span class='add_btn' date_index = '\" + _date_index + \"'><img src='img/cart/btn_plus.gif'/></span></div></div><div class='cart_total'>¥<span>\" + _total + \"</span></div><div class='cart_del'><a class='del' date_id = '\" + date[i].id + \"' href='javascript:;'>删除</a></div></div>\"\n\t\t\t\t\t\t_date_index++;\n\t\t\t\t\t\t$(\".shopping_box\").append(_str1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tboundEvent()\n\n\t\t\t}\n\t\t})\n\n\t}\n}", "_createMarkupSectionPreview(dataCard) {\n return `\n <div class=\"example-product-card\" id=\"#${dataCard.id}\">\n <div class=\"product-image\">\n <a href=\"https://stockx.com/${dataCard.id}\" class=\"product-link\">\n <img src=\"${dataCard.image_url_small}\" alt=\"${dataCard.name}\" class=\"\">\n </a>\n </div>\n <div class=\"wrapper-product-title\">\n <h3 class=\"product-title\">${dataCard.name}</h3>\n </div>\n <div class=\"wrapper-product-panel\">\n <div class=\"product-panel\">\n <div class=\"wrapper-remove-button\">\n <a class=\"remove-button product-button\">\n <svg class=\"product-svg\" width=\"23\" height=\"23\" viewBox=\"0 0 23 23\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7.58853 6.98715L15.9206 15.4511M7.58853 15.4511L15.9206 6.98715M11.7546 21.0938C6.38594 21.0938 2.03381 16.6728 2.03381 11.2191C2.03381 5.76552 6.38594 1.34448 11.7546 1.34448C17.1232 1.34448 21.4753 5.76552 21.4753 11.2191C21.4753 16.6728 17.1232 21.0938 11.7546 21.0938Z\" stroke=\"#828282\" stroke-width=\"2.5\"/>\n </svg>\n </a>\n </div>\n <h3 class=\"product-price\">${dataCard.last_sale_price}$</h3>\n <div class=\"wrapper-done-button\">\n <a class=\"done-button product-button\">\n <svg class=\"product-svg\" width=\"23\" height=\"23\" viewBox=\"0 0 23 23\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M6.52441 11.3445L10.8101 14.9159L16.5244 7.77305M11.5244 21.3445C6.00157 21.3445 1.52441 16.8673 1.52441 11.3445C1.52441 5.82163 6.00157 1.34448 11.5244 1.34448C17.0473 1.34448 21.5244 5.82163 21.5244 11.3445C21.5244 16.8673 17.0473 21.3445 11.5244 21.3445Z\" stroke=\"#828282\" stroke-width=\"2.5\"/>\n </svg> \n </a>\n </div>\n </div>\n </div>\n </div>\n `;\n }", "function showCart() {\n // get the value and parse from session storage\n let cart = JSON.parse(sessionStorage.getItem('cart'));\n\n if (cart === null) {\n cart = [];\n }\n // if cart is empty set the table in the cart col md 3 section to display none\n if (cart.length === 0) {\n $('#cart').css('display', 'none');\n $('#empty').text('You have no item in your cart.');\n } else {\n // otherwise show table by setting display to block, loop over all items in cart and create a new row for each item.\n $('#cart').css('display', 'block');\n\n let html = '';\n\n let duplicates = [];\n\n for (let i in cart) {\n let count = countDuplicates(cart[i].id);\n\n if (duplicates.indexOf(cart[i].id)== -1) {\n html += `\n <tr>\n <td>${count}</td>\n <td>${cart[i].title}</td>\n <td>$${(cart[i].price*count).toFixed(2)}</td>\n <td>\n <button onClick=\"removeItem(${cart[i].id})\" class=\"btn btn-danger\">X</button>\n </td>\n </tr>\n `;\n duplicates.push(cart[i].id);\n }\n }\n\n\n // send the proper string into the tbody section\n $('tbody').html(html);\n }\n // call update totals\n updateTotals();\n }", "renderCarts(cart){\n \tif(cart.length>0){\n \t\treturn cart.map(i=><li>{i.name}</li>)\n \t}else{\n \t\treturn <h1>No Items added</h1>\n \t}\n \t\n }", "function setCartRows(response) {\n let html = '';\n let total_price = 0;\n response.forEach(element => {\n total_price += getPricePerProductQuantity(element.id, element.price)\n price_per_item[element.id] = element.price;\n //create cards for each product\n var row = ` <div class=\"row\" id=\"${element.id}\">\n <div class=\"col-12 col-sm-12 col-md-2 text-center\">\n <img class=\"img-responsive\" src=\"${element.image_url}\" alt=\"prewiew\" width=\"120\" height=\"80\">\n </div>\n <div class=\"col-12 text-sm-center col-sm-12 text-md-left col-md-6\">\n <h4 class=\"product-name\"><strong>${element.name}</strong></h4>\n <h4>\n <small>${element.description}</small>\n </h4>\n </div>\n <div class=\"col-12 col-sm-12 text-sm-center col-md-4 text-md-right row\">\n <div class=\"col-3 col-sm-3 col-md-6 text-md-right\" style=\"padding-top: 5px\">\n <h6><strong>${element.price} <span class=\"text-muted\">x</span></strong></h6>\n </div>\n <div class=\"col-4 col-sm-4 col-md-4\">\n <div class=\"quantity\">\n \n <input type=\"number\" step=\"1\" max=\"99\" min=\"1\" value=\"${products[element.id]}\" title=\"Qty\" data-id=\"${element.id}\" data-price=\"${element.price}\" class=\"qty\"\n size=\"4\" onchange=\"changeQuantity(this)\">\n \n </div>\n </div>\n <div class=\"col-2 col-sm-2 col-md-2 text-right\">\n <button type=\"button\" class=\"btn btn-outline-danger btn-xs\" data-id=\"${element.id}\" onclick=\"removeItem(this)\">\n <i class=\"fa fa-trash\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </div>\n <hr>`;\n html += row;\n })\n $('#cart_items').html(html);\n $('#total_price').text(total_price);\n }", "function updatecart(where){\n console.log(\"update cart: \" + where);\n var total = $(\".grandtotal\").html();\n $(\"#cart-header\").show();\n $(\".cart-header-total\").html(total);\n if( !(debugmode || profiletype == 1) ) {\n $(\"#checkout-btn\").addClass(\"disabled\");\n }\n if(total_items != \"\" && !isNaN(total_items)){\n $(\".cart-header-items\").html(total_items);\n }\n if( Number(total.replace(\"$\", \"\")) > 0 ){\n $(\"#checkout-btn\").removeClass(\"disabled\");\n $(\"#checkout-btn\").removeClass(\"btn-secondary\");\n $(\"#checkout-btn\").addClass(\"btn-primary\");\n }\n\n $(\".cart-header-show\").hide();\n $(\".cart-header-gif\").show();\n setTimeout(function(){//add a delay so it's easier to notice\n $(\".cart-header-show\").show();\n $(\".cart-header-gif\").hide();\n }, 1000);\n}" ]
[ "0.6977778", "0.6943263", "0.66290593", "0.66050214", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6541971", "0.650137", "0.64912754", "0.6441319", "0.6404139", "0.63754094", "0.6369933", "0.6358181", "0.6248045", "0.61992735", "0.6180358", "0.6179645", "0.61621666", "0.6152615", "0.61243916", "0.6120728", "0.60672736", "0.6064203", "0.6058851", "0.6045293", "0.6023325", "0.601913", "0.60063", "0.59882134", "0.59831953", "0.5969928", "0.5936864", "0.5929147", "0.59058434", "0.59005594", "0.589167", "0.5884988", "0.58759177", "0.58683527", "0.5864881", "0.5860317", "0.5855243", "0.58517516", "0.5849408", "0.5833816", "0.5820255", "0.5807139", "0.5795582", "0.5791253", "0.57769006", "0.5771541", "0.5746694", "0.5730034", "0.57266885", "0.5722894", "0.5720461", "0.567", "0.5665867", "0.5664484", "0.56515783", "0.56505835", "0.56488144", "0.56441504", "0.56435907", "0.5641511", "0.563929", "0.563208", "0.56301564", "0.5624668", "0.56222767", "0.5608303", "0.5603887", "0.5603719", "0.5596919", "0.5584608", "0.55768657", "0.55747515", "0.5573495", "0.55701923", "0.5569547", "0.5567714", "0.5560931", "0.5556884", "0.5553505" ]
0.771274
0
Set the list opened or closed
function setStatus(node) { var elements = []; $(node).each(function() { elements.push($(node).nextAll()); }); for (var i = 0; i < elements.length; i++) { if (elements[i].css("display") == "none") { elements[i].fadeIn(); } else { elements[i].fadeOut(0); } } if (elements[0].css("display") != "none") { $(node).addClass("active"); } else { $(node).removeClass("active"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetOpen() {\n open = [];\n}", "_setOpenState(val) {\n if (val === undefined) {\n val = 'false';\n } // Default value\n GM_setValue('toggleSnatchedState', val);\n this._isOpen = val;\n }", "_setOpenState(val) {\n if (val === undefined) {\n val = 'false';\n } // Default value\n GM_setValue('toggleSnatchedState', val);\n this._isOpen = val;\n }", "toggleList() {}", "set list(list) {\n Node.throw(\"reassign-list\");\n }", "function updateOpen() {\n if (open) {\n el.addClass('open');\n \n var height = friendsHeight();\n list.css('height', height);\n } else {\n el.removeClass('open');\n list.css('height', 0);\n }\n }", "set open(value) {\n // TODO AUI-3726 Revisit double calls to canceled event handlers.\n // Explicitly calling reflectOpenness(…) in this setter means\n // that in native we'll get two sync calls to reflectOpenness(…)\n // and in polyfill one sync (here) and one async (attr change\n // handler). The latter of the two calls, for both cases, will\n // usually be a noop (except when show/hide events are cancelled).\n _attributes2.default.setBooleanAttribute(this, 'open', value);\n reflectOpenness(this);\n }", "get opened() { return this._opened; }", "get opened() { return this._opened; }", "get opened() { return this._opened; }", "function list() {\n return toggleList;\n }", "function openlist() {\n $state.go(vm.baseState.name);\n }", "changeStatus(params) {\n var index = this.list.map(i => i.id).indexOf(params.id);\n this.list[index].open = params.status;\n ls.updateItem({id : params.id}, {open : params.status});\n this.filterByStatus(this.stats);\n }", "set open(data) {\n if (this._open === data) return;\n this._open = data;\n if (this._open) {\n this._$container.classList.add(\"open\");\n } else {\n this._$container.classList.remove(\"open\");\n }\n this._render();\n }", "change()\n {\n this.list = new Set();\n }", "open() {\n if(this.opened || this.readOnly){\n return;\n }\n\n this.opened = true;\n }", "function listSet(e) {\n\n const\n t = target(e),\n dl = t && t.parentElement;\n\n if (!dl || !dl.input) return;\n\n updatedValue = dl.input.value = (t && t.value) || '';\n $(dl.input).trigger('change');\n listHide(dl);\n\n }", "open() {\r\n this.setAttribute('opend', '');\r\n this.isOpend = true;\r\n }", "function saveFldrOpen () {\n let saveObj;\n saveObj = curFldrOpenList;\n browser.storage.local.set({\n\tsavedFldrOpenList: saveObj\n })\n// .then(\n//\t function () {\n// trace(\"Saved curFldrOpenList\");\n// \ttrace(Object.keys(saveObj));\n// trace(Object.values(saveObj));\n//\t }\n// )\n ;\n}", "function toggleOpen() {\n open = !open;\n \n updateOpen();\n }", "function selectOpenList(e) {\n var target;\n if (e.target) {\n target = e.target;\n } else {\n target = e;\n }\n var expandedState = target.getAttribute('aria-expanded');\n if (expandedState === 'true') {\n expandedState = 'false';\n } else {\n expandedState = 'true';\n }\n target.setAttribute('aria-expanded', expandedState);\n\n // second toggle here is a compromise to allow animation on opening\n // while still providing good tab focus behavior\n setTimeout(function(){\n target.classList.toggle('is-open');\n },50);\n }", "open() {\n this.opened = true;\n }", "function manageOpenState() {\n setIsOpen(open);\n }", "set list(list){\n this._list = list;\n this.render()\n }", "closeEditingMode(listLength) {\n\n let arr = new Array(listLength).fill(false);\n this.state.isEditing = arr;\n this.forceUpdate()\n }", "toggleListNoPref() {}", "_open() {\n if (!this._afterOpened.closed) {\n this._afterOpened.next();\n this._afterOpened.complete();\n }\n }", "_initOpened() {\n //\tInvoke \"before\" hook.\n this.trigger('initOpened:before');\n /** The selected listitem(s). */\n let listitems = this.node.pnls.querySelectorAll('.mm-listitem_selected');\n /** The last selected listitem. */\n let lastitem = null;\n //\tDeselect the listitems.\n listitems.forEach(listitem => {\n lastitem = listitem;\n listitem.classList.remove('mm-listitem_selected');\n });\n //\tRe-select the last listitem.\n if (lastitem) {\n lastitem.classList.add('mm-listitem_selected');\n }\n /**\tThe current opened panel. */\n let current = lastitem\n ? lastitem.closest('.mm-panel')\n : DOM.children(this.node.pnls, '.mm-panel')[0];\n //\tOpen the current opened panel.\n this.openPanel(current, false);\n //\tInvoke \"after\" hook.\n this.trigger('initOpened:after');\n }", "setCurrentList ({ commit }, id) { commit('SET_CURRENT_LIST', id) }", "SET_CURRENT_LIST (state, id) { state.currentList = id }", "setActiveList(list) {\n this.setState({ active_list: list });\n }", "setListView(state, status) {\n state.listView = status;\n localStorage.setItem('listView', status);\n }", "function _setCurrentSettings(list) {\n\t\tlist.forEach(function (item) {\n\t\t\tif (item.type)\n\t\t\t\t_setSetting(item.id, item.type, item.setting);\n\n\t\t\tif (item.items)\n\t\t\t\t_setCurrentSettings(item.items);\n\t\t})\n\t}", "openAll() {\n this._openCloseAll(true);\n }", "editList () {\n\t\tthis.setState({ edit: !this.state.edit });\n\t}", "getReadList(state, list) {\n\t\t\tstate.readList = list;\n\t\t}", "function changeList( box, list ) {\n\t// Next empty the slave list\n\n\temptyList( box );\n\n\t// Then assign the new list values\n\n\tfillList( box, list );\n}", "toggle () {\n this.opened = !this.opened;\n }", "toggle () {\n this.opened = !this.opened;\n }", "toggleOpen(tab,posicionOpens) {\n var tempOpenStates=this.state.openStates;\n if(tempOpenStates[3][posicionOpens]){\n return;\n }\n const prevState = this.state.openStates[posicionOpens];\n \n const state = prevState.map((x, index) => tab === index ? !x : false);\n\n tempOpenStates[posicionOpens]=state;\n this.setState({\n openStates:tempOpenStates\n });\n }", "open () {\n this.opened = true;\n }", "function openSet() {\n document.getElementById(\"set\").classList.toggle(\"set-open\"); //classlist.toggle -> adding a css element\n}", "function save_last_opened_list(list_id)\r\n{\r\n\tTitanium.App.Properties.setString('last_opened_list', list_id.toString());\r\n}", "setStateForList(readyList, newState) {\n for (let i = 0; i < readyList.length; i++) {\n let listItem = readyList[i];\n this.dependencyGraph.setBootDependencyState(listItem.name, newState);\n }\n }", "function handleListClose(){\n setListOpen(false);\n dispatch(editTodo({name:current},{name:titleEdit,description:descriptionEdit,team:teamEdit}));\n }", "setOpen(open) {\n this.setState({\n open\n });\n }", "function toggleList(evt) {\n if (!evt.target.matches('input')) return;\n const elem = evt.target;\n const index = elem.dataset.index;\n\n items[index].done = !items[index].done;\n checkSelectedItems(items);\n localStorage.setItem('list', JSON.stringify(items));\n}", "updateListItem(listData) {\n this.queryItems = listData ? listData : [];\n this.dropdownOpen = true;\n }", "function swapOpen(group){\n // skip self\n if(open === group)\n return;\n // swap\n open.show = false;\n if(open.comments != null && open.comments.length === 0)\n delete $scope.groups[getKey(open.coord)];\n\n open = group;\n open.show = true;\n }", "function list(l) {\n\tdaList[arguments[0] - 1] = arguments[1];\t\n\t// if(arguments[0] -1 == size){\n\t\tif (updateFlag == 1){\n\t\t\toutlet(0, daList);\n\t\t}\n\t// }\t\t\n}", "inListView(){\n this.setState( previousState => ( {listClicked: !previousState.listClicked} ) )\n }", "setStateForList(readyList, newState) {\n for (let i = 0; i < readyList.length; i++) {\n let listItem = readyList[i];\n this.dependencyGraphs[this.currentStage].setBootDependencyState(listItem.name, newState);\n }\n }", "setOpenDialogState() {\n let newState = Object.assign({}, this.state);\n newState['open'] = true;\n this.setState(newState);\n }", "function ListSetter(value) {\n listBin.push(value);\n while (listBin.length > LIMIT_BIN) {\n listBin.shift(listBin);\n }\n UpdateView(listBin);\n return listBin;\n}", "'click #editlist'() {\n\t\treturn Session.set(\"targetlist\" + this._id, true);\n\t}", "get listMode() {\n\t\treturn this.__listMode;\n\t}", "'click .toggle-list-private'() {\n\t\tlet setPrivate = {\n\t\t\tlistId: \t\tthis._id,\n\t\t\tsetToPrivate: \t!this.private,\n\t\t}\n\n\t\tMeteor.call('lists.setPrivate', setPrivate, (error) => {\n\t\t\tif (error)\n\t\t\t\tBert.alert( error.reason, 'danger', 'growl-top-right' );\n\t\t});\n\t}", "setOpen(){\n this.setState({\n open: !this.state.open,\n step : 1\n }) \n }", "function setCurStockList(stockName, stockList) {\n stockMap[stockName] = stockList;\n}", "function toggle() {\n opened = !opened;\n element.removeClass(opened ? 'closed' : 'opened');\n element.addClass(opened ? 'opened' : 'closed');\n }", "function toggle() {\n opened = !opened;\n element.removeClass(opened ? 'closed' : 'opened');\n element.addClass(opened ? 'opened' : 'closed');\n }", "SetOpen(show) {\n this.open = show;\n if(show) {\n this.folderContainer.classList.remove(styles['guify-folder-closed']);\n this.arrow.innerHTML = '&#9662;'; // Down triangle\n\n }\n else {\n this.folderContainer.classList.add(styles['guify-folder-closed']);\n this.arrow.innerHTML = '&#9656;'; // Right triangle\n }\n\n }", "function toggleOpenOneOnly(e) {\n if (this.open) {\n All_Details.forEach(deet=>{\n if (deet!=this && deet.open) deet.open = false\n });\n }\n}", "function changeSlideList(slideToChange, listObj, listObjID) {\r\n slideToChange.data.list[listObjID] = listObj.value;\r\n runUpdateTimer();\r\n}", "setValue(new_value) {\n this.active_list = new_value;\n if (this._onChange) {\n this._onChange(new_value);\n }\n }", "function clear_last_opened_list()\r\n{\r\n\tTitanium.App.Properties.setString('last_opened_list', '1');\r\n}", "_setOpen(isOpen, restoreFocus, openedVia = 'program') {\n this._opened = isOpen;\n if (isOpen) {\n this._animationState = this._enableAnimations ? 'open' : 'open-instant';\n this._openedVia = openedVia;\n }\n else {\n this._animationState = 'void';\n if (restoreFocus) {\n this._restoreFocus();\n }\n }\n this._updateFocusTrapState();\n return new Promise(resolve => {\n this.openedChange.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_12__.take)(1)).subscribe(open => resolve(open ? 'open' : 'close'));\n });\n }", "function openList(id) {\n \n notesCaption = '';\n buttonClass = 'visible';\n \n for (let i=0; i<userLists.length; i++) {\n \n // finds record of list matching id\n if (userLists[i][0] == id) {\n \n // 1. write out caption\n const currentList = userLists[i];\n notesCaption = `${currentList[1]}\n <button id=\"editListCaption\">edit</button>`;\n \n // 2. generate list of tasks\n helper_generateListItems(currentList[2]);\n \n // 3. saves current list to global variable\n setUserList(id, currentList);\n break;\n }\n }\n \n reRenderDashboard();\n \n // assign event to button\n document.addEventListener('click', (e) => {\n \n if ((e.target) && (e.target.id === \n 'editListCaption')) {\n e.preventDefault();\n editListCaptions();\n }\n });\n \n document.getElementById('saveList').disabled = true;\n }", "function updateList(marker){\n if (selected != undefined) {\n selected.setAttribute(\"class\", \"list-group-item\");\n }\n selected = marker.item;\n marker.item.setAttribute(\"class\", \"list-group-item active\");\n scroll(marker.item);\n}", "function toggleOrderedList(editor) {\n\t\t\tvar cm = editor.codemirror;\n\t\t\t_toggleLine(cm, \"ordered-list\");\n\t\t}", "handleExistingList(existingListToSave) {\n this.setState({existingList: existingListToSave});\n this.setState({refreshState: !this.state.refreshState});\n }", "function setList (newElements) {\n let newList = [...props.list]\n if (props.title === \"Song\") {\n newList[0] = newElements\n props.setList(newList)\n }\n else if (props.title === \"Artist\") {\n newList[1] = newElements\n props.setList(newList)\n }\n else if (props.title === \"Genre\") {\n newList[2] = newElements\n props.setList(newList)\n }\n }", "open() {\n this.setAttribute('open', '');\n this._isOpen = true;\n }", "toggleFileList(){\n this.setState({hideFile: !this.state.hideFile});\n if(!this.state.hideFile){\n Object.assign(this.props.windowStore.windowSettings,{hideFile: true});\n //console.log(\"Hide File List\");\n }else{\n Object.assign(this.props.windowStore.windowSettings,{hideFile: false});\n //console.log(\"Show File List\");\n }\n //console.log(this.props.windowStore.windowSettings.hideFile);\n }", "function setListDisables() {\r\n inputAMPM.disabled = false;\r\n var selectedDate = getRootDate();\r\n\r\n function listDisabler(selectedDate, listObject) {\r\n for (var i = 0; i < listObject.length; i++) {\r\n var disablerDate = new Date(selectedDate);\r\n var valCheck = isNaN(listObject.options[i].innerText) ? i : parseInt(listObject.options[i].innerText);\r\n listObject == listMonth ? disablerDate.setMonth(valCheck) : listObject == listHour ? disablerDate.setHours(inputAMPM.checked ? valCheck + 12 : valCheck) : disablerDate.setMinutes(valCheck);\r\n listObject.options[i].disabled = (disablerDate < startDate || disablerDate > endDate) ? true : false;\r\n }\r\n }\r\n\r\n listDisabler(selectedDate, listMonth);\r\n listDisabler(selectedDate, listHour);\r\n listDisabler(selectedDate, listMinute);\r\n\r\n var startDateCheck = new Date(selectedDate);\r\n if (inputAMPM.checked) { startDateCheck.setHours(startDateCheck.getHours() - 12); } else { startDateCheck.setHours(startDateCheck.getHours() + 12); }\r\n if (startDateCheck < startDate || startDateCheck > endDate) {\r\n inputAMPM.disabled = true;\r\n }\r\n\r\n }", "updateList(error, list) {\n\t\tthis.setState({\n\t\t\tisLoading: false,\n\t\t\tfiles: list\n\t\t});\n\t}", "set listLevelNumber(value) {\n if (value === this.listLevelNumberIn) {\n return;\n }\n this.listLevelNumberIn = value;\n this.notifyPropertyChanged('listLevelNumber');\n }", "function toggleOrderedList(editor) {\n\t\tvar cm = editor.codemirror;\n\t\t_toggleLine(cm, \"ordered-list\");\n\t}", "updateSpendList(state, spends) {\r\n state.spendsList = spends; \r\n }", "close() {\n this.opened = false;\n }", "function toggleOrderedList(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleLine(cm, \"ordered-list\");\n}", "function toggleOrderedList(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleLine(cm, \"ordered-list\");\n}", "function toggleOrderedList(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleLine(cm, \"ordered-list\");\n}", "function toggleOrderedList(editor) {\n\tvar cm = editor.codemirror;\n\t_toggleLine(cm, \"ordered-list\");\n}", "open() {\n\t\tif (this._opened) return\n\t\tthis._opened = true\n\t\tthis.addClass('open')\n\t\tthis.trigger(ToggleComponent.ToggleEvent, this, this._opened)\n\t}", "updateListShow() {\n }", "isOpen() { return this._open; }", "set enginesDropDownOpen(newState)\n {\n if (this.enginesDropDownOpen != newState) {\n var button = this.getElement({type: \"searchBar_dropDown\"});\n this._controller.click(button);\n\n this._controller.waitForEval(\"subject.searchBar.enginesDropDownOpen == subject.newState\", TIMEOUT, 100,\n {searchBar: this, newState: newState });\n this._controller.sleep(0);\n }\n }", "function set(list, index, value) {\n get(list, index).value = value\n}", "setFocusedAndToggle() {\n if(this.opened && this.focused_option != null)\n this.setValueByInputValue(this.focused_option);\n this.behave('toggle');\n this._toggleOpenedStatus();\n }", "function updateListItemsValues(){\n let i=0;\n $taskContainer.children(\"li\").each(function(){\n $(this).attr(\"value\", i);\n i++;\n })\n }", "function TagMenu_setValue(theValue) {\r\n this.listControl.setValue(theValue);\r\n}", "function switchToSelectedList() {\n var $firstSelected = $(Config.LIST_SWITCHER).find(Config.LIST_SELECTED).first();\n var listPath = $firstSelected.data('listPath');\n switchToList(listPath);\n }", "openFileTree() {\n this.changeFileTreeRecusive(this.state.content.filetree, \"isOpen\", true);\n this.save();\n }", "function initState(item) {\n if (item.$$isOpen === undefined) {\n Object.defineProperty(item, '$$isOpen', {\n value: false,\n configurable: false,\n enumerable: false,\n writable: true\n });\n }\n }", "updateListPos(updatedList) {\n if (updatedList) {\n let lists = this.state.lists;\n lists[updatedList.pos] = updatedList;\n this.setState({ lists });\n }\n }", "leave(){\r\n if ( this.isOpened && !this.getRef('list').isOver ){\r\n this.isOpened = false;\r\n }\r\n }", "function openLi (li) {\n\n // if a popup is open, ignore this.\n if (ae.currentPopup)\n return false;\n\n // if another one is animating, force it to instantly finish\n if (ae.currentLi && ae.currentLi != li) {\n if (ae.currentLi.hasClass('sticky'))\n return;\n if (ae.currentLi != li)\n closeCurrentLi();\n }\n \n // redo the closing morph so that the timing is\n // perfectly lined up with the opening of the new one\n if (ae.closingLi) {\n var morph = ae.closingLi.get('morph');\n morph.cancel();\n ae.closingLi.morph({\n width: '15px',\n backgroundColor: '#696969'\n });\n delete ae.closingLi;\n }\n\n // animate this one\n li.morph({\n width: '100px',\n backgroundColor: '#2096ce',\n onComplete: function () { delete ae.openingLi; }\n });\n ae.openingLi = li;\n ae.currentLi = li;\n return true;\n}", "function handleOpen() {\n setOpen(true)\n }", "function openList() {\n for(var i=0; i< numOfOptions; i++) {\n $('.options2').children('li').eq(i).attr('tabindex', i).css(\n 'transform', 'translateY('+(i*100+100)+'%)').css(\n 'transition-delay', i*30+'ms');\n }\n }", "edit(listKey=null) {\n \t\tthis.props.activeList(listKey);\n \t\tthis.props.history.push(\"/editlist\");\n \t}" ]
[ "0.6220082", "0.61727405", "0.61727405", "0.60176533", "0.59372956", "0.58933836", "0.587499", "0.5846048", "0.5846048", "0.5846048", "0.58295065", "0.5825171", "0.5818736", "0.57208157", "0.57129925", "0.56440496", "0.5641822", "0.5605687", "0.5602292", "0.5562374", "0.5522513", "0.551944", "0.55164737", "0.5494135", "0.54941285", "0.5493775", "0.5466011", "0.5465823", "0.54500496", "0.54473543", "0.54355264", "0.54342735", "0.542217", "0.53894794", "0.5389039", "0.5364709", "0.5361412", "0.5350891", "0.5350891", "0.53470564", "0.5344099", "0.5325452", "0.5314542", "0.5305689", "0.5301196", "0.5299782", "0.528633", "0.52789986", "0.527683", "0.5276321", "0.52448213", "0.52402866", "0.5234261", "0.52309245", "0.5229886", "0.52031195", "0.51841044", "0.51777387", "0.5176324", "0.5171124", "0.5171124", "0.51512927", "0.5148183", "0.5147894", "0.513564", "0.51334935", "0.5128671", "0.51149744", "0.5113136", "0.510992", "0.5102829", "0.50995934", "0.50829774", "0.5071613", "0.5058173", "0.50394815", "0.5037178", "0.50371546", "0.5023406", "0.5018362", "0.501824", "0.501824", "0.501824", "0.501824", "0.50035053", "0.5001385", "0.49990126", "0.49987957", "0.49969044", "0.4989951", "0.4989789", "0.49769995", "0.49711743", "0.49696213", "0.4966614", "0.49486914", "0.4947161", "0.49433973", "0.49432796", "0.49427333", "0.4940416" ]
0.0
-1
! Parsley.js Version 2.7.1 built Mon, May 1st 2017, 11:19 am
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expendParsley() {\n window.Parsley.on('field:success', function () {\n\n\n });\n }", "private public function m246() {}", "constructor(location, parcels) {\n this.location = location;\n this.parcels = parcels;\n }", "function setup(p){\n\n}", "function PlatForm() {}", "function Bevy() {}", "function Parser() {\n\n}", "function buildPullapproveParser(localYargs) {\n return localYargs.help().strict().demandCommand().command('verify', 'Verify the pullapprove config', {}, () => verify$1());\n}", "static getTransformLobbies() {}", "static transient final private internal function m43() {}", "transient protected internal function m189() {}", "function Yielder() {}", "livelyPrepareSave() {\n }", "function paralax() {\n $('.clouds ul li:nth-child(1)').plaxmove({ratioH: 0.01, ratioV: 0.05, reversed: true, invertH: false});\n $('.clouds ul li:nth-child(2)').plaxmove({ratioH: 0.01, ratioV: 0.05, reversed: false, invertH: false});\n $('.clouds ul li:nth-child(3)').plaxmove({ratioH: 0.03, ratioV: 0.09, invertV: true});\n $('.clouds ul li:nth-child(4)').plaxmove({ratioH: 0.06, ratioV: 0.15, reversed: false, invertH: false});\n\n }", "function P(a,b,c){P.m.constructor.call(this,a);this.Ya=a.Ya||kg;this.Ze=a.Ze||lg;var e=[];e[y.Va]=new ye;e[y.ug]=new ye;e[y.Pa]=new ye;e[y.mf]=new ye;this.ll=e;b&&(this.Xa=b);c&&(this.mg=c);this.Mk=this.mg&&y.h.He();this.Wj=[];this.pe=new Wf(a.qc);this.Nc=this.options.ep?new zf(a.ep,a.cp):null;y.I&&y.I.we&&mg(this,y.Ln,y.I.we);y.Ec&&y.Ec.we&&mg(this,y.xr,y.Ec.we);y.Qa&&y.Qa.we&&mg(this,y.Jn,y.Qa.we)}", "renderPrep() {\n }", "private internal function m248() {}", "function pulleyControls(pulley, conf) {\n var circle = pulley.select('.sprocket'),\n dl = pulley.select('.debugLength'),\n cx = parseFloat(circle.attr('cx')),\n cy = parseFloat(circle.attr('cy'));\n\n var angle = 0;\n // Start in a right triangle\n var length = Math.SQRT2 / 2 * PULLEYDISTANCE;\n dl.attr('r', length);\n\n return {\n rotate: function (deg) {\n angle += deg;\n\n length += (deg * (Math.PI / 180)) * PULLEYRADIUS * conf.dir;\n\n pulley.attr('transform', 'rotate(' + angle + ',' + cx + ',' + cy + ')');\n dl.attr('r', length);\n },\n distance: function (x, y) {\n return distance(cx, cy, x, y);\n },\n intersect: function (start, end) {\n var relStart = [start[0] - cx, start[1] - cy];\n var relEnd = [end[0] - cx, end[1] - cy];\n\n var intersections = intersect(length, relStart[0], relStart[1], relEnd[0], relEnd[1]);\n for (var i = 0; i < intersections.length; i++) {\n var p = intersections[i];\n p[0] += cx;\n p[1] += cy;\n }\n return intersections;\n },\n length: function () {\n return length;\n },\n x: function () {\n return cx;\n },\n y: function () {\n return cy;\n }\n }\n}", "static private internal function m121() {}", "transient final protected internal function m174() {}", "initialize()\n {\n }", "protected internal function m252() {}", "function jessica() {\n $log.debug(\"TODO\");\n }", "function Adaptor() {}", "function pu(a,b){this.$h=[];this.vo=a;this.ym=b||null;this.Af=this.re=!1;this.Jc=void 0;this.jl=this.wq=this.Pi=!1;this.oi=0;this.L=null;this.Si=0}", "static transient final private protected internal function m40() {}", "function SeleneseMapper() {\n}", "function kp() {\n $log.debug(\"TODO\");\n }", "function setup() {\n\n\n}", "function setup() {\n\n\n}", "transient private internal function m185() {}", "prepare() {\n }", "initialize() {\n\n }", "init() {\n }", "transient private protected internal function m182() {}", "function Billonaire() { }", "initialize() {\n //\n }", "function Parser() {\n}", "function Parser() {\n}", "function plugin() {\n\n const getBasicPageQuery = (siteUrl, endPoint) => {\n return siteUrl + endPoint;\n };\n\n const getParagraphQuery = (siteUrl, endPoint, paragraphType, paragraphID) => {\n return siteUrl + endPoint + paragraphType + '/' + paragraphID;\n };\n\n const getParagraphData = (paragraphRequest) => {\n\n request.get(paragraphRequest, function(error, response, data) {\n if(error) {\n console.log(error);\n }\n\n const paragraphObj = JSON.parse(data);\n let paragraph = paragraphObj.data;\n\n content = paragraph.attributes.field_wysiwyg;\n\n return content;\n\n });\n\n };\n\n return function(files, metalsmith, done) {\n const siteUrl = 'http://vagovcms.lndo.site';\n const pageEndPoint = '/jsonapi/node/page';\n const paragraphEndPoint = '/jsonapi/paragraph/';\n const pageRequest = getBasicPageQuery(siteUrl, pageEndPoint);\n\n // get data from Lando Drupal instance\n request.get(pageRequest, function(error, response, data) {\n if(error) {\n console.log(error);\n }\n\n const pageDataObj = JSON.parse(data);\n pageDataObj.siteUrl = siteUrl;\n\n let pagesSummary = {};\n let temp = {};\n\n pageDataObj.data.forEach(function (page) {\n temp = {};\n\n temp.pageTitle = page.attributes.title;\n temp.introText = page.attributes.field_intro_text;\n\n paragraphID = page.relationships.field_content_block.data[0].id;\n paragraphType = 'wysiwyg';\n\n let paragraphRequest = getParagraphQuery(siteUrl, paragraphEndPoint, paragraphType, paragraphID);\n temp.paragraph = getParagraphData(paragraphRequest);\n\n\n\n pagesSummary[page.id] = temp;\n });\n\n // add pagesSummary variables to the metalsmith metadata\n let metadata = metalsmith.metadata();\n metadata.basicPages = pagesSummary;\n metalsmith.metadata(metadata);\n console.log(metadata);\n\n done();\n });\n\n };\n}", "static private protected internal function m118() {}", "function Rebelizer() {\n\n}", "function setup() {}", "function yepnopeIsLoaded(){\n yepnope(\n { test: (typeof jQuery === 'undefined'),\n yep: 'http://static.twoday.net/sys.files/js/jquery/jquery.min.js',\n complete: function(){\n\t\t\tvar $videos = $(siteVideos);\n\t\t\tyepnope([\n\t\t\t{ load: 'http://static.twoday.net/cdn/files/video2day-min-js.js',\n\t\t\t complete: function(){ $videos.video2day().init( {addFlexVideoClass: (typeof $.fn.foundation !== 'undefined')} ); }\n\t\t\t},\n\t\t\t{ test: $videos.hasClass(\"other\"),\n\t\t\t yep: [ 'http://static.twoday.net/cdn/files/video43-min-css.css', 'http://static.twoday.net/cdn/files/video43-min-js.js' ]\n\t\t\t} ]);\n }\n }\n );\n}", "function setup() {\n \n}", "constructor(place, parcels) { // this is the first property of the VillageState class \n this.place = place; //this.place is the current location of the robot\n this.parcels = parcels; // the value is assigned on line 50 and below; parcels means movement/delivery\n }", "function GLS(jsonpObject) {\n\t//parses data from jasonp object\n\tvar dataObject = jsonpObject[\"data\"];\n\tvar cssContent = dataObject[\"css\"];\n\t// creates new elements on the http page\n\tcreateCss(cssContent);\n\tcreateTemplates(dataObject);\n\t// sorts new info for the tips\n\tvar stepsArray = getStepsStructure(dataObject);\n\tcreateStepsInfo(stepsArray);\n //start first tip\n\tmakeTip(idArray[0]);\t\n\n}", "function Packer(){}", "function parrotFacts(){\n console.log('Some parrots can live for 8 years');\n console.log('Parrots can speak human language');\n}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function Loader() {\n\n}", "function setup() {\n\n\t\t\t\t\t}", "static ready() { }", "function p() {return new Pellet(false, true);} //p(ellet)", "function setup() {\r\n}", "constructor ( ) {\n // KEY\n this.key = pb.plugin.key('pentaposts');\n\n // PLUGIN\n this.plugin = pb.plugin.get('the_last_pentaposts');\n\n // SETTINGS\n this.settings = {};\n // user\n this.settings.preview_max_length = this.plugin.settings.preview_max_length;\n this.settings.excluded_boards = this.plugin.settings.excluded_boards;\n this.settings.excluded_categories = this.plugin.settings.excluded_categories;\n this.settings.excluded_members = this.plugin.settings.excluded_members;\n this.settings.post_html = this.plugin.settings.post_html;\n this.settings.shelf_html = this.plugin.settings.shelf_html;\n this.settings.title = this.plugin.settings.title;\n // defaults\n this.settings.default_post_html = '<tr><td>$[apentapost]</td><td>$[apentadelete]</td></tr>';\n this.settings.default_shelf_html = '<table><tr><th>$[apentatitle]</th></tr>$[apentashelf]</table>';\n\n\n // INFO\n this.info = {};\n // Page\n this.info.is_post_page = yootil.form.post().length > 0;\n this.info.is_thread = yootil.form.quick_reply().length > 0;\n this.info.is_edit = pb.data('route').name.split('_')[0].toUpperCase() == \"EDIT\";\n this.info.is_conversation = pb.data('route').name.toUpperCase() == \"CONVERSATION\"\n this.info.is_user_profile = pb.data('route').name.toUpperCase() == 'USER';\n // User\n this.info.user = pb.data('user').id;\n this.info.curr_user_excluded = ( this.settings.excluded_users != undefined )? (this.settings.excluded_users.indexOf(this.info.user) > -1):false;\n // html\n this.info.shelf_variables_exist = ( this.settings.shelf_html.match(/\\$\\[apentashelf\\]/gi).length != 1 || this.settings.shelf_html.match(/\\$\\[apentatitle\\]/gi).length != 1 )? false: true;\n this.info.post_variables_exist = ( this.settings.post_html.match(/\\$\\[apentapost\\]/gi).length != 1 || this.settings.post_html.match(/\\$\\[apentadelete\\]/gi).length != 1 )? false: true;\n // misc.\n this.info.curr_board = ( pb.data('page').board != undefined )? pb.data('page').board.id: -1;\n this.info.curr_category = ( pb.data('page').category != undefined )? pb.data('page').category.id: -1;\n this.info.curr_board_excluded = ( this.settings.excluded_boards != undefined )? ( this.settings.excluded_boards.indexOf(this.info.curr_board) > -1 ):false;\n this.info.curr_category_excluded = ( this.settings.excluded_categories != undefined )? (this.settings.excluded_categories.indexOf(this.info.curr_category) > -1):false;\n this.info.user_profile_id = ( this.info.is_user_profile )? pb.data('page').member.id: -1;\n this.info.user_profile_has_items = ( this.info.is_user_profile )? (\n ( this.key.get( this.info.user_profile_id ) != undefined )? (\n (this.key.get( this.info.user_profile_id ).length != 0)? true: false\n ): false\n ): false;\n\n // KICK\n this.init();\n }", "function setup() {\n \n}", "function setup() {\n \n}", "constructor(){ super(JXONParser.rules(), JXONObj.TAG) }", "function About_svelte_create_fragment(ctx) {\n\tlet p0;\n\tlet p1;\n\tlet t3;\n\tlet p2;\n\tlet p3;\n\tlet t12;\n\tlet p4;\n\n\treturn {\n\t\tc() {\n\t\t\tp0 = (0,internal/* element */.bG)(\"p\");\n\n\t\t\tp0.innerHTML = `Thank you for using this open source solution for diy pedals. <br/>\r\n This is not to be sold its open and free for everyone to use. <br/> \r\n`;\n\n\t\t\tp1 = (0,internal/* element */.bG)(\"p\");\n\t\t\tt3 = (0,internal/* space */.Dh)();\n\t\t\tp2 = (0,internal/* element */.bG)(\"p\");\n\n\t\t\tp2.innerHTML = `You can find executable and arduino code in the following locations <br/>\r\n Gui executable: <a href=\"https://github.com/vospascal/pedal-gui\">pedal-gui</a> <br/>\r\n Arduino code that works with the gui exe file: <a href=\"https://github.com/vospascal/pedal-arduino/\">pedal-arduino</a> <br/> \r\n`;\n\n\t\t\tp3 = (0,internal/* element */.bG)(\"p\");\n\t\t\tt12 = (0,internal/* space */.Dh)();\n\t\t\tp4 = (0,internal/* element */.bG)(\"p\");\n\n\t\t\tp4.innerHTML = `If you like it please consider a donation to further development. <br/> \r\n <a href=\"paypal.com/donate/?business=TBPE6XCB2XBMW&amp;item_name=pedalbox&amp;currency_code=EUR\">donate on\r\n paypal</a>`;\n\t\t},\n\t\tm(target, anchor) {\n\t\t\t(0,internal/* insert */.$T)(target, p0, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, p1, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, t3, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, p2, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, p3, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, t12, anchor);\n\t\t\t(0,internal/* insert */.$T)(target, p4, anchor);\n\t\t},\n\t\tp: internal/* noop */.ZT,\n\t\ti: internal/* noop */.ZT,\n\t\to: internal/* noop */.ZT,\n\t\td(detaching) {\n\t\t\tif (detaching) (0,internal/* detach */.og)(p0);\n\t\t\tif (detaching) (0,internal/* detach */.og)(p1);\n\t\t\tif (detaching) (0,internal/* detach */.og)(t3);\n\t\t\tif (detaching) (0,internal/* detach */.og)(p2);\n\t\t\tif (detaching) (0,internal/* detach */.og)(p3);\n\t\t\tif (detaching) (0,internal/* detach */.og)(t12);\n\t\t\tif (detaching) (0,internal/* detach */.og)(p4);\n\t\t}\n\t};\n}", "function pd(){this.Fc=void 0;this.group=x.j.Ml;this.Vb=x.j.Vb}", "function pd(){}", "function comportement (){\n\t }", "function setup() {\n\n}", "function setup() {\n\n}", "function setup() {\n\n}", "function setup() {\n\n}", "function load_parchment()\n{\n\t// Check for any customised options\n\tif (window.parchment_options)\n\t\t$.extend(parchment.options, parchment_options);\n\t\n\t// Hide the #about, until we can do something more smart with it\n\t$('#about').remove();\n\t\n\t// Load the library\n\tvar library = new parchment.lib.Library();\n\tparchment.library = library;\n\tlibrary.load();\n\n\t// Add the Analytics tracker, but only if we're at parchment.googlecode.com\n\tif (location.href.slice(0, 31) == 'http://parchment.googlecode.com')\n\t{\n\t\t$.getScript('http://www.google-analytics.com/ga.js', function(){_gat._getTracker(\"UA-7949545-1\")._trackPageview();});\n\t}\n}", "get PSP2() {}", "buildSPS() {\n }", "prepare() {}", "static private public function m119() {}", "jsdocPeldaPrivate() {}", "init () {\n }", "function wg(a){this.p=a}", "function v13(v14,v15) {\n }", "transient final private internal function m170() {}", "function beetle_lvl4() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }" ]
[ "0.585894", "0.52009135", "0.5161253", "0.51474077", "0.5083898", "0.5078293", "0.5019331", "0.49913025", "0.49615997", "0.49594483", "0.49470842", "0.49466026", "0.4904374", "0.48970538", "0.48697108", "0.4867041", "0.48647588", "0.48589423", "0.48562303", "0.48493853", "0.4822282", "0.48192188", "0.48175478", "0.48110884", "0.4801116", "0.4799155", "0.47900698", "0.4774372", "0.4760693", "0.4760693", "0.47563735", "0.47516397", "0.47451028", "0.4736611", "0.47355038", "0.47350648", "0.47313505", "0.4729782", "0.4729782", "0.47293788", "0.47255367", "0.47146416", "0.47078922", "0.4704963", "0.4704025", "0.46967283", "0.4695117", "0.4692476", "0.46922246", "0.46823537", "0.46823537", "0.46823537", "0.46823537", "0.46823537", "0.46823537", "0.4668481", "0.46670324", "0.46643707", "0.46643406", "0.46615055", "0.46577868", "0.46547982", "0.46547982", "0.46380353", "0.4637548", "0.46324962", "0.46249515", "0.4623459", "0.4620213", "0.4620213", "0.4620213", "0.4620213", "0.46123853", "0.4608265", "0.45987165", "0.45984295", "0.45936936", "0.45913124", "0.45864347", "0.45836088", "0.45818883", "0.45818847", "0.45763278", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403", "0.45686403" ]
0.0
-1
inputevent Alleviate browser bugs for input events
function n(){var t=this,i=window||global;_extends(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger("input")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on("change.inputevent",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off("input.inputevent",i.data.selector,t.behavesOk).off("change.inputevent",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched="0.0.3";for(var n=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],r=0;r<n.length;r++){var s=n[r];e(document).on("input.inputevent",s,{selector:s},t.behavesOk).on("change.inputevent",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(".inputevent")}})}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onInput(e) {\r\n /* console.log(e.detail);\r\n console.log(\"onInput: \", e.detail);*/\r\n }", "_onInputChange(event) {\n if (typeof event.target.oninput === 'undefined') {\n this._onInputChangeHandler(event);\n }\n }", "function onInput(e){\n console.log(e.detail);\n console.log(\"onInput: \", e.detail);\n }", "internalOnInput(event) {\n const me = this;\n\n // Keep the value synced with the inputValue at all times.\n me.inputting = true;\n me.value = me.input.value;\n me.inputting = false;\n\n me.trigger('input', { value: me.value, event });\n\n me.changeOnKeyStroke && me.changeOnKeyStroke(event);\n\n // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onInput\n }", "internalOnInput(event) {\n const me = this; // Keep the value synced with the inputValue at all times.\n\n me.inputting = true;\n me.value = me.input.value;\n me.inputting = false;\n me.trigger('input', {\n value: me.value,\n event\n });\n me.changeOnKeyStroke && me.changeOnKeyStroke(event); // since Widget has Events mixed in configured with 'callOnFunctions' this will also call onInput\n }", "function n(){var t=this,i=window||global;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger(\"input\")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on(\"change.inputevent\",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off(\"input.inputevent\",i.data.selector,t.behavesOk).off(\"change.inputevent\",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched=\"0.0.3\";for(var n=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],r=0;r<n.length;r++){var s=n[r];e(document).on(\"input.inputevent\",s,{selector:s},t.behavesOk).on(\"change.inputevent\",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(\".inputevent\")}})}", "function n(){var t=this,i=window||global;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger(\"input\")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on(\"change.inputevent\",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off(\"input.inputevent\",i.data.selector,t.behavesOk).off(\"change.inputevent\",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched=\"0.0.3\";for(var n=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],r=0;r<n.length;r++){var s=n[r];e(document).on(\"input.inputevent\",s,{selector:s},t.behavesOk).on(\"change.inputevent\",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(\".inputevent\")}})}", "function n(){var t=this,i=window||global;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger(\"input\")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on(\"change.inputevent\",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off(\"input.inputevent\",i.data.selector,t.behavesOk).off(\"change.inputevent\",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched=\"0.0.3\";for(var n=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],r=0;r<n.length;r++){var s=n[r];e(document).on(\"input.inputevent\",s,{selector:s},t.behavesOk).on(\"change.inputevent\",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(\".inputevent\")}})}", "function n(){var t=this,i=window||global;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger(\"input\")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on(\"change.inputevent\",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off(\"input.inputevent\",i.data.selector,t.behavesOk).off(\"change.inputevent\",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched=\"0.0.3\";for(var n=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],r=0;r<n.length;r++){var s=n[r];e(document).on(\"input.inputevent\",s,{selector:s},t.behavesOk).on(\"change.inputevent\",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(\".inputevent\")}})}", "onInputChange(event) {\n console.log(event);\n }", "internalOnInput(event) {\n const me = this,\n inputLen = me.input.value.length;\n\n // IE11 triggers input event on focus for some reason, ignoring it if not editable\n if (!me.editable) return;\n\n me.updateEmpty();\n\n if (inputLen >= me.minChars) {\n me.filterList(me.input.value);\n } else {\n if (me.validateFilter) {\n me[inputLen ? 'setError' : 'clearError'](fieldvalidateFilterErrorName);\n }\n me.hidePicker();\n }\n\n /**\n * User typed into the field. Please note that the value attached to this event is the raw input field value and\n * not the combos value\n * @event input\n * @param {Common.widget.Combo} source - The combo\n * @param {String} value - Raw input value\n */\n me.trigger('input', { value: me.input.value, event });\n }", "function l(){var n=this,r=window||t;o(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(t){n.isNativeEvent(t)&&e(t.target).trigger(\"input\")},misbehaves:function(t){n.isNativeEvent(t)&&(n.behavesOk(t),e(document).on(\"change.inputevent\",t.data.selector,n.fakeInputEvent),n.fakeInputEvent(t))},behavesOk:function(t){n.isNativeEvent(t)&&e(document).off(\"input.inputevent\",t.data.selector,n.behavesOk).off(\"change.inputevent\",t.data.selector,n.misbehaves)},install:function(){if(!r.inputEventPatched){r.inputEventPatched=\"0.0.3\";for(var t=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],i=0;i<t.length;i++){var a=t[i];e(document).on(\"input.inputevent\",a,{selector:a},n.behavesOk).on(\"change.inputevent\",a,{selector:a},n.misbehaves)}}},uninstall:function(){delete r.inputEventPatched,e(document).off(\".inputevent\")}})}", "function inputHandle(event) {\n\t\tvar inputValue = event.target.value;\n\t\tinputValueHandle(inputValue);\n\t}", "function i(){var t=this,n=window||s;e.extend(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(n){t.isNativeEvent(n)&&e(n.target).trigger(\"input\")},misbehaves:function(n){t.isNativeEvent(n)&&(t.behavesOk(n),e(document).on(\"change.inputevent\",n.data.selector,t.fakeInputEvent),t.fakeInputEvent(n))},behavesOk:function(n){t.isNativeEvent(n)&&e(document).off(\"input.inputevent\",n.data.selector,t.behavesOk).off(\"change.inputevent\",n.data.selector,t.misbehaves)},install:function(){if(!n.inputEventPatched){n.inputEventPatched=\"0.0.3\";for(var i=[\"select\",'input[type=\"checkbox\"]','input[type=\"radio\"]','input[type=\"file\"]'],r=0;r<i.length;r++){var o=i[r];e(document).on(\"input.inputevent\",o,{selector:o},t.behavesOk).on(\"change.inputevent\",o,{selector:o},t.misbehaves)}}},uninstall:function(){delete n.inputEventPatched,e(document).off(\".inputevent\")}})}", "dispatch_event( evt_name ){\r\n this.dispatchEvent( new CustomEvent( evt_name, { \r\n bubbles : true, \r\n cancelable : true, \r\n composed : false,\r\n detail : { value : this.input.value }\r\n }));\r\n }", "internalOnInput(event) {\n const me = this,\n value = me.input.value,\n inputLen = value.length; // IE11 triggers input event on focus for some reason, ignoring it if not editable\n\n if (!me.editable) {\n return;\n }\n\n me.updateEmpty();\n me.syncInputWidth();\n me.inputting = true;\n\n if (inputLen >= me.minChars) {\n me.filterList(value);\n } else {\n // During typing, the field is invalid\n if (me.validateFilter && !me.filterParamName) {\n me[inputLen ? 'setError' : 'clearError'](errorValidateFilter);\n }\n\n me.hidePicker();\n }\n\n me.inputting = false;\n /**\n * User typed into the field. Please note that the value attached to this event is the raw input field value and\n * not the combos value\n * @event input\n * @param {Core.widget.Combo} source - The combo\n * @param {String} value - Raw input value\n */\n\n me.trigger('input', {\n value,\n event\n });\n }", "onInputChange(value) {\r\n if (isObject(this.events) && value == this.events.input) {\r\n console.error(value);\r\n throw new Error(\"Attempt to override Forms.onInput callback with Forms.events.input will lead to infinite loop!\");\r\n }\r\n }", "function inputText (e){\n\tconsole.log(\"here\");\n\treturn outputEvent.innerHTML = userInput;\n\n\t//var onKeyUp = function(e) {\n\t//var userInput = document.getElementById('keypress-input').value; \t\n}", "onInput(event) {\n const input = event.target;\n // Let's wait for DOM to be updated\n nextTick().then(() => {\n this.$emit('update:modelValue', nullify(input.value));\n });\n }", "handleInput(input) {\n\t\t\n\t}", "function InputEvent() {\n var _this13 = this;\n\n var globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n $.extend(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: function isNativeEvent(evt) {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: function fakeInputEvent(evt) {\n if (_this13.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: function misbehaves(evt) {\n if (_this13.isNativeEvent(evt)) {\n _this13.behavesOk(evt);\n $(document).on('change.inputevent', evt.data.selector, _this13.fakeInputEvent);\n _this13.fakeInputEvent(evt);\n }\n },\n\n behavesOk: function behavesOk(evt) {\n if (_this13.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, _this13.behavesOk).off('change.inputevent', evt.data.selector, _this13.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: function install() {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n var _arr = ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]'];\n for (var _i = 0; _i < _arr.length; _i++) {\n var selector = _arr[_i];\n $(document).on('input.inputevent', selector, { selector: selector }, _this13.behavesOk).on('change.inputevent', selector, { selector: selector }, _this13.misbehaves);\n }\n },\n\n uninstall: function uninstall() {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n }", "onElementKeyPress(event) {}", "onElementKeyPress(event) {}", "function onInputActivated(e) {\r\n\t//upon activation try to cancel flashing\r\n\tcancelFlashingTab();\r\n\r\n\t//register the events for this input (taken from a forunm in extjs) \r\n\t var editor = this.container.dom.childNodes[1].lastChild.contentWindow.document;\r\n\t//Used addEvent instead of attachEvent for firefox support. \r\n\t addEvent(editor, 'keyup',checkEditorValue, false);\r\n\t checkEditorValue();\r\n}", "function InputEvent() {\n var _this14 = this;\n\n var globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n $.extend(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: function isNativeEvent(evt) {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: function fakeInputEvent(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: function misbehaves(evt) {\n if (_this14.isNativeEvent(evt)) {\n _this14.behavesOk(evt);\n $(document).on('change.inputevent', evt.data.selector, _this14.fakeInputEvent);\n _this14.fakeInputEvent(evt);\n }\n },\n\n behavesOk: function behavesOk(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, _this14.behavesOk).off('change.inputevent', evt.data.selector, _this14.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: function install() {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n var _arr = ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]'];\n for (var _i = 0; _i < _arr.length; _i++) {\n var selector = _arr[_i];\n $(document).on('input.inputevent', selector, { selector: selector }, _this14.behavesOk).on('change.inputevent', selector, { selector: selector }, _this14.misbehaves);\n }\n },\n\n uninstall: function uninstall() {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n }", "function InputEvent() {\n var _this14 = this;\n\n var globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n _extends(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: function isNativeEvent(evt) {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: function fakeInputEvent(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: function misbehaves(evt) {\n if (_this14.isNativeEvent(evt)) {\n _this14.behavesOk(evt);\n $(document).on('change.inputevent', evt.data.selector, _this14.fakeInputEvent);\n _this14.fakeInputEvent(evt);\n }\n },\n\n behavesOk: function behavesOk(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, _this14.behavesOk).off('change.inputevent', evt.data.selector, _this14.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: function install() {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n var _arr = ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]'];\n for (var _i = 0; _i < _arr.length; _i++) {\n var selector = _arr[_i];\n $(document).on('input.inputevent', selector, { selector: selector }, _this14.behavesOk).on('change.inputevent', selector, { selector: selector }, _this14.misbehaves);\n }\n },\n\n uninstall: function uninstall() {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n }", "onInputChange(event) {\n\t\t// access value of the input\n\t\tconsole.log(event.target.value)\n\t}", "_evtChange(event) { }", "_onInputChangeHandler(event) {\n // stops the current event\n event.stopPropagation();\n\n const handle = event.target.closest(`.${CLASSNAME_HANDLE}`);\n\n if (event.target === document.activeElement) {\n this._focus(event);\n }\n\n this._updateValue(handle, event.target.value, true);\n }", "handleInput() {}", "inputEventReceived(inputEvent) {\n switch (inputEvent.eventType) {\n case 'focusClassAdded':\n // Handle as desired\n break;\n case 'focusClassRemoved':\n // Handle as desired\n break;\n case 'errorClassAdded':\n // Handle as desired\n break;\n case 'errorClassRemoved':\n // Handle as desired\n break;\n case 'cardBrandChanged':\n // Handle as desired\n break;\n case 'postalCodeChanged':\n // Handle as desired\n break;\n default:\n break;\n }\n }", "onChange() {\n triggerEvent(this.input, 'input');\n triggerEvent(this.input, 'change');\n }", "_inputChangeHandler(event) {\n event.stopPropagation();\n event.preventDefault();\n }", "function MCH_InputChange(el_input) {\n console.log(\" ----- MCH_InputChange ----\")\n console.log(\" el_input\", el_input)\n mod_MCH_dict.has_changes = true;\n MCH_Hide_Inputboxes();\n }", "_inputValueChanged(e) {\n // Handle only input events from our inputElement.\n if (e.composedPath().indexOf(this.inputElement) !== -1) {\n this._inputElementValue = this.inputElement[this._propertyForValue];\n\n this._filterFromInput(e);\n }\n }", "function cInput(trs){\n\t\ttrs.runtime.inputEventOut = 'input_ge';\n\t\ttrs.runtime.inputEventPush = 'inpute_gp';\n\n\t\ttrs.addEvent(trs.runtime.inputEventPush);\n\t\ttrs.addEvent(trs.runtime.inputEventOut);\n\n\t\ttrs.PushEvent = PushEvent;\n\t\ttrs.DispatchEvents = DispatchEvents;\n\n\t\t// trs.addEventListener(\"keydown\", onKeyDown);\n\t\t//trs.addEventListener(\"keypress\", onKeyDown);\n\t\ttrs.canvas.focus();\n\t\ttrs.canvas.setAttribute('tabindex','0');\n\t\t//trs.canvas.setAttribute('contentEditable','true');\n\n\t\t// TODO: add keymapper: [{keyEnc:scodeToDispatch}]\n\t}", "function handleInput() {\n\t\t\tif (onInput) {\n\t\t\t\tonInput(value);\n\t\t\t}\n\t\t}", "keypressInput(e) {\n // console.log(e);\n let keycode = event.key; // also for cross-browser compatible\n (this.acceptMoves) && this.ea.publish('keyPressed', keycode);\n }", "function onWritingInInput(ev) {\n var inputValue = ev.target.value;\n\n console.log(inputValue);\n }", "function handleInputChange(event) {\n console.count('input changed');\n }", "onLoadInputClick(e) {\n console.log(\"Load input Clicked!\");\n e.stopPropagation();\n return false;\n }", "handlePCInputKeyDown(ev){\n EventUtils.filterNumericInput(ev)\n }", "_handleKeyPress(input){\n switch (typeof input){\n case 'number': return this._handleNumericalKeyPress(input);\n case 'string': return this._handleOperationKeyPress(input);\n }\n }", "function handleInput(e) {\n\t\tsetInputValue(e.target.value)\n\t}", "_onInputButtonPressed(input) {\n alert(input);\n }", "function Input() {}", "onInput(e) {\n this.updateFilledState();\n }", "onInputChange(event) {\n console.log(event.target.value)\n }", "onInputChange(event) {\n console.log(event.target.value);\n }", "function bindEventsToInput(element) {\n element._input.addEventListener('keydown', function (e) {\n if (element.busy && e.keyCode === _keyCode2.default.SPACE) {\n e.preventDefault();\n }\n });\n // prevent toggle can be trigger through SPACE key on Firefox\n if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {\n element._input.addEventListener('click', function (e) {\n if (element.busy) {\n e.preventDefault();\n }\n });\n }\n}", "_inputPasteHandler() {\n const that = this;\n\n requestAnimationFrame(() => that.$.fireEvent('changing', { 'currentValue': that.$.input.value, 'validValue': that.value, 'radix': that._radixNumber }));\n }", "_noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }", "handleEvent(event) {\n switch (event.type) {\n case 'input':\n this.onSearch(this.inputNode.value);\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n default:\n break;\n }\n }", "handleEvent(event) {\n switch (event.type) {\n case 'input':\n this.onSearch(this.inputNode.value);\n break;\n case 'focus':\n case 'blur':\n this._toggleFocused();\n break;\n default:\n break;\n }\n }", "function onInputChange(e) { // get triggered ONLY when you exit the input field\n e.preventDefault()\n const value = e.target.value\n const inputId = e.target.id\n console.log(e.target.id)\n console.log(e.target.value)\n ipcRenderer.send('inputChange', {value, inputId})\n}", "onInput(event) {\n this.$emit(\"input\", {\n content: event.target.value\n });\n }", "_onInputClick(event) {\n // We have to stop propagation for click events on the visual hidden input element.\n // By default, when a user clicks on a label element, a generated click event will be\n // dispatched on the associated input element. Since we are using a label element as our\n // root container, the click event on the `slide-toggle` will be executed twice.\n // The real click event will bubble up, and the generated click event also tries to bubble up.\n // This will lead to multiple click events.\n // Preventing bubbling for the second event will solve that issue.\n event.stopPropagation();\n }", "onInputChange(event) {\n this.props.onInputChange(event.target.value);\n }", "function tpieevents(input) {\n store_remote_events(input);\n parse_events(input);\n}", "handleInputChange(event) {\n let eventDetail = {};\n let typeLowercased = this.type.toLowerCase();\n\n switch (typeLowercased) {\n case \"toggle\":\n eventDetail = {\n // event.detail.value is undefined for a toggle\n value: event.detail.checked,\n };\n break;\n\n default:\n eventDetail = {\n value: event.detail.value,\n };\n }\n\n const settingsInputChange = new CustomEvent(\"settingsinputchange\", { detail: eventDetail });\n this.dispatchEvent(settingsInputChange);\n }", "_onInput(event) {\n // Listening to the input event wouldn't be necessary when the input is using the\n // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.\n this.lastKeyValue = event.data;\n if (this._isTextarea) {\n this.lastCaretPosition = this._elementRef.nativeElement.selectionStart;\n }\n }", "function isInput( e ) {\n\n var t = getTN( e );\n\n return t === 'input' || t === 'textarea';\n\n }", "_onInput() {\n // This is a noop function and is used to let Angular know whenever the value changes.\n // Angular will run a new change detection each time the `input` event has been dispatched.\n // It's necessary that Angular recognizes the value change, because when floatingLabel\n // is set to false and Angular forms aren't used, the placeholder won't recognize the\n // value changes and will not disappear.\n // Listening to the input event wouldn't be necessary when the input is using the\n // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.\n }", "onInputChange(name, event) {\n\t\tvar change = {};\n\t\tchange[name] = event.target.value;\n\t\tthis.setState(change);\n\t}", "handleInput(e) {\n if (this.props.onUpdate) { this.props.onUpdate(e.currentTarget.value) }\n }", "handleInput(event) {\n\t\t\tthis.insertCharacter(event.which);\n\t}", "_inputKeydownHandler(event) {\n const that = this,\n keyCode = !event.charCode ? event.which : event.charCode;\n\n if (keyCode === 40 && that._isIncrementOrDecrementAllowed()) {\n // decrement when Down Arrow is pressed\n that._incrementOrDecrement('subtract');\n }\n else if (keyCode === 38 && that._isIncrementOrDecrementAllowed()) {\n // increment when Up Arrow is pressed\n that._incrementOrDecrement('add');\n }\n\n that._keydownInfo = { value: that.$.input.value, specialKey: event.altKey || event.ctrlKey || event.shiftKey };\n }", "function inputKeydown(e)\n {\n // Pressing enter or space bar or comma while focused on input\n if(e.keyCode == 13 || e.keyCode == 32 || e.keyCode == 188)\n {\n inputKeydownEnter();\n }\n\n // Pressing backspace while focused on input\n if(e.keyCode == 8)\n {\n hideIfUndefined(input);\n }\n }", "function fieldOnChange(e) {\r\n\tvar obj = targetElement(e);\r\n\tcheckInput(obj);\r\n}", "onElementKeyUp(event) {}", "onElementKeyUp(event) {}", "function makeListener(input, v) {\n\tvar n = document.getElementById(input)\n\tn.oninput = function() { v = this.value; needsUpdate = true; } \n}", "function checkInput(e) {\n\t\tswitch (e.which) {\n\t\t\tcase 69:\n\t\t\tcase 187:\n\t\t\tcase 189:\n\t\t\tcase 190:\n\t\t\t\te.preventDefault();\n\t\t}\n\t}", "onInput(calc) {\n let elm = this.getState('dom');\n elm.addEventListener('input', event => {\n // when user types --> update state\n this.setState({ userInput: event.target.value });\n // when state is updated, recall method notifyObservers as render() in Reactjs\n let data = calc(this.getState('userInput')); // calc func always return a string as final result\n this.notifyObservers(data);\n });\n }", "function MUA_InputKeyup(el_input, event_key) {\n //console.log( \"===== MUA_InputKeyup ========= \");\n //console.log( \"event_key\", event_key);\n\n const fldName = get_attr_from_el(el_input, \"data-field\");\n if(el_input){\n if(event_key === \"Shift\"){\n // pass\n } else if(event_key === \"Enter\" && fldName === \"username\"){\n el_MUA_last_name.focus();\n } else if(event_key === \"Enter\" && fldName === \"last_name\"){\n el_MUA_email.focus();\n } else {\n let field_value = el_input.value;\n //console.log( \"fldName\", fldName);\n //console.log( \"field_value\", field_value);\n // fldName is 'username', 'last_name' or 'email' . fldName \"schoolname\" is handled in MUA_InputSchoolname\n if (fldName === \"username\" && field_value){\n field_value = field_value.replace(/, /g, \"_\"); // replace comma or space with \"_\"\n field_value = replaceChar(field_value)\n if (field_value !== el_input.value) { el_input.value = field_value}\n }\n mod_MUA_dict[fldName] = (field_value) ? field_value : null\n mod_MUA_dict[\"has_changed_\" + fldName] = true;\n\n MUA_ResetElements();\n // send schoolbase, username and email to server after 1000 ms\n // abort if within that period a new value is entered.\n // checked by comparing the timestamp\n //time_stamp = Number(Date.now())\n //setTimeout(MUA_Save, 1500, time_stamp); // time_stamp is an argument passed to the function MUA_Save.\n\n MUA_DisableBtnSave()\n\n }\n }\n }", "onInputChange(e) {\n this.setState({\n input: e && e.target.value,\n });\n }", "function onInput(event) {\n\t\tutils.setHTML('#form-error', \"\");\n\t\tif(event.target.name === 'name') {\n\t\t\tutils.setHTML('#name .error', \"\");\n\t\t} else if(event.target.name === 'nameAlpha') {\n\t\t\tutils.setHTML('#nameAlpha .error', \"\");\n\t\t} else if(event.target.name === 'birth') {\n\t\t\tutils.setHTML('#birth .error', \"\");\n\t\t} else if(event.target.name === 'death') {\n\t\t\tutils.setHTML('#death .error', \"\");\n\t\t}\n\t}", "function Component_InputHandler() {\n\n /**\n * Indicates if all input events, such as mouse and keyboard event, should be blocked.\n *\n * @property blockInput\n * @type boolean\n * @default false\n */\n this.blockInput = false;\n }", "captureInputField(myEvent)\n {\n //target is the input text box and target.value gives the val of the text\n console.log(myEvent.target.value)\n this.setState({textValue : myEvent.target.value})\n\n }", "function runevent2(e){\n\tconsole.log(`Event Type = ${e.type}`);\n\n\t// get input value \n\tconsole.log(taskinput.value);\n\t// e.preventDefault();\n}", "_inputWheelHandler(event) {\n const that = this,\n activeElement = that.shadowRoot ? (that.shadowRoot.activeElement || document.activeElement) : document.activeElement;\n\n if (that.$.input === activeElement && that.enableMouseWheelAction && that._isIncrementOrDecrementAllowed()) {\n event.stopPropagation();\n event.preventDefault();\n if (event.wheelDelta > 0) {\n that._incrementOrDecrement('add');\n }\n else {\n that._incrementOrDecrement('subtract');\n }\n }\n }", "function inputEventHandler(e){\n if (e.ctrlKey) {\n \t return _defaultInputEvent(e);\n } \n var target = e.data.target;\n var t = $(target);\n var state = t.data('combo');\n var opts = t.combo('options');\n state.panel.panel('options').comboTarget = target;\n \n switch(e.keyCode){\n case 38: // up\n e.preventDefault();\n t.combo('showPanel');\n opts.keyHandler.up.call(target, e);\n break;\n case 40: // down\n e.preventDefault();\n t.combo('showPanel'); \n opts.keyHandler.down.call(target, e);\n break;\n case 37: // left\n opts.keyHandler.left.call(target, e);\n break;\n case 39: // right\n opts.keyHandler.right.call(target, e);\n break;\n case 13: // enter\n //e.preventDefault();\n opts.keyHandler.enter.call(target, e);\n default:\n return _defaultInputEvent(e);\n //return false;\n// case 9: // tab\n// case 27: // esc\n// t.combo('hidePanel');\n// break;\n }\n }", "handleEvent(event) {\n switch (event.type) {\n case 'click':\n this._evtClick(event);\n break;\n case 'focus':\n this._evtFocus(event);\n break;\n default:\n break;\n }\n }", "function _onKeyDown(event) {\n\t\tif ($.inArray(event.target.tagName.toLowerCase(), ['input','textarea']) < 0) { // let form elements handle their own input\n\t\t\tvar keyindex = $.inArray(event.which, [27,37,39,36,35]); // keys are [ESC, left arrow, right arrow, home, end]\n\t\t\tkeyindex < 0 || [hideDialog,previousItem,nextItem,firstItem,lastItem][keyindex]();\n\t\t\treturn false; // cancel event propagation\n\t\t}\n\t}", "function getInputValue() {\r\n let input = event.target.innerText;\r\n console.log(input);\r\n printValue(input);\r\n}", "function handleInput(e) {\n setInput(e.target.value);\n }", "function onInputHandler(event,_id) {\n// console.log(\"刚输入的是:\"+event.target.value);\n\tif( lastLength < event.target.value.length ){\t//上次字数少于当前字数,说明新加了,否则就是删除\n\t\tif( event.target.value.length==4 ){\n\t\t//\tevent.target.value += \"-\"\n\t\t}\n\t}\n\tlastLength = event.target.value.length;\t//存储当前字数\n\tif( event.target.value.length >7 && event.target.value.indexOf(\"-\")<0){//16位没有横杠,说明是直接复制过来的\n\t\tvar temp = event.target.value;\n\t//\ttemp = temp.slice(0, 4) + \"-\" + temp.slice(4);\n\t\tevent.target.value = temp.slice(0,8);\n\t}\n}", "function MUD_InputChange(el_input) {\n console.log( \"===== MUD_InputChange ========= \");\n\n const fldName = get_attr_from_el(el_input, \"data-field\");\n let field_value = el_input.value;\n console.log( \"fldName\", fldName);\n console.log( \"field_value\", field_value);\n const has_error = MUD_validate_input(el_input);\n\n }", "function doBrowserInput(event) {\r\n if (GAME.gameOver) {\r\n return;\r\n }\r\n if (event.which === 13 || event.keyCode === 13) {\r\n var ti = document.getElementById(\"con_stdin\");\r\n doBrowserOutput(ti.value + \"\\n\");\r\n GAME.input(ti.value);\r\n ti.value = \"\";\r\n } \r\n}", "handleEvent(event) {\n if (this.isHidden || !this._editor) {\n return;\n }\n switch (event.type) {\n case 'keydown':\n this._evtKeydown(event);\n break;\n case 'mousedown':\n this._evtMousedown(event);\n break;\n case 'scroll':\n this._evtScroll(event);\n break;\n default:\n break;\n }\n }", "inputOnChange(e) {\n e.target.value = e.target.value;\n this.props.dispatch(updateStateText(e.target.value));\n }", "function userInputChanges(e) {\n setUserInput(e.target.value);\n }", "function Input(parent, domElement) {\n var enabled = false;\n function dispatch(e) { \n if (!enabled)\n return;\n e.preventDefault();\n var offset = $(parent).offset();\n var x = e.pageX - offset.left;\n var y = e.pageY - offset.top;\n Messenger.getInstance().sendMessage({type: e.type, x: x, y: y, e:e});\n //$(e.target).css('background', ['red','blue','green','yellow'][~~(Math.random()*4)]);\n }\n var events = ['mousemove', 'mousedown', 'mouseup']; \n this.start = function() {\n enabled = true;\n for (var i = 0, $d = $(document); i < events .length; i++) \n $d.bind(events[i], dispatch);\n }\n this.stop = function() {\n enabled = false;\n }\n}", "function input(event) {\n // Take Input from the Player\n // console.log(\"Input\");\n // console.log(\"Event type: \" + event.type);\n\n if (event.type === \"keydown\") {\n switch (event.keyCode) {\n case 37:\n gamerInput = new GamerInput(\"Left\");\n break; //Left key\n case 38:\n gamerInput = new GamerInput(\"Up\");\n break; //Up key\n case 39:\n gamerInput = new GamerInput(\"Right\");\n break; //Right key\n case 40:\n gamerInput = new GamerInput(\"Down\");\n break; //Down key\n case 32:\n gamerInput = new GamerInput (\"Space\");\n break;\n default:\n gamerInput = new GamerInput(\"None\"); //No Input\n }\n } else {\n gamerInput = new GamerInput(\"None\"); //No Input\n }\n console.log(\"Gamer Input :\" + gamerInput.action);\n}", "onInputChange(name, event) {\n\n var change = {};\n \t\tchange[name] = event.target.value;\n \t\tthis.setState(change);\n\n \t}", "function eventcheck(event) {\n if (!event)\n return;\n try {\n var obj = event.target;\n if (obj.mozIsTextField) {\n if (event.keyCode == 9 || event.keyCode == 13) {\n if (obj.id == gtGrdObj(event.target.parentNode).editCtrl) {\n event.preventDefault(true);\n event.stopPropagation();\n }\n else if (obj.value == \"\" && getIAttribute(event.target.nextSibling, \"q\") == \"t\") {\n event.preventDefault(true);\n event.stopPropagation();\n }\n }\n }\n }\n catch (ex) { }\n}" ]
[ "0.7483774", "0.7424675", "0.73940694", "0.73078495", "0.72044325", "0.71850246", "0.71850246", "0.71850246", "0.71850246", "0.71568596", "0.7054438", "0.7052404", "0.7024237", "0.6939248", "0.690374", "0.68855846", "0.68607026", "0.6822698", "0.68046427", "0.6775204", "0.6747469", "0.6742935", "0.6742935", "0.67388153", "0.6662059", "0.6649115", "0.6640286", "0.663097", "0.6599761", "0.65797216", "0.6544348", "0.6496592", "0.64817035", "0.64699787", "0.64350355", "0.64314216", "0.6430684", "0.6413878", "0.64092124", "0.6406928", "0.6404286", "0.64040464", "0.6388782", "0.63792527", "0.63789976", "0.63639575", "0.6361578", "0.63452524", "0.63412696", "0.63406736", "0.6327758", "0.6322661", "0.6320179", "0.6320179", "0.6297958", "0.62896585", "0.62841034", "0.6280351", "0.62665164", "0.62517524", "0.6246121", "0.6234823", "0.6218377", "0.6200341", "0.6187902", "0.6181474", "0.6152324", "0.6148555", "0.6124595", "0.6120352", "0.6120352", "0.61140275", "0.6109575", "0.6098498", "0.6094191", "0.6088966", "0.6076533", "0.6076457", "0.60754114", "0.6063692", "0.6062325", "0.6059453", "0.6055226", "0.6046008", "0.6040756", "0.6033914", "0.60312444", "0.6022859", "0.5999359", "0.5998305", "0.59980863", "0.5996971", "0.59851366", "0.5985069", "0.59836435", "0.59796923" ]
0.7285664
8
! moment.js locale configuration ! locale : Breton [br] ! author : JeanBaptiste Le Duigou :
function ud(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+xd(d[c],a)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale ' + key + ' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\",\n 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:2121\");\n\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else\n {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else\n {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\", 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:1880\");\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function T(a,b,c,d,e){var f;// works with moment-pre-2.8\n// Expand localized format strings, like \"LL\" -> \"MMMM D YYYY\"\n// BTW, this is not important for `formatDate` because it is impossible to put custom tokens\n// or non-zero areas in Moment's localized format strings.\nreturn a=Ia.moment.parseZone(a),b=Ia.moment.parseZone(b),f=(a.localeData||a.lang).call(a),c=f.longDateFormat(c)||c,d=d||\" - \",U(a,b,W(c),d,e)}// expose", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function parseMonth(str) {\r\n\t// Supports: Bulgarian, Czech, Danish, Dutch, English, French, German, Greek, Indonesian, Italian, Macedonian, Portuguese, Serbian, Slovak, Spanish, Swedish\r\n\tvar dict = {\r\n\t\t'bg'\t\t: Array('??????', '????????', '????', '?????', '???', '???', '???', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'cs'\t\t: Array('leden', '򮯲', 'b?ezen', 'duben', 'kv?ten', '?erven', '?ervenec', 'srpen', 'z‭', '?n', 'listopad', 'prosinec'),\r\n\t\t'da'\t\t: Array('januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'),\r\n\t\t'de'\t\t: Array('januar', 'februar', 'm峺', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember'),\r\n\t\t'en-abbr1'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'),\r\n\t\t'en-abbr2'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'),\r\n\t\t'en'\t\t: Array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'),\r\n\t\t'es'\t\t: Array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'),\r\n\t\t'el'\t\t: Array('i?????????', '???????????', '???????', '????????', '?????', 'i??????', 'i??????', '?????????', '???????????', 'o????????', '?????????', '??????????'),\r\n\t\t'fr'\t\t: Array('janvier', 'f귲ier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao󴧬 'septembre', 'octobre', 'novembre', 'dꤥmbre'),\r\n\t\t'id'\t\t: Array('januari', 'februari', 'maret', 'april', 'mei', 'juni', 'juli', 'agustus', 'september', 'oktober', 'november', 'desember'),\r\n\t\t'it'\t\t: Array('gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'),\r\n\t\t'mk'\t\t: Array('???????', '????????', '????', '?????', '???', '????', '????', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'nl'\t\t: Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'),\r\n\t\t'pt'\t\t: Array('janeiro', 'fevereiro', 'mar诧, 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'),\r\n\t\t'sk'\t\t: Array('januⲧ, 'februⲧ, 'marec', 'apr, 'm⪧, 'j򮧬 'j򬧬 'august', 'september', 'okt󢥲', 'november', 'december'),\r\n\t\t'sr'\t\t: Array('??????', '???????', '????', '?????', '???', '????', '????', '??????', '?????????', '???????', '????????', '????????'),\r\n\t\t'sv'\t\t: Array('januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december')\r\n\t}\r\n\t$d_months = Array(Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array());\r\n\tfor (var key in dict) { for (var i=0; i<dict[key].length; i++) { $d_months[i].push(dict[key][i]); } }\r\n\tfor (var i=0; i<12; i++) { $d_months[i] = RegExp('^(.*\\\\s)?(' + $d_months[i].join('|') + ')(\\\\s.*)?$'); }\r\n\t\r\n\tparseMonth = function(str) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tfor (var i=0; i<$d_months.length; i++) { if (str.match($d_months[i])) { return i; } }\r\n\t\treturn -1;\r\n\t}\r\n\treturn parseMonth(str);\r\n}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "formatBDToDateTime(str) {\n var formatter = new Intl.DateTimeFormat('pt-BR').format(str);\n return formatter;\n }", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n }", "function getSetGlobalLocale (key, values) {\n\t var data;\n\t if (key) {\n\t if (isUndefined(values)) {\n\t data = getLocale(key);\n\t }\n\t else {\n\t data = defineLocale(key, values);\n\t }\n\t\n\t if (data) {\n\t // moment.duration._locale = moment._locale = data;\n\t globalLocale = data;\n\t }\n\t else {\n\t if ((typeof console !== 'undefined') && console.warn) {\n\t //warn user if arguments are passed but the locale could not be set\n\t console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n\t }\n\t }\n\t }\n\t\n\t return globalLocale._abbr;\n\t }", "function getSetGlobalLocale (key, values) {\n\t var data;\n\t if (key) {\n\t if (isUndefined(values)) {\n\t data = getLocale(key);\n\t }\n\t else {\n\t data = defineLocale(key, values);\n\t }\n\t\n\t if (data) {\n\t // moment.duration._locale = moment._locale = data;\n\t globalLocale = data;\n\t }\n\t else {\n\t if ((typeof console !== 'undefined') && console.warn) {\n\t //warn user if arguments are passed but the locale could not be set\n\t console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n\t }\n\t }\n\t }\n\t\n\t return globalLocale._abbr;\n\t }", "function getSetGlobalLocale (key, values) {\n\t var data;\n\t if (key) {\n\t if (isUndefined(values)) {\n\t data = getLocale(key);\n\t }\n\t else {\n\t data = defineLocale(key, values);\n\t }\n\t\n\t if (data) {\n\t // moment.duration._locale = moment._locale = data;\n\t globalLocale = data;\n\t }\n\t else {\n\t if ((typeof console !== 'undefined') && console.warn) {\n\t //warn user if arguments are passed but the locale could not be set\n\t console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n\t }\n\t }\n\t }\n\t\n\t return globalLocale._abbr;\n\t }", "function getSetGlobalLocale (key, values) {\n\t var data;\n\t if (key) {\n\t if (isUndefined(values)) {\n\t data = getLocale(key);\n\t }\n\t else {\n\t data = defineLocale(key, values);\n\t }\n\t\n\t if (data) {\n\t // moment.duration._locale = moment._locale = data;\n\t globalLocale = data;\n\t }\n\t else {\n\t if ((typeof console !== 'undefined') && console.warn) {\n\t //warn user if arguments are passed but the locale could not be set\n\t console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n\t }\n\t }\n\t }\n\t\n\t return globalLocale._abbr;\n\t }", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n }\n\n return globalLocale._abbr;\n}" ]
[ "0.80059713", "0.7704327", "0.7642467", "0.7615224", "0.7004516", "0.67185086", "0.6640758", "0.6581124", "0.6524153", "0.6427434", "0.6401369", "0.6152816", "0.6152816", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.601329", "0.601329", "0.601329", "0.601329", "0.5999022", "0.5999022", "0.5999022", "0.58424306", "0.58424306", "0.58424306", "0.58424306", "0.58424306", "0.5835205", "0.5785874", "0.5775219", "0.5712649", "0.5669959", "0.5655941", "0.5655941", "0.56145626", "0.5599077", "0.5592249", "0.5592249", "0.5592249", "0.5592249", "0.55920225", "0.55920225", "0.55920225", "0.55920225", "0.55920225", "0.55920225", "0.5581281", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156", "0.55799156" ]
0.0
-1
! moment.js locale configuration ! locale : German (Switzerland) [dech] ! author : sschueller :
function Dd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale ' + key + ' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function formatDate(date) {\n moment.locale(\"fr\");\n return moment(new Date(Number(date)).toISOString()).format(\"D MMM YYYY\");\n }", "function getMomentLocaleData(localeCode){return moment.localeData(localeCode)||moment.localeData('en');}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function T(a,b,c,d,e){var f;// works with moment-pre-2.8\n// Expand localized format strings, like \"LL\" -> \"MMMM D YYYY\"\n// BTW, this is not important for `formatDate` because it is impossible to put custom tokens\n// or non-zero areas in Moment's localized format strings.\nreturn a=Ia.moment.parseZone(a),b=Ia.moment.parseZone(b),f=(a.localeData||a.lang).call(a),c=f.longDateFormat(c)||c,d=d||\" - \",U(a,b,W(c),d,e)}// expose", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\",\n 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:2121\");\n\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function getMomentLocaleData(langCode) {\n var func = moment.localeData || moment.langData;\n return func.call(moment, langCode) ||\n func.call(moment, 'en'); // the newer localData could return null, so fall back to en\n }", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "function formatMoment(m, format) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return m.lang().longDateFormat(input) || input;\n }\n\n while (i-- && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n }\n\n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n\n return formatFunctions[format](m);\n }", "getGermanDateFormat(date) {\n let values = date.split(Config.DATE_CHECKER.DASH),\n result = Config.EMPTY_STRING;\n for (let i = values.length - 1; i >= 0; i--) {\n result += values[i];\n if (i !== 0) {\n result += Config.DATE_CHECKER.POINT;\n }\n }\n return result;\n }", "function getLocaleText(locale = \"DE\") {\n return {\n days_narrow: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"narrow\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_short: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"short\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_long: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"long\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n month_narrow: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"narrow\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_short: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"short\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_long: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"long\" }).format(new Date(Date.UTC(2021, month, 1)))\n )\n }\n}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else\n {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else\n {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\", 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:1880\");\n }\n }\n }\n\n return globalLocale._abbr;\n }", "static getLocale() {\n return 'en_US';\n }", "function getDateString(moment){\n return moment.toLocaleDateString('en-US',\n {year:'numeric'\n ,month:'long',\n day:'numeric'})\n}", "function locale(localeCode,newFcOptions){var fcOptions;var momOptions;// get the FullCalendar internal option hash for this locale. create if necessary\nfcOptions=exports.localeOptionHash[localeCode]||(exports.localeOptionHash[localeCode]={});// provided new options for this locales? merge them in\nif(newFcOptions){fcOptions=exports.localeOptionHash[localeCode]=options_1.mergeOptions([fcOptions,newFcOptions]);}// compute locale options that weren't defined.\n// always do this. newFcOptions can be undefined when initializing from i18n file,\n// so no way to tell if this is an initialization or a default-setting.\nmomOptions=getMomentLocaleData(localeCode);// will fall back to en\n$.each(momComputableOptions,function(name,func){if(fcOptions[name]==null){fcOptions[name]=func(momOptions,fcOptions);}});// set it as the default locale for FullCalendar\noptions_1.globalDefaults.locale=localeCode;}", "getFormattedDate ({ date }) {\n if (typeof date === 'string') {\n return format(parseISO(date), \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }\n return format(date, \"d 'de' MMMM', às' HH'h'mm\", {\n locale: ptBR\n })\n }", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n \n format = expandFormat(format, m.localeData());\n \n if (!formatFunctions[format]) {\n formatFunctions[format] = makeFormatFunction(format);\n }\n \n return formatFunctions[format](m);\n }", "function parseMonth(str) {\r\n\t// Supports: Bulgarian, Czech, Danish, Dutch, English, French, German, Greek, Indonesian, Italian, Macedonian, Portuguese, Serbian, Slovak, Spanish, Swedish\r\n\tvar dict = {\r\n\t\t'bg'\t\t: Array('??????', '????????', '????', '?????', '???', '???', '???', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'cs'\t\t: Array('leden', '򮯲', 'b?ezen', 'duben', 'kv?ten', '?erven', '?ervenec', 'srpen', 'z‭', '?n', 'listopad', 'prosinec'),\r\n\t\t'da'\t\t: Array('januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'),\r\n\t\t'de'\t\t: Array('januar', 'februar', 'm峺', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember'),\r\n\t\t'en-abbr1'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'),\r\n\t\t'en-abbr2'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'),\r\n\t\t'en'\t\t: Array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'),\r\n\t\t'es'\t\t: Array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'),\r\n\t\t'el'\t\t: Array('i?????????', '???????????', '???????', '????????', '?????', 'i??????', 'i??????', '?????????', '???????????', 'o????????', '?????????', '??????????'),\r\n\t\t'fr'\t\t: Array('janvier', 'f귲ier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao󴧬 'septembre', 'octobre', 'novembre', 'dꤥmbre'),\r\n\t\t'id'\t\t: Array('januari', 'februari', 'maret', 'april', 'mei', 'juni', 'juli', 'agustus', 'september', 'oktober', 'november', 'desember'),\r\n\t\t'it'\t\t: Array('gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'),\r\n\t\t'mk'\t\t: Array('???????', '????????', '????', '?????', '???', '????', '????', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'nl'\t\t: Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'),\r\n\t\t'pt'\t\t: Array('janeiro', 'fevereiro', 'mar诧, 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'),\r\n\t\t'sk'\t\t: Array('januⲧ, 'februⲧ, 'marec', 'apr, 'm⪧, 'j򮧬 'j򬧬 'august', 'september', 'okt󢥲', 'november', 'december'),\r\n\t\t'sr'\t\t: Array('??????', '???????', '????', '?????', '???', '????', '????', '??????', '?????????', '???????', '????????', '????????'),\r\n\t\t'sv'\t\t: Array('januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december')\r\n\t}\r\n\t$d_months = Array(Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array());\r\n\tfor (var key in dict) { for (var i=0; i<dict[key].length; i++) { $d_months[i].push(dict[key][i]); } }\r\n\tfor (var i=0; i<12; i++) { $d_months[i] = RegExp('^(.*\\\\s)?(' + $d_months[i].join('|') + ')(\\\\s.*)?$'); }\r\n\t\r\n\tparseMonth = function(str) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tfor (var i=0; i<$d_months.length; i++) { if (str.match($d_months[i])) { return i; } }\r\n\t\treturn -1;\r\n\t}\r\n\treturn parseMonth(str);\r\n}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function toLocalizedDateString(momentDate, format, locale) {\n var adjustedMomentDate = (locale != null) ? momentDate.locale(locale) : momentDate;\n return adjustedMomentDate.format(format);\n}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "setLocale(locale) {\n this.locale = locale;\n }", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] =\n\t formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t }", "function getMomentLocaleData(localeCode) {\n\t\treturn moment.localeData(localeCode) || moment.localeData('en');\n\t}", "function getMomentLocaleData(localeCode) {\n return moment.localeData(localeCode) || moment.localeData('en');\n}", "function getMomentLocaleData(localeCode) {\n return moment.localeData(localeCode) || moment.localeData('en');\n}", "function getMomentLocaleData(localeCode) {\n return moment.localeData(localeCode) || moment.localeData('en');\n}", "function getMomentLocaleData(localeCode) {\n return moment.localeData(localeCode) || moment.localeData('en');\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function getSetGlobalLocale (key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n }\n else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n }\n else {\n if ((typeof console !== 'undefined') && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n\n return globalLocale._abbr;\n}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t}", "function formatMoment(m, format) {\n\t if (!m.isValid()) {\n\t return m.localeData().invalidDate();\n\t }\n\t\n\t format = expandFormat(format, m.localeData());\n\t formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n\t\n\t return formatFunctions[format](m);\n\t}", "get() {\n return defaultLocale;\n }", "function getMomentLocaleData(localeCode) {\n\treturn moment.localeData(localeCode) || moment.localeData('en');\n}", "function getMomentLocaleData(localeCode) {\n\treturn moment.localeData(localeCode) || moment.localeData('en');\n}" ]
[ "0.818455", "0.7860676", "0.7833741", "0.73853076", "0.70475256", "0.69542605", "0.68731415", "0.68490523", "0.65440273", "0.6526152", "0.6369514", "0.601142", "0.601142", "0.59891135", "0.5938963", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.5873426", "0.5855725", "0.5855725", "0.5855725", "0.5855725", "0.5830532", "0.5830532", "0.5830532", "0.5830532", "0.5830532", "0.5803016", "0.5803016", "0.5803016", "0.5803016", "0.5678633", "0.5678633", "0.5678633", "0.56418395", "0.5634094", "0.56200826", "0.56164366", "0.56164366", "0.5606899", "0.5606899", "0.5606899", "0.5606899", "0.5606899", "0.5606899", "0.5606899", "0.5606899", "0.5602126", "0.55952543", "0.5594942", "0.55751127", "0.55737555", "0.55667657", "0.5563216", "0.5556135", "0.5556135", "0.5556135", "0.5556055", "0.5556055", "0.55170625", "0.5499982", "0.5496316", "0.5496316", "0.5464536", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.54609466", "0.5455549", "0.5440066", "0.5409384", "0.54016584", "0.54016584", "0.54016584", "0.54016584", "0.53938127", "0.53938127", "0.53938127", "0.53938127", "0.53938127", "0.53938127", "0.5387972", "0.5387972", "0.5387972", "0.5387972", "0.5387972", "0.53869325", "0.5375443", "0.5375443" ]
0.0
-1
! moment.js locale configuration ! locale : Estonian [et] ! author : Henry Kehlmann : ! improvements : Illimar Tambek :
function Fd(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function e(t,e,i,n){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[i][2]?r[i][2]:r[i][1]:n?r[i][0]:r[i][1]}", "function e(t,e,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function e(t,e,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function e(t,e,n){var r,i,o={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(r=+t,i=o[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function e(t,e,n){var i,r,o={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r=o[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,n,o){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?i[n][2]?i[n][2]:i[n][1]:o?i[n][0]:i[n][1]}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function e(t,e,n){var r,i;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(r=+t,i={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,a,i){var s={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?s[a][2]?s[a][2]:s[a][1]:i?s[a][0]:s[a][1]}", "function e(t,e,n){var i,r;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function e(t,e,n){var i,r;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,a,n){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[a][2]?r[a][2]:r[a][1]:n?r[a][0]:r[a][1]}", "function t(e,t,a,n){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[a][2]?r[a][2]:r[a][1]:n?r[a][0]:r[a][1]}", "function e(t,e,r,n){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[r][2]?i[r][2]:i[r][1]:n?i[r][0]:i[r][1]}", "function e(t,e,r,n){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[r][2]?i[r][2]:i[r][1]:n?i[r][0]:i[r][1]}", "function t(e,t,i,n){var s={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?s[i][2]?s[i][2]:s[i][1]:n?s[i][0]:s[i][1]}", "function t(e,t,n,i){var s={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?s[n][2]?s[n][2]:s[n][1]:i?s[n][0]:s[n][1]}", "function t(e,t,n,i){var s={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?s[n][2]?s[n][2]:s[n][1]:i?s[n][0]:s[n][1]}", "function e(t,e,n){var i,a;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,a={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?a[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?a[1]:a[2])}", "function e(t,e,n,r){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};if(e){return a[n][2]?a[n][2]:a[n][1]}return r?a[n][0]:a[n][1]}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n,a){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?i[n][2]?i[n][2]:i[n][1]:a?i[n][0]:i[n][1]}", "function t(e,t,n,a){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?i[n][2]?i[n][2]:i[n][1]:a?i[n][0]:i[n][1]}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(t,e,n){var i=t+\" \";switch(n){case\"ss\":return i+=1===t?\"sekunda\":2===t||3===t||4===t?\"sekunde\":\"sekundi\";case\"m\":return e?\"jedna minuta\":\"jedne minute\";case\"mm\":return i+=1===t?\"minuta\":2===t||3===t||4===t?\"minute\":\"minuta\";case\"h\":return e?\"jedan sat\":\"jednog sata\";case\"hh\":return i+=1===t?\"sat\":2===t||3===t||4===t?\"sata\":\"sati\";case\"dd\":return i+=1===t?\"dan\":\"dana\";case\"MM\":return i+=1===t?\"mjesec\":2===t||3===t||4===t?\"mjeseca\":\"mjeseci\";case\"yy\":return i+=1===t?\"godina\":2===t||3===t||4===t?\"godine\":\"godina\"}}", "function e(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(e=+e,n=(n={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n]).split(\"_\"),e%10==1&&e%100!=11?n[0]:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?n[1]:n[2])}", "function e(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(e=+e,n=(n={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n]).split(\"_\"),e%10==1&&e%100!=11?n[0]:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?n[1]:n[2])}", "function t(e,t,n,a){var o={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?o[n][2]?o[n][2]:o[n][1]:a?o[n][0]:o[n][1]}", "function t(e,t,a,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[a][2]?r[a][2]:r[a][1]:i?r[a][0]:r[a][1]}", "function t(e,t,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?a[n][2]?a[n][2]:a[n][1]:i?a[n][0]:a[n][1]}", "function ei(e,t,n,a){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?i[n][2]?i[n][2]:i[n][1]:a?i[n][0]:i[n][1]}", "function e(t,e,n){var i,r,o={ss:e?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:e?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:e?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"};return\"m\"===n?e?\"хвилина\":\"хвилину\":\"h\"===n?e?\"година\":\"годину\":t+\" \"+(i=+t,r=o[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:i?r[n][0]:r[n][1]}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function t(e,t,n){var r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}(r[n],+e)}", "function e(t,e,n){var r,i,o={ss:e?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:e?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:e?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"};return\"m\"===n?e?\"хвилина\":\"хвилину\":\"h\"===n?e?\"година\":\"годину\":t+\" \"+(r=+t,i=o[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function e(t,e,n,r){var i={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[t+\"sekundi\",t+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[t+\" minuti\",t+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[t+\" tunni\",t+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[t+\" kuu\",t+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[t+\" aasta\",t+\" aastat\"]};return e?i[n][2]?i[n][2]:i[n][1]:r?i[n][0]:i[n][1]}", "function t(e,t,n,g){var I={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?I[n][2]?I[n][2]:I[n][1]:g?I[n][0]:I[n][1]}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}", "function t(e,t,n,a){var r={s:[\"mõne sekundi\",\"mõni sekund\",\"paar sekundit\"],ss:[e+\"sekundi\",e+\"sekundit\"],m:[\"ühe minuti\",\"üks minut\"],mm:[e+\" minuti\",e+\" minutit\"],h:[\"ühe tunni\",\"tund aega\",\"üks tund\"],hh:[e+\" tunni\",e+\" tundi\"],d:[\"ühe päeva\",\"üks päev\"],M:[\"kuu aja\",\"kuu aega\",\"üks kuu\"],MM:[e+\" kuu\",e+\" kuud\"],y:[\"ühe aasta\",\"aasta\",\"üks aasta\"],yy:[e+\" aasta\",e+\" aastat\"]};return t?r[n][2]?r[n][2]:r[n][1]:a?r[n][0]:r[n][1]}" ]
[ "0.7557109", "0.7551594", "0.74955004", "0.7079154", "0.69555044", "0.62988454", "0.6280072", "0.62005496", "0.60696095", "0.6043879", "0.6043879", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60118425", "0.6006246", "0.5955362", "0.5941495", "0.5941495", "0.592045", "0.59097403", "0.590585", "0.590585", "0.5894177", "0.5894177", "0.5889948", "0.5889948", "0.5884113", "0.58837974", "0.58837974", "0.58784395", "0.586819", "0.58639413", "0.58639413", "0.5851661", "0.5851661", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58508384", "0.58500445", "0.58500445", "0.5848725", "0.5843785", "0.5839085", "0.5839085", "0.5839085", "0.5839085", "0.5838445", "0.5828774", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5828099", "0.5821785", "0.58210737", "0.5820658", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.58156866", "0.5805975", "0.5798878", "0.579862", "0.579862", "0.579862", "0.579862", "0.579862", "0.579862", "0.579862", "0.579862" ]
0.0
-1
! moment.js locale configuration ! locale : Konkani Latin script [gomlatn] ! author : The Discoverer :
function Id(a,b,c,d){var e={s:["thodde secondanim","thodde second"],m:["eka mintan","ek minute"],mm:[a+" mintanim",a+" mintam"],h:["eka horan","ek hor"],hh:[a+" horanim",a+" hor"],d:["eka disan","ek dis"],dd:[a+" disanim",a+" dis"],M:["eka mhoinean","ek mhoino"],MM:[a+" mhoineanim",a+" mhoine"],y:["eka vorsan","ek voros"],yy:[a+" vorsanim",a+" vorsam"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale ' + key + ' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){var a,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?i[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}(r[n],+e)}", "function t(e,t,n){var a,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?o[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?o[1]:o[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var i,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?a[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var o,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(o=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),o%10==1&&o%100!=11?i[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?i[1]:i[2])}", "function t(e,t,n){var i,s;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,s={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?s[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?s[1]:s[2])}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?o[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?o[1]:o[2])}", "function e(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(e=+e,n=(n={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n]).split(\"_\"),e%10==1&&e%100!=11?n[0]:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?n[1]:n[2])}", "function e(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(e=+e,n=(n={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n]).split(\"_\"),e%10==1&&e%100!=11?n[0]:2<=e%10&&e%10<=4&&(e%100<10||20<=e%100)?n[1]:n[2])}", "function t(e,t,n){var i,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,n){var i,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,n){var i,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function t(e,t,a){var i,s;return\"m\"===a?t?\"хвіліна\":\"хвіліну\":\"h\"===a?t?\"гадзіна\":\"гадзіну\":e+\" \"+(i=+e,s={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[a].split(\"_\"),i%10==1&&i%100!=11?s[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?s[1]:s[2])}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function e(t,e,n){var i,a;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,a={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?a[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?a[1]:a[2])}", "function e(t,e,n){var r,i;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(r=+t,i={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",ww:\"неделя_недели_недель\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "constructor(locale) {\n const result = localeRe.exec(locale.replace(/_/g, \"-\"));\n if (!result) {\n this.isWellFormed = false;\n return;\n }\n\n let [, language, script, region, variant] = result;\n\n if (language) {\n this.language = language.toLowerCase();\n }\n if (script) {\n this.script = script[0].toUpperCase() + script.slice(1);\n }\n if (region) {\n this.region = region.toUpperCase();\n }\n this.variant = variant;\n this.isWellFormed = true;\n }", "function t(e,t,n){var a,i;return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(a=+e,i={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n].split(\"_\"),a%10==1&&a%100!=11?i[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?i[1]:i[2])}", "function e(t,e,n){var i,r;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function e(t,e,n){var i,r;return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function e(t,e,n){var i,r,o={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,r=o[n].split(\"_\"),i%10==1&&i%100!=11?r[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?r[1]:r[2])}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function e(t,e,n){var r,i,o={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?e?\"хвіліна\":\"хвіліну\":\"h\"===n?e?\"гадзіна\":\"гадзіну\":t+\" \"+(r=+t,i=o[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function t(e,t,a){var n,r;return\"m\"===a?t?\"хвіліна\":\"хвіліну\":\"h\"===a?t?\"гадзіна\":\"гадзіну\":e+\" \"+(n=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[a].split(\"_\"),n%10==1&&n%100!=11?r[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var r={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"};return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}(r[n],+e)}", "function t(e,t,n){var a,o;return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(a=+e,o={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n].split(\"_\"),a%10==1&&a%100!=11?o[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"};return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a,i={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"};return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(r=+e,a=i[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var i,a;return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+(i=+e,a={ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n].split(\"_\"),i%10==1&&i%100!=11?a[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?a[1]:a[2])}" ]
[ "0.8243827", "0.78860277", "0.7814756", "0.77083063", "0.7066194", "0.6849828", "0.6790166", "0.657647", "0.6568694", "0.64285296", "0.63389885", "0.61543334", "0.61543334", "0.6018532", "0.59970075", "0.5991416", "0.59857446", "0.59857446", "0.59662306", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59568894", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59519136", "0.59489423", "0.59439373", "0.5943578", "0.5943578", "0.5936489", "0.5936489", "0.5936489", "0.5936489", "0.5936489", "0.5936489", "0.5936489", "0.59146845", "0.59146845", "0.5910744", "0.5910744", "0.5910744", "0.58868635", "0.5881223", "0.5881223", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5873103", "0.5839374", "0.5831307", "0.58264184", "0.58180743", "0.58146214", "0.5813847", "0.5813847", "0.58098155", "0.58085763", "0.58085763", "0.58076155", "0.58076155", "0.58076155", "0.58076155", "0.58076155", "0.57949", "0.57912433", "0.5787357", "0.5783984", "0.5783984", "0.5782223", "0.5768889", "0.576342", "0.576342", "0.5760204" ]
0.0
-1
! moment.js locale configuration ! locale : Luxembourgish [lb] ! author : mweimerskirch : ! author : David Raison :
function Od(a,b,c,d){var e={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale ' + key + ' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}", "function lc(a) { var b; return void 0 === a ? this._locale._abbr : (b = bb(a), null != b && (this._locale = b), this) }", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function T(a,b,c,d,e){var f;// works with moment-pre-2.8\n// Expand localized format strings, like \"LL\" -> \"MMMM D YYYY\"\n// BTW, this is not important for `formatDate` because it is impossible to put custom tokens\n// or non-zero areas in Moment's localized format strings.\nreturn a=Ia.moment.parseZone(a),b=Ia.moment.parseZone(b),f=(a.localeData||a.lang).call(a),c=f.longDateFormat(c)||c,d=d||\" - \",U(a,b,W(c),d,e)}// expose", "function parseMonth(str) {\r\n\t// Supports: Bulgarian, Czech, Danish, Dutch, English, French, German, Greek, Indonesian, Italian, Macedonian, Portuguese, Serbian, Slovak, Spanish, Swedish\r\n\tvar dict = {\r\n\t\t'bg'\t\t: Array('??????', '????????', '????', '?????', '???', '???', '???', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'cs'\t\t: Array('leden', '򮯲', 'b?ezen', 'duben', 'kv?ten', '?erven', '?ervenec', 'srpen', 'z‭', '?n', 'listopad', 'prosinec'),\r\n\t\t'da'\t\t: Array('januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'),\r\n\t\t'de'\t\t: Array('januar', 'februar', 'm峺', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember'),\r\n\t\t'en-abbr1'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'),\r\n\t\t'en-abbr2'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'),\r\n\t\t'en'\t\t: Array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'),\r\n\t\t'es'\t\t: Array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'),\r\n\t\t'el'\t\t: Array('i?????????', '???????????', '???????', '????????', '?????', 'i??????', 'i??????', '?????????', '???????????', 'o????????', '?????????', '??????????'),\r\n\t\t'fr'\t\t: Array('janvier', 'f귲ier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao󴧬 'septembre', 'octobre', 'novembre', 'dꤥmbre'),\r\n\t\t'id'\t\t: Array('januari', 'februari', 'maret', 'april', 'mei', 'juni', 'juli', 'agustus', 'september', 'oktober', 'november', 'desember'),\r\n\t\t'it'\t\t: Array('gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'),\r\n\t\t'mk'\t\t: Array('???????', '????????', '????', '?????', '???', '????', '????', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'nl'\t\t: Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'),\r\n\t\t'pt'\t\t: Array('janeiro', 'fevereiro', 'mar诧, 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'),\r\n\t\t'sk'\t\t: Array('januⲧ, 'februⲧ, 'marec', 'apr, 'm⪧, 'j򮧬 'j򬧬 'august', 'september', 'okt󢥲', 'november', 'december'),\r\n\t\t'sr'\t\t: Array('??????', '???????', '????', '?????', '???', '????', '????', '??????', '?????????', '???????', '????????', '????????'),\r\n\t\t'sv'\t\t: Array('januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december')\r\n\t}\r\n\t$d_months = Array(Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array());\r\n\tfor (var key in dict) { for (var i=0; i<dict[key].length; i++) { $d_months[i].push(dict[key][i]); } }\r\n\tfor (var i=0; i<12; i++) { $d_months[i] = RegExp('^(.*\\\\s)?(' + $d_months[i].join('|') + ')(\\\\s.*)?$'); }\r\n\t\r\n\tparseMonth = function(str) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tfor (var i=0; i<$d_months.length; i++) { if (str.match($d_months[i])) { return i; } }\r\n\t\treturn -1;\r\n\t}\r\n\treturn parseMonth(str);\r\n}", "function initLanguage() {\n months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];\n }", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function getMonthLong(locale) {\n if (locale === 'ko') {\n // Long and short are equivalent in Korean except long has a bug on IE11/Windows 7\n return 'short';\n }\n\n return 'long';\n}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "static getLocale() {\n return 'en_US';\n }", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function getMomentLocaleData(localeCode){return moment.localeData(localeCode)||moment.localeData('en');}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\",\n 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:2121\");\n\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function ignoreMomentLocale(webpackConfig) {\n delete webpackConfig.module.noParse;\n webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/));\n}", "function getLocalePluralCase(locale){var data=findLocaleData(locale);return data[18/* PluralCase */];}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else\n {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else\n {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\", 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:1880\");\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function getMonths(){\r\n moment.locale(\"it\");\r\n var mesi = moment.months();\r\n return mesi;\r\n}", "setLocale(locale) {\n this.locale = locale;\n }", "function getMomentLocaleData(langCode) {\n var func = moment.localeData || moment.langData;\n return func.call(moment, langCode) ||\n func.call(moment, 'en'); // the newer localData could return null, so fall back to en\n }", "function getLocaleText(locale = \"DE\") {\n return {\n days_narrow: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"narrow\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_short: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"short\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_long: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"long\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n month_narrow: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"narrow\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_short: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"short\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_long: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"long\" }).format(new Date(Date.UTC(2021, month, 1)))\n )\n }\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "static getLocalizedNames(locale) {\n const days = { names: [], namesAbbr: [], namesShort: [] },\n months = { names: [], namesAbbr: [] };\n\n if (this[locale]) {\n return this[locale];\n }\n\n for (let i = 23; i < 30; i++) {\n const date = new Date(2017, 6, i),\n name = date.toLocaleString(locale, { 'weekday': 'long' });\n\n days.names.push(name);\n days.namesAbbr.push(date.toLocaleString(locale, { 'weekday': 'short' }));\n days.namesShort.push(name.substring(0, 2));\n }\n\n for (let i = 0; i < 12; i++) {\n const date = new Date(2017, i, 1),\n name = date.toLocaleString(locale, { 'month': 'long' });\n\n months.names.push(name);\n months.namesAbbr.push(name.substring(0, 3));\n }\n\n months.names.push('');\n months.namesAbbr.push('');\n\n this[locale] = { days: days, months: months };\n\n return this[locale];\n }", "function e(a){var c=b.localeData||b.langData;return c.call(b,a)||c.call(b,\"en\")}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function setLocaleWording() {\n _D(\"Set locale wording...\");\n\n pn = options[\"lang\"] || G_DEFAULT_LANG;\n \n if( pn=='' ) {\n // use by system default.\n \n } else if( pn in _locale) {\n loc_list = {\n \"#dlist a\" : \"dlist\",\n \"#general a\" : \"general\",\n \"#langs a\" : \"langs\",\n \"#lang_desc\" : \"lang_desc\",\n \"#save\" : \"save\",\n \"#default\" : \"default\",\n \"#en\" : \"en\",\n \"#zh-TW\" : \"zh-TW\",\n \"#ja-JP\" : \"ja-JP\",\n \"#download_dir\" : \"download_dir\",\n \"#file_format\" : \"file_format\",\n \"#comment_file_format\" : \"comment_file_format\",\n \"#download_dir_btn\" : \"download_dir_btn\",\n \"#clear_all\" : \"delete_all_btn\",\n \"#comment_lang_en_span\" : \"en\",\n \"#comment_lang_jp_span\" : \"ja-JP\",\n \"#comment_lang_tw_span\" : \"zh-TW\",\n \"#comment_lang\" : \"comment_lang\",\n \"#if_file_exist\" : \"if_file_exist\",\n \"#overwrite\" : \"overwrite\",\n \"#saveNew\" : \"save_new\",\n \"#download_quality_mode\": \"download_quality_mode\",\n \"#high_quality\" : \"high_quality\",\n \"#low_quality\" : \"low_quality\",\n };\n \n for(var k in loc_list) {\n $(k).html( _locale[pn][loc_list[k]]);\n }\n }\n}", "get() {\n return defaultLocale;\n }", "function t(e,t,n){var r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"};return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}(r[n],+e)}", "function getLocaleMonthNames(locale,formStyle,width){var data=findLocaleData(locale);var monthsData=[data[5/* MonthsFormat */],data[6/* MonthsStandalone */]];var months=getLastDefinedValue(monthsData,formStyle);return getLastDefinedValue(months,width);}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function t(e,t,n){var a,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?i[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?i[1]:i[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,o;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,o={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?o[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?o[1]:o[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}" ]
[ "0.8045511", "0.7559744", "0.75030416", "0.7409973", "0.740628", "0.7021226", "0.69451475", "0.64851147", "0.6393321", "0.62985593", "0.62424666", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.58968407", "0.58754826", "0.58754826", "0.5819327", "0.5791424", "0.57234997", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.5710468", "0.56857723", "0.56857723", "0.56857723", "0.56857723", "0.56800026", "0.5591534", "0.5591534", "0.5587187", "0.55759054", "0.55759054", "0.55759054", "0.55759054", "0.55759054", "0.55759054", "0.55759054", "0.55759054", "0.55464", "0.55464", "0.55464", "0.5531379", "0.5531379", "0.5531379", "0.5531379", "0.5531379", "0.5488499", "0.548382", "0.5451256", "0.5451256", "0.5451256", "0.5451256", "0.54499376", "0.54480433", "0.5445805", "0.5444095", "0.54332143", "0.5428434", "0.54276305", "0.54276305", "0.54276305", "0.5422745", "0.53806984", "0.5370119", "0.5352285", "0.5352285", "0.5350234", "0.53430927", "0.5337908", "0.53265184", "0.5321477", "0.5321477", "0.53165454", "0.53064996", "0.53064996", "0.5296963", "0.52815217", "0.52815217", "0.52815217", "0.52815217", "0.52815217" ]
0.0
-1
! moment.js locale configuration ! locale : Romanian [ro] ! author : Vlad Gurdiga : ! author : Valentin Agachi :
function ce(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"минута_минуты_минут\":\"минуту_минуты_минут\",hh:\"час_часа_часов\",dd:\"день_дня_дней\",MM:\"месяц_месяца_месяцев\",yy:\"год_года_лет\"}[n],+e)}", "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[n],+e)}", "function At(e,t,a){return\"m\"===a?t?\"хвилина\":\"хвилину\":\"h\"===a?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var a=e.split(\"_\");return t%10==1&&t%100!=11?a[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?a[1]:a[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд\",mm:t?\"хвилина_хвилини_хвилин\":\"хвилину_хвилини_хвилин\",hh:t?\"година_години_годин\":\"годину_години_годин\",dd:\"день_дні_днів\",MM:\"місяць_місяці_місяців\",yy:\"рік_роки_років\"}[a],+e)}", "function Io(e,t,n){var i={mm:\"minute\",hh:\"ore\",dd:\"zile\",MM:\"luni\",yy:\"ani\"},o=\" \";return(e%100>=20||e>=100&&e%100===0)&&(o=\" de \"),e+o+i[n]}//! moment.js locale configuration", "function localizeMoment(mom) {\n\t\tif ('_locale' in mom) { // moment 2.8 and above\n\t\t\tmom._locale = localeData;\n\t\t}\n\t\telse { // pre-moment-2.8\n\t\t\tmom._lang = localeData;\n\t\t}\n\t}", "function localizeMoment(mom) {\n\t\tmom._locale = localeData;\n\t}", "function localizeMoment(mom) {\n\t\t\tmom._locale = localeData;\n\t\t}", "function hd(i,ee,te){return i+\" \"+function kd(i,ee){return 2===ee?function ld(i){var ee={m:\"v\",b:\"v\",d:\"z\"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)}\n//! moment.js locale configuration\n//! locale : bosnian (bs)\n//! author : Nedim Cholich : https://github.com/frontyard\n//! based on (hr) translation by Bojan Marković\n(i):i}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[te],i)}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}}return globalLocale._abbr;}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\nglobalLocale=data;}else{if(typeof console!=='undefined'&&console.warn){//warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale '+key+' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function getMonths(){\r\n moment.locale(\"it\");\r\n var mesi = moment.months();\r\n return mesi;\r\n}", "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are passed but the locale could not be set\nconsole.warn('Locale ' + key + ' not found. Did you forget to load it?');}}}return globalLocale._abbr;}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function parseMonth(str) {\r\n\t// Supports: Bulgarian, Czech, Danish, Dutch, English, French, German, Greek, Indonesian, Italian, Macedonian, Portuguese, Serbian, Slovak, Spanish, Swedish\r\n\tvar dict = {\r\n\t\t'bg'\t\t: Array('??????', '????????', '????', '?????', '???', '???', '???', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'cs'\t\t: Array('leden', '򮯲', 'b?ezen', 'duben', 'kv?ten', '?erven', '?ervenec', 'srpen', 'z‭', '?n', 'listopad', 'prosinec'),\r\n\t\t'da'\t\t: Array('januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'),\r\n\t\t'de'\t\t: Array('januar', 'februar', 'm峺', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember'),\r\n\t\t'en-abbr1'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'),\r\n\t\t'en-abbr2'\t: Array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'),\r\n\t\t'en'\t\t: Array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'),\r\n\t\t'es'\t\t: Array('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'),\r\n\t\t'el'\t\t: Array('i?????????', '???????????', '???????', '????????', '?????', 'i??????', 'i??????', '?????????', '???????????', 'o????????', '?????????', '??????????'),\r\n\t\t'fr'\t\t: Array('janvier', 'f귲ier', 'mars', 'avril', 'mai', 'juin', 'juillet', 'ao󴧬 'septembre', 'octobre', 'novembre', 'dꤥmbre'),\r\n\t\t'id'\t\t: Array('januari', 'februari', 'maret', 'april', 'mei', 'juni', 'juli', 'agustus', 'september', 'oktober', 'november', 'desember'),\r\n\t\t'it'\t\t: Array('gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'),\r\n\t\t'mk'\t\t: Array('???????', '????????', '????', '?????', '???', '????', '????', '??????', '?????????', '????????', '???????', '????????'),\r\n\t\t'nl'\t\t: Array('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'),\r\n\t\t'pt'\t\t: Array('janeiro', 'fevereiro', 'mar诧, 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'),\r\n\t\t'sk'\t\t: Array('januⲧ, 'februⲧ, 'marec', 'apr, 'm⪧, 'j򮧬 'j򬧬 'august', 'september', 'okt󢥲', 'november', 'december'),\r\n\t\t'sr'\t\t: Array('??????', '???????', '????', '?????', '???', '????', '????', '??????', '?????????', '???????', '????????', '????????'),\r\n\t\t'sv'\t\t: Array('januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december')\r\n\t}\r\n\t$d_months = Array(Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array(), Array());\r\n\tfor (var key in dict) { for (var i=0; i<dict[key].length; i++) { $d_months[i].push(dict[key][i]); } }\r\n\tfor (var i=0; i<12; i++) { $d_months[i] = RegExp('^(.*\\\\s)?(' + $d_months[i].join('|') + ')(\\\\s.*)?$'); }\r\n\t\r\n\tparseMonth = function(str) {\r\n\t\tstr = str.toLowerCase();\r\n\t\tfor (var i=0; i<$d_months.length; i++) { if (str.match($d_months[i])) { return i; } }\r\n\t\treturn -1;\r\n\t}\r\n\treturn parseMonth(str);\r\n}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function locale_locales__getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data=locale_locales__getLocale(key);}else{data=defineLocale(key,values);}if(data){// moment.duration._locale = moment._locale = data;\r\n\tglobalLocale=data;}}return globalLocale._abbr;}", "function getMomentLocaleData(localeCode){return moment.localeData(localeCode)||moment.localeData('en');}", "function convertToRoman() {\n let numero = prompt('Ingrese el número a convertir:');\n let original = numero;\n\n function obtenerNumero(digito, cadenaUno, cadenaDos, cadenaTres) {\n switch (true) {\n \n case digito <= 3:\n return cadenaUno.repeat(digito);\n \n case digito === 4:\n return cadenaUno + cadenaDos;\n \n case digito <= 8:\n return cadenaDos + cadenaUno.repeat(digito - 5);\n \n default:\n return cadenaUno + cadenaTres;\n }\n }\n \n let cadena = '';\n \n cadena += 'M'.repeat(Math.floor(numero/1000));\n numero %= 1000;\n \n cadena += obtenerNumero(Math.floor(numero/100), 'C', 'D', 'M')\n numero %= 100;\n \n cadena += obtenerNumero(Math.floor(numero/10), 'X', 'L', 'C')\n numero %= 10;\n \n cadena += obtenerNumero(numero, 'I', 'V', 'X')\n \n alert(`${original} en números romanos equivale a: ${cadena}.`);\n\n return cadena;\n }", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}", "function ka__monthsCaseReplace(m, format) {\n var months = {\n 'nominative': 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),\n 'accusative': 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')\n },\n nounCase = (/D[oD] *MMMM?/).test(format) ?\n 'accusative' :\n 'nominative';\n return months[nounCase][m.month()];\n }", "function ka__monthsCaseReplace(m, format) {\n var months = {\n 'nominative': 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),\n 'accusative': 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')\n },\n nounCase = (/D[oD] *MMMM?/).test(format) ?\n 'accusative' :\n 'nominative';\n return months[nounCase][m.month()];\n }", "static getLocalizedNames(locale) {\n const days = { names: [], namesAbbr: [], namesShort: [] },\n months = { names: [], namesAbbr: [] };\n\n if (this[locale]) {\n return this[locale];\n }\n\n for (let i = 23; i < 30; i++) {\n const date = new Date(2017, 6, i),\n name = date.toLocaleString(locale, { 'weekday': 'long' });\n\n days.names.push(name);\n days.namesAbbr.push(date.toLocaleString(locale, { 'weekday': 'short' }));\n days.namesShort.push(name.substring(0, 2));\n }\n\n for (let i = 0; i < 12; i++) {\n const date = new Date(2017, i, 1),\n name = date.toLocaleString(locale, { 'month': 'long' });\n\n months.names.push(name);\n months.namesAbbr.push(name.substring(0, 3));\n }\n\n months.names.push('');\n months.namesAbbr.push('');\n\n this[locale] = { days: days, months: months };\n\n return this[locale];\n }", "function hy_am__monthsCaseReplace(m, format) {\n var months = {\n 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'),\n 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_')\n },\n nounCase = (/D[oD]?(\\[[^\\[\\]]*\\]|\\s+)+MMMM?/).test(format) ?\n 'accusative' :\n 'nominative';\n return months[nounCase][m.month()];\n }", "function hy_am__monthsCaseReplace(m, format) {\n var months = {\n 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'),\n 'accusative': 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_')\n },\n nounCase = (/D[oD]?(\\[[^\\[\\]]*\\]|\\s+)+MMMM?/).test(format) ?\n 'accusative' :\n 'nominative';\n return months[nounCase][m.month()];\n }", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(qf=c)),qf._abbr}", "function Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\n return a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}", "function RomanNumeralsHelper() {\n}", "function getLocalePluralCase(locale){var data=findLocaleData(locale);return data[18/* PluralCase */];}", "function getMonths() {\n moment.locale(\"it\");\n return moment.months();\n}", "function getMonths() {\n moment.locale(\"it\");\n\n var months = moment.months();\n\n return months;\n}", "function locale(localeCode,newFcOptions){var fcOptions;var momOptions;// get the FullCalendar internal option hash for this locale. create if necessary\nfcOptions=exports.localeOptionHash[localeCode]||(exports.localeOptionHash[localeCode]={});// provided new options for this locales? merge them in\nif(newFcOptions){fcOptions=exports.localeOptionHash[localeCode]=options_1.mergeOptions([fcOptions,newFcOptions]);}// compute locale options that weren't defined.\n// always do this. newFcOptions can be undefined when initializing from i18n file,\n// so no way to tell if this is an initialization or a default-setting.\nmomOptions=getMomentLocaleData(localeCode);// will fall back to en\n$.each(momComputableOptions,function(name,func){if(fcOptions[name]==null){fcOptions[name]=func(momOptions,fcOptions);}});// set it as the default locale for FullCalendar\noptions_1.globalDefaults.locale=localeCode;}", "function T(a,b,c,d,e){var f;// works with moment-pre-2.8\n// Expand localized format strings, like \"LL\" -> \"MMMM D YYYY\"\n// BTW, this is not important for `formatDate` because it is impossible to put custom tokens\n// or non-zero areas in Moment's localized format strings.\nreturn a=Ia.moment.parseZone(a),b=Ia.moment.parseZone(b),f=(a.localeData||a.lang).call(a),c=f.longDateFormat(c)||c,d=d||\" - \",U(a,b,W(c),d,e)}// expose", "setLocale(locale) {\n this.locale = locale;\n }", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function t(e,t,n){return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+function(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n],+e)}", "function convertDayMonth(hari) {\n\n let hariPerBulan = 30;\n let hasil;\n\n let cariBulan = Math.floor(hari / hariPerBulan);\n let sisaHari = hari % hariPerBulan;\n\n if (cariBulan == 0) {\n hasil = hari + \" Hari\";\n } else if (sisaHari == 0) {\n hasil = cariBulan + \" Bulan \" + \"(\" + hari + \" Hari)\";\n } else {\n hasil = cariBulan + \" Bulan \" + sisaHari + \" Hari \" + \"(\" + hari + \" Hari)\";\n }\n\n return hasil;\n}", "function formatRoman(value, pattern) {\n var i,\n s = '',\n v = Number(String(value).slice(-3)),\n nThousands = (value - v) / 1000,\n decimal = [0, 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900].reverse(),\n numeral = ['0', 'I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM'].reverse();\n\n while (v > 0) {\n for (i = 0; i < decimal.length; i++) {\n if (decimal[i] <= v) {\n s += numeral[i];\n v -= decimal[i];\n break;\n }\n }\n }\n\n for (i = 0; i < nThousands; i++) {\n s = \"M\".concat(s);\n }\n\n if (pattern[1] !== pattern[1].toUpperCase()) {\n s = s.toLowerCase();\n }\n\n return s;\n}", "function naturalLang(date){\n \n var months = ['January', 'February', 'March', 'April', 'May', 'June','July','August','September','October','November','December'];\n \n var month = months[date.getMonth()];\n var year = date.getFullYear();\n var day = date.getDate();\n \n return month + ' ' + day + ', ' + year;\n}", "function getMomentLocaleData(langCode) {\n var func = moment.localeData || moment.langData;\n return func.call(moment, langCode) ||\n func.call(moment, 'en'); // the newer localData could return null, so fall back to en\n }", "function t(e,t,r){var n,i;return\"m\"===r?t?\"хвіліна\":\"хвіліну\":\"h\"===r?t?\"гадзіна\":\"гадзіну\":e+\" \"+(n=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[r].split(\"_\"),n%10==1&&n%100!=11?i[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?i[1]:i[2])}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getMomentLocaleData(langCode) {\n\tvar func = moment.localeData || moment.langData;\n\treturn func.call(moment, langCode) ||\n\t\tfunc.call(moment, 'en'); // the newer localData could return null, so fall back to en\n}", "function getDateString(moment){\n return moment.toLocaleDateString('en-US',\n {year:'numeric'\n ,month:'long',\n day:'numeric'})\n}", "function getLocaleText(locale = \"DE\") {\n return {\n days_narrow: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"narrow\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_short: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"short\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n days_long: [...Array(7).keys()].map((day) =>\n new Intl.DateTimeFormat(locale, { weekday: \"long\" }).format(new Date(Date.UTC(2021, 5, day)))\n ),\n month_narrow: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"narrow\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_short: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"short\" }).format(new Date(Date.UTC(2021, month, 1)))\n ),\n month_long: [...Array(12).keys()].map((month) =>\n new Intl.DateTimeFormat(locale, { month: \"long\" }).format(new Date(Date.UTC(2021, month, 1)))\n )\n }\n}", "function locale(key){var newLocaleData;if(key === undefined){return this._locale._abbr;}else {newLocaleData = getLocale(key);if(newLocaleData != null){this._locale = newLocaleData;}return this;}}", "function testDateFmtPersSimpleShort_fa_IR() {\n var fmt = new ilib.DateFmt({\n\t\tcalendar: \"persian\",\n\t\tlocale: \"fa-IR\",\n\t\tlength: \"short\"\n\t});\n assertNotNull(fmt);\n \n var date = new ilib.Date.PersDate({\n\t\tlocale: \"fa-IR\",\n\t\tyear: 1392,\n\t\tmonth: 9,\n\t\tday: 21,\n\t\thour: 13,\n\t\tminute:45,\n\t\tsecond: 0,\n\t\tmillisecond: 0\n\t});\n assertEquals(\"‏۱۳۹۲/۹/۲۱\", fmt.format(date));\n}", "function t(e,t,n){var a,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?i[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var r,i;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,i={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?i[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?i[1]:i[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function t(e,t,n){var a,r;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(a=+e,r={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),a%10==1&&a%100!=11?r[0]:a%10>=2&&a%10<=4&&(a%100<10||a%100>=20)?r[1]:r[2])}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\",\n 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:2121\");\n\n }\n }\n }\n\n return globalLocale._abbr;\n }", "function parseRoman(s) {\n var val = {M: 1000, D: 500, C: 100, L: 50, X: 10, V: 5, I: 1};\n return s.toUpperCase().split('').reduce(function(r, a, i, aa) {\n return val[a] < val[aa[i + 1]] ? r - val[a] : r + val[a];\n }, 0);\n}", "function initLanguage() {\n months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];\n }", "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;}return this;}}", "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;}return this;}}", "function e(t,e,r){var i,n;return\"m\"===r?e?\"хвіліна\":\"хвіліну\":\"h\"===r?e?\"гадзіна\":\"гадзіну\":t+\" \"+(i=+t,n={ss:e?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:e?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:e?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[r].split(\"_\"),i%10==1&&i%100!=11?n[0]:i%10>=2&&i%10<=4&&(i%100<10||i%100>=20)?n[1]:n[2])}", "function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else\n {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else\n {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n __f__(\"warn\", 'Locale ' + key + ' not found. Did you forget to load it?', \" at node_modules/moment/moment.js:1880\");\n }\n }\n }\n\n return globalLocale._abbr;\n }", "constructor(locale) {\n const result = localeRe.exec(locale.replace(/_/g, \"-\"));\n if (!result) {\n this.isWellFormed = false;\n return;\n }\n\n let [, language, script, region, variant] = result;\n\n if (language) {\n this.language = language.toLowerCase();\n }\n if (script) {\n this.script = script[0].toUpperCase() + script.slice(1);\n }\n if (region) {\n this.region = region.toUpperCase();\n }\n this.variant = variant;\n this.isWellFormed = true;\n }", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}", "function t(e,t,n){var r,a;return\"m\"===n?t?\"хвіліна\":\"хвіліну\":\"h\"===n?t?\"гадзіна\":\"гадзіну\":e+\" \"+(r=+e,a={ss:t?\"секунда_секунды_секунд\":\"секунду_секунды_секунд\",mm:t?\"хвіліна_хвіліны_хвілін\":\"хвіліну_хвіліны_хвілін\",hh:t?\"гадзіна_гадзіны_гадзін\":\"гадзіну_гадзіны_гадзін\",dd:\"дзень_дні_дзён\",MM:\"месяц_месяцы_месяцаў\",yy:\"год_гады_гадоў\"}[n].split(\"_\"),r%10==1&&r%100!=11?a[0]:r%10>=2&&r%10<=4&&(r%100<10||r%100>=20)?a[1]:a[2])}" ]
[ "0.7537402", "0.69916016", "0.69081736", "0.6767979", "0.66841763", "0.64818966", "0.6432834", "0.64190984", "0.57471997", "0.56857115", "0.55967474", "0.5530572", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.54282737", "0.54282737", "0.54282737", "0.54282737", "0.5363236", "0.535492", "0.535492", "0.535492", "0.535492", "0.535492", "0.53086317", "0.53086317", "0.5302071", "0.5284869", "0.5259623", "0.5259623", "0.5259623", "0.52386", "0.52386", "0.5224674", "0.5210068", "0.5210068", "0.5192693", "0.5192693", "0.51729286", "0.5169356", "0.5168087", "0.5154472", "0.51156145", "0.51015055", "0.50782037", "0.50696665", "0.5057892", "0.5057892", "0.50386447", "0.5038499", "0.4973164", "0.4972475", "0.4962786", "0.49601522", "0.49601522", "0.49601522", "0.49433643", "0.49343282", "0.49200374", "0.49179193", "0.48912877", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48877123", "0.48784417", "0.48784417", "0.48768798", "0.4875085", "0.48571616", "0.48534483", "0.48534483", "0.4852047", "0.48495758", "0.48491323", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937", "0.48480937" ]
0.0
-1
Hsla conversions adapted from:
function hue2rgb( p, q, h ) { h = ( h + 1 ) % 1; if ( h * 6 < 1 ) { return p + ( q - p ) * h * 6; } if ( h * 2 < 1 ) { return q; } if ( h * 3 < 2 ) { return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; } return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "asHSL(ao) {\r\n return \"hsla(\" + this.h + \",\" + this.s + \"%,\" + this.l + \"%,\" + ((ao == undefined) ? this.a : ao) + \")\";\r\n }", "function toHsla(color) {\n return hsla.apply(void 0, _toConsumableArray(parseToHsla(color)));\n}", "get hsla() {\n let [r, g, b] = Color.RGBToHSL(this.r, this.g, this.b);\n return [r, g, b, a];\n }", "static FromHSLA(h, s, l, a) {\n let [r, g, b] = Color.HSLToRGB(h, s, l);\n return new Color(r, g, b, a);\n }", "function hslaify(d) {\n return \"hsla(\" + d.Hue + \",50%,50%,1)\";\n}", "toHsl() {\n const hsl = conversion_1.rgbToHsl(this.r, this.g, this.b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };\n }", "function hsla(hue, saturation, lightness, alpha) {\n return `hsla(${(hue % 360).toFixed()}, ${guard(0, 100, saturation * 100).toFixed()}%, ${guard(0, 100, lightness * 100).toFixed()}%, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;\n}", "function liveHEXtoHSL() {\n hex = document.querySelector(\"#HEXvalue3>span\").innerHTML;\n console.log(316, hex, typeof hex);\n const arrayHSL = hexToHsl(hex);\n console.log(318, arrayHSL);\n HSLvalue3 = document.querySelector(\"#HSLvalue3\");\n HSLvalue3.innerHTML = `HSL Values: <span>${arrayHSL[0]}°, ${arrayHSL[1]}%, ${arrayHSL[2]}%</span>`;\n}", "function hexToHsl(hex) {\n //HEX to RGB first\n let red = parseInt(hex.substring(1, 3), 16);\n let green = parseInt(hex.substring(3, 5), 16);\n let blue = parseInt(hex.substring(5, 7), 16);\n console.log(183, \"RGB colors:\", red, green, blue);\n //RGB to HSL\n let r = red / 255;\n let g = green / 255;\n let b = blue / 255;\n let cmin = Math.min(r, g, b);\n let cmax = Math.max(r, g, b);\n let delta = cmax - cmin;\n let h = 0;\n let s = 0;\n let l = 0;\n // console.log(194, r, b, g);\n // console.log(195, cmin, cmax, delta);\n if (delta === 0) {\n h = 0;\n } else if (cmax === r) {\n h = ((g - b) / delta) % 6;\n } else if (cmax === g) {\n h = (b - r) / delta + 2;\n } else {\n h = (r - g) / delta + 4;\n }\n h = Math.round(h * 60);\n // console.log(206, h);\n if (h < 0) {\n h = h + 360;\n }\n // console.log(210, h);\n l = (cmax + cmin) / 2;\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n l = (l * 100).toFixed(1);\n s = +(s * 100).toFixed(1);\n console.log(215, \"HSL colors:\", h, s, l);\n return [h, s, l];\n}", "function _hsla(str) {\r\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\r\n if (match) {\r\n var hasAlpha = !!match[1];\r\n var expectedPartCount = hasAlpha ? 4 : 3;\r\n var parts = match[2].split(/ *, */).map(Number);\r\n if (parts.length === expectedPartCount) {\r\n var rgba = hsl2rgb(parts[0], parts[1], parts[2]);\r\n rgba.a = hasAlpha ? parts[3] * 100 : MAX_COLOR_ALPHA;\r\n return rgba;\r\n }\r\n }\r\n}", "function _hsla(str) {\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\n if (match) {\n var hasAlpha = !!match[1];\n var expectedPartCount = hasAlpha ? 4 : 3;\n var parts = match[2].split(/ *, */).map(Number);\n if (parts.length === expectedPartCount) {\n var rgba = hsl2rgb(parts[0], parts[1], parts[2]);\n rgba.a = hasAlpha ? parts[3] * 100 : MAX_COLOR_ALPHA;\n return rgba;\n }\n }\n}", "function _hsla(str) {\n var match = str.match(/^hsl(a?)\\(([\\d., ]+)\\)$/);\n if (match) {\n var hasAlpha = !!match[1];\n var expectedPartCount = hasAlpha ? 4 : 3;\n var parts = match[2].split(/ *, */).map(Number);\n if (parts.length === expectedPartCount) {\n var rgba = (0,_hsl2rgb__WEBPACK_IMPORTED_MODULE_1__.hsl2rgb)(parts[0], parts[1], parts[2]);\n rgba.a = hasAlpha ? parts[3] * 100 : _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_ALPHA;\n return rgba;\n }\n }\n}", "function buildHSL(h,s,l) {\r\n return 'hsl('+h.toString()+','+s.toString()+'%,'+l.toString()+'%)'; \r\n }", "toHslString() {\n const hsl = conversion_1.rgbToHsl(this.r, this.g, this.b);\n const h = Math.round(hsl.h * 360);\n const s = Math.round(hsl.s * 100);\n const l = Math.round(hsl.l * 100);\n return this.a === 1 ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${this.roundA})`;\n }", "hslString (h, s, l, a = 255) {\n a = a / 255; const a4 = a.toPrecision(4)\n return (a === 1) ? `hsl(${h},${s}%,${l}%)` : `hsla(${h},${s}%,${l}%,${a4})`\n }", "function toHSL(h, l) {\n if (l==undefined) {\n l = 50;\n }\n return 'hsl('+h+', 100%, '+l+'%)';\n}", "function parseHSL(str) {\n var c, h, s, l, r, g, b, q, p, a;\n\n c = str.match(/[\\d\\.]+/g);\n h = +c[0] / 360;\n s = +c[1] / 100;\n l = +c[2] / 100;\n a = (+c[3] || 1) / 1;\n\n function hue2rgb(p, q, t) {\n if (t < 0) {\n t += 1;\n }\n if (t > 1) {\n t -= 1;\n }\n if (t < 1 / 6) {\n return p + (q - p) * 6 * t;\n }\n if (t < 1 / 2) {\n return q;\n }\n if (t < 2 / 3) {\n return p + (q - p) * (2 / 3 - t) * 6;\n }\n\n return p;\n }\n\n if (s === 0) {\n r = g = b = l;\n } else {\n q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return {\n \"r\": r * 255,\n \"g\": g * 255,\n \"b\": b * 255,\n \"a\": a\n };\n }", "function parseToHsla(color) {\n var _parseToRgba$map = parseToRgba(color).map(function (value, index) {\n return (\n // 3rd index is alpha channel which is already normalized\n index === 3 ? value : value / 255\n );\n }),\n _parseToRgba$map2 = _slicedToArray(_parseToRgba$map, 4),\n red = _parseToRgba$map2[0],\n green = _parseToRgba$map2[1],\n blue = _parseToRgba$map2[2],\n alpha = _parseToRgba$map2[3];\n var max = Math.max(red, green, blue);\n var min = Math.min(red, green, blue);\n var lightness = (max + min) / 2;\n\n // achromatic\n if (max === min) return [0, 0, lightness, alpha];\n var delta = max - min;\n var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);\n var hue = 60 * (red === max ? (green - blue) / delta + (green < blue ? 6 : 0) : green === max ? (blue - red) / delta + 2 : (red - green) / delta + 4);\n return [hue, saturation, lightness, alpha];\n}", "function hslToRgb(H,S,L){\n\t\tS /= 100;\n\t\tL /= 100;\n\tvar P,Q,i;\n\tvar t = new Array();\n\tif( L < 0.5 )\n\t\tQ = L * ( 1 + S );\n\telse\n\t\tQ = L + S - L * S ;\n\tP = 2 * L - Q;\n\tH = ( H == 360 ) ? 0: H/360;\n\tt[0] = H + 1/3;\n\tt[1] = H;\n\tt[2] = H - 1/3;\n\tfor ( i = 0; i < 3; i++)\n\t{ \n\t\tif ( t[i] < 0 ) t[i]++;\n\t\tif ( t[i] > 1 ) t[i]--;\n\t\t\n\t\tif ( t[i] < 1/6 ) t[i] = P + ( Q - P ) * 6 * t[i] ;\n\t\telse if ( t[i] < 1/2 ) t[i] = Q;\n\t\telse if ( t[i] < 2/3 ) t[i] = P + ( Q - P ) * 6 * ( 2/3 - t[i] );\n\t\telse t[i] = P;\t\n\t\tt[i] *= 255;\n\t\tt[i] = Math.round(t[i]);\n\t}\n\t\n\treturn [t[0],t[1],t[2]];\n}", "function hsl2hsv(h, s, l) {\n s *= (l < 50 ? l : 100 - l) / 100;\n var v = l + s;\n return {\n h: h,\n s: v === 0 ? 0 : ((2 * s) / v) * 100,\n v: v,\n };\n}", "function hsl2hsv(h, s, l) {\r\n s *= (l < 50 ? l : 100 - l) / 100;\r\n var v = l + s;\r\n return {\r\n h: h,\r\n s: v === 0 ? 0 : ((2 * s) / v) * 100,\r\n v: v\r\n };\r\n}", "function ld(a,b){this.Hf=[];this.ai=a;this.Gh=b||null;this.xe=this.hd=!1;this.Uc=void 0;this.Sg=this.Ki=this.Yf=!1;this.Mf=0;this.ub=null;this.Zf=0}", "function h$fromHsString(str) {\n var xs = '';\n while(((str).f === h$ghczmprimZCGHCziTypesziZC_con_e)) {\n var h = ((str).d1);\n xs += String.fromCharCode(((typeof(h) === 'number')?(h):(h).d1));\n str = ((str).d2);\n }\n return xs;\n}", "function h$fromHsString(str) {\n var xs = '';\n while(((str).f === h$ghczmprimZCGHCziTypesziZC_con_e)) {\n var h = ((str).d1);\n xs += String.fromCharCode(((typeof(h) === 'number')?(h):(h).d1));\n str = ((str).d2);\n }\n return xs;\n}", "function h$fromHsString(str) {\n var xs = '';\n while(((str).f === h$ghczmprimZCGHCziTypesziZC_con_e)) {\n var h = ((str).d1);\n xs += String.fromCharCode(((typeof(h) === 'number')?(h):(h).d1));\n str = ((str).d2);\n }\n return xs;\n}", "function calculateHSL(){\n\n // determine the lightness in the range [0,100]\n var l = (2 - hsv.s / 100) * hsv.v / 2;\n\n // store the HSL components\n hsl =\n {\n 'h' : hsv.h,\n 's' : hsv.s * hsv.v / (l < 50 ? l * 2 : 200 - l * 2),\n 'l' : l\n };\n\n // correct a division-by-zero error\n if (isNaN(hsl.s)) hsl.s = 0;\n\n }", "function hslaColor(str) {\n /*\n Split the string by the following 3 characters:\n * (\n * )\n * ,\n This will always leave an empty string as the last item in the array.\n */\n const [type, h, s, l, a, empty] = str.split(/[\\(\\),]/)\n const isHsl = type === 'hsl'\n const error = new TypeError(`\"${str}\" isn't a valid ${type} color.`)\n const getPercentNumAndCheck = val => {\n const num = +val.slice(0, -1)\n if (!/%$/.test(val) || !numCheck(num, 0, 100)) throw error\n return num / 100\n }\n\n // Check for the correct ending and the correct empty string - there's always an empty string.\n if (!str.endsWith(')') || (isHsl ? a : empty) !== '') throw error\n\n const hue = safeHue(h)\n const saturation = getPercentNumAndCheck(s)\n const lightness = getPercentNumAndCheck(l)\n const alpha = isHsl ? 1 : +a\n const alphaOk = numCheck(alpha, 0, 1)\n\n if (isNaN(hue) || !alphaOk) throw error\n\n const results = {h: hue, s: saturation, l: lightness, a: alpha}\n return addHex(addRgb(results))\n}", "function hex2hsb(hex) {\r\n\t\tvar hsb = rgb2hsb(hex2rgb(hex));\r\n\t\tif( hsb.s === 0 ) hsb.h = 360;\r\n\t\treturn hsb;\r\n\t}", "function hex2hsb(hex) {\nvar hsb = rgb2hsb(hex2rgb(hex));\nif( hsb.s === 0 ) hsb.h = 360;\nreturn hsb;\n}", "function hex2hsb(hex) {\n\t\tvar hsb = rgb2hsb(hex2rgb(hex));\n\t\tif( hsb.s === 0 ) hsb.h = 360;\n\t\treturn hsb;\n\t}", "function hex2hsb(hex) {\n\t\tvar hsb = rgb2hsb(hex2rgb(hex));\n\t\tif( hsb.s === 0 ) hsb.h = 360;\n\t\treturn hsb;\n\t}", "calcHSL() {\r\n let r = this.r/255;\r\n let g = this.g/255;\r\n let b = this.b/255;\r\n let max = Math.max(r, g, b)\r\n let min = Math.min(r, g, b);\r\n let h, s, l = (max + min) / 2;\r\n if(max == min){\r\n h = s = 0; // achromatic\r\n } else {\r\n var d = max - min;\r\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n switch(max){\r\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n case g: h = (b - r) / d + 2; break;\r\n case b: h = (r - g) / d + 4; break;\r\n }\r\n h /= 6;\r\n }\r\n this._h = Math.round(h * 360);\r\n this._s = Math.round(s * 100);\r\n this._l = Math.round(l * 100);\r\n }", "static HSLToRGB(h, s, l) {\n let c = (1 - Math.abs(2 * l - 1)) * s;\n let hp = h / 60.0;\n let x = c * (1 - Math.abs((hp % 2) - 1));\n let rgb1;\n if (isNaN(h)) rgb1 = [0, 0, 0];\n else if (hp <= 1) rgb1 = [c, x, 0];\n else if (hp <= 2) rgb1 = [x, c, 0];\n else if (hp <= 3) rgb1 = [0, c, x];\n else if (hp <= 4) rgb1 = [0, x, c];\n else if (hp <= 5) rgb1 = [x, 0, c];\n else if (hp <= 6) rgb1 = [c, 0, x];\n let m = l - c * 0.5;\n let r = Math.round(255 * (rgb1[0] + m));\n let g = Math.round(255 * (rgb1[1] + m));\n let b = Math.round(255 * (rgb1[2] + m));\n return [r, g, b];\n }", "function hsv2hsl(h, s, v) {\n s /= consts_1.MAX_COLOR_SATURATION;\n v /= consts_1.MAX_COLOR_VALUE;\n var l = (2 - s) * v;\n var sl = s * v;\n sl /= l <= 1 ? l : 2 - l;\n sl = sl || 0;\n l /= 2;\n return { h: h, s: sl * 100, l: l * 100 };\n }", "function uh(a){var b=vh;this.g=[];this.v=b;this.u=a||null;this.f=this.a=!1;this.c=void 0;this.l=this.w=this.i=!1;this.h=0;this.b=null;this.o=0}", "function hh(a,b){this.g=[];this.v=a;this.u=b||null;this.f=this.a=!1;this.c=void 0;this.l=this.w=this.i=!1;this.h=0;this.b=null;this.m=0}", "function h$toHsStringA(str) {\n if(typeof str !== 'string') return h$ghczmprimZCGHCziTypesziZMZN;\n var i = str.length - 1;\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n while(i>=0) {\n r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, (str.charCodeAt(i)), (r)));\n --i;\n }\n return r;\n}", "function h$toHsStringA(str) {\n if(typeof str !== 'string') return h$ghczmprimZCGHCziTypesziZMZN;\n var i = str.length - 1;\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n while(i>=0) {\n r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, (str.charCodeAt(i)), (r)));\n --i;\n }\n return r;\n}", "function h$toHsStringA(str) {\n if(typeof str !== 'string') return h$ghczmprimZCGHCziTypesziZMZN;\n var i = str.length - 1;\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n while(i>=0) {\n r = (h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, (str.charCodeAt(i)), (r)));\n --i;\n }\n return r;\n}", "function hex2hsb(hex) {\r\n var hsb = rgb2hsb(hex2rgb(hex));\r\n if(hsb.s === 0) hsb.h = 360;\r\n return hsb;\r\n }", "function hsv2hsl(h, s, v) {\r\n s /= MAX_COLOR_SATURATION;\r\n v /= MAX_COLOR_VALUE;\r\n var l = (2 - s) * v;\r\n var sl = s * v;\r\n sl /= l <= 1 ? l : 2 - l;\r\n sl = sl || 0;\r\n l /= 2;\r\n return { h: h, s: sl * 100, l: l * 100 };\r\n}", "function infoFor4DivHexHSL() {\n const grayScaleBGC = infoFor4DivGray();\n console.log(359, grayScaleBGC);\n // RGB to HEX conversion\n let Red = grayScaleBGC[0].toString(16);\n let Green = grayScaleBGC[1].toString(16);\n let Blue = grayScaleBGC[2].toString(16);\n Red = Red.padStart(2, 0);\n Green = Green.padStart(2, 0);\n Blue = Blue.padStart(2, 0);\n console.log(367, Red, Green, Blue);\n document.querySelector(\"#HEXvalue4\").innerHTML = `HEX Value: <span>#${\n Red + Green + Blue\n }</span>`;\n // HEX to HSL conversion\n hex = \"#\" + Red + Green + Blue;\n console.log(373, hex, typeof hex);\n const arrayHSL = hexToHsl(hex);\n console.log(375, arrayHSL);\n HSLvalue4 = document.querySelector(\"#HSLvalue4\");\n HSLvalue4.innerHTML = `HSL Values: <span>${arrayHSL[0]}°, ${arrayHSL[1]}%, ${arrayHSL[2]}%</span>`;\n return arrayHSL;\n}", "function RGBtoHSL(r, g, b) {\n\tr /= 255, g /= 255, b /= 255;\n\tvar max = Math.max(r, g, b),\n\t\tmin = Math.min(r, g, b);\n\tvar h, s, l = (max + min) / 2;\n\tif (max == min) {\n\t\th = s = 0; // achromatic\n\t} else {\n\t\tvar d = max - min;\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\t\tswitch (max) {\n\t\tcase r:\n\t\t\th = (g - b) / d + (g < b ? 6 : 0);\n\t\t\tbreak;\n\t\tcase g:\n\t\t\th = (b - r) / d + 2;\n\t\t\tbreak;\n\t\tcase b:\n\t\t\th = (r - g) / d + 4;\n\t\t\tbreak;\n\t\t}\n\t\th /= 6;\n\t}\n\treturn [h, s, l];\n}", "function HSLToRGB(h,s,l) {\r\n\t\th = h/360;\r\n\t\ts = parseInt(s)/100;\r\n\t\tl = parseInt(l)/100;\r\n\t\tvar r = g = b = 0;\r\n\t\tvar v1 = v2 = 0;\r\n\t\t\r\n\t\tif (s == 0) {\r\n \tr = l * 255;\r\n \tg = l * 255;\r\n \tb = l * 255;\r\n } else {\r\n \tif (l < 0.5) {\r\n \tv2 = l * (1 + s);\r\n \t} else {\r\n \t v2 = (l + s) - (s * l);\r\n\t\t \t}\r\n\t\t\tv1 = 2 * l - v2;\r\n r = 255 * hue_2_rgb(v1,v2,h + (1 / 3));\r\n g = 255 * hue_2_rgb(v1,v2,h);\r\n b = 255 * hue_2_rgb(v1,v2,h - (1 / 3));\r\n }\r\n\t\treturn [r,g,b];\r\n\t}", "function hex2hsb(hex) {\n var hsb = rgb2hsb(hex2rgb(hex));\n if(hsb.s === 0) hsb.h = 360;\n return hsb;\n }", "function hsv2hsl(h, s, v) {\n s /= _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_SATURATION;\n v /= _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_VALUE;\n var l = (2 - s) * v;\n var sl = s * v;\n sl /= l <= 1 ? l : 2 - l;\n sl = sl || 0;\n l /= 2;\n return { h: h, s: sl * 100, l: l * 100 };\n}", "hex2hsl(hex) {\n let sColor = hex.toLowerCase();\n // 十六进制颜色值的正则表达式\n const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;\n\n // 处理六位的颜色值\n const rgbArr = [];\n\n // 如果是16进制颜色\n if (sColor && reg.test(sColor)) {\n if (sColor.length === 4) {\n let sColorNew = '#';\n for (let i = 1; i < 4; i += 1) {\n sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));\n }\n sColor = sColorNew;\n }\n\n for (let i = 1; i < 7; i += 2) {\n rgbArr.push(parseInt(`0x${sColor.slice(i, i + 2)}`, 16));\n }\n // return `RGB(${rgbArr.join(',')})`;\n } else {\n return;\n }\n // return sColor;\n\n const r1 = rgbArr[0] / 255;\n const g1 = rgbArr[1] / 255;\n const b1 = rgbArr[2] / 255;\n\n const maxColor = Math.max(r1, g1, b1);\n const minColor = Math.min(r1, g1, b1);\n // Calculate L:\n let L = (maxColor + minColor) / 2;\n let S = 0;\n let H = 0;\n if (maxColor !== minColor) {\n // Calculate S:\n if (L < 0.5) {\n S = (maxColor - minColor) / (maxColor + minColor);\n } else {\n S = (maxColor - minColor) / (2.0 - maxColor - minColor);\n }\n // Calculate H:\n if (r1 === maxColor) {\n H = (g1 - b1) / (maxColor - minColor);\n } else if (g1 === maxColor) {\n H = 2.0 + (b1 - r1) / (maxColor - minColor);\n } else {\n H = 4.0 + (r1 - g1) / (maxColor - minColor);\n }\n }\n\n L *= 100;\n S *= 100;\n H *= 60;\n if (H < 0) {\n H += 360;\n }\n return [H, S, L];\n }", "function h$toHsStringA(str) {\n\n if(typeof str !== 'string') return h$ghczmprimZCGHCziTypesziZMZN;\n var i = str.length - 1;\n var r = h$ghczmprimZCGHCziTypesziZMZN;\n while(i>=0) {\n\n\n\n r = h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, str.charCodeAt(i), r);\n\n --i;\n }\n return r;\n}", "function hsllg(h1,s1,l1, h2,s2,l2, x1,x2,x) {\n var h = h1 + (h2-h1)/(x2-x1)*(x-x1)\n var s = s1 + (s2-s1)/(x2-x1)*(x-x1)\n var l = l1 + (l2-l1)/(x2-x1)*(x-x1)\n\n return 'hsl(' + h + ', ' + s + '%, ' + l + '%)'\n}", "function h$fromHsString(str) {\n var xs = '';\n while(str.f.a === 2) {\n if(typeof str.d1 === 'number') {\n xs += String.fromCharCode(str.d1);\n } else {\n xs += String.fromCharCode(str.d1.d1); // unbox_e\n }\n str = str.d2;\n }\n return xs;\n}", "function rgbToHsl(r, g, b){\r\n\tr /= 255, g /= 255, b /= 255;\r\n\tvar max = Math.max(r, g, b), min = Math.min(r, g, b);\r\n\tvar h, s, l = (max + min) / 2;\r\n\r\n\tif(max == min){\r\n\t\th = s = 0; \r\n\t}else{\r\n\t\tvar d = max - min;\r\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n\t\tswitch(max){\r\n\t\t\tcase r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n\t\t\tcase g: h = (b - r) / d + 2; break;\r\n\t\t\tcase b: h = (r - g) / d + 4; break;\r\n\t\t}\r\n\t\th /= 6;\r\n\t}\r\n\treturn [h, s, l];\r\n}", "function rgbToHsl(r, g, b){\n r /= 255, g /= 255, b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min){\n h = s = 0; // achromatic\n }else{\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n // start custom hsl code\n h = Math.round(h*360);\n s = Math.round(s*100);\n l = Math.round(l*100);\n // end custom hsl code\n return [h, s, l];\n}", "function hexToHsl(hexInput) {\n var hslStr = Y.Color.toHSL(hexInput),\n hslArr = Y.Color.toArray(hslStr);\n\n return hslArr;\n }", "function hsba(h, s, b, a) {\n var lightness = (2 - s)*b;\n var satHSL = s*b/((lightness <= 1) ? lightness : 2 - lightness);\n return Qt.hsva(h, satHSL, lightness, a);\n}", "function rgbToHsl(R,G,B){\n\tR /= 255; G /= 255; B /= 255;\n\tvar H,L,S,ls_G,ls_B,ls_R;\n\tvar theMax=Math.max(R,G,B);\n\tvar theMin=Math.min(R,G,B); \n\n\tvar L = (theMax + theMin) / 2;\n\n if (theMax - theMin == 0)\n {\n H = 0;\n S = 0;\n }\n else\n {\n if (L < 0.5)\n {\n S = (theMax - theMin) / (theMax + theMin);\n }\n else\n {\n S = (theMax - theMin) / (2 - theMax - theMin);\n };\n\n ls_R = (((theMax - R) / 6) + ((theMax - theMin) / 2)) / (theMax - theMin);\n ls_G = (((theMax - G) / 6) + ((theMax - theMin) / 2)) / (theMax - theMin);\n ls_B = (((theMax - B) / 6) + ((theMax - theMin) / 2)) / (theMax - theMin);\n\n if (R == theMax)\n {\n H = ls_B - ls_G;\n }\n else if (G == theMax)\n {\n H = (1 / 3) + ls_R - ls_B;\n }\n else if (B == theMax)\n {\n H = (2 / 3) + ls_G - ls_R;\n };\n\n if (H < 0)\n {\n H += 1;\n };\n\n if (H > 1)\n {\n H -= 1;\n };\n };\n\tH = Math.round(H*360);\n\tS = Math.round(S*100);\n\tL = Math.round(L*100);\n\treturn [H,S,L];\n}", "function HSLToRGB(h, s, l) {\r\n\ts /= 100;\r\n\tl /= 100;\r\n\tvar c = (1 - Math.abs(2 * l - 1)) * s,\r\n\t\tx = c * (1 - Math.abs((h / 60) % 2 - 1)),\r\n\t\tm = l - c / 2,\r\n\t\tr = 0,\r\n\t\tg = 0,\r\n\t\tb = 0;\r\n\tif (0 <= h && h < 60) {\r\n\t\tr = c;\r\n\t\tg = x;\r\n\t\tb = 0;\r\n\t} else if (60 <= h && h < 120) {\r\n\t\tr = x;\r\n\t\tg = c;\r\n\t\tb = 0;\r\n\t} else if (120 <= h && h < 180) {\r\n\t\tr = 0;\r\n\t\tg = c;\r\n\t\tb = x;\r\n\t} else if (180 <= h && h < 240) {\r\n\t\tr = 0;\r\n\t\tg = x;\r\n\t\tb = c;\r\n\t} else if (240 <= h && h < 300) {\r\n\t\tr = x;\r\n\t\tg = 0;\r\n\t\tb = c;\r\n\t} else if (300 <= h && h < 360) {\r\n\t\tr = c;\r\n\t\tg = 0;\r\n\t\tb = x;\r\n\t}\r\n\tr = Math.round((r + m) * 255);\r\n\tg = Math.round((g + m) * 255);\r\n\tb = Math.round((b + m) * 255);\r\n\treturn [r, g, b];\r\n}", "function h$toHsStringMU8(arr) {\n\n var accept = false, b, n = 0, cp = 0, r = h$ghczmprimZCGHCziTypesziZMZN, i = arr.length - 1;\n while(i >= 0) {\n b = arr[i];\n if(!(b & 128)) {\n cp = b;\n accept = true;\n } else if((b & 192) === 128) {\n cp += (b & 32) * Math.pow(64, n)\n } else {\n cp += (b&((1<<(6-n))-1)) * Math.pow(64, n);\n accept = true;\n }\n if(accept) {\n\n\n\n r = h$c2(h$ghczmprimZCGHCziTypesziZC_con_e, cp, r);\n\n cp = 0\n n = 0;\n } else {\n n++;\n }\n accept = false;\n i--;\n }\n return r;\n}", "function lz(a,b){this.J=[];this.Ka=a;this.la=b||null;this.F=this.C=!1;this.If=void 0;this.ea=this.za=this.N=!1;this.L=0;this.Ef=null;this.H=0}", "function rgbToHSL(rgb) {\n rgb = rgb.slice(1, -1);\n\n let r = rgb.split(\",\")[0];\n let g = rgb.split(\",\")[1];\n let b = rgb.split(\",\")[2];\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n let h, s, l;\n\n const min = Math.min(r, g, b);\n const max = Math.max(r, g, b);\n\n if (max === min) {\n h = 0;\n } else if (max === r) {\n h = 60 * (0 + (g - b) / (max - min));\n } else if (max === g) {\n h = 60 * (2 + (b - r) / (max - min));\n } else if (max === b) {\n h = 60 * (4 + (r - g) / (max - min));\n }\n\n if (h < 0) {\n h = h + 360;\n }\n\n l = (min + max) / 2;\n\n if (max === 0 || min === 1) {\n s = 0;\n } else {\n s = (max - l) / Math.min(l, 1 - l);\n }\n // multiply s and l by 100 to get the value in percent, rather than [0,1]\n s *= 100;\n l *= 100;\n\n // round hsl\n function roundNumbers() {\n h = h.toFixed(0);\n s = s.toFixed(0);\n l = l.toFixed(0);\n }\n roundNumbers();\n\n // return template literals of h s l\n let result = `${h}° ${s}% ${l}%`;\n return result;\n}", "function calculateHSL(){\n\n // get the maximum and range of the RGB component values\n var maximum = Math.max(rgb.r, rgb.g, rgb.b);\n var range = maximum - Math.min(rgb.r, rgb.g, rgb.b);\n\n // determine the lightness in the range [0,1]\n var l = maximum / 255 - range / 510;\n\n // store the HSL components\n hsl =\n {\n 'h' : getHue(maximum, range),\n 's' : (range == 0 ? 0 : range / 2.55 / (l < 0.5 ? l * 2 : 2 - l * 2)),\n 'l' : 100 * l\n };\n\n }", "static rgbToHSL(r, g, b) {\n let h, s;\n if (typeof r === \"object\") {\n ({ g } = r);\n ({ b } = r);\n ({ r } = r);\n }\n\n r /= 255;\n g /= 255;\n b /= 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n\n if (max === min) {\n h = (s = 0);\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n h = (() => { switch (max) {\n case r: return ((g - b) / d) + (g < b ? 6 : 0);\n case g: return ((b - r) / d) + 2;\n case b: return ((r - g) / d) + 4;\n } })();\n\n h /= 6;\n }\n\n return {h, s, l};\n }", "function hexToHSL (hex, saturation) {\n // Convert hex to RGB first\n let r = 0\n let g = 0\n let b = 0\n if (hex.length === 4) {\n r = '0x' + hex[1] + hex[1]\n g = '0x' + hex[2] + hex[2]\n b = '0x' + hex[3] + hex[3]\n } else if (hex.length === 7) {\n r = '0x' + hex[1] + hex[2]\n g = '0x' + hex[3] + hex[4]\n b = '0x' + hex[5] + hex[6]\n }\n // Then to HSL\n r /= 255\n g /= 255\n b /= 255\n const cmin = Math.min(r, g, b)\n const cmax = Math.max(r, g, b)\n const delta = cmax - cmin\n let h = 0\n let s = 0\n let l = 0\n\n if (delta === 0) {\n h = 0\n } else if (cmax === r) {\n h = ((g - b) / delta) % 6\n } else if (cmax === g) {\n h = (b - r) / delta + 2\n } else {\n h = (r - g) / delta + 4\n }\n\n h = Math.round(h * 60)\n\n if (h < 0) { h += 360 }\n l = (cmax + cmin) / 2\n s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1))\n s = saturation || +(s * 200).toFixed(1)\n l = +(l * 100).toFixed(1)\n return 'hsl(' + h + ',' + s + '%,' + l + '%)'\n}", "function rgbToHsl(r, g, b){\n\t\t\tr /= 255, g /= 255, b /= 255;\n\t\t\tvar max = Math.max(r, g, b), min = Math.min(r, g, b);\n\t\t\tvar h, s, l = (max + min) / 2;\n\n\t\t\tif (max == min){\n\t\t\t\th = s = 0; // achromatic\n\t\t\t} else {\n\t\t\t\tvar d = max - min;\n\t\t\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\t\t\t\tswitch(max){\n\t\t\t\t\tcase r: h = (g - b) / d + (g < b ? 6 : 0); break;\n\t\t\t\t\tcase g: h = (b - r) / d + 2; break;\n\t\t\t\t\tcase b: h = (r - g) / d + 4; break;\n\t\t\t\t}\n\t\t\t\th /= 6;\n\t\t\t}\n\n\t\t\treturn [h, s, l];\n\t\t}", "function hsl2Rgb(h,s,l){\n function hue2rgb(p,q,t){\n if(t < 0) t+= 1;\n if(t > 1) t-= 1;\n if(t < 1/6) return p + (q -p) *6*t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q -p) *(2/3 -t)*6;\n return p;\n }\n\n var r,g,b;\n\n if (s==0){\n r = g = b = 1;\n } else {\n var q = l < 0.5 ? l * (1+s) : l+s -l*s;\n var p = 2 * l -q;\n r = hue2rgb(p,q,h+1/3);\n g = hue2rgb(p,q,h);\n b = hue2rgb(p,q,h-1/3);\n }\n\n return [Math.floor(r*255),Math.floor(g*255),Math.floor(b*255)];\n }", "function marshalSVHL (svhl) {\r\n try {\r\n if (svhl == null) return \"\";\r\n var res = svhl.gen;\r\n if (svhl.gen == GEN_ANY) return res;\r\n\r\n res += \" \";\r\n if (svhl.gen == GEN_NONE) res += svhl.value.hlStruct.marshal () + \",\" + svhl.value.hlContent;\r\n else {\r\n var method = getMethodByID (svhl.gen);\r\n res += method.marshal (GEN_HIGHLIGHT, svhl.value);\r\n }\r\n return res;\r\n } catch (ex) {\r\n showStatus (\"[statevar.marshalSVHL] \" + ex.message);\r\n }\r\n}", "LDSPHL() {\n regSP[0] = regHL[0];\n return 12;\n }", "function rgbToHsl(r, g, b) {\n\tr /= 255, g /= 255, b /= 255;\n\tvar max = Math.max(r, g, b), min = Math.min(r, g, b);\n\tvar h, s, l = (max + min) / 2;\n\n\tif (max == min) {\n\t\th = s = 0; // achromatic\n\t} else {\n\t\tvar d = max - min;\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\t\tswitch (max) {\n\t\tcase r:\n\t\t\th = (g - b) / d + (g < b ? 6 : 0);\n\t\t\tbreak;\n\t\tcase g:\n\t\t\th = (b - r) / d + 2;\n\t\t\tbreak;\n\t\tcase b:\n\t\t\th = (r - g) / d + 4;\n\t\t\tbreak;\n\t\t}\n\t\th /= 6;\n\t}\n\n\treturn [ h, s, l ];\n}", "static hslToRGB(h, s, l) {\n let b, g, r;\n if (typeof h === \"object\") {\n ({ s } = h);\n ({ l } = h);\n ({ h } = h);\n }\n\n if (s === 0) {\n r = (g = (b = l));\n } else {\n const q = l < 0.5 ? l * (1 + s) : (l + s) - (l * s);\n const p = (2 * l) - q;\n\n r = this.hueToRGB(p, q, h + (1/3));\n g = this.hueToRGB(p, q, h);\n b = this.hueToRGB(p, q, h - (1/3));\n }\n\n return {r: r * 255, g: g * 255, b: b * 255};\n }", "function pixelToHsl(pixel){\n const ret = new Uint16Array(3);\n ret[0] = PixelMath.hue(pixel);\n ret[1] = PixelMath.saturation(pixel);\n ret[2] = PixelMath.lightness(pixel);\n return ret;\n}", "function rgbToHslConverter(rgb) {\n const regex = /[\\(|\\)|r|g|b| ]/g\n let rgbString = rgb.replace(regex, '')\n let rgbArr = new Array();\n rgbArr = rgbString.split(\",\");\n r = (+rgbArr[0])\n g = (+rgbArr[1])\n b = (+rgbArr[2])\n\n r /= 255; g /= 255; b /= 255;\n let max = Math.max(r, g, b);\n let min = Math.min(r, g, b);\n let delta = max - min;\n let h;\n\n if (delta === 0) h = 0;\n else if (max === r) h = ((((g - b) / delta) % 6) + 6) % 6;\n else if (max === g) h = (b - r) / delta + 2;\n else if (max === b) h = (r - g) / delta + 4;\n\n let l = ((min + max) / 2);\n let s = (delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)));\n const hsl = `hsl(${Math.round(h * 60)}, ${Math.round((s * 100))}, ${Math.round((l * 100))})`;\n\n return hsl\n}", "function Vh(a){var b=Wh;this.g=[];this.v=b;this.o=a||null;this.f=this.a=!1;this.c=void 0;this.u=this.w=this.i=!1;this.h=0;this.b=null;this.l=0}", "function hslToHex(h, s, l) {\n l /= 100;\n const a = s * Math.min(l, 1 - l) / 100;\n const f = n => {\n const k = (n + h / 30) % 12;\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return Math.round(255 * color).toString(16).padStart(2, '0'); // convert to Hex and prefix \"0\" if needed\n };\n return `#${f(0)}${f(8)}${f(4)}`;\n}", "function hslToHex(h, s, l) {\n h /= 360;\n s /= 100;\n l /= 100;\n let r, g, b;\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n const hue2rgb = (p, q, t) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n const toHex = x => {\n const hex = Math.round(x * 255).toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n };\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}", "function rgbToHsl(r, g, b){\r\n \r\n r /= 255,\r\n g /= 255, \r\n b /= 255;\r\n \r\n var max = Math.max(r, g, b), \r\n min = Math.min(r, g, b);\r\n var h = 0,\r\n s = 0,\n l = (max + min) / 2;\n\n\tif(max == min){\n\t\t// gray\n h = s = 0; \n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return { \n \tH: Math.floor(h * 360),\n \tS: Math.floor(s * 100),\n \tL: Math.ceil(l * 100)\n };\n}", "function convertHHDeltas(hhDeltas) {\n let hashedHHD = new Array(hhDeltas.length);\n for (let i = 0; i < hhDeltas.length; i++) {\n hashedHHD[i] = zokratesHelper.packAndHash(hhDeltas[i]).toString();\n }\n return hashedHHD;\n}", "function binl2hex(binarray) \n{ \nvar hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\"; \nvar str = \"\"; \nfor(var i = 0; i < binarray.length * 4; i++) \n{ \nstr += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + \nhex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); \n} \nreturn str; \n}", "function rgbToHsl(rgbArr) {\n var r,g,b;\n r = rgbArr[0] / 255; g = rgbArr[1] / 255; b = rgbArr[2] / 255;\n\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n\n h /= 6;\n }\n\n return [ h, s, l ];\n}", "function rgbToHsl(r, g, b) {\n r /= 255, g /= 255, b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return [h, s, l];\n }", "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsv */ .py)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString", "function rgbToHsl(r, g, b){\r\n r /= 255, g /= 255, b /= 255;\r\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\r\n var h, s, l = (max + min) / 2;\r\n\r\n if(max == min){\r\n h = s = 0; // achromatic\r\n }else{\r\n var d = max - min;\r\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n switch(max){\r\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\r\n case g: h = (b - r) / d + 2; break;\r\n case b: h = (r - g) / d + 4; break;\r\n }\r\n h /= 6;\r\n }\r\n\r\n return [h, s, l];\r\n}", "function ht(a,b){this.PW=[];this.Cva=a;this.Gja=b||null;this.qI=this.Oe=!1;this.Yi=void 0;this.Eda=this.HIa=this.l_=!1;this.EY=0;this.Xb=null;this.CN=0}", "function hslToHex(h, s, l) {\n l /= 100\n const a = (s * Math.min(l, 1 - l)) / 100\n const f = (n) => {\n const k = (n + h / 30) % 12\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)\n return Math.round(255 * color)\n .toString(16)\n .padStart(2, '0') // convert to Hex and prefix \"0\" if needed\n }\n return `#${f(0)}${f(8)}${f(4)}`\n}", "function angolo_H(njd,Ar,Long){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) settembre 2010\n // njd= numero del giorno giuliano della data in T.U.\n // Ar= ascensione retta in ore decimali.\n // Long= Longitudine dell'ooseravtore. \n\nvar TSG=temposid (njd); // tempo siderale a Greenwich.\nvar TS_Loc=TSL(TSG,Long); // tempo siderale Locale.\nvar ang_H=TS_Loc-Ar; // angolo orario H.\n \n ang_H=ore_24(ang_H)*1; // H in ore decimali \n\nreturn ang_H;\n\n}", "static FromHSL(h, s, l) {\n let [r, g, b] = Color.HSLToRGB(h, s, l);\n return new Color(r, g, b);\n }", "function hslToRgb(h, s, l){\r\n var r, g, b;\r\n\r\n if(s == 0){\r\n r = g = b = l; // achromatic\r\n }else{\r\n function hue2rgb(p, q, t){\r\n if(t < 0) t += 1;\r\n if(t > 1) t -= 1;\r\n if(t < 1/6) return p + (q - p) * 6 * t;\r\n if(t < 1/2) return q;\r\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\r\n return p;\r\n }\r\n\r\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n var p = 2 * l - q;\r\n r = hue2rgb(p, q, h + 1/3);\r\n g = hue2rgb(p, q, h);\r\n b = hue2rgb(p, q, h - 1/3);\r\n }\r\n\r\n return [r * 255, g * 255, b * 255];\r\n}", "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,conversion/* rgbToHsv */.py)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString", "function hslToRgb(h, s, l, stringi=true){\n var r, g, b;\n\n if(s == 0){\n r = g = b = l; // achromatic\n }else{\n var hue2rgb = function hue2rgb(p, q, t){\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n if(stringi){\n return \"rgb(\"+Math.round(r * 255).toString()+\",\"+ Math.round(g * 255).toString()+\",\"+Math.round(b * 255)+\")\";\n }else{\n return {'r': Math.round(r*255),'g':Math.round(g*255),'b':Math.round(b*255)}\n }\n}", "function rgbToHsl(r, g, b){\n r /= 255, g /= 255, b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min){\n h = s = 0; // achromatic\n }else{\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return [h, s, l];\n}", "function rgbToHsl(r, g, b){\n r /= 255, g /= 255, b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min){\n h = s = 0; // achromatic\n }else{\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return [h, s, l];\n}", "function LABtoHSV(){\n var lab = getLAB();\n //console.log(\"labTOhsv: lab\", lab);\n var xyz = LABtoXYZ(lab[0], lab[1], lab[2]);\n //console.log(\"labTOhsv: xyz\", xyz);\n var rgb = XYZtoRGB(xyz[0], xyz[1], xyz[2]);\n //console.log(\"labTOhsv: rgb\", rgb);\n var hsv = RGBtoHSV(rgb[0], rgb[1], rgb[2]);\n //console.log(\"labTOhsv: hsv\", hsv);\n return hsv;\n}", "function rgbToHsl(r, g, b){\n r /= 255, g /= 255, b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max == min){\n h = s = 0; // achromatic\n }else{\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return [h, s, l];\n}", "function hslToRgb(h, s, l){\n var r, g, b;\n\n if(s == 0){\n r = g = b = l; // achromatic\n }else{\n function hue2rgb(p, q, t){\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return [r * 255, g * 255, b * 255];\n}", "function rgbToHsl(r, g, b){\n r /= 255;\n g /= 255;\n b /= 255;\n var max = Math.max(r, g, b), min = Math.min(r, g, b);\n var h, s, l = (max + min) / 2;\n\n if(max === min){\n h = s = 0; // achromatic\n }else{\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch(max){\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return [h, s, l];\n}", "function rgbToHsl(con_r, con_g, con_b){\n con_r /= 255;\n con_g /= 255;\n con_b /= 255;\n\n // Find greatest and smallest channel values\n let cmin = Math.min(con_r,con_g,con_b),\n cmax = Math.max(con_r,con_g,con_b),\n delta = cmax - cmin,\n h = 0,\n s = 0,\n l = 0;\n // Calculate hue\n // No difference\n if (delta == 0)\n h = 0;\n // Red is max\n else if (cmax == con_r)\n h = ((con_g - con_b) / delta) % 6;\n // Green is max\n else if (cmax == con_g)\n h = (con_b - con_r) / delta + 2;\n // Blue is max\n else\n h = (con_r - con_g) / delta + 4;\n \n h = Math.round(h * 60);\n \n // Make negative hues positive behind 360°\n if (h < 0)\n h += 360;\n \n l = (cmax + cmin) / 2;\n\n // Calculate saturation\n s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n \n // Multiply l and s by 100\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n \n return [h, s, l];\n \n}", "function hslToRgb(h, s, l) {\n\t\t\tvar r, g, b;\n\n\t\t\tif (s === 0){\n\t\t\t\tr = g = b = l; // achromatic\n\t\t\t} else {\n\t\t\t\tvar q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\t\t\tvar p = 2 * l - q;\n\t\t\t\tr = hue2rgb(p, q, h + 1/3);\n\t\t\t\tg = hue2rgb(p, q, h);\n\t\t\t\tb = hue2rgb(p, q, h - 1/3);\n\t\t\t}\n\t\t\treturn [r * 255, g * 255, b * 255];\n\t\t}", "function vjHSL(hue, saturation, lightness) {\n var ret = vjHCL(hue, (1 - Math.abs(2 * lightness - 1)) * saturation, lightness);\n ret.s = saturation;\n return ret;\n}", "function hslToRgb(h, s, l) {\r\n var r, g, b;\r\n\r\n function hue2rgb(p, q, t) {\r\n if (t < 0) t += 1;\r\n if (t > 1) t -= 1;\r\n if (t < 1 / 6) return p + (q - p) * 6 * t;\r\n if (t < 1 / 2) return q;\r\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\r\n return p;\r\n }\r\n if (s == 0) {\r\n r = g = b = l; // achromatic\r\n } else {\r\n\r\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n var p = 2 * l - q;\r\n r = hue2rgb(p, q, h + 1 / 3);\r\n g = hue2rgb(p, q, h);\r\n b = hue2rgb(p, q, h - 1 / 3);\r\n }\r\n return [r * 255, g * 255, b * 255];\r\n}", "function hsl2rgb(h, s, l){\n if(h.length) { l = h[2], s = h[1], h = h[0]; }\n var r, g, b;\n\n if(s == 0){\n r = g = b = l; // achromatic\n }else{\n function hue2rgb(p, q, t){\n if(t < 0) t += 1;\n if(t > 1) t -= 1;\n if(t < 1/6) return p + (q - p) * 6 * t;\n if(t < 1/2) return q;\n if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n }\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return [r, g, b];\n}", "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHsv)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString", "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHsv)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString", "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHsv)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString" ]
[ "0.7133919", "0.6777103", "0.6756517", "0.6323499", "0.6226175", "0.61585385", "0.61223394", "0.60979325", "0.60345244", "0.6014705", "0.59953487", "0.5991524", "0.5911918", "0.59083855", "0.5854398", "0.5845574", "0.5794395", "0.57931525", "0.5763595", "0.5761861", "0.5759879", "0.57319605", "0.5729671", "0.5729671", "0.5729671", "0.57273906", "0.57213134", "0.5659273", "0.5653339", "0.56478125", "0.56478125", "0.56378955", "0.5622747", "0.56218046", "0.5607203", "0.56064975", "0.5602554", "0.5602554", "0.5602554", "0.5598489", "0.55968016", "0.55946237", "0.5584499", "0.55754316", "0.556014", "0.55538493", "0.5550249", "0.55302995", "0.5525897", "0.55243564", "0.5502157", "0.5494124", "0.5482849", "0.54816824", "0.54612166", "0.5448699", "0.54456353", "0.544278", "0.54415387", "0.54411364", "0.5430153", "0.5429127", "0.542442", "0.54182357", "0.5407533", "0.54065394", "0.53871304", "0.5386219", "0.5383644", "0.5381045", "0.53703475", "0.5365194", "0.5363606", "0.5352266", "0.5349994", "0.53378654", "0.5329289", "0.53276205", "0.53234017", "0.5314067", "0.53023475", "0.5299419", "0.52977854", "0.5293026", "0.5289418", "0.52805424", "0.5279739", "0.52768666", "0.52768666", "0.5274041", "0.5273216", "0.5272491", "0.5272421", "0.52711904", "0.5268627", "0.5268285", "0.5268069", "0.52678835", "0.52656806", "0.52656806", "0.52656806" ]
0.0
-1
Return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) { // Allow passing all options as the first parameter if ( $.isPlainObject( effect ) ) { options = effect; effect = effect.effect; } // Convert to an object effect = { effect: effect }; // Catch (effect, null, ...) if ( options == null ) { options = {}; } // Catch (effect, callback) if ( $.isFunction( options ) ) { callback = options; speed = null; options = {}; } // Catch (effect, speed, ?) if ( typeof options === "number" || $.fx.speeds[ options ] ) { callback = speed; speed = options; options = {}; } // Catch (effect, options, callback) if ( $.isFunction( speed ) ) { callback = speed; speed = null; } // Add options to effect if ( options ) { $.extend( effect, options ); } speed = speed || options.duration; effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; effect.complete = callback || options.complete; return effect; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _normalizeArguments(effect,options,speed,callback){// Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options=effect;effect=effect.effect;}// Convert to an object\neffect={effect:effect};// Catch (effect, null, ...)\nif(options==null){options={};}// Catch (effect, callback)\nif($.isFunction(options)){callback=options;speed=null;options={};}// Catch (effect, speed, ?)\nif(typeof options===\"number\"||$.fx.speeds[options]){callback=speed;speed=options;options={};}// Catch (effect, options, callback)\nif($.isFunction(speed)){callback=speed;speed=null;}// Add options to effect\nif(options){$.extend(effect,options);}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed===\"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}", "function _normalizeArguments(effect,options,speed,callback){// Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options=effect;effect=effect.effect;}// Convert to an object\neffect={effect:effect};// Catch (effect, null, ...)\nif(options==null){options={};}// Catch (effect, callback)\nif($.isFunction(options)){callback=options;speed=null;options={};}// Catch (effect, speed, ?)\nif(typeof options===\"number\"||$.fx.speeds[options]){callback=speed;speed=options;options={};}// Catch (effect, options, callback)\nif($.isFunction(speed)){callback=speed;speed=null;}// Add options to effect\nif(options){$.extend(effect,options);}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed===\"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}", "function _normalizeArguments(effect,options,speed,callback){// Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options=effect;effect=effect.effect;}// Convert to an object\neffect={effect:effect};// Catch (effect, null, ...)\nif(options==null){options={};}// Catch (effect, callback)\nif($.isFunction(options)){callback=options;speed=null;options={};}// Catch (effect, speed, ?)\nif(typeof options===\"number\"||$.fx.speeds[options]){callback=speed;speed=options;options={};}// Catch (effect, options, callback)\nif($.isFunction(speed)){callback=speed;speed=null;}// Add options to effect\nif(options){$.extend(effect,options);}speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed===\"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}", "function _normalizeArguments(effect, options, speed, callback) {\n // allow passing all options as the first parameter\n if ($.isPlainObject(effect)) {\n options = effect;\n effect = effect.effect;\n }\n // convert to an object\n effect = {\n effect: effect\n };\n // catch (effect, null, ...)\n if (options == null) {\n options = {};\n }\n // catch (effect, callback)\n if ($.isFunction(options)) {\n callback = options;\n speed = null;\n options = {};\n }\n // catch (effect, speed, ?)\n if (typeof options === \"number\" || $.fx.speeds[options]) {\n callback = speed;\n speed = options;\n options = {};\n }\n // catch (effect, options, callback)\n if ($.isFunction(speed)) {\n callback = speed;\n speed = null;\n }\n // add options to effect\n if (options) {\n $.extend(effect, options);\n }\n speed = speed || options.duration;\n effect.duration = $.fx.off ? 0 : typeof speed === \"number\" ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;\n effect.complete = callback || options.complete;\n return effect;\n }", "function _normalizeArguments(effect, options, speed, callback) {\n\n\t\t\t// allow passing all options as the first parameter\n\t\t\tif ($.isPlainObject(effect)) {\n\t\t\t\toptions = effect;\n\t\t\t\teffect = effect.effect;\n\t\t\t}\n\n\t\t\t// convert to an object\n\t\t\teffect = { effect: effect };\n\n\t\t\t// catch (effect, null, ...)\n\t\t\tif (options == null) {\n\t\t\t\toptions = {};\n\t\t\t}\n\n\t\t\t// catch (effect, callback)\n\t\t\tif ($.isFunction(options)) {\n\t\t\t\tcallback = options;\n\t\t\t\tspeed = null;\n\t\t\t\toptions = {};\n\t\t\t}\n\n\t\t\t// catch (effect, speed, ?)\n\t\t\tif (typeof options === \"number\" || $.fx.speeds[options]) {\n\t\t\t\tcallback = speed;\n\t\t\t\tspeed = options;\n\t\t\t\toptions = {};\n\t\t\t}\n\n\t\t\t// catch (effect, options, callback)\n\t\t\tif ($.isFunction(speed)) {\n\t\t\t\tcallback = speed;\n\t\t\t\tspeed = null;\n\t\t\t}\n\n\t\t\t// add options to effect\n\t\t\tif (options) {\n\t\t\t\t$.extend(effect, options);\n\t\t\t}\n\n\t\t\tspeed = speed || options.duration;\n\t\t\teffect.duration = $.fx.off ? 0 :\n\t\t\t\ttypeof speed === \"number\" ? speed :\n\t\t\t\t\tspeed in $.fx.speeds ? $.fx.speeds[speed] :\n\t\t\t\t\t\t$.fx.speeds._default;\n\n\t\t\teffect.complete = callback || options.complete;\n\n\t\t\treturn effect;\n\t\t}", "function _normalizeArguments( effect, options, speed, callback ) {\r\n\r\n // allow passing all options as the first parameter\r\n if ( $.isPlainObject( effect ) ) {\r\n options = effect;\r\n effect = effect.effect;\r\n }\r\n\r\n // convert to an object\r\n effect = { effect: effect };\r\n\r\n // catch (effect, null, ...)\r\n if ( options == null ) {\r\n options = {};\r\n }\r\n\r\n // catch (effect, callback)\r\n if ( $.isFunction( options ) ) {\r\n callback = options;\r\n speed = null;\r\n options = {};\r\n }\r\n\r\n // catch (effect, speed, ?)\r\n if ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\r\n callback = speed;\r\n speed = options;\r\n options = {};\r\n }\r\n\r\n // catch (effect, options, callback)\r\n if ( $.isFunction( speed ) ) {\r\n callback = speed;\r\n speed = null;\r\n }\r\n\r\n // add options to effect\r\n if ( options ) {\r\n $.extend( effect, options );\r\n }\r\n\r\n speed = speed || options.duration;\r\n effect.duration = $.fx.off ? 0 :\r\n typeof speed === \"number\" ? speed :\r\n speed in $.fx.speeds ? $.fx.speeds[ speed ] :\r\n $.fx.speeds._default;\r\n\r\n effect.complete = callback || options.complete;\r\n\r\n return effect;\r\n }", "function _normalizeArguments(effect,options,speed,callback){ // Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options = effect;effect = effect.effect;} // Convert to an object\neffect = {effect:effect}; // Catch (effect, null, ...)\nif(options == null){options = {};} // Catch (effect, callback)\nif($.isFunction(options)){callback = options;speed = null;options = {};} // Catch (effect, speed, ?)\nif(typeof options === \"number\" || $.fx.speeds[options]){callback = speed;speed = options;options = {};} // Catch (effect, options, callback)\nif($.isFunction(speed)){callback = speed;speed = null;} // Add options to effect\nif(options){$.extend(effect,options);}speed = speed || options.duration;effect.duration = $.fx.off?0:typeof speed === \"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete = callback || options.complete;return effect;}", "function _normalizeArguments(effect,options,speed,callback){ // allow passing all options as the first parameter\nif($.isPlainObject(effect)){options = effect;effect = effect.effect;} // convert to an object\neffect = {effect:effect}; // catch (effect, null, ...)\nif(options == null){options = {};} // catch (effect, callback)\nif($.isFunction(options)){callback = options;speed = null;options = {};} // catch (effect, speed, ?)\nif(typeof options === \"number\" || $.fx.speeds[options]){callback = speed;speed = options;options = {};} // catch (effect, options, callback)\nif($.isFunction(speed)){callback = speed;speed = null;} // add options to effect\nif(options){$.extend(effect,options);}speed = speed || options.duration;effect.duration = $.fx.off?0:typeof speed === \"number\"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete = callback || options.complete;return effect;}", "function _normalizeArguments( effect, options, speed, callback ) {\r\n\r\n\t// Allow passing all options as the first parameter\r\n\tif ( $.isPlainObject( effect ) ) {\r\n\t\toptions = effect;\r\n\t\teffect = effect.effect;\r\n\t}\r\n\r\n\t// Convert to an object\r\n\teffect = { effect: effect };\r\n\r\n\t// Catch (effect, null, ...)\r\n\tif ( options == null ) {\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// Catch (effect, callback)\r\n\tif ( $.isFunction( options ) ) {\r\n\t\tcallback = options;\r\n\t\tspeed = null;\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// Catch (effect, speed, ?)\r\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\r\n\t\tcallback = speed;\r\n\t\tspeed = options;\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// Catch (effect, options, callback)\r\n\tif ( $.isFunction( speed ) ) {\r\n\t\tcallback = speed;\r\n\t\tspeed = null;\r\n\t}\r\n\r\n\t// Add options to effect\r\n\tif ( options ) {\r\n\t\t$.extend( effect, options );\r\n\t}\r\n\r\n\tspeed = speed || options.duration;\r\n\teffect.duration = $.fx.off ? 0 :\r\n\t\ttypeof speed === \"number\" ? speed :\r\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\r\n\t\t$.fx.speeds._default;\r\n\r\n\teffect.complete = callback || options.complete;\r\n\r\n\treturn effect;\r\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n // short path for passing an effect options object:\n if ( $.isPlainObject( effect ) ) {\n return effect;\n }\n\n // convert to an object\n effect = { effect: effect };\n\n // catch (effect)\n if ( options === undefined ) {\n options = {};\n }\n\n // catch (effect, callback)\n if ( $.isFunction( options ) ) {\n callback = options;\n speed = null;\n options = {};\n }\n\n // catch (effect, speed, ?)\n if ( $.type( options ) === \"number\" || $.fx.speeds[ options ]) {\n callback = speed;\n speed = options;\n options = {};\n }\n\n // catch (effect, options, callback)\n if ( $.isFunction( speed ) ) {\n callback = speed;\n speed = null;\n }\n\n // add options to effect\n if ( options ) {\n $.extend( effect, options );\n }\n\n speed = speed || options.duration;\n effect.duration = $.fx.off ? 0 : typeof speed === \"number\"\n ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;\n\n effect.complete = callback || options.complete;\n\n return effect;\n }", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t// allow passing all options as the first parameter\n\tif ( $.isPlainObject( effect ) ) {\n\t\toptions = effect;\n\t\teffect = effect.effect;\n\t}\n\n\t// convert to an object\n\teffect = { effect: effect };\n\n\t// catch (effect, null, ...)\n\tif ( options == null ) {\n\t\toptions = {};\n\t}\n\n\t// catch (effect, callback)\n\tif ( $.isFunction( options ) ) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, speed, ?)\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\n\t// catch (effect, options, callback)\n\tif ( $.isFunction( speed ) ) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\t// add options to effect\n\tif ( options ) {\n\t\t$.extend( effect, options );\n\t}\n\n\tspeed = speed || options.duration;\n\teffect.duration = $.fx.off ? 0 :\n\t\ttypeof speed === \"number\" ? speed :\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\n\t\t$.fx.speeds._default;\n\n\teffect.complete = callback || options.complete;\n\n\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\n\n\t\t// short path for passing an effect options object:\n\t\tif ( $.isPlainObject( effect ) ) {\n\t\t\t\treturn effect;\n\t\t}\n\n\t\t// convert to an object\n\t\teffect = { effect: effect };\n\n\t\t// catch (effect)\n\t\tif ( options === undefined ) {\n\t\t\t\toptions = {};\n\t\t}\n\n\t\t// catch (effect, callback)\n\t\tif ( $.isFunction( options ) ) {\n\t\t\t\tcallback = options;\n\t\t\t\tspeed = null;\n\t\t\t\toptions = {};\n\t\t}\n\n\t\t// catch (effect, speed, ?)\n\t\tif ( $.type( options ) === \"number\" || $.fx.speeds[ options ]) {\n\t\t\t\tcallback = speed;\n\t\t\t\tspeed = options;\n\t\t\t\toptions = {};\n\t\t}\n\n\t\t// catch (effect, options, callback)\n\t\tif ( $.isFunction( speed ) ) {\n\t\t\t\tcallback = speed;\n\t\t\t\tspeed = null;\n\t\t}\n\n\t\t// add options to effect\n\t\tif ( options ) {\n\t\t\t\t$.extend( effect, options );\n\t\t}\n\n\t\tspeed = speed || options.duration;\n\t\teffect.duration = $.fx.off ? 0 : typeof speed === \"number\"\n\t\t\t\t? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;\n\n\t\teffect.complete = callback || options.complete;\n\n\t\treturn effect;\n}", "function _normalizeArguments( effect, options, speed, callback ) {\r\n\r\n\t// allow passing all options as the first parameter\r\n\tif ( $.isPlainObject( effect ) ) {\r\n\t\toptions = effect;\r\n\t\teffect = effect.effect;\r\n\t}\r\n\r\n\t// convert to an object\r\n\teffect = { effect: effect };\r\n\r\n\t// catch (effect, null, ...)\r\n\tif ( options == null ) {\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// catch (effect, callback)\r\n\tif ( $.isFunction( options ) ) {\r\n\t\tcallback = options;\r\n\t\tspeed = null;\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// catch (effect, speed, ?)\r\n\tif ( typeof options === \"number\" || $.fx.speeds[ options ] ) {\r\n\t\tcallback = speed;\r\n\t\tspeed = options;\r\n\t\toptions = {};\r\n\t}\r\n\r\n\t// catch (effect, options, callback)\r\n\tif ( $.isFunction( speed ) ) {\r\n\t\tcallback = speed;\r\n\t\tspeed = null;\r\n\t}\r\n\r\n\t// add options to effect\r\n\tif ( options ) {\r\n\t\t$.extend( effect, options );\r\n\t}\r\n\r\n\tspeed = speed || options.duration;\r\n\teffect.duration = $.fx.off ? 0 :\r\n\t\ttypeof speed === \"number\" ? speed :\r\n\t\tspeed in $.fx.speeds ? $.fx.speeds[ speed ] :\r\n\t\t$.fx.speeds._default;\r\n\r\n\teffect.complete = callback || options.complete;\r\n\r\n\treturn effect;\r\n}", "addEffect (config, options) {\n return createEffect(this, config, options)\n }", "function updateEffectsOption() {\n var currText = 'Efectos';\n var currValue = (scene.effectsOn() ? 'ON': 'OFF');\n $('#optEffects').attr('value', currText + ' (' + currValue + ')');\n}", "function runEffect() {\r\n // get effect type from\r\n var selectedEffect = $( \"#effectTypes1\" ).val();\r\n \r\n // most effect types need no options passed by default\r\n var options = {};\r\n // some effects have required parameters\r\n if ( selectedEffect === \"scale\" ) {\r\n options = { percent: 0 };\r\n } else if ( selectedEffect === \"size\" ) {\r\n options = { to: { width: 200, height: 60 } };\r\n }\r\n \r\n // run the effect\r\n $( \"#effect\" ).toggle( selectedEffect, options, 500 );\r\n }", "function runEffect() {\r\n // get effect type from\r\n var selectedEffect = $( \"#effectTypes\" ).val();\r\n \r\n // most effect types need no options passed by default\r\n var options = {};\r\n // some effects have required parameters\r\n if ( selectedEffect === \"scale\" ) {\r\n options = { percent: 0 };\r\n } else if ( selectedEffect === \"size\" ) {\r\n options = { to: { width: 200, height: 60 } };\r\n }\r\n \r\n // run the effect\r\n $( \"#effect1\" ).toggle( selectedEffect, options, 500 );\r\n }", "function runEffect() {\r\n // get effect type from\r\n var selectedEffect = $(\"#effectTypes\").val();\r\n\r\n // Most effect types need no options passed by default\r\n var options = {};\r\n // some effects have required parameters\r\n if (selectedEffect === \"scale\") {\r\n options = { percent: 50 };\r\n } else if (selectedEffect === \"transfer\") {\r\n options = { to: \"#button\", className: \"ui-effects-transfer\" };\r\n } else if (selectedEffect === \"size\") {\r\n options = { to: { width: 200, height: 60 } };\r\n }\r\n // } else if(selectedEffect === \"explode\") {\r\n // options = { pieces: 100};\r\n // }\r\n\r\n // Run the effect\r\n $(\"#testImg\").effect(selectedEffect, options, 1000, callback);\r\n}", "function prepareAnimateOptions(options){return isObject(options)?options:{};}", "function prepareAnimateOptions(options){return isObject(options)?options:{};}", "function runEffect() {\n // get effect type from\n var selectedEffect = $( \"#effectTypes\" ).val();\n\n // most effect types need no options passed by default\n var options = {};\n // some effects have required parameters\n if ( selectedEffect === \"scale\" ) {\n options = {\n percent: 0\n };\n } else if ( selectedEffect === \"size\" ) {\n options = {\n to: {\n width: 200,\n height: 60\n }\n };\n }\n\n $( \"#effect\" ).toggle( selectedEffect, options, 500 );\n }", "function runEffect() {\n // get effect type from\n var selectedEffect = 'blind';\n\n // most effect types need no options passed by default\n var options = {};\n // some effects have required parameters\n if (selectedEffect === \"scale\") {\n options = {\n percent: 0\n };\n } else if (selectedEffect === \"size\") {\n options = {\n to: {\n width: 200,\n height: 60\n }\n };\n\n }\n\n // run the effect\n $(\"#effect\").toggle(selectedEffect, options, 500);\n\n }", "function buildSoundOptions(opts) {\n var soundOpts = {};\n for (var opt in opts)\n {\n soundOpts[opt] = opts[opt];\n }\n soundOpts.onload = AwesomeLoading.somethingLoaded;\n soundOpts.autoLoad = true;\n return soundOpts;\n }", "function runEffect() {\n// get effect type from\nvar selectedEffect = $( \"#effectTypes\" ).val();\n\n// most effect types need no options passed by default\nvar options = {};\n// some effects have required parameters\nif ( selectedEffect === \"scale\" ) {\n options = { percent: 0 };\n} else if ( selectedEffect === \"transfer\" ) {\n options = { to: \"#button\", className: \"ui-effects-transfer\" };\n} else if ( selectedEffect === \"size\" ) {\n options = { to: { width: 200, height: 60 } };\n}\n\n// run the effect\n$( \"#effect\" ).effect( selectedEffect, options, 500, callback );\n}", "buildParams() {\n const classOpts = {\n flip: this.flip,\n spin: this.spin,\n pulse: this.pulse,\n border: this.border,\n inverse: this.inverse,\n size: this.size || null,\n pull: this.pull || null,\n rotate: this.rotate || null,\n fixedWidth: this.fixedWidth,\n };\n const parsedTransform = typeof this.transform === 'string' ? _fortawesome_fontawesome_svg_core__WEBPACK_IMPORTED_MODULE_3__[\"parse\"].transform(this.transform) : this.transform;\n return {\n transform: parsedTransform,\n classes: [...faClassList(classOpts), ...this.classes],\n title: this.title,\n styles: this.styles,\n };\n }", "function Params() {\n return {\n // Wave shape\n wave_type: SQUARE,\n\n // Envelope\n env_attack: 0, // Attack time\n env_sustain: 0.3, // Sustain time\n env_punch: 0, // Sustain punch\n env_decay: 0.4, // Decay time\n\n // Tone\n base_freq: 0.3, // Start frequency\n freq_limit: 0, // Min frequency cutoff\n freq_ramp: 0, // Slide (SIGNED)\n freq_dramp: 0, // Delta slide (SIGNED)\n\n // Vibrato\n vib_strength: 0, // Vibrato depth\n vib_speed: 0, // Vibrato speed\n\n // Tonal change\n arp_mod: 0, // Change amount (SIGNED)\n arp_speed: 0, // Change speed\n\n // Duty (affects the timbre of SQUARE waves)\n duty: 0, // Square duty\n duty_ramp: 0, // Duty sweep (SIGNED)\n\n // Repeat\n repeat_speed: 0, // Repeat speed\n\n // Phaser\n pha_offset: 0, // Phaser offset (SIGNED)\n pha_ramp: 0, // Phaser sweep (SIGNED)\n\n // Low-pass filter\n lpf_freq: 1.0, // Low-pass filter cutoff\n lpf_ramp: 0, // Low-pass filter cutoff sweep (SIGNED)\n lpf_resonance: 0, // Low-pass filter resonance\n // High-pass filter\n hpf_freq: 0, // High-pass filter cutoff\n hpf_ramp: 0, // High-pass filter cutoff sweep (SIGNED)\n\n // Sample parameters\n sound_vol: 0.5,\n sample_rate: 44100,\n sample_size: 8\n };\n}", "function setOptions(obj) {\n\n // Set bean\n $(\"#Arabica\").fadeTo(250, (obj.bean == \"Arabica\" ? 1 : .25))\n $(\"#Robusta\").fadeTo(250, (obj.bean == \"Robusta\" ? 1 : .25))\n\n // Set roast\n $(\"#Light\").fadeTo(250, (obj.roast == \"Light\" ? 1 : .25))\n $(\"#Medium\").fadeTo(250, (obj.roast == \"Medium\" ? 1 : .25))\n $(\"#Dark\").fadeTo(250, (obj.roast == \"Dark\" ? 1 : .25))\n\n\n // Set method\n $(\"#Chemex\").fadeTo(250, (obj.method == \"Chemex\" ? 1 : .25))\n $(\"#Siphon\").fadeTo(250, (obj.method == \"Siphon\" ? 1 : .25))\n $(\"#ColdBrew\").fadeTo(250, (obj.method == \"ColdBrew\" ? 1 : .25))\n $(\"#Espresso\").fadeTo(250, (obj.method == \"Espresso\" ? 1 : .25))\n $(\"#Turkish\").fadeTo(250, (obj.method == \"Turkish\" ? 1 : .25))\n\n // Ste milk\n $(\"#CowMilk\").fadeTo(250, (obj.milk == \"CowMilk\" ? 1 : .25))\n $(\"#AlmondMilk\").fadeTo(250, (obj.milk == \"AlmondMilk\" ? 1 : .25))\n $(\"#SoyMilk\").fadeTo(250, (obj.milk == \"SoyMilk\" ? 1 : .25))\n\n // Set sweetener\n $(\"#Sugar\").fadeTo(250, (obj.sweetener == \"Sugar\" ? 1 : .25))\n $(\"#Honey\").fadeTo(250, (obj.sweetener == \"Honey\" ? 1 : .25))\n $(\"#Syrup\").fadeTo(250, (obj.sweetener == \"Syrup\" ? 1 : .25))\n }", "function runEffect() {\r\n // get effect type from\r\n var selectedEffect = $(\"#effectTypes\").val();\r\n\r\n // Most effect types need no options passed by default\r\n var options = {};\r\n // some effects have required parameters\r\n if (selectedEffect === \"scale\") {\r\n options = { percent: 50 };\r\n } else if (selectedEffect === \"transfer\") {\r\n options = { to: \"#button\", className: \"ui-effects-transfer\" };\r\n } else if (selectedEffect === \"size\") {\r\n options = { to: { width: 200, height: 60 } };\r\n }\r\n\r\n // Run the effect\r\n $(\"#effect\").effect(selectedEffect, options, 500, callback);\r\n }", "constructor(options) {\n this.attack = options.attack;\n this.break = options.break;\n this.name = options.name || '';\n this.img = options[\"image name\"] || \"default.jpg\";\n\n this.element = options.element;\n this.type = options.type;\n this.target = options.target || '';\n\n this.extra_skill = options[\"extra skill\"] || [];\n this.auto_ability = options[\"auto ability\"] || {};\n this.mechanics = options[\"mechanics\"] || {};\n }", "function Awake ()\n\t{\n\t\tvar effect_radius: radius = radius.other;\n\t\tif (affects_single)\n\t\t{\n\t\t\teffect_radius = radius.single;\n\t\t}\n\t\telse if (affects_adjacent)\n\t\t{\n\t\t\teffect_radius = radius.adjacent;\n\t\t}\n\t\telse if (affects_all_enemies)\n\t\t{\n\t\t\teffect_radius = radius.enemies;\n\t\t}\n\t\telse if (affects_all_creatures)\n\t\t{\n\t\t\teffect_radius = radius.creatures;\n\t\t}\n\t\telse if (affects_all_enemy_creatures)\n\t\t{\n\t\t\teffect_radius = radius.enemy_creatures;\n\t\t}\n\t\telse if (affects_random_enemy)\n\t\t{\n\t\t\teffect_radius = radius.random_enemy;\n\t\t}\n\t\tif (summon > 0)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.summon, summon, additional_card);\n\t\t}\n\t\telse if (deal_damage > 0)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.damage, deal_damage);\n\t\t}\n\t\tif (draw > 0)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.draw, draw);\n\t\t}\n\t\telse if (gain_creature)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.convert);\n\t\t}\n\t\telse if (swap_stats)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.swap);\n\t\t}\n\t\telse if(temp_mana_gain[0] > 0 || temp_mana_gain[1] > 0 || temp_mana_gain[2] > 0 || temp_mana_gain[3] > 0)\n\t\t{\n\t\t\tabilities.Add(effect_radius, effect.temp_mana, (temp_mana_gain[0] * 1000) + (temp_mana_gain[1] * 100) + (temp_mana_gain[2] * 10) + temp_mana_gain[3]);\n\t\t}\n\t}", "function runEffect() {\r\n // get effect type from\r\n var selectedEffect = $(\"#effectTypes\").val();\r\n\r\n // Most effect types need no options passed by default\r\n var options = {};\r\n // some effects have required parameters\r\n if (selectedEffect === \"scale\") {\r\n options = { percent: 50 };\r\n } else if (selectedEffect === \"size\") {\r\n options = { to: { width: 200, height: 60 } };\r\n }\r\n\r\n // Run the effect\r\n $(\"#effect\").hide(selectedEffect, options, 1000, callback);\r\n }", "function initEffects() {\n var key;\n for (key in Effects) {\n if (Effects.hasOwnProperty(key) && key !== '-') {\n Effects['-'].push(key);\n }\n }\n}", "applyOptions(options) {\n Object.assign(this[$options], options);\n // Re-evaluates clamping based on potentially new values for min/max\n // polar, azimuth and radius:\n this.setOrbit();\n // Prevent interpolation in the case that any target spherical values\n // changed (preserving OrbitalControls behavior):\n this[$spherical].copy(this[$targetSpherical]);\n }", "effect (prm) {\n try {\n return this.frame().effect(prm);\n } catch (e) {\n console.error(e.stack);\n throw e;\n }\n }", "function newPotionEffect(type, dur, str) {\n\tvar effectType;\n\tswitch (type.toUpperCase()) {\n\t\tcase \"ABSORPTION\":\n\t\t\teffectType = bkPotionEffectType.ABSORPTION;\n\t\t\tbreak;\n\t\tcase \"BLINDNESS\":\n\t\t\teffectType = bkPotionEffectType.BLINDNESS;\n\t\t\tbreak;\n\t\tcase \"CONFUSION\":\n\t\t\teffectType = bkPotionEffectType.CONFUSION;\n\t\t\tbreak;\n\t\tcase \"DAMAGE_RESISTANCE\":\n\t\t\teffectType = bkPotionEffectType.DAMAGE_RESISTANCE;\n\t\t\tbreak;\n\t\tcase \"FAST_DIGGING\":\n\t\t\teffectType = bkPotionEffectType.FAST_DIGGING;\n\t\t\tbreak;\n\t\tcase \"FIRE_RESISTANCE\":\n\t\t\teffectType = bkPotionEffectType.FIRE_RESISTANCE;\n\t\t\tbreak;\n\t\tcase \"HARM\":\n\t\t\teffectType = bkPotionEffectType.HARM;\n\t\t\tbreak;\n\t\tcase \"HEAL\":\n\t\t\teffectType = bkPotionEffectType.HEAL;\n\t\t\tbreak;\n\t\tcase \"HEALTH_BOOST\":\n\t\t\teffectType = bkPotionEffectType.HEALTH_BOOST;\n\t\t\tbreak;\n\t\tcase \"HUNGER\":\n\t\t\teffectType = bkPotionEffectType.HUNGER;\n\t\t\tbreak;\n\t\tcase \"INCREASE_DAMAGE\":\n\t\t\teffectType = bkPotionEffectType.INCREASE_DAMAGE;\n\t\t\tbreak;\n\t\tcase \"INVISIBILITY\":\n\t\t\teffectType = bkPotionEffectType.INVISIBILITY;\n\t\t\tbreak;\n\t\tcase \"JUMP\":\n\t\t\teffectType = bkPotionEffectType.JUMP;\n\t\t\tbreak;\n\t\tcase \"NIGHT_VISION\":\n\t\t\teffectType = bkPotionEffectType.NIGHT_VISION;\n\t\t\tbreak;\n\t\tcase \"POISON\":\n\t\t\teffectType = bkPotionEffectType.POISON;\n\t\t\tbreak;\n\t\tcase \"REGENERATION\":\n\t\t\teffectType = bkPotionEffectType.REGENERATION;\n\t\t\tbreak;\n\t\tcase \"SATURATION\":\n\t\t\teffectType = bkPotionEffectType.SATURATION;\n\t\t\tbreak;\n\t\tcase \"SLOW\":\n\t\t\teffectType = bkPotionEffectType.SLOW;\n\t\t\tbreak;\n\t\tcase \"SLOW_DIGGING\":\n\t\t\teffectType = bkPotionEffectType.SLOW_DIGGING;\n\t\t\tbreak;\n\t\tcase \"SPEED\":\n\t\t\teffectType = bkPotionEffectType.SPEED;\n\t\t\tbreak;\n\t\tcase \"WATER_BREATHING\":\n\t\t\teffectType = bkPotionEffectType.WATER_BREATHING;\n\t\t\tbreak;\n\t\tcase \"WEAKNESS\":\n\t\t\teffectType = bkPotionEffectType.WEAKNESS;\n\t\t\tbreak;\n\t\tcase \"WITHER\":\n\t\t\teffectType = bkPotionEffectType.WITHER;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log(\"must be a valid PotionEffectType: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html\");\n\t}\n\tif (dur == \"max\") {\n\t\treturn new bkPotionEffect(effectType, 2147483647, str-1); // dur (seconds) * 20 (ticks/sec)\n\t} else {\n\t\treturn new bkPotionEffect(effectType, dur*20, str-1); // dur (seconds) * 20 (ticks/sec)\n\t}\n}", "get options() {\n return { throttleDelay: this.throttleDelay, passive: this.passive };\n }", "function prepareAnimateOptions(options) {\n return isObject(options) ? options : {};\n }", "function Effect() {\r\n }//动画实例,做成类的形式,是为了共用所有原型方法", "function runEffect(effect) {\n // get effect type from\n var selectedEffect = \"blind\";\n \n // Most effect types need no options passed by default\n var options = {};\n // some effects have required parameters\n if ( selectedEffect === \"scale\" ) {\n options = { percent: 50 };\n } else if ( selectedEffect === \"size\" ) {\n options = { to: { width: 200, height: 60 } };\n }\n \n // Run the effect\n effect.toggle( selectedEffect, options, 500 );\n // $( \"#effect\" ).toggle( selectedEffect, options, 500 );\n }", "function setParameters(){\n var params = {};\n src = $('[src*=\"contrast.js\"').attr('src');\n if (src.substring(0, 4) != 'http') src = protocol + '//' + hostname + src;\n src.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { params[key] = value; });\n css = params['css'];\n append = params['append'];\n if (append == null) append = 'body';\n }", "function runEffect() {\n // get effect type from\n var selectedEffect = \"clip\";\n \n // most effect types need no options passed by default\n var options = {};\n // some effects have required parameters\n if ( selectedEffect === \"scale\" ) {\n options = { percent: 100 };\n } else if ( selectedEffect === \"size\" ) {\n options = { to: { width: 280, height: 185 } };\n }\n \n // run the effect\n $( \"#effect\" ).show( selectedEffect, options, 500, callback );\n }", "function runEffect() {\r\n\t\t\t// get effect type from \r\n\t\t\tvar selectedEffect = $( \"#effectTypes\" ).val();\r\n\r\n\t\t\t// most effect types need no options passed by default\r\n\t\t\tvar options = {};\r\n\t\t\t// some effects have required parameters\r\n\t\t\tif ( selectedEffect === \"scale\" ) {\r\n\t\t\t\toptions = { percent: 100 };\r\n\t\t\t} else if ( selectedEffect === \"size\" ) {\r\n\t\t\t\toptions = { to: { width: 280, height: 185 } };\r\n\t\t\t}\r\n\r\n\t\t\t// run the effect\r\n\t\t\t$( \"#effect\" ).show( selectedEffect, options, 500, callback );\r\n\t\t}", "function EffectClass () {}", "constructor() {\n this.effectsPool = {};\n }", "function getSharedArgs(options) {\n return [\n /**\n * Width\n */\n ...(options.width ? ['--width', options.width.toString()] : []),\n /**\n * Height\n */\n ...(options.height ? ['--height', options.height.toString()] : []),\n /**\n * Rotation\n */\n ...(options.rotation ? ['--rotation', options.rotation.toString()] : []),\n /**\n * Horizontal flip\n */\n ...(options.flip && (options.flip === __1.Flip.Horizontal || options.flip === __1.Flip.Both)\n ? ['--hflip']\n : []),\n /**\n * Vertical flip\n */\n ...(options.flip && (options.flip === __1.Flip.Vertical || options.flip === __1.Flip.Both)\n ? ['--vflip']\n : []),\n /**\n * Shutter Speed\n */\n ...(options.shutter ? ['--shutter', options.shutter.toString()] : []),\n /**\n * Sharpness (-100 to 100; default 0)\n */\n ...(options.sharpness ? ['--sharpness', options.sharpness.toString()] : []),\n /**\n * Contrast (-100 to 100; default 0)\n */\n ...(options.contrast ? ['--contrast', options.contrast.toString()] : []),\n /**\n * Brightness (0 to 100; default 50)\n */\n ...(options.brightness || options.brightness === 0\n ? ['--brightness', options.brightness.toString()]\n : []),\n /**\n * Saturation (-100 to 100; default 0)\n */\n ...(options.saturation ? ['--saturation', options.saturation.toString()] : []),\n /**\n * ISO\n */\n ...(options.iso ? ['--ISO', options.iso.toString()] : []),\n /**\n * EV Compensation\n */\n ...(options.exposureCompensation ? ['--ev', options.exposureCompensation.toString()] : []),\n /**\n * Exposure Mode\n */\n ...(options.exposureMode ? ['--exposure', options.exposureMode.toString()] : []),\n /**\n * Auto White Balance Mode\n */\n ...(options.awbMode ? ['--awb', options.awbMode.toString()] : []),\n /**\n * Analog Gain\n */\n ...(options.analogGain ? ['--analoggain', options.analogGain.toString()] : []),\n /**\n * Digital Gain\n */\n ...(options.digitalGain ? ['--digitalgain', options.digitalGain.toString()] : []),\n ];\n}", "function config(options) {\n options.duration ??= 100\n options.speed ??= 25;\n console.log(options)\n}", "function optShadow(opt) {\n if (opt == 'Soft 1') {\n return {blur: '20', offsetX: 5, offsetY: 5};\n } else if (opt == 'Soft 2') {\n return {blur: '20', offsetX: 10, offsetY: 10};\n } else if (opt == 'Hard 1') {\n return {blur: '0', offsetX: 5, offsetY: 5};\n } else if (opt == 'Hard 2') {\n return {blur: '0', offsetX: 10, offsetY: 10};\n } else {\n return {blur: '20', offsetX: 5, offsetY: 5};\n }\n }", "applyEffect (effect, source) {}", "function prepareAnimateOptions(options) {\n return isObject(options)\n ? options\n : {};\n}", "function prepareAnimateOptions(options) {\n return isObject(options)\n ? options\n : {};\n}", "function prepareAnimateOptions(options) {\n return isObject(options)\n ? options\n : {};\n}" ]
[ "0.63458794", "0.63458794", "0.63458794", "0.6345363", "0.6340309", "0.6337576", "0.6335888", "0.6304416", "0.627795", "0.6254449", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.62464744", "0.62414306", "0.62072444", "0.61912155", "0.5802764", "0.57720876", "0.57412624", "0.571211", "0.571211", "0.56329113", "0.55949384", "0.55858314", "0.5549163", "0.55009675", "0.54883045", "0.54853934", "0.5450861", "0.54303724", "0.5426613", "0.5425011", "0.5392476", "0.5390213", "0.53695685", "0.5363086", "0.5348597", "0.5340776", "0.5313389", "0.53130317", "0.53005475", "0.5299985", "0.52955747", "0.5285544", "0.52573633", "0.524539", "0.5237283", "0.5221475", "0.5220273", "0.5209535", "0.5209535", "0.5209535" ]
0.62808436
17
Support: IE 8 only IE 8 doesn't resolve inherit to visible/hidden for computed values
function visible( element ) { var visibility = element.css( "visibility" ); while ( visibility === "inherit" ) { element = element.parent(); visibility = element.css( "visibility" ); } return visibility !== "hidden"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visible(element){var visibility=element.css(\"visibility\");while(visibility===\"inherit\"){element=element.parent();visibility=element.css(\"visibility\");}return visibility!==\"hidden\";}", "function visible(element){var visibility=element.css(\"visibility\");while(visibility===\"inherit\"){element=element.parent();visibility=element.css(\"visibility\");}return visibility!==\"hidden\";}", "function visible(element){var visibility=element.css(\"visibility\");while(visibility===\"inherit\"){element=element.parent();visibility=element.css(\"visibility\");}return visibility!==\"hidden\";}", "static set visible(value) {}", "get hidden() { return hidden }", "function visible(element){var visibility=element.css(\"visibility\");while(visibility === \"inherit\") {element = element.parent();visibility = element.css(\"visibility\");}return visibility !== \"hidden\";}", "get visible(){ return this.filter(_elementIsVisible); }", "get _isVisible(){return Boolean(this.offsetWidth||this.offsetHeight);}", "prefixVisibilityChange() {\n if (typeof document.hidden !== \"undefined\") { // Opera 12.10 and Firefox 18 and later support\n this.set('hidden', 'hidden');\n this.set('visibilityChange', 'visibilitychange');\n } else if (typeof document.mozHidden !== \"undefined\") {\n this.set('hidden', 'mozHidden');\n this.set('visibilityChange', 'mozvisibilitychange');\n } else if (typeof document.msHidden !== \"undefined\") {\n this.set('hidden', 'msHidden');\n this.set('visibilityChange', 'msvisibilitychange');\n } else if (typeof document.webkitHidden !== \"undefined\") {\n this.set('hidden', 'webkitHidden');\n this.set('visibilityChange', 'webkitvisibilitychange');\n }\n }", "static get visible() {}", "get visible() {\n return true;\n }", "get _isVisible(){return!!(this.offsetWidth||this.offsetHeight)}", "attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'visible') {\n this.style.display = (newValue === 'false') ? 'none' : '';\n }\n }", "function isVisibleChild(value) {\n\treturn !isBoolean(value) && value != null;\n}", "function visible(e){return a.a.expr.filters.visible(e)&&!a()(e).parents().addBack().filter(function(){return\"hidden\"===a.a.css(this,\"visibility\")}).length}", "get _isVisible() {\n return Boolean(this.offsetWidth || this.offsetHeight);\n }", "get visible() {\n return this._visible;\n }", "get visible() {\n return this._visible;\n }", "get visible() {\n return this._visible;\n }", "_setVisibles(){\n\t\tif(this.hasAttribute('visible-element')){\n\t\t\tthis.visibles = this.vRoot.querySelectorAll(this.vElement);\n\t\t} else{\n\t\t\tthis.visibles = this._getVisiblesWhenNoVisibleElementAttribute();\n\t\t}\n\t}", "get isVisible () {\n return this._visible;\n }", "function getHiddenProp(){var e=[\"webkit\",\"moz\",\"ms\",\"o\"];if(\"hidden\"in document)return\"hidden\";for(var t=0;t<e.length;t++){if(e[t]+\"Hidden\"in document)return e[t]+\"Hidden\"}return null}", "get vElement(){\n\t\treturn this.hasAttribute('visible-element') ? this.getAttribute('visible-element') : '#' + this.cValue;\n\t}", "get _isVisible() {\n return !this.panelElem.hasClass(\"hidden\");\n }", "static get hiddenClass() {\n return 'hidden';\n }", "function visible(dimension) {return !('visible' in dimension) || dimension.visible;}", "function visible(dimension) {return !('visible' in dimension) || dimension.visible;}", "_getVisibleStyle() {\n var invisible = this.props.invisible;\n if(invisible) {\n return 'hide';\n }\n return '';\n }", "function makeInvisible(value) {\n return value ? 'visible' : 'invisible';\n }", "function set_visible(div, value) {\n\tvar ref;\n\tif(dom == 1) {\n\t\tref = document.getElementById(div).style;\n\t}\n // GH 19/12/08: Supports IE 4 which we shouldn't need to anymore\n\telse if(ie == 1) {\n\t\tref = eval('document.all.div.style');\n\t}\n // GH 19/12/08: Supports Netscape 4 which we shouldn't need to anymore\n\telse if(nn == 1) {\n\t\tref = eval('document.layers[div]');\n\t}\n\tref.visibility = value;\n}", "function isVisible() {\n return visible;\n }", "function isVisible() {\n return visible;\n }", "function computeVisibility(){var computedVisibility=(_audioOnly&&_displayMode==='auto'||_displayMode==='on')&&_displayAroundLoading;if(_lastComputedVisibility!==computedVisibility){_lastComputedVisibility=computedVisibility;_eventEmitter.emit('visibilityChanged',computedVisibility);}}", "function _prop(val) { return { value: val, enumerable: true }; }", "function _prop(val) { return { value: val, enumerable: true }; }", "get userVisible(){ return this.filter(_elementIsUserVisible); }", "analyseVisibility(visibleState, visible, dotVisible) {\n let currState = visibleState && visibleState !== 'auto' ? visibleState : visible;\n if (currState === 'dot' && !dotVisible) currState = 'none';\n return currState;\n }", "function visible(element) {\n var visibility = element.css('visibility');\n while (visibility === 'inherit') {\n element = element.parent();\n visibility = element.css('visibility');\n }\n return visibility !== 'hidden';\n }", "function _hidden() {}", "function setVisibility(){\n $jQ(':visible').each(function(){\n $jQ(this).attr(vars.visible, \"true\");\n });\n $jQ(':hidden').each(function(){\n $jQ(this).attr(vars.visible, \"false\");\n });\n}", "get hidden() {\n return !this.selected;\n }", "getVisibility() {\n var visibility = 'visible';\n if (this.state.position < 0 || this.state.position > this.state.max) {\n visibility = 'hidden';\n }\n return visibility;\n }", "isPartiallyVisible() {\n\t\treturn !this.isVisible() && !this.isHidden();\n\t}", "toggleVisibility() {\n this.visibility = this.visibility === \"hidden\" ? \"visible\" : \"hidden\";\n return this.visibility;\n }", "set visible(value) {\n if (value) {\n this.node.setAttribute(\"visible\", true);\n } else {\n this.node.removeAttribute(\"visible\");\n this.active = false;\n this.focusWhenActive = false;\n }\n }", "function GetCurrentVisibility(klass)\n{\n for(let elem of document.getElementsByClassName(klass)){\n let vis = elem.getAttribute('visibility')\n return vis != 'hidden';\n }\n\n return false;// no elems at all\n}", "toggleHidden (prop) {\n\t\t\tvar isVisible = true;\n\t\t\tif (!isNone(prop['isVisible'])) {\n\t\t\t\tisVisible = prop['isVisible'];\n\t\t\t}\n\t\t\tset(prop,'isVisible', isVisible?false:true);\n\t\t\t//comprobamos si queda alguna columna como visible, si no ocultamos acciones\n\t\t\tvar visible = false;\n\t\t\tvisible = this.properties.some(function(entry){\n\t\t\t\tif ( entry['isVisible'] ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\t\t\tvisible?this.handleVisibility(false):this.handleVisibility(true);\n\t\t}", "function shouldBeVisible() {\n return visibleValues > 1;\n}", "getIsVisible() {\n return this.isVisible();\n }", "function calcAndDisplayStatEffect(id, visibility) {\n document.getElementById(id).style.display = visibility; \n}", "function getEltVisibility (elt)\n{ if (is.nav4) \n { var value = elt.visibility;\n if (value == \"show\") return \"visible\";\n else if (value == \"hide\") return \"hidden\";\n else return value;\n }\n else if (elt.style) return elt.style.visibility;\n}", "function VisibletAttribute(attribute, visible) {\n Xrm.Page.getControl(attribute).setVisible(visible);\n}", "function xHide(e){return xVisibility(e,0);}", "static show(v) {\n // Set style to original value\n UI.find(v).removeAttribute(\"hidden\");\n }", "function isVisible() {\n\t\t\treturn visible;\n\t\t}", "function validatorUpdateDisplay(val) {\r\n\r\n jQuery(val).removeAttr(\"style\").hide().removeClass(\"invalid\");\r\n\r\n if (typeof (val.display) == \"string\") {\r\n\r\n if (val.display == \"None\") {\r\n return;\r\n }\r\n if (val.display == \"Dynamic\") {\r\n\r\n if (val.isvalid && !jQuery(val).siblings(\".field\").hasClass(\"invalid\")) {\r\n\r\n jQuery(val).siblings(\".field\").removeClass(\"invalid\");\r\n\r\n } else {\r\n\r\n jQuery(val).siblings(\".field\").addClass(\"invalid\");\r\n\r\n }\r\n return;\r\n }\r\n }\r\n}", "function visible(element) {\r\n if(getComputedStyle(element).getPropertyValue(\"visibility\") == \"hidden\") {\r\n return false;\r\n } else {\r\n if(element.parentNode != document) {\r\n return visible(element.parentNode);\r\n } else {\r\n return true;\r\n }\r\n }\r\n}", "isVisible() {\n return this._visibility === 'visible';\n }", "function isVisible(elem) {\n let element = elem;\n let visibility = element.css('visibility');\n while (visibility === 'inherit') {\n element = element.parent();\n visibility = element.css('visibility');\n }\n return visibility !== 'hidden';\n }", "function f$7(e){return !!r$s(e)&&!e.visible}", "setVisible() {\n element.removeClass('hidden');\n }", "setVisible() {\n element.removeClass('hidden');\n }", "function incomeVisibility() {\n 'use strict';\n\n // Earned Income\n FBRun.vis.applyRule($('#p3'), employedInHousehold());\n\n // Pensions Income:\n FBRun.vis.applyRule($('#p5'), pensionerInHousehold());\n\n // Non-dep Income:\n FBRun.vis.applyRule($('#p7'), nonDepInHousehold());\n return false;\n}", "function v(e){var o=q(e).offsetParent();var O=false;var $=q(e).parents().filter(function(){if(this===o){O=true;}return O;});return!q(e).add($).filter(function(){return q.css(this,\"visibility\")===\"hidden\"||q.expr.pseudos.hidden(this);}).length;}", "isSupported() {\n return hidden !== undefined;\n }", "function isHidden(){\n \tvar hidden;\n \tif (hidden != 'hidden'){\n \t\thidden = 'hidden';\n \t}else{\n \t\thidden = '';\n \t}\n return hidden;\n\n}", "get hidden() {\n return !this.mcVisible && !this.animationState;\n }", "function setVisible(val) {\n\t\tif(val == undefined) {\n\t\t\tval = true;\n\t\t}\n\t\tthis.visible = val;\n\t}", "function xVisibility(e, bShow)\r\n{\r\n if(!(e=xGetElementById(e))) return null;\r\n if(e.style && xDef(e.style.visibility)) {\r\n if (xDef(bShow)) e.style.visibility = bShow ? 'visible' : 'hidden';\r\n return e.style.visibility;\r\n }\r\n return null;\r\n}", "function isVisible(element, value) {\n if (!element.offsetParent && element.offsetWidth === 0 && element.offsetHeight === 0) {\n return (false)\n } else {\n return (true);\n }\n }", "function trk_get_visible() {\n var hidden = false;\n if (typeof document.hidden !== \"undefined\") {\n\thidden = document.hidden;\n } else if (typeof document.msHidden !== \"undefined\") {\n\thidden = document.msHidden;\n } else if (typeof document.webkitHidden !== \"undefined\") {\n\thidden = document.webkitHidden;\n }\n return hidden ? 0 : 1;\n}", "function setValuesVisibility() {\n lodash.forEach(ctrl.valuesArray, function (value) {\n lodash.defaults(value, {visible: true});\n });\n }", "function _isVisible(el, t, r, b, l, w, h) {\n\n // Application.console.log(\"isVisible called\");\n\n var s1 = 0;\n var s2 = 0;\n var s3 = 0;\n var s4 = 0;\n\n var p = el.parentNode,\n VISIBLE_PADDING = 2;\n\n // if ( !_elementInDocument(el) ) {\n // Application.console.log(\"rejected in step1\");\n // return false; \n // }\n\n //-- Return true for document node\n if ( 9 === p.nodeType ) {\n return true;\n\n // Application.console.log(\"rejected in step 2\")\n }\n\n //-- Return false if our element is invisible\n if (\n '0' === _getStyle(el, 'opacity') ||\n 'none' === _getStyle(el, 'display') ||\n 'hidden' === _getStyle(el, 'visibility')\n ) {\n\n // Application.console.log(\"rejected in step 3\");\n return false;\n }\n\n if ( \n 'undefined' === typeof(t) ||\n 'undefined' === typeof(r) ||\n 'undefined' === typeof(b) ||\n 'undefined' === typeof(l) ||\n 'undefined' === typeof(w) ||\n 'undefined' === typeof(h)\n ) {\n t = el.offsetTop;\n l = el.offsetLeft;\n b = t + el.offsetHeight;\n r = l + el.offsetWidth;\n w = el.offsetWidth;\n h = el.offsetHeight;\n }\n //-- If we have a parent, let's continue:\n if ( p ) {\n //-- Check if the parent can hide its children.\n if ( ('hidden' === _getStyle(p, 'overflow') || 'scroll' === _getStyle(p, 'overflow')) ) {\n //-- Only check if the offset is different for the parent\n if (\n //-- If the target element is to the right of the parent elm\n l + VISIBLE_PADDING > p.offsetWidth + p.scrollLeft ||\n //-- If the target element is to the left of the parent elm\n l + w - VISIBLE_PADDING < p.scrollLeft ||\n //-- If the target element is under the parent elm\n t + VISIBLE_PADDING > p.offsetHeight + p.scrollTop ||\n //-- If the target element is above the parent elm\n t + h - VISIBLE_PADDING < p.scrollTop\n ) {\n //-- Our target element is out of bounds:\n // Application.console.log(\"rejected in step 4\")\n return false;\n\n s3++;\n }\n }\n //-- Add the offset parent's left/top coords to our element's offset:\n if ( el.offsetParent === p ) {\n l += p.offsetLeft;\n t += p.offsetTop;\n }\n //-- Let's recursively check upwards:\n return _isVisible(p, t, r, b, l, w, h);\n }\n return true;\n }", "function plugin_hidden_isHidden(elem){\n return jQuery(elem.parentNode).children('div.hiddenBody')[0].style.display === \"none\";\n}", "get visible()/*: boolean*/ {\n if (this[_visible] === undefined && this.parentView) {\n return this.parentView.visible;\n }\n return this[_visible];\n }", "function xShow(e) {return xVisibility(e,1);}", "restoreDefaultVisibility(){\n\t\t\tthis.properties.forEach(function(entry){\n\t\t\t\tvar isVisible = ( isNone(entry['hidden']) || !entry['hidden'] ) ? true : false;\n\t\t\t\tset(entry, 'isVisible', isVisible);\n\t\t\t});\n\t\t}", "isHide() {\n return this.x < 0\n }", "function Edit_UpdateVisibility(theHTML, theObject)\n{\n\t//only process this on non JSGrabber objects unless there actually is a value on it (so you can hide it)\n\tif (!theObject.StyleProperties || !String_IsNullOrWhiteSpace(theObject.Properties[__NEMESIS_PROPERTY_VISIBLE]))\n\t{\n\t\t//is visible?\n\t\tvar bVisible = Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_VISIBLE], true);\n\t\t//visible style\n\t\tvar strVisible = bVisible ? \"inherit\" : \"hidden\";\n\t\t//update ourselves\n\t\ttheHTML.style.visibility = strVisible;\n\t\t//has mandatory?\n\t\tif (theHTML.MANDATORY_IMAGE)\n\t\t{\n\t\t\t//set visibile\n\t\t\ttheHTML.MANDATORY_IMAGE.style.visibility = strVisible;\n\t\t}\n\t\t//has mandatory caption?\n\t\tif (theHTML.MANDATORY_CAPTION)\n\t\t{\n\t\t\t//remove it from the parent\n\t\t\ttheHTML.MANDATORY_CAPTION.style.visibility = strVisible;\n\t\t}\n\t\t//are we showing matchcode?\n\t\tif (theHTML.STATES_MATCHCODE && !bVisible)\n\t\t{\n\t\t\t//remove all popups\n\t\t\tPopups_TriggerCloseAll();\n\t\t}\n\t}\n}", "get showValue() {\n return this.getShowValue();\n }", "function makevisible(cur,which){\r\nstrength=(which==0)? 1 : 0.6\r\n\r\nif (cur.style.MozOpacity)\r\ncur.style.MozOpacity=strength\r\nelse if (cur.filters)\r\ncur.filters.alpha.opacity=strength*100\r\n}", "function propagateVisibility(showeverything) {\t\n\t/*at first hide everything*/\n\tvar fachs = document.querySelectorAll('*[data-name~=\"fach\"]');\n\tfor (var i=0; i < fachs.length; i++) {\n\t\tfachs[i].setAttribute(\"data-nocontent\",\"true\");\n\t}\n\tvar wholefachs = document.querySelectorAll('*[data-name~=\"wholefach\"]');\n\tfor (var i=0; i < wholefachs.length; i++) {\n\t\twholefachs[i].setAttribute(\"data-nolvas\",\"true\");\n\t}\n\tvar wholemodul2s = document.querySelectorAll('*[data-name~=\"wholemodul2\"]');\n\tfor (var i=0; i < wholemodul2s.length; i++) {\n\t\twholemodul2s[i].setAttribute(\"data-nolvas\",\"true\");\n\t}\n\tvar wholemodul1s = document.querySelectorAll('*[data-name~=\"wholemodul1\"]');\n\tfor (var i=0; i < wholemodul1s.length; i++) {\n\t\twholemodul1s[i].setAttribute(\"data-nolvas\",\"true\");\n\t}\n\n\tvar tables = document.querySelectorAll('*[data-name~=\"lvatable\"]');\n\tfor (var i=0; i < tables.length; i++) {\n\t\tif(showeverything) {\n\t\t\t//TODO parentNode method not very change-proof (XPath?)\n\t\t\ttables[i].parentNode.setAttribute(\"data-nocontent\",\"false\"); /*fach*/\n\t\t\ttables[i].parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholefach*/\n\t\t\ttables[i].parentNode.parentNode.parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholemodul2*/\n\t\t\ttables[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholemodul1*/\n\t\t} else {\n\t\t\tvar subrows = tables[i].firstChild.childNodes; //firstChild is tbody\n\t\t\tfor (var j=0; j < subrows.length; j++) {\n\t\t\t\tif( subrows[j].hasChildNodes() && \n\t\t\t\t\t\tsubrows[j].getAttribute(\"data-hiderow_date\") != \"true\" &&\n\t\t\t\t\t\tsubrows[j].getAttribute(\"data-hiderow_semester\") != \"true\" &&\n\t\t\t\t\t\tsubrows[j].getAttribute(\"data-hiderow_university\") != \"true\" &&\n\t\t\t\t\t\t(document.getElementById(\"content\").getAttribute(\"data-hideuni\") != \"true\" || tables[i].parentNode.parentNode.getAttribute(\"data-multipleuniversities_static\") != \"true\") ) {\n\t\t\t\t\t//TODO parentNode method not very change-proof (XPath?)\n\t\t\t\t\ttables[i].parentNode.setAttribute(\"data-nocontent\",\"false\"); /*fach*/\n\t\t\t\t\ttables[i].parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholefach*/\n\t\t\t\t\ttables[i].parentNode.parentNode.parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholemodul2*/\n\t\t\t\t\ttables[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.setAttribute(\"data-nolvas\",\"false\"); /*wholemodul1*/\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tredrawFix();\n}" ]
[ "0.6636289", "0.6636289", "0.6636289", "0.648814", "0.64609355", "0.64392227", "0.6343425", "0.6238091", "0.6237218", "0.62117374", "0.612754", "0.6095307", "0.60799813", "0.60512996", "0.594326", "0.593291", "0.59233123", "0.59233123", "0.59233123", "0.58854663", "0.5885439", "0.58223635", "0.58213216", "0.57965237", "0.5796173", "0.579165", "0.579165", "0.57906955", "0.57841116", "0.5760042", "0.575222", "0.575222", "0.57305574", "0.57230973", "0.57230973", "0.5703996", "0.5689222", "0.5657854", "0.56502205", "0.5642551", "0.56130207", "0.5591091", "0.55772686", "0.5573518", "0.55543995", "0.5547889", "0.5547831", "0.55355054", "0.55200446", "0.551671", "0.5509732", "0.5493575", "0.5477061", "0.5474344", "0.5472993", "0.5461113", "0.5460666", "0.5457785", "0.5455148", "0.54376", "0.5422956", "0.5422956", "0.5416956", "0.5414732", "0.5405554", "0.54023683", "0.5401841", "0.53991437", "0.5393024", "0.5390501", "0.5390258", "0.5380739", "0.53694177", "0.536865", "0.5368521", "0.5368304", "0.53672504", "0.5360977", "0.5360072", "0.53555846", "0.5334297", "0.5333643" ]
0.56523085
51
Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, allowing multiple different settings on the same page.
function Datepicker() { this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false; // True if the popup picker is showing , false if not this._inDialog = false; // True if showing within a "dialog", false if not this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class this._appendClass = "ui-datepicker-append"; // The name of the append marker class this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class this.regional = []; // Available regional settings, indexed by language code this.regional[ "" ] = { // Default regional settings closeText: "Done", // Display text for close link prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link monthNames: [ "January","February","March","April","May","June", "July","August","September","October","November","December" ], // Names of months for drop-down and formatting monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year yearSuffix: "" // Additional text to append to the year in the month headers }; this._defaults = { // Global defaults for all the date picker instances showOn: "focus", // "focus" for popup on focus, // "button" for trigger button, or "both" for either showAnim: "fadeIn", // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations defaultDate: null, // Used when field is blank: actual date, // +/-number for offset from today, null for today appendText: "", // Display text following the input box, e.g. showing the format buttonText: "...", // Text for trigger button buttonImage: "", // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: false, // True if month can be selected directly, false if only prev/next changeYear: false, // True if year can be selected directly, false if only prev/next yearRange: "c-10:c+10", // Range of years to display in drop-down, // either relative to today's year (-nn:+nn), relative to currently displayed year // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: "+10", // Short year values < this are in the current century, // > this are in the previous century, // string value starting with "+" for current year + value minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit duration: "fast", // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker onSelect: null, // Define a callback function when a date is selected onChangeMonthYear: null, // Define a callback function when the month or year is changed onClose: null, // Define a callback function when the datepicker is closed numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward stepBigMonths: 12, // Number of months to step back/forward for the big links altField: "", // Selector for an alternate field to store selected dates into altFormat: "", // The date format to use for the alternate field constrainInput: true, // The input is constrained by the current date format showButtonPanel: false, // True to show button panel, false to not show it autoSize: false, // True to size the input for the date format, false to leave as is disabled: false // The initial disabled state }; $.extend( this._defaults, this.regional[ "" ] ); this.regional.en = $.extend( true, {}, this.regional[ "" ] ); this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Datepicker() {\r\n\tthis.debug = false; // Change this to true to start debugging\r\n\tthis._nextId = 0; // Next ID for a date picker instance\r\n\tthis._inst = []; // List of instances indexed by ID\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[''] = { // Default regional settings\r\n\t\tclearText: 'Clear', // Display text for clear link\r\n\t\tclearStatus: 'Erase the current date', // Status text for clear link\r\n\t\tcloseText: 'Close', // Display text for close link\r\n\t\tcloseStatus: 'Close without change', // Status text for close link\r\n\t\tprevText: '&#x3c;Prev', // Display text for previous month link\r\n\t\tprevStatus: 'Show the previous month', // Status text for previous month link\r\n\t\tnextText: 'Next&#x3e;', // Display text for next month link\r\n\t\tnextStatus: 'Show the next month', // Status text for next month link\r\n\t\tcurrentText: 'Today', // Display text for current month link\r\n\t\tcurrentStatus: 'Show the current month', // Status text for current month link\r\n\t\tmonthNames: ['January','February','March','April','May','June',\r\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\r\n\t\tmonthStatus: 'Show a different month', // Status text for selecting a month\r\n\t\tyearStatus: 'Show a different year', // Status text for selecting a year\r\n\t\tweekHeader: 'Wk', // Header for the week of the year column\r\n\t\tweekStatus: 'Week of the year', // Status text for the week of the year column\r\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\r\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\r\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\r\n\t\tdayStatus: 'Set DD as first week day', // Status text for the day of the week selection\r\n\t\tdateStatus: 'Select DD, M d', // Status text for the date selection\r\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tinitStatus: 'Select a date', // Initial Status text on opening\r\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\r\n\t\t\t// 'button' for trigger button, or 'both' for either\r\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: '...', // Text for trigger button\r\n\t\tbuttonImage: '', // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\tcloseAtTop: true, // True to have the clear/close at the top,\r\n\t\t\t// false to have them at the bottom\r\n\t\tmandatory: false, // True to hide the Clear link, false to include it\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tchangeMonth: true, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: true, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\r\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\r\n\t\tchangeFirstDay: true, // True to click on day name to change, false to remain as set\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tshowWeeks: false, // True to show week of the year, false to omit\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century, \r\n\t\t\t// string value starting with '+' for current year + value\r\n\t\tshowStatus: false, // True to show status bar at bottom, false to not show it\r\n\t\tstatusForDate: this.dateStatus, // Function to provide status text for a date -\r\n\t\t\t// takes date and instance as parameters, returns display text\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tspeed: 'normal', // Speed of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not,\r\n\t\t\t// [1] = custom CSS class name(s) or '', e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\trangeSelect: false, // Allows for selecting a date range on one date picker\r\n\t\trangeSeparator: ' - ' // Text between two dates in a range\r\n\t};\r\n\t$.extend(this._defaults, this.regional['']);\r\n\tthis._datepickerDiv = $('<div id=\"datepicker_div\">');\r\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false // True to show button panel, false to not show it\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false // True to size the input for the date format, false to leave as is\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false // True to size the input for the date format, false to leave as is\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false // True to show button panel, false to not show it\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\r\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\r\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\t// dateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\t\tthis._curInst = null; // The current instance in use\n\t\tthis._keyEvent = false; // If the last event was a key event\n\t\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\t\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\t\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\t\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\t\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\t\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\t\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\t\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\t\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\t\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\t\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\t\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\t\tthis.regional = []; // Available regional settings, indexed by language code\n\t\tthis.regional[\"\"] = { // Default regional settings\n\t\t\tcloseText: \"Done\", // Display text for close link\n\t\t\tprevText: \"Prev\", // Display text for previous month link\n\t\t\tnextText: \"Next\", // Display text for next month link\n\t\t\tcurrentText: \"Today\", // Display text for current month link\n\t\t\tmonthNames: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n\t\t\t\t\"July\", \"August\", \"September\", \"October\", \"November\", \"December\"], // Names of months for drop-down and formatting\n\t\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\t\tdayNamesMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"], // Column headings for days starting at Sunday\n\t\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t\t};\n\t\tthis._defaults = { // Global defaults for all the date picker instances\n\t\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\t\tshowOptions: {}, // Options for enhanced animations\n\t\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\t\tbuttonText: \"...\", // Text for trigger button\n\t\t\tbuttonImage: \"\", // URL for trigger button image\n\t\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\t\tduration: \"fast\", // Duration of display/closure\n\t\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\t\tonSelect: null, // Define a callback function when a date is selected\n\t\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\t\tstepMonths: 1, // Number of months to step back/forward\n\t\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\t\tdisabled: false // The initial disabled state\n\t\t};\n\t\t$.extend(this._defaults, this.regional[\"\"]);\n\t\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n\t}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis._weekOverClass = 'ui-datepicker-week-over'; // The name of the week hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tclearText: 'Clear', // Display text for clear link\n\t\tclearStatus: 'Erase the current date', // Status text for clear link\n\t\tcloseText: 'Close', // Display text for close link\n\t\tcloseStatus: 'Close without change', // Status text for close link\n\t\tprevText: '&#x3c;Prev', // Display text for previous month link\n\t\tprevStatus: 'Show the previous month', // Status text for previous month link\n\t\tprevBigText: '&#x3c;&#x3c;', // Display text for previous year link\n\t\tprevBigStatus: 'Show the previous year', // Status text for previous year link\n\t\tnextText: 'Next&#x3e;', // Display text for next month link\n\t\tnextStatus: 'Show the next month', // Status text for next month link\n\t\tnextBigText: '&#x3e;&#x3e;', // Display text for next year link\n\t\tnextBigStatus: 'Show the next year', // Status text for next year link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tcurrentStatus: 'Show the current month', // Status text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tmonthStatus: 'Show a different month', // Status text for selecting a month\n\t\tyearStatus: 'Show a different year', // Status text for selecting a year\n\t\tweekHeader: 'Wk', // Header for the week of the year column\n\t\tweekStatus: 'Week of the year', // Status text for the week of the year column\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdayStatus: 'Set DD as first week day', // Status text for the day of the week selection\n\t\tdateStatus: 'Select DD, M d', // Status text for the date selection\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tinitStatus: 'Select a date', // Initial Status text on opening\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\tcloseAtTop: true, // True to have the clear/close at the top,\n\t\t\t// false to have them at the bottom\n\t\tmandatory: false, // True to hide the Clear link, false to include it\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tshowBigPrevNext: false, // True to show big prev/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: true, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: true, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tchangeFirstDay: true, // True to click on day name to change, false to remain as set\n\t\thighlightWeek: false, // True to highlight the selected week\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tshowWeeks: false, // True to show week of the year, false to omit\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tshowStatus: false, // True to show status bar at bottom, false to not show it\n\t\tstatusForDate: this.dateStatus, // Function to provide status text for a date -\n\t\t\t// takes date and instance as parameters, returns display text\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\trangeSelect: false, // Allows for selecting a date range on one date picker\n\t\trangeSeparator: ' - ', // Text between two dates in a range\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true // The input is constrained by the current date format\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" style=\"display: none;\"></div>');\n}", "function Datepicker() {\n\t\tthis._curInst = null; // The current instance in use\n\t\tthis._keyEvent = false; // If the last event was a key event\n\t\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\t\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\t\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\t\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\t\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\t\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\t\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\t\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\t\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\t\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\t\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\t\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\t\tthis.regional = []; // Available regional settings, indexed by language code\n\t\tthis.regional[\"\"] = { // Default regional settings\n\t\t\tcloseText: \"Done\", // Display text for close link\n\t\t\tprevText: \"Prev\", // Display text for previous month link\n\t\t\tnextText: \"Next\", // Display text for next month link\n\t\t\tcurrentText: \"Today\", // Display text for current month link\n\t\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t\t};\n\t\tthis._defaults = { // Global defaults for all the date picker instances\n\t\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\t\tshowOptions: {}, // Options for enhanced animations\n\t\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t\t// +/-number for offset from today, null for today\n\t\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\t\tbuttonText: \"...\", // Text for trigger button\n\t\t\tbuttonImage: \"\", // URL for trigger button image\n\t\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t\t// if not applicable, false to just disable them\n\t\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t\t// takes a Date and returns the number of the week for it\n\t\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t\t// > this are in the previous century,\n\t\t\t\t// string value starting with \"+\" for current year + value\n\t\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\t\tduration: \"fast\", // Duration of display/closure\n\t\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t\t// returns a set of custom settings for the date picker\n\t\t\tonSelect: null, // Define a callback function when a date is selected\n\t\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\t\tstepMonths: 1, // Number of months to step back/forward\n\t\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\t\tdisabled: false // The initial disabled state\n\t\t};\n\t\t$.extend(this._defaults, this.regional[\"\"]);\n\t\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n\t}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[ \"\" ] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n\t\t\t\"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ], // For formatting\n\t\tdayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ], // For formatting\n\t\tdayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ], // For formatting\n\t\tdayNamesMin: [ \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\" ], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\", // Additional text to append to the year in the month headers,\n\t\tselectMonthLabel: \"Select month\", // Invisible label for month selector\n\t\tselectYearLabel: \"Select year\" // Invisible label for year selector\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tonUpdateDatepicker: null, // Define a callback function when the datepicker is updated\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend( this._defaults, this.regional[ \"\" ] );\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ] );\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover( $( \"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\" ) );\n}", "function Datepicker() {\r\n this._curInst = null; // The current instance in use\r\n this._keyEvent = false; // If the last event was a key event\r\n this._disabledInputs = []; // List of date picker inputs that have been disabled\r\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n this._inDialog = false; // True if showing within a \"dialog\", false if not\r\n this._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n this._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n this._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n this._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n this._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n this._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n this._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n this._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n this._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n this.regional = []; // Available regional settings, indexed by language code\r\n this.regional[\"\"] = { // Default regional settings\r\n closeText: \"Done\", // Display text for close link\r\n prevText: \"Prev\", // Display text for previous month link\r\n nextText: \"Next\", // Display text for next month link\r\n currentText: \"Today\", // Display text for current month link\r\n monthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n dayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n weekHeader: \"Wk\", // Column header for week of the year\r\n dateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n isRTL: false, // True if right-to-left language, false if left-to-right\r\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n yearSuffix: \"\" // Additional text to append to the year in the month headers\r\n };\r\n this._defaults = { // Global defaults for all the date picker instances\r\n showOn: \"focus\", // \"focus\" for popup on focus,\r\n // \"button\" for trigger button, or \"both\" for either\r\n showAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n showOptions: {}, // Options for enhanced animations\r\n defaultDate: null, // Used when field is blank: actual date,\r\n // +/-number for offset from today, null for today\r\n appendText: \"\", // Display text following the input box, e.g. showing the format\r\n buttonText: \"...\", // Text for trigger button\r\n buttonImage: \"\", // URL for trigger button image\r\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n hideIfNoPrevNext: false, // True to hide next/previous month links\r\n // if not applicable, false to just disable them\r\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n gotoCurrent: false, // True if today link goes back to current selection instead\r\n changeMonth: false, // True if month can be selected directly, false if only prev/next\r\n changeYear: false, // True if year can be selected directly, false if only prev/next\r\n yearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n // either relative to today's year (-nn:+nn), relative to currently displayed year\r\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n showOtherMonths: false, // True to show dates in other months, false to leave blank\r\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n showWeek: false, // True to show week of the year, false to not show it\r\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n // takes a Date and returns the number of the week for it\r\n shortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n // > this are in the previous century,\r\n // string value starting with \"+\" for current year + value\r\n minDate: null, // The earliest selectable date, or null for no limit\r\n maxDate: null, // The latest selectable date, or null for no limit\r\n duration: \"fast\", // Duration of display/closure\r\n beforeShowDay: null, // Function that takes a date and returns an array with\r\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n beforeShow: null, // Function that takes an input field and\r\n // returns a set of custom settings for the date picker\r\n onSelect: null, // Define a callback function when a date is selected\r\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n onClose: null, // Define a callback function when the datepicker is closed\r\n numberOfMonths: 1, // Number of months to show at a time\r\n showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n stepMonths: 1, // Number of months to step back/forward\r\n stepBigMonths: 12, // Number of months to step back/forward for the big links\r\n altField: \"\", // Selector for an alternate field to store selected dates into\r\n altFormat: \"\", // The date format to use for the alternate field\r\n constrainInput: true, // The input is constrained by the current date format\r\n showButtonPanel: false, // True to show button panel, false to not show it\r\n autoSize: false, // True to size the input for the date format, false to leave as is\r\n disabled: false // The initial disabled state\r\n };\r\n $.extend(this._defaults, this.regional[\"\"]);\r\n this.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n }", "function Datepicker() {\n this._curInst = null; // The current instance in use\n this._keyEvent = false; // If the last event was a key event\n this._disabledInputs = []; // List of date picker inputs that have been disabled\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\n this._inDialog = false; // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n this.regional = []; // Available regional settings, indexed by language code\n this.regional[ \"\" ] = { // Default regional settings\n closeText: \"Done\", // Display text for close link\n prevText: \"Prev\", // Display text for previous month link\n nextText: \"Next\", // Display text for next month link\n currentText: \"Today\", // Display text for current month link\n monthNames: [ \"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\" ], // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ], // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ], // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ], // For formatting\n dayNamesMin: [ \"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\" ], // Column headings for days starting at Sunday\n weekHeader: \"Wk\", // Column header for week of the year\n dateFormat: \"mm/dd/yy\", // See format options on parseDate\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false, // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\n yearSuffix: \"\" // Additional text to append to the year in the month headers\n };\n this._defaults = { // Global defaults for all the date picker instances\n showOn: \"focus\", // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\", // Name of jQuery animation for popup\n showOptions: {}, // Options for enhanced animations\n defaultDate: null, // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\", // Display text following the input box, e.g. showing the format\n buttonText: \"...\", // Text for trigger button\n buttonImage: \"\", // URL for trigger button image\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false, // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n gotoCurrent: false, // True if today link goes back to current selection instead\n changeMonth: false, // True if month can be selected directly, false if only prev/next\n changeYear: false, // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false, // True to show dates in other months, false to leave blank\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n showWeek: false, // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\", // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null, // The earliest selectable date, or null for no limit\n maxDate: null, // The latest selectable date, or null for no limit\n duration: \"fast\", // Duration of display/closure\n beforeShowDay: null, // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null, // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null, // Define a callback function when a date is selected\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\n onClose: null, // Define a callback function when the datepicker is closed\n numberOfMonths: 1, // Number of months to show at a time\n showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1, // Number of months to step back/forward\n stepBigMonths: 12, // Number of months to step back/forward for the big links\n altField: \"\", // Selector for an alternate field to store selected dates into\n altFormat: \"\", // The date format to use for the alternate field\n constrainInput: true, // The input is constrained by the current date format\n showButtonPanel: false, // True to show button panel, false to not show it\n autoSize: false, // True to size the input for the date format, false to leave as is\n disabled: false // The initial disabled state\n };\n $.extend( this._defaults, this.regional[ \"\" ] );\n this.regional.en = $.extend( true, {}, this.regional[ \"\" ] );\n this.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n this.dpDiv = datepicker_bindHover( $( \"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\" ) );\n}", "function Datepick() {\n this._uuid = new Date().getTime(); // Unique identifier seed\n this._curInst = null; // The current instance in use\n this._keyEvent = false; // If the last event was a key event\n this._disabledInputs = []; // List of date picker inputs that have been disabled\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\n this._inDialog = false; // True if showing within a \"dialog\", false if not\n this.regional = []; // Available regional settings, indexed by language code\n this.regional[''] = { // Default regional settings\n clearText: 'Clear', // Display text for clear link\n clearStatus: 'Erase the current date', // Status text for clear link\n closeText: 'Close', // Display text for close link\n closeStatus: 'Close without change', // Status text for close link\n prevText: '&laquo;Prev', // Display text for previous month link\n prevStatus: 'Show the previous month', // Status text for previous month link\n prevBigText: '&#x3c;&#x3c;', // Display text for previous year link\n prevBigStatus: 'Show the previous year', // Status text for previous year link\n nextText: 'Next&raquo;', // Display text for next month link\n nextStatus: 'Show the next month', // Status text for next month link\n nextBigText: '&#x3e;&#x3e;', // Display text for next year link\n nextBigStatus: 'Show the next year', // Status text for next year link\n currentText: 'Today', // Display text for current month link\n currentStatus: 'Show the current month', // Status text for current month link\n monthNames: ['January','February','March','April','May','June',\n 'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n monthStatus: 'Show a different month', // Status text for selecting a month\n yearStatus: 'Show a different year', // Status text for selecting a year\n weekHeader: 'Wk', // Header for the week of the year column\n weekStatus: 'Week of the year', // Status text for the week of the year column\n dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n dayStatus: 'Set DD as first week day', // Status text for the day of the week selection\n dateStatus: 'Select DD, M d', // Status text for the date selection\n dateFormat: 'mm/dd/yy', // See format options on parseDate\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n initStatus: 'Select a date', // Initial Status text on opening\n isRTL: false, // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\n yearSuffix: '' // Additional text to append to the year in the month headers\n };\n this._defaults = { // Global defaults for all the date picker instances\n showOn: 'focus', // 'focus' for popup on focus,\n // 'button' for trigger button, or 'both' for either\n showAnim: 'show', // Name of jQuery animation for popup\n showOptions: {}, // Options for enhanced animations\n duration: 'normal', // Duration of display/closure\n buttonText: '...', // Text for trigger button\n buttonImage: '', // URL for trigger button image\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n defaultDate: null, // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n showDefault: false, // True to populate field with the default date\n appendText: '', // Display text following the input box, e.g. showing the format\n closeAtTop: true, // True to have the clear/close at the top,\n // false to have them at the bottom\n mandatory: false, // True to hide the Clear link, false to include it\n hideIfNoPrevNext: false, // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n showBigPrevNext: false, // True to show big prev/next links\n stepMonths: 1, // Number of months to step back/forward\n stepBigMonths: 12, // Number of months to step back/forward for the big links\n gotoCurrent: false, // True if today link goes back to current selection instead\n changeMonth: true, // True if month can be selected directly, false if only prev/next\n changeYear: true, // True if year can be selected directly, false if only prev/next\n yearRange: '-10:+10', // Range of years to display in drop-down,\n // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n changeFirstDay: false, // True to click on day name to change, false to remain as set\n showOtherMonths: false, // True to show dates in other months, false to leave blank\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n highlightWeek: false, // True to highlight the selected week\n showWeeks: false, // True to show week of the year, false to omit\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: '+10', // Short year values < this are in the current century,\n // > this are in the previous century, string value starting with '+'\n // for current year + value, -1 for no change\n showStatus: false, // True to show status bar at bottom, false to not show it\n statusForDate: this.dateStatus, // Function to provide status text for a date -\n // takes date and instance as parameters, returns display text\n minDate: null, // The earliest selectable date, or null for no limit\n maxDate: null, // The latest selectable date, or null for no limit\n numberOfMonths: 1, // Number of months to show at a time\n showCurrentAtPos: 0, // The position in multiple months at which to show the current month (starting at 0)\n rangeSelect: false, // Allows for selecting a date range on one date picker\n rangeSeparator: ' - ', // Text between two dates in a range\n multiSelect: 0, // Maximum number of selectable dates\n multiSeparator: ',', // Text between multiple dates\n beforeShow: null, // Function that takes an input field and\n // returns a set of custom settings for the date picker\n beforeShowDay: null, // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n // [2] = cell title (optional), e.g. $.datepick.noWeekends\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\n onHover: null, // Define a callback function when hovering over a day\n onSelect: null, // Define a callback function when a date is selected\n onClose: null, // Define a callback function when the datepicker is closed\n altField: '', // Selector for an alternate field to store selected dates into\n altFormat: '', // The date format to use for the alternate field\n constrainInput: true // The input is constrained by the current date format\n };\n $.extend(this._defaults, this.regional['']);\n this.dpDiv = $('<div id=\"' + this._mainDivId + '\" style=\"display: none;\"></div>');\n}", "function Datepicker() {\n this._curInst = null;\n // The current instance in use\n this._keyEvent = false;\n // If the last event was a key event\n this._disabledInputs = [];\n // List of date picker inputs that have been disabled\n this._datepickerShowing = false;\n // True if the popup picker is showing , false if not\n this._inDialog = false;\n // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\";\n // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\";\n // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\";\n // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\";\n // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\";\n // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\";\n // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\";\n // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\";\n // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\";\n // The name of the day hover marker class\n this.regional = [];\n // Available regional settings, indexed by language code\n this.regional[\"\"] = {\n // Default regional settings\n closeText: \"Done\",\n // Display text for close link\n prevText: \"Prev\",\n // Display text for previous month link\n nextText: \"Next\",\n // Display text for next month link\n currentText: \"Today\",\n // Display text for current month link\n monthNames: [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ],\n // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ],\n // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ],\n // For formatting\n dayNamesMin: [ \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\" ],\n // Column headings for days starting at Sunday\n weekHeader: \"Wk\",\n // Column header for week of the year\n dateFormat: \"mm/dd/yy\",\n // See format options on parseDate\n firstDay: 0,\n // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false,\n // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false,\n // True if the year select precedes month, false for month then year\n yearSuffix: \"\"\n };\n this._defaults = {\n // Global defaults for all the date picker instances\n showOn: \"focus\",\n // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\",\n // Name of jQuery animation for popup\n showOptions: {},\n // Options for enhanced animations\n defaultDate: null,\n // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\",\n // Display text following the input box, e.g. showing the format\n buttonText: \"...\",\n // Text for trigger button\n buttonImage: \"\",\n // URL for trigger button image\n buttonImageOnly: false,\n // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false,\n // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false,\n // True if date formatting applied to prev/today/next links\n gotoCurrent: false,\n // True if today link goes back to current selection instead\n changeMonth: false,\n // True if month can be selected directly, false if only prev/next\n changeYear: false,\n // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\",\n // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false,\n // True to show dates in other months, false to leave blank\n selectOtherMonths: false,\n // True to allow selection of dates in other months, false for unselectable\n showWeek: false,\n // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week,\n // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\",\n // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null,\n // The earliest selectable date, or null for no limit\n maxDate: null,\n // The latest selectable date, or null for no limit\n duration: \"fast\",\n // Duration of display/closure\n beforeShowDay: null,\n // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null,\n // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null,\n // Define a callback function when a date is selected\n onChangeMonthYear: null,\n // Define a callback function when the month or year is changed\n onClose: null,\n // Define a callback function when the datepicker is closed\n numberOfMonths: 1,\n // Number of months to show at a time\n showCurrentAtPos: 0,\n // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1,\n // Number of months to step back/forward\n stepBigMonths: 12,\n // Number of months to step back/forward for the big links\n altField: \"\",\n // Selector for an alternate field to store selected dates into\n altFormat: \"\",\n // The date format to use for the alternate field\n constrainInput: true,\n // The input is constrained by the current date format\n showButtonPanel: false,\n // True to show button panel, false to not show it\n autoSize: false,\n // True to size the input for the date format, false to leave as is\n disabled: false\n };\n $.extend(this._defaults, this.regional[\"\"]);\n this.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n }", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function DatepickerInstance(settings, inline) {\r\n\tthis._id = $.datepicker._register(this);\r\n\tthis._selectedDay = 0; // Current date for selection\r\n\tthis._selectedMonth = 0; // 0-11\r\n\tthis._selectedYear = 0; // 4-digit year\r\n\tthis._drawMonth = 0; // Current month at start of datepicker\r\n\tthis._drawYear = 0;\r\n\tthis._input = null; // The attached input field\r\n\tthis._inline = inline; // True if showing inline, false if used in a popup\r\n\tthis._datepickerDiv = (!inline ? $.datepicker._datepickerDiv :\r\n\t\t$('<div id=\"datepicker_div_' + this._id + '\" class=\"datepicker_inline\">'));\r\n\t// customise the date picker object - uses manager defaults if not overridden\r\n\tthis._settings = extendRemove(settings || {}); // clone\r\n\tif (inline)\r\n\t\tthis._setDate(this._getDefaultDate());\r\n}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function DatePicker( picker, settings ) {\n\t\n\t var calendar = this,\n\t element = picker.$node[ 0 ],\n\t elementValue = element.value,\n\t elementDataValue = picker.$node.data( 'value' ),\n\t valueString = elementDataValue || elementValue,\n\t formatString = elementDataValue ? settings.formatSubmit : settings.format,\n\t isRTL = function() {\n\t\n\t return element.currentStyle ?\n\t\n\t // For IE.\n\t element.currentStyle.direction == 'rtl' :\n\t\n\t // For normal browsers.\n\t getComputedStyle( picker.$root[0] ).direction == 'rtl'\n\t }\n\t\n\t calendar.settings = settings\n\t calendar.$node = picker.$node\n\t\n\t // The queue of methods that will be used to build item objects.\n\t calendar.queue = {\n\t min: 'measure create',\n\t max: 'measure create',\n\t now: 'now create',\n\t select: 'parse create validate',\n\t highlight: 'parse navigate create validate',\n\t view: 'parse create validate viewset',\n\t disable: 'deactivate',\n\t enable: 'activate'\n\t }\n\t\n\t // The component's item object.\n\t calendar.item = {}\n\t\n\t calendar.item.clear = null\n\t calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n\t calendar.item.enable = -(function( collectionDisabled ) {\n\t return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n\t })( calendar.item.disable )\n\t\n\t calendar.\n\t set( 'min', settings.min ).\n\t set( 'max', settings.max ).\n\t set( 'now' )\n\t\n\t // When there’s a value, set the `select`, which in turn\n\t // also sets the `highlight` and `view`.\n\t if ( valueString ) {\n\t calendar.set( 'select', valueString, { format: formatString })\n\t }\n\t\n\t // If there’s no value, default to highlighting “today”.\n\t else {\n\t calendar.\n\t set( 'select', null ).\n\t set( 'highlight', calendar.item.now )\n\t }\n\t\n\t\n\t // The keycode to movement mapping.\n\t calendar.key = {\n\t 40: 7, // Down\n\t 38: -7, // Up\n\t 39: function() { return isRTL() ? -1 : 1 }, // Right\n\t 37: function() { return isRTL() ? 1 : -1 }, // Left\n\t go: function( timeChange ) {\n\t var highlightedObject = calendar.item.highlight,\n\t targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n\t calendar.set(\n\t 'highlight',\n\t targetDate,\n\t { interval: timeChange }\n\t )\n\t this.render()\n\t }\n\t }\n\t\n\t\n\t // Bind some picker events.\n\t picker.\n\t on( 'render', function() {\n\t picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n\t var value = this.value\n\t if ( value ) {\n\t picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n\t picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n\t }\n\t })\n\t picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n\t var value = this.value\n\t if ( value ) {\n\t picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n\t picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n\t }\n\t })\n\t }, 1 ).\n\t on( 'open', function() {\n\t var includeToday = ''\n\t if ( calendar.disabled( calendar.get('now') ) ) {\n\t includeToday = ':not(.' + settings.klass.buttonToday + ')'\n\t }\n\t picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n\t }, 1 ).\n\t on( 'close', function() {\n\t picker.$root.find( 'button, select' ).attr( 'disabled', true )\n\t }, 1 )\n\t\n\t}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n elementValue = picker.$node[ 0 ].value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format\n\n calendar.settings = settings\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'navigate create validate',\n view: 'create validate viewset',\n disable: 'flipItem',\n enable: 'flipItem'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' ).\n\n // Setting the `select` also sets the `highlight` and `view`.\n set( 'select',\n\n // Use the value provided or default to selecting “today”.\n valueString || calendar.item.now,\n {\n // Use the appropriate format.\n format: formatString,\n\n // Set user-provided month data as true when there is a\n // “mm” or “m” used in the relative format string.\n data: (function( formatArray ) {\n return valueString && ( formatArray.indexOf( 'mm' ) > -1 || formatArray.indexOf( 'm' ) > -1 )\n })( calendar.formats.toArray( formatString ) )\n }\n )\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: 1, // Right\n 37: -1, // Left\n go: function( timeChange ) {\n calendar.set( 'highlight', [ calendar.item.highlight.year, calendar.item.highlight.month, calendar.item.highlight.date + timeChange ], { interval: timeChange } )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n picker.set( 'highlight', [ picker.get( 'view' ).year, this.value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).focus()\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n picker.set( 'highlight', [ this.value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).focus()\n })\n }).\n on( 'open', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', false )\n }).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n })\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n elementValue = picker.$node[ 0 ].value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format\n\n calendar.settings = settings\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'navigate create validate',\n view: 'create validate viewset',\n disable: 'flipItem',\n enable: 'flipItem'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' ).\n\n // Setting the `select` also sets the `highlight` and `view`.\n set( 'select',\n\n // Use the value provided or default to selecting “today”.\n valueString || calendar.item.now,\n {\n // Use the appropriate format.\n format: formatString,\n\n // Set user-provided month data as true when there is a\n // “mm” or “m” used in the relative format string.\n data: (function( formatArray ) {\n return valueString && ( formatArray.indexOf( 'mm' ) > -1 || formatArray.indexOf( 'm' ) > -1 )\n })( calendar.formats.toArray( formatString ) )\n }\n )\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: 1, // Right\n 37: -1, // Left\n go: function( timeChange ) {\n calendar.set( 'highlight', [ calendar.item.highlight.year, calendar.item.highlight.month, calendar.item.highlight.date + timeChange ], { interval: timeChange } )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n picker.set( 'highlight', [ picker.get( 'view' ).year, this.value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).focus()\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n picker.set( 'highlight', [ this.value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).focus()\n })\n }).\n on( 'open', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', false )\n }).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n })\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, { format: formatString })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, { format: formatString })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, { format: formatString })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, { format: formatString })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, {\n format: formatString,\n defaultValue: true\n })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, {\n format: formatString,\n defaultValue: true\n })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker( picker, settings ) {\n\n var calendar = this,\n element = picker.$node[ 0 ],\n elementValue = element.value,\n elementDataValue = picker.$node.data( 'value' ),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function() {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle( picker.$root[0] ).direction == 'rtl'\n }\n\n calendar.settings = settings\n calendar.$node = picker.$node\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n }\n\n // The component's item object.\n calendar.item = {}\n\n calendar.item.clear = null\n calendar.item.disable = ( settings.disable || [] ).slice( 0 )\n calendar.item.enable = -(function( collectionDisabled ) {\n return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1\n })( calendar.item.disable )\n\n calendar.\n set( 'min', settings.min ).\n set( 'max', settings.max ).\n set( 'now' )\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if ( valueString ) {\n calendar.set( 'select', valueString, {\n format: formatString,\n defaultValue: true\n })\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.\n set( 'select', null ).\n set( 'highlight', calendar.item.now )\n }\n\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function() { return isRTL() ? -1 : 1 }, // Right\n 37: function() { return isRTL() ? 1 : -1 }, // Left\n go: function( timeChange ) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )\n calendar.set(\n 'highlight',\n targetDate,\n { interval: timeChange }\n )\n this.render()\n }\n }\n\n\n // Bind some picker events.\n picker.\n on( 'render', function() {\n picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )\n }\n })\n picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {\n var value = this.value\n if ( value ) {\n picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )\n picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )\n }\n })\n }, 1 ).\n on( 'open', function() {\n var includeToday = ''\n if ( calendar.disabled( calendar.get('now') ) ) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')'\n }\n picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )\n }, 1 ).\n on( 'close', function() {\n picker.$root.find( 'button, select' ).attr( 'disabled', true )\n }, 1 )\n\n}", "function DatePicker(picker, settings) {\n\n var calendar = this,\n element = picker.$node[0],\n elementValue = element.value,\n elementDataValue = picker.$node.data('value'),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function () {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle(picker.$root[0]).direction == 'rtl';\n };\n\n calendar.settings = settings;\n calendar.$node = picker.$node;\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n\n // The component's item object.\n };calendar.item = {};\n\n calendar.item.clear = null;\n calendar.item.disable = (settings.disable || []).slice(0);\n calendar.item.enable = -function (collectionDisabled) {\n return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;\n }(calendar.item.disable);\n\n calendar.set('min', settings.min).set('max', settings.max).set('now');\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if (valueString) {\n calendar.set('select', valueString, { format: formatString });\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.set('select', null).set('highlight', calendar.item.now);\n }\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function () {\n return isRTL() ? -1 : 1;\n }, // Right\n 37: function () {\n return isRTL() ? 1 : -1;\n }, // Left\n go: function (timeChange) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);\n calendar.set('highlight', targetDate, { interval: timeChange });\n this.render();\n }\n\n // Bind some picker events.\n };picker.on('render', function () {\n picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');\n }\n });\n picker.$root.find('.' + settings.klass.selectYear).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectYear).trigger('focus');\n }\n });\n }, 1).on('open', function () {\n var includeToday = '';\n if (calendar.disabled(calendar.get('now'))) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')';\n }\n picker.$root.find('button' + includeToday + ', select').attr('disabled', false);\n }, 1).on('close', function () {\n picker.$root.find('button, select').attr('disabled', true);\n }, 1);\n }", "function DatePicker(picker, settings) {\n\n var calendar = this,\n element = picker.$node[0],\n elementValue = element.value,\n elementDataValue = picker.$node.data('value'),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function () {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle(picker.$root[0]).direction == 'rtl';\n };\n\n calendar.settings = settings;\n calendar.$node = picker.$node;\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n\n // The component's item object.\n };calendar.item = {};\n\n calendar.item.clear = null;\n calendar.item.disable = (settings.disable || []).slice(0);\n calendar.item.enable = -function (collectionDisabled) {\n return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;\n }(calendar.item.disable);\n\n calendar.set('min', settings.min).set('max', settings.max).set('now');\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if (valueString) {\n calendar.set('select', valueString, { format: formatString });\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.set('select', null).set('highlight', calendar.item.now);\n }\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function () {\n return isRTL() ? -1 : 1;\n }, // Right\n 37: function () {\n return isRTL() ? 1 : -1;\n }, // Left\n go: function (timeChange) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);\n calendar.set('highlight', targetDate, { interval: timeChange });\n this.render();\n }\n\n // Bind some picker events.\n };picker.on('render', function () {\n picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');\n }\n });\n picker.$root.find('.' + settings.klass.selectYear).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectYear).trigger('focus');\n }\n });\n }, 1).on('open', function () {\n var includeToday = '';\n if (calendar.disabled(calendar.get('now'))) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')';\n }\n picker.$root.find('button' + includeToday + ', select').attr('disabled', false);\n }, 1).on('close', function () {\n picker.$root.find('button, select').attr('disabled', true);\n }, 1);\n }", "function DatePicker(picker, settings) {\n\n var calendar = this,\n element = picker.$node[0],\n elementValue = element.value,\n elementDataValue = picker.$node.data('value'),\n valueString = elementDataValue || elementValue,\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\n isRTL = function () {\n\n return element.currentStyle ?\n\n // For IE.\n element.currentStyle.direction == 'rtl' :\n\n // For normal browsers.\n getComputedStyle(picker.$root[0]).direction == 'rtl';\n };\n\n calendar.settings = settings;\n calendar.$node = picker.$node;\n\n // The queue of methods that will be used to build item objects.\n calendar.queue = {\n min: 'measure create',\n max: 'measure create',\n now: 'now create',\n select: 'parse create validate',\n highlight: 'parse navigate create validate',\n view: 'parse create validate viewset',\n disable: 'deactivate',\n enable: 'activate'\n\n // The component's item object.\n };calendar.item = {};\n\n calendar.item.clear = null;\n calendar.item.disable = (settings.disable || []).slice(0);\n calendar.item.enable = -function (collectionDisabled) {\n return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;\n }(calendar.item.disable);\n\n calendar.set('min', settings.min).set('max', settings.max).set('now');\n\n // When there’s a value, set the `select`, which in turn\n // also sets the `highlight` and `view`.\n if (valueString) {\n calendar.set('select', valueString, { format: formatString });\n }\n\n // If there’s no value, default to highlighting “today”.\n else {\n calendar.set('select', null).set('highlight', calendar.item.now);\n }\n\n // The keycode to movement mapping.\n calendar.key = {\n 40: 7, // Down\n 38: -7, // Up\n 39: function () {\n return isRTL() ? -1 : 1;\n }, // Right\n 37: function () {\n return isRTL() ? 1 : -1;\n }, // Left\n go: function (timeChange) {\n var highlightedObject = calendar.item.highlight,\n targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);\n calendar.set('highlight', targetDate, { interval: timeChange });\n this.render();\n }\n\n // Bind some picker events.\n };picker.on('render', function () {\n picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');\n }\n });\n picker.$root.find('.' + settings.klass.selectYear).on('change', function () {\n var value = this.value;\n if (value) {\n picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);\n picker.$root.find('.' + settings.klass.selectYear).trigger('focus');\n }\n });\n }, 1).on('open', function () {\n var includeToday = '';\n if (calendar.disabled(calendar.get('now'))) {\n includeToday = ':not(.' + settings.klass.buttonToday + ')';\n }\n picker.$root.find('button' + includeToday + ', select').attr('disabled', false);\n }, 1).on('close', function () {\n picker.$root.find('button, select').attr('disabled', true);\n }, 1);\n }", "function DatePicker(picker, settings) {\r\n\r\n var calendar = this,\r\n element = picker.$node[0],\r\n elementValue = element.value,\r\n elementDataValue = picker.$node.data('value'),\r\n valueString = elementDataValue || elementValue,\r\n formatString = elementDataValue ? settings.formatSubmit : settings.format,\r\n isRTL = function () {\r\n\r\n return element.currentStyle ?\r\n\r\n // For IE.\r\n element.currentStyle.direction == 'rtl' :\r\n\r\n // For normal browsers.\r\n getComputedStyle(picker.$root[0]).direction == 'rtl';\r\n };\r\n\r\n calendar.settings = settings;\r\n calendar.$node = picker.$node;\r\n\r\n // The queue of methods that will be used to build item objects.\r\n calendar.queue = {\r\n min: 'measure create',\r\n max: 'measure create',\r\n now: 'now create',\r\n select: 'parse create validate',\r\n highlight: 'parse navigate create validate',\r\n view: 'parse create validate viewset',\r\n disable: 'deactivate',\r\n enable: 'activate'\r\n\r\n // The component's item object.\r\n };calendar.item = {};\r\n\r\n calendar.item.clear = null;\r\n calendar.item.disable = (settings.disable || []).slice(0);\r\n calendar.item.enable = -function (collectionDisabled) {\r\n return collectionDisabled[0] === true ? collectionDisabled.shift() : -1;\r\n }(calendar.item.disable);\r\n\r\n calendar.set('min', settings.min).set('max', settings.max).set('now');\r\n\r\n // When there’s a value, set the `select`, which in turn\r\n // also sets the `highlight` and `view`.\r\n if (valueString) {\r\n calendar.set('select', valueString, { format: formatString });\r\n }\r\n\r\n // If there’s no value, default to highlighting “today”.\r\n else {\r\n calendar.set('select', null).set('highlight', calendar.item.now);\r\n }\r\n\r\n // The keycode to movement mapping.\r\n calendar.key = {\r\n 40: 7, // Down\r\n 38: -7, // Up\r\n 39: function () {\r\n return isRTL() ? -1 : 1;\r\n }, // Right\r\n 37: function () {\r\n return isRTL() ? 1 : -1;\r\n }, // Left\r\n go: function (timeChange) {\r\n var highlightedObject = calendar.item.highlight,\r\n targetDate = new Date(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange);\r\n calendar.set('highlight', targetDate, { interval: timeChange });\r\n this.render();\r\n }\r\n\r\n // Bind some picker events.\r\n };picker.on('render', function () {\r\n picker.$root.find('.' + settings.klass.selectMonth).on('change', function () {\r\n var value = this.value;\r\n if (value) {\r\n picker.set('highlight', [picker.get('view').year, value, picker.get('highlight').date]);\r\n picker.$root.find('.' + settings.klass.selectMonth).trigger('focus');\r\n }\r\n });\r\n picker.$root.find('.' + settings.klass.selectYear).on('change', function () {\r\n var value = this.value;\r\n if (value) {\r\n picker.set('highlight', [value, picker.get('view').month, picker.get('highlight').date]);\r\n picker.$root.find('.' + settings.klass.selectYear).trigger('focus');\r\n }\r\n });\r\n }, 1).on('open', function () {\r\n var includeToday = '';\r\n if (calendar.disabled(calendar.get('now'))) {\r\n includeToday = ':not(.' + settings.klass.buttonToday + ')';\r\n }\r\n picker.$root.find('button' + includeToday + ', select').attr('disabled', false);\r\n }, 1).on('close', function () {\r\n picker.$root.find('button, select').attr('disabled', true);\r\n }, 1);\r\n }", "function Datepicker() {}", "function Datepicker() {}" ]
[ "0.74273753", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.71955395", "0.71955395", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7180211", "0.7178158", "0.7176107", "0.7174543", "0.7137909", "0.7119532", "0.7031682", "0.7028496", "0.69912237", "0.69912237", "0.69256437", "0.6916388", "0.6916388", "0.6916388", "0.66997784", "0.65818393", "0.65818393", "0.6564699", "0.6564699", "0.6564699", "0.6564699", "0.6564531", "0.6564531", "0.6564531", "0.6491519", "0.6491519", "0.6491519", "0.64759594", "0.644462", "0.644462" ]
0.7161838
74
Bind hover events for datepicker elements. Done via delegate so the binding only occurs once in the lifetime of the parent div. Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
function datepicker_bindHover( dpDiv ) { var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; return dpDiv.on( "mouseout", selector, function() { $( this ).removeClass( "ui-state-hover" ); if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-prev-hover" ); } if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-next-hover" ); } } ) .on( "mouseover", selector, datepicker_handleMouseover ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.delegate(selector,\"mouseout\",function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\") !== -1){$(this).removeClass(\"ui-datepicker-prev-hover\");}if(this.className.indexOf(\"ui-datepicker-next\") !== -1){$(this).removeClass(\"ui-datepicker-next-hover\");}}).delegate(selector,\"mouseover\",datepicker_handleMouseover);}", "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.on(\"mouseout\",selector,function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\") !== -1){$(this).removeClass(\"ui-datepicker-prev-hover\");}if(this.className.indexOf(\"ui-datepicker-next\") !== -1){$(this).removeClass(\"ui-datepicker-next-hover\");}}).on(\"mouseover\",selector,datepicker_handleMouseover);}", "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.on(\"mouseout\",selector,function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\")!==-1){$(this).removeClass(\"ui-datepicker-prev-hover\");}if(this.className.indexOf(\"ui-datepicker-next\")!==-1){$(this).removeClass(\"ui-datepicker-next-hover\");}}).on(\"mouseover\",selector,datepicker_handleMouseover);}", "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.on(\"mouseout\",selector,function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\")!==-1){$(this).removeClass(\"ui-datepicker-prev-hover\");}if(this.className.indexOf(\"ui-datepicker-next\")!==-1){$(this).removeClass(\"ui-datepicker-next-hover\");}}).on(\"mouseover\",selector,datepicker_handleMouseover);}", "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.on(\"mouseout\",selector,function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\")!==-1){$(this).removeClass(\"ui-datepicker-prev-hover\");}if(this.className.indexOf(\"ui-datepicker-next\")!==-1){$(this).removeClass(\"ui-datepicker-next-hover\");}}).on(\"mouseover\",selector,datepicker_handleMouseover);}", "function datepicker_bindHover( dpDiv ) {\n var selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n return dpDiv.on( \"mouseout\", selector, function() {\n $( this ).removeClass( \"ui-state-hover\" );\n if ( this.className.indexOf( \"ui-datepicker-prev\" ) !== -1 ) {\n $( this ).removeClass( \"ui-datepicker-prev-hover\" );\n }\n if ( this.className.indexOf( \"ui-datepicker-next\" ) !== -1 ) {\n $( this ).removeClass( \"ui-datepicker-next-hover\" );\n }\n } )\n .on( \"mouseover\", selector, datepicker_handleMouseover );\n}", "function bindHover(dpDiv) {\r\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\r\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\r\n\t\t\t$(this).removeClass(\"ui-state-hover\");\r\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\r\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\r\n\t\t\t}\r\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\r\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\r\n\t\t\t}\r\n\t\t})\r\n\t\t.delegate(selector, \"mouseover\", function(){\r\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\r\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\r\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\r\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\r\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\r\n\t\t\t\t}\r\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\r\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n}", "function datepicker_bindHover(dpDiv) {\r\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\r\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\r\n\t\t\t$(this).removeClass(\"ui-state-hover\");\r\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\r\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\r\n\t\t\t}\r\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\r\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\r\n\t\t\t}\r\n\t\t})\r\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\r\n}", "function datepicker_bindHover( dpDiv ) {\r\n var selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\r\n return dpDiv.on( \"mouseout\", selector, function() {\r\n $( this ).removeClass( \"ui-state-hover\" );\r\n if ( this.className.indexOf( \"ui-datepicker-prev\" ) !== -1 ) {\r\n $( this ).removeClass( \"ui-datepicker-prev-hover\" );\r\n }\r\n if ( this.className.indexOf( \"ui-datepicker-next\" ) !== -1 ) {\r\n $( this ).removeClass( \"ui-datepicker-next-hover\" );\r\n }\r\n } )\r\n .on( \"mouseover\", selector, datepicker_handleMouseover );\r\n }", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function datepicker_bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate( selector, \"mouseover\", datepicker_handleMouseover );\n}", "function bindHover(dpDiv) {\n var selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n return dpDiv.delegate(selector, \"mouseout\", function() {\n $(this).removeClass(\"ui-state-hover\");\n if (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n $(this).removeClass(\"ui-datepicker-prev-hover\");\n }\n if (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n $(this).removeClass(\"ui-datepicker-next-hover\");\n }\n }).delegate(selector, \"mouseover\", function() {\n if (!$.datepicker._isDisabledDatepicker(instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n $(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n $(this).addClass(\"ui-state-hover\");\n if (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n $(this).addClass(\"ui-datepicker-prev-hover\");\n }\n if (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n $(this).addClass(\"ui-datepicker-next-hover\");\n }\n }\n });\n }", "function bindHover(dpDiv) {\r\n var selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\r\n return dpDiv.delegate(selector, \"mouseout\", function() {\r\n $(this).removeClass(\"ui-state-hover\");\r\n if (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\r\n $(this).removeClass(\"ui-datepicker-prev-hover\");\r\n }\r\n if (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\r\n $(this).removeClass(\"ui-datepicker-next-hover\");\r\n }\r\n })\r\n .delegate(selector, \"mouseover\", function(){\r\n if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\r\n $(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\r\n $(this).addClass(\"ui-state-hover\");\r\n if (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\r\n $(this).addClass(\"ui-datepicker-prev-hover\");\r\n }\r\n if (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\r\n $(this).addClass(\"ui-datepicker-next-hover\");\r\n }\r\n }\r\n });\r\n }", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.delegate(selector, 'mouseout', function() {\n\t\t\t$(this).removeClass('ui-state-hover');\n\t\t\tif (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');\n\t\t\tif (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');\n\t\t})\n\t\t.delegate(selector, 'mouseover', function(){\n\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\t\t$(this).addClass('ui-state-hover');\n\t\t\t\tif (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');\n\t\t\t\tif (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');\n\t\t\t}\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.bind('mouseout', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ( !elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.removeClass( \"ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover\" );\n\t\t})\n\t\t.bind('mouseover', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||\n\t\t\t\t\t!elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\telem.addClass('ui-state-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.bind('mouseout', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ( !elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.removeClass( \"ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover\" );\n\t\t})\n\t\t.bind('mouseover', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||\n\t\t\t\t\t!elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\telem.addClass('ui-state-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.bind('mouseout', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ( !elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.removeClass( \"ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover\" );\n\t\t})\n\t\t.bind('mouseover', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||\n\t\t\t\t\t!elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\telem.addClass('ui-state-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');\n\t\t});\n}", "function bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.bind('mouseout', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ( !elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.removeClass( \"ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover\" );\n\t\t})\n\t\t.bind('mouseover', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||\n\t\t\t\t\t!elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\telem.addClass('ui-state-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');\n\t\t});\n}", "function bindHover(dpDiv) {\n\t\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\t\treturn dpDiv.delegate(selector, \"mouseout\", function() {\n\t\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t}\n\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t\t}\n\t\t\t})\n\t\t\t.delegate(selector, \"mouseover\", function(){\n\t\t\t\tif (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t\t}\n\t\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}", "function bindHover(dpDiv) {\n var selector =\n '.oj-datepicker-prev-icon, .oj-datepicker-prev-icon' +\n ' .oj-clickable-icon-nocontext.oj-component-icon, .oj-datepicker-next-icon,' +\n ' .oj-datepicker-next-icon .oj-clickable-icon-nocontext.oj-component-icon,' +\n ' .oj-datepicker-calendar td a';\n return dpDiv\n .delegate(selector, 'mouseout', function () {\n this.classList.remove('oj-hover');\n })\n .delegate(selector, 'mouseover', function () {\n this.classList.add('oj-hover');\n })\n .delegate(selector, 'focus', function () {\n this.classList.add('oj-focus');\n })\n .delegate(selector, 'blur', function () {\n this.classList.remove('oj-focus');\n });\n }", "function bindHover(dpDiv) {\n\t\tvar selector = \"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";\n\t\treturn dpDiv.delegate(selector, \"mouseout\", function () {\n\t\t\t$(this).removeClass(\"ui-state-hover\");\n\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-prev-hover\");\n\t\t\t}\n\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t$(this).removeClass(\"ui-datepicker-next-hover\");\n\t\t\t}\n\t\t})\n\t\t\t.delegate(selector, \"mouseover\", function () {\n\t\t\t\tif (!$.datepicker._isDisabledDatepicker(instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {\n\t\t\t\t\t$(this).parents(\".ui-datepicker-calendar\").find(\"a\").removeClass(\"ui-state-hover\");\n\t\t\t\t\t$(this).addClass(\"ui-state-hover\");\n\t\t\t\t\tif (this.className.indexOf(\"ui-datepicker-prev\") !== -1) {\n\t\t\t\t\t\t$(this).addClass(\"ui-datepicker-prev-hover\");\n\t\t\t\t\t}\n\t\t\t\t\tif (this.className.indexOf(\"ui-datepicker-next\") !== -1) {\n\t\t\t\t\t\t$(this).addClass(\"ui-datepicker-next-hover\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis._weekOverClass = 'ui-datepicker-week-over'; // The name of the week hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tclearText: 'Clear', // Display text for clear link\n\t\tclearStatus: 'Erase the current date', // Status text for clear link\n\t\tcloseText: 'Close', // Display text for close link\n\t\tcloseStatus: 'Close without change', // Status text for close link\n\t\tprevText: '&#x3c;Prev', // Display text for previous month link\n\t\tprevStatus: 'Show the previous month', // Status text for previous month link\n\t\tprevBigText: '&#x3c;&#x3c;', // Display text for previous year link\n\t\tprevBigStatus: 'Show the previous year', // Status text for previous year link\n\t\tnextText: 'Next&#x3e;', // Display text for next month link\n\t\tnextStatus: 'Show the next month', // Status text for next month link\n\t\tnextBigText: '&#x3e;&#x3e;', // Display text for next year link\n\t\tnextBigStatus: 'Show the next year', // Status text for next year link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tcurrentStatus: 'Show the current month', // Status text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tmonthStatus: 'Show a different month', // Status text for selecting a month\n\t\tyearStatus: 'Show a different year', // Status text for selecting a year\n\t\tweekHeader: 'Wk', // Header for the week of the year column\n\t\tweekStatus: 'Week of the year', // Status text for the week of the year column\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdayStatus: 'Set DD as first week day', // Status text for the day of the week selection\n\t\tdateStatus: 'Select DD, M d', // Status text for the date selection\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tinitStatus: 'Select a date', // Initial Status text on opening\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\tcloseAtTop: true, // True to have the clear/close at the top,\n\t\t\t// false to have them at the bottom\n\t\tmandatory: false, // True to hide the Clear link, false to include it\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tshowBigPrevNext: false, // True to show big prev/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: true, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: true, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tchangeFirstDay: true, // True to click on day name to change, false to remain as set\n\t\thighlightWeek: false, // True to highlight the selected week\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tshowWeeks: false, // True to show week of the year, false to omit\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tshowStatus: false, // True to show status bar at bottom, false to not show it\n\t\tstatusForDate: this.dateStatus, // Function to provide status text for a date -\n\t\t\t// takes date and instance as parameters, returns display text\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\trangeSelect: false, // Allows for selecting a date range on one date picker\n\t\trangeSeparator: ' - ', // Text between two dates in a range\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true // The input is constrained by the current date format\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" style=\"display: none;\"></div>');\n}", "function Datepicker() {\n this._curInst = null; // The current instance in use\n this._keyEvent = false; // If the last event was a key event\n this._disabledInputs = []; // List of date picker inputs that have been disabled\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\n this._inDialog = false; // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n this.regional = []; // Available regional settings, indexed by language code\n this.regional[ \"\" ] = { // Default regional settings\n closeText: \"Done\", // Display text for close link\n prevText: \"Prev\", // Display text for previous month link\n nextText: \"Next\", // Display text for next month link\n currentText: \"Today\", // Display text for current month link\n monthNames: [ \"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\" ], // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ], // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ], // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ], // For formatting\n dayNamesMin: [ \"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\" ], // Column headings for days starting at Sunday\n weekHeader: \"Wk\", // Column header for week of the year\n dateFormat: \"mm/dd/yy\", // See format options on parseDate\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false, // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\n yearSuffix: \"\" // Additional text to append to the year in the month headers\n };\n this._defaults = { // Global defaults for all the date picker instances\n showOn: \"focus\", // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\", // Name of jQuery animation for popup\n showOptions: {}, // Options for enhanced animations\n defaultDate: null, // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\", // Display text following the input box, e.g. showing the format\n buttonText: \"...\", // Text for trigger button\n buttonImage: \"\", // URL for trigger button image\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false, // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n gotoCurrent: false, // True if today link goes back to current selection instead\n changeMonth: false, // True if month can be selected directly, false if only prev/next\n changeYear: false, // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false, // True to show dates in other months, false to leave blank\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n showWeek: false, // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\", // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null, // The earliest selectable date, or null for no limit\n maxDate: null, // The latest selectable date, or null for no limit\n duration: \"fast\", // Duration of display/closure\n beforeShowDay: null, // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null, // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null, // Define a callback function when a date is selected\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\n onClose: null, // Define a callback function when the datepicker is closed\n numberOfMonths: 1, // Number of months to show at a time\n showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1, // Number of months to step back/forward\n stepBigMonths: 12, // Number of months to step back/forward for the big links\n altField: \"\", // Selector for an alternate field to store selected dates into\n altFormat: \"\", // The date format to use for the alternate field\n constrainInput: true, // The input is constrained by the current date format\n showButtonPanel: false, // True to show button panel, false to not show it\n autoSize: false, // True to size the input for the date format, false to leave as is\n disabled: false // The initial disabled state\n };\n $.extend( this._defaults, this.regional[ \"\" ] );\n this.regional.en = $.extend( true, {}, this.regional[ \"\" ] );\n this.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n this.dpDiv = datepicker_bindHover( $( \"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\" ) );\n}", "function Datepicker() {\n this._curInst = null;\n // The current instance in use\n this._keyEvent = false;\n // If the last event was a key event\n this._disabledInputs = [];\n // List of date picker inputs that have been disabled\n this._datepickerShowing = false;\n // True if the popup picker is showing , false if not\n this._inDialog = false;\n // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\";\n // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\";\n // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\";\n // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\";\n // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\";\n // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\";\n // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\";\n // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\";\n // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\";\n // The name of the day hover marker class\n this.regional = [];\n // Available regional settings, indexed by language code\n this.regional[\"\"] = {\n // Default regional settings\n closeText: \"Done\",\n // Display text for close link\n prevText: \"Prev\",\n // Display text for previous month link\n nextText: \"Next\",\n // Display text for next month link\n currentText: \"Today\",\n // Display text for current month link\n monthNames: [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ],\n // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ],\n // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ],\n // For formatting\n dayNamesMin: [ \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\" ],\n // Column headings for days starting at Sunday\n weekHeader: \"Wk\",\n // Column header for week of the year\n dateFormat: \"mm/dd/yy\",\n // See format options on parseDate\n firstDay: 0,\n // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false,\n // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false,\n // True if the year select precedes month, false for month then year\n yearSuffix: \"\"\n };\n this._defaults = {\n // Global defaults for all the date picker instances\n showOn: \"focus\",\n // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\",\n // Name of jQuery animation for popup\n showOptions: {},\n // Options for enhanced animations\n defaultDate: null,\n // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\",\n // Display text following the input box, e.g. showing the format\n buttonText: \"...\",\n // Text for trigger button\n buttonImage: \"\",\n // URL for trigger button image\n buttonImageOnly: false,\n // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false,\n // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false,\n // True if date formatting applied to prev/today/next links\n gotoCurrent: false,\n // True if today link goes back to current selection instead\n changeMonth: false,\n // True if month can be selected directly, false if only prev/next\n changeYear: false,\n // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\",\n // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false,\n // True to show dates in other months, false to leave blank\n selectOtherMonths: false,\n // True to allow selection of dates in other months, false for unselectable\n showWeek: false,\n // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week,\n // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\",\n // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null,\n // The earliest selectable date, or null for no limit\n maxDate: null,\n // The latest selectable date, or null for no limit\n duration: \"fast\",\n // Duration of display/closure\n beforeShowDay: null,\n // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null,\n // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null,\n // Define a callback function when a date is selected\n onChangeMonthYear: null,\n // Define a callback function when the month or year is changed\n onClose: null,\n // Define a callback function when the datepicker is closed\n numberOfMonths: 1,\n // Number of months to show at a time\n showCurrentAtPos: 0,\n // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1,\n // Number of months to step back/forward\n stepBigMonths: 12,\n // Number of months to step back/forward for the big links\n altField: \"\",\n // Selector for an alternate field to store selected dates into\n altFormat: \"\",\n // The date format to use for the alternate field\n constrainInput: true,\n // The input is constrained by the current date format\n showButtonPanel: false,\n // True to show button panel, false to not show it\n autoSize: false,\n // True to size the input for the date format, false to leave as is\n disabled: false\n };\n $.extend(this._defaults, this.regional[\"\"]);\n this.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n }", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\r\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\r\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false // True to show button panel, false to not show it\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false // True to size the input for the date format, false to leave as is\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false // True to size the input for the date format, false to leave as is\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'normal', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false // True to show button panel, false to not show it\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = $('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible\"></div>');\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}" ]
[ "0.7934868", "0.7904358", "0.79031956", "0.79031956", "0.79031956", "0.7886937", "0.787541", "0.7867152", "0.7743114", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.76798844", "0.7673795", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.76553017", "0.7648513", "0.7580805", "0.7580805", "0.7580805", "0.7580805", "0.75112647", "0.7509071", "0.75076455", "0.6079413", "0.6079413", "0.6079413", "0.6055702", "0.6055702", "0.5945658", "0.5921705", "0.5921703", "0.59078306", "0.59078306", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5885435", "0.5839247", "0.5839247", "0.5839247" ]
0.77573276
21
jQuery extend now ignores nulls!
function datepicker_extendRemove( target, props ) { $.extend( target, props ); for ( var name in props ) { if ( props[ name ] == null ) { target[ name ] = props[ name ]; } } return target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jQueryExtend() {\n var options, name, src, copy, copyIsArray, clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false;\n\n // Handle a deep copy situation\n if ( typeof target === \"boolean\" ) {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if ( typeof target !== \"object\" && GetType(target) != 'function') {\n target = {};\n }\n\n // extend jQuery itself if only one argument is passed\n if ( length === i ) {\n target = this;\n --i;\n }\n\n for ( ; i < length; i++ ) {\n // Only deal with non-null/undefined values\n if ( (options = arguments[ i ]) != null ) {\n // Extend the base object\n for ( name in options ) {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target === copy ) {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n if ( copyIsArray ) {\n copyIsArray = false;\n clone = src && jQuery.isArray(src) ? src : [];\n } else {\n clone = src && jQuery.isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = jQuery.extend( deep, clone, copy );\n\n // Don't bring in undefined values\n } else if ( copy !== undefined ) {\n target[ name ] = copy;\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n }", "function _extend()\n {\n // copy reference to target object\n var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray;\n\n // Handle a deep copy situation\n if ( typeof target === \"boolean\" ) \n {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if ( typeof target !== \"object\" && !_isFunction(target)) \n {\n target = {};\n }\n\n // extend jQuery itself if only one argument is passed\n if ( length === i ) \n {\n target = MCR;\n --i;\n }\n\n for ( ; i < length; i++ ) \n {\n // Only deal with non-null/undefined values\n if ( (options = arguments[i]) != null ) \n {\n // Extend the base object\n for ( name in options ) \n {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target === copy ) \n {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n var clone;\n if ( deep && copy && ( _isPlainObject(copy) || (copyIsArray = _isArray(copy)) ) ) \n {\n if ( copyIsArray ) \n {\n copyIsArray = false;\n clone = src && _isArray(src) ? src : [];\n\n } \n else \n {\n clone = src && _isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = _extend( deep, clone, copy );\n\n // Don't bring in undefined values\n }\n else if ( copy !== undefined ) \n {\n target[ name ] = copy;\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n }", "function extendJQuery() {\n jQuery.extend(Object.create(null, {\n 'alert': { value: alert, configurable: true, enumerable: true, writable: true },\n 'confirm': { value: createShowShorthand('success', 'S011'), configurable: true, enumerable: true, writable: true, },\n 'notice': { value: createShowShorthand('info'), configurable: true, enumerable: true, writable: true, },\n 'warn': { value: createShowShorthand('warning', 'S012'), configurable: true, enumerable: true, writable: true, },\n 'alarm': { value: createShowShorthand('error', 'S013'), configurable: true, enumerable: true, writable: true, },\n }));\n }", "function ExtendObject() {\r\n var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {},\r\n i = 1,\r\n length = arguments.length,\r\n deep = false;\r\n\r\n // Handle a deep copy situation\r\n if (typeof target === \"boolean\") {\r\n deep = target;\r\n\r\n // Skip the boolean and the target\r\n target = arguments[i] || {};\r\n i++;\r\n }\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (typeof target !== \"object\" && (typeof target !== \"function\")) {\r\n target = {};\r\n }\r\n\r\n // Extend jQuery itself if only one argument is passed\r\n if (i === length) {\r\n target = this;\r\n i--;\r\n }\r\n\r\n for (; i < length; i++) {\r\n\r\n // Only deal with non-null/undefined values\r\n if ((options = arguments[i]) != null) {\r\n\r\n // Extend the base object\r\n for (name in options) {\r\n src = target[name];\r\n copy = options[name];\r\n\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n continue;\r\n }\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (deep && copy && (IsPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {\r\n\r\n if (copyIsArray) {\r\n copyIsArray = false;\r\n clone = src && Array.isArray(src) ? src : [];\r\n\r\n } else {\r\n clone = src && IsPlainObject(src) ? src : {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[name] = ExtendObject(deep, clone, copy);\r\n\r\n // Don't bring in undefined values\r\n } else if (copy !== undefined) {\r\n target[name] = copy;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Return the modified object\r\n return target;\r\n}", "extend() {}", "extend() {}", "function extend() {\n // copy reference to target object\n var target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false,\n options,\n name,\n src,\n copy;\n\n // Handle a deep copy situation\n if (typeof target === \"boolean\") {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== \"object\" && !typeof target === 'function')\n target = {};\n\n var isPlainObject = function(obj) {\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor\n // property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if (!obj || toString.call(obj) !== \"[object Object]\" || obj.nodeType\n || obj.setInterval)\n return false;\n\n var has_own_constructor = hasOwnProperty.call(obj, \"constructor\");\n var has_is_prop_of_method = hasOwnProperty.call(obj.constructor.prototype,\n \"isPrototypeOf\");\n // Not own constructor property must be Object\n if (obj.constructor && !has_own_constructor && !has_is_prop_of_method)\n return false;\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n\n var last_key;\n for (var key in obj)\n last_key = key;\n\n return last_key === undefined || hasOwnProperty.call(obj, last_key);\n };\n\n\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) !== null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target === copy)\n continue;\n\n // Recurse if we're merging object literal values or arrays\n if (deep && copy && (isPlainObject(copy) || Array.isArray(copy))) {\n var clone = src && (isPlainObject(src) || Array.isArray(src)\n ? src : (Array.isArray(copy) ? [] : {}));\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (copy !== undefined)\n target[name] = copy;\n }\n }\n }\n\n // Return the modified object\n return target;\n}", "function extend() {\n // copy reference to target object\n var target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false,\n options,\n name,\n src,\n copy;\n\n // Handle a deep copy situation\n if (typeof target === \"boolean\") {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== \"object\" && !typeof target === 'function')\n target = {};\n\n var isPlainObject = function(obj) {\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor\n // property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if (!obj || toString.call(obj) !== \"[object Object]\" || obj.nodeType\n || obj.setInterval)\n return false;\n\n var has_own_constructor = hasOwnProperty.call(obj, \"constructor\");\n var has_is_prop_of_method = hasOwnProperty.call(obj.constructor.prototype,\n \"isPrototypeOf\");\n // Not own constructor property must be Object\n if (obj.constructor && !has_own_constructor && !has_is_prop_of_method)\n return false;\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n\n var last_key;\n for (var key in obj)\n last_key = key;\n\n return last_key === undefined || hasOwnProperty.call(obj, last_key);\n };\n\n\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) !== null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target === copy)\n continue;\n\n // Recurse if we're merging object literal values or arrays\n if (deep && copy && (isPlainObject(copy) || Array.isArray(copy))) {\n var clone = src && (isPlainObject(src) || Array.isArray(src)\n ? src : (Array.isArray(copy) ? [] : {}));\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (copy !== undefined)\n target[name] = copy;\n }\n }\n }\n\n // Return the modified object\n return target;\n}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions || {};for(key in src) {if(src[key] !== undefined){(flatOptions[key]?target:deep || (deep = {}))[key] = src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function Nothing$prototype$extend(f) {\n return this;\n }", "function ajaxExtend(target,src){var deep,key,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function ajaxExtend(target,src){var deep,key,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}", "function extend(o, e){\n each(e, function(v, n){\n if (is(o[n], 'object') && is(v, 'object')){\n o[n] = extend(o[n], v);\n } else if (v !== null) {\n o[n] = v;\n }\n });\n return o;\n}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}}", "function extend(from, to) {\n if (to === void 0) { to = null; }\n if (from == null || typeof from != \"object\")\n return from;\n if (from.constructor != Object && from.constructor != Array)\n return from;\n if (from.constructor == Date ||\n from.constructor == RegExp ||\n from.constructor == Function ||\n from.constructor == String ||\n from.constructor == Number ||\n from.constructor == Boolean)\n return new from.constructor(from);\n to = to || new from.constructor();\n for (var name in from) {\n to[name] = typeof to[name] == \"undefined\" ? extend(from[name], null) : to[name];\n }\n return to;\n }", "function Xj(a,b){null!=a&&this.append.apply(this,arguments)}", "function ajaxExtend( target, src ) { // 8596\n\tvar key, deep, // 8597\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {}; // 8598\n // 8599\n\tfor ( key in src ) { // 8600\n\t\tif ( src[ key ] !== undefined ) { // 8601\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; // 8602\n\t\t} // 8603\n\t} // 8604\n\tif ( deep ) { // 8605\n\t\tjQuery.extend( true, target, deep ); // 8606\n\t} // 8607\n // 8608\n\treturn target; // 8609\n} // 8610", "function JSextend(a, b) {\n\tfor ( var prop in b ) {\n\t\ta[prop] = b[prop];\n\t}\n\treturn a;\n}", "function cloneIt(o) {\n return ( $.extend(true, {}, o) );\n}", "function extend() {\n var args = Array.prototype.slice.call(arguments, 0);\n return _extend.apply(null, [{}].concat(args));\n }", "function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}", "function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}", "function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}", "function $extend(destiny, source) {\r\n\t\tif (!$defined(destiny) || !$defined(source)) return destiny;\r\n\t\tfor (var prop in source) {\r\n\t\t\tif (destiny.prototype) destiny.prototype[prop] = source[prop];\r\n\t\t\telse destiny[prop] = source[prop];\r\n\t\t}\r\n\t\treturn destiny;\r\n\t}", "function ajaxExtend(target, src) {\n var deep, key,\n flatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n for (key in src) {\n if (src[ key ] !== undefined) {\n (flatOptions[ key ] ? target : (deep || (deep = {})))[ key ] = src[ key ];\n }\n }\n if (deep) {\n jQuery.extend(true, target, deep);\n }\n\n return target;\n }", "function __extends(e,t){function __(){this.constructor=e}ke(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}", "function extendObject() {\n var i, options, key, value,\n target = arguments[0] || {},\n length = arguments.length;\n\n for( i = 1; i < length; i++ ) {\n // Ignore non-null/undefined values\n if( (options = arguments[ i ]) != null ) {\n // Extend the target object\n for( key in options ) {\n value = options[key]\n if( value )\n target[key] = value\n }\n }\n }\n\n return target\n }", "function extend(from, to)\n{\n if (from == null || typeof from != \"object\") return from;\n if (from.constructor != Object && from.constructor != Array) return from;\n if (from.constructor == Date || from.constructor == RegExp || from.constructor == Function ||\n from.constructor == String || from.constructor == Number || from.constructor == Boolean)\n return new from.constructor(from);\n\n to = to || new from.constructor();\n\n for (var name in from)\n {\n to[name] = typeof to[name] == \"undefined\" ? extend(from[name], null) : to[name];\n }\n\n return to;\n}", "function extend() {\n var options, name, src, copy, copyIsArray, clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length;\n\n // Handle case when target is a string or something (possible in deep copy)\n if ( typeof target !== \"object\" && !_.isFunction(target) ) {\n target = {};\n }\n\n for ( ; i < length; i++ ) {\n // Only deal with non-null/undefined values\n if ( (options = arguments[ i ]) != null ) {\n // Extend the base object\n for ( name in options ) {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target === copy ) {\n continue;\n }\n\n // Recurse if we're merging plain objects or arrays\n if ( copy && isPlainObject(copy) ) {\n clone = src && isPlainObject(src) ? src : {};\n\n // Never move original objects, clone them\n target[ name ] = extend( clone, copy );\n // Don't bring in undefined values\n } else if ( copy !== undefined ) {\n target[ name ] = copy;\n }\n }\n }\n }\n // Return the modified object\n return target;\n }", "function extend(a,b){for(var prop in b){a[prop]=b[prop];}return a;}", "function CustomOptions(opts) {\n $.extend(true, this, opts);\n\n\n\n}", "function ajaxExtend( target, src ) {\r\r\n\tvar key, deep,\r\r\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\r\n\tfor ( key in src ) {\r\r\n\t\tif ( src[ key ] !== undefined ) {\r\r\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\r\r\n\t\t}\r\r\n\t}\r\r\n\tif ( deep ) {\r\r\n\t\tjQuery.extend( true, target, deep );\r\r\n\t}\r\r\n}", "function boundExtend() {\n var args, val;\n args = Array.prototype.slice.call(arguments);\n val = this.valueOf(); // jshint ignore:line\n args.unshift(val);\n return extend.apply(null, args);\n }", "function ajaxExtend( target, src ) {\r\n\tvar deep, key,\r\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\n\r\n\tfor ( key in src ) {\r\n\t\tif ( src[ key ] !== undefined ) {\r\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\r\n\t\t}\r\n\t}\r\n\tif ( deep ) {\r\n\t\tjQuery.extend( true, target, deep );\r\n\t}\r\n\r\n\treturn target;\r\n}", "function extend(a, b) {\n for (var i in b) {\n if (b.hasOwnProperty(i)) {\n a[i] = b[i];\n }\n }\n\n if (b.hasOwnProperty(\"toString\")) {\n a.toString = b.toString;\n }\n\n if (b.hasOwnProperty(\"valueOf\")) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n\t}", "function ajaxExtend(target, src) {\r\n\t\tvar key, deep,\r\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\n\t\tfor (key in src) {\r\n\t\t\tif (src[key] !== undefined) {\r\n\t\t\t\t(flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (deep) {\r\n\t\t\tjQuery.extend(true, target, deep);\r\n\t\t}\r\n\t\treturn target;\r\n\t}", "function extend() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n /** The final result we will return */\n var result = {};\n for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {\n var object = objects_1[_a];\n if (object == null || object === false) {\n continue;\n }\n for (var key in object) {\n /** Falsy values except a explicit 0 is ignored */\n var val = object[key];\n if (!val && val !== 0) {\n continue;\n }\n /** if nested media or pseudo selector */\n if (key === '$nest' && val) {\n result[key] = result['$nest'] ? extend(result['$nest'], val) : val;\n }\n else if ((key.indexOf('&') !== -1 || key.indexOf('@media') === 0)) {\n result[key] = result[key] ? extend(result[key], val) : val;\n }\n else {\n result[key] = val;\n }\n }\n }\n return result;\n}", "function extend() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n /** The final result we will return */\n var result = {};\n for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {\n var object = objects_1[_a];\n if (object == null || object === false) {\n continue;\n }\n for (var key in object) {\n /** Falsy values except a explicit 0 is ignored */\n var val = object[key];\n if (!val && val !== 0) {\n continue;\n }\n /** if nested media or pseudo selector */\n if (key === '$nest' && val) {\n result[key] = result['$nest'] ? extend(result['$nest'], val) : val;\n }\n else if ((key.indexOf('&') !== -1 || key.indexOf('@media') === 0)) {\n result[key] = result[key] ? extend(result[key], val) : val;\n }\n else {\n result[key] = val;\n }\n }\n }\n return result;\n}", "function extend() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n /** The final result we will return */\n var result = {};\n for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {\n var object = objects_1[_a];\n if (object == null || object === false) {\n continue;\n }\n for (var key in object) {\n /** Falsy values except a explicit 0 is ignored */\n var val = object[key];\n if (!val && val !== 0) {\n continue;\n }\n /** if nested media or pseudo selector */\n if (key === '$nest' && val) {\n result[key] = result['$nest'] ? extend(result['$nest'], val) : val;\n }\n else if ((key.indexOf('&') !== -1 || key.indexOf('@media') === 0)) {\n result[key] = result[key] ? extend(result[key], val) : val;\n }\n else {\n result[key] = val;\n }\n }\n }\n return result;\n}", "function ajaxExtend( target, src ) {\r\n\tvar key, deep,\r\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\n\r\n\tfor ( key in src ) {\r\n\t\tif ( src[ key ] !== undefined ) {\r\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\r\n\t\t}\r\n\t}\r\n\tif ( deep ) {\r\n\t\tjQuery.extend( true, target, deep );\r\n\t}\r\n\r\n\treturn target;\r\n}", "function ajaxExtend( target, src ) {\r\n\tvar key, deep,\r\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\n\r\n\tfor ( key in src ) {\r\n\t\tif ( src[ key ] !== undefined ) {\r\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\r\n\t\t}\r\n\t}\r\n\tif ( deep ) {\r\n\t\tjQuery.extend( true, target, deep );\r\n\t}\r\n\r\n\treturn target;\r\n}", "function ajaxExtend( target, src ) {\n \tvar key, deep,\n \t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n \tfor ( key in src ) {\n \t\tif ( src[ key ] !== undefined ) {\n \t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n \t\t}\n \t}\n \tif ( deep ) {\n \t\tjQuery.extend( true, target, deep );\n \t}\n\n \treturn target;\n }", "function ajaxExtend(target, src) {\r\n\t\tvar deep, key,\r\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\r\n\r\n\t\tfor (key in src) {\r\n\t\t\tif (src[key] !== undefined) {\r\n\t\t\t\t(flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (deep) {\r\n\t\t\tjQuery.extend(true, target, deep);\r\n\t\t}\r\n\r\n\t\treturn target;\r\n\t}", "function MerelyNothing () {\n const superCtor = (typeof Reflect === 'object') ? function () {\n return Reflect.construct(HTMLElement, arguments, this.constructor);\n } : function () {\n return HTMLElement.apply(this, arguments) || this;\n };\n const $_ = superCtor.apply(this, arguments);\n $_.nothing = null;\n $_.padding = 0;\n $_.message = '';\n return $_;\n}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}", "function ajaxExtend( target, src ) {\n var key, deep,\n flatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n for ( key in src ) {\n if ( src[ key ] !== undefined ) {\n ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n }\n }\n if ( deep ) {\n jQuery.extend( true, target, deep );\n }\n\n return target;\n }", "function extendNodes(){\n\t\tif(!nodes) return;\n\t\t$.extend(nodes, {\n\t\t\t'bind' : bind,\n\t\t\t'parent' : parent,\n\t\t\t'children' : children,\n\t\t\t'index'\t : index,\n\t\t\t'css' : css\n\t\t});\n\t}", "function extendSource(source)\n {\n // API\n $.extend( source, {\n /* ----- Options ----- */\n getOptions: function() {\n return getOptions();\n },\n getOption: function(option) {\n return options[option];\n },\n /* ----- Forms ----- */\n // Get all Forms\n getForms: function() {\n return getForms();\n },\n // Alias of getForms\n getAllForms: function() {\n return getForms();\n },\n getForm: function(val) {\n if (typeof(val) != 'undefined') {\n val++;\n } \n return getForm(val);\n },\n getLastForm: function() {\n return getForm();\n },\n getFirstForm: function() {\n first();\n return getCurrentForm();\n },\n addForm: function(form) {\n return addForm(form);\n },\n addNForms: function(n) {\n return addNForms(n);\n },\n disableOldRows: function(){\n return disableOldRows();\n },\n // Number of active forms\n getFormsCount: function() {\n return getFormsCount();\n },\n hasForms: function() {\n return hasForms();\n },\n canAddForm: function() {\n return canAddForm();\n },\n canRemoveAllForms: function() {\n return canRemoveAllForms();\n },\n // Can remove a form?\n canRemoveForm: function() {\n return canRemoveForm();\n },\n removeAllForms: function() {\n return removeAllForms(true);\n },\n removeLastForm: function() {\n return removeLastForm();\n },\n removeFirstForm: function() {\n first();\n return removeForm(getCurrentForm());\n },\n removeForm: function(val) {\n if (typeof(val) != 'undefined') {\n val++;\n }\n return removeForm(getForm(val));\n },\n\n /* ----- Advanced ----- */\n inject: function(data) {\n // Loop over each data using a Proxy (function , context)\n $.each(data, $.proxy( fillData, source ));\n },\n cloneTemplate: function(){\n return cloneTemplate();\n },\n count: function(){\n return count();\n },\n normalizeForms: function(){\n return normalizeForms();\n },\n setParent: function(p){\n setParent(p);\n }\n });\n }", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}", "function ajaxExtend( target, src ) {\n\tvar deep, key,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}" ]
[ "0.73487353", "0.696477", "0.6951151", "0.6454417", "0.6113531", "0.6113531", "0.60536283", "0.60536283", "0.5966844", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.59418887", "0.59309053", "0.59309053", "0.5918109", "0.5908905", "0.59048486", "0.58993274", "0.5897868", "0.5885704", "0.5869864", "0.58583856", "0.5830698", "0.5830698", "0.5830698", "0.5828586", "0.582129", "0.5805443", "0.5801151", "0.57848126", "0.57721853", "0.5699095", "0.5653748", "0.56385505", "0.56328714", "0.5619924", "0.5619316", "0.56134695", "0.5612391", "0.5612391", "0.5612391", "0.5606598", "0.5606598", "0.55922085", "0.55889857", "0.55859286", "0.55841666", "0.55841666", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.5578395", "0.55756915", "0.5570808", "0.55683047", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219", "0.5566219" ]
0.0
-1
Post events to containers
function delayEvent( type, instance, container ) { return function( event ) { container._trigger( type, event, instance._uiHash( instance ) ); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postEvents(req, res, next) {\n jackalopeApp.jackrabbitConnection.publish('queue.simple', req.body);\n res.status(200).end();\n }", "function registerEvents(Remci) {\n for(var e in events) {\n let event = events[e];\n Remci.post(e, emitEvent(event));\n }\n}", "function onContainer(container) {\n console.log('onContainer',container);\n} // end function", "function postEvent(eventName) {\n const body = {\n 'name': eventName //body\n };\n\n fetch('http://localhost:3000/events', { //endpoint\n method: 'post',\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json'\n },\n })\n .then(res => res.json())\n .then((json) => {\n newLine();\n console.table(json);\n endLine();\n continueCallback();\n });\n }", "function registerEvents(Screen) {\n for(var e in events) {\n let event = events[e];\n Screen.post(e, emitEvent(event));\n }\n}", "function EventsQueue() {}", "function publishListener () {\n\n\tif ( editorData.isCurrentPostPublished() ) {\n\t\tunSubscribe();\n\n\t\ttriggerUpdateEvent( {\n\t\t\t'icon': getFeaturedImageURL(),\n\t\t\t'link': editorData.getPermalink(),\n\t\t\t'edit_link': `post.php?post=${editorData.getCurrentPostId()}&action=edit&pods_modal=1`,\n\t\t\t'selected': true // Automatically select add new records\n\t\t} );\n\t}\n}", "function registerEvents() {\n}", "post(event, dataProvider) {\n if (this.subscriptions[event]) {\n this.subscriptions[event].forEach(target => {\n target(dataProvider)\n })\n }\n }", "handleEvents(events) {\n events.forEach((event) => {\n console.info(`Publish event ${event.Code} to MQTT`);\n this.publishToMQTT(event.Code, {\n Action: event.eventAction,\n Data: event.Data,\n deviceType: this.deviceType,\n serialNumber: this.serialNumber,\n });\n });\n }", "function addEvents(eventList) {\n angular.forEach(eventList, function(e) {\n $scope.eventQueue.enqueue(e);\n });\n }", "function tpieevents(input) {\n store_remote_events(input);\n parse_events(input);\n}", "function registerEvents(SmsTemplate) {\n for(var e in events) {\n let event = events[e];\n SmsTemplate.post(e, emitEvent(event));\n }\n}", "handleEvents() {\n }", "allCustomEvents() {\n // add custom events here\n }", "publish() {\n if (Meteor.isServer) {\n const eventDataPublications = require('./EventDataCollectionPublications.js').eventDataCollectionPublications;\n eventDataPublications();\n }\n }", "function registerEvents(Booktable) {\n for (var e in events) {\n var event = events[e];\n Booktable.post(e, emitEvent(event));\n }\n}", "bindEvents() {\n this.container.addEventListener(\"click\", this.click.bind(this));\n }", "addEventListeners() {\n\t\tthis.container.addEventListener( 'click', this.handleClick, false );\n\t}", "run () {\n this._client.on('messageCreate', this.onMessageCreateEvent.bind(this))\n this._client.on('messageReactionAdd', this.onMessageReactionEvent.bind(this))\n this._client.on('messageReactionRemove', this.onMessageReactionEvent.bind(this))\n }", "_handleContainers() {\n const that = this;\n let customContainer;\n\n if (typeof that.appendTo === 'string') {\n customContainer = document.getElementById(that.appendTo);\n }\n else if (that.appendTo instanceof HTMLElement) {\n customContainer = that.appendTo;\n }\n\n //Get or create the toast items container\n that._container = that._getToastContainer(customContainer);\n\n if (customContainer) {\n that._appendTo = customContainer;\n\n if (!that._container.parentElement) {\n //Add events listeners\n that._addContainerListeners(that._container);\n that._appendTo.appendChild(that._container);\n }\n\n return;\n }\n\n if (!customContainer && that.$.toastContainerCustom && !that.$.toastContainerCustom.children.length) {\n that._removeContainerListeners(that.$.toastContainerCustom);\n\n if (that.$.toastContainerCustom.parentElement) {\n that.$.toastContainerCustom.parentElement.removeChild(that.$.toastContainerCustom);\n }\n }\n\n if (!that._container.parentElement) {\n //Add events listeners\n that._addContainerListeners(that._container);\n document.body.appendChild(that._container);\n }\n }", "ConnectEvents() {\n\n }", "function setupListener() {\r\n container.addEventListener('click', clickHandler);\r\n}", "event(name, data = {}) {\n const eventObj = { event: name };\n for (const d in data) {\n const v = data[d];\n eventObj[d] = v;\n }\n logger.log('pushing event', eventObj);\n return window.criteo_q.push(eventObj);\n }", "onEventCreated(newEventRecord) {}", "postIngestData() {}", "watch_post ( ) {\n let _that = this;\n yootil.form.any_posting().each(function(){\n $(this).find('[type=\"submit\"]').mousedown(function(){\n let packet = _that.intercept_post();\n _that.send(packet);\n });\n });\n }", "publish() {\n if (Meteor.isServer) {\n const boxEventPublications = require('./BoxEventCollectionPublications.js').boxEventCollectionPublications;\n boxEventPublications();\n }\n }", "function upload() {\n gtag('event', 'Event Uploader Submit');\n formatEvents();\n showHide('results', 'preview');\n apiWorker.postMessage(array);\n}", "_emitNewEvents() {\n logger.log({level: 'info', type: 'service', message: 'Emitting new service events'});\n\n if (!this.primaryDeployment) return;\n\n if (!this.eventsAfter) {\n this.eventsAfter = this.primaryDeployment.createdAt;\n }\n\n const events = _(this.raw.events)\n .filter((event) => event.createdAt > this.eventsAfter)\n .sortBy('createdAt')\n .value();\n\n if (events.length > 0) this.eventsAfter = _.last(events).createdAt;\n\n const eventClassTestOrder = [\n serviceEvents.TasksStartedEvent,\n serviceEvents.TasksStoppedEvent,\n serviceEvents.SteadyEvent,\n serviceEvents.Event,\n ];\n\n for (const event of events) {\n logger.log({level: 'debug', type: 'service-event', message: JSON.stringify(event)});\n const eventClass = eventClassTestOrder.find((type) => type.test(event));\n eventClass.convert(this, event, (error, value) => {\n if (error) return this.emit('error', error);\n this.emit('event', value);\n });\n }\n }", "function attachEvents() {\n // scroll to top/left 0 when a box is generated\n $(\".drag, .decision, .end\").click(function (e) {\n e.preventDefault();\n $('.umb-panel-nobody').animate({\n scrollLeft: 0,\n scrollTop: 0\n }, 800);\n });\n $(\".dragged-doc, .dragged-decision, .dragged-end\").click(function () {\n $(\".dragged-doc, .dragged-decision, .dragged-end\").removeClass('current_procedure');\n $(this).addClass('current_procedure');\n });\n $(document).mouseup(function (e) {\n var container = $(\"#toolbox, #flowchart_backend .dragged-doc, .colpick\");\n if (!container.is(e.target) // if the target of the click isn't the container...\n && container.has(e.target).length === 0) // ... nor a descendant of the container\n $(\".dragged-doc, .dragged-decision, .dragged-end\").removeClass('current_procedure');\n });\n $(\".remove\").click(function () {\n instance.removeAllEndpoints($(this).parent().attr(\"id\"));\n normalizeEndpoints();\n if ($(this).parent().hasClass(\"existing\") && $(this).parent().hasClass(\"dragged-doc\")) {\n boxArr.push({\n umbracoId: parseInt($(this).parent().attr(\"umbracoId\")),\n docId: $(this).parent().attr(\"id\").toString(),\n name: \"\",\n colour: \"\",\n left: 0,\n top: 0,\n isNew: false,\n delete: true\n });\n }\n $(this).parents(\".box-wrap\").animate(\n { height: \"0\", width: \"0\" },\n { duration: 240, complete: function () { $(this).remove() } }\n );\n });\n }", "_registerEvents(eventTypes) {\n this._ngZone.runOutsideAngular(() => {\n eventTypes.forEach((type) => {\n this._triggerElement.addEventListener(type, this, passiveEventOptions);\n });\n });\n }", "_registerEvents(eventTypes) {\n this._ngZone.runOutsideAngular(() => {\n eventTypes.forEach((type) => {\n this._triggerElement.addEventListener(type, this, passiveEventOptions);\n });\n });\n }", "_registerEvents(eventTypes) {\n this._ngZone.runOutsideAngular(() => {\n eventTypes.forEach((type) => {\n this._triggerElement.addEventListener(type, this, passiveEventOptions);\n });\n });\n }", "onEvent() {\n \n }", "function bindContainerHandler(containerNode, eventName, func) {\n containerNode.addEventListener(eventName, function(event) {\n var node = event.target;\n // bail if they clicked on the container and not a child...\n if (node === containerNode)\n return;\n while (node && node.parentNode !== containerNode) {\n node = node.parentNode;\n }\n func(node, event);\n }, false);\n}", "function submitEvent(event) {\n $.post(\"/api/events\", event, function () {\n window.location.href = \"/events\";\n });\n }", "static publish() {\r\n ViewportService.subscribers.forEach(el => {el.callback();});\r\n }", "static dragEvents(){\n //enter drag\n Quas.on(\"dragenter dragstart\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).addCls(\"dragenter\");\n });\n\n //exit drag\n Quas.on(\"dragend dragleave\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n });\n\n //prevent default on other drag events\n Quas.on(\"drag dragover\", \".drop\", function(e){\n e.preventDefault();\n });\n\n //dropping the file\n Quas.on(\"drop\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n upload(e.dataTransfer.files, function(data){\n //todo progress bar\n closeToolModals();\n Quas.getEl(\"#post-tool-cloud\").visible(true);\n loadModal(\"cloud\");\n });\n });\n }", "function registerEvents() {\n var graphViewEvents = graphView.getEvents();\n // Non d3 events\n $baseTopologyTemplate.on(\"click\", \".topology-zoom-in\", function (evt) {\n $container.trigger(topologyConstants.events.zoomIn, {}); // Private Event \n });\n $baseTopologyTemplate.on(\"click\", \".topology-zoom-out\", function (evt) {\n $container.trigger(topologyConstants.events.zoomOut, {}); // Private Event\n });\n $baseTopologyTemplate.on(\"click\", \".topology-reset\", function (evt) {\n reload();\n });\n $baseTopologyTemplate.on(\"click\", \".topology-legend-icon\", function (evt) {\n var $elem = $baseTopologyTemplate.find(\".legend-view-container\");\n if ($elem.hasClass(\"legend-expanded\")) {\n $elem.removeClass(\"legend-expanded\").addClass(\"legend-collapsed\");\n $userContainer.trigger(topologyConstants.events.legendCollapse, {}); // Public Event\n }\n else if ($elem.hasClass(\"legend-collapsed\")) {\n $elem.removeClass(\"legend-collapsed\").addClass(\"legend-expanded\");\n $userContainer.trigger(topologyConstants.events.legendExpand, {}); // Public Event\n }\n });\n\n // d3 events\n graphViewEvents.on('nodeClick', function (d) {\n var node = getNode(d);\n $userContainer.trigger(topologyConstants.events.nodeClick, node); // Public Event\n });\n\n graphViewEvents.on('nodeMouseOver', function (d, i, nodeEl) {\n var node = getNode(d);\n $userContainer.trigger(topologyConstants.events.nodeMouseOver, node); // Public Event\n });\n\n graphViewEvents.on('nodeMouseOut', function (d, i, nodeEl) {\n var node = getNode(d);\n $userContainer.trigger(topologyConstants.events.nodeMouseOut, node); // Public Event\n });\n\n graphViewEvents.on('linkClick', function (d) {\n var node = getNodeLink(d);\n $userContainer.trigger(topologyConstants.events.linkClick, node); // Public Event\n });\n\n graphViewEvents.on('linkMouseOver', function (d) {\n var node = getNodeLink(d);\n $userContainer.trigger(topologyConstants.events.LinkMouseOver, node); // Public Event\n });\n\n graphViewEvents.on('linkMouseOut', function (d) {\n var node = getNodeLink(d);\n $userContainer.trigger(topologyConstants.events.LinkMouseOut, node); // Public Event\n });\n\n function getNode(d) {\n return dataStore && dataStore.get(d.id);\n }\n\n function getNodeLink(d) {\n return dataStore && dataStore.get(d.id);\n }\n }", "function performPublish(e) {\n queueArticles(publish.queued, queueArticlesSuccess, queueArticlesError);\n }", "function EventDispatcher() {}", "function EventDispatcher() {}", "execute_event(ev, state) {\n //if (ev._ !== \"App.Event.tick\") console.log(\"execute\", ev._, ev.time, ev.done);\n var actions = this.app.when(ev)(state);\n while (actions._ === \"List.cons\") {\n var action = actions.head;\n switch (action._) {\n case \"App.Action.state\":\n state = action.state;\n break;\n case \"App.Action.print\":\n if (!ev.done) {\n console.log(action.text);\n }\n break;\n case \"App.Action.post\":\n if (!ev.done) {\n var data = lib.hex(256, lib.fmword_to_hex(action.data));\n front.logs.send_post(lib.fmword_to_hex(action.room), data);\n }\n break;\n case \"App.Action.watch\":\n if (!ev.done) {\n front.logs.watch_room(lib.fmword_to_hex(action.room));\n //console.log(\"watching room\");\n front.logs.on_post(({room, time, addr, data}) => {\n //var text = lib.hex_to_string(data).replace(/\\0/g,\"\");\n //console.log(\"got post\");\n this.register_event({\n _: \"App.Event.post\",\n time: parseInt(time.slice(2), 16),\n room: lib.hex_to_fmword(room),\n addr: lib.hex_to_fmword(addr),\n data: lib.hex_to_fmword(data),\n });\n });\n }\n break;\n case \"App.Action.resize\":\n if (!ev.done) {\n this.init_canvas(action.width, action.height);\n }\n break;\n };\n actions = actions.tail;\n }\n ev.done = true;\n return state;\n }", "delegateEvents() {\n this._userEvent('beforeDelegateEvents');\n this._closeComponentsOnEsc();\n Object.keys(this.DOMEvents).forEach((key) => {\n const [, eventName, selectorString] = key.match(delegateEventSplitter);\n if (selectorString) {\n this._on(eventName, selectorString, (evt, target) => {\n this.DOMEvents[key].call(this, evt, target);\n });\n } else {\n this.wrapper.addEventListener('click', (evt) => {\n this.DOMEvents[key].call(this, evt);\n });\n }\n });\n this._userEvent('afterDelegateEvents');\n }", "function CreateEvents() {\n mc.on('press panstart panmove', function(e) {\n ShadowOpacity(0, 0.1);\n\n // TODO: add smooth scale animation, problems with transition\n UpdateCardPos(currCard, e);\n });\n\n mc.on('pressup panend', function(e) {\n var dist = Math.abs(e.deltaX);\n var dir = Math.sign(e.deltaX);\n\n // Do we take action or snap back\n if(dist >= bp) {\n if(dir > 0) {\n SnapRight(currCard, e);\n }\n else if(dir < 0) {\n SnapLeft(currCard, e);\n }\n }\n else {\n SnapBack(currCard);\n ShadowOpacity(maxOpacity, 0.3);\n }\n });\n\n heart.addEventListener(\"click\", function() {\n ToggleLiked();\n });\n}", "function sendEvent(payload) {\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"POST\", \"http://localhost:8081/command.json\", true);\n\txhr.setRequestHeader(\"Content-type\", \"application/json\");\n\txhr.send(payload);\n}", "publishEvent()\n {\n this.SelectTextDisplayLogic();\n\n // Creates the event with selected items.\n const selectedEvent = new CustomEvent('selected', { detail: this.selectedList });\n // Dispatches the event.\n this.dispatchEvent(selectedEvent);\n }", "bindEvents() {\n }", "attach() {\n for (const container of this.containers) {\n container.addEventListener('webkitmouseforcewillbegin', this[onMouseForceWillBegin], false);\n container.addEventListener('webkitmouseforcedown', this[onMouseForceDown], false);\n container.addEventListener('mousedown', this[onMouseDown], true);\n container.addEventListener('webkitmouseforcechanged', this[onMouseForceChange], false);\n }\n\n document.addEventListener('mousemove', this[onMouseMove]);\n document.addEventListener('mouseup', this[onMouseUp]);\n }", "_postSent(post) {\n\t\tthis.broadcast('postSent', post);\n\t}", "function addEventListeners() {\n watchSubmit();\n watchResultClick();\n watchLogo();\n watchVideoImageClick();\n watchCloseClick();\n}", "function doPost(e){\n \n // for testing\n if (!e) {\n e = {\"parameters\":\n {\"events\":\n '[{\"tag\": \"test_LINE\",\"time\": \"1\",\"record\": {\"value1\": \"10\", \"value2\": \"20\"}},{\"tag\": \"test_LINE\",\"time\": \"2\",\"record\": {\"value1\": \"15\", \"value2\": \"22\"}}]'\n }\n }\n }\n \n // process each event\n var events = JSON.parse(e.parameters.events);\n for each (var event in events) {\n processEvent(event);\n }\n\n // response with empty string\n return ContentService.createTextOutput(\"\");\n}", "_eventHandler(message) {\n // push to web client\n this._io.emit('service:event:' + message.meta.event, message.payload)\n this._io.emit('_bson:service:event:' + message.meta.event,\n this._gateway._connector.encoder.pack(message.payload))\n }", "function dispatchLoggedEvent( e ) {\r\n\r\n\tdebug.master && debug.events && console.log ( 'About to dispatch ' , e );\r\n\tdispatchEvent( e );\r\n\tdebug.master && debug.events && console.log ( 'Just dispatched ' , e );\r\n\t\t\r\n}", "execute(client, data) {\n events.log.push(data);\n }", "function flyatics_event(data){\n\tflybase.trigger( 'client-event', data );\n}", "function addEventListeners()\n\t{\n\t\t// window event\n\t\t$(window).resize(callbacks.windowResize);\n\t\t$(window).keydown(callbacks.keyDown);\n\t\t\n\t\t// click handler\n\t\t$(document.body).mousedown(callbacks.mouseDown);\n\t\t$(document.body).mouseup(callbacks.mouseUp);\n\t\t$(document.body).click(callbacks.mouseClick);\n\n\t\t$(document.body).bind('touchstart',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchstart(e);\n\t\t});\n\t\t$(document.body).bind('touchend',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchend(e);\n\t\t});\n\t\t$(document.body).bind('touchmove',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchmove(e);\n\t\t});\n\t\t\n\t\tvar container = $container[0];\n\t\tcontainer.addEventListener('dragover', cancel, false);\n\t\tcontainer.addEventListener('dragenter', cancel, false);\n\t\tcontainer.addEventListener('dragexit', cancel, false);\n\t\tcontainer.addEventListener('drop', dropFile, false);\n\t\t\n\t\t// GUI events\n\t\t$(\".gui-set a\").click(callbacks.guiClick);\n\t\t$(\".gui-set a.default\").trigger('click');\n\t}", "function registerEvents(Position) {\n for(var e in events) {\n let event = events[e];\n Position.hook(e, emitEvent(event));\n }\n}", "function refetchEvents() { // can be called as an API method\n\t\t\tfetchAndRenderEvents();\n\t\t}", "function refetchEvents() { // can be called as an API method\n\t\tfetchAndRenderEvents();\n\t}", "function subscribeToPosts(cb) {\n socket.on('post', cb);\n socket.emit('subscribeToPosts');\n}", "function submitPost(Post) {\n $.post(\"/event\", Post, function() {\n window.location.href = \"/event\";\n });\n }", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('projectWasRemoved', projectWasRemoved);\n channel.bind('projectWasModified', projectWasModified);\n }", "function registerEvents(Trim) {\n for(var e in events) {\n let event = events[e];\n Trim.post(e, emitEvent(event));\n }\n}", "triggerEvent(event) {\n\t\treturn _makeRequest('/events', {method: 'POST', body: {event}})\n\t\t\t.then(responseData => {\n\t\t\t\tif(responseData.success){\n\t\t\t\t\tconsole.log('Event Sent', event);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.error(error);\n\t\t\t});\n\t}", "pushEvent(self, event, ref, message) {\n firebase.database.ref(ref).child(event[\"key\"]).set({\n name: event[\"name\"],\n startDate: event[\"startDate\"],\n duration: parseInt(event[\"duration\"]),\n location: event[\"location\"],\n organization: event[\"organization\"],\n imgid: event[\"imgid\"],\n description: event[\"description\"],\n webLink: event[\"webLink\"],\n tags: this.state.tags.toString(),\n email: event[\"email\"],\n });\n self.setState({ uploading: false });\n self.displayMessage(self, message);\n this.group.leave(this.token);\n }", "bubble(e) {\n this.dispatchEvent(\n new CustomEvent(e.type, {\n detail: e.detail,\n bubbles: true\n })\n );\n }", "function extractEvents(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget,eventSystemFlags,targetContainer){extractCompositionEvent(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget);extractBeforeInputEvent(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget);}", "function extractEvents(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget,eventSystemFlags,targetContainer){extractCompositionEvent(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget);extractBeforeInputEvent(dispatchQueue,domEventName,targetInst,nativeEvent,nativeEventTarget);}", "HAXCMSFireButtonEvent(name, target, payload) {\n // send message off so that the control board hands it off to the CMS\n const evt = new CustomEvent(name, {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n originalTarget: target,\n values: payload,\n },\n });\n this.dispatchEvent(evt);\n }", "function bindPusherEvents() {\n var pusher = new Pusher('bf3b73f9a228dfef0913');\n var channel = pusher.subscribe(divvy.channel);\n\n channel.bind('subtaskWasModified', subtaskWasModified);\n channel.bind('subtaskWasDeleted', subtaskWasDeleted);\n channel.bind('subtaskWasCompleted', subtaskWasCompleted);\n channel.bind('subtaskWasIncomplete', subtaskWasIncomplete);\n }", "_events() {\n \tthis._addKeyHandler();\n \tthis._addClickHandler();\n }", "function IETabNotifyListener(event) {\n\tvar evt = document.createEvent(\"MessageEvent\");\n\tevt.initMessageEvent(\"ContainerMessage\", true, true, event.data, document.location.href, 0, window);\n\tdocument.dispatchEvent(evt);\n}", "setupContainerListener_() {\n dev().assert(this.container_);\n const toggleControls = this.toggleControls_.bind(this);\n listen(dev().assertElement(this.container_), 'click', toggleControls);\n }", "function registerItemEvents() {\n\n\n\n\n\t\t\t// START showEE\n\t\t\tfunction showEE(eventObjectToSearchIn) {\n\t\t\t\tshowEEFunc(getRelationObject(eventObjectToSearchIn), eventObjectToSearchIn);\n\t\t\t}\n\n\n\t\t\t// END showEE\n\n\t\t\tjContainer.find('[data-toggle=\"ASWidget-Post-Date\"]').tooltip();\n\n\t\t\tjContainer.find('img').bind('error', function(event) {\n\t\t\t\tvar this$ = $(event.currentTarget);\n\t\t\t\tif (this$.is(\":visible\")) {\n\t\t\t\t\tthis$.hide().after('<i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"> &nbsp ' +\n\t\t\t\t\t\tlocalizeString(\"ASWidget-image-preview-notavailable\", \"Preview has not been loaded. May it has been deleted or no preview is available.\") + '</i>');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tjContainer.find(\".normalPostEntryItem .postExpandClass\").on(\"click\", function(event) {\n\t\t\t\texpandItem($(event.currentTarget).parents(\".normalPostEntryItem\").first().find(\".ActivityStreamWidgetPost\"));\n\t\t\t\treturn false;\n\t\t\t});\n\n\n\t\t\tjContainer.find(\".AS-Widget-ShowPreviousCommentsBtn\").on(\"click\", function(event) {\n\t\t\t\tvar dataItem = getRelationObject(event),\n\t\t\t\t\tobjectId = dataItem.object.id || \"\",\n\t\t\t\t\tpObject = event.currentTarget,\n\t\t\t\t\tcurrentBtn$ = $(event.currentTarget),\n\t\t\t\t\titems = [],\n\t\t\t\t\toldObj$;\n\n\t\t\t\tif (objectId.length) {\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: X.T.getRootPath(\"WidgetsContainer\", false) + \"/basic/rest/ublog/@all/@all/\" + objectId + \"/comments?sortBy=published&sortOrder=ascending&startIndex=0&count=100\"\n\t\t\t\t\t}).done(function(data) {\n\t\t\t\t\t\tif (data && data.list && data.list.length) {\n\n\t\t\t\t\t\t\t$.each(data.list, function(ignore, el) {\n\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\tauthorID: el.author.id,\n\t\t\t\t\t\t\t\t\tauthorProfileURL: getspecifiedURL(el.author.id, \"profile\"),\n\t\t\t\t\t\t\t\t\tauthorPictureURL: getspecifiedURL(el.author.id, \"picture\"),\n\t\t\t\t\t\t\t\t\tauthorFullName: el.author.displayName,\n\t\t\t\t\t\t\t\t\tcommentContent: el.content,\n\t\t\t\t\t\t\t\t\tcommentCreatedDateUnparsed: el.updated || \"\",\n\t\t\t\t\t\t\t\t\tcommentCreatedDateParsed: formatDate(X.T.parseAtomDate(el.updated) || \"\"),\n\t\t\t\t\t\t\t\t\tcommentCreatedDateParsedFull: moment(el.updated || \"\").format('LLLL')\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\titems = generateCommentsHtml(items).join(\"\");\n\n\t\t\t\t\t\t\toldObj$ = $(dataItem.finalHTML);\n\t\t\t\t\t\t\toldObj$.find(\".ASWidgetcommentsList\").html(items);\n\n\t\t\t\t\t\t\tdataItem.finalHTML = oldObj$.get(0).outerHTML;\n\t\t\t\t\t\t\t$(pObject).parents(\".ASWidgetcommentsList\").first().html(items);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}).fail(function(jqXHR) {\n\t\t\t\t\t\tif (403 === jqXHR.status) {\n\t\t\t\t\t\t\tcurrentBtn$.remove();\n\t\t\t\t\t\t\tX.T.notifyError(localizeString(\"ASWidget-comments-no-permission\", \"You do not have permission to load further comments.\"), titleError);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tX.T.notifyError(localizeString(\"ASWidget-comments-request-failed\", \"Requesting further comments has failed [request error]\"), titleError);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".ASWidget-Stream-Showmore\").on(\"click\", function() {\n\t\t\t\tvar searchQueryText,\n\t\t\t\t\tlastItemTimeStamp;\n\t\t\t\tshowMoreMode = true;\n\t\t\t\t(function appendTimeStampToQueryAndRefresh() {\n\t\t\t\t\tsearchQueryText = jContainer.find(\".searchInputBox\");\n\t\t\t\t\tlastItemTimeStamp = jContainer.find(\".streamItems li .ActivityStreamWidgetPost\").last().data().date || \"\";\n\t\t\t\t\tgetActivityStreamEntries(currentActivityStreamType, lastLoadedFeedType, (jContainer.find(\".ASWidgetSearchStreamDiv\").is(\":visible\") && searchQueryText.val().length) ? searchQueryText : undefined, lastItemTimeStamp, true);\n\t\t\t\t}\n\t\t\t\t());\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".ASWidgetSaveSelectedPost\").on(\"click\", function(event) {\n\t\t\t\tvar dataItem,\n\t\t\t\t\tdataObject,\n\t\t\t\t\tnewSavedState,\n\t\t\t\t\tsaveBTN$;\n\n\t\t\t\tcheckEvent(event);\n\t\t\t\tdataItem = getRelationObject(event);\n\t\t\t\tdataObject = $(event.target).parents(\".ActivityStreamWidgetPost\").first();\n\t\t\t\tnewSavedState = !(\"true\" === dataObject.attr(\"saved\"));\n\t\t\t\tsaveBTN$ = $(event.currentTarget);\n\n\t\t\t\ttoggleSaveEvent(dataItem.id, newSavedState, function(successfully) {\n\t\t\t\t\tif (!successfully) {\n\t\t\t\t\t\tX.T.notifyError(((newSavedState) ? localizeString(\"ASWidget-save-post-fail\", 'Saving your content has failed. [request error]') : localizeString(\"ASWidget-unsave-post-fail\", \"Unsaving your content has failed [request error].\")), titleError);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tdataObject.attr(\"saved\", newSavedState.toString());\n\t\t\t\t\tsaveBTN$.text(newSavedState ? localizeString(\"ASWidget-streamitems-dontsave\", \"Don't save\") : localizeString(\"ASWidget-streamitems-save\", \"Save\"));\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".LikeX\").on(\"click\", function(event) {\n\t\t\t\tvar dataItem,\n\t\t\t\t\tthis$,\n\t\t\t\t\tLikedState,\n\t\t\t\t\tdataSplit,\n\t\t\t\t\trollUpId,\n\t\t\t\t\tlikerCache,\n\t\t\t\t\tlikersForThisItem,\n\t\t\t\t\titemsToShow;\n\n\t\t\t\tcheckEvent(event);\n\t\t\t\tdataItem = getRelationObject(event);\n\t\t\t\tthis$ = $(event.currentTarget);\n\t\t\t\tLikedState = (\"true\" === this$.parents(\".ActivityStreamWidgetPost\").first().attr(\"liked\"));\n\t\t\t\tdataSplit = assertChain(dataItem, \"connections.likeService\") ? replaceIt(dataItem.connections.likeService, \"/likes\", \"\").split(\"/\") : [];\n\t\t\t\trollUpId = dataSplit[dataSplit.length - 1] || dataItem.connections.rollupid;\n\t\t\t\tlikerCache = assertChain(dataItem, \"LikerCache\");\n\t\t\t\tlikersForThisItem = (likerCache && dataItem.LikerCache[rollUpId]) ? dataItem.LikerCache[rollUpId] : false;\n\t\t\t\titemsToShow = \"No items\";\n\n\t\t\t\tif (likerCache && likersForThisItem) {\n\t\t\t\t\titemsToShow = dataItem.LikerCache[rollUpId];\n\n\t\t\t\t\tif (itemsToShow.LikerArr.length) {\n\t\t\t\t\t\tshowLikePopover(itemsToShow.LikerArr, LikedState, this$);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdataItem.LikerCache = [];\n\t\t\t\t\tloadLikers(rollUpId, function(loadedLikers) {\n\t\t\t\t\t\tif (loadedLikers.LikerArr.length) {\n\t\t\t\t\t\t\titemsToShow = loadedLikers;\n\t\t\t\t\t\t\tdataItem.LikerCache[rollUpId] = itemsToShow;\n\t\t\t\t\t\t\tshowLikePopover(itemsToShow.LikerArr, LikedState, this$);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tshowLikePopover(false, false, this$);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn false;\n\n\t\t\t});\n\n\n\t\t\tjContainer.find(\".PostCurrentComment\").on(\"click\", function(event) {\n\t\t\t\tvar this$,\n\t\t\t\t\ttextField$,\n\t\t\t\t\ttoPostComment,\n\t\t\t\t\ttoGenObj,\n\t\t\t\t\trelatedObj,\n\t\t\t\t\toldObj$,\n\t\t\t\t\tnewItem,\n\t\t\t\t\tdomElement$;\n\n\t\t\t\tcheckEvent(event);\n\n\t\t\t\tthis$ = $(this);\n\t\t\t\ttextField$ = this$.parents().eq(3).find(\"textarea\");\n\t\t\t\ttoPostComment = textField$.val();\n\n\t\t\t\tif (!toPostComment.length) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ttextField$.prop(\"disabled\", true);\n\n\t\t\t\trelatedObj = getRelationObject(event);\n\t\t\t\toldObj$ = $(relatedObj.finalHTML);\n\t\t\t\tdomElement$ = this$.parents(\".ActivityStreamWidgetMetaChunk\").first().find(\".ASWidgetcommentsSection\");\n\n\n\t\t\t\tpostComment(toPostComment, relatedObj.connections.rollupid, function(createdEntry, successfully) {\n\t\t\t\t\tif (!successfully) {\n\t\t\t\t\t\tX.T.notifyError(localizeString(\"ASWidget-comment-post-fail\", 'Posting your comment has failed [request error]'), titleError);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\ttoGenObj = {\n\t\t\t\t\t\tAuthor: {\n\t\t\t\t\t\t\tFullName: ownProfile.getName(),\n\t\t\t\t\t\t\tProfileUrl: ownProfile.ownProfileUrl,\n\t\t\t\t\t\t\tPictureUrl: ownProfile.ownPictureUrl\n\t\t\t\t\t\t},\n\t\t\t\t\t\tComment: {\n\t\t\t\t\t\t\tEventId: createdEntry.entry.author.id,\n\t\t\t\t\t\t\tId: createdEntry.entry.id,\n\t\t\t\t\t\t\tiLiked: false,\n\t\t\t\t\t\t\tisLikable: true,\n\t\t\t\t\t\t\tLikesAmountTotal: 0,\n\t\t\t\t\t\t\tCreatedDateParsedFull: X.T.parseAtomDate(createdEntry.entry.published),\n\t\t\t\t\t\t\tCreatedDateFull: formatDate(X.T.parseAtomDate(createdEntry.entry.published)),\n\t\t\t\t\t\t\tContent: toPostComment\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tnewItem = generateSingleComment(toGenObj);\n\t\t\t\t\tdomElement$.show().find(\".ASWidgetcommentsList\").append(newItem);\n\t\t\t\t\toldObj$.find(\".ASWidgetcommentsList\").append(newItem); // modify object\n\t\t\t\t\trelatedObj.finalHTML = oldObj$.get(0).outerHTML;\n\t\t\t\t\tbindLikeCommentEvents();\n\t\t\t\t\tbindCommentShowLikesEvents();\n\t\t\t\t\ttextField$.val(\"\");\n\t\t\t\t\ttextField$.prop(\"disabled\", false);\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t\treturn false;\n\n\t\t\t});\n\n\t\t\tjContainer.find('.oM-entryItem-CommentToggleWrapper').on('click', function(event) {\n\t\t\t\tvar this$ = $(event.currentTarget).hide(),\n\t\t\t\t\tactionLi$ = this$.parents('.oM-Actions'),\n\t\t\t\t\tactionDiv$ = actionLi$.find('.ActivityStreamWidgetActions');\n\n\t\t\t\tactionLi$.find('.ASWidgetcommentsSection').hide();\n\t\t\t\tactionLi$.find('.shareCurrentCommentDiv').hide();\n\t\t\t\tactionLi$.find('.oM-CommentAction').show();\n\t\t\t\tactionLi$.append(actionDiv$.clone(true));\n\t\t\t\tactionDiv$.remove();\n\t\t\t});\n\n\t\t\tjContainer.find(\".CommentAction\").on(\"click\", function(event) {\n\t\t\t\tvar this$,\n\t\t\t\t\tshareCurrentCommentDiv$,\n\t\t\t\t\tactionDiv$;\n\n\t\t\t\tcheckEvent(event);\n\t\t\t\tthis$ = $(event.currentTarget);\n\t\t\t\tactionDiv$ = this$.parents('.ActivityStreamWidgetActions');\n\t\t\t\tshareCurrentCommentDiv$ = savedSettings.useDefaultStyle ? this$.parents().eq(3).find(\".shareCurrentCommentDiv\") : this$.parents('.oM-Actions').find('.shareCurrentCommentDiv');\n\n\t\t\t\texpandItem(this$.parents(\".ActivityStreamWidgetPost\").first());\n\n\t\t\t\tif (savedSettings.useDefaultStyle) {\n\t\t\t\t\tthis$.remove();\n\t\t\t\t} else {\n\t\t\t\t\tthis$.hide();\n\t\t\t\t\tactionDiv$.find('.oM-entryItem-CommentToggleWrapper').show();\n\t\t\t\t\tshareCurrentCommentDiv$.after(actionDiv$);\n\t\t\t\t}\n\n\t\t\t\tthis$.parents('.oM-Actions').find('.ASWidgetcommentsSection').show();\n\t\t\t\tshareCurrentCommentDiv$.slideToggle();\n\n\t\t\t\tif (shareCurrentCommentDiv$.val() === localizeString(\"ASWidget-comment-placeholder\", \"Add a comment...\")) {\n\t\t\t\t\tshareCurrentCommentDiv$.val(\"\");\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".FollowAction\").on(\"click\", function(event) {\n\t\t\t\tvar dataItem,\n\t\t\t\t\tdataObject,\n\t\t\t\t\tnewFollowingState,\n\t\t\t\t\tstoryId,\n\t\t\t\t\tfollowBTN$;\n\n\t\t\t\tcheckEvent(event);\n\t\t\t\tdataItem = getRelationObject(event);\n\t\t\t\tdataObject = $(event.target).parents(\".ActivityStreamWidgetPost\").first();\n\t\t\t\tnewFollowingState = !(\"true\" === dataObject.attr(\"followed\"));\n\t\t\t\tstoryId = dataItem.id;\n\t\t\t\tfollowBTN$ = $(event.currentTarget);\n\n\t\t\t\tstopFollowing(storyId, function(successfully, hasEntries) {\n\t\t\t\t\tif (!successfully) {\n\t\t\t\t\t\tX.T.notifyError(localizeString(\"ASWidget-following-stop-fail\", 'Stopping to unfollow has failed. [request error]'), titleError);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (!hasEntries) {\n\t\t\t\t\t\tX.T.notifySuccess(localizeString(\"ASWidget-following-noItems\", \"You are not currently following any items for this story..\"), localizeString('ASWidget-notificationTitle_succes', 'Success'));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfollowBTN$.remove();\n\t\t\t\t\t\tdataObject.attr(\"followed\", newFollowingState.toString());\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".RepostAction\").on(\"click\", function(event) {\n\t\t\t\tcheckEvent(event);\n\t\t\t\trePostEvent(getRelationObject(event).id, function(successfully) {\n\t\t\t\t\tif (!successfully) {\n\t\t\t\t\t\tX.T.notifyError(localizeString(\"ASWidget-repost-fail\", 'Reposting has failed [request error]'), titleError);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tW.setTimeout(refreshResults, 800);\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t// START bindCommentShowLikesEvents\n\t\t\tfunction bindCommentShowLikesEvents() {\n\t\t\t\tjContainer.find(\".CommentShowLikes\").unbind('click').on(\"click\", function(event) {\n\t\t\t\t\tvar dataItem,\n\t\t\t\t\t\tthis$,\n\t\t\t\t\t\tdataObject,\n\t\t\t\t\t\trollUpID,\n\t\t\t\t\t\tLikedState,\n\t\t\t\t\t\tlikerCache,\n\t\t\t\t\t\tlikersForThisItem,\n\t\t\t\t\t\titemsToShow;\n\n\t\t\t\t\tcheckEvent(event);\n\t\t\t\t\tdataItem = getRelationObject(event);\n\t\t\t\t\tthis$ = $(event.currentTarget);\n\t\t\t\t\tdataObject = $(event.target).parents(\".ASWidget-Comment\").first();\n\t\t\t\t\trollUpID = dataObject.attr(\"commentid\") || \"0\";\n\t\t\t\t\tLikedState = (\"true\" === dataObject.attr(\"liked\"));\n\t\t\t\t\tlikerCache = assertChain(dataItem, \"CommentLikerCache\");\n\t\t\t\t\tlikersForThisItem = (likerCache && dataItem.CommentLikerCache[rollUpID]) ? dataItem.CommentLikerCache[rollUpID] : false;\n\t\t\t\t\titemsToShow = \"No items\";\n\n\t\t\t\t\tif (likerCache && likersForThisItem && likersForThisItem.LikerArr && (likersForThisItem.LikerArr.length > 0)) {\n\t\t\t\t\t\titemsToShow = dataItem.CommentLikerCache[rollUpID];\n\t\t\t\t\t\tif (itemsToShow.LikerArr.length) {\n\t\t\t\t\t\t\tshowLikePopover(itemsToShow.LikerArr, LikedState, this$);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdataItem.CommentLikerCache = [];\n\t\t\t\t\t\tloadLikers(rollUpID, function(loadedLikers) {\n\t\t\t\t\t\t\tif (loadedLikers.LikerArr.length) {\n\t\t\t\t\t\t\t\titemsToShow = loadedLikers;\n\t\t\t\t\t\t\t\tdataItem.CommentLikerCache[rollUpID] = itemsToShow;\n\t\t\t\t\t\t\t\tshowLikePopover(itemsToShow.LikerArr, LikedState, this$);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tshowLikePopover(false, false, this$);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t}\n\n\n\t\t\t// END bindCommentShowLikesEvents\n\n\t\t\tbindCommentShowLikesEvents();\n\t\t\tbindLikeCommentEvents();\n\n\n\t\t\tjContainer.find(\".LikeAction\").on(\"click\", function(event) {\n\t\t\t\tvar dataItem,\n\t\t\t\t\tthis$,\n\t\t\t\t\tdataObject,\n\t\t\t\t\tnewLikedState,\n\t\t\t\t\tlikeObject$,\n\t\t\t\t\toldLikeCount,\n\t\t\t\t\tlikerBtn$,\n\t\t\t\t\teventId,\n\t\t\t\t\tnewLikeCount;\n\n\t\t\t\tcheckEvent(event);\n\t\t\t\tdataItem = getRelationObject(event);\n\t\t\t\tthis$ = $(event.currentTarget);\n\t\t\t\tdataObject = $(event.target).parents(\".ActivityStreamWidgetPost\").first();\n\t\t\t\tnewLikedState = !(\"true\" === dataObject.attr(\"liked\"));\n\t\t\t\tlikeObject$ = savedSettings.useDefaultStyle ?\n\t\t\t\t\tthis$.parents(\"[aria-label=ASWidgetPostActionDiv]\").first().find(\".ASWidgetCurrentPostLikes\") :\n\t\t\t\t\tthis$.parents('.oM-actionDiv').find('.ASWidgetCurrentPostLikes'),\n\n\t\t\t\toldLikeCount = parseInt(likeObject$.text());\n\t\t\t\tlikerBtn$ = this$.parents(\"[aria-label=ASWidgetPostActionDiv]\").first().find(\".LikeX\");\n\t\t\t\teventId = this$.attr(\"eventid\");\n\n\t\t\t\ttoggleLikeEvent(eventId, dataItem.connections.rollupid, newLikedState, function(successfully) {\n\t\t\t\t\tif (!successfully) {\n\t\t\t\t\t\tX.T.notifyError((newLikedState ? localizeString(\"ASWidget-like-fail\", 'Liking the event has failed [request error]') : localizeString(\"ASWidget-unlike-fail\", \"Unlike the event has failed [request error]\")), titleError);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (newLikedState) {\n\t\t\t\t\t\tlikeObject$.text(oldLikeCount + 1);\n\t\t\t\t\t\tlikerBtn$.show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewLikeCount = (oldLikeCount > 0 ? oldLikeCount - 1 : 0);\n\t\t\t\t\t\tif (1 === oldLikeCount) {\n\t\t\t\t\t\t\tlikerBtn$.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlikeObject$.text(newLikeCount.toString());\n\t\t\t\t\t}\n\n\t\t\t\t\tif (savedSettings.useDefaultStyle) {\n\t\t\t\t\t\tthis$.text(newLikedState ? localizeString(\"ASWidget-streamitems-unlike\", \"Unlike\") : localizeString(\"ASWidget-streamitems-like\", \"Like\"));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlikeObject$.parents('.LikeX')\n\t\t\t\t\t\t\t.find('i')\n\t\t\t\t\t\t\t.removeAttr('class')\n\t\t\t\t\t\t\t.addClass((0 === newLikeCount || !newLikedState) ? 'fa fa-heart-o' : 'fa fa-heart');\n\t\t\t\t\t}\n\n\t\t\t\t\tdataObject.attr(\"liked\", newLikedState.toString());\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\n\t\t\tjContainer.find(\".postActionBox\").on(\"click\", function(event) {\n\t\t\t\texpandItem($(event.currentTarget).parents(\".ActivityStreamWidgetPost\").first());\n\t\t\t\tshowEE(event);\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\tjContainer.find(\".normalPostEntryItem\").on(\"click\", function(event) {\n\t\t\t\tif (\"normalPostEntryItem\" === $(event.currentTarget).attr(\"class\") && !$(event.target).is(\"a\") && !$(event.target).is(\"i\") &&\n\t\t\t\t\t!$(event.target).is(\"textarea\") && !$(event.target).is(\"button\") && !$(event.target).is(\"video\") && !$(event.target).is(\"img\") &&\n\t\t\t\t\t!$(event.target).is(\"span\")) {\n\t\t\t\t\texpandItem($(event.currentTarget).parents(\".ActivityStreamWidgetPost\").first());\n\t\t\t\t\tshowEE(event);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tjContainer.find(\".streamItems li .ActivityStreamWidgetPost\").hover(function() {\n\t\t\t\t$(this).find(\".postActionBox\").css(\"visibility\", \"visible\");\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\t\tfunction() {\n\t\t\t\t\t$(this).find(\".postActionBox\").css(\"visibility\", \"hidden\");\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t}", "function addListeners() {\n //get the elements to add listener and change image\n let cardContainers = Array.from($(\".col-md-3\"));\n addEvents(cardContainers, 'image/jazz-music-rubber-duck.jpg', 'mouseover');\n addEvents(cardContainers, 'image/question.png', 'mouseout');\n }", "function addEvents(cardContainers, imgPath, listenerType) {\n cardContainers.forEach((cc) => {\n let card = cc;\n //create listener which will call function change the image\n let listener = function (event) {\n let cardImg = card.querySelector(\".card .card-img-top\");\n changeImage(cardImg, imgPath);\n };\n cc.addEventListener(listenerType, listener);\n });\n }", "publish(event, args = {}) {\n const {round, clickCount} = this;\n const data = Object.assign({round, clickCount}, args);\n\n EventManager.publish(event, data);\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "constructor() {\n this.eventPool = {}\n }", "trigger(eventName) {\n if(this.events[eventName]){\n this.events[eventName].forEach(callback => {\n callback();\n })\n }\n }", "function raisePHPEvent(eventname)\n{\n var args = new Array();\n var args2 = new Array();\n \n if (arguments) {\n args = arguments;\n } else if (this.arguments) {\n args = this.arguments;\n }\n\n for (i=0; i< args.length; i++) {\n args2[i] = args[i];\n }\n \n if (typeof(jQuery) !== 'undefined') {\n $.post('transferevents.php', {'action': 'raise_event', 'eventname': eventname, 'arguments': JSONstring.make(args2)}, function (data) {_cjEventHandler(data)});\n } else if (typeof(Prototype) !== 'undefined') {\n new Ajax.Request('transferevents.php', {\n 'method': 'post',\n 'parameters': {'action': 'raise_event', 'eventname': eventname, 'arguments': JSONstring.make(args2)},\n onSuccess: function (data) {_cjEventHandler(data.responseJSON);}\n });\n } else {\n alert('You need JQuery or Prototype to raise php events');\n }\n}" ]
[ "0.6496375", "0.63010883", "0.5960383", "0.5890177", "0.5843974", "0.5827947", "0.5778853", "0.57435614", "0.5645402", "0.56397086", "0.55770916", "0.55728555", "0.5566734", "0.5565772", "0.55490434", "0.55484766", "0.55384415", "0.5507436", "0.5482938", "0.54693615", "0.5421852", "0.5398207", "0.53950244", "0.5386248", "0.5359728", "0.5359144", "0.5350146", "0.53349966", "0.5334031", "0.5324368", "0.53145206", "0.5308267", "0.5308267", "0.5308267", "0.5308208", "0.52849865", "0.528478", "0.5281611", "0.5275622", "0.5264747", "0.52632433", "0.5238292", "0.5238292", "0.52373767", "0.52365047", "0.5192772", "0.5188494", "0.5183532", "0.5181609", "0.5176955", "0.5163066", "0.5145881", "0.514289", "0.5136403", "0.5127046", "0.5115966", "0.5114794", "0.51125866", "0.51117945", "0.51111037", "0.5105416", "0.5101731", "0.51000404", "0.5095073", "0.5087903", "0.50870395", "0.5083954", "0.50824803", "0.5082342", "0.5082342", "0.50811136", "0.50779957", "0.50741065", "0.5071842", "0.50676674", "0.50626844", "0.50575566", "0.5056306", "0.50499916", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.5042802", "0.503899", "0.5036926", "0.5035701" ]
0.0
-1
! jQuery UI Spinner 1.12.1 Copyright jQuery Foundation and other contributors Released under the MIT license. >>label: Spinner >>group: Widgets >>description: Displays buttons to easily input numbers via the keyboard or mouse. >>docs: >>demos: >>css.structure: ../../themes/base/core.css >>css.structure: ../../themes/base/spinner.css >>css.theme: ../../themes/base/theme.css
function spinnerModifer( fn ) { return function() { var previous = this.element.val(); fn.apply( this, arguments ); this._refresh(); if ( previous !== this.element.val() ) { this._trigger( "change" ); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function customSpinner() {\n\t$(\".spinner\").spinner({\n\t\tnumberFormat: \"n\",\n\t\tmin: 0\n\t});\n}", "_initQuantitySpinner() {\n $('#spinnerQuantity').spinner();\n }", "function loading() {\n\n var opts = {\n lines: 13, // The number of lines to draw\n length: 7, // The length of each line\n width: 4, // The line thickness\n radius: 10, // The radius of the inner circle\n corners: 1, // Corner roundness (0..1)\n rotate: 0, // The rotation offset\n color: '#000', // #rgb or #rrggbb\n speed: 1, // Rounds per second\n trail: 60, // Afterglow percentage\n shadow: false, // Whether to render a shadow\n hwaccel: false, // Whether to use hardware acceleration\n className: 'spinner', // The CSS class to assign to the spinner\n zIndex: 2e9, // The z-index (defaults to 2000000000)\n top: 'auto', // Top position relative to parent in px\n left: 'auto' // Left position relative to parent in px\n };\n\n var target = document.getElementById('spinner');\n var spinner = new Spinner(opts).spin(target);\n\n}", "function _createSpinner(context, name, type, min = 1, max = 12) {\n var spinner = \"<div class=\\\"\" + type + \" float\\\">\"; // Opening Div\n // Top \"Spinner\" Arrow\n spinner += \"<span class=\\\"up spin_control\\\" id=\\\"\"\n + name + \"_\" + type +\"_up\\\"></span>\";\n // Input field to hold the number\n spinner += \"<input type=\\\"number\\\" min=\\\"1\\\" max=\\\"12\\\"\" +\n \" value=\\\"1\\\" class=\\\"float\\\" id=\\\"\" + name + \"_\" + type + \"\\\"/>\";\n // Bottom \"Spinner\" Arrow\n spinner += \"<span class=\\\"down spin_control\\\" id=\\\"\" + \n name + \"_\" + type + \"_down\\\"></span>\";\n spinner += \"</div>\"; // Closing Div\n\n // Append all \"Spinner\" elements to the control passed in the context\n $(context).append(spinner);\n\n // Increment Function\n $(\"#\" + name + \"_\" + type +\"_up\").click(function(){\n incVal(\"#\" + name + \"_\" + type, max, min);\n updateTime(name);\n });\n\n // Decrement Function\n $(\"#\" + name + \"_\" + type + \"_down\").click(function(){\n decVal(\"#\" + name + \"_\" + type, min, max);\n updateTime(name);\n });\n }", "function createSpin() {\n __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.each(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(spinnerSelector), function (index, spinner) {\n __WEBPACK_IMPORTED_MODULE_0_jquery___default()(spinner).TouchSpin({\n verticalbuttons: true,\n verticalupclass: 'material-icons touchspin-up',\n verticaldownclass: 'material-icons touchspin-down',\n buttondown_class: 'btn btn-touchspin js-touchspin js-increase-product-quantity',\n buttonup_class: 'btn btn-touchspin js-touchspin js-decrease-product-quantity',\n min: parseInt(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(spinner).attr('min'), 10),\n max: 1000000\n });\n });\n}", "function spinner_start() {\n $(\"#refreshicon\").addClass(\"spin\");\n }", "function initLoadingSpinner() {\n // Using jQuery instead of $ due to a conflict with Prototype in the forums and on main site.\n \n jQuery('.button.loader').append('<span class=\"loading\" style=\"display:block;\"></span>');\n jQuery('span.loading').hide();\n var isLoading = 0;\n jQuery('.button.loader button').not('.disabled').click(function(){\n var parent = jQuery(this).parent('.button.loader');\n if(isLoading == 0){\n parent.find('.button-content *').addClass('invisible');\n parent.find('span.loading').show();\n parent.addClass('inprogress');\n isLoading++\n }\n });\n jQuery('a.button.loader').not('.disabled').click(function(){\n var parent = jQuery(this).parent('.button.loader');\n if(isLoading == 0){\n jQuery(this).find('.button-content *').addClass('invisible');\n jQuery(this).find('span.loading').show();\n parent.removeClass('inprogress');\n isLoading++\n }\n });\n}", "function spinner_modifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger(\"change\");}};}", "function loadSpinner() {\t\n\t\t\t// Only inject the spinner if the plugin has been loaded/exist\t\n\t\t\tif (window.Spinner) {\t\n\t\t\t\t// Ensures only one spinner is active at a time\n\t\t\t\tif (!$('#spinner').length) {$('body').append('<div id=\"spinner\"></div>');}\n\t\t\t\t\t\t\t\t\n\t\t\t\t// Spinner settings\n\t\t\t\tvar opts = {\n\t\t\t\t lines: 11, // The number of lines to draw\n\t\t\t\t length: 9, // The length of each line\n\t\t\t\t width: 5, // The line thickness\n\t\t\t\t radius: 12, // The radius of the inner circle\n\t\t\t\t corners: 0.4, // Corner roundness (0..1)\n\t\t\t\t color: '#a87fc6', // #rgb or #rrggbb or array of colors\n\t\t\t\t className: 'spinner', // The CSS class to assign to the spinner\n\t\t\t\t top: '45%', // Top position relative to parent\n\t\t\t\t left: '55%' // Left position relative to parent\n\t\t\t\t};\n\t\t\t\tvar target = document.getElementById('spinner');\n\t\t\t\tvar spinner = new Spinner(opts).spin(target);\n\t\t\t}\n\t\t}", "function spinner_modifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger(\"change\")}}}", "function Plugin(element, options) {\n // References to DOM and jQuery versions of element.\n var el = element,\n $el = $(element),\n data = {},\n $content = $('.button-spinner-label', $el);\n \n options = $.extend({}, $.fn[pluginName].defaults, options);\n \n function init() {\n $el.data('buttonspinner', data);\n $el.addClass('button-spinner');\n // add a container for hide/show of button label\n if (!$content.length) {\n $el.html('<span class=\"button-spinner-label\">' + $el.html() + '</span>');\n $content = $('.button-spinner-label', $el);\n }\n }\n \n function start() {\n data.old_html = $el.html();\n $el.data('buttonspinner', data);\n\n outer_width = $el.outerWidth() + 'px';\n outer_height = $el.outerHeight() + 'px';\n\n $content.css('display', 'none');\n $el\n .css({\n 'height': outer_height,\n 'width': outer_width,\n })\n .addClass('spinning disabled')\n .spin({\n lines: 8, \n length: 3, \n radius: 5\n });\n }\n\n function stop() {\n $el\n .spin(false)\n .removeClass('spinning disabled');\n $content.css('display', 'inline');\n\n delete data.old_html;\n $el.data('buttonspinner', data);\n }\n \n /**\n * Destroy plugin.\n * Usage: $('#el').buttonspinner('destroy');\n */\n function destroy() {\n // Iterate over each matching element.\n $el.each(function() {\n var el = this;\n var $el = $(this);\n \n // Add code to restore the element to its original state...\n $el\n .css({\n 'height': '',\n 'width': '',\n })\n .removeClass('button-spinner')\n .html($content.html());\n \n // Remove Plugin instance from the element.\n $el.removeData('plugin_' + pluginName);\n $el.removeData(pluginName);\n });\n }\n \n init();\n \n // Expose methods of Plugin we wish to be public.\n return {\n destroy: destroy,\n start: start,\n stop: stop\n };\n }", "function spinner_modifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous !== this.element.val()){this._trigger(\"change\");}};}", "function initNumberSpinner1() {\n if (!$.fn.TouchSpin) { return; }\n var $el = $('.number-spinner1');\n $el.not('.has-spinner').TouchSpin({\n verticalbuttons: true,\n min: 0,\n max: 99999,\n step: $el.data('step') || 1,\n decimals: $el.data('decimals') || 0\n }).addClass('has-spinner');\n}", "function showSpinner(){\n \tspinTarget.show();\n\t\tspinner.spin(spinTarget[0]);\n }", "function startSpin(btn) {\n btn.data('orgtxt', btn.html());\n btn.css('width', btn.outerWidth());\n btn.html('<i class=\"fa fa-spinner fa-spin\"></i>');\n btn.prop(\"disabled\", true);\n}", "function spinner(action, location) {\n\t\tvar $spinner;\n\t\tvar spinner_class = '.wrap-spinner';\n\t\tif (location !== undefined) {\n\t\t\tspinner_class += '.js-spinner-' + location; \n\t\t}\n\n\t\t$spinner = $(spinner_class);\n\n\t\tswitch(action) {\n\t\t\tcase('on'):\n\t\t\t\t$spinner.removeClass('hidden');\n\t\t\t\tbreak;\n\n\t\t\tcase('off'):\n\t\t\t\t$spinner.addClass('hidden');\n\t\t\t\tbreak;\n\t\t}\n\t}", "function displayLoading (action) {\r\n\tvar divSpinner = $('#divSpinner');\r\n\tif (action == 'start') {\r\n\t\tif (divSpinner.length == 0) {\r\n\t\t\tvar opts = {\r\n\t\t\t\tlines: 11, // The number of lines to draw\r\n\t\t\t\tlength: 0, // The length of each line\r\n\t\t\t\twidth: 10, // The line thickness\r\n\t\t\t\tradius: 17, // The radius of the inner circle\r\n\t\t\t\tcorners: 1, // Corner roundness (0..1)\r\n\t\t\t\trotate: 0, // The rotation offset\r\n\t\t\t\tdirection: 1, // 1: clockwise, -1: counterclockwise\r\n\t\t\t\tcolor: '#fff', // #rgb or #rrggbb or array of colors\r\n\t\t\t\tspeed: 1, // Rounds per second\r\n\t\t\t\ttrail: 30, // Afterglow percentage\r\n\t\t\t\tshadow: true, // Whether to render a shadow\r\n\t\t\t\thwaccel: false, // Whether to use hardware acceleration\r\n\t\t\t\tclassName: 'spinner', // The CSS class to assign to the spinner\r\n\t\t\t\tzIndex: 2e9, // The z-index (defaults to 2000000000)\r\n\t\t\t\ttop: '50%', // Top position relative to parent\r\n\t\t\t\tleft: '50%' // Left position relative to parent\r\n\t\t\t};\r\n\r\n\t\t\tvar div = $(\"<div class='loadingAnimation' id='divSpinner' ></div>\");\r\n\t\t\tvar spinner = new Spinner(opts).spin(div[0]);\r\n\t\t\t$(document.body).append(div);\r\n\t\t\tcenterElement(div);\r\n\t\t} else {\r\n\t\t\tdivSpinner.show();\r\n }\r\n\r\n\t\t//Set spinner timeout, for 30 seconds\r\n\t\tsetTimeout(function () {\r\n\t\t\tdivSpinner.hide();\r\n\t\t}, 30000);\r\n\r\n\t //Support RTL style modifications in jquery UI\r\n\t\tif ($(\"body\").css(\"direction\").toLowerCase() == \"rtl\") {\r\n\t\t $('.spinner').css('left', '65%');\r\n\t\t}\r\n\r\n\t} else if (action == 'stop') {\r\n\t\tdivSpinner.hide();\r\n\t}\r\n}", "function initNumberSpinner() {\n if (!$.fn.TouchSpin) { return; }\n var $el = $('.number-spinner');\n $el.not('.has-spinner').TouchSpin({\n verticalbuttons: true,\n min: 0,\n max: 99999,\n step: $el.data('step') || .25,\n decimals: $el.data('decimals') || 2\n }).addClass('has-spinner');\n}", "function startSpin () {\t\t\n\t\t// start each reel spinning\n\t\t$('.slot-one').addClass('spinning1');\n\t\t$('.slot-two').addClass('spinning2');\n\t\t$('.slot-three').addClass('spinning3');\t\t\n\t\t// stop reels\n\t\tstopSpin();\n\t}", "function _createSpinner() {\n this.spinner = new ImageSurface({\n size: [36, 36],\n properties: {\n display: 'none'\n }\n });\n \n this.spinner.setContent('./img/spinner.gif');\n \n this.spinnerMod = new Modifier({\n origin: [0.5, 0.5]\n });\n \n this._add(this.spinnerMod).add(this.spinner);\n}", "function addSpinner () {\n spinner = new CanvasLoader(\"spinner\");\n spinner.setShape(\"spiral\");\n spinner.setDiameter(90);\n spinner.setDensity(90);\n spinner.setRange(1);\n spinner.setSpeed(4);\n spinner.setColor(\"#333333\");\n // As its hidden and not rendering by default we have to call its show() method\n spinner.show();\n // We use the jQuery fadeIn method to slowly fade in the preloader\n $(\"#spinner\").fadeIn(\"slow\");\n }", "function Spinner(props) {\n var className = props.className,\n style = props.style,\n assistiveText = props.assistiveText,\n isVisible = props.isVisible,\n size = props.size,\n variant = props.variant,\n type = props.type,\n children = props.children;\n var currentSize = (0, _getSizeValue[\"default\"])(size);\n\n if (isVisible) {\n if (type === 'arc') {\n return _react[\"default\"].createElement(_spinnerContainer[\"default\"], {\n className: className,\n style: style\n }, _react[\"default\"].createElement(_arcSpinner[\"default\"], {\n viewBox: \"\".concat(0, \" \", 0, \" \", currentSize, \" \").concat(currentSize),\n size: size,\n variant: variant\n }, _react[\"default\"].createElement(\"circle\", {\n className: \"path\",\n cx: currentSize / 2,\n cy: currentSize / 2,\n r: (currentSize - 3) / 2,\n fill: \"none\",\n strokeWidth: \"3\"\n })), _react[\"default\"].createElement(_childContainer[\"default\"], null, children), _react[\"default\"].createElement(_AssistiveText[\"default\"], {\n text: assistiveText\n }));\n }\n\n return _react[\"default\"].createElement(_circleSpinner[\"default\"], {\n className: className,\n size: size,\n variant: variant,\n style: style\n }, _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(\"div\", null), _react[\"default\"].createElement(_childContainer[\"default\"], null, children), _react[\"default\"].createElement(_AssistiveText[\"default\"], {\n text: assistiveText\n }));\n }\n\n return null;\n}", "function spinnerCreated() {\r\n var btns = $(this).next();\r\n btns.addClass('feBtns').removeClass('spinerBtns');\r\n $('.spinBtnUp', btns).addClass('feBtn spinArrowUp');\r\n $('.spinBtnDown', btns).addClass('feBtn spinArrowDown');\r\n}", "function Spinner() {\n\treturn (\n\t\t<div style={{}}>\n\t\t<div className=\"lds-css ng-scope\">\n\t\t<div style={{width:\"100%\",height:\"100%\"}} className=\"lds-dual-ring\">\n\t\t<div>\n\t\t</div>\n\t\t</div>\n\t\t</div>\n\t\t</div>\n\t);\n}", "function addLoadingIcon(element) {\n var opts = {\n lines: 12, // The number of lines to draw\n length: 8, // The length of each line\n width: 4, // The line thickness\n radius: 10, // The radius of the inner circle\n corners: 1, // Corner roundness (0..1)\n rotate: 0, // The rotation offset\n direction: 1, // 1: clockwise, -1: counterclockwise\n color: '#333', // #rgb or #rrggbb\n speed: 1, // Rounds per second\n trail: 60, // Afterglow percentage\n shadow: false, // Whether to render a shadow\n hwaccel: false, // Whether to use hardware acceleration\n className: 'spinner', // The CSS class to assign to the spinner\n zIndex: 2e9, // The z-index (defaults to 2000000000)\n top: 'auto', // Top position relative to parent in px\n left: 'auto' // Left position relative to parent in px\n };\n\n return new Spinner(opts).spin(element);\n }", "function spinnerModifer(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger(\"change\");}};}", "function spinnerModifer(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger(\"change\");}};}", "function spinnerModifer(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger(\"change\");}};}", "function spinnerModifer(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous !== this.element.val()){this._trigger(\"change\");}};}", "function set_loading_spinner(button, spinner) {\n button.prop('disabled', true);\n\n // First, figure out by how much the button needs to be lengthened.\n var width = button.width();\n var obj = {width: 0};\n\n // Do the transformation.\n var transform = anime({\n targets: obj,\n width: spinner.outerWidth(true),\n round: 1,\n easing: 'easeInOutQuart',\n update: function() {\n button.width(width + obj.width);\n },\n complete: function(anim) {\n spinner.show();\n }\n });\n}", "function makeSpin(elem) {\n\n return spinner;\n}", "function showSpinner() {\n\t\t$('.spinner').show();\n\t}", "render() {\n return (\n <div className=\"spinner__container\">\n <div className=\"spinner\">\n <span className=\"spinner-inner-1\"></span>\n <span className=\"spinner-inner-2\"></span>\n <span className=\"spinner-inner-3\"></span>\n </div>\n </div>\n )\n }", "function changeSpinner(element, state) {\n if (state == 'show' || state == 'display') {\n $($(element).find('.rest-scaffold-spinner')[0]).show();\n } else {\n $($(element).find('.rest-scaffold-spinner')[0]).hide();\n }\n}", "function createSpinner(id, options) {\n jq(\"#\" + id).spinit(options);\n}", "function cartTouchSpin () {\n\tif($('.quantity-spinner').length){\n\t\t$(\"input.quantity-spinner\").TouchSpin({\n\t\t verticalbuttons: true\n\t\t});\n\t}\n}", "function cartTouchSpin() {\n if ($('.quantity-spinner').length) {\n $(\"input.quantity-spinner\").TouchSpin({\n verticalbuttons: true\n });\n }\n}", "function Spinner( size ) {\n\t\t// Set the size to an object if the size is a number\n\t\tif ( typeof size !== \"object\" ) { \n\t\t\tif ( !isNaN( size ) && isFinite( size ) ) { \n\t\t\t\tsize = { width: Number( size ), height: Number( size ) };\n\t\t\t} else { \n\t\t\t\tthrow new TypeError( \"The value must either be an object or a finite number.\" );\n\t\t\t}\n\t\t}\n\n\t\t// The current spinner instance\n\t\tconst sp = this;\n\n\t\t// The spinner element\n\t\tconst spinner = document.createElementNS( \"http://www.w3.org/2000/svg\", \"svg\" );\n\t\tspinner.classList.add( \"wds-spinner\", \"wds-spinner__block\" );\n\n\t\tconst spinnerAttr = Object.freeze( { \n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t\tviewBox: [ 0, 0, 66, 66 ].join( \" \" ),\n\t\t\txmlns: \"http://www.w3.org/2000/svg\"\n\t\t} );\n\n\t\tObject.getOwnPropertyNames( spinnerAttr )\n\t\t\t.forEach( function( property ) { \n\t\t\t\tconst value = spinnerAttr[ property ];\n\t\t\t\tspinner.setAttribute( property, value );\n\t\t\t} );\n\n\t\t// The grouping element\n\t\tconst g = document.createElementNS( \"http://www.w3.org/2000/svg\", \"g\" );\n\t\tg.setAttribute( \"transform\", \"translate(33, 33)\" );\n\n\t\t// The circle element\n\t\tconst c = document.createElementNS( \"http://www.w3.org/2000/svg\", \"circle\" );\n\t\tc.classList.add( \"wds-spinner__stroke\" );\n\n\t\tconst cAttr = Object.freeze( { \n\t\t\tfill: \"none\",\n\t\t\tr: 30,\n\t\t\t\"stroke-width\": 2,\n\t\t\t\"stroke-dasharray\": 188.49555921538757,\n\t\t\t\"stroke-dashoffset\": 188.49555921538757,\n\t\t\t\"stroke-linecap\": \"round\"\n\t\t} );\n\n\t\tObject.getOwnPropertyNames( cAttr )\n\t\t\t.forEach( function( property ) { \n\t\t\t\tconst value = cAttr[ property ];\n\t\t\t\tc.setAttribute( property, value );\n\t\t\t} );\n\t\t\n\t\t// Creates the spinner element\n\t\tg.append( c );\n\t\tspinner.append( g );\n\n\t\t// Returns the actual element\n\t\tsp.el = function( ) { \n\t\t\treturn spinner;\n\t\t};\n\n\t\t// Returns the outer html\n\t\tsp.html = function( ) { \n\t\t\treturn spinner.outerHTML;\n\t\t};\n\t}", "function spining() {\n const opts = {\n lines: 11, // The number of lines to draw\n length: 25, // The length of each line\n width: 9, // The line thickness\n radius: 25, // The radius of the inner circle\n scale: 1.5, // Scales overall size of the spinner\n corners: 1, // Corner roundness (0..1)\n color: '#ef6c57', // CSS color or array of colors\n fadeColor: 'transparent', // CSS color or array of colors\n speed: 0.7, // Rounds per second\n rotate: 19, // The rotation offset\n animation: 'spinner-line-fade-quick', // The CSS animation name for the lines\n direction: 1, // 1: clockwise, -1: counterclockwise\n zIndex: 2e9, // The z-index (defaults to 2000000000)\n className: 'spinner', // The CSS class to assign to the spinner\n top: '99%', // Top position relative to parent\n left: '50%', // Left position relative to parent\n shadow: '0 0 1px transparent', // Box-shadow for the lines\n position: 'absolute', // Element positioning\n };\n const target = document.getElementById('spinnerContainer');\n const spinner = new Spinner(opts).spin(target);\n setTimeout(() => {\n $('#spinnerContainer').css('display', 'none');\n }, 3000);\n }", "spinner() {\n return (\n <Spinner />\n );\n }", "function Loader(props) {\n return (\n <Spin\n delay={props.delay}\n indicator={props.indicator}\n size={props.size}\n spinning={props.spinning}\n tip={props.tip}\n wrapperClassName={props.wrapperClassName}\n />\n );\n}", "loading(value) {\n if (value) {\n //this.buttonElements.prop('disabled', true);\n //this.loadingContainer.fadeIn(250);\n console.log('animation start!');\n console.log(this.loadingContainer);\n this.spinner.spin(this.loadingContainer);\n }\n else {\n //this.buttonElements.prop('disabled', false);\n //this.loadingContainer.fadeOut(250);\n this.spinner.stop();\n }\n }", "function spinToggle (el, values, opt){\n opt = opt || {};\n var labels = opt.labels || values;\n delete opt.labels;\n\n if (values.length != 2)\n throw \"spinToggle: values must be an array with only two values! id=\" + el +', values='+values ;\n\n var options = {\n type\t\t\t: 'spinToggle',\n labels\t\t\t: labels,\n selectedClass \t: '',\n enableToggle \t: true,\n bounciness\t\t: 0,\n easingDuration\t: 50,\n spinClass\t\t: 'spinToggle',\n alignToEdge\t\t: true,\t\t// !important\n spinToClick\t\t: opt.enableToggle,\n\n _onchange : function(){\n //console.log(this.value + ' -- override onchange callback to do something useful!');\n }\n };\n if (opt.onOffStyle) options.spinClass += ' onOffStyle';\n for (var i in opt){\n options[i] = opt[i];\n }\n delete options.initialValue;\t// set it after layout adjustments\n\n var spin = new spinControl(el, values, options);\n\n // override click behavior\n spin.base_click = spin.click;\n spin.click = function(e){\n this.toggle();\n this.base_click(e);\n return false;\n };\n\n // insert thimble separator\n var thimble = document.createElement('span');\n thimble.className = spin.options.labelClass + ' thimbleClass';\n thimble.innerHTML = '';\n thimble = spin.labelsDiv.insertBefore(thimble, spin.labelsDiv.lastChild);\n\n // adjust size\n // labels have display:table-cell and setting width doesn't work! so adjust border width of smaller label!\n var amount = spin.labelsDiv.firstChild.offsetWidth - spin.labelsDiv.lastChild.offsetWidth,\n el = amount > 0 ? spin.labelsDiv.lastChild : spin.labelsDiv.firstChild;\n\n amount = Math.abs(amount);\n if (amount > 0) {\n var amountLeft = Math.floor(amount/2),\n amountRight = amount - amountLeft;\n el.style.paddingLeft = amountLeft + parseInt(getComputedStyle(el,null).getPropertyValue('padding-left')) + 'px';\n el.style.paddingRight = amountRight + parseInt(getComputedStyle(el,null).getPropertyValue('padding-right')) + 'px';\n }\n\n var v = parseInt(getComputedStyle(spin.thumb,null).getPropertyValue('padding-left'))\n + parseInt(getComputedStyle(spin.thumb,null).getPropertyValue('border-left-width')) ;\n\n var w = 2 * v /* 2 * thumb border or padding */\n + spin.labelsDiv.firstChild.offsetWidth\n + thimble.offsetWidth;\n spin.wrapper.style.width = w+'px';\n spin.refresh();\n spin.maxSlide = -spin.labelsDiv.firstChild.offsetWidth;\n spin.labelsDivWidth += 2*v;\n spin.onOrientation = function(){};\n\n // reset initial value after adjustments\n if ('initialValue' in opt) spin.setValue(opt.initialValue)\n else spin.setIndex(0);\n\n return spin;\n}", "showSpinner () {\n this.spinnerEl.classList.add('active');\n }", "function setSpinner(son, mom, base, speed){\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t// spin 360\r\n\tvar autospin, posXori = 1, mdown=false, posXori, tickAmount = speed, autoId = 0;\r\n\t \r\n\tfunction moveBack(){\r\n\t\ti++;\r\n\t\tif(i > spinMax - 1){\r\n\t\t\ti=0;\r\n\t\t}\r\n\t\tspinner(i)\r\n\t}\r\n\t\r\n\tfunction moveForward(){\r\n\t\ti--;\r\n\t\tif(i < 0){\r\n\t\t\ti = spinMax-1;\r\n\t\t}\r\n\t\tspinner(i);\r\n\t}\r\n\t\r\n\tmom.appendChild(son);\r\n\t\t\r\n\tspinner = function(sp){\r\n\t\t// spinner frame has all the to be spinner images on x gap space, so we can place them on x=spinId*image width, so we give illusion of spin, haha\r\n\t\t// display -none vs block- is too much on processor, using one div with images as train, moving x direction is so far, best to spin \r\n\t\tarrFrame[1].style.left = -gap*sp;\r\n\t\t//trace(sp)\r\n\t}\r\n\r\n}", "function showSpinner() {\n\t\t\tclear();\n\t\t\tdiv.update(spinner);\n\t\t\tspinnerVisible = true;\n\t\t\tmove();\n\t\t}", "function page_spinner_start() {\n $(document.createElement(\"div\")).attr('id','page_spinner').text('Working...').prependTo('body').show(100);\n}", "function showSpinner(field) {\t\r\n\tvar currentDivHeight = $('#plot-'+field).height();\r\n\t$('#plot-'+field).html('<div style=\"text-align:center;width:500px;height:'+currentDivHeight+'px;\"><img title=\"Loading...\" alt=\"Loading...\" src=\"'+app_path_images+'progress.gif\"></div>');\r\n}", "function blockSpin( element, options ) {\n this.element = element;\n this.options = $.extend( {}, defaults, options) ;\n this.data = $(this).data(); \n this.add();\n }", "function submit_confirm() {\n var opts = {\n lines: 12, // The number of lines to draw\n length: 7, // The length of each line\n width: 9, // The line thickness\n radius: 30, // The radius of the inner circle\n color: '#000', // #rgb or #rrggbb\n speed: 1, // Rounds per second\n trail: 60, // Afterglow percentage\n className: 'spinner', // The CSS class to assign to the spinner\n top: '0', // Top position relative to parent\n left: '0', // Left position relative to parent\n shadow: 'false', // Box-shadow for the lines\n position: 'fixed' // Element positioning\n };\n // 描画先の親要素\n var spin_target = document.getElementById('container');\n // スピナーオブジェクト\n var spinner = new Spinner(opts);\n // スピナー描画\n spinner.spin(spin_target); \n return true;\n}", "renderLoading() {\n // #2196F3 -> md-blue-500\n return (\n <div className=\"instancesSpinner\">\n <MDSpinner singleColor=\"#2196F3\" />\n </div>\n );\n }", "generateSpinnerElement()\n {\n let emptyDivKey = Object.keys(this.numberOfEmptyDivForSpinner).find(element => element === this.options.spinnerIcon);\n\n let emptyDivElement = this.generateEmptyDivElement(this.numberOfEmptyDivForSpinner[emptyDivKey]);\n\n this.spinner = `<div style=\"color: ${this.options.spinnerColor}\" class=\"la-${ this.options.spinnerIcon } la-${this.options.spinnerSize}\">${ emptyDivElement }</div>`\n }", "function addSpinner(selector, boolean) {\n $(selector)\n .prepend(`<span class=\"spinner-grow spinner-grow-sm\" role=\"status\" aria-hidden=\"true\"></span> `)\n .attr(\"disabled\", boolean);\n}", "function stopSpinner() {\n spin = false;\n stopButton.classList.add('display-none');\n inputContainer.classList.toggle('dynamic-height');\n createFormHolder();\n createInputRow();\n createDoneButton();\n}", "function spin() {\n\tvar $spinner = $('.spinner');\n var $spinnerCategory = $('.spinner-category');\n\tvar $spinnerTrigger = $('.spinner-trigger');\n\n\t$spinnerTrigger.click(function() {\n\t\tvar category = getRandomJSONIndex(categories);\n\t\tvar values = categories[category];\n\t\tvar chosen = getRandomFromArray(values);\n\n $spinner.html('');\n $spinnerCategory.text(category);\n\n // Create card that will be chosen\n $spinner.append('<div class=\"chosen card\">' + chosen + '</div>');\n var $chosenCard = $('.card.chosen');\n\n var cardsOnEachSide = 50;\n\n // Append other decoy cards\n for(var i = 0; i < cardsOnEachSide; i++) {\n var card = '<div class=\"card\">' + getRandomFromArray(values) + '</div>';\n $spinner.append(card);\n $chosenCard.before(card);\n }\n\n var $cards = $spinner.find('.card');\n var $lastCard = $cards.last();\n\n // Get width of decoy cards, so we know by how much we should slide\n var cardsWidth = 0;\n for(var i = 0; i < cardsOnEachSide - 1; i++) {\n cardsWidth += $cards.eq(i).outerWidth();\n }\n\n // Spin animation\n\n $lastCard.css('marginRight', cardsWidth * 2);\n $lastCard.animate({\n marginRight: 0,\n }, 3000, 'easeOutQuint', function() {\n $chosenCard.addClass('card-success');\n $chosenCard.animate({\n marginLeft : cardsWidth,\n marginRight: cardsWidth,\n });\n });\n\n\t});\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\t};\n}", "DisplaySpinn(){\n let spinn=this.state.dataSpinn[this.state.value]\n if (spinn>=0){\n return(\n <Icon2 name=\"spinner-rotate-forward\" size={spinn*4} color='green'/>\n )\n }else{\n return(\n <Icon2 name=\"spinner-rotate-forward\" size={spinn*4} color='red'/>\n )\n }\n }", "addSpinner(id)\n {\n let spinner = new CustomSpinner(id);\n document.getElementById(this.id + '-dialog').append(spinner.html());\n spinner.animate();\n }", "function addSpinner(node) {\r\n var spinner = document.createElement('span');\r\n spinner.classList.add('spinner');\r\n spinner.classList.add('tertiary');\r\n spinner.clientHeight = node.clientHeight;\r\n //spinner.style.float = 'left';\r\n node.append(spinner);\r\n}", "__toggleSpinnerButtonsState() {\n const { min, max } = this.values;\n this.__disableIncrementor = this.currentValue >= max && max !== Infinity;\n this.__disableDecrementor = this.currentValue <= min && min !== Infinity;\n this.setAttribute('aria-valuenow', this.currentValue);\n this.dispatchEvent(\n new CustomEvent('user-input-changed', {\n bubbles: true,\n }),\n );\n }", "function RateSpinner($rootScope, $timeout, APP_PATH){\n return {\n restrict: \"E\",\n templateUrl: APP_PATH.COMMON_WIDGETS + \"/rate-spinner/rate-spinner.template.html\",\n link: function($scope, element) {\n\n $scope.$on(\"startLoading\", function(event, data) {\n element.removeClass(\"ng-hide\");\n });\n\n $scope.$on(\"endLoading\", function(event, data) {\n element.addClass(\"ng-hide\");\n });\n }\n };\n }", "function spinner_modifier( fn ) {\n\treturn function() {\n\t\tvar previous = this.element.val();\n\t\tfn.apply( this, arguments );\n\t\tthis._refresh();\n\t\tif ( previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"onChange\" );\n\t\t}\n\t};\n}", "function startSpin(whatSpinner, direction)\n{\n\tdocument.thisLoop = setInterval(function ()\n\t{\n\t\tnextStep(whatSpinner, direction);\n\t}, 125); //125 ms\n}", "loader() {\n if (this.state.loader) {\n return (\n <View>\n <Spinner visible={this.state.loader} textContent={\"\"} textStyle={{ color: Colors.header_red }} color={Colors.header_red} />\n </View>\n )\n }\n }", "onSpinStart() {\n this.spinButton.prop( \"disabled\", true );\n console.log('Spinning');\n }", "function spinner($e, jqXHR) {\n var $spinner = $('<i>').addClass('spinner loading icon');\n $e.after($spinner).hide();\n jqXHR.always(function() {\n $spinner.remove();\n $e.show();\n });\n }", "function spinner_stop() {\n $(\"#refreshicon\").removeClass(\"spin\");\n }", "function stopSpinner(){\n $('.spinner-container').hide();\n}", "function startIconSpin(elem,icon,callback){\n\t$(elem).animate({width:\"0px\",opacity:0},{done:function(){\n $(elem).removeClass(icon).addClass('icon-refresh');\n $(elem).animate({width:\"15px\",opacity:1},{done:function(){\n $(elem).addClass('icon-animated-spinning');\n $(elem).addClass('animate-unlimited-times');\n\t\t\tif (callback!=undefined) callback();\n }});\n }});\n}", "function showLoadingSpinner() {\n $('.demo-loading')\n .css({'display': 'block', 'opacity': 0.1})\n .animate({'opacity' : 1}, 300);\n }", "function startSpinner() {\n let slot1 = document.getElementById('slot1');\n let slot2 = document.getElementById('slot2');\n let slot3 = document.getElementById('slot3');\n if (spin === true) {\n slot1.innerHTML = `${Math.floor(Math.random() * 8.999999) + 1}`;\n slot2.innerHTML = `${Math.floor(Math.random() * 9.999999)}`;\n slot3.innerHTML = `${Math.floor(Math.random() * 9.999999)}`;\n setTimeout(startSpinner, 100);\n } else {\n targetNum = parseInt(slot1.innerText + slot2.innerText + slot3.innerText);\n }\n}", "function __UI_FullPageLoadingSpinner() {\n\n /**\n * Object pointer\n * @type {__UI_FullPageLoadingSpinner}\n * @private\n */\n let self = this;\n\n /**\n * Loading spinner\n * @type {Spinner|null}\n * @private\n */\n this._loading_spiner = null;\n\n /**\n * Spinner status\n * @type {boolean}\n * @private\n */\n this._enabled = false;\n\n /**\n * Maximum duration of the event\n * @type {number}\n * @private\n */\n this._max_duration_spinner = cfg_max_time_loading_layer;\n\n /**\n * Thread ID\n * @type {number}\n * @private\n */\n this._max_duration_thread = 0;\n\n /**\n * Change function, is enabled after {@link cfg_init_loading_layer_after} milliseconds\n * @type {number}\n * @private\n */\n this._thread_change = -1;\n\n /**\n * Disable scroll lock\n * @type {boolean}\n * @private\n */\n this._scroll_lock = false;\n\n /**\n * Size of the loading box\n * @type {{width:number, height:number, mean:number}}\n * @private\n */\n this._size = {\n height: 75,\n mean: 0,\n width: 75,\n };\n this._size.mean = (self._size.width + self._size.height) / 2;\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Set spinner max duration time.\n *\n * @param {number} $seconds - Time in seconds, if 0 disable the cancel loading after max duration time\n */\n this.setMaxDuration = function ($seconds) {\n\n self._max_duration_spinner = $seconds * 1000;\n\n };\n\n /**\n * Show spinner.\n *\n * @param {string=} $message\n */\n this.start = function ($message) {\n\n if (isNullUndf($message)) $message = '';\n if (self._thread_change !== -1) return; // If waiting returns\n if (self._enabled) return; // If init returns\n self._thread_change = setTimeout(function () { // Create new thread\n if (!self._enabled) self._loadFullpageSpinner(true);\n self._thread_change = -1;\n }, cfg_init_loading_layer_after);\n self.setMessage($message);\n\n };\n\n /**\n * Stop spinner.\n */\n this.stop = function () {\n\n if (self._thread_change !== -1) {\n clearTimeout(self._thread_change);\n self._thread_change = -1;\n }\n self._loadFullpageSpinner(false);\n self.clearMessage();\n\n };\n\n /**\n * Clear current message.\n */\n this.clearMessage = function () {\n\n self.setMessage('');\n\n };\n\n /**\n * Set loading message.\n *\n * @param {string=} $message\n */\n this.setMessage = function ($message) {\n\n /** @type {jQuery} */ let $div = app_dom.body.find('#loading-div-layer-message');\n $div.hide();\n\n if (isNullUndf($message) || $message === '') {\n $div.empty();\n } else {\n $div.html($message);\n $div.show();\n let $width = $div.innerWidth();\n if ($width === 0) {\n setTimeout(function () {\n self.setMessage($message);\n }, 150);\n }\n $div.css('margin-left', 'calc((-{0}px + var(--loading-box-width)) / 2)'.format($div.innerWidth()));\n }\n\n };\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Set body cursor.\n *\n * @param {boolean=} $status - If true, show cursor\n */\n this.bodyCursor = function ($status) {\n if (isNullUndf($status)) $status = false;\n if ($status) {\n app_dom.body.css('cursor', 'wait');\n } else {\n app_dom.body.css('cursor', 'initial');\n }\n };\n\n /**\n * Show loading panel.\n *\n * @param {boolean} $checker - Set status\n * @param {Function=} $callback - Callback function\n * @private\n */\n this._loadFullpageSpinner = function ($checker, $callback) {\n /* eslint callback-return:\"off\" */\n\n let $h, $hh, $w, $posX, $posY;\n\n /**\n * Get page dimension\n */\n $h = app_dom.window.outerHeight();\n $hh = app_dom.body.outerHeight();\n $hh = Math.max($h, $hh) - 0.1;\n $w = app_dom.window.outerWidth();\n $posX = ($w - self._size.width) / 2;\n $posY = ($h - self._size.height) / 2;\n\n /**\n * --------------------------------------------------------------------\n * Show spinner\n * --------------------------------------------------------------------\n */\n if ($checker) {\n\n // Object has not been created\n if (isNullUndf(document.getElementById('loading-div-layer'))) {\n // App message\n app_console.info('Init loading layer');\n\n // Add object\n app_dom.body.prepend('<div id=\"loading-div-layer\" class=\"loading-div-layer-class noselect\"><div class=\"loading-foreground\"><div class=\"loading-box\"><div id=\"loading-div-layer-message\"></div><div id=\"spinner-spin\"></div></div></div><div class=\"loading-background\"></div></div>');\n let $opts = {// Init spinner\n animation: 'spinner-line-fade-more',\n className: 'spinner',\n color: app_theme.spinColor,\n corners: 0.95,\n direction: 1,\n fadeColor: 'transparent',\n left: '50%',\n length: self._size.mean / 2,\n lines: app_theme.spinLines,\n position: 'absolute',\n radius: 45,\n rotate: 0,\n scale: app_theme.spinScale,\n shadow: app_theme.spinShadow,\n speed: 1.0,\n top: '50%',\n width: 16,\n zIndex: 2e9,\n };\n /** @private */ this._spinner_container = document.getElementById('spinner-spin');\n // noinspection JSValidateTypes\n self._loading_spiner = new Spinner($opts);\n }\n\n // Change loadingLayer geometry\n let $loadinglayer = $('#loading-div-layer');\n // $loadinglayer.css('height', String(hh) + 'px');\n $loadinglayer.find('.loading-foreground').css('height', String($hh) + 'px');\n $loadinglayer.find('.loading-foreground .loading-box').css({\n 'left': $posX.toString() + 'px',\n 'top': $posY.toString() + 'px',\n });\n $loadinglayer.find('.loading-background').css('height', String($hh) + 'px');\n // noinspection JSValidateTypes\n $loadinglayer.fadeIn(350, function () {\n if (notNullUndf($callback)) $callback();\n });\n\n // Init spinner\n // noinspection JSUnresolvedFunction\n self._loading_spiner.spin(self._spinner_container);\n\n // Disable scroll\n if (app_dom.body.height() > app_dom.window.height()) {\n // noinspection JSUnresolvedVariable\n $.extScrollLock.enable('loading');\n self._scroll_lock = true;\n }\n\n // Init hide thread\n if (self._max_duration_spinner > 0) {\n self._max_duration_thread = setTimeout(function () {\n self.stop();\n self._max_duration_thread = 0;\n clearTimeout(self._thread_change);\n self._thread_change = -1;\n }, self._max_duration_spinner * 1000);\n } else {\n if (self._thread_change !== -1) {\n clearTimeout(self._thread_change);\n self._thread_change = -1;\n }\n }\n\n // Set as initialized\n self._enabled = true;\n\n }\n\n /**\n * --------------------------------------------------------------------\n * Hide spinner\n * --------------------------------------------------------------------\n */\n else {\n\n // Cancel timeout\n if (self._max_duration_thread !== 0) {\n clearTimeout(self._max_duration_thread);\n self._max_duration_thread = 0;\n }\n\n // Disable scrollock\n if (self._scroll_lock) {\n // noinspection JSUnresolvedVariable\n $.extScrollLock.disable('loading');\n self._scroll_lock = false;\n }\n\n // Hide object\n $('#loading-div-layer').hide();\n\n // Stop spinner\n if (notNullUndf(self._loading_spiner)) { // noinspection JSUnresolvedFunction\n self._loading_spiner.stop();\n }\n\n // Check as hidden\n self._enabled = false;\n\n // Trigger callback\n if (notNullUndf($callback)) $callback();\n }\n\n };\n\n /**\n * Add resize event.\n */\n app_dom.window.onReplace('resize.FullPageLoadingDivLayer', function ($e) {\n $e.preventDefault();\n if (!self._enabled) return;\n let $h, $hh, $w, $posX, $posY;\n if (document.getElementById('loading-div-layer') !== null) {\n $h = app_dom.window.outerHeight();\n $hh = app_dom.body.outerHeight();\n $hh = Math.max($h, $hh);\n $w = app_dom.window.outerWidth();\n $posX = ($w - self._size.width) / 2;\n $posY = ($h - self._size.height) / 2;\n let $loadinglayer = $('#loading-div-layer');\n\n /*\n $loadinglayer.css({\n height: hh.toString() + 'px',\n });\n */\n\n $loadinglayer.find('> .loading-foreground').css({\n height: $hh.toString() + 'px',\n });\n $loadinglayer.find('> .loading-background').css({\n height: $hh.toString() + 'px',\n });\n $loadinglayer.find('> .loading-foreground > .loading-box').css({\n left: $posX.toString() + 'px',\n });\n app_dom.body.find('.loading-box').css({\n 'left': $posX + 'px',\n 'top': $posY + 'px',\n });\n }\n\n });\n\n}", "function showLoadingSpinner(){\n loader.hidden = false;\n quoteContainer.hidden = true;\n}", "function animateSpinner(el, animation, complete) {\n if (el.data('animating')) {\n el.removeClass(el.data('animating')).data('animating', null);\n el.data('animationTimeout') && clearTimeout(el.data('animationTimeout'));\n }\n el.addClass('spinner-' + animation).data('animating', 'spinner-' + animation);\n el.data('animationTimeout', setTimeout(function () {\n animation == 'remove' && el.remove();\n complete && complete();\n }, parseFloat(el.css('animation-duration')) * 1000));\n}", "function clickSpinner(){\r\n if(open){\r\n clickMenuClose();\r\n }\r\n else{\r\n clickMenuOpen();\r\n }\r\n}", "function spinnerModifer( fn ) {\n return function() {\n var previous = this.element.val();\n fn.apply( this, arguments );\n this._refresh();\n if ( previous !== this.element.val() ) {\n this._trigger( \"change\" );\n }\n };\n}", "function loadingElement(element,tagClass=\"fa-2x mr-1\"){\n $(element).hide();\n\n let spinnerId = generateUniqueString('spinner-element');\n // let id = \"spinner-\"+generateUniqueString()\n let spinner = $( `<i id=\"${spinnerId}\" class='fa fa-spinner fa-spin ${tagClass}'></i>` ).insertAfter( $(element) );\n $(element).attr('data-spinner-id',spinnerId);\n}", "onSpinnerShown_() {\n if (this.scanInProgress_) {\n this.listContainer_.endBatchUpdates();\n this.listContainer_.startBatchUpdates();\n }\n }", "initBtn() {\n this.btn.setTexture(constants.BUTTON_SPIN.key);\n this.btnDisplay = \"Spin\";\n }", "function toggleSpinner(value) {\n $('#spinner-group, #spinner-backdrop').toggleClass('hidden',value);\n}", "function showBuildingUiIndicator()\n {\n $(document.body).addClass('spot_easy_mode_loading');\n\n insertProgressIndicator();\n\n updateProgressIndicator(\n 'Building UI <span id=\"spot_easy_mode_loader_progress\">0</span>%'\n );\n }", "function InitSpinner() {\n $(document).ajaxSend(function () {\n $('#divSpinner').show();\n }).ajaxComplete(function () {\n $('#divSpinner').hide();\n }).ajaxError(function (e, xhr) {\n // do something on ajax error\n });\n}", "function _showLoader() {\r\n spinner.classList.add('fa', 'fa-refresh', 'fa-spin');\r\n spinner.style.marginRight = \"8px\";\r\n }", "function showSpinner() {\n spinner.start();\n overlay.show();\n }", "function spinWheel() {\n // Rotate the spinner arrow\n rotation = (rotation + 12) % 360;\n arrow.setAttributeNS(null, \"transform\", \"rotate(\"+rotation+\",150,150)\");\n // Highlight the slice the arrow is above\n var newSlice = Math.floor(rotation / (360/numSlices));\n if (newSlice != currentSlice) {\n slices[currentSlice].toggleOverlay();\n slices[newSlice].toggleOverlay();\n currentSlice = newSlice;\n }\n}", "function LoadingIndicator() {\n this.el = this.build_();\n document.body.appendChild(this.el);\n this.show();\n}", "function LoadingIndicator() {\n this.el = this.build_();\n document.body.appendChild(this.el);\n this.show();\n}", "function showSpinnerInfinite() {\n button.style.display=\"none\";\n hide_show.style.display=\"none\";\n spinner.className = \"show\";\n setTimeout(() => {\n spinner.className = spinner.className.replace(\"show\", \"\");\n button.style.display=\"block\";\n hide_show.style.display=\"block\";\n }, 100000000);\n}", "function $loadingIndicator() {\n return $(\n [\n '<span class=\"search-loading fa fa-spinner fa-spin\" ',\n 'title=\"',\n _l(\"loading...\"),\n '\"></span>'\n ].join(\"\")\n )\n .hide()\n .tooltip({ placement: \"bottom\" });\n }", "function toggleSpinner(spinnerSelector, contentSelector) {\n $(spinnerSelector).addClass('d-none')\n $(contentSelector).removeClass('d-none')\n}", "toggleSpinner() {\r\n this.setState({\r\n showSpinner: !this.state.showSpinner\r\n });\r\n }" ]
[ "0.7480407", "0.72747725", "0.6951026", "0.6838331", "0.68114835", "0.66085505", "0.6585339", "0.65607965", "0.656062", "0.6557318", "0.655325", "0.65526116", "0.6364848", "0.6330671", "0.63282835", "0.63166267", "0.63128227", "0.6304382", "0.6275497", "0.6247222", "0.62465674", "0.6202072", "0.6191773", "0.61816716", "0.61562544", "0.6135372", "0.6135372", "0.6135372", "0.6132491", "0.60009354", "0.5995796", "0.5980735", "0.5966688", "0.59632504", "0.5961727", "0.5901973", "0.5890751", "0.5875511", "0.5865583", "0.58650744", "0.5858998", "0.5858842", "0.58471626", "0.58392847", "0.5834108", "0.5824876", "0.5814828", "0.5783639", "0.5720454", "0.5717667", "0.5655758", "0.56540537", "0.5644237", "0.56210107", "0.55744874", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.5569814", "0.55695647", "0.55629414", "0.55545163", "0.555447", "0.554651", "0.5540614", "0.55359983", "0.5529181", "0.55183953", "0.5515218", "0.5511477", "0.5503931", "0.5452474", "0.54468143", "0.5440682", "0.5439803", "0.5436587", "0.5433176", "0.5425821", "0.54187655", "0.54096484", "0.5403861", "0.539141", "0.5378532", "0.53784263", "0.53773236", "0.53525466", "0.53515947", "0.53502333", "0.5349528", "0.5349528", "0.53480047", "0.5338007", "0.5336786", "0.53281623" ]
0.0
-1
Helper function to create drag handlers for dragover/dragenter/dragleave:
function getDragHandler(type) { var isDragOver = type === 'dragover'; return function (e) { e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; var dataTransfer = e.dataTransfer; if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && this._trigger( type, $.Event(type, {delegatedEvent: e}) ) !== false) { e.preventDefault(); if (isDragOver) { dataTransfer.dropEffect = 'copy'; } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static dragEvents(){\n //enter drag\n Quas.on(\"dragenter dragstart\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).addCls(\"dragenter\");\n });\n\n //exit drag\n Quas.on(\"dragend dragleave\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n });\n\n //prevent default on other drag events\n Quas.on(\"drag dragover\", \".drop\", function(e){\n e.preventDefault();\n });\n\n //dropping the file\n Quas.on(\"drop\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n upload(e.dataTransfer.files, function(data){\n //todo progress bar\n closeToolModals();\n Quas.getEl(\"#post-tool-cloud\").visible(true);\n loadModal(\"cloud\");\n });\n });\n }", "function addDragHandlers () {\n if (supportsTouch) {\n element.addEventListener('touchmove', handleTouchMove, false)\n } else {\n element.addEventListener('mouseover', handleDragEnter, false)\n element.addEventListener('mouseout', handleDragLeave, false)\n }\n\n // document.addEventListener(\"selectstart\", prevent, false);\n }", "function addDragDropHandler(canvas) {\n canvas.addEventListener('dragover', onDragOver, false);\n canvas.addEventListener('drop', onDrop, false);\n}", "function addDragDropHandlers(element) {\n element.addEventListener('dragstart', handleDragStart, false);\n element.addEventListener('dragenter', handleDragEnter, false)\n element.addEventListener('dragover', handleDragOver, false);\n element.addEventListener('dragleave', handleDragLeave, false);\n element.addEventListener('drop', handleDrop, false);\n element.addEventListener('dragend', handleDragEnd, false);\n }", "function createDragAndDropListener() {\n\n //Create Listeners for Columns\n var tempColumns = document.getElementsByClassName('evo_c-divtable-column');\n if (tempColumns != null) {\n for (var i = 0; i < tempColumns.length; i++) {\n tempColumns[i].addEventListener('dragstart', handleColumnDragStart, false);\n tempColumns[i].addEventListener('dragenter', handleColumnDragEnter, false)\n tempColumns[i].addEventListener('dragover', handleColumnDragOver, false);\n tempColumns[i].addEventListener('dragleave', handleColumnDragLeave, false);\n tempColumns[i].addEventListener('drop', handleColumnDrop, false);\n tempColumns[i].addEventListener('dragend', handleColumnDragEnd, false);\n }\n }\n //Create Listeners for Rows\n var tempRows = document.getElementsByClassName('evo_c-divtable-row_evo_c-divtable-header');\n if (tempRows != null) {\n for (var i = 0; i < tempRows.length; i++) {\n tempRows[i].addEventListener('dragstart', handleRowDragStart, false);\n tempRows[i].addEventListener('dragenter', handleRowDragEnter, false)\n tempRows[i].addEventListener('dragover', handleRowDragOver, false);\n tempRows[i].addEventListener('dragleave', handleRowDragLeave, false);\n tempRows[i].addEventListener('drop', handleRowDrop, false);\n tempRows[i].addEventListener('dragend', handleRowDragEnd, false);\n }\n }\n }", "function addLisener(){\n elem.bind('dragenter', dragenter);\n elem.bind('dragleave', dragleave);\n elem.bind('dragover', dragover);\n elem.bind('drop', drop);\n }", "function addLisener(){\n elem.bind('dragenter', dragenter);\n elem.bind('dragleave', dragleave);\n elem.bind('dragover', dragover);\n elem.bind('drop', drop);\n }", "function addFakeDragHandlers() {\n if (!supportsDragAndDrop) {\n if (supportsTouch) {\n element.addEventListener(\"touchmove\", handleTouchMove, false);\n } else {\n element.addEventListener('mouseover', handleDragEnter, false);\n element.addEventListener('mouseout', handleDragLeave, false);\n }\n\n element.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDrop, false);\n document.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDragEnd, false);\n document.addEventListener(\"selectstart\", prevent, false);\n\n }\n }", "dragEnter(ev) {\n this.dragOver(ev);\n }", "function addDraggableEvents() {\n [].forEach.call(\n document.querySelectorAll('.card'),\n function(card) { \n card.addEventListener('dragstart',handleDragStart,false);\n card.addEventListener('dragend',handleDragEnd,false);\n card.addEventListener('dragleave',handleCardDragLeave,false);\n }\n );\n [].forEach.call(\n document.querySelectorAll('.card-holder'),\n function(holder) {\n holder.addEventListener('dragover',handleDragOver,false);\n holder.addEventListener('dragleave',handleDragLeave,false);\n holder.addEventListener('dragenter',handleDragEnter,false);\n holder.addEventListener('drop',handleDrop,false);\n holder.addEventListener('dragstart',function(e) {\n if (e.target === this) {\n e.preventDefault();\n return false;\n }\n },false);\n }\n );\n}", "function dragOverHandler(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "onMouseDrag(e) {}", "function addDragListeners() {\n document.addEventListener(\"dragstart\", function (e) {\n draggedCircle = e.target;\n e.target.classList.add(\"dragging\");\n\n // Set the drag preview to be invisible\n let elem = document.createElement(\"div\");\n elem.id = \"drag-ghost\";\n elem.style.position = \"absolute\";\n document.body.appendChild(elem);\n e.dataTransfer.setDragImage(elem, 0, 0);\n });\n\n document.addEventListener(\"dragend\", function (e) {\n e.target.classList.remove(\"dragging\");\n });\n\n document.addEventListener(\"dragover\", function (e) {\n e.preventDefault();\n updateCircleLocation(e);\n drawReaderFrame();\n endGame();\n });\n }", "drag(ev) {\n // console.log('drag')\n }", "function dragover(e){\n e.stopPropagation();\n e.preventDefault();\n elem.addClass('dragenter');\n }", "function dragover(e){\n e.stopPropagation();\n e.preventDefault();\n elem.addClass('dragenter');\n }", "function handleDrag(ev) {\r\n\tif (objDrag) {\r\n\t\tif (dragHandler) {\r\n\t\t\tdragHandler(ev);\r\n\t\t} else {\r\n\t\t\tdefaultDragHandler(ev);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}", "function dragOverHandler(ev) {\n // console.log('File(s) in drop zone');\n\n // Prevent default behavior (Prevent file from being opened)\n ev.preventDefault();\n}", "initDragAndDrop() {\n // treat body as drag and drop zone\n this.dndZone = document.getElementById('drag-and-drop');\n this.dndZone.addEventListener('dragover', this.onDragOver);\n this.dndZone.addEventListener(\"dragleave\", this.onDragLeave);\n this.dndZone.addEventListener('drop', this.onDragDrop);\n }", "drop(ev) {\n\t\tev.preventDefault();\n\t\tvar data = ev.dataTransfer.getData(\"text\");\n\t\tif(data.includes(\"func\"))\n\t\t{\n\t\t\tcopyID = \"drag\" + counter;\n\t\t\tcounter++;\n\t\t\tvar offLeft = document.getElementById(\"context\").offsetLeft;\n\t\t\tvar offTop = document.getElementById(\"context\").offsetTop;\n\t\t\tvar x = ev.clientX - offLeft; // Get the horizontal coordinate of mouse\n\t\t\tvar y = ev.clientY - offTop; // Get the vertical coordinate of mouse\n\t\t\t\n\t\t\t// console.log(\"Left =\" + offLeft + \", Top =\" + offTop );\n\t\t\t// console.log(\"X =\" + x + \", Y =\" + y );\n\t\t\tvar elem;\n\t\t\tswitch (data) {\n\t\t\t\tcase \"funcBody\":\n\t\t\t\t\telem = document.getElementById(\"funcBody\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\t// x -= elem.offsetWidth/2;\n\t\t\t\t\t// y -= elem.offsetHeight/2;\n\t\t\t\t\tthis.appendData(funcBody, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcRec\":\n\t\t\t\t\telem = document.getElementById(\"funcRec\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\tthis.appendData(funcRec, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcOp\":\n\t\t\t\t\telem = document.getElementById(\"funcOp\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\tthis.appendData(funcOp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcExp\":\n\t\t\t\t\telem = document.getElementById(\"funcExp\");\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\tthis.appendData(funcExp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcNExp\":\n\t\t\t\t\telem = document.getElementById(\"funcNExp\");\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\tthis.appendData(funcNExp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"Invalid drop\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "function handleDrag ( event /*: JQueryEventObject */ ) {\n var dx = event.pageX - $element[0].dragData.lastX,\n dy = event.pageY - $element[0].dragData.lastY,\n dleft = dx, dtop = dy, dright = dx, dbottom = dy;\n if ( $element[0].dragData.type != 4 ) {\n if ( $element[0].dragData.type > 2 ) dtop = 0;\n if ( $element[0].dragData.type < 6 ) dbottom = 0;\n if ( $element[0].dragData.type % 3 > 0 ) dleft = 0;\n if ( $element[0].dragData.type % 3 < 2 ) dright = 0;\n }\n reposition( dleft, dtop, dright, dbottom );\n $element[0].dragData.lastX = event.pageX;\n $element[0].dragData.lastY = event.pageY;\n }", "_setEvents() {\n\n if (this.fileInputLinkEle) {\n //Show file reference dialog when clicking the \"Select File\" link\n this.fileInputLinkEle.addEventListener('click', evt => {\n this.fileInputEle.click();\n evt.preventDefault();\n });\n }\n\n if (this.fileInputEle) {\n //Add a file when a file is selected on the file reference dialog\n this.fileInputEle.addEventListener('change', evt => {\n\n const selectedFiles = evt.target.files;\n\n //Add dropped file(s).\n this.doDrop(selectedFiles);\n });\n }\n\n\n this.fileDropAreaEle.addEventListener('dragenter', evt => {\n\n evt.preventDefault();\n\n // If there is a child element in the file drop area\n // Count enter/leave to ignore \"dragenter\"/\"dragleave\" event in child element\n this.enterLeaveNum++;\n\n const draggingObjectTypes = evt.dataTransfer.types;\n\n\n // If dragging objects contains \"file\" type object,\n // then set a flag to indicate that it can be dropped\n let draggingObjectContainsFile = false;\n\n for (const draggingObjectType of draggingObjectTypes) {\n if (draggingObjectType === 'Files') {\n draggingObjectContainsFile = true;\n break;\n }\n }\n\n if (!draggingObjectContainsFile) {\n this.nonFileObjectDragging = true;\n } else {\n this.nonFileObjectDragging = false;\n }\n\n\n if (this.nonFileObjectDragging) {\n this.fileDropAreaEle.style.cursor = 'not-allowed';\n this.fileDropAreaEle.classList.add(this.DRAG_OVER_NOT_ALLOWED_CLS_NAME);\n return;\n } else {\n this.fileDropAreaEle.style.cursor = 'default';\n this.fileDropAreaEle.classList.add(this.DRAG_OVER_CLS_NAME);\n return;\n }\n\n });\n\n this.fileDropAreaEle.addEventListener('dragover', evt => {\n\n if (this.nonFileObjectDragging) {\n //Return here to show 'forbidden' icon.\n return;\n }\n evt.preventDefault();\n });\n\n this.fileDropAreaEle.addEventListener('dragleave', evt => {\n\n this.enterLeaveNum--;\n\n if (this.enterLeaveNum === 0) {\n //When it comes out of the parent element (dragleave)\n\n if (this.nonFileObjectDragging) {\n this.nonFileObjectDragging = false;\n this.fileDropAreaEle.style.cursor = 'default';\n this.fileDropAreaEle.classList.remove(this.DRAG_OVER_NOT_ALLOWED_CLS_NAME);\n } else {\n this.fileDropAreaEle.classList.remove(this.DRAG_OVER_CLS_NAME);\n }\n\n }\n\n });\n\n this.fileDropAreaEle.addEventListener('drop', evt => {\n\n evt.stopPropagation();\n evt.preventDefault();\n\n this.enterLeaveNum = 0;\n\n if (this.nonFileObjectDragging) {\n this.nonFileObjectDragging = false;\n this.fileDropAreaEle.style.cursor = 'default';\n this.fileDropAreaEle.classList.remove(this.DRAG_OVER_NOT_ALLOWED_CLS_NAME);\n return;//Skip adding dropped file.\n\n } else {\n this.fileDropAreaEle.classList.remove(this.DRAG_OVER_CLS_NAME);\n }\n\n const selectedFiles = evt.dataTransfer.files;\n\n //Add dropped file(s).\n this.doDrop(selectedFiles);\n\n });\n\n }", "function dropAble(mimeTypes, onDrop) {\n return function ($node) {\n $node.on('dragenter', function () {\n var e = __WEBPACK_IMPORTED_MODULE_0_d3__[\"event\"];\n //var xy = mouse($node.node());\n if (hasDnDType(e, mimeTypes)) {\n __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_d3__[\"select\"])(this).classed('drag_over', true);\n //sounds good\n return false;\n }\n //not a valid mime type\n __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_d3__[\"select\"])(this).classed('drag_over', false);\n }).on('dragover', function () {\n var e = __WEBPACK_IMPORTED_MODULE_0_d3__[\"event\"];\n if (hasDnDType(e, mimeTypes)) {\n e.preventDefault();\n updateDropEffect(e);\n __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_d3__[\"select\"])(this).classed('drag_over', true);\n return false;\n }\n }).on('dragleave', function () {\n //\n __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_d3__[\"select\"])(this).classed('drag_over', false);\n }).on('drop', function (d) {\n var e = __WEBPACK_IMPORTED_MODULE_0_d3__[\"event\"];\n e.preventDefault();\n __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_d3__[\"select\"])(this).classed('drag_over', false);\n //var xy = mouse($node.node());\n if (hasDnDType(e, mimeTypes)) {\n var data_1 = {};\n //selects the data contained in the data transfer\n mimeTypes.forEach(function (mime) {\n var value = e.dataTransfer.getData(mime);\n if (value !== '') {\n data_1[mime] = value;\n }\n });\n return onDrop(data_1, d, copyDnD(e));\n }\n });\n };\n}", "function InitDragDrop() {\n document.onmousedown = OnMouseDown;\n document.onmouseup = OnMouseUp;\n}", "function CdkDragEnter() {}", "function CdkDragEnter() {}", "function dragover(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "dragOver(event, obj){\n\t\tevent.preventDefault();\n\t\t// Maybe make some nice colors?\n\t}", "function enableDropArea() {\n\tdropArea.addEventListener(\"drop\", dropHandler);\n\tdropArea.addEventListener(\"dragover\", dragOverHandler);\n\tdropArea.addEventListener(\"dragleave\", dragLeaveHandler);\n}", "function dragOverHandler(ev) {\n // console.log('File(s) in drop zone'); \n document.getElementById(\"dragdropcontainer\").style.backgroundColor = \"white\";\n // Prevent default behavior (Prevent file from being opened)\n ev.preventDefault();\n}", "function DragHelperTemplate() {}", "function DragHelperTemplate() {}", "function initDND() {\n //create a ghost box div for representing where our box will end up\n let ghostBox = document.createElement(\"div\");\n ghostBox.className = \"ghost box\";\n\n //loop over each box and give it drag events\n draggables.forEach(draggable => {\n draggable.addEventListener('dragstart', () => {\n //give our box that is currently being dragged over a class to help us find it later\n ghostBox.style.backgroundColor = draggable.style.backgroundColor;\n ghostBox.innerHTML = draggable.innerHTML;\n draggable.classList.add('dragging');\n })\n\n draggable.addEventListener('dragend', () => {\n //remove dragging class\n draggable.classList.remove('dragging');\n if (ghostBox.parentNode) {\n ghostBox.parentNode.removeChild(ghostBox);\n }\n })\n\n\n draggable.addEventListener('dragover', e => {\n e.preventDefault();\n const dragging = document.querySelector('.dragging');\n\n if (dragging === draggable) { return }\n\n //use getBoundingClientRect() to get box underneath our dragging\n let rect = e.currentTarget.getBoundingClientRect();\n let x = e.clientX - rect.left; //x position within the element.\n\n //determine whether x position is more left than right and insert ghost box appropriately\n if (x < (rect.width/2)) {\n draggable.parentNode.insertBefore(ghostBox, draggable);\n } else {\n draggable.parentNode.insertBefore(ghostBox, draggable.nextSibling);\n }\n })\n })\n\n favs.addEventListener(\"dragover\", (e) => {\n e.preventDefault();\n });\n\n favs.addEventListener(\"drop\", (e) => {\n console.log('drop');\n });\n}", "onDragOver(e){\n e.preventDefault();\n }", "onDrag(mousePosition) {\n }", "function dragAndDrop () {\n\tobj_animal = document.getElementsByClassName('drag');\n\tareaSoltar = document.querySelectorAll('.categoria-area-post-it, aside');\n\n\t[].forEach.call(obj_animal, function(animal) {\n\n\t animal.addEventListener('dragstart', arrastrarInicio, false);\n\t animal.addEventListener('dragend', arrastrarFin, false);\n\t \n\t});\n\n\t[].forEach.call(areaSoltar, function(a){\n\t\ta.addEventListener('dragenter', soltarEntro, false);\n\t a.addEventListener('dragover', soltarNavegando, false);\n\t\ta.addEventListener('drop', soltar, false);\n\t\ta.addEventListener('dragleave', soltarSale, false);\n\t});\n}", "function addDragEeventListener(nodes, codeNames){\n nodes\n .call(d3.drag()\n .on('start', drags)\n .on('drag', dragging)\n .on('end', dragged));\n codeNames\n .call(d3.drag()\n .on('start', drags)\n .on('drag', dragging)\n .on('end', dragged));\n}", "function CdkDragDrop() {}", "function CdkDragDrop() {}", "function dragMouseDown(objSender, customHandler) {\r\n\tobjDrag = objSender;\r\n\tdragHandler = customHandler;\r\n}", "function registerDrag() {\r\n\tdocument.onmousemove = handleDrag;\r\n\tdocument.onmouseup = dragMouseup;\r\n}", "function Draggable(draggableElement, handler, data, onStart, onDrag, onFinish) {\n\tvar xDelta = 0, yDelta = 0;\n\tvar xStart = 0, yStart = 0;\n\tvar xOffset = 0, yOffset = 0;\n\tvar x, y;\n\tvar objects;\n\tvar draggable = this;\n\n\t// remove the events\n\tfunction enddrag(e) {\n\t\tif (e.button != 0) // Only attend to left button (or right button for left-handed persons) events\n\t\t\treturn false;\n\n\t\tdocument.removeEventListener(\"mouseup\", enddrag, false);\n\t\tdocument.removeEventListener(\"mousemove\", drag, false);\n\n\t\tfor (var i = 0; i < objects.length; i++) {\n\t\t\tobjects[i].contentDocument.onmouseup = null;\n\t\t\tobjects[i].contentDocument.onmousemove = null;\n\t\t}\n\n\t\tonFinish(draggable, data);\n\t\tdraggableElement.style.zIndex = \"\";\n\n\t\thandler.addEventListener(\"mousedown\", startdrag, false);\n\n\t\tdocument.onmousedown = null;\n\t\tdocument.oncontextmenu = null;\n\t\treturn false;\n\t}\n\n\t// fire each time it's dragged\n\tfunction drag(e) {\n//\t\te = e || window.event;\n\t\txDelta = xStart - parseInt(e.screenX);\n\t\tyDelta = yStart - parseInt(e.screenY);\n\t\txStart = parseInt(e.screenX);\n\t\tyStart = parseInt(e.screenY);\n\t\ty = y - yDelta;\n\t\tx = x - xDelta;\n\t\tdraggableElement.style.top = y + 'px';\n\t\tdraggableElement.style.left = x + 'px';\n\n\t\tonDrag(draggable, data, x + xOffset, y + yOffset);\n\t}\n\n\t// initiate the drag\n\tfunction startdrag(e) {\n\t\tif (e.button != 0) // Only attend to left button (or right button for left-handed persons) events\n\t\t\treturn false;\n\n\t\tdocument.oncontextmenu = function() { return false; }; // disable context menu\n\t\tdocument.onmousedown = function() { return false; }; // disable text selection\n\t\thandler.removeEventListener(\"mousedown\", startdrag, false);\n\n\t\txStart = parseInt(e.screenX);\n\t\tyStart = parseInt(e.screenY);\n\t\ty = draggableElement.offsetTop;\n\t\tx = draggableElement.offsetLeft;\n\t\tdraggableElement.style.top = y + 'px';\n\t\tdraggableElement.style.left = x + 'px';\n\t\tdocument.addEventListener(\"mouseup\", enddrag, false);\n\t\tdocument.addEventListener(\"mousemove\", drag, false);\n\n\t\tobjects = document.getElementsByTagName(\"object\");\n\t\tfor (var i = 0; i < objects.length; i++) {\n\t\t\tobjects[i].contentDocument.onmouseup = enddrag;\n\t\t\tobjects[i].contentDocument.onmousemove = drag;\n\t\t}\n\n\t\tdraggableElement.style.zIndex = \"200\"; // TODO\n\t\tonStart(draggable, data);\n\n\t\treturn false;\n\t}\n\n\t// cancels the call to startdrag function\n\tfunction cancelbubbling(e) {\n\t\tif (e.stopPropagation) e.stopPropagation();\n\t}\n\n\t// add mousedown event listener\n\thandler.addEventListener(\"mousedown\", startdrag, false);\n\tvar children = handler.childElements();\n\tfor (var i = 0; i < children.length; i++)\n\t\tchildren[i].addEventListener(\"mousedown\", cancelbubbling, false);\n\n\tthis.setXOffset = function(offset) {\n\t\txOffset = offset;\n\t}\n\n\tthis.setYOffset = function(offset) {\n\t\tyOffset = offset;\n\t}\n}", "function setGeneralDragAndDrop(){\n\n\twindow.ondragover = function () { this.className = 'hover'; return false; };\n \twindow.ondragend = function () { this.className = ''; return false; };\n\n\twindow.ondrop = function (e) {\n\t\n\t\tuploadFile(e);\n\t\treturn true;\n\t};\n}", "function handleDrag() {\n svgPointer.call(d3.drag()\n .subject(dragSubject)\n .on('start', dragStarted)\n .on('drag', dragged)\n .on('end', dragEnded));\n\n nodePointer.on('mouseover', function() {\n d3.select(this)\n .select('text')\n .attr('opacity', 1);\n })\n .on('mouseout', function() {\n d3.select(this)\n .select('text')\n .attr('opacity', 0);\n });\n}", "attach() {\n this.draggable.on('drag:move', this[onDragMove]).on('drag:stop', this[onDragStop]);\n }", "_createHandleListeners(handle, valueVar) {\n var handleBody = handle.select('.handleBody'),\n handleLines = handle.selectAll('.handleLines'),\n handleShadow = handle.select('.handleDropShadow');\n\n handle.call(Px.d3.drag()\n .on(\"start.interrupt\", function() { handle.interrupt(); })\n .on(\"start drag\", function() {\n // apply styling\n handleBody.classed(\"handleBodyPressed\", true);\n handleLines.classed(\"handleLinesPressed\", true);\n handleShadow.classed(\"handleDropShadowPressed\", true);\n\n // TODO for vertical: check state, pass in d3.event.y\n this._calcSliderValue(Px.d3.event.x, valueVar);\n\n }.bind(this))\n .on(\"end\", function() {\n // remove styling\n handleBody.classed(\"handleBodyPressed\", false);\n handleLines.classed(\"handleLinesPressed\", false);\n handleShadow.classed(\"handleDropShadowPressed\", false);\n })\n )\n .on(\"mouseenter\", function() {\n handleBody.classed(\"handleBodyHover\", true);\n handleLines.classed(\"handleBodyHover\", true);\n })\n .on(\"mouseleave\", function() {\n handleBody.classed(\"handleBodyHover\", false);\n handleLines.classed(\"handleBodyHover\", false);\n });\n }", "function addEventListeners() {\n const dragListItems = document.querySelectorAll(\".draggable-list__entry\");\n const draggables = document.querySelectorAll(\".draggable-list__detail\");\n\n draggables.forEach(draggable => {\n draggable.addEventListener(\"dragstart\", dragStart);\n });\n\n dragListItems.forEach(item => {\n item.addEventListener(\"dragover\", dragOver);\n item.addEventListener(\"drop\", dragDrop);\n item.addEventListener(\"dragenter\", dragEnter);\n item.addEventListener(\"dragleave\", dragLeave);\n });\n}", "function setupDragDropListener(obj){\n obj.addEventListener(\"dragover\", fileDragHover, false);\n obj.addEventListener(\"dragleave\", fileDragHover, false);\n obj.addEventListener(\"drop\", fileSelectHandler, false);\n obj.style.display = \"block\";\n }", "function mouseDragged(){\r\n inputForMDragging(mouseX, mouseY);\r\n\r\n\r\n}", "function dragstart_handler(ev) {\r\n // Add this element's id to the drag payload so the drop handler will\r\n // know which element to add to its tree\r\n ev.dataTransfer.setData(\"text/html\", ev.target.id);\r\n ev.dataTransfer.dropEffect = \"move\";\r\n \r\n// this will add EL to the main element\r\n let canvasElement = document.querySelector(\"#main\");\r\n let str = ev.target.id;\r\n let n = str.search(/Sheets_/);\r\n if(n != -1){\r\n canvasElement.addEventListener(\"dragenter\",function(){\r\n this.style.backgroundColor = \"#f39c12\";\r\n });\r\n canvasElement.addEventListener(\"dragleave\",function(){\r\n this.style.backgroundColor = \"red\";\r\n });\r\n canvasElement.addEventListener(\"drop\",function(){\r\n this.style.backgroundColor = \"#333\";\r\n });\r\n } else {\r\n console.log(\"regex not working\");\r\n }\r\n \r\n}", "attach() {\n this.draggable.on('drag:start', this[onDragStart]).on('drag:move', this[onDragMove]).on('drag:stop', this[onDragStop]);\n }", "function OnDragging(dragInfo:DragInfo){\n\t//if the dragInfo index matches dragIndex1, call function to position dragObj1 accordingly\n\tif(dragInfo.index==currentDragIndex1){\n\t\tObj1ToCursor(dragInfo);\n\t}\n\t//if the dragInfo index matches dragIndex2, call function to position dragObj2 accordingly\n\telse if(dragInfo.index==currentDragIndex2){\n\t\tObj2ToCursor(dragInfo);\n\t}\n}", "function addMouseHandlers() {\n container.addEventListener('mousedown', function(evt) {\n // console.log('mousedown', evt);\n lastX = evt.screenX;\n container.addEventListener('mousemove', mousemove);\n container.addEventListener('mouseup', function(e) {\n container.removeEventListener('mousemove', mousemove);\n });\n container.addEventListener('mouseout', function(e) {\n container.removeEventListener('mousemove', mousemove);\n });\n });\n}", "function onMouseMoveEventOnHandler(ev){\n if(WorkStore.isSelected()) return;\n\n window.addEventListener(MOUSE_DOWN, onMouseDownHandler);\n document.body.classList.add(\"drag\");\n}", "function dragOver(e){\n //we have to prevent the defaullt behavior or drop will not work \n e.preventDefault();\nconsole.log('over');\n\n}", "_delegateDrag(x, y) {\n const dragItems = this._listeners.dragged;\n if (dragItems.length === 0) {\n return false;\n }\n else {\n let _isDragged = false;\n this._filterViewIdToValidView(dragItems)\n .forEach(_ctrl => {\n if (_ctrl.drag(x, y) && !_isDragged) {\n _isDragged = true;\n }\n this._delegateHover(_ctrl, x, y);\n });\n return _isDragged;\n }\n }", "_delegateDrag(x, y) {\n const dragItems = this._listeners.dragged;\n if (dragItems.length === 0) {\n return false;\n }\n else {\n let _isDragged = false;\n this._filterViewIdToValidView(dragItems)\n .forEach(_ctrl => {\n if (_ctrl.drag(x, y) && !_isDragged) {\n _isDragged = true;\n }\n this._delegateHover(_ctrl, x, y);\n });\n return _isDragged;\n }\n }", "function dragoverHandler(evt) {\n\tnobubbleHandler(evt);\n\tevt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.\n}", "function dragenter(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "function dragenter(e) {\n e.stopPropagation();\n e.preventDefault();\n}", "handleDragOver(e) {\n if (this.state.dragging) {\n return\n }\n e.preventDefault()\n e.dataTransfer.dropEffect = 'move'\n this.props.onDragOver(this.props.todo)\n }", "function createDrops(folders){\n\tvar targets;\n\tif(folders==\"ALL\"){\n\t\ttargets=$('[id*=\"_FolderMaster\"]');\t\t\n\t}\n\telse{\n\t\ttargets=$(folders);\n\t}\n\tfor(var i=0;i<targets.length;i++){\n\t\t//unbind and then rebind\n\t\t$(targets[i]).unbind('dragover');\n\t\t$(targets[i]).unbind('dragenter');\n\t\t$(targets[i]).unbind('drop');\n\t\t// Tells the browser that we *can* drop on this target\n\t\t$(targets[i]).on('dragover', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t);\n\t\t$(targets[i]).on( 'dragenter', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t);\n\t\t$(targets[i]).on('drop', function(e){\n\t\t\t\tif(e.originalEvent.dataTransfer){\n\t\t\t\t\tif(e.originalEvent.dataTransfer.files.length) {\n\t\t\t\t\t\t\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\tupload(e.originalEvent.dataTransfer.files,'#'+$(this).attr(\"id\"));\n\t\t\t\t\t} \n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\t\n\t\n}", "function drag(e){\ndraggedItem=e.target;\ndragging=true;\n}", "function initDragDrop(obj) {\n obj.onmousedown = function(e) {\n obj.dx = obj.getBoundingClientRect().left - e.clientX;\n obj.dy = obj.getBoundingClientRect().top - e.clientY;\n obj.isDown = true;\n dragObj = this;\n }\n obj.onmouseup = function(e) {\n obj.isDown = false;\n }\n obj.onmousemove = function(e) {\n if (dragObj && dragObj.isDown) {\n //dragObj.style.left = e.pageX - dragObj.adx + dragObj.dx + \"px\";\n //dragObj.style.top = e.pageY - dragObj.ady + dragObj.dy + \"px\";\n dragObj.setAttribute(\"cx\", e.clientX);\n dragObj.setAttribute(\"cy\", e.clientY);\n\n }\n }\n}", "handleNodeDropping() {\n if (this.highlighted && this.editor && this.editor.handleNodeDropping) {\n this.editor.handleNodeDropping(this.editorContext, this.highlighted);\n }\n this.setDragDescriptor(undefined);\n }", "function dragOver(e) {\n e.preventDefault();\n}", "function enterDragHandler(ev){ //event hadler for drag and drop enter effect\n if(findClassAncestor(ev.target, \"drop-area\") != null){\n ev.target.classList.add(\"target-drop-area\");\n var tab_target = findClassAncestor(ev.target , \"drop-area\");\n if (classDescendantsExist(tab_target , \"target-drop-area\")){\n tab_target.classList.add(\"high-drop\");\n } else {\n tab_target.classList.remove(\"high-drop\")\n }\n }\n }", "function dragOver(e) {\n e.preventDefault();\n}", "function dragOver(event) {\n console.log('drag over');\n event.preventDefault();\n}", "function dragOverHandler(event) {\n event.preventDefault();\n event.stopPropagation();\n event.dataTransfer.dropEffect = 'copy';\n}", "function onDragOver(ev)\n{\n ev.preventDefault();\n}", "function handleDragOver(event) {\n event.stopPropagation();\n event.preventDefault();\n dropArea.addClass(\"hover\");\n }", "function defaultDragHandler(ev) {\r\n\tev = ev || window.event;\r\n\tvar mousePos = getMouseCoords(ev);\r\n\tif(objDrag) {\r\n\t\tif (!mouseOffset) {\r\n\t\t\tmouseOffset = getMouseOffset(objDrag, ev);\r\n\t\t}\r\n\t\t\r\n\t\tvar posY = mousePos.y - mouseOffset.y;\r\n\t\tvar posX = mousePos.x - mouseOffset.x;\r\n\t\t\r\n\t\tobjDrag.style.position = 'absolute';\r\n\t\tobjDrag.style.top = posY;\r\n\t\tobjDrag.style.left = posX;\r\n\r\n\t\treturn false;\r\n\t}\r\n}", "function dragDrop(args) {\n\n // merges args passed in with defaults\n var options = $.extend(true, {\n id: undefined,\n dragstart: defaultFunc,\n drag: defaultFunc,\n dragenter: defaultFunc,\n dragleave: defaultFunc,\n dragover: defaultFunc,\n drop: defaultFunc,\n dragend: defaultFunc\n }, args);\n\n\n if (window.File && window.FileList && window.FileReader && !$.browser.msie && !$.browser.safari) {\n\n // Dropzone element\n var dropzone = $(options.id);\n\n dropzone.on('dragstart', options.dragstart);\n\n dropzone.on('drag', options.drag);\n\n dropzone.on('dragenter', options.dragenter);\n\n dropzone.on('dragleave', options.dragleave);\n\n dropzone.on('dragover', options.dragover);\n\n dropzone.on('drop', options.drop);\n\n dropzone.on('dragend', options.dragend);\n\n // Stops stuff heppening when file dropped in document\n $(document).on('drop dragover', defaultFunc);\n\n }\n}", "function processDragAndDrop() {\n\t\t\t\t\tif (definition.DragSource && voAggregation.getMetadata().hasAggregation(\"dragSource\")) {\n\t\t\t\t\t\t[].concat(definition.DragSource.DragItem).forEach(function(item) {\n\t\t\t\t\t\t\tvoAggregation.addDragSource(new sap.ui.vbm.DragSource({\n\t\t\t\t\t\t\t\ttype: item.type\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (definition.DropTarget && voAggregation.getMetadata().hasAggregation(\"dropTarget\")) {\n\t\t\t\t\t\t[].concat(definition.DropTarget.DropItem).forEach(function(item) {\n\t\t\t\t\t\t\tvoAggregation.addDropTarget(new sap.ui.vbm.DropTarget({\n\t\t\t\t\t\t\t\ttype: item.type\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n ev.dataTransfer.setDragImage(ev.target, 25,25, 0);\n Array.from(document.getElementsByClassName(\"drop_target\")).forEach(o => {\n o.style.pointerEvents = \"auto\";\n });\n}", "addEventListeners() {\n\n this.dropZone.ondragover = (e) => {\n\n e.preventDefault();\n e.target.classList.add(\"highlight\");\n };\n \n this.dropZone.ondragleave = (e) => {\n \n e.preventDefault();\n e.target.classList.remove(\"highlight\");\n };\n \n this.dropZone.ondrop = (e) => {\n \n e.preventDefault();\n e.target.classList.remove(\"highlight\");\n this.addFiles(e);\n };\n \n this.fileInput.onchange = (e) => {\n \n e.preventDefault();\t\n this.addFiles(e);\n };\n }", "_createControls() {\n if (this._leftControl) {\n this._leftControl\n .addEventListener('click', () => this._leftMoveHandler());\n }\n if (this._rightControl) {\n this._rightControl\n .addEventListener('click', () => this._rightMoveHandler());\n }\n if (this._settings.swipes) {\n this._itemsHolder\n .addEventListener('pointerdown', event => this._pointerDownHandler(event));\n }\n if (this._relatedSliders.length > 0) {\n this._container.addEventListener('moveRelatedLeft', () => this._moveRelatedLeftHandler());\n this._container.addEventListener('moveRelatedRight', () => this._moveRelatedRightHandler());\n }\n }", "function rsltDragOverHandler (e) {\n let dt = e.dataTransfer;\n let target = e.target;\n if (isLinux) {\n\tcurRsltTarget = target;\n\tcurRsltDt = dt;\n }\n//console.log(\"Rslt drag over event: \"+e.type+\" target: \"+target+\" id: \"+target.id+\" class: \"+target.classList);\n // Handle drag scrolling inhibition\n handleRsltDragScroll(OverEvent, e);\n dt.dropEffect = \"none\"; // Signal drop not allowed\n}", "handleDragOver(event) {\n event.preventDefault();\n }", "function dragOver(e) {\n e.preventDefault()\n }", "function on_drag(x,y) {\n console.log('item on drag');\n if (get_item()) {\n return Dragged(x,y, this);\n }\n }", "function dragOver(e){\n\te.preventDefault();\n}", "function _onDragOver(evt) {\n evt.preventDefault();\n evt.dataTransfer.dropEffect = 'move';\n var target = evt.target;\n\n if( target && target !== dragEl && target.nodeName.toLowerCase() == targetname.toLowerCase() ){\n // Sorting\n\n var rect = target.getBoundingClientRect();\n var topnext = (evt.clientY - rect.top)/(rect.bottom - rect.top) > 0.5;\n var leftnext = (evt.clientX - rect.left)/(rect.right - rect.left) > 0.5;\n rootEl.insertBefore(dragEl, (topnext && target.nextSibling) || (leftnext && target.nextSibling) || target);\n }\n }" ]
[ "0.7138991", "0.7102745", "0.69069475", "0.68983006", "0.6729915", "0.6649239", "0.6649239", "0.6601595", "0.65734357", "0.65551645", "0.6535164", "0.6468388", "0.6432454", "0.64096344", "0.6367905", "0.6367905", "0.63239425", "0.63213205", "0.6307204", "0.62995845", "0.62949806", "0.62863874", "0.6275154", "0.6252845", "0.6238721", "0.6238721", "0.62273014", "0.6226564", "0.6221644", "0.6221525", "0.6189872", "0.6189872", "0.6168056", "0.61599445", "0.61487144", "0.61312", "0.61067855", "0.6100562", "0.6100562", "0.6092798", "0.60861504", "0.60754937", "0.6050284", "0.60352683", "0.60282373", "0.60238034", "0.600587", "0.59824586", "0.597489", "0.5970855", "0.5964608", "0.5961446", "0.59591454", "0.5958265", "0.5953946", "0.5947155", "0.5947155", "0.59450287", "0.5934147", "0.5934147", "0.5926839", "0.5923601", "0.591751", "0.5912532", "0.5911724", "0.5911462", "0.5907025", "0.5885271", "0.5884742", "0.58846676", "0.58756435", "0.5873823", "0.5868431", "0.58629423", "0.58578455", "0.5855642", "0.58542264", "0.585375", "0.58410734", "0.58388084", "0.5829914", "0.582843", "0.5827596", "0.58225256" ]
0.6193044
45
Custom proxy to avoid jQuery's guid
function proxy(fn, context) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } return function () { for (var _len2 = arguments.length, args2 = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args2[_key2] = arguments[_key2]; } return fn.apply(context, args.concat(toArray(args2))); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function i(){this.expando=me.expando+i.uid++}", "getElementId(){\n return `${this.constructor.elementIdPrefix}${this.identity}`;\n }", "function get(){return proxy;}", "function get(){return proxy;}", "function getNeededId(self){\n var manipulator = $(self);\n var neededId = manipulator.attr('id').split('_')[1];//getting unique general value of id\n return neededId;\n}", "function WebIdUtils () {\n}", "function makeJQueryID ( myid )\r\n{\r\n\treturn \"#\" + myid.replace( /(:|\\.|\\/|\\%|\\[|\\])/g, \"\\\\$1\" );\r\n}", "function i(e){return Object.defineProperty(e.data(),\"id\",{value:e.id})}", "get _id() {\n return this.__id;\n }", "function Proxy(){}", "function Proxy(){}", "function jq(myid) {\r\n\t\treturn '#' + myid.replace(/(:|\\.)/g,'\\\\$1');\r\n}", "get id() {\n console.log('in id getter');\n return this._id + 'TEMPORARY';\n }", "function generateID ( $ )\n{\n thisid = $.prop ( 'id' );\n if ( strlen ( thisid ) === 0 )\n {\n thisid = \"GenID_\" + str_pad ( generateID_counter + \"\" , 4 , \"0\" , STR_PAD_LEFT );\n generateID_counter++;\n $.prop ( 'id' , thisid );\n }\n return thisid;\n}", "_uuid() {\n return this.uid++;\n }", "function useUniqueID() {\n var UUID = Math.floor(Math.random() * 1000000000);\n var UUIDBindings = new Map();\n\n function getID(model) {\n if (UUIDBindings.has(model)) {\n return UUIDBindings.get(model);\n } else {\n UUID++;\n UUIDBindings.set(model, UUID);\n return UUID;\n }\n }\n\n return {\n UUID: UUID,\n UUIDBindings: UUIDBindings,\n getID: getID\n };\n}", "function id(x){ return x; }", "static id(arg) {\nreturn arg;\n}", "function guid() {return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();}", "constructor () {\n this._id = getUniqueId();\n }", "function id(x) { return x; }", "function getGuid() {\n return getUuid();\n}", "createNewGuid() {\n return this.guidGenerator.generateGuid();\n }", "function jQueryStub() {\n return this;\n}", "_id () {\n return (Math.random().toString(16) + '000000000').substr(2, 8)\n }", "function url_safe_uuid() {\n\t \treturn urlencodeBase64(btoa(uuid_fn()));\n\t }", "url() {\n return 'url(#' + this.id() + ')';\n }", "url() {\n return 'url(#' + this.id() + ')';\n }", "id(){\n if(!this.uniqueID){\n var hashids = new Hashids(this.body.substring(0, this.body.length));\n this.uniqueID = hashids.encode([Math.floor(Math.random() * Math.floor(1000))]);\n }\n return this.uniqueID;\n }", "function Data() { // 4029\n\tthis.expando = jQuery.expando + Data.uid++; // 4030\n} // 4031", "function UUIDjs() {\n}", "getID() {}", "function jq(myid) {\n return '#' + myid.replace(/(:|\\.)/g, '\\\\$1');\n}", "newCustomID()\r\n {\r\n var newID = \"customid_\" + this.id_counter;\r\n this.id_counter++;\r\n return newID;\r\n }", "generateId() {\n return this.constructor.generateId();\n }", "function uuidWeak() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (character) {\n var rand = (Math.random() * 16) | 0;\n var value = character === 'x' ? rand : (rand & 0x3) | 0x8;\n return value.toString(16);\n });\n}", "generateId() {\n return `INV-${this.guid()}`;\n }", "function uniquegen() {\n return '#btc-reg-' + uniquegen.counter++;\n }", "function getUID(prefix) {\n do prefix += ~~(Math.random() * 1000000)\n while (document.getElementById(prefix))\n return prefix\n }", "function jq(myid) {\n return '#' + myid.replace(/(:|\\.|\\[|\\])/g, '\\\\$1');\n}", "get id() { return this._id; }", "get id() { return this._id; }", "get id() { return this._id; }", "generateId() {\n if (!this.constructor.generatedIdIndex) this.constructor.generatedIdIndex = 0;\n return '_generated' + this.$name + ++this.constructor.generatedIdIndex;\n }", "function uniqueId() {\n\t\tuniqueId.i = uniqueId.i || 0;\n\t\treturn '__' + uniqueId.i++;\n\t}", "function getID() {\n return '_' + Math.random().toString(36).substr(2, 9);\n}", "function jq( myid ) {\n return \"#\" + myid.replace( /(:|\\.|\\[|\\]|,)/g, \"\\\\$1\" );\n}", "function ID(x) {\n return x;\n}", "function id(a){ return a }", "get uuid() {\n return this._uuid;\n }", "getId(){\r\n return this.#id;\r\n }", "function o(){return null!=this._id?String(this._id):null}", "function genUniqueParam(parameter)\n{\n return parameter+'unique_id='+genUniqueId();\n}", "generateId() { return this._get_uid() }", "static get ID() {\n return \"OTZSILJ\";\n }", "guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n }", "function getMyWebID()\r\n { \r\n try\r\n { \r\n return parent.getMyMemberID();\r\n }\r\n catch(ex){}\r\n }", "function idGetter() {\n if (this.$__._id) {\n return this.$__._id;\n }\n\n this.$__._id = this._id == null\n ? null\n : String(this._id);\n return this.$__._id;\n}", "function DummyProxy() {\n var data = {};\n return {\n read: function () {\n return $.when(data);\n },\n write: function (value) {\n data = value;\n return this.read();\n },\n unset: function () {\n data = {};\n return this.read();\n }\n };\n }", "function guid() {\r\n\treturn parseInt(Date.now() + Math.random());\r\n}", "function guid(prefix) {\n\t return (prefix || '') + Math.round(Math.random() * 1000000).toString();\n\t }", "bind(_elem) {\n const _id = this._add(_elem);\n this._initCache(_id);\n return _id;\n }", "bind(_elem) {\n const _id = this._add(_elem);\n this._initCache(_id);\n return _id;\n }", "function uuid() {\n return \"uid-\" + __counter++;\n}", "toString() {\n return 'url(#' + this.id() + ')';\n }", "function id() {\r\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\r\n // append a 'a' because neo gets mad\r\n newId = \"a\" + newId;\r\n // ensure not already used\r\n if (!cache[newId]) {\r\n cache[newId] = true;\r\n return newId;\r\n }\r\n return id();\r\n}", "function id() {\r\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\r\n // append a 'a' because neo gets mad\r\n newId = \"a\" + newId;\r\n // ensure not already used\r\n if (!cache[newId]) {\r\n cache[newId] = true;\r\n return newId;\r\n }\r\n return id();\r\n}", "addProxy(obj) {\n this.proxy = obj;\n this.target.setAttribute(\"id\", \"proxyOf\" + obj.parentElement.id);\n }", "constructor(url, id) {\n super(url); //llama al constructor desde el que extiende\n this._id = id;\n }", "function _id() {\n\t\tvar S4 = function() {\n\t\t return (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n\t\t};\n\t\treturn (S4()+S4());\n\t}", "init() {\r\n this._super(...arguments);\r\n this.set('id', UUID.createV4());\r\n }", "function guid() {\r\n return parseInt(Date.now() + Math.random());\r\n}", "static get(name, id, state, opts) {\n return new ProxyTarget(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "_UUID() \n {\n return 'Sock-xyxxx-xxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }", "get id() {\n if (!this._id) {\n this._id = Util.GUID();\n }\n return this._id;\n }", "function makeId() {\n return \"_\" + (\"\" + Math.random()).slice(2, 10); \n }", "function cProxy(\n)\n{\n\n\n}", "function guidGenerator() {\nvar S4 = function() {\nreturn (((1+Math.random())*0x10000)|0).toString(16).substring(1);\n};\nreturn (S4()+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+\"-\"+S4()+S4()+S4());\n}", "function guid() {\n return (S4()+S4()+S4()+S4());\n}", "function id() {\n return '_' + Math.random().toString(36).substr(2, 9);\n }", "function getUid(){\n\n}", "function _0x329edd(_0x38ef9f){return function(){return _0x38ef9f;};}", "function setupRegistry(){return{getUniqueId:getSeqNumberGenerator(),icus:new Map()};}", "get ID(){return ID}", "function Hh(t){if(t instanceof no[\"default\"])return t.id;if(t instanceof wr)return t.get(\"id\");throw new Error(\"Illegal source argument\")}", "function UUID(){}", "function UUID(){}", "function UUID(){}", "function UUID(){}", "function UUID(){}", "obtain(){}", "function id() {\n var newId = ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\n // append a 'a' because neo gets mad\n newId = \"a\" + newId;\n // ensure not already used\n if (!cache[newId]) {\n cache[newId] = true;\n return newId;\n }\n return id();\n}", "function id () {\n return '_' + Math.random().toString(36).substr(2, 9);\n}", "function getUniqueId() {\n _id++;\n return _id;\n}", "function newGuid() {\n\treturn (S4() + S4() + \"-\" + S4() + \"-4\" + S4().substr(0,3) + \"-\" + S4() + \"-\" + S4() + S4() + S4()).toLowerCase();\n\t}", "get customIdentity() {\n\t\treturn null;\n\t}", "function _guid() {\n function S4() {\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\n }\n\n return (S4() + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + \"-\" + S4() + S4() + S4());\n }", "function id(x) {\n return x;\n}", "generateGuid() {\n return uuid.v4();\n }", "set _id(value) {\n this.__id = value;\n }", "guid() {\n return this._ctx._guid;\n }" ]
[ "0.60234004", "0.5816297", "0.57973206", "0.57973206", "0.5755648", "0.56807077", "0.5627472", "0.5626583", "0.5598052", "0.5547384", "0.5547384", "0.5546235", "0.5508463", "0.55060285", "0.5495939", "0.54917043", "0.548817", "0.54807484", "0.54734755", "0.5466507", "0.5453039", "0.5442843", "0.5394006", "0.53878117", "0.5377284", "0.537297", "0.5350953", "0.5350953", "0.53493726", "0.5343002", "0.5337846", "0.5329402", "0.53243095", "0.5323505", "0.5317748", "0.530039", "0.52923596", "0.52918494", "0.5290775", "0.52814513", "0.5269379", "0.5269379", "0.5269379", "0.525838", "0.5255955", "0.52454036", "0.52427715", "0.5241343", "0.52402776", "0.52036923", "0.51901126", "0.5184726", "0.5182867", "0.51819694", "0.51735604", "0.5168473", "0.5158257", "0.5157032", "0.51462865", "0.5146264", "0.5142721", "0.51358426", "0.51358426", "0.51324713", "0.5129666", "0.51286507", "0.51286507", "0.5121539", "0.5120652", "0.5107488", "0.51029426", "0.5099221", "0.50893635", "0.50889117", "0.5075695", "0.5075254", "0.50711995", "0.50680727", "0.5066876", "0.50584155", "0.5056956", "0.50499517", "0.5045841", "0.5042976", "0.50385994", "0.50384957", "0.50384957", "0.50384957", "0.50384957", "0.50384957", "0.5026265", "0.5020604", "0.50179386", "0.5017339", "0.5015973", "0.50152755", "0.501179", "0.50108004", "0.50104326", "0.5008567", "0.50075775" ]
0.0
-1
Only available for JPEG image
function arrayBufferToDataURL(arrayBuffer) { var dataView = new Uint8Array(arrayBuffer); var length = dataView.length; var base64 = ''; var i = void 0; for (i = 0; i < length; i++) { base64 += fromCharCode(dataView[i]); } return 'data:image/jpeg;base64,' + btoa(base64); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isJPEG(imgUrl)\r\n {\r\n var istream = getDataStream(imgUrl);\r\n if (istream) {\r\n var bis = Components.classes[\"@mozilla.org/binaryinputstream;1\"].createInstance(Components.interfaces.nsIBinaryInputStream);\r\n bis.setInputStream(istream);\r\n if (bis.read16() == SOI_MARKER)\r\n return true;\r\n }\r\n\r\n return false;\r\n }", "function check_image(file) {\n\n}", "function ImageHelper() { }", "isImage(file) {\n return (\n Utility.isObject(file)\n && typeof file.hasOwnProperty(\"type\")\n && [\"image/png\", \"image/gif\", \"image/bmp\", \"image/jpg\", \"image/jpeg\"].indexOf(file.type) > -1\n );\n }", "function isJPEG(file){\n let checkEnd = (f, p, j) => { return f.substring(f.length - p, f.length) === j; };\n let checkFront = (f) => { return f.substring(0, 2) !== '._'; };\n \n let jpg = checkEnd(file, 4, '.jpg');\n let jpeg = checkEnd(file, 5, '.jpeg');\n \n return (jpg || jpeg) && checkFront(file);\n}", "isSupportedImageType(image) {\n \t//Supported html display types = jpg, jpeg, gift, png, svg\n \t//Wikidata query may return other types. Not displaying currently\n \tvar fileExtension = image.substr( (image.lastIndexOf('.') +1) ).toLowerCase();\n \treturn (fileExtension == \"jpg\" || fileExtension == \"jpeg\" || fileExtension == \"gif\" || fileExtension == \"png\" || fileExtension == \"svg\");\n }", "function isJPG (buffer) { //, filepath\n var SOIMarker = buffer.toString('hex', 0, 2);\n return ('ffd8' === SOIMarker);\n}", "function isJPG (buffer) { //, filepath\n var SOIMarker = buffer.toString('hex', 0, 2);\n return ('ffd8' === SOIMarker);\n}", "static isAllowedImageType(name) {\r\n var allowedRx = C.RECOG_RGX.IMAGE;\r\n return allowedRx.test(name);\r\n }", "function getImgType() {\n\t\tvar src = $('#img').attr('src'); \n\t\tif( src.indexOf( 'data' ) !== -1 ) { \n\t\t\treturn 'png'; \n\t\t} \n\t\telse { \n\t\t\treturn 'jpeg'; \n\t\t}\n\t}", "function isImageOk(img) {\n if (!img.complete) {\n return false;\n }\n return !(typeof img.naturalWidth !== 'undefined' && img.naturalWidth === 0);\n }", "function getImageInfo() {\n\n}", "validFile(imageName){\n let lowercaseImageName = imageName.toLowerCase();\n return (\n lowercaseImageName.indexOf(\".jpg\") !== -1 ||\n lowercaseImageName.indexOf(\".jpeg\") !== -1 ||\n lowercaseImageName.indexOf(\".tiff\") !== -1 ||\n lowercaseImageName.indexOf(\".bmp\") !== -1\n )\n }", "function imgError(image) {\n image.onerror = \"\";\n image.src = \"../pages/images/noimage.gif.jpg\";\n \n return true;\n}", "function imgError(image) {\n image.onerror = \"\";\n image.src = \"assets/noimage.png\";\n return true;\n}", "function is_image(url)\n {\n return url.startsWith(\"data:\") ||\n /\\.(bmp|gif|jpg|jpeg|png|svg)$/.test(url);\n }", "static isImage(path)\n {\n return path.endsWith(\".png\") || path.endsWith(\".jpg\") || path.endsWith(\".jpeg\");\n }", "function getImage() {\n var ImageNotSupported = /*#__PURE__*/function ImageNotSupported() {\n _classCallCheck(this, ImageNotSupported);\n };\n\n return __WEBPACK_IMPORTED_MODULE_0__init__[\"global\"].Image || ImageNotSupported;\n}", "function svgasimg() {\r\n\t\t\treturn document.implementation.hasFeature(\r\n\t\t\t\t\"http://www.w3.org/TR/SVG11/feature#Image\", \"1.1\"\r\n\t\t\t);\r\n\t\t}", "function validateImage(src) {\r\n\tstrArr = src.split('.');\r\n\r\n\tif (strArr[strArr.length-1] == 'png' || strArr[strArr.length-1] == 'jpg' || strArr[strArr.length-1] == 'jpeg') {\r\n\t\treturn src;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n}", "function checkImgFile(file) {\n //Check File Size\n if (file.size > 0 && file.size < 1000000) {\n //Check File Name\n var extension = file.name.substr(file.name.lastIndexOf('.') + 1).toUpperCase();\n if (extension == \"PNG\" || extension == \"JPG\" || extension == \"JPEG\" || extension == \"GIF\")\n return 1;\n else\n return \"Supported File Types: PNG, JPG, GIF\";\n }\n else\n return \"Supported File Size: 1MB Maximum\";\n }", "function imgError(image) {\n image.onerror = \"\";\n image.src = \"http://liftbazaar.ir/no-image.jpg\";\n return true;\n}", "function validateImg(ctrl) {\n var fileUpload = ctrl;\n var regex = new RegExp(\"([a-zA-Z0-9\\s_\\\\.\\-:])+(.jpeg|.jpg|.png|.gif)$\");\n if (regex.test(fileUpload.value.toLowerCase())) {\n if (typeof (fileUpload.files) != \"undefined\") {\n var reader = new FileReader();\n reader.readAsDataURL(fileUpload.files[0]);\n reader.onload = function (e) {\n var image = new Image();\n image.src = e.target.result;\n image.onload = function () {\n var height = this.height;\n var width = this.width;\n if (height == 680 && width == 1020) {\n // alert(\"Ảnh hợp lệ.\");\n return true;\n } else {\n fileUpload.value = null;\n alert(\"Ảnh không đúng kích thước 1020 x 680 !\");\n return false;\n }\n };\n }\n } else {\n alert(\"Trình duyệt của bạn không hỗ trợ HTML5.\");\n return false;\n }\n } else {\n alert(\"Hãy chọn đúng định dạng file ảnh.\");\n return false;\n }\n}", "function filterJpegImage(buffer, comment) {\n buffer = image_traverse.jpeg_segments_filter(buffer, segment => {\n if (segment.id >= 0xE2 && segment.id < 0xF0) return false;\n return true;\n });\n\n buffer = image_traverse.jpeg_exif_tags_filter(buffer, entry => {\n return entry.data_length < 100;\n });\n\n if (comment) {\n buffer = image_traverse.jpeg_add_comment(buffer, comment);\n }\n\n return buffer;\n}", "function imgErrorPhoto(image) {\n image.onerror = '';\n image.src = 'https://raw.githubusercontent.com/Stricks1/cap-twitter/feature/app/assets/images/user_default.png';\n return true;\n}", "function isImageURL(url) { return url.match(/\\.(jpeg|jpg|gif|png|tiff|bmp)$/) != null; }", "function isImageURL(url) { return url.match(/\\.(jpeg|jpg|gif|png|tiff|bmp)$/) != null; }", "function imageOk(img) {\n // During the onload event, IE correctly identifies any images that\n // weren't downloaded as not complete. Others should too. Gecko-based\n // browsers act like NS4 in that they report this incorrectly.\n if (!img.complete) {\n return false;\n }\n // However, they do have two very useful properties: naturalWidth and\n // naturalHeight. These give the true size of the image. If it failed\n // to load, either of these should be zero.\n if (typeof img.naturalWidth !== \"undefined\" && img.naturalWidth === 0) {\n return false;\n }\n // No other way of checking: assume it's ok.\n return true;\n }", "function ReturnIfImageError() {\n if (currentEpisode.Pages[0].Path.search(\"img_warning\") > 0)\n return true;\n else\n return false;\n \n}", "function isImage(url) {\n return url.match(/\\.(jpeg|gif|jpg|png)$/) != null;\n}", "canImageDiff() {\n return false;\n }", "function imgError(image) {\n image.onerror = \"\";\n image.src = \"images/no-image.png\";\n return true;\n}", "function isValidImage(filename) {\n if(!filename && typeof filename !== 'string') return false;\n let fileType = filename.split('.');\n fileType = fileType[fileType.length -1];\n return (fileType === \"jpg\" || fileType ===\"jpeg\" || fileType === \"png\")\n \n \n}", "function isImageOk(img) {\n // Image was removed from the page code (issue #1)\n if (typeof img === \"undefined\") {\n return false;\n }\n // During the onload event, IE correctly identifies any images that\n // weren’t downloaded as not complete. Others should too. Gecko-based\n // browsers act like NS4 in that they report this incorrectly.\n // NOTE: This check doesn't seem to be needed - and doesn't work \n // reliably in MS Edge in my tests. So disabling for now.\n //if (!img.complete) {\n // return false;\n //}\n // However, they do have two very useful properties: naturalWidth and\n // naturalHeight. These give the true size of the image. If it failed\n // to load, either of these should be zero.\n if (typeof img.naturalWidth !== \"undefined\" && img.naturalWidth <= 1) {\n return false;\n }\n // No other way of checking: assume it’s ok.\n return true;\n}", "function validateImg(ctrl) {\n\tvar fileUpload = ctrl;\n\tvar regex = new RegExp('([a-zA-Z0-9s_\\\\.-:])+(.jpeg|.jpg|.png|.gif)$');\n\tif (regex.test(fileUpload.value.toLowerCase())) {\n\t\tif (typeof fileUpload.files != 'undefined') {\n\t\t\tvar reader = new FileReader();\n\t\t\treader.readAsDataURL(fileUpload.files[0]);\n\t\t\treader.onload = function(e) {\n\t\t\t\tvar image = new Image();\n\t\t\t\timage.src = e.target.result;\n\t\t\t\timage.onload = function() {\n\t\t\t\t\tvar height = this.height;\n\t\t\t\t\tvar width = this.width;\n\t\t\t\t\tif (height == 680 && width == 1020) {\n\t\t\t\t\t\t// alert(\"Ảnh hợp lệ.\");\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfileUpload.value = null;\n\t\t\t\t\t\talert('Ảnh không đúng kích thước 1020 x 680 !');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t} else {\n\t\t\talert('Trình duyệt của bạn không hỗ trợ HTML5.');\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\talert('Hãy chọn đúng định dạng file ảnh.');\n\t\treturn false;\n\t}\n}", "_isImage(file) {\n if (file.type) {\n return (file.type.split('/')[0] === 'image');\n }\n\n const filename = file.name.toLowerCase();\n\n return ['.jpeg', '.jpg', '.png', '.gif', '.bmp', '.tiff', '.svg'].some(\n extension => filename.endsWith(extension));\n }", "function isImage(url) {\n return (url && url.match(/\\.(jpeg|jpg|gif|png)$/) !== null);\n}", "function isWebCamGIFSupported() {\n return error.isValid();\n }", "isImage(filename){\n return filename.split('.').pop()==\"pdf\"\n }", "function validateImg(ctrl) {\n\tvar fileUpload = ctrl;\n\tvar regex = new RegExp('([a-zA-Z0-9s_\\\\.-:])+(.jpg|.png|.gif)$');\n\tif (regex.test(fileUpload.value.toLowerCase())) {\n\t\tif (typeof fileUpload.files != 'undefined') {\n\t\t\tvar reader = new FileReader();\n\t\t\treader.readAsDataURL(fileUpload.files[0]);\n\t\t\treader.onload = function(e) {\n\t\t\t\tvar image = new Image();\n\t\t\t\timage.src = e.target.result;\n\t\t\t\timage.onload = function() {\n\t\t\t\t\tvar height = this.height;\n\t\t\t\t\tvar width = this.width;\n\t\t\t\t\tif (height == 680 && width == 1020) {\n\t\t\t\t\t\t// alert(\"Ảnh hợp lệ.\");\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfileUpload.value = '';\n\t\t\t\t\t\talert('Ảnh không đúng kích thước 1020 x 680 !');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t} else {\n\t\t\talert('Trình duyệt của bạn không hỗ trợ HTML5.');\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\talert('Hãy chọn đúng định dạng file ảnh.');\n\t\treturn false;\n\t}\n}", "function test_missing_thumb() {\n\n}", "function imgFail (image) {\n image.onerror=\"\";\n image.src = \"img/shrug.png\";\n return true;\n}", "function image_result_streamization() {\r\n \r\n}", "function isImage(extension){\n\n switch (extension.toLowerCase()) {\n case 'jpeg':\n case 'jpg':\n case 'gif':\n case 'bmp':\n case 'png':\n return true;\n }\n return false;\n }", "function checkForImage(obj) {\n if (obj[\"image\"] !== null) {\n var image = obj[\"image\"];\n obj[\"image\"] = \"<img src='\" + image + \"' style='width:5rem'>\";\n }\n }", "function canEncode(){\n var canvas = document.createElement(\"canvas\");\n canvas.width = 8;\n canvas.height = 8;\n return canvas.toDataURL(\"image/webp\",0.1).indexOf(\"image/webp\") > -1;\n }", "function verifImage(){\n var file,fileTypes;\n file=$('#boutonAvatar');\n fileTypes = ['image/jpeg','image/jpg','image/png','image/gif'];\n for (var i = 0; i < fileTypes.length; i++) {\n if(file.files[0].type == fileTypes[i]) {\n return false;\n }\n }\n return true;\n}", "isExist(src) {\n let existFlag = false;\n let imageObj = new Image();\n imageObj.src = src;\n\n // @TODO how to judge a image exist or not in server\n if (imageObj.fileSize >= 0 || (imageObj.width >= 0 && imageObj.height >= 0)) {\n existFlag = true;\n }\n return existFlag;\n }", "function isImage(filename) {\n let ext = getExtension(filename);\n switch (ext.toLowerCase()) {\n case 'jpg':\n case 'gif':\n case 'bmp':\n case 'png':\n return true;\n }\n return false;\n}", "function verifyJpegHeader(buffer) {\n if (buffer.length < 12) {\n return false\n }\n\n const firstDword = buffer.readUInt32BE(0)\n if ((firstDword & 0xFFFFFF00) >>> 0 !== 0xFFD8FF00) {\n return false\n }\n const fourthByte = firstDword & 0xFF\n if (fourthByte === 0xD8) {\n return true\n } else if (fourthByte === 0xE0) {\n const jfif = buffer.readUInt32BE(6)\n const additional = buffer.readUInt16BE(10)\n if (jfif !== 0x4A464946 || additional !== 0x0001) {\n return false\n }\n return true\n } else if (fourthByte === 0xE1) {\n const exif = buffer.readUInt32BE(6)\n const additional = buffer.readUInt16BE(10)\n if (exif !== 0x45786966 || additional !== 0x0000) {\n return false\n }\n return true\n } else {\n return false\n }\n}", "function imagenExiste(image)\n\t{\n\t var http = new XMLHttpRequest();\n\t http.open('HEAD', image, false);\n\t http.send();\n\n\t return (http.status != 404);\n\t}", "function testOver32kb() {\n\n var datauriBig = new Image();\n\n datauriBig.onerror = function() {\n addTest('datauri', true);\n Modernizr.datauri = new Boolean(true);\n Modernizr.datauri.over32kb = false;\n };\n datauriBig.onload = function() {\n addTest('datauri', true);\n Modernizr.datauri = new Boolean(true);\n Modernizr.datauri.over32kb = (datauriBig.width == 1 && datauriBig.height == 1);\n };\n\n var base64str = 'R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';\n while (base64str.length < 33000) {\n base64str = '\\r\\n' + base64str;\n }\n datauriBig.src = 'data:image/gif;base64,' + base64str;\n }", "function isImage($field) {\n return !_.isEmpty($field) && $field.prop(\"type\") === \"file\" && $field.hasClass(\"coral-FileUpload-input\");\n }", "static get ImageFormat() {\n return enums.ImageFormat;\n }", "function isValidImage(images, allowed) {\n\n\n\n\n}", "function bad_image(image) {\n image.src = \"images/product_default_image.png\";\n}", "function filterJpegPreview(buffer) {\n buffer = image_traverse.jpeg_segments_filter(buffer, segment => {\n if (segment.id >= 0xE1 && segment.id < 0xF0) return false;\n return true;\n });\n\n return buffer;\n}", "function checkImageDimensions(image){if(test)console.log(image.src+\" ; state:\"+image.complete+\":n w h:\"+image.naturalWidth+\" \"+image.naturalHeight+\";w h:\"+image.clientWidth+\" \"+image.clientHeight);if(image.clientWidth>0){if(image.clientWidth<minWidthOfImageForDisplayBottomOffersWrapper){if(test)console.log('картинка '+image.src+' не прошла проверку на размеры с шириной '+image.naturalWidth+'('+_typeof(image.naturalWidth)+') и высотой '+image.naturalHeight+'('+_typeof(image.naturalHeight)+')');return false;}else return true;}else if(image.naturalWidth<minWidthOfImageForDisplayBottomOffersWrapper){if(test)console.log(image.naturalHeight);return false;}return true;}", "function checkAttachImg(filename,set_inline_img) {\r\n\tvar dot = filename.lastIndexOf(\".\"); \r\n\tif( dot == -1 ) return \"\"; \r\n\tvar extension = filename.substr(dot+1,filename.length).toLowerCase();\r\n\tvar is_img = (extension == \"jpeg\" || extension == \"jpg\" || extension == \"gif\" || extension == \"png\" || extension == \"bmp\");\r\n\tenableAttachImgOption(is_img,set_inline_img);\r\n}", "get isImage () {\n return this.data.type === 'image'\n }", "getImageData(glTFImage) {\n return {\n typedArray: this.getBufferView(glTFImage.bufferView),\n mimeType: glTFImage.mimeType || 'image/jpeg'\n };\n }", "getImage(){\n return '';//This might change later, we will see what I want this to be\n }", "onBeforeUpload(file) {\n // Allow upload files under 5Gb, and only in png/jpg/jpeg formats\n if (\n file.size <= 5368709120 &&\n /png|jpg|jpeg|mp4|pdf|mp3|pptx|ppt|webm|/i.test(file.extension)\n ) {\n return true;\n }\n return 'Please upload image, with size equal or less than 10MB';\n }", "onBeforeUpload(file) {\n // Allow upload files under 5Gb, and only in png/jpg/jpeg formats\n if (\n file.size <= 5368709120 &&\n /png|jpg|jpeg|mp4|pdf|mp3|pptx|ppt|webm|/i.test(file.extension)\n ) {\n return true;\n }\n return 'Please upload image, with size equal or less than 10MB';\n }", "function image_process_streamization() { \r\n\r\n}", "function checkURL(url) {\n return(url.match(/\\.(jpg)$/) != null);\n}", "function checkStatus() {\n if (imageGallery.supportsAvif !== null && imageGallery.supportsWebp !== null) {\n imageGallery.showOverlay(imageIndex);\n return;\n }\n }", "function img(file) {\n return jg.os({android: '../images/' + file, iphone: 'images/' + file});\n}", "function checkWebp(cb) {\n var img = new Image();\n img.onload = function() {\n cb(true);\n };\n\n img.onerror = function() {\n cb(false);\n };\n\n img.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA';\n}", "function bIsImage(sFile){\n var sExt = sFile.split('.').pop();\n sExt = sExt.toLowerCase();\n if (sExt === 'bmp' || sExt === 'jpg' || sExt ==='png' || sExt === 'gif'){\n return true;\n }\n return false;\n}", "function fileIsSupported(file) {\n\t\tvar supportedFileTypes = [\"image/jpeg\", \"image/png\"];\n\t\treturn supportedFileTypes.indexOf(file.type) >= 0 ? true : false;\n\t}", "function check_image() {\n var im = document.getElementById(\"image_form\").elements.namedItem(\"image_src\").value;\n\n var image = new Image();\n image.src = im;\n\n image.onload = function() {\n if (this.width > 0) {\n alert(\"IMAGE SRC OK - CLICK 'ADD IMAGE' TO SUBMIT\"); }};\n\n image.onerror = function() {\n alert(\"IMAGE SRC INCORRECT - CHECK URL AND RE-ENTER\"); }; \n}", "image(input) {\n return new Promise((valid, invalid) => {\n if (\n input.getAttribute('type') === 'file'\n && input.getAttribute('accept').indexOf('image') > -1\n && _bn_getFile(input) !== false\n ) {\n __WEBPACK_IMPORTED_MODULE_0__file_file__[\"a\" /* BunnyFile */].getSignature(_bn_getFile(input)).then(signature => {\n if (__WEBPACK_IMPORTED_MODULE_0__file_file__[\"a\" /* BunnyFile */].isJpeg(signature) || __WEBPACK_IMPORTED_MODULE_0__file_file__[\"a\" /* BunnyFile */].isPng(signature)) {\n valid();\n } else {\n invalid({signature});\n }\n }).catch(e => {\n invalid(e);\n });\n } else {\n valid();\n }\n });\n }", "function readURL(input) {\r\n if (input.files && input.files[0]) {\r\n var reader = new FileReader();\r\n reader.onload = function (e) {\r\n var textoImagem = e.target.result;\r\n if(textoImagem.includes(\"data:image/gif\") || textoImagem.includes(\"data:image/png\") || textoImagem.includes(\"data:image/jpeg\")){\r\n $('#imgP-profile').attr('src', e.target.result);\r\n document.getElementById(\"input-imgP-profile\").className=\"custom-file-input form-control is-valid\";\r\n imagemP=true;\r\n }\r\n else{\r\n document.getElementById(\"input-imgP-profile\").className=\"custom-file-input form-control is-invalid\";\r\n }\r\n }\r\n reader.readAsDataURL(input.files[0]);\r\n }\r\n}", "function getImageData(){\n\n }", "function isImage(extension) {\n switch (extension.toLowerCase()) {\n case 'jpg':\n case 'gif':\n case 'png':\n case 'jpeg':\n return true;\n break;\n default:\n return false;\n break;\n }\n}", "function isValidImage(str) {\r\n\tvar error=0;\r\n\tvar exterror=0;\r\n\tvar nameerror=0;\r\n\tvar lastcount=str.split('\\\\').length;\r\n\tvar uploadimg=str.split('\\\\')[lastcount-1];\t\t\r\n\tvar pos=uploadimg.lastIndexOf(\".\");\t\t\t\t\r\n\tvar str1=uploadimg.substring(pos);\t\t\t\t\r\n\tvar str=str1.toLowerCase();\t\t\t\t\t\t\r\n\t//Check if the Image is a valid format\r\n\tif(str==\".jpg\" || str== \".gif\" || str==\".jpeg\")\r\n\t{\r\n\t\texterror=0;\t//The image is not a .jpg or .gif\r\n\t} else {\r\n\t\texterror=1;\t\r\n\t}\r\n\t//Check if the imagename is valid\r\n\tvar imagename=uploadimg.substring(0,pos);\r\n\tif (isalphanumeric(imagename) == false) {\r\n\t\tnameerror=2;\r\n\t}\r\n\tif (exterror==0 && nameerror==0){\r\n\t\terror=0;\r\n\t} else if (exterror!=0){\r\n\t\terror = exterror;\r\n\t} else if (nameerror!=0){\r\n\t\terror = nameerror;\r\n\t}\r\n\treturn(error);\t\t\r\n}", "function isImage(url) {\n\t\treturn settings.photo || /\\.(gif|png|jpe?g|bmp|ico)((#|\\?).*)?$/i.test(url);\n\t}", "function imageExists(image_url)\n{ \n\tvar http = new XMLHttpRequest();\n\thttp.open(\"HEAD\", image_url, true);\n\thttp.send();\n\treturn http.status < 400;\n}", "function onLowResImageFail(e){\n\tTitanium.API.info(e);\n}", "function imageExists(url)\n{\n var img = new Image();\n img.src = url;\n return img.height != 0;\n}", "function protection_image()\n{\n\t// Si on à pas déjà montré l'image\n\tif(typeof(proctection_image_deja_check) == 'undefined')\n\t{\n\t\touverture_alert(alert_basic = '<span>Les images sont protégées par des droits d\\'auteur :<br /><br />- Pour un usage personnel ou professionnel lié au web merci de faire une référence à DonneMoiFaim sur votre site internet (exemple dans la page partenaire) : <br /> <input onclick=\"this.select();\"class=\"input\" style=\"width:100%; min-width:200px; max-width:500px\" value=\\'&lt;a href=\"' + nom_domaine_site + '\"&gt;' + nom_domaine_site + '&lt;/a&gt; \\'/><br /><br />- Tout usage commercial des images (revente, etc..) est strictement interdit. </span>', taille_box = '300px' );\n\t\t\n\t\tproctection_image_deja_check = 1;\n\t}\n}", "function missing_img() {\n \"use strict\";\n $('img').each(function() {\n\n if ((!this.complete || typeof this.naturalWidth == \"undefined\" || this.naturalWidth == 0) && $(this).closest('#logo').length == 0) {\n this.src = 'http://thesimple.ellethemes.com/dummy_data/set_image.png';\n }\n });\n }", "function replaceImage(image) {\n image.onerror = \"\";\n image.src = 'https://archiveshub.jisc.ac.uk/images/contrlogos/valogo.jpg';\n return true;\n}", "function isFilePicture(p){\n var ext = p.slice((p.lastIndexOf(\".\") - 1 >>> 0) + 2).toLowerCase();\n return ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif';\n }", "onBeforeUpload(file) {\n // Ensure image size is smaller, in bytes, than 25 MB\n if (file.size > 26214400) {\n return 'Image is too large. Please upload a smaller image file.';\n }\n // Check that uploaded file is an image in a proper format\n else if (!/png|jpg|jpeg/i.test(file.extension)) {\n return 'Please upload a valid image file.';\n }\n return true;\n }", "function isImage(url) {\n\t\treturn settings.photo ? true : url.match(/\\.(gif|png|jpg|jpeg|bmp)(?:\\?([^#]*))?(?:#(\\.*))?$/i);\n\t}", "function isUploadNeeded($img) {\n var imageUrl = $img.attr('src');\n if(imageUrl.match(/^\\/[^\\/]/)) return 0; // that is absolute url (and does not start with //)\n\n var jiveUrlPrefix = '(https?:)?\\/\\/' + location.hostname + (location.port ? ':' + location.port : '');\n if ( !imageUrl.match('^' + jiveUrlPrefix) ) {\n // does not begins with jive hostname; in this case always upload\n return true;\n }\n\n // begins with jive hostname; if proxied (has gadgets proxy in path), then yes, upload\n // otherwise don't proxy\n return protect.isProxiedUrl( imageUrl ) ? 1 : 0;\n }", "supportsObjectFit() {\n let testImg = typeof Image === 'undefined' ? {style: {'object-position': 1}} : new Image();\n let supportsFit = 'object-fit' in testImg.style;\n\n return supportsFit;\n }", "function readURLU(input) {\r\n if (input.files && input.files[0]) {\r\n var reader = new FileReader();\r\n reader.onload = function (e) {\r\n var textoImagem = e.target.result;\r\n if(textoImagem.includes(\"data:image/gif\") || textoImagem.includes(\"data:image/png\") || textoImagem.includes(\"data:image/jpeg\")){\r\n $('#imgU-profile').attr('src', e.target.result);\r\n document.getElementById(\"input-imgU-profile\").className=\"custom-file-input form-control is-valid\";\r\n imagemU=true;\r\n }\r\n else{\r\n document.getElementById(\"input-imgU-profile\").className=\"custom-file-input form-control is-invalid\";\r\n }\r\n }\r\n reader.readAsDataURL(input.files[0]);\r\n }\r\n}", "function onHighResImageFail(e){\n\tTitanium.API.info(e);\n}", "function isImageTypeSupported(type) {\n switch (type) {\n case 'auto':\n // Should only ever be false in Node.js, if polyfills have not been installed...\n return IMAGE_BITMAP_SUPPORTED || IMAGE_SUPPORTED || DATA_SUPPORTED;\n\n case 'imagebitmap':\n return IMAGE_BITMAP_SUPPORTED;\n case 'image':\n return IMAGE_SUPPORTED;\n case 'data':\n return DATA_SUPPORTED;\n\n // DEPRECATED types\n case 'html':\n return IMAGE_SUPPORTED;\n case 'ndarray':\n return DATA_SUPPORTED;\n\n default:\n throw new Error(`@loaders.gl/images: image ${type} not supported in this environment`);\n }\n}", "function uploadImage(input) {\n const label = $('[data-js-label]');\n if (input.files && input.files[0]) {\n console.log(input.files[0]);\n if (input.files[0].size < MAX_FILE_UPLOAD_SIZE) {\n if (input.files[0].type === 'image/jpeg' || input.files[0].type === 'image/png') {\n label.text(input.files[0].name)\n var reader = new FileReader();\n reader.onload = function (e) {\n // Show logo if all conditions are true\n LOGO.show();\n $('.logo').attr('src', e.target.result);\n }\n reader.readAsDataURL(input.files[0]); // convert to base64 string\n } else {\n alert('We only support JPF/PNG images');\n }\n } else {\n alert('File size should be less than 5 MB')\n }\n }\n}", "function getImageType(image) {\n const jpeg = \"JFIF\";\n if (\n image[6] === jpeg.charCodeAt(0) &&\n image[7] === jpeg.charCodeAt(1) &&\n image[8] === jpeg.charCodeAt(2) &&\n image[9] === jpeg.charCodeAt(3)\n ) {\n return \"image/jpeg\";\n }\n\n const png = \"PNG\";\n if (\n image[1] === png.charCodeAt(0) &&\n image[2] === png.charCodeAt(1) &&\n image[3] === png.charCodeAt(2)\n ) {\n return \"image/png\";\n }\n\n return undefined;\n}", "function imageIsLoaded(image) {\n if (image != null && image.complete()) {\n return true;\n }\n else {\n alert(\"Image not ready.\");\n return false;\n }\n}", "function isImage(url) {\n return imageExtensions.includes(getExtension(url));\n}", "function validateJPG(file, cb) {\n var data = fs.readFileSync(file),\n len = data.length,\n last = data.slice(len-2,len),\n ends = (last[0] === 0xFF && last[1] === 0xD9);\n cb(ends ? false : \"jpg file \"+file+\" is incomplete.\");\n }", "function saveImg() {\n var file = current.brows.files[0];\n var type = file.type;\n var size = file.size;\n\n if(!type.match('image.*')) {\n var message = \"File is not an image\";\n Flash.flashError(current.menu, message);\n } else if(size > 10000000) {\n var message = \"file is over 100mb\";\n Flash.flashError(current.menu, message);\n } else {\n current.form.submit();\n var message = \"Picture uploaded successfuly\";\n Flash.flash(current.menu, message);\n }\n }", "function isAssetTypeAnImage(type: string): boolean {\n return (\n ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(\n type,\n ) !== -1\n );\n}", "function getImageTypeOrNull(image) {\n if (typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n return 'imagebitmap';\n }\n if (typeof Image !== 'undefined' && image instanceof Image) {\n return 'image';\n }\n if (image && typeof image === 'object' && image.data && image.width && image.height) {\n return 'data';\n }\n return null;\n}", "function imageExists(image_url){\r\n\r\n var http = new XMLHttpRequest();\r\n\r\n http.open('HEAD', image_url, false);\r\n http.send();\r\n\r\n return http.status != 404;\r\n\r\n}" ]
[ "0.6750157", "0.6707812", "0.6451136", "0.6432129", "0.64300776", "0.6354731", "0.63220286", "0.63220286", "0.62505156", "0.62397563", "0.62182915", "0.6178039", "0.61705726", "0.6163406", "0.6151997", "0.6141724", "0.6130553", "0.6121599", "0.61148214", "0.60809416", "0.60455686", "0.60201293", "0.60182714", "0.6015913", "0.59969974", "0.59939945", "0.59939945", "0.598995", "0.59882283", "0.5973917", "0.5961736", "0.59609795", "0.5934286", "0.5932462", "0.59295017", "0.5921498", "0.5921295", "0.59088224", "0.5870768", "0.58692336", "0.58589685", "0.58529466", "0.585062", "0.5844682", "0.584321", "0.5837178", "0.5825181", "0.58206064", "0.58112913", "0.5802064", "0.57817256", "0.5781397", "0.57787573", "0.57694185", "0.57558644", "0.57403874", "0.5736255", "0.57359827", "0.573312", "0.5715308", "0.57128775", "0.570212", "0.56881917", "0.56881917", "0.5670812", "0.5670055", "0.56549525", "0.5653042", "0.56442916", "0.56410056", "0.5637742", "0.56357837", "0.56320757", "0.5631076", "0.5630858", "0.5623958", "0.5617595", "0.5614143", "0.5609664", "0.5607865", "0.56070423", "0.5606685", "0.5594467", "0.55926526", "0.5579069", "0.5575299", "0.55738246", "0.5566703", "0.556534", "0.5562979", "0.55355686", "0.5533008", "0.5532062", "0.5527853", "0.55274725", "0.5526852", "0.5524884", "0.5521776", "0.55198795", "0.55158323", "0.55089957" ]
0.0
-1
Turns a plugin!resource to [plugin, resource] with the plugin being undefined if the name did not have a plugin prefix.
function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitPrefix(name){var prefix,index=name?name.indexOf('!'):-1;if(index > -1){prefix = name.substring(0,index);name = name.substring(index + 1,name.length);}return [prefix,name];} //Creates a parts array for a relName where first part is plugin ID,", "function build_plugin_names() {\n const args = Norma(\n '{name:s, builtin:s|a?, prefix:s|a?, system:a?}',\n arguments\n )\n\n const name = args.name\n\n const builtin_list = args.builtin\n ? Array.isArray(args.builtin)\n ? args.builtin\n : [args.builtin]\n : []\n\n const prefix_list = args.prefix\n ? Array.isArray(args.prefix)\n ? args.prefix\n : [args.prefix]\n : []\n\n const system_modules = args.system || []\n\n const plugin_names = []\n\n // Do the builtins first! But only for the framework module, see above.\n if (!name.match(/^[./]/)) {\n builtin_list.forEach(function (builtin) {\n plugin_names.push({ type: 'builtin', name: builtin + name })\n prefix_list.forEach(function (prefix) {\n plugin_names.push({ type: 'builtin', name: builtin + prefix + name })\n })\n })\n }\n\n // Try the prefix first - this ensures something like seneca-joi works\n // where there is also a joi module\n prefix_list.forEach(function (prefix) {\n plugin_names.push({ type: 'normal', name: prefix + name })\n })\n\n // Vanilla require on the plugin name.\n // Common case: the require succeeds on first module parent,\n // because the plugin is an npm module\n // in the code calling the framework.\n // You can't load node system modules as plugins, however.\n if (-1 == system_modules.indexOf(name)) {\n plugin_names.push({ type: 'normal', name: name })\n }\n\n // OK, probably not an npm module, try locally.\n plugin_names.push({ type: 'normal', name: './' + name })\n\n prefix_list.forEach(function (prefix) {\n plugin_names.push({ type: 'normal', name: './' + prefix + name })\n })\n\n return plugin_names\n}", "resourceNamed(name) {\n return this.object.plugin.urlForResourceNamed_(name)\n }", "function plugins(loader) {\n if (typeof indexOf == 'undefined')\n indexOf = Array.prototype.indexOf;\n\n loader._extensions.push(plugins);\n\n var loaderNormalize = loader.normalize;\n loader.normalize = function(name, parentName, parentAddress) {\n var loader = this;\n // if parent is a plugin, normalize against the parent plugin argument only\n var parentPluginIndex;\n if (parentName && (parentPluginIndex = parentName.indexOf('!')) != -1)\n parentName = parentName.substr(0, parentPluginIndex);\n\n return Promise.resolve(loaderNormalize.call(loader, name, parentName, parentAddress))\n .then(function(name) {\n // if this is a plugin, normalize the plugin name and the argument\n var pluginIndex = name.lastIndexOf('!');\n if (pluginIndex != -1) {\n var argumentName = name.substr(0, pluginIndex);\n\n // plugin name is part after \"!\" or the extension itself\n var pluginName = name.substr(pluginIndex + 1) || argumentName.substr(argumentName.lastIndexOf('.') + 1);\n\n // normalize the plugin name relative to the same parent\n return new Promise(function(resolve) {\n resolve(loader.normalize(pluginName, parentName, parentAddress));\n })\n // normalize the plugin argument\n .then(function(_pluginName) {\n pluginName = _pluginName;\n return loader.normalize(argumentName, parentName, parentAddress, true);\n })\n .then(function(argumentName) {\n return argumentName + '!' + pluginName;\n });\n }\n\n // standard normalization\n return name;\n });\n };\n\n var loaderLocate = loader.locate;\n loader.locate = function(load) {\n var loader = this;\n\n var name = load.name;\n\n // only fetch the plugin itself if this name isn't defined\n if (this.defined && this.defined[name])\n return loaderLocate.call(this, load);\n\n // plugin\n var pluginIndex = name.lastIndexOf('!');\n if (pluginIndex != -1) {\n var pluginName = name.substr(pluginIndex + 1);\n\n // the name to locate is the plugin argument only\n load.name = name.substr(0, pluginIndex);\n\n var pluginLoader = loader.pluginLoader || loader;\n\n // load the plugin module\n // NB ideally should use pluginLoader.load for normalized,\n // but not currently working for some reason\n return pluginLoader['import'](pluginName)\n .then(function() {\n var plugin = pluginLoader.get(pluginName);\n plugin = plugin['default'] || plugin;\n\n // allow plugins to opt-out of build\n if (plugin.build === false && loader.pluginLoader)\n load.metadata.build = false;\n\n // store the plugin module itself on the metadata\n load.metadata.plugin = plugin;\n load.metadata.pluginName = pluginName;\n load.metadata.pluginArgument = load.name;\n load.metadata.buildType = plugin.buildType || \"js\";\n\n // run plugin locate if given\n if (plugin.locate)\n return plugin.locate.call(loader, load);\n\n // otherwise use standard locate without '.js' extension adding\n else\n return Promise.resolve(loader.locate(load))\n .then(function(address) {\n return address.replace(/\\.js$/, '');\n });\n });\n }\n\n return loaderLocate.call(this, load);\n };\n\n var loaderFetch = loader.fetch;\n loader.fetch = function(load) {\n var loader = this;\n // ignore fetching build = false unless in a plugin loader\n if (load.metadata.build === false && loader.pluginLoader)\n return '';\n else if (load.metadata.plugin && load.metadata.plugin.fetch && !load.metadata.pluginFetchCalled) {\n load.metadata.pluginFetchCalled = true;\n return load.metadata.plugin.fetch.call(loader, load, loaderFetch);\n }\n else\n return loaderFetch.call(loader, load);\n };\n\n var loaderTranslate = loader.translate;\n loader.translate = function(load) {\n var loader = this;\n if (load.metadata.plugin && load.metadata.plugin.translate)\n return Promise.resolve(load.metadata.plugin.translate.call(loader, load)).then(function(result) {\n if (typeof result == 'string')\n load.source = result;\n return loaderTranslate.call(loader, load);\n });\n else\n return loaderTranslate.call(loader, load);\n };\n\n var loaderInstantiate = loader.instantiate;\n loader.instantiate = function(load) {\n var loader = this;\n if (load.metadata.plugin && load.metadata.plugin.instantiate)\n return Promise.resolve(load.metadata.plugin.instantiate.call(loader, load)).then(function(result) {\n if (result) {\n // load.metadata.format = 'defined';\n // load.metadata.execute = function() {\n // return result;\n // };\n return result;\n }\n return loaderInstantiate.call(loader, load);\n });\n else if (load.metadata.plugin && load.metadata.plugin.build === false) {\n load.metadata.format = 'defined';\n load.metadata.deps.push(load.metadata.pluginName);\n load.metadata.execute = function() {\n return loader.newModule({});\n };\n return loaderInstantiate.call(loader, load);\n }\n else\n return loaderInstantiate.call(loader, load);\n }\n\n}", "function normalizePluginParts(argumentName, pluginName) {\n if (defaultExtension && argumentName.substr(argumentName.length - 3, 3) == '.js')\n argumentName = argumentName.substr(0, argumentName.length - 3);\n\n if (loader.pluginFirst) {\n return pluginName + '!' + argumentName;\n }\n else {\n return argumentName + '!' + pluginName;\n }\n }", "function combinePluginParts(loader, argumentName, pluginName, defaultExtension) {\n if (defaultExtension && argumentName.substr(argumentName.length - 3, 3) == '.js')\n argumentName = argumentName.substr(0, argumentName.length - 3);\n\n if (loader.pluginFirst) {\n return pluginName + '!' + argumentName;\n }\n else {\n return argumentName + '!' + pluginName;\n }\n }", "function combinePluginParts(loader, argumentName, pluginName, defaultExtension) {\n if (defaultExtension && argumentName.substr(argumentName.length - 3, 3) == '.js')\n argumentName = argumentName.substr(0, argumentName.length - 3);\n\n if (loader.pluginFirst) {\n return pluginName + '!' + argumentName;\n }\n else {\n return argumentName + '!' + pluginName;\n }\n }", "function splitPluginMid(mid) {\n\t\tvar index = mid.indexOf(\"!\");\n\t\tif (index === -1) {\n\t\t\treturn {\n\t\t\t\tmid: mid\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tmid: mid.substring(0, index),\n\t\t\t\tresource: mid.substring(index + 1, mid.length)\n\t\t\t};\n\t\t}\n\t}", "function loadPreset(name, opts, relativeTo) {\n\tvar path = resolve(name, relativeTo),\n\t\tmod = normalizePreset(path && req(path), null, opts.options);\n\tif (!mod) throw new Error('Preset \"'+name+'\" not found.');\n\n\tpath = dirname(path);\n\n\tvar out = {\n\t\talias: {}\n\t};\n\tif (mod.presets) {\n\t\tvar availablePresets = getChildren(path, 'preset', out.alias);\n\t\tout.presets = mod.presets.map(function(preset) {\n\t\t\tif (typeof preset!=='string') {\n\t\t\t\tpreset = findAndRemove(preset, path, availablePresets);\n\t\t\t}\n\t\t\treturn loadPreset(preset, opts, path);\n\t\t});\n\t}\n\n\tif (mod.plugins) {\n\t\tvar availablePlugins = getChildren(path, 'plugin', out.alias);\n\t\tout.plugins = mod.plugins.map(function(plugin) {\n\t\t\tvar name = Array.isArray(plugin) ? plugin[0] : plugin;\n\t\t\tif (typeof name!=='string') {\n\t\t\t\tif (name._original_name) {\n\t\t\t\t\t// console.log('using _original_name: ', name._original_name);\n\t\t\t\t\tname = name._original_name;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tname = findAndRemove(name, path, availablePlugins);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!name) return plugin;\n\n\t\t\tname = resolve(name, path);\n\t\t\tname = getModulePath(name);\n\t\t\tif (opts) {\n\t\t\t\tif (opts.cwd) name = relative(opts.cwd, name);\n\t\t\t\tif (opts.transform) name = opts.transform(name);\n\t\t\t}\n\t\t\treturn Array.isArray(plugin) ? [name].concat(plugin.slice(1)) : name;\n\t\t});\n\t}\n\treturn out;\n}", "function alias(newName, oldPlugin) {\r\n var name = oldPlugin.name, plugin = __rest(oldPlugin, [\"name\"]);\r\n return __assign({ name: newName }, plugin);\r\n}", "function processNaming(resources) {\n return resources.reduce((col, res) => {\n col[res.spec.kind] = {\n scope: res.spec.scope ? res.spec.scope.kind : undefined,\n plural: res.spec.plural\n };\n return col;\n }, {})\n}", "getPluginData(name) {\r\n const data = this._plugins\r\n .map(p => (Array.isArray(p.data) ? p.data : [p.data]))\r\n .reduce((acc, arr) => [...acc, ...arr], []);\r\n return name ? data.filter((d) => d.name === name) : data;\r\n }", "get resources() {\n return this.resource ? [this.resource] : [];\n }", "function normalizePlugin(normalize, name, parentName, isPlugin, sync) {\n var loader = this;\n // if parent is a plugin, normalize against the parent plugin argument only\n if (parentName) {\n var parentPluginIndex;\n if (loader.pluginFirst) {\n if ((parentPluginIndex = parentName.lastIndexOf('!')) != -1)\n parentName = parentName.substr(parentPluginIndex + 1);\n }\n else {\n if ((parentPluginIndex = parentName.indexOf('!')) != -1)\n parentName = parentName.substr(0, parentPluginIndex);\n }\n }\n\n // if this is a plugin, normalize the plugin name and the argument\n var pluginIndex = name.lastIndexOf('!');\n if (pluginIndex != -1) {\n var argumentName;\n var pluginName;\n\n if (loader.pluginFirst) {\n argumentName = name.substr(pluginIndex + 1);\n pluginName = name.substr(0, pluginIndex);\n }\n else {\n argumentName = name.substr(0, pluginIndex);\n pluginName = name.substr(pluginIndex + 1) || argumentName.substr(argumentName.lastIndexOf('.') + 1);\n }\n\n // note if normalize will add a default js extension\n // if so, remove for backwards compat\n // this is strange and sucks, but will be deprecated\n var defaultExtension = loader.defaultJSExtensions && argumentName.substr(argumentName.length - 3, 3) != '.js';\n\n // put name back together after parts have been normalized\n function normalizePluginParts(argumentName, pluginName) {\n if (defaultExtension && argumentName.substr(argumentName.length - 3, 3) == '.js')\n argumentName = argumentName.substr(0, argumentName.length - 3);\n\n if (loader.pluginFirst) {\n return pluginName + '!' + argumentName;\n }\n else {\n return argumentName + '!' + pluginName;\n }\n }\n\n if (sync) {\n argumentName = loader.normalizeSync(argumentName, parentName);\n pluginName = loader.normalizeSync(pluginName, parentName);\n\n return normalizePluginParts(argumentName, pluginName);\n }\n else {\n // third argument represents that this is a plugin call\n // which in turn will skip default extension adding within packages\n return Promise.all([\n loader.normalize(argumentName, parentName, true),\n loader.normalize(pluginName, parentName, true)\n ])\n .then(function(normalized) {\n return normalizePluginParts(normalized[0], normalized[1]);\n });\n }\n }\n else {\n return normalize.call(loader, name, parentName, isPlugin);\n }\n }", "function preparePluginList(list)\n {\n const result = [];\n for (let index = 0; index < list.length; index++)\n {\n if (list[index].postcssPlugin)\n {\n result.push(list[index].postcssPlugin);\n }\n else\n {\n const source = list[index].toString();\n if (source.indexOf('only partially supported by') > -1)\n {\n result.push('doiuse');\n }\n else if (source.indexOf('if ( config.imports ) { style.walkAtRules( updateImport ); }') > -1)\n {\n result.push('urlrewrite');\n }\n else\n {\n console.log('Not found', source);\n }\n }\n }\n return result;\n }", "get(prefix, name) {\n let resourceName = resources[prefix + name];\n if(!instances[prefix + name]) {\n instances[prefix + name] = new resourceName();\n }\n return instances[prefix + name];\n }", "get resources() {\n return [this.resource];\n }", "function loadPlugin(prefix, id, dirname, loc, i) {\n let pluginLoc = prefix && resolve(`${prefix}-${id}`, dirname) || resolve(id, dirname);\n if (pluginLoc) {\n return require(pluginLoc);\n } else {\n throw new ReferenceError(msg(\"pluginUnknown\", id, loc, i, dirname));\n }\n}", "function makeRelParts(relName){return relName?splitPrefix(relName):[];}", "function createPluginIconsRule() {\n const packageNames = {};\n return {\n test: /\\.svg$/,\n include(svgPath) {\n const dirName = path.dirname(svgPath);\n const isIconDir = dirName.endsWith(path.join(\"assets\", \"icons\"));\n if (!isIconDir) {\n return false;\n }\n\n const packageName = readPackageName(\n path.resolve(dirName, \"..\", \"..\", \"package.json\")\n );\n\n const isTerriaJsPlugin = packageName\n ? PluginPackagePattern.test(packageName)\n : false;\n\n packageNames[svgPath] = packageName;\n return isTerriaJsPlugin;\n },\n loader: require.resolve(\"svg-sprite-loader\"),\n options: {\n esModule: false,\n symbolId: (svgPath) => {\n // Generate a symbolId by concatenating the package name and the icon name\n const packageName = packageNames[svgPath] || \"terriajs-plugin-\";\n const iconName = path.basename(svgPath, \".svg\");\n const symbolId = `${packageName}-${iconName}`;\n return symbolId;\n }\n }\n };\n}", "_convertFrom(resource, opts = {}, children = false) {\n if (resource instanceof Array) {\n return resource.map((r) => this._convertFrom(r, opts, children));\n }\n if (!resource)\n return null;\n const r = (resource.toJSONHidden\n ? resource.toJSONHidden(opts)\n : resource);\n const convert = r;\n // If the resource has children, and the paramater is set, loop over\n // children and apply the function recursively.\n if (r.children && children) {\n delete convert.path;\n delete convert.parent;\n const c = this._convertFrom(r.children, opts, true);\n if (c instanceof Array)\n convert.children = c;\n else if (c)\n convert.children = [c];\n }\n convert.id = r._id;\n delete convert._id;\n delete convert.__v;\n return r;\n }", "function resourceHintWebpackPluginAlterAssetTags(htmlPluginData, callback) {\n const htmlWebpackPluginOptions = htmlPluginData.plugin.options\n const pluginData = objectAssign({}, htmlPluginData)\n const tags = {\n prefetch: [],\n // https://w3c.github.io/preload/#link-type-preload\n preload: [],\n }\n // Create Resource tags\n Object.keys(tags).forEach(resourceHintType => {\n // Check if it is disabled for the current htmlWebpackPlugin instance:\n // e.g.\n // new HtmlWebpackPlugin({\n // prefetch: false\n // })\n if (htmlWebpackPluginOptions[resourceHintType] === false) {\n return\n }\n // If no options are found all files are prefetched / preload\n const fileFilters = htmlWebpackPluginOptions[resourceHintType]\n ? [].concat(htmlWebpackPluginOptions[resourceHintType])\n : defaultFilter\n // Process every filter\n fileFilters.forEach(filter => {\n if (filter.indexOf('*') !== -1) {\n // @start me\n Array.prototype.push.apply(\n tags[resourceHintType],\n addResourceHintTags(\n resourceHintType,\n filter,\n pluginData.head,\n htmlWebpackPluginOptions\n )\n )\n // @end me\n Array.prototype.push.apply(\n tags[resourceHintType],\n addResourceHintTags(\n resourceHintType,\n filter,\n pluginData.body,\n htmlWebpackPluginOptions\n )\n )\n } else {\n tags[resourceHintType].push(\n createResourceHintTag(\n filter,\n resourceHintType,\n htmlWebpackPluginOptions\n )\n )\n }\n })\n })\n // Add all Resource tags to the head\n // Array.prototype.push.apply(pluginData.head, tags.preload.map(addPreloadType));\n // Array.prototype.push.apply(pluginData.head, tags.prefetch);\n // @start me\n var head = tags.preload.map(addPreloadType)\n Array.prototype.push.apply(head, pluginData.head)\n Array.prototype.push.apply(head, tags.prefetch)\n pluginData.head = head\n // @end me\n callback(null, pluginData)\n}", "loadResource(name) {\n if (!(name in this.resources)) {\n return Promise.reject(name);\n }\n\n const resource = this.resources[name];\n if (resource.promise) {\n return resource.promise;\n }\n\n if (!(resource.type in this.loaders)) {\n return Promise.resolve(name);\n }\n\n const loader = this.loaders[resource.type];\n resource.promise = loader(resource.url);\n return resource.promise;\n}", "function repairResource(resource) {\n return _.extend({ metadata: resource }, resource)\n }", "getType(name) {\n let upName = name[0].toUpperCase() + name.slice(1)\n return objReduce(this.system.statePlugins, (val, namespace) => {\n let thing = val[name]\n if(thing)\n return {[namespace+upName]: thing}\n })\n }", "function uuplugin() { // @return Array: [\"plugin-name\", ...]\r\n return uukeys(uuplugin);\r\n}", "getResourcePath(resourceName) {\n let namespace = this.defaultNamespace;\n let fullName = resourceName;\n if (resourceName.includes(':')) {\n ([namespace, fullName] = resourceName.split(':'));\n }\n const fullPath = fullName.split('/');\n const name = fullPath[fullPath.length - 1];\n const path = fullPath.slice(0, -1);\n return {\n namespace, path, fullPath, name, fullPathWithNamespace: [namespace, ...fullPath], fullName: `${namespace}:${fullName}`,\n };\n }", "function registerPlugins (log) {\n const plugins = global.FLINT.plugins\n const Plugin = mongoose.model('Plugin')\n\n return Promise.all(plugins.map(async (PluginClass) => {\n if (!PluginClass.uid) throw new Error(`${PluginClass.name} is missing a UID.`)\n if (!PluginClass.version) throw new Error(`${PluginClass.name} is missing a version.`)\n\n mongoose.plugin((schema, options) => {\n if (schema.name === undefined) return null\n return new PluginClass(schema, options)\n })\n\n const pathToIcon = PluginClass.icon\n const buffer = await readFileAsync(pathToIcon, null)\n const foundPlugin = await Plugin.findOne({ uid: PluginClass.uid })\n\n const pluginData = Object.assign({}, {\n title: PluginClass.title,\n name: PluginClass.name,\n uid: PluginClass.uid,\n version: PluginClass.version,\n icon: {\n path: PluginClass.icon,\n buffer\n }\n }, PluginClass.model)\n\n if (foundPlugin) {\n // Update the existing plugin in case its configuration (icon, name, etc) have changed.\n const updatedPlugin = Object.assign(foundPlugin, pluginData, { uid: PluginClass.uid })\n const savedPlugin = await updatedPlugin.save()\n if (!savedPlugin) log.error(`Could not save the [${PluginClass.name}] plugin to the database.`)\n } else {\n // Create a new plugin instance by including the Class model\n // The PluginSchema has { strict: false } so additions to the\n // model will work fine.\n const newPlugin = new Plugin(pluginData)\n const savedPlugin = await newPlugin.save()\n if (!savedPlugin) log.error(`Could not save the [${PluginClass.name}] plugin to the database.`)\n }\n }))\n}", "function getPluginElementNames(namespace){\n return getCacheData('/xapi/spawner/ids/' + namespace);\n }", "function getPluginComp() { return pluginComp; }", "constructArns() {\n const Resource = [];\n\n if (this.event) {\n const arn = this.event.methodArn;\n logger.info(`The arn which was passed in via the event is: ${arn}`);\n Resource.push(arn.trim());\n } else {\n const colonDelimiter = ':';\n const slashDelimiter = '/';\n const apiIds = this.resourceGroup.apiIds;\n\n apiIds.forEach((apiId) => {\n logger.info(`apiId is ${JSON.stringify(apiId)}`);\n const arn = 'arn:aws:execute-api:'\n .concat(this.region)\n .concat(colonDelimiter)\n .concat(this.accountId)\n .concat(colonDelimiter)\n .concat(apiId.api_name)\n .concat(slashDelimiter)\n .concat(apiId.phase)\n .concat(slashDelimiter)\n .concat(apiId.verb)\n .concat(slashDelimiter);\n\n if (apiId.resource) {\n arn.concat(apiId.resource);\n }\n\n Resource.push(arn.trim());\n });\n }\n return Resource;\n }", "function optimizePluginsArray(plugins) {\n return plugins.map(item => [item]).reduce((arr, item) => {\n const last = arr[arr.length - 1];\n\n if (last && item[0].type === last[0].type) {\n last.push(item[0]);\n }\n else {\n arr.push(item);\n }\n return arr;\n }, []);\n}", "function kindToResource(kind, humanize) {\n if (!kind) {\n return \"\";\n }\n var resource = kind;\n if (humanize) {\n var humanizeKind = $filter(\"humanizeKind\");\n resource = humanizeKind(resource);\n }\n resource = String(resource).toLowerCase();\n if (resource === 'endpoints' || resource === 'securitycontextconstraints') {\n // no-op, plural is the singular\n }\n else if (resource[resource.length-1] === 's') {\n resource = resource + 'es';\n }\n else if (resource[resource.length-1] === 'y') {\n resource = resource.substring(0, resource.length-1) + 'ies';\n }\n else {\n resource = resource + 's';\n }\n\n return resource;\n }", "plugin(plugin) {\n let known = this.pluginMap.get(plugin);\n if (known === undefined || known && known.spec != plugin)\n this.pluginMap.set(plugin, known = this.plugins.find(p => p.spec == plugin) || null);\n return known && known.update(this).value;\n }", "static registerActions() {\n webAPI.registerAction(\"get-plugin-prefix\", (data, reply) => {\n if (Plugin._plugins[data.pluginId] !== undefined) {\n reply(Plugin._plugins[data.pluginId].prefix);\n } else {\n reply(false);\n }\n });\n\n webAPI.registerAction(\"get-plugin-logs\", (data, reply) => {\n reply(Plugin._plugins[data.pluginId].logs);\n }, \"owner\");\n\n webAPI.registerAction(\"set-plugin-prefix\", (data, reply) => {\n Plugin._plugins[data.pluginId].prefix = data.prefix;\n reply();\n }, \"owner\");\n\n webAPI.registerAction(\"get-enabled\", (data, reply) => {\n if (Plugin._plugins[data.pluginId] !== undefined) {\n reply(Plugin._plugins[data.pluginId].enabled);\n } else {\n reply(false);\n }\n });\n\n webAPI.registerAction(\"set-enabled\", (data, reply) => {\n Plugin._plugins[data.pluginId].enabled = data.enabled;\n reply();\n }, \"owner\");\n\n webAPI.registerAction(\"get-plugins\", (data, reply, userDiscordId) => {\n let pluginsObjects = [];\n\n for (const key in Plugin.getAll()) {\n if (Plugin.getAll().hasOwnProperty(key)) {\n pluginsObjects.push(Plugin.getAll()[key].toObject(!Owner.isOwner(userDiscordId)));\n }\n }\n\n reply(pluginsObjects);\n });\n }", "function resolvers_getActivePlugins() {\n var url, results;\n return regeneratorRuntime.wrap(function getActivePlugins$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return actions_setIsRequesting('getActivePlugins', true);\n\n case 2:\n _context.prev = 2;\n url = WC_ADMIN_NAMESPACE + '/plugins/active';\n _context.next = 6;\n return Object(external_this_wp_dataControls_[\"apiFetch\"])({\n path: url,\n method: 'GET'\n });\n\n case 6:\n results = _context.sent;\n _context.next = 9;\n return actions_updateActivePlugins(results.plugins, true);\n\n case 9:\n _context.next = 15;\n break;\n\n case 11:\n _context.prev = 11;\n _context.t0 = _context[\"catch\"](2);\n _context.next = 15;\n return setError('getActivePlugins', _context.t0);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, plugins_resolvers_marked, null, [[2, 11]]);\n}", "function addResourceHintTags(\n resourceHintType,\n filter,\n assetTags,\n htmlWebpackPluginOptions\n) {\n const urls = assetTags\n .map(tag => tag.attributes.src || tag.attributes.href)\n .filter(url => url)\n .filter(minimatch.filter(filter))\n // Add a ResourceHint for every match\n return urls.map(url =>\n createResourceHintTag(url, resourceHintType, htmlWebpackPluginOptions)\n )\n}", "function getPlugin(name) {\n\tlogger.entry(\"pluginLoader.getPlugin\", name);\n\t\n\tvar plugin = null;\n\tif(plugins[name]) {\n\t\tplugin = plugins[name];\n\t}\n\t\n\tlogger.exit(\"pluginLoader.getPlugin\", plugin);\n\treturn plugin;\n}", "function add(name, plugin) {\n\t\tvar a = registry[name];\n\n\t\tif (a == null) {\n\t\t\ta = registry[name] = [];\n\t\t}\n\n\t\tplugin = aperture.util.viewOf(plugin);\n\n\t\t// clear this in case there is a problem loading it\n\t\tvar m = plugin.module;\n\t\tplugin.module = null;\n\n\t\t// register the plugin.\n\t\ta.push(plugin);\n\n\t\t// load required modules\n\t\tif (u.isString(m)) {\n\t\t\trequire(['../../' + m], function(module) {\n\t\t\t\tplugin.module = module;\n\t\t\t});\n\t\t}\n\t}", "for (const factory of plugins) {\n if (factory.pluginType === 'currency') {\n const plugin = await factory.makePlugin({\n io: { ...io, folder: downgradeDisklet(io.disklet) }\n })\n payload[plugin.currencyInfo.pluginName] = plugin\n } else if (factory.pluginType === 'exchange') {\n const plugin = await factory.makePlugin({ io })\n payload[plugin.exchangeInfo.exchangeName] = plugin\n }\n }", "function makeRelParts(relName) {\r\n return relName ? splitPrefix(relName) : [];\r\n }", "function localResolve(preset) {\n return Array.isArray(preset)\n ? [require.resolve(preset[0]), preset[1]]\n : require.resolve(preset);\n}", "getResource(internal_name) {\n if (IsString(internal_name, true)) {\n const resource = this.asset.resource.get(internal_name);\n return resource ? resource : {};\n }\n }", "function normalizePluginOptions(schema, \n// This allows us to automatically normalize undefined to { id: \"default\" }\noptions = {}) {\n // All plugins can be provided an \"id\" option (multi-instance support)\n // we add schema validation automatically\n const finalSchema = schema.append({\n id: validationSchemas_1.PluginIdSchema,\n });\n const { error, warning, value } = finalSchema.validate(options, {\n convert: false,\n });\n printWarning(warning);\n if (error) {\n throw error;\n }\n return value;\n}", "static initPlugins(plugInto, ...plugins) {\n let property = plugInto.plugins || (plugInto.plugins = {});\n\n for (let PluginClass of plugins) {\n property[PluginClass.$name] = new PluginClass(plugInto);\n }\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "static initPlugins(plugInto, ...plugins) {\n const property = plugInto.plugins || (plugInto.plugins = {});\n\n for (const PluginClass of plugins) {\n property[PluginClass.$name] = new PluginClass(plugInto);\n }\n }", "function getPlugins(opts) {\n const plugins = new Set();\n\n const rubyPlugins = opts.rubyPlugins.trim();\n if (rubyPlugins.length > 0) {\n rubyPlugins.split(\",\").forEach((plugin) => plugins.add(plugin.trim()));\n }\n\n if (opts.rubySingleQuote) {\n plugins.add(\"plugin/single_quotes\");\n }\n\n if (opts.trailingComma !== \"none\") {\n plugins.add(\"plugin/trailing_comma\");\n }\n\n return Array.from(plugins);\n}", "get plugins () {\n return this._chain.reduce(\n (plugins, {config}) => config.plugins\n ? plugins.concat(config.plugins)\n : plugins,\n []\n )\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function makeRelParts(relName) {\n return relName ? splitPrefix(relName) : [];\n }", "function findPlugin(name) {\n return require(\"./tasks/\" + name + \".js\");\n}", "function getPlugins() {\n return plugins;\n}", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "function registerResources(rs) {\r\n registerPromise = registerPromise.then(() => {\r\n return Promise.all(rs.map((r) => { return Promise.denodeify(pushResource)(r); }));\r\n });\r\n }", "getPlugins() {\n let plugins = this.plugins;\n for (let router of Object.values(this.destinations)) {\n plugins = plugins.concat(router.getPlugins());\n }\n return plugins;\n }", "function getResourceName(resource) {\n switch (resource) {\n case Resource.Wool:\n return \"Wool\";\n case Resource.Ore:\n return \"Ore\";\n case Resource.Lumber:\n return \"Lumber\";\n case Resource.Brick:\n return \"Brick\";\n case Resource.Grain:\n return \"Grain\";\n case Resource.Desert:\n return \"Produces Nothing\";\n }\n}", "function build_plugin_desc(spec, useopts, eraro) {\n const plugin = spec.plugin\n\n // Don't do much with plugin options, just ensure they are an object.\n let options =\n null == spec.options\n ? null == plugin.options\n ? {}\n : plugin.options\n : spec.options\n options = 'object' === typeof options ? options : { value$: options }\n\n // Start building the return value.\n let plugin_desc = {\n options: options,\n callback: spec.callback,\n history: [],\n }\n\n // The most common case, where the plugin is\n // specified as a string name to be required in.\n if ('string' === typeof plugin) {\n plugin_desc.name = plugin\n }\n\n // Define the plugin with a function, most often used for small,\n // on-the-fly plugins.\n else if ('function' === typeof plugin) {\n if ('' !== plugin.name) {\n plugin_desc.name = plugin.name\n }\n\n // The function has no name, so generate a name for the plugin\n else {\n const prefix = Array.isArray(useopts.prefix)\n ? useopts.prefix[0]\n : useopts.prefix\n plugin_desc.name = prefix + Nid()\n }\n\n plugin_desc.init = plugin\n }\n\n // Provide some or all of plugin definition directly.\n else if ('object' === typeof plugin) {\n plugin_desc = Object.assign({}, plugin, plugin_desc)\n\n let name = plugin_desc.name\n if ('string' !== typeof name) {\n name = null != plugin_desc.init ? plugin_desc.init.name : null\n }\n\n if (null == name) {\n throw eraro('no_name', { plugin: plugin })\n } else {\n plugin_desc.name = name\n }\n\n if (null != plugin_desc.init && 'function' !== typeof plugin_desc.init) {\n throw eraro('no_init_function', {\n name: name,\n plugin: plugin,\n })\n }\n }\n\n // Options as an argument to the _use_ function override options\n // in the plugin description object.\n plugin_desc.options = Object.assign(\n {},\n plugin_desc.options || {},\n options || {}\n )\n\n // Plugins can be tagged.\n // The tag can be embedded inside the name using a $ separator: _name$tag_.\n // Note: the $tag suffix is NOT considered part of the file name!\n\n const m = /^(.+)\\$(.+)$/.exec(plugin_desc.name)\n if (m) {\n plugin_desc.name = m[1]\n plugin_desc.tag = m[2]\n }\n\n plugin_desc.full =\n plugin_desc.name +\n (null == plugin_desc.tag || '' == plugin_desc.tag\n ? ''\n : '$' + plugin_desc.tag)\n\n // Plugins must have a name.\n if (!plugin_desc.name) {\n throw eraro('no_name', plugin_desc)\n }\n\n return plugin_desc\n}", "_convertTo(resource) {\n if (resource instanceof Array) {\n return resource.map(r => this._convertTo(r));\n }\n const r = resource;\n if (resource.id)\n r._id = resource.id;\n delete r.id;\n return resource;\n }", "function handlePlugins$1(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function ResolveRSModulePlugin(alias) {\n this.alias = alias || 'rs';\n}", "registerPlugin(name, endpoints) {\n console.log('Enabling plugin: ', name);\n if (this.plugin_list.indexOf(name) >= 0) {\n debug('Plugin already enabled:', name);\n return;\n }\n this.plugin_list.push(name);\n if (endpoints.middlewares) {\n for (var mw in endpoints.middlewares) {\n for (var e = 0; e < endpoints.middlewares[mw].length; e++) {\n this.middleware[mw].use(endpoints.middlewares[mw][e]);\n }\n }\n }\n if (endpoints.init) {\n try {\n endpoints.init(this);\n }\n catch (err) {\n if (err) {\n throw new Error(err);\n }\n }\n }\n debug('Plugin Enabled: ', name);\n }", "function prefixAssets(prefix, assets) {\n return _.map(assets, function(asset) {\n return prefix + asset;\n });\n}", "function loadPlugin(plugin) {\n // Die Plugins werden abhängig von ihrer Api Version unterschiedlich geladen.\n switch (plugin.help.apiVersion) {\n case 1:\n // API v1: Es müssen keine gesonderten Argumente übergeben werden. Wird meistens von Overwrites verwendet. \n plugin.run();\n break;\n case 2:\n // API v2: Übergibt einfache Information wie die Bot-Instanze\n plugin.run(bot);\n break;\n \n default:\n // API v?: Die Api Version ist nicht bekannt. Das Plugin wird nicht geladen!\n console.error(`Failed to load Plugin '${plugin.help.name}': Unknown Api Version!`)\n break;\n }\n return;\n }", "getData(name) {\n const data = this._plugins\n .filter((p) => !!p.data)\n .map((p) => (Array.isArray(p.data) ? p.data : [p.data]))\n .reduce((acc, arr) => [...acc, ...arr], []);\n return name ? data.filter((d) => d.name === name) : data;\n }", "function getAudioResources(){\n\t//Load default resources\n\tvar audioResources = [\n\t\t[\"jump\",[\"resources/jump.mp3\",\"resources/jump.ogg\"],{channel:\"jump\"}],\n\t\t[\"hit\",[\"resources/hit.mp3\",\"resources/hit.ogg\"],{channel:\"hit\"}],\n\t\t[\"squish\",[\"resources/sword.mp3\",\"resources/sword.ogg\"],{channel:\"hit\"}],\n\t\t[\"explode\",[\"resources/megaexplosion.mp3\",\"resources/megaexplosion.ogg\"],{channel:\"boom\"}],\n\t\t[\"star\",[\"resources/coin.mp3\",\"resources/coin.ogg\"],{channel:\"hit\"}]\n \t];\n\tif($config.use_plugins){\n//\t\taudioResources = [];\n\t\tfor(var plugin in pluginHelper.loadedPlugins){\n\t\t\tif(pluginHelper.loadedPlugins[plugin].audio){\n\t\t\t\taudioResources.push(pluginHelper.loadedPlugins[plugin].audio);\n\t\t\t}\n\t\t}\n\t}\n\treturn audioResources;\n}", "function makeMap(name, relName) {\n var prefix, plugin,\n index = name.indexOf('!');\n\n if (index !== -1) {\n prefix = normalize(name.slice(0, index), relName);\n name = name.slice(index + 1);\n plugin = callDep(prefix);\n\n //Normalize according\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relName));\n } else {\n name = normalize(name, relName);\n }\n } else {\n name = normalize(name, relName);\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n p: plugin\n };\n }", "function makeMap(name, relName) {\n var prefix, plugin,\n index = name.indexOf('!');\n\n if (index !== -1) {\n prefix = normalize(name.slice(0, index), relName);\n name = name.slice(index + 1);\n plugin = callDep(prefix);\n\n //Normalize according\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relName));\n } else {\n name = normalize(name, relName);\n }\n } else {\n name = normalize(name, relName);\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n p: plugin\n };\n }", "function makeMap(name, relName) {\n var prefix, plugin,\n index = name.indexOf('!');\n\n if (index !== -1) {\n prefix = normalize(name.slice(0, index), relName);\n name = name.slice(index + 1);\n plugin = callDep(prefix);\n\n //Normalize according\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relName));\n } else {\n name = normalize(name, relName);\n }\n } else {\n name = normalize(name, relName);\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n p: plugin\n };\n }", "function makeMap(name, relName) {\n var prefix, plugin,\n index = name.indexOf('!');\n\n if (index !== -1) {\n prefix = normalize(name.slice(0, index), relName);\n name = name.slice(index + 1);\n plugin = callDep(prefix);\n\n //Normalize according\n if (plugin && plugin.normalize) {\n name = plugin.normalize(name, makeNormalize(relName));\n } else {\n name = normalize(name, relName);\n }\n } else {\n name = normalize(name, relName);\n }\n\n //Using ridiculous property names for space reasons\n return {\n f: prefix ? prefix + '!' + name : name, //fullName\n n: name,\n p: plugin\n };\n }", "function definePlugin(sName, fnFirstPass, fnLastPass) {\n var oPlugin = {\n name: sName,\n fnFirstPass: fnFirstPass,\n fnLastPass: fnLastPass\n };\n oInProgressFlags[sName] = false;\n aPlugins.push(oPlugin);\n ui$[sName] = function(v) {\n if (jQuery.isArray(v)) {\n _invokePlugin(oPlugin, aLastResults);\n return v;\n }\n // if a new query\n return pipe(v)[sName]().toArray();\n };\n }" ]
[ "0.6088341", "0.5513669", "0.5496837", "0.543208", "0.53964555", "0.5210579", "0.5210579", "0.5177312", "0.5127608", "0.5112156", "0.5010494", "0.49943906", "0.4879141", "0.48771456", "0.48741922", "0.47705242", "0.47443357", "0.47084403", "0.47025114", "0.46985525", "0.46838933", "0.46496877", "0.4619825", "0.45935532", "0.45855185", "0.4564409", "0.45620084", "0.4560475", "0.45316398", "0.45209023", "0.45142716", "0.45005676", "0.44892642", "0.4458196", "0.44474822", "0.4431794", "0.4418962", "0.44122005", "0.44085184", "0.44052085", "0.44051704", "0.4402132", "0.44016287", "0.43997574", "0.43968472", "0.43958992", "0.43958992", "0.4395456", "0.4395187", "0.43738478", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.43738082", "0.4372172", "0.43695587", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.43632847", "0.435875", "0.4349784", "0.43412018", "0.43406618", "0.43337274", "0.43231505", "0.43192554", "0.43147936", "0.43009198", "0.43009055", "0.42982352", "0.42951393", "0.42869955", "0.42869955", "0.42869955", "0.42869955", "0.4282071" ]
0.0
-1
Filter out all items except for the one passed in the argument
function onlyItem (item) { return function () { return $(this).val() == item.id; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n }", "function without(items, item) {\n return items.filter(function (i) { return i !== item; });\n}", "function without(items, item) {\n return items.filter(function (i) { return i !== item; });\n}", "function without(array$$1, excludedItems) {\n return array$$1.filter(function (item) { return !contains(excludedItems, item); });\n }", "static filterInvalidItems(items = [TestQuestion.structure]){\n return (items || []).filter((item = {}) => \n TestQuestion.isValidItem(item)\n );\n }", "function destroyer(arr) {\n let array = Array.from(arguments).slice(1);\n return arr.filter(function(item){\n return !array.includes(item)\n });\n }", "removeAllFilters() {}", "function keep() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t var result = first()(cleanValues);\n\t cleanValues.forEach(function (v) {\n\t if (v !== result) {\n\t return null;\n\t }\n\t });\n\t return result;\n\t };\n\t}", "function except(source, filter) {\n return source.filter(key => !filter.includes(key));\n}", "function filterRemovedItem(items) {\n var modifiedItems;\n modifiedItems = _.filter(items, function(item) {\n if (value.urltype == \"dynamic\") {\n return item.id !== value.id;\n } else {\n return item.url !== value.url;\n }\n });\n return modifiedItems;\n }", "function filterNotUnique(compare) {\n return merged.filter(function(element){\n return element !== compare;\n })\n }", "function destroyer2(arr) {\n var args = Array.from(arguments).slice(1);\n return arr.filter(function(val) {\n return !args.includes(val);\n });\n}", "function destroyer(arr) {\n // Remove all the values\n for (var i = 1; i < arguments.length; i++) {\n var skip = arguments[i];\n arr = arr.filter(function (e) {\n return e !== skip;\n });\n }\n return arr;\n}", "function without(array, excludedItems) {\n return array.filter(function (item) { return !contains(excludedItems, item); });\n}", "function destroyer(arr) {\n function checkThis(item) {\n return !(args.includes(item));\n }\n var args = Array.from(arguments);\n\n return args[0].filter(checkThis);\n}", "filterChangeSet(changeSet) {\n return excludeEmptyChangeSetItems(changeSet);\n }", "filterChangeSet(changeSet) {\n return excludeEmptyChangeSetItems(changeSet);\n }", "function destroyer(arr) {\n let args = [];\n for (let i = 1; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n // console.log(args)\n return arr.filter(item => !args.includes(item));\n}", "function destroyer(...args) {\n return arguments[0].filter(arg => !args.slice(1).includes(arg));\n}", "function destroyer(arr) {\n let newArr = [...arguments].slice(1);\n return arr.filter(a => !newArr.includes(a));\n}", "function falsyFilter(){\n for(var i = 0; i < mixedArray.length; i++){\n\tif(mixedArray[i] === false)\n {mixedArray.splice(i, 1)};\n\treturn mixedArray;\n }\n}", "function filterAll() {\n for (var i = 0, l = items.length; i < l; ++i) {\n filterItem(items[i], mapping[items[i].id])\n }\n }", "function destroyer(arr) {\n var compareArgs = Array.prototype.slice.call(arguments, 1);\n return arr.filter(function(item) {\n return compareArgs.indexOf(item) === -1;\n });\n}", "[REMOVE_MEAL_ITEM](state, item) {\n state.meal.items = state.meal.items.filter(i => i !== item);\n }", "function gooseFilter(birds){\n const geese = ['African', 'Roman Tufted', 'Toulouse', 'Pilgrim', 'Steinbacher'];\n return birds.filter(bird => !geese.includes(bird));\n}", "filterAndUpdate( callback, thisArg)\n //------------------------------------------------------------------------------------------------------\n {\n var itemsToRemove = [];\n\n this.forEach( function( item) {\n\n if ( ! callback.call(thisArg, item) ) {\n itemsToRemove.push(item);\n }\n\n }, thisArg);\n\n this.remove(itemsToRemove);\n\n return this;\n }", "function filterOutRepeats (txList) {\n return object => {\n return !txList.find(target => matchUtxo(target, object))\n }\n}", "function britainFilter(items){\n return items.currency_code !== \"USD\";\n }", "function destroyer(arr, ...rest) {\n return arr.filter(val => !rest.includes(val));\n}", "filter() {\n\t}", "filter() {\n\t}", "function destroyer(arr) {\n\n var args = [].slice.call(arguments);\n args.shift();\n\n arr = arr.filter(function (item) {\n\n for (var i = 0; i < args.length; i++) {\n if (item == args[i]) {\n return false;\n }\n }\n return true;\n\n });\n // Remove all the values\n return arr;\n}", "function destroyer(arr) {\n const args = [...arguments].slice(1);\n\n return arr.filter(e => !args.includes(e));\n}", "function removeItems(args){\n\t\tvar c = [];\n\t\t//Loop through all of the fullArray items for testing\n\t\tfor (var i = 0; i < args.length; i++) {\n\t\t\t//Check that items are not set for removal with \n\t\t\t//the indexOf parameter. indexOf allows us to filter non matched \n\t\t\t//array loop items. If destroyItems do not match the \n\t\t\t//fullArray loop items we push these clean accepted items to the\n\t\t\t//new array. Also negates having to use nested loops. \n\t\t\tif (destroyItems.indexOf(args[i]) === -1)\n\t\t\t{\n\t\t\t\t//Push all non matched items to a new returned array\n\t\t\t\tc.push(args[i]);\n\t\t\t} \n\t\t}\n\t\treturn c;\n\t} //checkItems Ends", "filter(keepIf) {\n const self = this;\n return new Seq(function* () {\n for (const element of self)\n if (keepIf(element))\n yield element;\n });\n }", "function destroyer(arr) {\n arr = Array.from(arguments).slice(0, 1)[0];\n let args = [...arguments].slice(1);\n return arr.filter(item => args.indexOf(item) == -1);\n}", "function filterDirectoryItems(items, remove = true) {\n\t\tlogTrace('invoking filterDirectoryItems($)', items);\n\n\t\tlet remainingItems = [];\n\n\t\tconst itemsLength = items.length;\n\t\tfor (let i = 0; i < itemsLength; i++) {\n\n\t\t\tconst item = items[i];\n\n\t\t\t// mark item node as being processed\n\t\t\titem.node.setAttribute('data-uttv-processed', '');\n\n\t\t\tif (remove === false) { continue; }\n\n\t\t\tif (isBlacklistedItem(item) === true) {\n\n\t\t\t\tif (removeDirectoryItem(item) === true) {\n\n\t\t\t\t\tlogVerbose('Removed item in directory due to being blacklisted:', item);\n\t\t\t\t\tcontinue;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlogError('Unable to remove blacklisted item in directory:', item);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tremainingItems.push(item);\n\t\t}\n\n\t\treturn remainingItems;\n\t}", "function gooseFilter(birds) {\n var geese = [\"African\", \"Roman Tufted\", \"Toulouse\", \"Pilgrim\", \"Steinbacher\"];\n var notgeese = birds.filter(function (bird) {\n return !geese.includes(bird);\n })\n\n\n return notgeese\n\n}", "function filterSidebarItems(items) {\n\t\tlogTrace('invoking filterSidebarItems($)', items);\n\n\t\tlet remainingItems = [];\n\n\t\tconst itemsLength = items.length;\n\t\tfor (let i = 0; i < itemsLength; i++) {\n\n\t\t\tconst item = items[i];\n\n\t\t\t// mark item node as being processed\n\t\t\titem.node.setAttribute('data-uttv-processed', '');\n\n\t\t\tif (isBlacklistedItem(item) === true) {\n\n\t\t\t\tif (removeSidebarItem(item) === true) {\n\n\t\t\t\t\tlogVerbose('Removed item in sidebar due to being blacklisted:', item);\n\t\t\t\t\tcontinue;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlogError('Unable to remove blacklisted item in sidebar:', item);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tremainingItems.push(item);\n\t\t}\n\n\t\treturn remainingItems;\n\t}", "function destroy(arr){\n let newArr = Array.from(arguments).slice(1);\n return arr.filter(a => !newArr.includes(a));\n}", "function filterTwos(elem) { return elem !== 2; }", "function filterTwos(elem) { return elem !== 2; }", "function filterExcluded(array){\n let excluded = ['h', 'w'];\n let new_array = array.slice(0,1);\n for(let i = 1; i < array.length; i++){\n let l = array[i].toLowerCase();\n if (isFirst(i, array) || !(excluded.includes(l))) new_array.push(array[i]);\n }\n return new_array;\n}", "clearAllExcept (state, payload) {\n state.list = state.list.filter(data => data.row === payload.row && data.col === payload.col)\n }", "function destroyer(arr) {\n\tvar args = Array.from(arguments).slice(1);\n\treturn arr.filter((i) => !args.includes(i));\n}", "function destroy(arr,...rest){\n return arr.filter(val => !rest.includes(val))\n}", "function destroyer(arr) {\n // Remove all the values\n var newArr = [];\n for(var i =1; i < arguments.length; i++) {\n newArr.push(arguments[i]);\n }\n return (arr.filter(el => newArr.indexOf(el) === -1 ));\n\n // return arr;\n}", "function removeItem(search){\n data.items = data.items.filter(function(el){\n return el.id !== search; \n });\n}", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n every(function (key) {\n return !filterObj[key];\n });\n }", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n every(function (key) {\n return !filterObj[key];\n });\n }", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n every(function (key) {\n return !filterObj[key];\n });\n }", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n every(function (key) {\n return !filterObj[key];\n });\n }", "filterMatchingItems(item) {\n if (this.state.shelf_life === 'All' && this.state.type === 'All') {\n return true;\n } else if (this.state.shelf_life === 'All' && this.state.type === item.type) {\n return true;\n } else if (this.state.shelf_life === item.shelf_life && this.state.type === \"All\") {\n return true;\n } else if (this.state.shelf_life === item.shelf_life && this.state.type === item.type) {\n return true;\n } else {\n return false;\n }\n\n }", "function destroyer(arr) {\n \n\tconst rest = Array.from(arguments);\n\tconst search = rest.shift(0);\n\t\n \tarr = search.filter(x => ! rest.includes(x));\n \treturn arr;\n}", "function without(arr, value) {\n return arr.filter(function(item) { return item !== value; });\n}", "function falsyFilter(){\nfor(var i = 0; i < mixedArray.length; i++) {\n if(mixedArray === true || mixedArray === \"true\" || mixedArray !== false)\n\t {mixedArray.slice(i, 1)}\n else return mixedArray;\n}\n}", "function destroyer(arr) {\n var checkIn = [];\n for (var dummyIndex = 1; dummyIndex < arguments.length; dummyIndex++) \n checkIn.push(arguments[dummyIndex]);\n return arr.filter(function(x){return checkIn.indexOf(x) == -1});\n}", "function badItems (rule, a) {\n\t if (!low.isArray(a)) {\n\t throw new Error('expected array to find bad items')\n\t }\n\t return a.filter(logic.notModifier(rule))\n\t}", "function filterNot(a,p){\n\tvar filteredElement = a.filter(isEven);\n\treturn filteredElement; //should return the array [1, 3, 5, 7, 9]\n}", "function filterItems (array, filter) {\n if(filter.trim().toLowerCase() === \"all\"){\n return array;\n };\n\n let filteredArray = array.filter ((element) => {\n return element.type == filter;\n });\n return filteredArray;\n}", "function getUnwanted(members) {\n return members.filter(item => !checkIntensity(getPersonProfile(item.decData[1])));\n }", "function destroyer(arr) {\n let extrArr = []\n for (let i = 1; i < arguments.length; i++) {\n extrArr.push(arguments[i])\n }\n\n arr = arr.filter((value) => extrArr.indexOf(value) === -1)\n\n return arr\n}", "function filter() {\n \n}", "function filterForRepeats (txList) {\n return object => {\n return !(!txList.find(target => matchUtxo(target, object)))\n }\n}", "function filterItems(){\r\n try {\r\n // return materials.filter(materialsArray => materialsArray.length > 6);\r\n return materials.filter(materialsArray => materialsArray.toLowerCase().indexOf('um') > -1);\r\n } catch (error) {\r\n console.log(error) // Type error\r\n }\r\n}", "function excludeAllSamplesFromSearch() {\n\tfor (var i=0; i<allTissues.length; i++){\n\t\tif (allTissues[i].view === allViews[activeView]) { // only include items for the active view\n\t\t\tallTissues[i].value = \"excluded\";\n\t\t\tallTissues[i].color = \"#FFFFFF\";\n\t\t}\n\t}\n\tupdateColors();\n}", "function destroyer(arr) {\n // Remove all the values\n let args = Array.from(arguments).splice(1);\n return arr.filter(element => !args.includes(element));\n}", "function defaultFilterFunction(thing, params, request) {\n if (Array.isArray(params.exclude) && ap.indexOf.call(params.exclude, thing.id) !== -1) {\n return false;\n }\n if (typeof params.exclude === 'string' && thing.id === params.exclude) {\n return false;\n }\n if (Array.isArray(params.only) && ap.indexOf.call(params.only, thing.id) === -1) {\n return false;\n }\n if (typeof params.only === 'string' && thing.id !== params.only) {\n return false;\n }\n return true;\n}", "function clean(args) {\n\treturn Array.prototype.filter.call(args, v => v !== INVALIDATE);\n}", "function destroyer(arr) {\n // Remove all the values\n //turn the argument of function to array\n var args = Array.prototype.slice.call(arguments);\n // turn arguments to array\n var arg = args.slice(1);\n console.log(args);\n // loop through array and each value that not in arguments return to newArr\n var newArr = args[0].filter(function(val) {\n if (arg.indexOf(val) == -1) {\n return true;\n }\n return false;\n });\n console.log(newArr);\n return newArr;\n}", "function exclude(arg) {\r\n\tswitch (typeof arg) {\r\n\t\tcase 'string': {\r\n\t\t\tif (this.record(arg)) {\r\n\t\t\t\tthis.remove(arg);\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\tcase 'function': {\r\n\t\t\treturn this.exclude(identifier(arg));\r\n\t\t}\r\n\t\tcase 'object': {\r\n\t\t\tif (Array.isArray(arg)) {\r\n\t\t\t\tvar r = 0;\r\n\t\t\t\targ.forEach((function (c) {\r\n\t\t\t\t\tr += this.exclude(c);\r\n\t\t\t\t}).bind(this));\r\n\t\t\t\treturn r;\r\n\t\t\t}\r\n\t\t}\r\n\t\tdefault: throw new Error(\"Sermat.exclude: Could not exclude (\"+ arg +\")!\");\r\n\t}\r\n}", "function filter(array, fn) {\n let filteredArray = [];\n array.forEach(element => {\n if (!fn(element)) {\n filteredArray.push(element);\n }\n });\n console.log(filteredArray); \n}", "function destroyer(arr) {\n return [].slice.call(arguments, 1).reduce(function(arr, num) {\n return arr.filter(function(item) {\n return num !== item;\n });\n }, arr);\n}", "function filterOutEva(name) {\n if(name !== \"Eva\") return true;\n else return false;\n}", "function filterFunction() {\n \n}", "function tagSelectNOT(tags, from, tagset){\r\n\tvar remove = tagSelectAND(tags, from, false, tagset)\r\n\t// keep the elements that DO NOT exist in remove...\r\n\treturn from.filter(function(e){\r\n\t\treturn remove.indexOf(e) < 0\r\n\t})\r\n}", "function removeAllElements(array, type) {\n return array.filter(function(item) {\n return (item.indexOf(type) === -1);\n });\n }", "function destroyer(arr, a, b, c) { // ([1,2,3,1,2,3],2,3,undefined)\n var base = arr.filter(function(x) { \n return x !== a && x !== b && x !== c; //compare and filter out a, b, c \n });\n return base; \n}", "function filterTestModeLineItems(allLineItems) {\n const result = allLineItems.filter(lineItem => {\n return (lineItem.advertiser != \"SDK Test Mode\" && lineItem.orderName != \"SDK Test Mode\");\n });\n return result;\n }", "function nullFilter(item) {\n // Return the object\n return item // return the object\n}", "unfilterNoChangeLayers(){\n //get the no change status object\n let no_change_status = this.props.statuses.filter(status => status.key === 'no_change');\n //clear the filter depending on whether it is a global or country view\n let filter = (this.props.view === 'global') ? null : ['in', 'iso3', this.props.country.iso3];\n //iterate through the layers and set the filter\n no_change_status[0].layers.forEach(layer => this.map.setFilter(layer, filter));\n //\n }", "function createlstDontWant() {\n var lst = $(\"#dontWant\").val().toLowerCase().split(\",\");\n i = 0;\n for (i = 0; i < lst.length; i++) {\n lst[i] = lst[i].trim();\n }\n curAppliedFilters[\"ingredientsToExclude\"] = lst;\n}", "function scanAndFilter(freightItems, forbiddenString) {\n // This is an array variable you can override with your filtered array\n let filteredItems = [];\n \n /*\n Replace this comment with your code.\n Use the array filter() function to replace filteredItems with a new array of\n strings that don't include the value of forbiddenString\n */\n freightItems.filter(function(item, index, array) {\n console.log(`${item} at ${index} is in ${array}`)\n // if true item is pushed to results and the iteration continues\n if (item != forbiddenString){\n filteredItems.push(item);\n }\n console.log(forbiddenString)\n // returns empty array if nothing found\n });\n\n\n return filteredItems;\n }", "function getObjUnselectedItems(){\r\n\t\tvar objItems = g_objWrapper.find(\".uc-filelist-item\").not(\".uc-filelist-item-selected\");\r\n\t\treturn(objItems);\r\n\t}", "filteredCheck() {\n const { filteredItems, localItems, localFilter } = this\n return { filteredItems, localItems, localFilter }\n }", "filterNonReadJobs(){\n let filteredJobs = this.jobs\n .slice()\n .filter(job => job.type === 'pop' || (job.type === 'tap' && !job.name));\n\n this.jobs.splice(0);\n this.jobs.push(...filteredJobs);\n }", "function destroyer(arr) {\n var mustDelete = [];\n for (var i = 1; i < arguments.length; i++) {\n mustDelete.push(arguments[i]);\n }\n return arr.filter(function(x) {\n if (mustDelete.indexOf(x) >= 0) {\n return false;\n } else {\n return true;\n }\n });\n}", "function omit(obj) {\n\t var notInArray = function (array, item) { return !exports.inArray(array, item); };\n\t return pickOmitImpl.apply(null, [notInArray].concat(restArgs(arguments)));\n\t}", "@computed get filteredTodos() {\r\n var matchesFilter = new RegExp(this.filter, \"i\");\r\n //\"i\" means ignore groß und kleinschreibung\r\n return this.todos.filter(\r\n todo => !this.filter || matchesFilter.test(todo.value)\r\n );\r\n // test will test the RegExp, so this.props.store.filter will automtaticly return\r\n // the filtered Value, on the CLient Side\r\n }", "function onFilterListRemoveAll(e) {\r\n var id = 'exclusion_filter_list';\r\n if (e.target.id.indexOf('inclusion') == 0) {\r\n id = 'inclusion_filter_list';\r\n }\r\n var list = $(id);\r\n while (list.length != 0) {\r\n list.remove();\r\n }\r\n}", "function filterOutOdds(){\n var nums =Array.prototype.slice.call(arguments);\n return nums.filter(function(num){\n return num%2===0\n });\n}", "function removeDuplicate(items){\n let newItems = items.filter((element,index) => items.indexOf(element) === index); \n \n return newItems;\n}", "function filterValues(data) \r\n{\r\n data = data.filter(isEligible);\r\n return data;\r\n}", "filterByTag(...args) {\n const filtered = new PacketList();\n\n const handle = tag => packetType => tag === packetType;\n\n for (let i = 0; i < this.length; i++) {\n if (args.some(handle(this[i].tag))) {\n filtered.push(this[i]);\n }\n }\n\n return filtered;\n }", "function destroyer(arr, ...values) {\n\treturn arr.filter((el) => !values.includes(el));\n}", "function seekAndDestroy(arr, ...rest) {\n return arr.filter((item) => {\n return !rest.includes(item);\n });\n}", "function filterAuxiliaryElements(items) {\n const auxiliaryTags = [\n 'link',\n 'script',\n 'style',\n 'template'\n ];\n return [].filter.call(items, function(item) {\n return !item.localName || auxiliaryTags.indexOf(item.localName) < 0;\n });\n}", "function gooseFilter (birds) {\n var geese = [\"African\", \"Roman Tufted\", \"Toulouse\", \"Pilgrim\", \"Steinbacher\"];\n \n // return an array containing all of the strings in the input array except those that match strings in geese\n return birds.filter(function(element){\n return geese.indexOf(element) === -1 });\n}", "function filter(obj, action) {\n var filtered = [];\n each(obj, function(item) {\n if(action(item)) {\n filtered.push(item);\n }\n });\n return filtered;\n}", "removeAll(id) {\n const newItems = { ...this.items };\n delete newItems[id];\n this.items = newItems;\n }", "notFainted(){\n return this.pokemons.filter(pokemon => {\n return !pokemon.fainted\n })\n }" ]
[ "0.7620843", "0.74576545", "0.74576545", "0.6949059", "0.67931205", "0.6763516", "0.67110926", "0.66278845", "0.6603125", "0.66006714", "0.65639323", "0.6540129", "0.6525952", "0.65198886", "0.6499483", "0.64748067", "0.64748067", "0.6468689", "0.6459403", "0.641476", "0.6413214", "0.63475585", "0.63399523", "0.6339705", "0.6330562", "0.6328124", "0.6309558", "0.6273596", "0.6264659", "0.6261473", "0.6261473", "0.6257582", "0.6255162", "0.6249702", "0.62480944", "0.6215159", "0.6171297", "0.61626756", "0.61366355", "0.61347353", "0.6134084", "0.6134084", "0.6113528", "0.60947317", "0.60676074", "0.6066157", "0.6046065", "0.60440326", "0.6043026", "0.6043026", "0.6043026", "0.6043026", "0.60425675", "0.60300887", "0.6029354", "0.60269505", "0.60192186", "0.60044634", "0.59977823", "0.5991976", "0.59689087", "0.5960281", "0.5952631", "0.59433097", "0.59387374", "0.5933343", "0.59314936", "0.59261906", "0.5919376", "0.59033716", "0.58876073", "0.5873361", "0.5857635", "0.58456296", "0.58412194", "0.58264244", "0.5819609", "0.58152455", "0.58122146", "0.5806433", "0.5795454", "0.5756482", "0.5751562", "0.5745756", "0.5722324", "0.5719892", "0.5709141", "0.57049", "0.5698189", "0.5696694", "0.56910634", "0.5689876", "0.56848514", "0.5683344", "0.5681454", "0.56568205", "0.56509864", "0.5650535", "0.56423134", "0.5637955", "0.5637359" ]
0.0
-1
Used 'uni range + named function' from
function match(a) { return DIACRITICS[a] || a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Range() {}", "function f(){return{range:function(e,t,a){void 0===t?(t=e,e=0,a=1):a||(a=1);var n=[];if(a>0)for(var r=e;r<t;r+=a)n.push(r);else for(var f=e;f>t;f+=a)\n // eslint-disable-line for-direction\n n.push(f);return n},cycler:function(){return n(Array.prototype.slice.call(arguments))},joiner:function(e){return r(e)}}}", "GetRange() {\n\n }", "function mvRange(x, y, z) {\n\t return _.map(_.range(x, y, z != null ? z : 1), String);\n\t }", "names(range) {\n return this.m.rows(range);\n }", "function diceFn (range) {\n \treturn function () {\n \t\treturn this.natural(range);\n \t};\n }", "function diceFn (range) {\n\t \treturn function () {\n\t \t\treturn this.natural(range);\n\t \t};\n\t }", "function range(from) {\n return function(to) {\n var result = [];\n for (var n = from; n < to; n += 1) result.push (n);\n return result;\n };\n }", "function diceFn (range) {\n\t return function () {\n\t return this.natural(range);\n\t };\n\t }", "function diceFn (range) {\n\t return function () {\n\t return this.natural(range);\n\t };\n\t }", "RemoveRange() {\n\n }", "function $qQQH$var$mapWithoutIndex(range) {\n return {\n start: range.start,\n end: range.end\n };\n}", "function TStylingRange() { }", "get_range() {\n return this.liveFunc._range;\n }", "function diceFn (range) {\n return function () {\n return this.natural(range);\n };\n }", "function diceFn (range) {\n return function () {\n return this.natural(range);\n };\n }", "function diceFn (range) {\n return function () {\n return this.natural(range);\n };\n }", "function diceFn (range) {\n return function () {\n return this.natural(range);\n };\n }", "function miFuncion (){}", "function TStylingRange() {}", "function TStylingRange() {}", "function range(start,end){\r\n\t\tvar foo = [];\r\n\t\tfor (i = start; i < end; i++) {\r\n\t\t\tfoo.push(i);\r\n\t\t}\r\n\t\treturn foo;\r\n\t}", "function mapWithoutIndex(range){return{start:range.start,end:range.end};}", "function range(lower, upper) {\n var pid = parser_id++;\n return function(state) {\n var savedState = state;\n var cached = savedState.getCached(pid);\n if(cached)\n return cached;\n\n if(state.length < 1)\n cached = false;\n else {\n var ch = state.at(0);\n if(ch >= lower && ch <= upper)\n cached = { remaining: state.from(1), matched: ch, ast: ch };\n else\n cached = false;\n }\n savedState.putCached(pid, cached);\n return cached;\n };\n}", "function range(start, end) {\n if ((start && end) || end == 0) {\n let result = [];\n for (i = start; i <= end; i++) {\n result.push(i);\n }\n return result;\n }\n\n if (arguments[1] === undefined) {\n return function rangeTill(end) {\n let result = [];\n for (i = start; i <= end; i++) {\n result.push(i);\n }\n return result;\n };\n }\n}", "static fromRange(start, end){\n return FlowFactory.getFlow([...new Array(end - start + 1).keys()].map((elem) => elem + start));\n }", "function range(start, end) {\n start = Number(start) || 0;\n if (end === undefiend) {\n return function getEnd(end) {\n return getRange(start, end);\n }\n } else {\n end = Number(end) || 0;\n return getRange(start, end);\n }\n function getRange(start, end) {\n let ret = [];\n for (let i = start; i <= end; i++) {\n ret.push(i);\n }\n return ret;\n }\n}", "function range(begin, end) {\n return test(ch => begin <= ch && ch <= end).desc(`${begin}-${end}`);\n}", "rangeMapping(value, from, to) {\n return Math.floor(to[0] + (value - from[0]) * (to[1] - to[0]) / (from[1] - from[0]));\n }", "range(from, to = from) { return Range.create(from, to, this); }", "function nr(e){for(;e.length;){if(!p(e).ranges)break;e.pop()}}", "function Range(lo, hi) {\n\tthis.low = lo;\n\tthis.high = hi;\n\t\n\tfunction lowwer()\n\t{\n\treturn this.low;\n\t}\n\t\n\tfunction upper()\n\t{\n\treturn this.upper;\n\t}\n}", "function range(nbr,min,max){if(nbr<min){return min;}else if(nbr>max){return max;}else{return nbr;}}", "function mapWithIndex(range,index){return{start:range.start,end:range.end,index:index};}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function argsFor() {\n\n}", "range(_start, _end) {\n var result = []\n for (let i=_start; i<=_end; i++){\n result.push(i)\n }\n return result\n }", "function i(e,t){return(0,u.default)(t).map(function(n){var r=t[n];return(0,l.default)(r)?{name:n,direction:e,fn:r}:(0,o.default)({name:n},r)})}", "get range() {\n\t\treturn this.range$.slice(0, 2);\n\t}", "function invertRange(range) {\n var start = _Type__WEBPACK_IMPORTED_MODULE_0__[\"getValue\"](range.start);\n var end = _Type__WEBPACK_IMPORTED_MODULE_0__[\"getValue\"](range.end);\n return { start: 1 - end, end: 1 - start };\n}", "SetRange() {\n\n }", "function foreachNamedRange_(namedRanges, callbackNameRange) {\n for(var i in namedRanges) {\n var namedRange = namedRanges[i];\n var nameMaybeToExpand = namedRange.getName();\n var range = namedRange.getRange();\n var x = callbackNameRange(nameMaybeToExpand, range, namedRange);\n if(x) return x;\n }\n}", "function Uf(a){this.m=a}", "range(start, count) {\n\t return Array.apply(0, Array(count))\n\t .map((element, index) =>{\n\t return index + start;\n\t \t}\n\t\t);\n }", "range(startIndex, endIndex){\n if( startIndex < 0 )\n throw new Error(\"Start Index cannot be negative\");\n if( endIndex <= 0 )\n throw new Error(\"End Index must be greater than 0\");\n if( startIndex > endIndex )\n throw new Error(\"End Index cannot be less than Start Index\");\n\n var flow = new RangeMethodFlow(startIndex, endIndex);\n setRefs(this, flow);\n\n return flow;\n }", "function gSrange(begin,end,inclusive) {\n var start = begin;\n var finish = end;\n var reverse = false;\n if (finish<start) {\n start = finish;\n finish = begin;\n reverse = true;\n if (!inclusive) {\n start = start + 1;\n }\n } else {\n if (!inclusive) {\n finish = finish - 1;\n }\n }\n\n var result,number,count;\n for (result=[], number=start, count=0 ; number<=finish ; number++,count++) {\n result[count] = number;\n }\n if (reverse) {\n result = result.reverse()\n }\n var object = gSlist(result);\n object.toList = function() {\n return gSlist(this.values());\n }\n return object;\n}", "function Range3(from, to){//the constructor would be invoked as the method of the newly created object\n this.from = from;\n this.to = to;\n //no need to return a value. The newly created object would be created.\n}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function RangePrototype() {}", "function range() {\n const\n args = Array.from(arguments),\n ab = 1 !== args.length ? (\n args\n ) : args[0],\n [as, bs] = [ab[0], ab[1]].map(\n x => Array.isArray(x) ? (\n x\n ) : (undefined !== x.type) &&\n (x.type.startsWith('Tuple')) ? (\n listFromTuple(x)\n ) : [x]\n ),\n an = as.length;\n return (an === bs.length) ? (\n 1 < an ? (\n sequenceAList(as.map((_, i) => enumFromTo(as[i], bs[i])))\n ) : enumFromTo(as[0], bs[0])\n ) : [];\n}", "function printRange (startRange, endRange) {\n\n}", "add(range) {\n return new SubRange(\n Math.min(this.low, range.low),\n Math.max(this.high, range.high)\n );\n }", "function indexes(upTo) {\r\n return range(0, upTo - 1);\r\n}", "function $qQQH$var$mapWithIndex(range, index) {\n return {\n start: range.start,\n end: range.end,\n index: index\n };\n}", "function ea(){}", "function Range(from,to) {\n this.from=from;\n this.to=to;\n}", "function range(start, end) {\n var foo = [];\n for (var i = start; i <= end; i++) {\n foo.push(i);\n }\n return foo;\n}", "generateRange(min, max, suffix) {\n let range = [];\n for (let i = min; i <= max; i++){\n range.push(i + \" \" + suffix);\n }\n return range;\n }", "function range(min,max)\n{\n var output = [];\n return rangeRec(min,max,output);\n}", "function range(start, end) {\n // YOUR CODE GOES BELOW HERE //\n //first i am going to make an array to hold the numbers .pushed into it for the range function\n var rangeArray = [];\n //here i am making a loop that will decide in which order the number will be returned \n \n if(start < end){\n for(var i = start; i <= end; i++){\n rangeArray.push(i);\n }\n }else{\n for(var i = start; i >= end; i--){\n rangeArray.push(i);\n }\n }\n // i am returning range array so that it will hold the new output data\n return (rangeArray); \n \n \n // YOUR CODE GOES ABOVE HERE //\n}", "function RangePrint2(start, end){\n for (var num = start; num < end; num++){\n console.log(num)\n }\n}", "*points(range) {\n yield [range.anchor, 'anchor'];\n yield [range.focus, 'focus'];\n }", "*points(range) {\n yield [range.anchor, 'anchor'];\n yield [range.focus, 'focus'];\n }", "function i(e,n){return{start:e.start,end:e.end,index:n}}", "function printRangeInclusive (startRange, endRange) {\n\n}", "function __WFU_ApplyValidator_Range(object, min, max) {\r\n object[\"range\"] = [min, max];\r\n}", "forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {\n const name = this._scope.toName(nameOrPrefix);\n return this._for(new ForRange(varKind, name, from, to), () => forBody(name));\n }", "forEach(f) {\n let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2;\n for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i], oldStart = start - (this.inverted ? diff : 0), newStart = start + (this.inverted ? 0 : diff);\n let oldSize = this.ranges[i + oldIndex], newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n }", "function cb(start, end, rangeName) {\n // $('.rangeFilter span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); // show range instead of range name\n $('.rangeFilter span').html(rangeName); // show range name\n }", "function NumberRangeGenerator(lb, ub){\n\tthis.lb = lb\n\tthis.ub = ub\n}", "getNameRange() {\n return this.nameRange;\n }", "add(range) {\n return new SubRange(Math.min((this || _global).low, range.low), Math.max((this || _global).high, range.high));\n }", "function Uu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&\"function\"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}", "function t(e,n){return{start:e.start,end:e.end,index:n}}", "function mapWithoutIndex(range) {\n return {\n start: range.start,\n end: range.end\n };\n}", "function UnifyingSlice() {\n}", "get withIndex() {\n return this.zip(range_1.Range.nats);\n }", "function u(e){var t=typeof Symbol===\"function\"&&e[Symbol.iterator],r=0;if(t)return t.call(e);return{next:function(){if(e&&r>=e.length)e=void 0;return{value:e&&e[r++],done:!e}}}}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function iRange(start, end) {\n return Array.from({ length: (end - start) + 1 }, (value, key) => key + start);\n}", "function addRange(start, finish, scope) {\r\n var i = 0;\r\n for (i = start; i <= finish; i++) {\r\n var item = {\r\n value: i.toString(),\r\n liClass: scope.page == i ? scope.activeClass : 'waves-effect',\r\n action: function() {\r\n internalAction(scope, this.value);\r\n }\r\n };\r\n\r\n scope.List.push(item);\r\n }\r\n }", "function t(e,a){return{start:e.start,end:e.end,index:a}}", "function myFunction4(arg){\n return arg[1]; \n }", "function u(e){var t=\"function\"===typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}", "print() {\n let result = ''\n RangeCollection.range.forEach(range => {\n result += ` [${range[0]}, ${range[range.length-1]})`;\n });\n console.log(result);\n }", "function i(e,t){for(var n=0;n<e.length;n++)t(e[n],n)}", "function u(t, S, C, T, R, c, x) {\n\n}" ]
[ "0.6480403", "0.59365773", "0.59111726", "0.587964", "0.57743406", "0.5752047", "0.5658205", "0.5624756", "0.55952084", "0.55952084", "0.5579083", "0.55713874", "0.5569544", "0.55360025", "0.5502493", "0.5502493", "0.5502493", "0.549479", "0.54816073", "0.5480432", "0.5480432", "0.54441524", "0.54173714", "0.5403657", "0.54025406", "0.5374752", "0.5369492", "0.5366364", "0.5354893", "0.5340954", "0.5336866", "0.53345716", "0.5331208", "0.53211594", "0.5313698", "0.5313698", "0.5313698", "0.5293475", "0.5257256", "0.5245689", "0.5222442", "0.5213382", "0.52118856", "0.52113396", "0.52036035", "0.51921076", "0.51893276", "0.5169537", "0.51683486", "0.5163058", "0.5163058", "0.5163058", "0.5163058", "0.5163058", "0.5163058", "0.5163058", "0.5163058", "0.5158495", "0.51579326", "0.5155165", "0.51545984", "0.5153336", "0.51503253", "0.513699", "0.51298565", "0.5127516", "0.51230466", "0.5113642", "0.51096696", "0.5104094", "0.5104094", "0.510032", "0.5096681", "0.5089933", "0.5086088", "0.50850797", "0.5082663", "0.50783676", "0.5050203", "0.50440234", "0.5037984", "0.5030041", "0.5029716", "0.5029539", "0.50276583", "0.5021043", "0.5008428", "0.5008428", "0.5008428", "0.5008428", "0.5008428", "0.5008428", "0.5008428", "0.50031316", "0.5002072", "0.4987361", "0.49866167", "0.49821392", "0.4979199", "0.49787983", "0.49774057" ]
0.0
-1
CODE TO COMPUTE AND RENDER A TILE
function tile(x, y, w, distortion) { const points = [ { x: -w / 2 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: 0 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: 0 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: 0 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: -w / 2 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: -w / 2 + random(-distortion, distortion), y: 0 + random(-distortion, distortion), }, ]; push(); translate( x + random(-distortion, distortion), y + random(-distortion, distortion) ); rotate(distortion); stroke(100, 100 - distortion); strokeWeight(sw - distortion/100); beginShape(); //Outer perimater points.forEach((item) => { vertex(item.x, item.y); }); endShape(CLOSE); //INNER CROSS const crossPointIndexs = [1, 3, 5, 7]; beginShape(); crossPointIndexs.forEach((index) => { vertex(0, 0); vertex(points[index].x, points[index].y); }); endShape(); pop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n loop(function (row, col) {\n x = (col * tileSize);\n y = (row * tileSize);\n\n // draw placements\n if (map[row][col] == 1) {\n context.fillStyle = \"#aa0000\";\n context.fillRect(x + tileOffset, y + tileOffset, tileSize - tileOffset, tileSize - tileOffset);\n }\n });\n }", "drawMap() {\n for (let row = 0; row < this.tilemapSize.rows; row++) {\n for (let col = 0; col < this.tilemapSize.cols; col++) {\n const tile = this.tilemap[row][col];\n const srcY = tile[0] * this.tileSize;\n const srcX = tile[1] * this.tileSize;\n const dstY = row * this.tileSize;\n const dstX = col * this.tileSize;\n \n this.buffer.drawImage(this.tileset,\n srcX, srcY, this.tileSize, this.tileSize,\n dstX, dstY, this.tileSize, this.tileSize);\n }\n }\n }", "function render() {\n \n var d = new Date();\n var startTime = d.getTime(); \n \n baseImageLoaded = true;\n \n var firstTile = imageSliceData[0];\n \n var subImage = baseImage.get(firstTile.imageX, firstTile.imageY, firstTile.width / 2, firstTile.height / 2);\n \n var upsideDownImage = turnImageUpsideDown(subImage);\n var sidewaysImage = turnImageSideways(subImage);\n var upsideDownSidewaysImage = turnImageSideways(upsideDownImage);\n var resultImage = assembleTransform1(subImage, sidewaysImage, upsideDownImage, upsideDownSidewaysImage);\n \n for (var a = 0; a < imageSliceData.length; a++) {\n\n var tile = imageSliceData[a]\n\n image(resultImage, tile.componentX, tile.componentY);\n }\n \n var d = new Date();\n var stopTime = d.getTime(); \n}", "renderTile(tile) {\n const graphics = tile.graphics;\n graphics.clear();\n tile.drawnAtScale = this._xScale.copy();\n\n // we're setting the start of the tile to the current zoom level\n const {tileX, tileWidth} = this.getTilePosAndDimensions(tile.tileData.zoomLevel,\n tile.tileData.tilePos, this.tilesetInfo.tile_size);\n\n const matrix = tile.matrix;\n const trackHeight = this.dimensions[1];\n const matrixDimensions = tile.tileData.shape;\n const colorScale = this.options.colorScale || scaleOrdinal(schemeCategory10);\n const valueToPixels = scaleLinear()\n .domain([0, this.maxAndMin.max])\n .range([0, trackHeight / matrixDimensions[0]]);\n\n for (let i = 0; i < matrix[0].length; i++) {\n const intervals = trackHeight / matrixDimensions[0];\n // calculates placement for a line in each interval; we subtract 1 so we can see the last line clearly\n const linePlacement = (i === matrix[0].length - 1) ?\n (intervals * i) + ((intervals * (i + 1) - (intervals * i))) - 1 :\n (intervals * i) + ((intervals * (i + 1) - (intervals * i)));\n graphics.lineStyle(1, this.colorHexMap[colorScale[i]], 1);\n\n for (let j = 0; j < matrix.length; j++) { // 3070 or something\n const x = this._xScale(tileX + (j * tileWidth / this.tilesetInfo.tile_size));\n const y = linePlacement - valueToPixels(matrix[j][i]);\n this.addSVGInfo(tile, x, y, colorScale[i]);\n // move draw position back to the start at beginning of each line\n (j === 0) ? graphics.moveTo(x, y) : graphics.lineTo(x, y);\n }\n }\n\n }", "function renderCurrentTerrain(viewportTop, viewportLeft, viewportWidth, \r\n viewportHeight, tileSide, tileClass, maxIndexX, maxIndexY){\r\n\r\n\tvar minX = Math.floor(viewportLeft / tileSide);\r\n\tvar maxX = Math.floor( (viewportLeft + viewportWidth) / tileSide ) + 1;\r\n\tvar minY = Math.floor(viewportTop / tileSide);\r\n\tvar maxY = Math.floor( (viewportTop + viewportHeight) / tileSide ) + 1;\r\n\tvar innerDiv = document.getElementById(\"map\");\r\n\tfor ( i = minX; i <= maxX; i++ ){\r\n\t\tif ((i <= maxIndexX)&&(i >= 0)){\r\n\t\t\tfor ( j = minY; j <= maxY; j++){\r\n\t\t\t\tif ((j <= maxIndexY)&&(j >= 0)){\r\n\t\t\t\t\tvar tileName = \"x\" + i + \"y\" + j + \"z0.jpg\";\r\n\t\t\t\t\tif (!$(tileName)){\r\n\t\t\t\t\t var terrain = document.createElement(\"img\");\r\n\t\t\t\t\t terrain.src = \"images/terrain/\" + tileName;\r\n\t\t\t\t\t terrain.style.position = \"absolute\";\r\n\t\t\t\t\t terrain.style.left = i*tileSide + \"px\";\r\n\t\t\t\t\t terrain.style.top = j*tileSide + \"px\";\r\n\t\t\t\t\t terrain.style.zIndex = 2;\r\n\t\t\t\t\t\tterrain.title = \"\";\r\n\t\t\t\t\t //terrain.setAttribute(\"class\", tileClass);\r\n\t\t\t\t\t\tterrain.setAttribute(\"id\", tileName);\r\n\t\t\t\t\t\tterrain.className = tileClass;\r\n\t\t\t\t\t innerDiv.appendChild(terrain);\r\n\t\t\t\t\t}\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar terrains = document.getElementsByClassName(tileClass);\t\r\n\tfor (k = 0; k < terrains.length; k++){\r\n\t\tvar inside = false;\r\n\t\tvar xValue = terrains[k].id.replace(\"z0.jpg\",\"\");\r\n\t\tvar yValue = terrains[k].id.replace(\"z0.jpg\",\"\");\r\n\t\txValue = xValue.substring(1,xValue.indexOf(\"y\"));\r\n\t\tyValue = yValue.substring(yValue.indexOf(\"y\") + 1,yValue.length);\r\n\t\txValue = xValue*1;\r\n\t\tyValue = yValue*1;\r\n\t\tif ((xValue >= minX)&&(xValue <= maxX)&&(yValue >= minY)&&(yValue <= maxY)){\r\n\t\t\tinside = true;\r\n\t\t}\r\n\t\tif (inside === false){\r\n\t\t\tvar innerDiv = document.getElementById(\"map\");\r\n\t\t innerDiv.removeChild(terrains[k]);\r\n\t\t}\r\n\t}\r\n\t\r\n\t/////calculations////\r\n\tvar tnr = document.getElementsByClassName(tileClass);\r\n\ttnr = tnr.length;\r\n\t$('terrains_nr').innerHTML = tnr;\r\n\t//////////////////////\r\n\t\t\r\n}", "render() {\n ctx.drawImage(Resources.get(this.sprite), (this.col * tileWidth) - tileWidth, this.row * tileHeight - entityOffesetY+10);\n }", "render(renderParameters) {\r\n\t\t\t\t var tileSize = this.layer.tileInfo.size[0];\r\n\t\t\t\t var state = renderParameters.state;\r\n\t\t\t\t var pixelRatio = state.pixelRatio;\r\n\t\t\t\t var width = state.size[0];\r\n\t\t\t\t var height = state.size[1];\r\n\t\t\t\t var context = renderParameters.context;\r\n\t\t\t\t var coords = [0, 0];\r\n\r\n\t\t\t\t context.fillStyle = \"rgba(0,0,0,0.25)\";\r\n\t\t\t\t context.fillRect(0, 0, width * pixelRatio, height * pixelRatio);\r\n\t\t\t\t }", "function renderTiles() {\n var map_index = 0;\n\n // increment by actual TILE_SIZE to avoid multiplying on every iteration\n for (var top = 0; top < MAP.height; top += TILE_SIZE) {\n for (var left = 0; left < MAP.width; left += TILE_SIZE) {\n\n // if statement to draw the correct sprite to the correct idx position on the tile map\n if (MAP.tiles[map_index] === 0) {\n\n // draw background\n ctx.drawImage(background, left, top);\n\n } else if (MAP.tiles[map_index] === 2) {\n\n // draw platform\n ctx.drawImage(platform, left, top);\n\n new Obstacle(100, 100, left, top);\n\n } else if (MAP.tiles[map_index] === 3) {\n\n // draw ring\n ctx.drawImage(ring, left, top);\n //new Obstacle(100, 100, left, top);\n\n } else if (MAP.tiles[map_index] === 1) {\n\n // draw floor\n ctx.drawImage(floor, left, top);\n } else if (MAP.tiles[map_index] === 4) {\n\n ctx.drawImage(floor, left, top);\n new Obstacle(100, 100, left, top);\n }\n\n map_index++;\n }\n }\n}", "renderTiles (tiles, renderFunc) {\n if (!renderFunc || typeof renderFunc !== 'function') {\n throw new Error('Supply render function to Camera::renderTiles')\n }\n /**\n * This still does more than it needs to, in essence it should map a tiled\n * map on to the map of sprites. The SpritePool can remain an ndarray but,\n * we should access it linearly though ndarray.data[i] as that is faster than\n * using the strided approach (ndarray.get).\n * If zoom is disabled then we can position and size the SpritePool elements\n * up front, then Camera just handles culling the list of renderables by\n * iterating over the only relevant map section.\n */\n\n // @TODO if map is smaller than viewport then only iterate over the map,\n // otherwise, iterate over the viewport. This is all about iterating over\n // the minimum amount of tiles.\n\n // @TODO pull out only the viewport from the map\n let cell = null\n let sprite = null\n let exists = false\n for (let y = this.viewport.pos[1]; y < this.viewport.pos[3]; y++) {\n for (let x = this.viewport.pos[0]; x < this.viewport.pos[2]; x++) {\n cell = (x < tiles.shape[0] && y < tiles.shape[1])\n ? tiles.get(x, y)\n : null\n\n // Translate back to [0, 0] for pool access\n sprite = this.pool.get(x - this.viewport.pos[0], y - this.viewport.pos[1])\n\n exists = !(typeof cell === 'undefined' || cell === null)\n\n if (exists) {\n this.renderSprite(sprite, x, y)\n\n renderFunc(cell, sprite)\n }\n\n // Hide sprites that may have previously been rendered\n if (!exists) {\n sprite.visible = false\n }\n }\n }\n }", "function makeTileRender(gl) {\n var desiredMsPerTile = 21;\n var currentTile = -1;\n var numTiles = 1;\n var tileWidth;\n var tileHeight;\n var columns;\n var rows;\n var width = 0;\n var height = 0;\n var totalElapsedMs; // initial number of pixels per rendered tile\n // based on correlation between system performance and max supported render buffer size\n // adjusted dynamically according to system performance\n\n var pixelsPerTile = pixelsPerTileEstimate(gl);\n\n function reset() {\n currentTile = -1;\n totalElapsedMs = NaN;\n }\n\n function setSize(w, h) {\n width = w;\n height = h;\n reset();\n calcTileDimensions();\n }\n\n function calcTileDimensions() {\n var aspectRatio = width / height; // quantize the width of the tile so that it evenly divides the entire window\n\n tileWidth = Math.ceil(width / Math.round(width / Math.sqrt(pixelsPerTile * aspectRatio)));\n tileHeight = Math.ceil(tileWidth / aspectRatio);\n columns = Math.ceil(width / tileWidth);\n rows = Math.ceil(height / tileHeight);\n numTiles = columns * rows;\n }\n\n function updatePixelsPerTile() {\n var msPerTile = totalElapsedMs / numTiles;\n var error = desiredMsPerTile - msPerTile; // tweak to find balance. higher = faster convergence, lower = less fluctuations to microstutters\n\n var strength = 5000; // sqrt prevents massive fluctuations in pixelsPerTile for the occasional stutter\n\n pixelsPerTile += strength * Math.sign(error) * Math.sqrt(Math.abs(error));\n pixelsPerTile = clamp(pixelsPerTile, 8192, width * height);\n }\n\n function nextTile(elapsedFrameMs) {\n currentTile++;\n totalElapsedMs += elapsedFrameMs;\n\n if (currentTile % numTiles === 0) {\n if (totalElapsedMs) {\n updatePixelsPerTile();\n calcTileDimensions();\n }\n\n totalElapsedMs = 0;\n currentTile = 0;\n }\n\n var isLastTile = currentTile === numTiles - 1;\n var x = currentTile % columns;\n var y = Math.floor(currentTile / columns) % rows;\n return {\n x: x * tileWidth,\n y: y * tileHeight,\n tileWidth: tileWidth,\n tileHeight: tileHeight,\n isFirstTile: currentTile === 0,\n isLastTile: isLastTile\n };\n }\n\n return {\n nextTile: nextTile,\n reset: reset,\n setSize: setSize\n };\n }", "define(name, x, y) { //creating a buffer where we keep the tile/subset derived from the big image so we don't have to draw from the big image every time.\n const buffer = document.createElement('canvas'); //programatically making a canvas element just like jsx behind the scenes.\n buffer.width = this.width;\n buffer.height = this.height;\n \n //now drawing the subset to the canvas, just like we did below in context.drawImage(..)\n buffer.\n getContext('2d')\n .drawImage(\n this.image,\n x * this.width,\n y* this.height,\n this.width,\n this.height,\n 0,\n 0,this.width,\n this.height\n );\n\n this.tiles.set(name, buffer);//add the buffer to the new map instantiated in the constructor above by using the \"tiles\" name.\n\n }", "function renderMap(map){\n\tfor (var r = 0; r <= map.tiles.length; r++) {\n if (map.tiles[r] !== undefined) {\n for (var b = 0; b <= map.tiles[r].length; b++) {\n if (map.tiles[r][b] !== undefined) {\n map.tiles[r][b].image.x = r * map.tileSize;\n map.tiles[r][b].image.y = b * map.tileSize;\n map.container.addChild(map.tiles[r][b].image);\n }\n }\n }\n }\n}", "function drawTileMap(){\n //+3, ker izrisujemo en tile prej(levo), ker indeksiramo z 0, in tile za tem\n let posX=-Math.floor(tileSide);\n let posY=-Math.floor(tileSide);\n for(let i=worldOffsetY; i<heightCols+worldOffsetY+4; i++){\n for(let j=worldOffsetX; j<widthCols+worldOffsetX+4; j++){\n if(map[i][j]===1){\n ctx.drawImage(tiles[1],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n else if(map[i][j]===2){\n ctx.drawImage(tiles[6],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n else if(map[i][j]===3){\n ctx.drawImage(tiles[7],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n else if(map[i][j]===7){\n ctx.drawImage(tiles[10],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n else if(map[i][j]===11){\n ctx.drawImage(tiles[11],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n\n else{\n ctx.drawImage(tiles[0],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY),tileSide,tileSide);\n }\n if(map[i][j]===9){\n ctx.drawImage(tiles[9],Math.round(posX+tileOffsetX),Math.round(posY+tileOffsetY)-128+tileSide,70,128);\n }\n posX+=tileSide\n }\n posX=-tileSide;\n posY+=tileSide;\n }\n }", "function makeTileRender(gl) {\n let currentTile = -1;\n let numTiles = 1;\n let tileWidth;\n let tileHeight;\n let columns;\n let rows;\n\n let firstTileTime = 0;\n\n let width = 0;\n let height = 0;\n\n // initial number of pixels per rendered tile\n // based on correlation between system performance and max supported render buffer size\n // adjusted dynamically according to system performance\n let pixelsPerTile = pixelsPerTileEstimate(gl);\n\n let pixelsPerTileQuantized = pixelsPerTile;\n\n let desiredTimePerTile = 22; // 45 fps\n\n let timePerPixelSum = desiredTimePerTile / pixelsPerTile;\n let samples = 1;\n let resetSum = true;\n\n function addToTimePerPixel(t) {\n if (resetSum) {\n timePerPixelSum = 0;\n samples = 0;\n resetSum = false;\n }\n\n timePerPixelSum += t;\n samples++;\n }\n\n function getTimePerPixel() {\n return timePerPixelSum / samples;\n }\n\n function reset() {\n currentTile = -1;\n firstTileTime = 0;\n resetSum = true;\n }\n\n function setSize(w, h) {\n width = w;\n height = h;\n reset();\n }\n\n function setTileDimensions(pixelsPerTile) {\n const aspectRatio = width / height;\n\n // quantize the width of the tile so that it evenly divides the entire window\n tileWidth = Math.ceil(width / Math.round(width / Math.sqrt(pixelsPerTile * aspectRatio)));\n tileHeight = Math.ceil(tileWidth / aspectRatio);\n pixelsPerTileQuantized = tileWidth * tileHeight;\n\n columns = Math.ceil(width / tileWidth);\n rows = Math.ceil(height / tileHeight);\n numTiles = columns * rows;\n }\n\n function initTiles() {\n if (firstTileTime) {\n const timeElapsed = Date.now() - firstTileTime;\n const timePerTile = timeElapsed / numTiles;\n const error = desiredTimePerTile - timePerTile;\n\n // higher number means framerate converges to targetRenderTime faster\n // if set too high, the framerate fluctuates rapidly with small variations in frame-by-frame performance\n const convergenceStrength = 1000;\n\n pixelsPerTile = pixelsPerTile + convergenceStrength * error;\n addToTimePerPixel(timePerTile / pixelsPerTileQuantized);\n }\n\n firstTileTime = Date.now();\n\n pixelsPerTile = clamp(pixelsPerTile, 8192, width * height);\n\n setTileDimensions(pixelsPerTile);\n }\n\n function nextTile() {\n currentTile++;\n\n if (currentTile % numTiles === 0) {\n initTiles();\n currentTile = 0;\n }\n\n const x = currentTile % columns;\n const y = Math.floor(currentTile / columns) % rows;\n\n return {\n x: x * tileWidth,\n y: y * tileHeight,\n tileWidth,\n tileHeight,\n isFirstTile: currentTile === 0,\n isLastTile: currentTile === numTiles - 1\n };\n }\n\n return {\n setSize,\n reset,\n nextTile,\n getTimePerPixel,\n restartTimer() {\n firstTileTime = 0;\n },\n setRenderTime(time) {\n desiredTimePerTile = time;\n },\n };\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), (this.col-1) * tileWidth, this.row * tileHeight - entityOffesetY);\n }", "draw() {\r\n\t\tthis.matrix.forEach((row, y) => row.forEach((tile, x) => {\r\n\t\t\tif (tile) {\r\n\t\t\t\tlet [tx, ty] = tile.position.get;\r\n\t\t\t\tif (tile.isEmpty) {\r\n\t\t\t\t\t//default\r\n\t\t\t\t\tmainCtx.fillStyle = this.baseColor;\r\n\t\t\t\t\tmainCtx.fillRect(\r\n\t\t\t\t\t\ttx * (this.tileSize + this.spacing),\r\n\t\t\t\t\t\tty * (this.tileSize + this.spacing),\r\n\t\t\t\t\t\tthis.tileSize,\r\n\t\t\t\t\t\tthis.tileSize\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//draw gameobject\r\n\t\t\t\t\tmainCtx.fillStyle = tile.top.bgColor;\r\n\t\t\t\t\tmainCtx.fillRect(\r\n\t\t\t\t\t\ttx * (this.tileSize + this.spacing),\r\n\t\t\t\t\t\tty * (this.tileSize + this.spacing),\r\n\t\t\t\t\t\tthis.tileSize,\r\n\t\t\t\t\t\tthis.tileSize\r\n\t\t\t\t\t);\r\n\t\t\t\t\tmainCtx.fillStyle = tile.top.color;\r\n\t\t\t\t\tmainCtx.fillText(\r\n\t\t\t\t\t\ttile.top.glyph,\r\n\t\t\t\t\t\ttx * (this.tileSize + this.spacing) + this.tileSize / 2,\r\n\t\t\t\t\t\tty * (this.tileSize + this.spacing) + this.tileSize / 1.5\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}));\r\n\t}", "paintTile(pixels, index) {\n const tileXOffset = index % TILES_PER_LINE;\n const tileYOffset = Math.floor(index / TILES_PER_LINE);\n\n const pixelXOffset = TILE_PIXEL_WIDTH * tileXOffset;\n const pixelYOffset = TILE_PIXEL_HEIGHT * tileYOffset;\n\n // pixels along the tile's x axis\n for (let x = 0; x < TILE_PIXEL_WIDTH; x += 1) {\n for (let y = 0; y < TILE_PIXEL_HEIGHT; y += 1) {\n // pixels along the tile's y axis\n\n const rawIndex = (pixelXOffset + x + ((pixelYOffset + y) * 160)) * 4;\n const color = this.getRGBValue(pixels, (y * TILE_PIXEL_WIDTH) + x, index);\n\n this.rawImageData[rawIndex] = color.r;\n this.rawImageData[rawIndex + 1] = color.g;\n this.rawImageData[rawIndex + 2] = color.b;\n this.rawImageData[rawIndex + 3] = 255;\n }\n }\n }", "function render()\n{\n requestAnimationFrame(render);\n\n\tctx.clearRect(0, 0, width, height);\n drawTiles();\n\tgui.draw(ctx, mouse);\n}", "function draw() {\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n for (c = 0; c < tileColumnCount; c++) {\n for (r = 0; r < tileRowCount; r++) {\n rect(tiles[c][r].x, tiles[c][r].y, tileW, tileH, tiles[c][r].state);\n }\n }\n\n}", "redraw() {\n // Clear the entire canvas\n let p1 = this._transformedPoint(0, 0)\n let p2 = this._transformedPoint(this.canvasWidth, this.canvasHeight)\n let rect = {\n x: p1.x,\n y: p1.y,\n width: p2.x - p1.x,\n height: p2.y - p1.y,\n }\n this._ctx.clearRect(rect.x, rect.y, rect.width, rect.height)\n\n this._ctx.fillStyle = '#cccccc'\n this._ctx.fillRect(-1000000000, -1000000000, 2000000000, 2000000000)\n let mins = Math.log(this._minScale) / Math.LN2\n let maxs = Math.log(this._maxScale) / Math.LN2\n let s = Math.log(this._transform.a) / Math.LN2\n let zoomPercent = (s - mins) / (maxs - mins)\n let zoomLevel = Math.max(Math.ceil(zoomPercent * this.maxZoom), 1)\n let numTiles = Math.pow(2, zoomLevel)\n let tileWidth = (this._contentSize.width / numTiles) * this._pixelRatio()\n let tileHeight = (this._contentSize.height / numTiles) * this._pixelRatio()\n for (let j = 0; j < numTiles; j++) {\n for (let k = 0; k < numTiles; k++) {\n let tile = {\n x: j * tileWidth,\n y: k * tileHeight,\n width: tileWidth,\n height: tileHeight,\n }\n if (this._intersectRect(rect, tile)) {\n let image = this._tileImage(zoomLevel, j, k)\n if (image.complete && image.naturalHeight !== 0) {\n // this._ctx.imageSmoothingEnabled = false;\n // this._ctx.imageSmoothingQuality = 'low';\n this._ctx.drawImage(image, tile.x, tile.y, tile.width, tile.height)\n }\n // if the tile at that zoom level is not loaded, show the lower\n // res version at the lower zoom level\n else {\n let zl = zoomLevel - 1\n while (zl > 0) {\n let parentJ = Math.floor((j / Math.pow(2, zoomLevel)) * Math.pow(2, zl))\n let parentK = Math.floor((k / Math.pow(2, zoomLevel)) * Math.pow(2, zl))\n let image = this._tileImage(zl, parentJ, parentK)\n if (image.complete && image.naturalHeight !== 0) {\n let childTilesPerParent = Math.pow(2, zoomLevel) / Math.pow(2, zl)\n let jRemainder = j - childTilesPerParent * parentJ\n let kRemainder = k - childTilesPerParent * parentK\n let sWidth = image.width / childTilesPerParent\n let sHeight = image.height / childTilesPerParent\n let sx = Math.floor(jRemainder * sWidth)\n let sy = Math.floor(kRemainder * sHeight)\n // this._ctx.imageSmoothingEnabled = false;\n // this._ctx.imageSmoothingQuality = 'low';\n this._ctx.drawImage(image, sx, sy, sWidth, sHeight, tile.x, tile.y, tile.width, tile.height)\n break\n }\n zl -= 1\n }\n }\n }\n }\n }\n\n // draw in-progress annotation/shapes\n let currentAnnotation = this._drawingAnnotation || { shapes: [] }\n\n // draw all annotations\n for (let annotation of this.annotations.concat(currentAnnotation)) {\n // when drawing, fade out all other shapes except the current annotation\n if (\n (this._selectedAnnotation && !this.callbacks.compareAnnotations(annotation, this._selectedAnnotation)) ||\n (this._drawingAnnotation && !this.callbacks.compareAnnotations(annotation, this._drawingAnnotation))\n ) {\n this._ctx.globalAlpha = 0.2\n } else {\n this._ctx.globalAlpha = 1.0\n }\n // draw in-progress shapes\n let shapes = annotation.shapes\n if (annotation === currentAnnotation) {\n shapes = shapes.concat(this._currentShape || [])\n }\n // draw shapes\n for (let shape of shapes) {\n // find the right tool for the job\n let tool = this.tools.find(tool => {\n return tool.name === shape.kind\n })\n\n // set how shape should look by default\n // (can be overriden in drawInContext)\n this._ctx.fillStyle = annotation.color || this._authorColor || '#FF0000'\n this._ctx.strokeStyle = annotation.color || this._authorColor || '#FF0000'\n // if we decide we want the line to stay the same width at all scales:\n // this._ctx.lineWidth = (1 / this._transform.a) * _lineWidth\n this._ctx.lineWidth = _lineWidth\n\n tool.drawInContext(this._ctx, tool.scaleGeometry(shape.geometry, this._pixelRatio()))\n\n // tests bounding box\n // this._ctx.lineWidth = 1;\n // let g = tool.boundingRect(shape.geometry);\n // this._ctx.beginPath();\n // this._ctx.strokeRect(g.x, g.y, g.width, g.height);\n // this._ctx.stroke();\n }\n\n // tests annotation bounding box\n // this._ctx.lineWidth = 1;\n // let g = this.boundingRectFor(annotation);\n // this._ctx.beginPath();\n // this._ctx.strokeRect(g.x, g.y, g.width, g.height);\n // this._ctx.stroke();\n }\n\n this._ctx.globalAlpha = 1.0\n }", "destroyTile(i, j) {\n // This method will make the buffer dirty since it needs to load pixels\n if (!this.dirty) {\n this.dirty = true;\n this.buffer.loadPixels();\n }\n\n this.groundMap[this.lin_ij(i, j)] = false;\n\n // Manually set the alpha channel of pixels to transparent. This seems a bit overkill, but\n // replace blending a transparent image over the top doesn't seem to work.\n for (let y = i * this.tileSizeDrawn; y < (i + 1) * this.tileSizeDrawn; y++) {\n for (let x = j * this.tileSizeDrawn; x < (j + 1) * this.tileSizeDrawn; x++) {\n this.buffer.pixels[this.byteAddress_xyc(x, y, 'a')] = 0;\n }\n }\n\n // These methods should work, but there may be something wrong with p5's current implementation\n\n /*\n this.buffer.blendMode(REPLACE);\n this.buffer.image(this.tileNone,\n this.tileSizeDrawn * j,\n this.tileSizeDrawn * i);\n */\n\n /*\n this.buffer.blend(this.tileNone,\n 0,\n 0,\n this.tileSizeDrawn,\n this.tileSizeDrawn,\n this.tileSizeDrawn * j,\n this.tileSizeDrawn * i,\n this.tileSizeDrawn,\n this.tileSizeDrawn,\n REPLACE);\n */\n }", "draw(ctx, cam, width, height) {\n cam = cam.copy();\n cam.focus.imul(this.paraCoeff);\n cam.zoom = Math.sqrt(cam.zoom) * this.zoomCoeff;\n var mat = cam.getTransform();\n\n var origin = new Vec2(\n Math.floor(cam.focus.x / this.tileSize),\n Math.floor(cam.focus.y / this.tileSize)\n );\n\n // Extra padding for the rectangle to ensure all stars get drawn\n var fudge = cam.scale * this.tileSize * Math.SQRT1_2;\n\n var imgRad = Math.min(\n this.maxStarSize,\n Math.max(this.minStarSize, cam.scale * this.starScale)\n ) / cam.scale;\n\n ctx.save();\n ctx.transform(...mat);\n\n // coords in queue relative to origin\n var queue = Queue.from([[0, 0]]);\n while (!queue.empty) {\n var coord = queue.dequeue();\n var pos = Vec2.from(coord).add(origin).mul(this.tileSize);\n var sc = pos.trf(mat);\n\n if (Math.abs(sc.x) > width / 2 + fudge ||\n Math.abs(sc.y) > height / 2 + fudge) continue;\n\n var hash = this.hashPos(pos);\n var rx = hash - 0.5;\n hash = this.dropHigh(hash, 1e10);\n var ry = hash - 0.5;\n hash = this.dropHigh(hash, 1e10);\n ctx.globalAlpha = hash;\n\n ctx.drawImage(this.img,\n pos.x + this.tileSize * rx - imgRad,\n pos.y + this.tileSize * ry - imgRad,\n imgRad * 2, imgRad * 2\n );\n\n // Because I didn't want to have 4 similar if statements, I\n // made one unreadable (and slower) loop! Hooray for DRY!\n for (var i = 0; i < 4; i++) {\n var vCur = i & 1;\n var vAux = ~i & 1;\n\n // -1 when high bit is 0, +1 when high bit is 1\n var sign = (i & ~vCur) - 1;\n\n // -1 for x, +1 for y\n var vSign = vCur * 2 - 1;\n\n if (sign * coord[vCur] >= 0) {\n if (Math.abs(coord[vCur]) >= Math.abs(coord[vAux])) {\n var leaf = coord.slice();\n leaf[vCur] += sign;\n queue.enqueue(leaf);\n }\n\n if (vSign * coord[vCur] === coord[vAux]) {\n var leaf = coord.slice();\n leaf[vCur] += sign;\n leaf[vAux] += vSign * sign;\n queue.enqueue(leaf);\n }\n }\n }\n }\n\n ctx.restore();\n }", "drawTile(id, row, col, zOffset = 0) {\n const puzzle = this.state.puzzle\n const position = this.mesh.geometry.getAttribute(\"position\")\n const numCols = puzzle.numCols\n const numRows = puzzle.numRows\n const missingTileId = numCols*numRows - 1\n const y0 = id === missingTileId ? 0 : .5 - row/numRows // .5 is the top, -.5 the bottom\n const x0 = id === missingTileId ? 0 : col/numCols - .5 // -.5 is the left, .5 the right\n const y1 = id === missingTileId ? 0 : y0 - 1/numRows\n const x1 = id === missingTileId ? 0 : x0 + 1/numCols\n\n // layout must match PlaneBufferGeometry\n const i = id*VERTS_PER_TILE\n position.setXYZ(i , x0, y0, zOffset)\n position.setXYZ(i+1, x0, y1, zOffset)\n position.setXYZ(i+2, x1, y0, zOffset)\n position.setXYZ(i+3, x0, y1, zOffset)\n position.setXYZ(i+4, x1, y1, zOffset)\n position.setXYZ(i+5, x1, y0, zOffset)\n\n position.needsUpdate = true\n }", "render() {\n ctx.drawImage(Resources.get(this.sprite), this.x, this.row * tileHeight - entityOffesetY); \n }", "constructor() {\n //this.groundColor = color(130, 100, 90);\n //this.skyColor = color(230, 250, 250);\n\n // Tile size actual is the size of the tile images.\n // Tiles may be scaled up to tile size drawn at lower pixel density.\n this.tileSizeActual = 16;\n this.tilePadding = 2;\n this.tileSizeDrawn = 16;\n\n // Frequncies for the noise function. The higher the frequency, the smaller the patches formed.\n this.tileNoiseFrequency = 0.1;\n this.subFromNoise = 0.05;\n this.biomeNoiseFrequency = 0.01;\n\n // Tile names and their row,column indices in the tile set\n this.tileIndex = {\n none: null,\n default: {\n tileset: undefined,\n default: {\n clay: [0, 0],\n concrete: [0, 1]\n },\n building: {\n steel: [1, 0],\n creepyBrick: [1, 1],\n sandstone: [1, 2],\n }\n },\n jungle: {\n tileset: undefined,\n default: {\n grass: [0, 0],\n swamp: [0, 1],\n mud: [0, 2],\n clay: [0, 3],\n ash: [0, 4],\n },\n building: {\n stoneBrick: [1, 0],\n stoneBlock: [1, 1],\n goldBrick: [1, 2]\n }\n }\n };\n\n // Dirty flag to keep track of changes made to the buffer\n // Dirty will be set when a tile is created or destroyed, prompting pixel loads and updates.\n this.dirty = false;\n\n // List of objects in the world to check player for collision against\n this.colliders = [];\n }", "draw() {\n this.tiles.forEach(t => {\n var tileCoords = {\n x: this.origin.x + (t.x * 8) + 16,\n y: this.origin.y + (t.y * 8)\n }\n this.context.drawImage(RESOURCE.sprites, t.t * 8, 16, 8, 8, tileCoords.x, tileCoords.y, 8, 8);\n });\n }", "buildWorld(layout,rows,cols,imageFactor) {\n for (var i = 0; i <=rows; i++) {\n for (var j = 0; j <=cols; j++) {\n if (imageFactor) {\n this.canvas[1].drawImage(this.cache[layout[i]],j*imageFactor ,i*imageFactor);\n }\n else {\n this.canvas[1].drawImage(this.cache[layout[i]],j*1 ,i*1);\n }\n }\n }\n }", "function render(selection) {\n\t var requests = [];\n\t var showDebug = context.getDebug('tile') && !source.overlay;\n\n\t if (source.validZoom(z)) {\n\t tile().forEach(function(d) {\n\t addSource(d);\n\t if (d[3] === '') return;\n\t if (typeof d[3] !== 'string') return; // Workaround for chrome crash https://github.com/openstreetmap/iD/issues/2295\n\t requests.push(d);\n\t if (cache[d[3]] === false && lookUp(d)) {\n\t requests.push(addSource(lookUp(d)));\n\t }\n\t });\n\n\t requests = uniqueBy(requests, 3).filter(function(r) {\n\t if (!!source.overlay && nearNullIsland(r[0], r[1], r[2])) {\n\t return false;\n\t }\n\t // don't re-request tiles which have failed in the past\n\t return cache[r[3]] !== false;\n\t });\n\t }\n\n\t var pixelOffset = [\n\t source.offset()[0] * Math.pow(2, z),\n\t source.offset()[1] * Math.pow(2, z)\n\t ];\n\n\t function load(d) {\n\t cache[d[3]] = true;\n\t d3.select(this)\n\t .on('error', null)\n\t .on('load', null)\n\t .classed('tile-loaded', true);\n\t render(selection);\n\t }\n\n\t function error(d) {\n\t cache[d[3]] = false;\n\t d3.select(this)\n\t .on('error', null)\n\t .on('load', null)\n\t .remove();\n\t render(selection);\n\t }\n\n\t function imageTransform(d) {\n\t var _ts = tileSize * Math.pow(2, z - d[2]);\n\t var scale = tileSizeAtZoom(d, z);\n\t return 'translate(' +\n\t ((d[0] * _ts) - tileOrigin[0] + pixelOffset[0]) + 'px,' +\n\t ((d[1] * _ts) - tileOrigin[1] + pixelOffset[1]) + 'px)' +\n\t 'scale(' + scale + ',' + scale + ')';\n\t }\n\n\t function debugTransform(d) {\n\t var _ts = tileSize * Math.pow(2, z - d[2]);\n\t var scale = tileSizeAtZoom(d, z);\n\t return 'translate(' +\n\t ((d[0] * _ts) - tileOrigin[0] + pixelOffset[0] + scale * (tileSize / 4)) + 'px,' +\n\t ((d[1] * _ts) - tileOrigin[1] + pixelOffset[1] + scale * (tileSize / 2)) + 'px)';\n\t }\n\n\t var image = selection\n\t .selectAll('img')\n\t .data(requests, function(d) { return d[3]; });\n\n\t image.exit()\n\t .style(transformProp, imageTransform)\n\t .classed('tile-removing', true)\n\t .each(function() {\n\t var tile = d3.select(this);\n\t window.setTimeout(function() {\n\t if (tile.classed('tile-removing')) {\n\t tile.remove();\n\t }\n\t }, 300);\n\t });\n\n\t image.enter().append('img')\n\t .attr('class', 'tile')\n\t .attr('src', function(d) { return d[3]; })\n\t .on('error', error)\n\t .on('load', load);\n\n\t image\n\t .style(transformProp, imageTransform)\n\t .classed('tile-debug', showDebug)\n\t .classed('tile-removing', false);\n\n\n\t var debug = selection.selectAll('.tile-label-debug')\n\t .data(showDebug ? requests : [], function(d) { return d[3]; });\n\n\t debug.exit()\n\t .remove();\n\n\t debug.enter()\n\t .append('div')\n\t .attr('class', 'tile-label-debug');\n\n\t debug\n\t .text(function(d) { return d[2] + ' / ' + d[0] + ' / ' + d[1]; })\n\t .style(transformProp, debugTransform);\n\t }", "patch (ctx, sx, sy, pw, ph) {\n\n\t\tsx = sx < 0 ? 0 : sx;\n\t\tsy = sy < 0 ? 0 : sy;\n\t\tpw = pw > this.w ? this.w : pw;\n\t\tph = ph > this.h ? this.h : ph;\n\n\t\tctx.fillStyle = 'rgba(0, 0, 0, 0.6)';\n\n\t\tfor(let y = sy; y < sy + ph; y++) {\n\t\t\tfor(let x = sx; x < sx + pw; x++) {\n\n\t\t\t\tif(!this.visible[y] || !this.visible[y][x] || this.outOfBounds(x, y)) continue;\n\n\t\t\t\t//Draw the tile\n\t\t\t\tctx.drawImage(\n\t\t\t\t\tthis.tileset,\n\n\t\t\t\t\tthis.data[y][x] * this.tw, 0,\n\t\t\t\t\tthis.tw, this.th,\n\n\t\t\t\t\tx * this.dw,\n\t\t\t\t\ty * this.dh,\n\t\t\t\t\tthis.dw, this.dh\n\t\t\t\t);\n\n\t\t\t\t//If the tile isn't in the player's immediate line of sight, dull it out a little and don't\n\t\t\t\t//display anything variable (only constant things like tile type and any items dropped on it)\n\t\t\t\tif(this.player && this.player.visible.indexOf(this.sPos(x, y)) === -1)\n\t\t\t\t\tctx.fillRect(x * this.dw, y * this.dh, this.dw, this.dh);\n\n\t\t\t}\n\t\t}\n\t}", "render_region(ctx, tile_size, colors, row, col, start_row, end_row, start_col, end_col, x, y, hover_warning_tiles) {\n\t\tif (start_row > 0) {\n\t\t\tctx.fillRect(0, 0,this.gui.window_width * tile_size, start_row * tile_size)\n\t\t}\n\t\tif (end_row <= this.gui.window_height) {\n\t\t\tctx.fillRect(0, tile_size * end_row + y, this.gui.window_width * tile_size, tile_size * (this.gui.window_height - end_row) - y)\n\t\t}\n\t\tif (start_col > 0) {\n\t\t\tctx.fillRect(0, 0, tile_size * start_col, this.gui.window_height * tile_size)\n\t\t}\n\t\tif (end_col <= this.gui.window_width) {\n\t\t\tctx.fillRect(tile_size * end_col + x, 0, tile_size * (this.gui.window_width - end_col) - x, tile_size * this.gui.window_height)\n\t\t}\n\t\tfor (var r = start_row; r < end_row; r++) {\n\t\t\tfor (var c = start_col; c < end_col; c++) {\n\t\t\t\tvar current_row = row + r;\n\t\t\t\tvar current_col = col + c;\n\t\t\t\tvar index = this.width * current_row + current_col;\n\t\t\t\tvar tile = this.tiles[index];\n\t\t\t\tvar tile_x = tile_size * c + x;\n\t\t\t\tvar tile_y = tile_size * r + y;\n\t\t\t\tthis.draw_tile(tile, ctx, tile_size, tile_x, tile_y, colors, hover_warning_tiles);\n\t\t\t}\n\t\t}\n\t}", "function cpyTile(x, y, source) {\n ctx.drawImage(\n source,\n\n x * properties.drawSize,\n y * properties.drawSize,\n properties.drawSize,\n properties.drawSize,\n\n x * properties.drawSize,\n y * properties.drawSize,\n properties.drawSize,\n properties.drawSize\n );\n }", "renderFrame(){\n // calculate fps\n let now = Date.now();\n this.fps = Math.round( 1000/ (now-this.lastFrameTimestamp) );\n this.lastFrameTimestamp = now;\n\n // calculate average fps\n if( this.fpsLast.length < 60 ) this.fpsLast.push( this.fps );\n else{\n let sum = this.fpsLast.reduce(function(a, b) { return a + b }, 0);\n let average = sum / this.fpsLast.length;\n this.fpsAverage = Math.round( average );\n this.fpsLast= [];\n }\n\n if( this.edgeScrolling ) this.__edgeScrollingHandler();\n\n // clear viewport\n this.Context.clearRect(0, 0, this.Canvas.width/this.Scale.current, this.Canvas.height/this.Scale.current);\n //\n // OPTIMIZATIONS TOSO: render only inscreen tiles\n // render in invisible canvas and dumpmcntent whennscene is ready\n //\n // Iterate columns from right to left\n for (var column =this.Map.columns-1; column >=0 ; column--){\n // Iteraterows from top to bottom\n for (var row =0; row < this.Map.rows ; row++){\n // each cell can have multiple sprites, iterate them...\n for (var layer = 0; layer < this.Map.tileData[row][column].length; layer++){\n this.renderTile( this.Map.tileData[row][column][layer], column, row);\n\n //this.Context.globalAlpha = 0.10;\n //this.renderTile( 7, column, row );\n //this.Context.globalAlpha = 1;\n }\n }\n }\n\n if(this.showProfiler) this.renderProfiler();\n\n let focusedTile = this.getTileFromCoords(this.Mouse.x, this.Mouse.y);\n if(focusedTile){\n this.Context.globalAlpha = 0.40;\n this.renderTile( 7, focusedTile.column, focusedTile.row );\n this.Context.globalAlpha = 1;\n }\n }", "function drawTile(imgName,x,y){ //JUST DRAWS, DOES NOT SET ANYTHING AND CAN BE FORCED TO DRAW NON-EXISTANT TILES\n\timg = document.getElementById(imgName);\n\tctx.drawImage(img,x*32,y*32); //USES GRID COORDINATES, NOT TRUE COORDINATES\n}", "mapTextures(iArray, param,underGrid) {\n\n if (param == \"terrain\") {\n //Fix For tiles Metal, Silver, Gold and Sterile tiles\n for (let j = 0; j < iArray.length; j++) {\n if (iArray[j] == 101 || iArray[j] == 246 || iArray[j] == 37 || iArray[j] == 199) {\n if (underGrid[j] != 0) {\n //Just shift the ID up one since we only care about tiles under dirt\n iArray[j] += 1;\n }\n }\n }\n\n for (let i = 0; i < iArray.length; i++) {\n //TINT THE TERRAIN TILE\n switch (iArray[i]) {\n case 2: //Concrete\n iArray[i] = 1;\n break;\n case 235: //Paved\n iArray[i] = 2;\n break;\n case 70: //Wood\n iArray[i] = 3;\n break;\n case 247: //metal //IF UNDER\n iArray[i] = 4;\n break;\n case 38: //silver //IF UNDER\n iArray[i] = 5;\n break;\n case 200: //gold //IF UNDER\n iArray[i] = 6;\n break;\n case 102: //sterile //If under\n iArray[i] = 7;\n break;\n case 174: //red\n iArray[i] = 8;\n break;\n case 232: //green\n iArray[i] = 9;\n break;\n case 202: //blue\n iArray[i] = 10;\n break;\n case 46: //cream\n iArray[i] = 11;\n break;\n case 231: //dark\n iArray[i] = 12;\n break;\n case 41: //burned wood\n iArray[i] = 13;\n break;\n case 171: //burned carpet\n iArray[i] = 14;\n break;\n case 88: //sandstone tile\n iArray[i] = 15;\n break;\n case 224: //granite tile\n iArray[i] = 16;\n break;\n case 160: //limestone tile\n iArray[i] = 17;\n break;\n case 219: //slate tile\n iArray[i] = 18;\n break;\n case 126: //Marble tile\n iArray[i] = 19;\n break;\n case 173: //slate flag\n iArray[i] = 20;\n break;\n case 169: //sandstone flag\n iArray[i] = 21;\n break;\n case 245: //granite flag\n iArray[i] = 22;\n break;\n case 59: //limestone flag\n iArray[i] = 23;\n break;\n case 1: //marble flagstone\n iArray[i] = 24;\n break;\n case 166: //sand\n iArray[i] = 25;\n break;\n case 161: //soil\n iArray[i] = 26;\n break;\n case 239: //marshy soil\n iArray[i] = 27;\n break;\n case 115: // rich soil\n iArray[i] = 28;\n break;\n case 48: //mud\n iArray[i] = 29;\n break;\n case 6: //marsh\n iArray[i] = 30;\n break;\n case 73: //gravel\n iArray[i] = 31;\n break;\n case 158: //lichen covered\n iArray[i] = 32;\n break;\n case 255: //ice\n iArray[i] = 33;\n break;\n case 205: //broken asphalt\n iArray[i] = 34;\n break;\n case 78: // packed dirt\n iArray[i] = 35;\n break;\n case 37: //underwall\n iArray[i] = 36;\n break;\n case 140: //deep water //DEEPOCEANWATER MISSING!!!!\n iArray[i] = 37;\n break;\n case 58: //moving deep water\n iArray[i] = 38;\n break;\n case 181: //shallow water\n iArray[i] = 39;\n break;\n case 137: //shallow ocean\n iArray[i] = 40;\n break;\n case 212: //shallow moving water\n iArray[i] = 40;\n break;\n case 56: //rough sandstone\n iArray[i] = 41;\n break;\n case 246: // rough hewn sandstone\n iArray[i] = 42;\n break;\n case 154: //smooth sandstone\n iArray[i] = 43;\n break;\n case 222: // rough granite\n iArray[i] = 44;\n break;\n case 116: // rough hewn granite\n iArray[i] = 45;\n break;\n case 199: //smooth granite\n iArray[i] = 46;\n break;\n case 99: //rough limestone\n iArray[i] = 47;\n break;\n case 82: // rought hewn limestone\n iArray[i] = 48;\n break;\n case 238: //smooth limestone\n iArray[i] = 49;\n break;\n case 148: //rough slate\n iArray[i] = 50;\n break;\n case 101: //rough hewn slate\n iArray[i] = 51;\n break;\n case 184: //smooth slate\n iArray[i] = 52;\n break;\n case 57: //rough marble\n iArray[i] = 53;\n break;\n case 135: //rough hewn marble\n iArray[i] = 54;\n break;\n case 208: //smooth marble\n iArray[i] = 55;\n break;\n case 21: //Moving river water?\n iArray[i] = 38;\n break;\n case 71: //Bridge\n iArray[i] = 3;\n break;\n case 153: //Softsand\n iArray[i] = 25;\n break;\n default:\n console.log(iArray[i]);\n }\n iArray[i] = iArray[i] -= 1; //fix for index offset\n }\n }\n return iArray;\n }", "function make_map_grid()\n{\n\t_obj_clear(tileObjects);\n\tvar tileRange = get_tile_range( current_zoom );\n\tvar gap_x = Math.abs( map_pixel_nw.x % tile_size );\n\tif (map_pixel_nw.x >= 0)\n\t\tgap_x = tile_size - gap_x;\n\tvar gap_y = Math.abs( map_pixel_nw.y % tile_size );\n\tif (map_pixel_nw.y >= 0)\n\t\tgap_y = tile_size - gap_y;\n\tfor (var tx = 0 ; tx < map_tile_width ; tx++)\n\t{\n\t\tfor (var ty = 0 ; ty < map_tile_height ; ty++)\n\t\t{\n\t\t\t// Source: Processing coords\n\t\t\tvar sx = ( tx == 0 ? 0 : (gap_x + ((tx-1) * tile_size)) );\n\t\t\tvar sy = ( ty == 0 ? 0 : (gap_y + ((ty-1) * tile_size)) );\n\t\t\t// Dest: tile coords\n\t\t\tvar dx = ( tx == 0 ? (tile_size-gap_x) : 0 );\n\t\t\tvar dy = ( ty == 0 ? (tile_size-gap_y) : 0 );\n\t\t\t// chunk size (not tile size!)\n\t\t\tvar w = ( tx == 0 ? gap_x : ( tx == map_tile_width-1 ? map_width-sx : tile_size ) );\n\t\t\tvar h = ( ty == 0 ? gap_y : ( ty == map_tile_height-1 ? map_height-sy : tile_size ) );\n\t\t\t// maps pixel coords\n\t\t\tvar map_x = (sx + map_pixel_nw.x);\n\t\t\tvar map_y = (sy + map_pixel_nw.y);\n\t\t\t// maps tile\n\t\t\tvar tile = pixel_to_tile( map_x, map_y );\n\t\t\t// make object\n\t\t\tvar o = {\n\t\t\t\tzoom:\t\tcurrent_zoom,\n\t\t\t\ttile_x:\t\ttile.x,\n\t\t\t\ttile_y:\t\ttile.y,\n\t\t\t\tsx:\t\t\tsx,\n\t\t\t\tsy:\t\t\tsy,\n\t\t\t\tdx:\t\t\tdx,\n\t\t\t\tdy:\t\t\tdy,\n\t\t\t\tw:\t\t\tw,\n\t\t\t\th:\t\t\th,\n\t\t\t}\n\t\t\tif (tile.y >= 0 && tile.y < tileRange)\n\t\t\t\t_obj_push(tileObjects, o);\n\t\t\t//alert(\"tx=\"+tx+\" ty=\"+ty+\" sx=\"+o.sx+\" sy=\"+o.sy+\" w=\"+o.w+\" h=\"+o.h);\n\t\t}\n\t}\n}", "renderTile( x, y, color ) {\n this.canvasContext.fillStyle = color;\n this.canvasContext.fillRect( x * this.TILE_SIZE, y * this.TILE_SIZE, this.TILE_SIZE, this.TILE_SIZE );\n }", "function makeTiled(pen, makeTileFnc, array, tPosBox, xNum, yNum, percentBuffer) {\n var width = tPosBox.w / (xNum);\n var height = tPosBox.h / (yNum);\n\n var xPos = tPosBox.x + width * percentBuffer;\n var yPos = tPosBox.y + height * percentBuffer;\n\n var drawnWidth = width * (1 - 2 * percentBuffer);\n var drawnHeight = height * (1 - 2 * percentBuffer);\n\n for (var key in array) {\n var subArray = array[key];\n if (getRealType(subArray) != \"Array\") {\n subArray = []\n subArray.push(array[key]);\n }\n for (var key in subArray) {\n var value = subArray[key];\n if (xPos > tPosBox.x + tPosBox.w) {\n xPos = tPosBox.x + width * percentBuffer;\n yPos += height;\n }\n\n if (makeTileFnc(value, pen, new TemporalPos(xPos, yPos, drawnWidth, drawnHeight)))\n xPos += width;\n }\n }\n}", "function renderMap(){\n clearMap();\n var currentVertice\n for(var y = 0; y < scaledHeight+1; y++){\n for(var x = 0; x < scaledHeight+1; x++){\n if(renderTopLeft[0]+x >= 0 && renderTopLeft[0] + x < vertices.length){\n if(renderTopLeft[1]+y >= 0 && renderTopLeft[1]+y < vertices[x].length){\n currentVertice = vertices[renderTopLeft[0]+x][renderTopLeft[1]+y];\n\n // check rooms\n for(var i = 0; i < allRooms.length; i++){\n if(allRooms[i].getTopLeft() == currentVertice && allRooms[i].found == true){\n allRooms[i].activateAllVertice();\n allRooms[i].draw();\n }\n }\n // check passageways\n for(var i = 0; i < allPassageways.length; i++){\n if(allPassageways[i].getTopLeft() == currentVertice && allPassageways[i].found == true){\n allPassageways[i].draw();\n }\n }\n\n // check doors\n for(var i = 0; i < allDoors.length; i++){\n if(allDoors[i].getTopLeft() == currentVertice && allDoors[i].found === true){\n allDoors[i].draw(allDoors[i].getDirection());\n }\n }\n\n // check all chests\n for(var i = 0; i < allChests.length; i++){\n if(allChests[i].found == true){\n if(allChests[i].getTopLeft() == currentVertice){\n allChests[i].draw();\n }\n }\n }\n\n // checks all traps\n for(var i = 0; i < allTraps.length; i++){\n if(allTraps[i].found === true){\n if(allTraps[i].getTopLeft() == currentVertice){\n allTraps[i].draw();\n }\n }\n }\n\n }\n }\n }\n }\n}", "function game_draw(renderer) {\n\trenderer.ctx.clearRect(0, 0, renderer.can.width, renderer.can.height);\n\trenderer.ctx.fillStyle = 'white';\n\trenderer.ctx.fillRect(0, 0, renderer.can.width, renderer.can.height);\n\trenderer.ctx.fill();\n\t\n\t//this draws the tiles to the floor\n\t\n\tfor(var i = 0; i < renderer.stages.length; i++){\n\t\tif(renderer.stages[i].will_destroy == true){\n\t\t\trenderer.pop();\n\t\t\trenderer.just_destroyed = true;\n\t\t\tcontinue;\n\t\t} \n\t if(renderer.stages[i].always_update == true || renderer.stages[i].always_draw == true){\n\t \t\n\t \tif (renderer.stages[i].owned_objects.indexOf(MC) != -1){\n\t \t\tif(renderer.stages[i].always_update == true){\n\t \t\t renderer.stages[i].owned_objects[renderer.stages[i].owned_objects.indexOf(MC)].update();\n\t \t\t}\n\t \t}\n\t \t\n\t\t for (var j = 0; j < renderer.stages[i].owned_objects.length; j++){\n\t\t if(renderer.stages[i].always_update == true){\n\t\t \tif(renderer.stages[i].owned_objects[j] != MC){\n\t\t \t renderer.stages[i].owned_objects[j].update();\n\t\t \t}\n\t\t }\n\t\t \n\t\t } //For1\n\t\t for(var j = 0; j < renderer.stages[i].owned_objects.length; j++){\n\t\t \t\n\t\t \tif(renderer.stages[i].owned_objects[j].hitbox == undefined){\n\t\t \t\t//console.log(renderer.stages[i].owned_objects[j]);\n\t\t \t\t//console.log(\"nohitbox\");\n\t\t \t\tcontinue;\n\t\t \t}\n\t\t \tif(renderer.stages[i].owned_objects[j].hitbox.active == false){\n\t\t \t\tcontinue;\n\t\t \t}\n\t\t \tfor(var k = j + 1; k < renderer.stages[i].owned_objects.length; k++){\n\t\t \t\tif(renderer.stages[i].always_update == true){\n\t\t \t\t\tif(renderer.stages[i].owned_objects[k].hitbox == undefined){\n\t\t \t\t\t\t//console.log('nohitbox2');\n\t\t \t\t\t\tcontinue;\n\t\t \t\t\t}\n\t\t \t\t\t//console.log('hitbox');\n\t\t \t\t\tif(renderer.stages[i].owned_objects[k].hitbox.active == false){\n\t\t \t\t\t\tcontinue;\n\t\t \t\t\t}\n\t\t \t\t\tif(renderer.stages[i].owned_objects[j].is_obstacle == true && \n\t\t \t\t\t\trenderer.stages[i].owned_objects[k].is_obstacle == true){\n\t\t \t\t\t\t\tcontinue;\n\t\t \t\t\t}\n\t\t \t\t\t\n\t\t \t\n\t\t \t\t\tvar check1 = renderer.stages[i].owned_objects[j].hitbox.shape;\n\t\t \t\t\tvar check2 = renderer.stages[i].owned_objects[k].hitbox.shape;\n\t\t \t\t if (check1 == 'rectangle' && check2 == 'rectangle'){\n\t\t \t\t \tvar response = new SAT.Response();\n\t\t \t\t \tvar t1 = renderer.stages[i].owned_objects[j].hitbox.col_data.toPolygon();\n\t\t \t\t \tvar t2 = renderer.stages[i].owned_objects[k].hitbox.col_data.toPolygon();\n\t\t\t\t\t if(SAT.testPolygonPolygon(t1, t2, response)){\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[j].collide(renderer.stages[i].owned_objects[k]);\n\t\t\t\t\t\t\t\t\t if(renderer.stages[i].owned_objects[k] != undefined){ \n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[k].collide(renderer.stages[i].owned_objects[j]);\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t}else if (check1 == 'rectangle' && check2 == 'circle'){\n\t\t\t\t\t var response = new SAT.Response();\n\t\t\t\t\t if(SAT.testPolygonCircle(renderer.stages[i].owned_objects[j].hitbox.col_data.toPolygon(),\n\t\t\t\t\t\t renderer.stages[i].owned_objects[k].hitbox.col_data, response) == true){\n\t\t\t\t\t\t \t\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[j].collide(renderer.stages[i].owned_objects[k]);\n\t\t\t\t\t\t\t if(typeof(renderer.stages[i].owned_objects[j].collide) ===\"function\"){\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[k].collide(renderer.stages[i].owned_objects[j]);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t \n\t\t\t }else if (check1 == 'circle' && check2 == 'rectangle'){\n\t\t\t\t\t var response = new SAT.Response();\n\t\t\t\t\t if(SAT.testCirclePolygon(renderer.stages[i].owned_objects[j].hitbox.col_data,\n\t\t\t\t\t\t renderer.stages[i].owned_objects[k].hitbox.col_data.toPolygon(), response) == true){\n\t\t\t\t\t\t \t\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[j].collide(renderer.stages[i].owned_objects[k]);\n\t\t\t\t\t\t\t if(typeof(renderer.stages[i].owned_objects[k].collide) === \"function\"){\n\t\t\t\t\t\t\t \t\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[k].collide(renderer.stages[i].owned_objects[j]);\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t \n\t\t\t\t } \n\t\t\t\t if(renderer.stages[i].owned_objects[j] == MC || renderer.stages[i].owned_objects[k] == MC){\n\t\t\t\t if(MC.attack_hitbox != false){\n\t\t\t\t \tconsole.log('hitbox');\n\t\t\t\t \tif(renderer.stages[i].owned_objects[j].hitbox.shape == 'circle' ||\n\t\t\t\t \t renderer.stages[i].owned_objects[k].hitbox.shape == 'circle'){\n\t\t\t\t \t \tcontinue;\n\t\t\t\t \t }\n\t\t\t\t if (renderer.stages[i].owned_objects[k].attack_hitbox != undefined){\n\t\t\t\t\t var response = new SAT.Response();\n\t\t\t\t\t if(SAT.testPolygonPolygon(renderer.stages[i].owned_objects[j].hitbox.col_data.toPolygon(),\n\t\t\t\t\t\t renderer.stages[i].owned_objects[k].attack_hitbox.col_data, response) == true){\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[j].collide_damage(); \n\t\t\t\t\t\t }\n\t\t\t\t } else if (renderer.stages[i].owned_objects[j].attack_hitbox != undefined){\n\t\t\t\t\t var response = new SAT.Response();\n\t\t\t\t\t //console.log(renderer.stages[i].owned_objects[j].attack_hitbox.col_data);\n\t\t\t\t\t var respo = renderer.stages[i].owned_objects[k].hitbox.col_data;\n\t\t\t\t\t var newpo = new SAT.Box(new SAT.Vector(toCanvasX(respo.pos.x), toCanvasY(respo.pos.y)), \n\t\t\t\t\t respo.w, respo.h).toPolygon();\n\t\t\t\t\t //console.log(newpo);\n\t\t\t\t\t if(renderer.stages[i].owned_objects[j].attack_hitbox != undefined){ \n\t\t\t\t\t if(SAT.testPolygonPolygon(renderer.stages[i].owned_objects[j].attack_hitbox.col_data,\n\t\t\t\t\t\t newpo, response) == true){\n\t\t\t\t\t\t\t renderer.stages[i].owned_objects[k].collide_damage();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t\t //console.log(response);\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t }\n\t\t \t }\n\t\t \t}\n\t\t \t\n\t\t } //For2\n\t\t if (renderer.stages[i].always_draw == true) {\n\t\t \tvar indices = [];\n\t\t \tfor(var q = 0; q < renderer.stages[i].owned_objects.length; q++){\n\t\t \t\tindices.push([q, renderer.stages[i].owned_objects[q].depth]);\n\t\t \t\t//console.log(renderer.stages[i].owned_objects[q]);\n\t\t \t}\n\t\t \t//console.log(indices);\n\t\t \tindices.sort(function(a,b){\n\t\t \t\tvar dep1 = a[1];\n if (dep1 == undefined || dep1 == NaN){\n dep1 = 0;\n }\n var dep2 = b[1];\n if (dep2 == undefined || dep2 == NaN){\n dep2 = 0;\n }\n if (dep1 > dep2){\n return -1;\n }else if (dep1 < dep2){\n return 1;\n }else {\n return 0;\n }\n\t\t \t});\n\n\t\t \tfor(var j = 0; j < indices.length; j++){\n\t\t \t\tif (renderer.stages[i].owned_objects[indices[j][0]] != undefined){\n\t\t \t\t\t\trenderer.stages[i].owned_objects[indices[j][0]].draw();\n\t\t \t }\n\t\t \t}\n\t\t /*for(var j = 0; j < renderer.stages[i].owned_objects.length; j++){\n\t\t \tif (renderer.stages[i].owned_objects[j] != undefined){\n\t\t \t\tif(renderer.stages[i].owned_objects[j].canvasX != undefined && \n\t\t \t\t\trenderer.stages[i].owned_objects[j].canvasY != undefined) {\n\t\t \t\t\t\t// Check to see if the canvasX of an object is inside the canvas.\n\t\t \t\t\t\tif (renderer.stages[i].owned_objects[j].canvasX +\n\t\t \t\t\t\t\trenderer.stages[i].owned_objects[j].sprite.width > 0\n\t\t \t\t\t\t\t|| renderer.stages[i].owned_objects[j].canvasX < canvas.width){\n\t\t \t\t\t\t\t\trenderer.stages[i].owned_objects[j].draw();\n\t\t \t\t\t\t\t\t// Else check canvasY\n\t\t \t\t\t\t\t} else if (renderer.stages[i].owned_objects[j].canvasY +\n\t\t \t\t\t\t\t renderer.stages[i].owned_objects[j].sprite.height > 0\n\t\t \t\t\t\t\t || renderer.stages[i].owned_objects[j].canvasY < \n\t\t \t\t\t\t\t canvas.height){\n\t\t \t\t\t\t\t\t renderer.stages[i].owned_objects[j].draw();\n\t\t \t\t\t\t\t}\n\t\t \t\t\t\t\n\t\t \t\t\t} else {\n\t\t \t\t\t\trenderer.stages[i].owned_objects[j].draw();\n\t\t \t\t\t}\n\t\t \t}\n\t\t } //For3 */\n\t\t\n\t\t }\n\t\t\n\t }\n\t}\n\t\n\t\n}", "function render() {\n copyPixels(mouseX, mouseY);\n outputContext.putImageData(outputImageData, 0, 0);\n}", "function drawTile(x, y, r, g, b) {\n context.fillStyle = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n context.fillRect(x + 2, y + 2, level.tilewidth - 4, level.tileheight - 4);\n context.drawImage(gemimage, x + 2, y + 2, level.tilewidth - 4, level.tileheight - 4);\n }", "function createTiles(){\n\t\n\t\n // figure out how wide and tall each tile should be based on the image with and height\n // then ceiling the float that will result from dividing the total size of the image\n // by the number of rows and columns needed\n \t_tile_width = Math.ceil(_image_width/_num_cols); // divide the total number of divs needed by the number of columns to get\n\t\t\t\t\t\t\t\t\t\t\t\t\t// the tile width\n \n\t_tile_height = Math.ceil(_image_height/_num_rows); // divide the total number of divs needed by the number of rows to get\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// the tile height\n\n \n\t//Create the two dimensional array needed to save the tiles in\n\t tile_array = doubleArray(_num_rows, _num_cols);\n\t\n // add all of the tiles to your page using nested for loops and\n\tfor(var r=0; r<_num_rows ; r++) // to loop over each row\n\t{\n\t\tfor(var c=0; c<_num_cols ; c++) // to loop over each column\n\t\t{\n\t\t\tif(r === c && c === 0) // if we are in the first row and column, we mark it as the empty tile\n\t\t\t{\n\t\t\t\ttile_array[r][c] = 0; // we mark it by adding zero\n\t\t\t\tcontinue; //continue to the loop\n\t\t\t}\n\t\t\t\n\t\t\tvar container = document.getElementById(\"cont\"); // get the container div which we will place the other divs in\n\t\t\ttile_array[r][c] = createDiv(r,c); //save each div created into the array\n\t\t\tcontainer.appendChild(tile_array[r][c]); //append the div created and saved to the container\n\t\t\t\n\t\t}\n\t}\n\n\n\t\n}", "buildImage(map, tileset, skip=[]){\n\n for(var y=0; y<map.length; y++){\n for(var x=0; x<map[y].length; x++){\n if(skip.indexOf(map[y][x]) === -1){\n var tile = tileset.getTile(map[y][x]);\n this.ctx.drawImage(tile, x*tileset.tileW, y*tileset.tileH, tileset.tileW, tileset.tileH);\n }\n }\n }\n }", "buildTile(index){\n var imgRow = Math.floor(index / this.numColumns) | 0;\n var imgCol = (index % (this.sourceImage.width / this.tileW)) | 0;\n // console.log(`index: ${index}, imgRow: ${imgRow}, imgCol: ${imgCol}`)\n \n var sx = imgCol * this.tileW;\n var sy = imgRow * this.tileH;\n\n var cnvs = document.createElement(\"canvas\");\n cnvs.width = this.tileW;\n cnvs.height = this.tileH;\n var ctx = cnvs.getContext(\"2d\");\n ctx.imageSmoothingEnabled = false;\n ctx.drawImage(this.sourceImage, sx, sy, this.tileW, this.tileH, 0, 0, this.tileW, this.tileH);\n return cnvs;\n }", "function DrawRectangle(){\n /**Render All Four Quadrants*/\n /**Initialize entry points */\n let i_o = start.y < mouse.y ? start.y : mouse.y; \n let j_o = start.x < mouse.x ? start.x : mouse.x;\n let i_f = i_o == start.y ? mouse.y : start.y;\n let j_f = j_o == start.x ? mouse.x : start.x;\n\n for(let i = i_o; i <= i_f; i++){\n for(let j = j_o; j <= j_f; j++){\n if(i==i_o || j==j_o || i ==i_f || j == j_f){\n if($('#'+i+'a'+j).attr('type') == 'tile'){\n prev_pixels.push($('#'+i+'a'+j));\n }\n }\n }\n }\n}", "function drawMarchingSquaresTiles(ctx, map, vars)\n{\n const { tileLayer, atlas } = ctx;\n\n const { widthInTiles, heightInTiles, screenX, screenY, mapX, mapY} = vars;\n\n // current known marching square tiles mask\n layerMask = 1;\n\n // currently drawn tile mask, initialize with 1 to always draw tile 0.\n let tileMask = 1;\n for (let i=0; i < MARCHING_SQUARE_TEXTURES; i++)\n {\n\n if (layerMask & tileMask)\n {\n\n // DRAW TILES\n for (let y = 0; y < heightInTiles; y++)\n {\n for (let x = 0; x < widthInTiles; x++)\n {\n const t8 = map.read(mapX + x, mapY + y);\n const t4 = map.read(mapX + x + 1, mapY + y);\n const t1 = map.read(mapX + x, mapY + y + 1);\n const t2 = map.read(mapX + x + 1, mapY + y + 1);\n let cellCase =\n (t8 === i ? 8 : 0) +\n (t4 === i ? 4 : 0) +\n (t1 === i ? 1 : 0) +\n (t2 === i ? 2 : 0);\n\n // if this is the first loop\n if (i === 0)\n {\n // collect layerMask bits\n layerMask |= 1 << t8;\n }\n\n if (cellCase !== 0)\n {\n // fix multi-color gaps\n if (cellCase === 1 && t2 !== t8)\n {\n cellCase = 16;\n }\n else if (cellCase === 2 && t4 !== t1)\n {\n cellCase = 17;\n }\n else if (cellCase === 4 && t8 !== t2)\n {\n cellCase = 18;\n }\n else if (cellCase === 8 && t1 !== t4)\n {\n cellCase = 19;\n }\n\n let texture = TEXTURES[i];\n\n texture += \"-\" + cellCase;\n\n const entry = atlas.frames[texture];\n if (!entry)\n {\n throw new Error(\"No texture '\" + texture + \"'\")\n }\n const {pivot, frame} = entry;\n\n tileLayer.addFrame(\n texture,\n screenX + (x << 4) - ((pivot.x * frame.w) | 0),\n screenY + (y << 4) - ((pivot.y * frame.h) | 0) - (i === WOOD ? 2: 0)\n );\n }\n }\n }\n }\n tileMask <<= 1;\n }\n\n}", "function MeligineGameScreenRender(){\r\n\tMeligineCleanTheScreen();\r\n\tactualCell=0;\r\n\t\r\n\tfor(var i=0;i<rows;i++){\r\n\t\t//where is the acctual cell on y\r\n\t\tactualY=i;\r\n\t\tif(actualY>playerY-cellsToDrawAroundPlayer+2 && actualY<playerY+cellsToDrawAroundPlayer-2){\r\n\t\t\tfor(var u=0;u<cellsPerRow;u++){\r\n\t\t\t\tactualX=u;\r\n\t\t\t\tif(actualX>playerX-cellsToDrawAroundPlayer && actualX<playerX+cellsToDrawAroundPlayer){\r\n\t\t\t\t//declare tile image\r\n\t\t\t\t\r\n\t\t\t\tvar tilesetImage= new Image();\r\n\t\t\t\tif(tilesetToUse==1){\r\n\t\t\t\ttilesetImage.src=tileset1;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//where is the acctual cell on x\r\n\t\t\t\t\r\n\t\t\t\t//cell repositioning due to player moving\r\n\t\t\t\tcellReplaceX=(playerScreenPadX+actualX*cellSizeZoom)-cellSizeZoom/2;\r\n\t\t\t\tcellReplaceY=(playerScreenPadY+actualY*cellSizeZoom)-cellSizeZoom/2;\r\n\t\t\t\t\r\n\t\t\t\t//ctx.strokeStyle=\"rgb(100,100,100)\";\r\n\t\t\t\t//ctx.strokeRect(cellReplaceX,cellReplaceY,cellSizeZoom,cellSizeZoom);\r\n\t\t\t\t\r\n\t\t\t\ttilesetTileOnY=Math.floor(allCells[actualCell]/tilesetTilesOnWidth);\r\n\t\t\t//\ttilesetTileOnY=1;\r\n\t\t\t\ttilesetTileOnX=allCells[actualCell]-tilesetTileOnY*tilesetTilesOnWidth;\r\n\t\t\t//\ttilesetTileOnX=9;\r\n\t\t\t\t//set the tilesets on x and y to know from where to pick\r\n\t\t\t\ttilesetX=tilesetTileOnX*tilesetTileSize;\r\n\t\t\t\ttilesetY=tilesetTileOnY*tilesetTileSize;\r\n\t\t\t\t\r\n\t\t\t\tctx.drawImage(tilesetImage,tilesetX,tilesetY,tilesetTileSize,tilesetTileSize,cellReplaceX,cellReplaceY,cellSizeZoom,cellSizeZoom);\r\n\t\t\t\tctx.fillStyle=\"rgb(255,0,255)\";\r\n\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\tactualCell++;\r\n\t\t\t\t}else{\r\n\t\t\t\tactualCell++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}else{\r\n\t\tactualCell+=cellsPerRow;\r\n\t\t}\r\n\t}\r\n\tMeligineDrawThePlayer();\r\n}", "fillMap() {\n const layout = this.config.layout || [[]];\n\n // First pass to assign basic walls\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col === 1) {\n this.groundLayer.putTileAt(TILES.FLOOR.BASIC, x, y);\n return;\n }\n\n const isWall = Object.values(getNeighbors(x, y))\n .reduce((a, pos) => isFloorTile(layout, pos) || a, false);\n\n if (isWall) {\n layout[y][x] = 2;\n }\n });\n });\n\n // Second pass to determine wall orientation\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col < 2) {\n return;\n }\n\n const neighbors = getNeighbors(x, y);\n\n let wallHash = 0;\n if (isWallTile(layout, neighbors.t)) {\n wallHash |= WALL_FLAGS.TOP;\n }\n if (isWallTile(layout, neighbors.r)) {\n wallHash |= WALL_FLAGS.RIGHT;\n }\n if (isWallTile(layout, neighbors.b)) {\n wallHash |= WALL_FLAGS.BOTTOM;\n }\n if (isWallTile(layout, neighbors.l)) {\n wallHash |= WALL_FLAGS.LEFT;\n }\n\n switch (wallHash) {\n case 1:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_BOTTOM, x, y);\n break;\n case 2:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_LEFT, x, y);\n break;\n case 3:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_LEFT, x, y);\n break;\n case 4:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_TOP, x, y);\n break;\n case 5:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.OPEN, x, y);\n break;\n case 6:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_LEFT, x, y);\n break;\n case 7:\n this.groundLayer.putTileAt(TILES.T_CORNER.RIGHT, x, y);\n break;\n case 8:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_RIGHT, x, y);\n break;\n case 9:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_RIGHT, x, y);\n break;\n case 10:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.OPEN, x, y);\n break;\n case 11:\n this.groundLayer.putTileAt(TILES.T_CORNER.TOP, x, y);\n break;\n case 12:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_RIGHT, x, y);\n break;\n case 13:\n this.groundLayer.putTileAt(TILES.T_CORNER.LEFT, x, y);\n break;\n case 14:\n this.groundLayer.putTileAt(TILES.T_CORNER.BOTTOM, x, y);\n break;\n case 15:\n this.groundLayer.putTileAt(TILES.T_CORNER.ALL, x, y);\n break;\n default:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_BOTH, x, y);\n }\n });\n });\n }", "function TileManager() {\n\n var MAX_TILE_DETAIL_SCALE = 5;\n if (window.location.hash === '#low') {\n MAX_TILE_DETAIL_SCALE = 2;\n }\n\n this.dimensions = {};\n this.elementsByGroup = [];\n this.levels = {\n 'high': 1000,\n 'medium': 2500,\n 'small': 5000,\n 'mini': 10000\n };\n\n var jsonTile = {};\n var self = this;\n var groupsQtty;\n var _firstLayer;\n var layersQtty;\n var section = [];\n var columnWidth = 0;\n var layerPosition = [];\n var superLayerMaxHeight = 0;\n var superLayerPosition = [];\n var qualities = {};\n\n var onClick = function(target) {\n if(window.actualView === 'table')\n window.onElementClick(target.userData.id);\n };\n\n this.JsonTile = function(callback){\n $.get(\"json/config_tile.json\", {}, function(json) {\n jsonTile = json;\n qualities = jsonTile.qualities;\n callback();\n });\n };\n\n /**\n * Pre-computes the space layout for next draw\n */\n this.preComputeLayout = function () {\n\n var SUPER_LAYER_SEPARATION = 3;\n\n var section_size = [],\n superLayerHeight = 0,\n isSuperLayer = [],\n i, actualSuperLayerName = '';\n\n //Initialize\n for (var key in layers) {\n if (key == \"size\") continue;\n\n var id = layers[key].index;\n\n if(layers[key].super_layer !== actualSuperLayerName) {\n superLayerHeight = 0;\n actualSuperLayerName = layers[key].super_layer;\n }\n\n if (layers[key].super_layer) {\n\n section[id] = 0;\n section_size[id] = 0;\n superLayerHeight++;\n\n if (superLayerMaxHeight < superLayerHeight) superLayerMaxHeight = superLayerHeight;\n }\n else {\n\n var newLayer = [];\n\n for (i = 0; i < groupsQtty; i++)\n newLayer.push(0);\n\n section_size[id] = newLayer;\n section[id] = newLayer.slice(0); //Use a copy\n }\n\n isSuperLayer.push(false);\n }\n\n for (var j = 0; j <= groupsQtty; j++) {\n\n self.elementsByGroup.push([]);\n }\n\n //Set sections sizes\n\n for(var platfrm in window.TABLE){\n\n for (var layer in window.TABLE[platfrm].layers){\n\n for(i = 0; i < window.TABLE[platfrm].layers[layer].objects.length; i++){\n\n var tile = window.TABLE[platfrm].layers[layer].objects[i];\n\n var r = tile.data.layerID;\n\n var c = tile.data.platformID;\n var idT = tile.id;\n\n\n self.elementsByGroup[c].push(idT);\n\n if (layers[tile.data.layer].super_layer) {\n\n section_size[r]++;\n isSuperLayer[r] = layers[tile.data.layer].super_layer;\n } else {\n\n section_size[r][c]++;\n if (section_size[r][c] > columnWidth) columnWidth = section_size[r][c];\n }\n\n }\n }\n }\n\n //Set row height\n\n var actualHeight = 0;\n var remainingSpace = superLayerMaxHeight;\n var inSuperLayer = false;\n var actualSuperLayer = -1;\n\n actualSuperLayerName = false;\n\n for (i = 0; i < layersQtty; i++) {\n\n if(isSuperLayer[i] !== actualSuperLayerName) {\n\n actualHeight += remainingSpace + 1;\n remainingSpace = superLayerMaxHeight;\n\n if(isSuperLayer[i]) {\n actualSuperLayer++;\n inSuperLayer = false;\n }\n\n actualSuperLayerName = isSuperLayer[i];\n }\n\n if (isSuperLayer[i]) {\n\n if (!inSuperLayer) {\n actualHeight += SUPER_LAYER_SEPARATION;\n\n if (superLayerPosition[actualSuperLayer] === undefined) {\n superLayerPosition[actualSuperLayer] = actualHeight;\n }\n }\n\n inSuperLayer = true;\n actualHeight++;\n remainingSpace--;\n } else {\n\n if (inSuperLayer) {\n\n actualHeight += remainingSpace + 1;\n remainingSpace = superLayerMaxHeight;\n }\n\n inSuperLayer = false;\n actualHeight++;\n }\n\n if(actualHeight == 6) //Separates GUI section\n actualHeight += 2;\n\n layerPosition[i] = actualHeight;\n }\n };\n\n this.fillTable = function (list) {\n var _suprlays = list.suprlays,\n _platfrms = list.platfrms,\n _layers = list.layers,\n _comps = list.comps,\n i, l, code, name;\n\n for (i = 0, l = _suprlays.length; i < l; i++) {\n code = _suprlays[i].code;\n window.superLayers[code] = {};\n window.superLayers[code].name = _suprlays[i].name;\n window.superLayers[code].index = _suprlays[i].order;\n window.superLayers[code]._id = _suprlays[i]._id;\n window.superLayers[code].dependsOn = _suprlays[i].deps;\n window.TABLE[code] = {\n layers : {},\n ID: _suprlays[i]._id,\n isSlayer: code\n };\n }\n\n for (i = 0, l = _platfrms.length; i < l; i++) {\n code = _platfrms[i].code;\n window.platforms[code] = {};\n window.platforms[code].index = _platfrms[i].order;\n window.platforms[code].dependsOn = _platfrms[i].deps;\n window.platforms[code]._id = _platfrms[i]._id;\n window.TABLE[code] = {\n layers : {},\n ID: _platfrms[i]._id,\n isSlayer: false\n };\n }\n\n for (i = 0, l = _layers.length; i < l; i++) {\n name = helper.capFirstLetter(_layers[i].name);\n window.layers[name] = {};\n //TODO: Temp fix of the server\n window.layers[name].super_layer = (_layers[i].suprlay !== \"false\") ? _layers[i].suprlay : false;\n window.layers[name].index = _layers[i].order;\n window.layers[name]._id = _layers[i]._id;\n }\n\n var buildElement = function (e) {\n\n var _comp = _comps[e];\n\n var _platfrm = getSPL(_comp._platfrm_id, _platfrms);\n var _layer = getSPL(_comp._layer_id, _layers);\n\n var layerID = _layer.order;\n layerID = (layerID === undefined) ? layers.size() : layerID;\n\n var platformID = _platfrm ? _platfrm.order : undefined;\n platformID = (platformID === undefined) ? window.platforms.size() : platformID;\n\n var _author = getBestDev(_comp.devs, \"author\");\n var _maintainer = getBestDev(_comp.devs, \"maintainer\");\n\n _layer = helper.capFirstLetter(_layer.name);\n\n var element = {\n \tid: _comp._id,\n platform: _platfrm ? _platfrm.code : undefined,\n platformID: platformID,\n superLayer : layers[_layer].super_layer,\n code: helper.getCode(_comp.name),\n name: helper.capFirstLetter(_comp.name),\n layer: _layer,\n layerID: layerID,\n type: helper.capFirstLetter(_comp.type),\n picture: _author.avatar_url ? _author.avatar_url : undefined,\n author: _author.usrnm ? _author.usrnm : undefined,\n authorRealName: _author.name ? _author.name : undefined,\n authorEmail: _author.email ? _author.email : undefined,\n maintainer : _maintainer.usrnm ? _maintainer.usrnm : undefined,\n maintainerPicture : _maintainer.avatar_url ? _maintainer.avatar_url : undefined,\n maintainerRealName : _maintainer.name ? _maintainer.name : undefined,\n difficulty: _comp.difficulty,\n code_level: _comp.code_level ? _comp.code_level : undefined,\n life_cycle: _comp.life_cycle,\n found: _comp.found,\n devs: _comp.devs,\n repo_dir: _comp.repo_dir,\n description: _comp.description\n };\n return element;\n };\n\n for (i = 0, l = _comps.length; i < l; i++) {\n\n var element = buildElement(i);\n\n //An element is always inside a platform or a superlayer\n //TODO: Temp fix of the server\n var group = element.platform || ((element.superLayer !== \"false\") ? element.superLayer : false),\n layer = element.layer;\n\n if(typeof window.TABLE[group] === 'undefined'){\n window.TABLE[group] = {\n layers : {},\n ID: element.platformID,\n isSlayer: element.superLayer\n };\n }\n\n if(typeof window.TABLE[group].layers[layer] === 'undefined'){\n window.TABLE[group].layers[layer] = {\n objects : [],\n y : 0,\n ID: element.layerID\n };\n }\n\n var lastObject = window.TABLE[group].layers[layer].objects.length;\n var count = lastObject;\n\n\n var objectTile = {\n mesh : null,\n data : element,\n target : {},\n id: group + '_' + layer + '_' + count\n };\n\n\n window.tilesQtty.push(objectTile.id);\n\n window.TABLE[group].layers[layer].objects.push(objectTile);\n\n }\n\n groupsQtty = _platfrms.length;\n layersQtty = list.layers.length;\n _firstLayer = _layers[0].order;\n };\n\n /**\n * Creates the tile texture\n * @param {Number} id ID in the table\n * @param {String} quality The quality of the picture as folder in the images dir\n * @param {Number} tileWidth Width of the tile\n * @param {Number} tileHeight Height of the tile\n * @param {Number} scale Scale of the pictures, the bigger, the better but heavier\n * @returns {Object} The drawn texture\n */\n this.createTexture = function (id, quality, tileWidth, tileHeight, scale, _table) {\n\n var tile = _table || window.helper.getSpecificTile(id).data;\n\n var state = tile.code_level,\n difficulty = Math.ceil(tile.difficulty / 2),\n group = tile.platform || window.layers[tile.layer].super_layer,\n type = tile.type,\n picture = tile.picture,\n base = 'images/tiles/';\n\n var canvas = document.createElement('canvas');\n canvas.width = tileWidth * scale;\n canvas.height = tileHeight * scale;\n\n var middle = canvas.width / 2;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = \"#FFFFFF\";\n ctx.textAlign = 'center';\n\n var texture = new THREE.Texture(canvas);\n texture.minFilter = THREE.NearestFilter;\n texture.magFilter = THREE.LinearFilter;\n\n var pic = {\n src: picture || base + 'buster.png'\n },\n portrait = {\n src: base + 'portrait/' + quality + '/' + state + '.png',\n x: jsonTile.global.portrait.x,\n y: jsonTile.global.portrait.y,\n w: jsonTile.global.portrait.w * tileWidth * scale,\n h: jsonTile.global.portrait.h * tileHeight * scale,\n skip: qualities[(jsonTile.global.portrait.minQuality || 'mini')] > qualities[quality]\n },\n groupIcon = {\n src: base + 'icons/group/' + quality + '/icon_' + group + '.png',\n w: jsonTile.global.groupIcon.w * scale,\n h: jsonTile.global.groupIcon.h * scale,\n skip: qualities[(jsonTile.global.groupIcon.minQuality || 'mini')] > qualities[quality]\n },\n typeIcon = {\n src: base + 'icons/type/' + quality + '/' + type.toLowerCase() + '_logo.png',\n w: jsonTile.global.typeIcon.w * scale,\n h: jsonTile.global.typeIcon.h * scale,\n skip: qualities[(jsonTile.global.typeIcon.minQuality || 'mini')] > qualities[quality]\n },\n ring = {\n src: base + 'rings/' + quality + '/' + state + '_diff_' + difficulty + '.png',\n skip: qualities[(jsonTile.global.ring.minQuality || 'mini')] > qualities[quality]\n },\n codeText = {\n text: tile.code,\n font: (jsonTile.global.codeText.font * scale) + \"px Arial\",\n skip: qualities[(jsonTile.global.codeText.minQuality || 'mini')] > qualities[quality]\n },\n nameText = {\n text: tile.name,\n font: (jsonTile.global.nameText.font * scale) + 'px Arial',\n skip: qualities[(jsonTile.global.nameText.minQuality || 'mini')] > qualities[quality]\n },\n layerText = {\n text: tile.layer,\n font: (jsonTile.global.layerText.font * scale) + 'px Arial',\n skip: qualities[(jsonTile.global.layerText.minQuality || 'mini')] > qualities[quality]\n },\n authorText = {\n text: tile.authorRealName || tile.author || '',\n font: (jsonTile.global.authorText.font * scale) + 'px Arial',\n skip: qualities[(jsonTile.global.authorText.minQuality || 'mini')] > qualities[quality]\n },\n picMaintainer = {\n src: tile.maintainerPicture || base + 'buster.png',\n skip: qualities[(jsonTile.concept.picMaintainer.minQuality || 'mini')] > qualities[quality]\n },\n maintainer = {\n text: 'Maintainer',\n font: (jsonTile.global.maintainer.font * scale) + 'px Arial',\n color: \"#FFFFFF\",\n skip: qualities[(jsonTile.global.maintainer.minQuality || 'mini')] > qualities[quality]\n },\n nameMaintainer = {\n text: tile.maintainerRealName || tile.maintainer || '',\n font: (jsonTile.global.nameMaintainer.font * scale) + 'px Arial',\n color: \"#FFFFFF\",\n skip: qualities[(jsonTile.global.nameMaintainer.minQuality || 'mini')] > qualities[quality]\n },\n userMaintainer = {\n text: tile.maintainer || 'No Maintainer yet',\n font: (jsonTile.global.userMaintainer.font * scale) + 'px Arial',\n color: \"#E2E2E2\",\n skip: qualities[(jsonTile.concept.userMaintainer.minQuality || 'mini')] > qualities[quality]\n };\n\n pic.x = jsonTile[state].pic.x * scale;\n pic.y = jsonTile[state].pic.y * scale;\n pic.w = jsonTile[state].pic.w * scale;\n pic.h = jsonTile[state].pic.h * scale;\n\n groupIcon.x = jsonTile[state].groupIcon.x * scale;\n groupIcon.y = jsonTile[state].groupIcon.y * scale;\n\n typeIcon.x = jsonTile[state].typeIcon.x * scale;\n typeIcon.y = jsonTile[state].typeIcon.y * scale;\n\n ring.x = jsonTile[state].ring.x * scale;\n ring.y = jsonTile[state].ring.y * scale;\n ring.w = jsonTile[state].ring.w * scale;\n ring.h = jsonTile[state].ring.h * scale;\n\n codeText.x = middle;\n codeText.y = jsonTile[state].codeText.y * scale;\n\n nameText.x = middle;\n nameText.y = jsonTile[state].nameText.y * scale;\n nameText.font = (jsonTile[state].nameText.font * scale) + 'px Arial';\n\n layerText.x = middle;\n layerText.y = jsonTile[state].layerText.y * scale;\n\n authorText.x = middle;\n authorText.y = jsonTile[state].authorText.y * scale;\n\n picMaintainer.x = jsonTile[state].picMaintainer.x * scale;\n picMaintainer.y = jsonTile[state].picMaintainer.y * scale;\n picMaintainer.w = jsonTile[state].picMaintainer.w * scale;\n picMaintainer.h = jsonTile[state].picMaintainer.h * scale;\n\n maintainer.x = jsonTile[state].maintainer.x * scale;\n maintainer.y = jsonTile[state].maintainer.y * scale;\n\n nameMaintainer.x = jsonTile[state].nameMaintainer.x * scale;\n nameMaintainer.y = jsonTile[state].nameMaintainer.y * scale;\n\n userMaintainer.x = jsonTile[state].userMaintainer.x * scale;\n userMaintainer.y = jsonTile[state].userMaintainer.y * scale;\n\n if(typeof jsonTile[state].layerText.color !== 'undefined')\n layerText.color = jsonTile[state].layerText.color;\n\n if(typeof jsonTile[state].nameText.color !== 'undefined')\n nameText.color = jsonTile[state].nameText.color;\n\n if(state === \"production\"){\n codeText.x = jsonTile[state].codeText.x * scale;\n layerText.x = jsonTile[state].layerText.x * scale;\n authorText.x = jsonTile[state].authorText.x * scale;\n\n nameText.x = jsonTile[state].nameText.x * scale;\n nameText.constraint = jsonTile[state].nameText.constraint * scale;\n nameText.lineHeight = jsonTile[state].nameText.lineHeight * scale;\n nameText.wrap = true;\n }\n\n if (state == \"concept\" || state == \"production\")\n ring.src = base + 'rings/' + quality + '/linear_diff_' + difficulty + '.png';\n\n if (difficulty === 0)\n ring = {};\n\n var data = [\n pic,\n picMaintainer,\n portrait,\n groupIcon,\n typeIcon,\n ring,\n codeText,\n nameText,\n layerText,\n authorText,\n maintainer,\n nameMaintainer,\n userMaintainer\n ];\n\n if ( tile.found !== true ) {\n\n var stamp = {\n src: 'images/alt_not_found.png',\n x: 0,\n y: 0,\n w: tileWidth * scale,\n h: tileHeight * scale\n };\n\n data.push(stamp);\n\n }\n\n drawPicture(data, ctx, texture);\n\n return texture;\n };\n\n /**\n * Creates a Tile\n * @param {Number} i ID of the tile (index in table)\n * @returns {DOMElement} The drawable element that represents the tile\n */\n\n this.createElement = function (id, _table) {\n\n var mesh,\n element = new THREE.LOD(),\n texture,\n tileWidth = window.TILE_DIMENSION.width - window.TILE_SPACING,\n tileHeight = window.TILE_DIMENSION.height - window.TILE_SPACING,\n scale = 2,\n table = _table || null;\n\n \n for(var level in this.levels) {\n\n if (level === 'high') scale = MAX_TILE_DETAIL_SCALE;\n else scale = 1;\n\n texture = self.createTexture(id, level, tileWidth, tileHeight, scale, table);\n\n mesh = new THREE.Mesh(\n new THREE.PlaneBufferGeometry(tileWidth, tileHeight),\n new THREE.MeshBasicMaterial({\n side: THREE.DoubleSide,\n transparent : true,\n map : texture\n })\n );\n\n mesh.userData = {\n id: id,\n onClick : onClick\n };\n mesh.renderOrder = 1;\n element.addLevel(mesh, this.levels[level]);\n element.userData = {\n flying: false\n };\n }\n\n return element;\n };\n\n /**\n * Converts the table in another form\n * @param {Array} goal Member of ViewManager.targets\n * @param {Number} duration Milliseconds of animation\n */\n this.transform = function (ordered, duration) {\n\n var i, l, j,\n DELAY = 500;\n\n duration = duration || 2000;\n ordered = ordered || false;\n\n //TWEEN.removeAll();\n\n var animate = function(object, target, delay) {\n\n delay = delay || 0;\n\n var move = new TWEEN.Tween(object.position)\n .to({\n x: target.position.x,\n y: target.position.y,\n z: target.position.z\n }, Math.random() * duration + duration)\n .easing(TWEEN.Easing.Exponential.InOut)\n .delay(delay)\n .onComplete(function() { object.userData.flying = false; });\n\n var rotation = new TWEEN.Tween(object.rotation)\n .to({\n x: target.rotation.x,\n y: target.rotation.y,\n z: target.rotation.z\n }, Math.random() * duration + duration)\n .delay(delay)\n .easing(TWEEN.Easing.Exponential.InOut);\n\n move.onStart(function() { rotation.start(); });\n\n return move;\n };\n\n if(ordered === true) {\n\n for(i = 0; i < self.elementsByGroup.length; i++) {\n\n var k = (i + self.elementsByGroup.length - 1) % (self.elementsByGroup.length);\n var delay = i * DELAY;\n\n for(j = 0; j < self.elementsByGroup[k].length; j++) {\n\n var index = self.elementsByGroup[k][j];\n\n var target = window.helper.getSpecificTile(index);\n\n var animation = animate(target.mesh, target.target.show, delay);\n\n animation.start();\n }\n }\n }\n else {\n\n for(var r = 0; r < window.tilesQtty.length; r++){\n\n var tile = window.helper.getSpecificTile(window.tilesQtty[r]);\n\n animate(tile.mesh, tile.target.show, 0).start();\n }\n }\n\n if(window.actualView === 'table') {\n if(!window.headersUp) {\n headers.showHeaders(duration);\n window.headersUp = true;\n }\n }\n\n\n new TWEEN.Tween(this)\n .to({}, duration * 2 + self.elementsByGroup * DELAY)\n .onUpdate(render)\n .start();\n\n setTimeout(window.screenshotsAndroid.show, duration);\n };\n\n /**\n * Goes back to last target set in last transform\n */\n this.rollBack = function () {\n\n window.camera.enable();\n window.camera.loseFocus();\n\n window.helper.show('container', 2000);\n\n window.workFlowManager.getActualFlow();\n\n self.transform();\n\n //window.changeView(self.lastTargets);\n };\n\n /**\n * Inits and draws the table, also creates the Dimensions object\n */\n this.drawTable = function () {\n\n this.preComputeLayout();\n\n var layerCoordinates = [];\n\n var signRow = null,\n signColumn = null;\n\n for(var i = 0; i < window.tilesQtty.length; i++){\n\n var id = window.tilesQtty[i];\n\n var mesh = this.createElement(id);\n\n scene.add(mesh);\n\n window.helper.getSpecificTile(id).mesh = mesh;\n\n var object = new THREE.Object3D();\n\n //Row (Y)\n var tile = window.helper.getSpecificTile(id).data;\n\n var group = tile.platform || window.layers[tile.layer].super_layer;\n\n var row = tile.layerID;\n\n if (layers[tile.layer].super_layer) {\n\n object.position.x = ((section[row]) * window.TILE_DIMENSION.width) - (columnWidth * groupsQtty * window.TILE_DIMENSION.width / 2);\n\n section[row]++;\n\n } else {\n\n //Column (X)\n var column = tile.platformID;\n\n object.position.x = (((column * (columnWidth) + section[row][column]) + column) * window.TILE_DIMENSION.width) - (columnWidth * groupsQtty * window.TILE_DIMENSION.width / 2);\n\n section[row][column]++;\n }\n\n\n object.position.y = -((layerPosition[row]) * window.TILE_DIMENSION.height) + (layersQtty * window.TILE_DIMENSION.height / 2);\n\n if(typeof layerCoordinates[row] === 'undefined')\n layerCoordinates[row] = object.position.y;\n\n\n /*start Positioning tiles*/\n\n object.position.copy(window.viewManager.translateToSection('table', object.position));\n\n if(layers[tile.layer].super_layer){\n\n if(typeof window.TABLE[layers[tile.layer].super_layer].x === 'undefined')\n window.TABLE[layers[tile.layer].super_layer].x = object.position.x;\n\n }\n\n var target = window.helper.fillTarget(object.position.x, object.position.y, object.position.z, 'table');\n\n window.helper.getSpecificTile(id).target = target;\n\n mesh.position.copy(target.hide.position);\n\n mesh.rotation.set(target.hide.rotation.x, target.hide.rotation.y, target.hide.rotation.z);\n\n /*End*/\n if(!window.signLayer.findSignLayer(group, tile.layer)){\n if(i === 0 ){ //entra a la primera\n window.signLayer.createSignLayer(object.position.x, object.position.y, tile.layer, group);\n signRow = tile.layerID;\n signColumn = tile.platformID;\n window.TABLE[group].layers[tile.layer].y = object.position.y;\n }\n\n if(tile.layerID !== signRow && tile.platformID === signColumn && layers[tile.layer].super_layer === false){ // solo cambio de filas\n window.signLayer.createSignLayer(object.position.x, object.position.y, tile.layer, group);\n signRow = tile.layerID;\n signColumn = tile.platformID;\n window.TABLE[group].layers[tile.layer].y = object.position.y;\n }\n\n else if(signColumn !== tile.platformID && layers[tile.layer].super_layer === false){ //cambio de columna\n window.signLayer.createSignLayer(object.position.x, object.position.y, tile.layer, group);\n signRow = tile.layerID;\n signColumn = tile.platformID;\n window.TABLE[group].layers[tile.layer].y = object.position.y;\n }\n }\n }\n\n this.dimensions = {\n columnWidth: columnWidth,\n superLayerMaxHeight: superLayerMaxHeight,\n groupsQtty: groupsQtty,\n layersQtty: layersQtty,\n superLayerPosition: superLayerPosition,\n layerPositions : layerCoordinates\n };\n };\n\n /**\n * Takes away all the tiles except the one with the id\n * @param {Array} [ids] The IDs to let alone\n * @param {Number} [duration=2000] Duration of the animation\n */\n this.letAlone = function (ids, duration) {\n\n var i, _duration = duration || 2000,\n distance = camera.getMaxDistance() * 2,\n out = window.viewManager.translateToSection('table', new THREE.Vector3(0, 0, distance));\n\n //TWEEN.removeAll();\n\n var target;\n\n var animate = function (object, target, dur) {\n\n new TWEEN.Tween(object.position)\n .to({\n x: target.x,\n y: target.y,\n z: target.z\n }, dur)\n .easing(TWEEN.Easing.Exponential.InOut)\n .onComplete(function () {\n object.userData.flying = false;\n })\n .start();\n\n };\n\n for(i = 0; i < window.tilesQtty.length; i++){\n\n var tile = window.helper.getSpecificTile(window.tilesQtty[i]);\n\n if (ids === tile.id) {\n target = tile.target.show.position;\n }\n else {\n target = out;\n tile.mesh.userData.flying = true;\n }\n\n animate(tile.mesh, target, Math.random() * _duration + _duration);\n }\n\n new TWEEN.Tween(this)\n .to({}, _duration * 2)\n .onUpdate(render)\n .start();\n\n window.screenshotsAndroid.hide();\n window.signLayer.letAloneSignLayer();\n };\n\n this.updateElementsByGroup = function(){\n\n self.elementsByGroup = [];\n\n window.tilesQtty = [];\n\n var i = 0;\n\n for (var j = 0; j <= groupsQtty; j++) {\n\n self.elementsByGroup.push([]);\n }\n\n for(var platform in window.TABLE){\n\n for(var layer in window.TABLE[platform].layers){\n\n for(i = 0; i < window.TABLE[platform].layers[layer].objects.length; i++){\n\n var tile = window.TABLE[platform].layers[layer].objects[i];\n\n var c = tile.data.platformID;\n var id = tile.id;\n\n window.tilesQtty.push(id);\n\n self.elementsByGroup[c].push(id);\n\n }\n }\n }\n };\n\n //Private methods\n\n /**\n * Draws a picture in canvas\n * @param {Array} data The options of the picture\n * @param {Object} ctx Canvas context\n * @param {Object} texture The texture object to update\n */\n function drawPicture(data, ctx, texture) {\n\n var image = new Image();\n var actual = data.shift();\n\n if (actual && actual.src && actual.src != 'undefined') {\n\n image.onload = function () {\n\n if (!actual.skip) {\n ctx.drawImage(image, actual.x, actual.y, actual.w, actual.h);\n }\n if (texture)\n texture.needsUpdate = true;\n\n if (data.length !== 0) {\n\n if (data[0].text)\n drawText(data, ctx, texture);\n else\n drawPicture(data, ctx, texture);\n }\n };\n\n image.onerror = function () {\n if (data.length !== 0) {\n if (data[0].text)\n drawText(data, ctx, texture);\n else\n drawPicture(data, ctx, texture);\n }\n };\n\n image.crossOrigin = \"anonymous\";\n image.src = actual.src;\n } else {\n if (data.length !== 0) {\n if (data[0].text)\n drawText(data, ctx, texture);\n else\n drawPicture(data, ctx, texture);\n }\n }\n }\n\n /**\n * Draws a texture in canvas\n * @param {Array} data Options of the texture\n * @param {Object} ctx Canvas Context\n * @param {Object} texture Texture to update\n */\n function drawText(data, ctx, texture) {\n\n var actual = data.shift();\n\n //TODO: Set Roboto typo\n\n if (!actual.skip) {\n if (actual.color)\n ctx.fillStyle = actual.color;\n\n ctx.font = actual.font;\n\n if (actual.constraint)\n if (actual.wrap)\n helper.drawText(actual.text, actual.x, actual.y, ctx, actual.constraint, actual.lineHeight);\n else\n ctx.fillText(actual.text, actual.x, actual.y, actual.constraint);\n else\n ctx.fillText(actual.text, actual.x, actual.y);\n }\n\n if (texture)\n texture.needsUpdate = true;\n\n ctx.fillStyle = \"#FFFFFF\";\n\n if (data.length !== 0){\n\n if(data[0].text)\n drawText(data, ctx, texture);\n else\n drawPicture(data, ctx, texture);\n }\n }\n\n function getSPL(_id, _SPLArray) {\n if (_id) {\n for (var i = 0, l = _SPLArray.length; i < l; i++) {\n if (_SPLArray[i]._id + '' == _id + '') {\n return _SPLArray[i];\n }\n }\n } else {\n return null;\n }\n }\n\n /**\n * Gets the best developer in the given role\n * @param {Array} _devs The array of developers\n * @param {string} role The role to look for\n * @returns {object} The best developer by the given criteria\n */\n function getBestDev(_devs, role) {\n var dev = {};\n if (_devs) {\n var _dev = {};\n dev.percnt = 0;\n for (var i = 0, l = _devs.length; i < l; i++) {\n _dev = _devs[i];\n\n if((role === 'author' && _dev.role === 'author' && _dev.scope === 'implementation') ||\n (role === 'maintainer' && _dev.role === 'maintainer')) {\n\n if (_dev.percnt >= dev.percnt) {\n\n dev.percnt = _dev.percnt;\n dev.usrnm = _dev.dev.usrnm;\n dev.name = _dev.dev.name;\n dev.email = _dev.dev.email;\n dev.avatar_url = _dev.dev.avatar_url;\n }\n }\n }\n }\n return dev;\n }\n}", "function addTile(context, z, y, x) {\n var tile = context.findTile(z, y, x);\n if ( tile ) {\n tile.locked = false;\n return;\n }\n //console.log(\"addTile z=\"+z+\" y=\"+y+\" x=\"+x);\n var cood = new Float32Array(256*256*2);\n \n// var extent = ol.proj.get(\"EPSG:3857\").getExtent();\n \n var zz = Math.pow(2,parseInt(z));\n var xx = (parseFloat(x))/zz;\n var yy = (parseFloat(y)+1)/zz;\n \n xx = xx*(extent[2]-extent[0])+extent[0];\n yy = yy*(extent[3]-extent[1])+extent[1];\n var xd = (extent[2]-extent[0])/zz/256;\n var yd = (extent[3]-extent[1])/zz/256;\n \n var c = {x:[256],y:[256]};\n for ( var i = 0 ; i < 256 ; i++ ) {\n var xxx = xx + xd*parseFloat(i);\n var yyy = yy - yd*parseFloat(i);\n var xp = ol.proj.transform([xxx,yy], 'EPSG:3857', 'EPSG:4326');\n c.x[i] = xp[0];\n if ( c.x[i] < -180.0 )\n c.x[i] += 360.0;\n else if ( c.x[i] >= 180.0 )\n c.x[i] -= 360.0;\n var yp = ol.proj.transform([xx,yyy], 'EPSG:3857', 'EPSG:4326');\n c.y[i] = yp[1];\n }\n var i = 0;\n for ( var yi = 0 ; yi < 256 ; yi++ ) {\n for ( var xi = 0 ; xi < 256 ; xi++ ) {\n cood[i++] = c.y[yi];\n cood[i++] = c.x[xi];\n }\n }\n context.addTile(\"M\", z, y, x, cood,\n new WRAP.Geo.Bounds(cood[0]*60.0, cood[2*256*255]*60.0, cood[2*256*256-1]*60.0, cood[1]*60.0));\n }", "function Tile() {\n this.x=0;\n this.y=0;\n this.z=0;\n this.type='';\n this.selected = false;\n this.isConstructible = true;\n this.building = 0;\n if (typeof(Tile.initialized) == 'undefined') {\n // Definition des coordonnée sur l'écran par rapport aux coordonnées dans le tableau\n Tile.prototype.toScreen = function () {\n var screen = [];\n screen.x = offsetX - (this.y * tileWidth / 2) + (this.x * tileWidth / 2) - (tileWidth / 2);\n screen.y = offsetY + (this.y * visualHeight / 2) + (this.x * visualHeight / 2);\n return screen;\n };\n // Affichage de la tile\n Tile.prototype.print = function (context) {\n context.drawImage(tileSet, tileWidth * (this.type+tilesetOffset), 0 * tileHeight, tileWidth, tileHeight, this.toScreen().x, ((this.toScreen().y) - this.z), tileWidth, tileHeight);\n var j;\n if (this.selected) {\n if (!this.isConstructible){\n context.drawImage(tileSet, tileWidth * 1, 0 * tileHeight, tileWidth, tileHeight, this.toScreen().x, ((this.toScreen().y) - this.z), tileWidth, tileHeight);\n } else {\n context.drawImage(tileSet, tileWidth * 0, 0 * tileHeight, tileWidth, tileHeight, this.toScreen().x, ((this.toScreen().y) - this.z), tileWidth, tileHeight);\n }\n j = 1;\n }\n else {\n j = 0;\n }\n\n if (this.building !== 0) {\n context.drawImage(buildings, tileWidth * this.building, j * buildingHeight, tileWidth, buildingHeight, this.toScreen().x, this.toScreen().y - (buildingHeight - visualHeight) - this.z, tileWidth, buildingHeight);\n }\n };\n }\n }", "function renderTiles() {\n removeChildren(tilesContainer);\n for (var i = 0, length = tiles.length; i < length; ++i) {\n tilesContainer.appendChild(tiles[i].elem);\n }\n}", "function makeCorridor(map,startx,starty,endx,endy){\n\tvar r;\n\n if(startx < endx){\n for(r = startx; r <= endx; r++){\n map.tiles[r][starty] = new TileProtos.Floor();\n if(map.tiles[r+1][starty+1] === undefined)\n map.tiles[r+1][starty+1] = new TileProtos.Wall();\n if(map.tiles[r+1][starty-1] === undefined)\n map.tiles[r+1][starty-1] = new TileProtos.Wall();\n }\n }else {\n for(r = endx; r <= startx; r++){\n map.tiles[r][starty] = new TileProtos.Floor();\n if(map.tiles[r-1][starty+1] === undefined)\n map.tiles[r-1][starty+1] = new TileProtos.Wall();\n if(map.tiles[r-1][starty-1] === undefined)\n map.tiles[r-1][starty-1] = new TileProtos.Wall();\n } \n }\n if(starty < endy){\n for(r = starty; r <= endy; r++){\n map.tiles[endx][r] = new TileProtos.Floor();\n if(map.tiles[endx+1][r-1] === undefined)\n map.tiles[endx+1][r-1] = new TileProtos.Wall();\n if(map.tiles[endx-1][r-1] === undefined)\n map.tiles[endx-1][r-1] = new TileProtos.Wall();\n }\n }else {\n for(r = endy; r <= starty; r++){\n map.tiles[endx][r] = new TileProtos.Floor();\n if(map.tiles[endx+1][r+1] === undefined)\n map.tiles[endx+1][r+1] = new TileProtos.Wall();\n if(map.tiles[endx-1][r+1] === undefined)\n map.tiles[endx-1][r+1] = new TileProtos.Wall();\n } \n }\n\n}", "function drawTiles()\n{\n\tfor(var y = 0; y < BOARD_HEIGHT; y++)\n\t{\n\t\tfor(var x = 0; x < BOARD_WIDTH; x++)\n\t\t{\n let drawX = x * TILE_WIDTH;\n let drawY = y * TILE_HEIGHT;\n\n //Draw the tiles, but not the ones off the screen\n if(drawX + TILE_WIDTH > -camera.xOffset && drawX < -camera.xOffset + width)\n {\n if(drawY + TILE_HEIGHT > -camera.yOffset && drawY < -camera.yOffset + height)\n {\n tiles[x][y].draw(ctx, camera);\n }\n }\n\t\t}\n\t}\n}", "draw() {\n var c2 = document.getElementById(this.canvasId);\n\n if (c2 instanceof HTMLCanvasElement) {\n var ctx2 = c2.getContext('2d');\n }\n else {\n throw 'c2 is not a canvas';\n }\n\n var c1 = document.createElement('canvas');\n\n if (c1 instanceof HTMLCanvasElement) {\n c1.width = this.size;\n c1.height = this.size;\n var ctx1 = c1.getContext('2d');\n\n if (ctx1 === null || ctx1 === undefined) {\n throw 'ctx1 is null';\n }\n\n var pixelData1 = new Array(this.size * this.size);\n\n var imgData = ctx1.createImageData(this.size, this.size);\n for (var i = 0; i < this.size; i++) {\n for (var j = 0; j < this.size; j++) {\n var k = j * this.size;\n\n var position = this.positions[i + k];\n var pixelData = position.getPixelData();\n pixelData1[i + k] = {};\n\n // Get pixel data for each pass\n // foreach pass\n // px = pass.getPixelData(position, pixelData, i + k);\n $(this.passes).each(function(i : number, pass : WP.WorldPass) {\n pass.getPixelData(position);\n pixelData1[i + k].r = pixelData.r;\n pixelData1[i + k].g = pixelData.g;\n pixelData1[i + k].b = pixelData.b;\n });\n\n }\n }\n console.log(pixelData);\n\n for (var i = 0; i < imgData.data.length; i+= 4) {\n var j = i/4;\n\n var r = pixelData1[j].r;\n if (r != null) {\n imgData.data[i] = r;\n }\n var g = pixelData1[j].g;\n if (g != null) {\n imgData.data[i+1] = g;\n }\n var b = pixelData1[j].b;\n if (b != null) {\n imgData.data[i+2] = b;\n }\n\n imgData.data[i+3] = 255;\n\n }\n ctx1.putImageData(imgData, 0, 0);\n\n //ctx2.mozImageSmoothingEnabled = false;\n //ctx2.webkitImageSmoothingEnabled = false;\n //ctx2.msImageSmoothingEnabled = false;\n //ctx2.imageSmoothingEnabled = false;\n if (ctx2 instanceof CanvasRenderingContext2D) {\n ctx2.drawImage(c1, 0, 0, this.size * 2, this.size * 2);\n }\n else {\n throw 'ctx2 is not a canvas rendering context';\n }\n\n }\n\n }", "function drawTileGrid(gameContainer, normalTexture, floodedTexture) {\r\n\tfor (var i = 0; i < 6; i++) {\r\n\t\tfor (var j = 0; j < 6; j++) {\r\n\t\t\tvar tile = new Tile(normalTexture, floodedTexture, i, j, 'tile_' + i + '_' + j);\r\n\t\t\t// Skip tile positions on first row that need to be blank\r\n\t\t\tif ((i == 0 && j == 0) || (i == 0 && j == 1) || (i == 0 && j == 4) || (i == 0 && j == 5)) {\r\n\t\t\t\ttile.alpha=0;\r\n tile.state = \"sunk\";\r\n tile.buttonMode = false;\r\n tile.interactive = false;\r\n\t\t\t}\r\n\t\t\t// Skip tile positions on second row that need to be blank\r\n\t\t\tif ((i == 1 && j == 0) || (i == 1 && j == 5)) {\r\n\t\t\t\ttile.alpha=0;\r\n tile.state = \"sunk\";\r\n tile.buttonMode = false;\r\n tile.interactive = false;\r\n\t\t\t}\r\n\t\t\t// Skip tile positions on fifth row that need to be blank\r\n\t\t\tif ((i == 4 && j == 0) || (i == 4 && j == 5)) {\r\n\t\t\t\ttile.alpha=0;\r\n tile.state = \"sunk\";\r\n tile.buttonMode = false;\r\n tile.interactive = false;\r\n\t\t\t}\r\n\t\t\t// Skip tile positions on sixth row that need to be blank\r\n\t\t\tif ((i == 5 && j == 0) || (i == 5 && j == 1) || (i == 5 && j == 4) || (i == 5 && j == 5)) {\r\n\t\t\t\ttile.alpha=0;\r\n tile.state = \"sunk\";\r\n tile.buttonMode = false;\r\n tile.interactive = false;\r\n\t\t\t}\r\n\r\n\t\t\t// Push tile object onto gameboard 2D Array\r\n\t\t\tgameBoard[i][j] = tile;\r\n\t\t\tgameContainer.addChild(tile);\r\n\t\t}\r\n\t}\r\n}", "function generateMap()\r\n{\r\n\tif(ctx==null)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\tfor(var y = 0; y < mapH; y++)\r\n\t{\r\n\t\tfor(var x = 0; x < mapW; x++)\r\n\t\t{\r\n\t\t\tfor(var i = 0; i < gameTiles.length;i++)\r\n\t\t\t{\r\n\t\t\t\tswitch(gameTiles[((y*mapW)+x)].type)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase 0:\r\n\t\t\t\t\t\tctx.fillStyle=\"green\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\tctx.fillStyle=\"purple\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\tctx.fillStyle=\"blue\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\tctx.fillStyle=\"red\";\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tctx.fillStyle=\"black\";\r\n\t\t\t\t}\r\n\t\t\t\tctx.fillRect(x*tileW, y*tileH, tileW, tileH);\r\n\t\t\t}\t\r\n\t\t}\r\n\t}\r\n\trequestAnimationFrame(generateMap);\r\n}", "getPixelCoordsFromTileIndex(i) {\n return {\n x: (i % this.width.tiles) * this.tileSize,\n y: Math.floor(i / this.width.tiles) * this.tileSize\n };\n }", "function render(coordMap, renderShips=true, opaque=false) {\n for (let state of Object.keys(coordMap)) {\n let opacity = (opaque) ? \"opaque \" : \"\";\n for (let cellId of coordMap[state]) {\n let div = document.getElementById(cellId);\n\n if (state == EMPTY) {\n div.className = opacity;\n } else if (state == HIT) {\n div.className = opacity + \"hit\";\n } else if (state == MISS) {\n div.className = opacity + \"miss\";\n } else if (renderShips) {\n div.className = opacity + \"ship\";\n } else {\n div.className = opacity;\n }\n }\n }\n}", "function draw() {\n for (let i=0; i<tiles.length; i++) {\n tiles[i].display();\n }\n}", "function prerender() {\n if (tileEngine.layers) {\n tileEngine.layers.forEach(layer => {\n layerMap[layer.name] = layer;\n\n if (layer.visible !== false) {\n tileEngine._r(layer, offscreenContext);\n }\n });\n }\n }", "function manipulateImage() {\n // 1.\n sourceImage.resize(200, 0); // 2.\n\n var srcImgW = sourceImage.width;\n var srcImgH = sourceImage.height; // 3.\n\n var ratio = srcImgH / srcImgW; // 4. Get width of the rasterized image from UI\n\n var mImgW = parseInt(State.width); // Calculate the height of it with the ratio\n\n var mImgH = parseInt(State.width * ratio);\n var scaling = mImgW / srcImgW; // Calculate the number of gridcolumns\n\n var gridItemW = mImgW / State.gridCols; // Calculate the number of gridrows\n\n var gridRows = State.gridCols * ratio; // Create PGraphics\n\n manipulatedImage = createGraphics(mImgW, mImgH); // Fill and stroke\n\n manipulatedImage.noStroke();\n manipulatedImage.fill(State.Colors.image); // BUG!\n // The loop draws only a grid of 60 tiles instead of 180\n\n var counter = 0; // Get the brightness-min- and max-values for contrast optimization\n\n var briMin = 0,\n briMax = 255;\n\n for (var x = 0; x < mImgW; x += gridItemW) {\n for (var y = 0; y < mImgH; y += gridItemW) {\n // get the right pixel\n var thisPixel = sourceImage.get(parseInt(x / scaling), parseInt(y / scaling));\n var brightn = brightness(thisPixel);\n }\n } // DRAW IT!!!\n\n\n for (var x = 0; x < mImgW; x += gridItemW) {\n counter++;\n\n for (var y = 0; y < mImgH; y += gridItemW) {\n // get the right pixel\n var thisPixel = sourceImage.get(parseInt(x / scaling), parseInt(y / scaling));\n var brightn = brightness(thisPixel); // calculate the size of the rectangle\n\n var size = map(brightn, 100, 0, 0, State.maxSize);\n manipulatedImage.push();\n manipulatedImage.translate(x, y);\n manipulatedImage.rect(0, 0, size, size);\n manipulatedImage.pop();\n }\n }\n\n busy = false;\n} // Get a new source image", "createTilesetsAndWaterTextures() {\n let tilesets = this.tilesetTextures;\n let tilesetsCount = tilesets.length;\n let canvas = document.createElement('canvas');\n let ctx = canvas.getContext('2d');\n\n canvas.width = 2048;\n canvas.height = 64 * (tilesetsCount + 1); // 1 is added for a black tileset, to remove branches from the fragment shader, at the cost of 512Kb.\n\n for (let tileset = 0; tileset < tilesetsCount; tileset++) {\n let imageData = tilesets[tileset].imageData;\n if (!imageData) {\n continue;\n }\n\n for (let variation = 0; variation < 16; variation++) {\n let x = (variation % 4) * 64;\n let y = ((variation / 4) | 0) * 64;\n\n ctx.putImageData(imageData, variation * 64 - x, (tileset + 1) * 64 - y, x, y, 64, 64);\n }\n\n if (imageData.width === 512) {\n for (let variation = 0; variation < 16; variation++) {\n let x = 256 + (variation % 4) * 64;\n let y = ((variation / 4) | 0) * 64;\n\n ctx.putImageData(imageData, 1024 + variation * 64 - x, (tileset + 1) * 64 - y, x, y, 64, 64);\n }\n }\n }\n\n let gl = this.gl;\n let texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n\n this.tilesetsTexture = texture;\n\n canvas.height = 128 * 3; // up to 48 frames.\n\n let waterTextures = this.waterTextures;\n\n for (let i = 0, l = waterTextures.length; i < l; i++) {\n let x = i % 16;\n let y = (i / 16) | 0;\n\n ctx.putImageData(waterTextures[i].imageData, x * 128, y * 128);\n }\n\n let waterTexture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, waterTexture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n\n this.waterTexture = waterTexture;\n }", "function draw(_) {\n const { viewBox, mouse, booleans, worldMap, units, selectedTerrainType, selectedBuildingType, selectedBackgroundImageSource, selectedUnitType, selectedFactionId, selectedPosition } = store.getState()\n const { width, height } = _.canvas\n const { offsetX, offsetY } = viewBox\n\n _.fillStyle = 'black'\n _.fillRect(0, 0, width, height)\n\n // No data displays only a black screen\n if (!worldMap) return\n\n const tileSize = width / viewBox.width // pixel per tile\n const viewBoxHeight = Math.ceil(height / tileSize) // tiles\n const mouseTile = worldMap[mouse.y] && worldMap[mouse.y][mouse.x]\n\n _.lineWidth = 1\n\n loadImages(imagesSources).then(images => {\n\n /* ----------------\n DRAW BACKGROUND\n ---------------- */\n\n for (let j = 0; j < viewBoxHeight + 1; j++) { // + 1 for move draw\n const y = Math.floor(j + viewBox.y)\n\n for (let i = 0; i < viewBox.width + 1; i++) {\n const x = Math.floor(i + viewBox.x)\n const tile = worldMap[y] && worldMap[y][x]\n\n if (!tile) continue\n\n _.drawImage(\n images[tile.backgroundImageSource],\n (i - (viewBox.x % 1)) * tileSize + offsetX,\n (j - (viewBox.y % 1)) * tileSize + offsetY,\n tileSize,\n tileSize\n )\n }\n }\n\n /* ---------------\n DRAW SELECTION\n --------------- */\n\n if (selectedBuildingType && mouseTile) {\n drawBuilding(_, images, tileSize, {\n type: selectedBuildingType,\n factionId: selectedFactionId,\n position: mouse,\n })\n }\n\n if (selectedTerrainType && selectedBackgroundImageSource && mouseTile) {\n _.drawImage(\n images[selectedBackgroundImageSource],\n (mouse.x - viewBox.x) * tileSize + offsetX,\n (mouse.y - viewBox.y) * tileSize + offsetY,\n tileSize,\n tileSize\n )\n }\n\n /* -----------\n DRAW UNITS\n ----------- */\n\n units.forEach(unit => drawUnit(_, tileSize, images, unit))\n\n if (selectedUnitType && mouseTile) {\n drawUnit(_, tileSize, images, {\n id: '0',\n type: selectedUnitType,\n factionId: selectedFactionId,\n position: mouse,\n })\n }\n\n /* ---------------------------\n DRAW TILE SELECTION SQUARE\n --------------------------- */\n\n const position = selectedPosition || mouse\n\n if (worldMap[position.y] && worldMap[position.y][position.x]) {\n const x = (position.x - viewBox.x) * tileSize + offsetX\n const y = (position.y - viewBox.y) * tileSize + offsetY\n\n _.lineWidth = 2\n _.strokeStyle = 'red'\n\n _.beginPath()\n _.rect(x, y, tileSize, tileSize)\n _.closePath()\n _.stroke()\n\n if (booleans.isDeletingUnits) {\n _.beginPath()\n _.moveTo(x, y)\n _.lineTo(x + tileSize, y + tileSize)\n _.moveTo(x + tileSize, y)\n _.lineTo(x, y + tileSize)\n _.closePath()\n _.stroke()\n }\n\n if (booleans.isFlippingUnits) {\n _.beginPath()\n _.moveTo(x + 0.3 * tileSize, y + 0.4 * tileSize)\n _.lineTo(x + 0.2 * tileSize, y + 0.5 * tileSize)\n _.lineTo(x + 0.3 * tileSize, y + 0.6 * tileSize)\n _.moveTo(x + 0.2 * tileSize, y + 0.5 * tileSize)\n _.lineTo(x + 0.8 * tileSize, y + 0.5 * tileSize)\n _.lineTo(x + 0.7 * tileSize, y + 0.4 * tileSize)\n _.moveTo(x + 0.8 * tileSize, y + 0.5 * tileSize)\n _.lineTo(x + 0.7 * tileSize, y + 0.6 * tileSize)\n _.closePath()\n _.stroke()\n }\n }\n })\n}", "updateMap() {\n const shape = this.shape,\n data = this.shape.shape,\n map = this.map,\n pos = map.getTileIndexFromPixel(shape.x, shape.y),\n buffer = shape.getMatrix(),\n rows = data.height / map.tileHeight,\n cols = data.width / map.tileWidth;\n\n for (let j = 0; j < rows; ++j) {\n for (let i = 0; i < cols; ++i) {\n if (buffer[j * cols + i]) {\n map.updateTile(pos.x + i, pos.y + j, data.color, Tile.TYPE.WALL);\n }\n }\n }\n }", "function makeTile(size, tiles, maxHeight=tiles/2, centerX=0, centerZ=0) {\r\n\t\tlet geom = new THREE.Geometry();\r\n\t\tlet x,y,z, position, addFace;\r\n\t\tlet max = size * tiles;\r\n\t\tfor(let i=0; i<=tiles; i++) {\r\n\t\t\tfor(let j=0; j<=tiles; j++) {\r\n\t\t\t\tx = i * size;\r\n\t\t\t\tz = j * size;\r\n\t\t\t\t// y = 0;\r\n\t\t\t\t// y = noise.perlin2(x, z)*size;\r\n\t\t\t\ty = noise.perlin2((x/max)*7, (z/max)*7)*maxHeight;\r\n\t\t\t\t// y = noise.perlin2((x/max)*7, (z/max)*7)*size;\r\n\t\t\t\t// y = noise.simplex2(x, z)*size;\r\n\t\t\t\tposition = new THREE.Vector3(x,y,z);\r\n\t\t\t\taddFace = (i>0) && (j>0);\r\n\t\t\t\tmakeQuad(geom, position, addFace, tiles+1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// geom.computeVertexNormals();\r\n\t\tgeom.computeFaceNormals();\r\n\t\tgeom.normalsNeedUpdate = true;\r\n\r\n\t\tlet half = max/2;\r\n\t\tgeom.translate(centerX-half,0,centerZ-half);\r\n\t\treturn geom;\r\n\t}", "function drawCanvas() {\n\n let context = document.getElementById('canvas').getContext('2d');\n\n context.globalCompositeOperation = 'source-over';\n\n context.clearRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT); // Clear the canvas\n\n for (let tile of tiles) { // Loop through all the tiles\n\n let loaded = false;\n for (let image of images) { // Draw them if their image has loaded\n if (image.src.endsWith(tile.path)) {\n context.save();\n context.translate(tile.x * TILE_SIZE, tile.y * TILE_SIZE);\n context.drawImage(image, 0, 0);\n context.restore();\n loaded = true;\n break;\n }\n }\n\n if (!loaded) { // Draw a loading image if the tile's image hasn't loaded yet\n context.save();\n context.translate(tile.x * TILE_SIZE + (TILE_SIZE - 100) / 2, tile.y * TILE_SIZE + (TILE_SIZE - 100) / 2);\n context.drawImage(loading, 0, 0);\n context.restore();\n }\n\n }\n\n}", "function DrawElements(canvas,x,y,counterY,counterX,img,color){\n var LENGTH_OF_ONE_TILE = 50;\n var HEIGH_OF_ONE_TILE = 50;\n var coordinateX = (x-1)*LENGTH_OF_ONE_TILE;\n var coordinateY = (y-1)*LENGTH_OF_ONE_TILE;\n canvas.fillStyle = color;\n canvas.fillRect(coordinateX,coordinateY,LENGTH_OF_ONE_TILE,HEIGH_OF_ONE_TILE);\n canvas.fillRect(coordinateX-counterX,coordinateY-counterY,LENGTH_OF_ONE_TILE,HEIGH_OF_ONE_TILE);\n canvas.drawImage(img,coordinateX-counterX,coordinateY-counterY,LENGTH_OF_ONE_TILE,HEIGH_OF_ONE_TILE);\n}", "function chunkGen() {\n \n //ctx.clearRect(0,0,canvas.width,canvas.height);\n noise.forEach(col => {\n for (let x = 0; x <= noise.length*64; x+=64) {\n col.forEach(el => {\n for (let y = 0; y < col.length*64; y+=64) {\n if (el === 1){\n drawWorld(tileSpr[0], 0, 0, 64, 64, 0+x, 0+y, 64, 64);\n } else if (el === 0) {\n drawWorld(tileSpr[1], 0, 0, 64, 64, 0+x, 0+y, 64, 64);\n }\n }\n });\n }\n });\n}", "blitFrom(c){\n this.context.clearRect(0,0,this.canvas.width,this.canvas.height);\n if (this.opt.tall){\n this.context.drawImage(c.canvas, 0, 0, c.canvas.width/2, c.canvas.height, 0, 0, this.canvas.width, this.canvas.height/2);\n this.context.drawImage(c.canvas, c.canvas.width/2, 0, c.canvas.width/2, c.canvas.height, 0, this.canvas.height/2, this.canvas.width, this.canvas.height/2);\n } else {\n this.context.drawImage(c.canvas, 0, 0, c.canvas.width, c.canvas.height, 0, 0, c.canvas.width/(c.zoom/this.zoom), c.canvas.height/(c.zoom/this.zoom))\n }\n if (this.opt.grid){\n for (let x = 0; x < this.canvas.width/this.zoom; ++x){\n if (x % 16 == 15 && x != this.tWidth-1){\n this.context.fillStyle = \"#AA0000\";\n }else{\n this.context.fillStyle = \"#AAAAAA\";\n }\n this.context.fillRect((x+1)*this.zoom-((x%8==7)?2:1),0,(x%8==7)?2:1,this.canvas.height);\n }\n for (let y = 0; y < this.canvas.height/this.zoom; ++y){\n if (y % 16 == 15 && y != this.tWidth-1){\n this.context.fillStyle = \"#BB0000\";\n }else{\n this.context.fillStyle = \"#AAAAAA\";\n }\n this.context.fillRect(0,(y+1)*this.zoom-((y%8==7)?2:1),this.canvas.width,(y%8==7)?2:1);\n }\n }\n this.drawCallback();\n }", "display() {\r\n for (let i = 0; i < DIMENSIONS; i++) {\r\n for (let j = 0; j < DIMENSIONS; j++) {\r\n fill(TILE_COLOUR);\r\n rect(SCALE*i, SCALE*j, SCALE, SCALE);\r\n if (this.grid[i][j] > 0) {\r\n fill(TEXT_COLOUR);\r\n text(this.grid[i][j], SCALE*(i + 1/2), SCALE*(j + 1/2));\r\n }\r\n }\r\n }\r\n }", "function render() {\n var rowImages = [\n 'images/water-block.png', // Top row is water\n 'images/stone-block.png', // Row 1 of 3 of stone\n 'images/stone-block.png', // Row 2 of 3 of stone\n 'images/stone-block.png', // Row 3 of 3 of stone\n 'images/stone-block.png', // Row 3 of 3 of stone\n 'images/grass-block.png', // Row 1 of 2 of grass\n 'images/grass-block.png', // Row 2 of 2 of grass\n ],\n numRows = 6,\n numCols = 5,\n row, col;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height)\n\n for (row = 0; row < numRows; row++) {\n for (col = 0; col < numCols; col++) {\n //Using Resources helpers for caching\n ctx.drawImage(Resources.get(rowImages[row]), col * 101, row * 83);\n }\n }\n\n renderEntities();\n }", "map(x, y, w, h, sx, sy) {\n let mapArray = this.mapData[0].layers[0].data;\n let tileSize = this.mapData[0].tileHeight;\n let numberVerticalTiles = this.mapData[0].layers[0].height;\n let numberHorizontalTiles = this.mapData[0].layers[0].width;\n let width = w || numberHorizontalTiles;\n let height = h || numberVerticalTiles;\n this.mapAdjustments.x = x || 0;\n this.mapAdjustments.y = y || 0;\n let x1 = sx || 0;\n let y1 = sy || 0;\n // evaluate runtime errors\n if (this.mapAdjustments.x < 0 || this.mapAdjustments.y < 0) {\n throw new RangeError(\"map(): Starting tile cannot be negative!. \");\n }\n for (let y0 = this.mapAdjustments.y; y0 < height; y0++) {\n for (let x0 = this.mapAdjustments.x; x0 < width; x0++) {\n this.spr(mapArray[y0][x0], x1 + (x0 - this.mapAdjustments.x) * tileSize, y1 + (y0 - this.mapAdjustments.y) * tileSize);\n }\n }\n }", "function Tile(tile_vector, pos_vector)\n{\n\n //tile_vector : holds index of the tile in the image tile-0-1.png - 0th row, 1st column\n this.tile_vector = tile_vector;\n\n //pos_vector : holds cordinates on the canvas where the tile will be placed\n this.pos_vector = pos_vector;\n\n //True if the tile already has image loaded\n this.iscached = false;\n\n //The image that the tile shows\n this.image;\n\n this.key = \"tile_\"+tile_vector.x+''+tile_vector.y;\n \n this.load_image = function()\n {\n\n var ctx = context.getInstance();\n console.log(\"this.iscached :: \"+this.iscached);\n var base_image;\n if(!this.iscached)\n {\n base_image = new Image();\n base_image.src = './tiles_again/tiled_'+tile_vector.x+'_'+tile_vector.y+'.png';\n base_image.onload = function() {\n ctx.drawImage(base_image,pos_vector.x ,pos_vector.y);\n \n };\n\n }\n //ctx.drawImage(base_image,pos_vector.x ,pos_vector.y);\n\n \n }\n\n}", "function setup() {\r\n createCanvas(tilesX * res, tilesY * res);\r\n background(10);\r\n for (let i = 0; i < tilesX; i++) {\r\n tiles[i] = [];\r\n for (let j = 0; j < tilesY; j++) {\r\n tiles[i][j] = new Tile(res * i, res * j);\r\n }\r\n }\r\n}", "function drawTile(ctx, img, posX, posY, width, height) {\n\tctx.drawImage(img, posX, posY, width, height);\n}", "drawTile ( x, y, value ) {\n this.context.clearRect(\n x * this.world.cellSize,\n y * this.world.cellSize,\n this.world.cellSize,\n this.world.cellSize\n );\n this.context.drawImage(\n this.tiles,\n this.world.cellSize * value,\n 0,\n this.world.cellSize,\n this.world.cellSize,\n (x * this.world.cellSize),\n (y * this.world.cellSize),\n this.world.cellSize,\n this.world.cellSize\n );\n }", "constructor(map, tileset){\n var cnvs = document.createElement(\"canvas\");\n cnvs.width = map[0].length * tileset.tileW;\n cnvs.height = map.length * tileset.tileH;\n this.canvas = cnvs;\n var ctx = this.canvas.getContext(\"2d\");\n ctx.imageSmoothingEnabled = false;\n this.ctx = ctx;\n this.buildImage(map, tileset);\n }", "draw(ctx, width, height, tilesize) {\n // Draw rooms\n this.bspMap.rooms.forEach((c, i) => {\n ctx.beginPath();\n ctx.fillStyle = \"#000\";\n\n const image = new Image();\n image.src = \"images/FloorTile001.png\";\n var m_canvas = document.getElementById(\"bg-canvas\");\n var m_context = m_canvas.getContext(\"2d\");\n image.addEventListener(\"load\", () => {\n m_context.drawImage(image, c.x * tilesize, c.y * tilesize);\n });\n ctx.fillRect(c.x * tilesize, c.y * tilesize, c.width * tilesize, c.height * tilesize);\n });\n\n // Draw halls\n this.bspMap.halls.forEach((c, i) => {\n c.forEach((h) => {\n ctx.beginPath();\n ctx.fillStyle = \"#000\";\n ctx.fillRect(h.x * 16, h.y * 16, h.width * 16, h.height * 16);\n });\n });\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n ctx.fillStyle = \"rgba(166, 5, 104, 0.1)\";\n if (this.bspMap.rooms.some((room) => room.x !== x) && this.bspMap.rooms.some((room) => room.y !== y)) {\n ctx.fillRect(x * 16, y * 16, 16, 16);\n\n const image = new Image();\n image.src = \"images/BrickWall_003.png\";\n var m_canvas = document.getElementById(\"wall-canvas\");\n var m_context = m_canvas.getContext(\"2d\");\n image.addEventListener(\"load\", () => {\n m_context.drawImage(image, x * tilesize, y * tilesize);\n });\n }\n }\n }\n }", "render() {\n let start = 0, end = this.props.width, rows = [];\n while (end <= (this.props.width * this.props.height)) {\n rows.push(this.props.tiles.slice(start, end));\n start += this.props.width;\n end += this.props.width;\n }\n return (\n <div>\n {rows.map((cols, y) => {\n return this.renderRow(y, cols);\n })}\n </div>\n );\n }", "function Tile( element ){\n\n// Tile element\nvar tile = element;\n\n// Global settings\n\n// Declare css for when the tile is in its idle state.\n var idleCss = \"perspective( 800px ) rotateX( 0deg ) rotateY( 0deg ) translateZ( 0px )\";\n\n\nvar initialize = function() {\n\n// Set transform origin to the center of the element.\ntile.style.webkitTransformOrigin = \"0% 50%\";\ntile.style.MozTransformOrigin = \"0% 50%\";\ntile.style.msTransformOrigin = \"0% 50%\";\ntile.style.oTransformOrigin = \"0% 50%\";\ntile.style.transformOrigin = \"0% 50%\";\n\n// Make sure the parent preserves the 3d perspective\ntile.parentElement.style.webkitTransformStyle = \"preserve-3d\";\ntile.parentElement.style.MozTransformStyle = \"preserve-3d\";\ntile.parentElement.style.msTransformStyle = \"preserve-3d\";\ntile.parentElement.style.oTransformStyle = \"preserve-3d\";\ntile.parentElement.style.transformStyle = \"preserve-3d\";\n\n// Set element transform times\ntile.style.webkitTransition = \"-webkit-transform 0.08s\";\ntile.style.MozTransition = \"-moz-transform 0.08s\";\ntile.style.msTransition = \"-ms-transform 0.08s\";\ntile.style.oTransition = \"-o-transform 0.08s\";\ntile.style.transition = \"transform 0.08s\";\n\n// This gives an antialiased effect for transforms in firefox.\ntile.style.outline = \"1px solid transparent\";\n\n// Font smoothing for webkit.\ntile.style.webkitFontSmoothing = \"antialiased\";\n\n// Listen to mouse events for the tile.\ntile.addEventListener('mousedown', MouseDown, false);\n\n}\n\n\nvar pushTile = function( x, y ){\n\n// Get the elements width and height.\nvar width = tile.offsetWidth;\nvar height = tile.offsetHeight;\n\nvar translateString = \"perspective( 800px ) \";\n\n\n/* Tilt based on position clicked\n*\n* Not quite sure how msft do this, but here's my logic:\n*\n* If the click is closer to the left, right, top or bottom:\n* Then tilt in that direction\n*\n* Unless the click is in the middle quater of the tile:\n* In which case, push the tile down.\n*\n*/\n\n// If the click is in the center quater of the element, push down.\nif ( x > width/4 && x < (width/4 * 3) && y > height/4 && y < (height/4 * 3) ) {\ntile.style.webkitTransformOrigin = \"50% 50%\";\ntile.style.MozTransformOrigin = \"50% 50%\";\ntile.style.msTransformOrigin = \"50% 50%\";\ntile.style.oTransformOrigin = \"50% 50%\";\ntile.style.transformOrigin = \"50% 50%\";\nvar trans = 40 / (width/150);\ntranslateString += \"rotateX( 0deg ) rotateY( 0deg ) translateZ(\" + -trans +\"px )\";\n}\n\n// is the user closer to the right/left hand side?\nelse if ( Math.min( x, width - x) < Math.min( y, height - y) ) {\nvar deg = 10 / (width/150) ;\n// Tilt on the left side\nif ( x < width - x ) {\n\ntile.style.webkitTransformOrigin = \"100% 50%\";\ntile.style.MozTransformOrigin = \"100% 50%\";\ntile.style.msTransformOrigin = \"100% 50%\";\ntile.style.oTransformOrigin = \"100% 50%\";\ntile.style.transformOrigin = \"100% 50%\";\ntranslateString += \"rotateX( 0deg ) rotateY( \"+ -deg + \"deg ) translateZ( -0px )\";\n\n// Tilt on the right side\n} else {\n\ntile.style.webkitTransformOrigin = \"0% 50%\";\ntile.style.MozTransformOrigin = \"0% 50%\";\ntile.style.msTransformOrigin = \"0% 50%\";\ntile.style.oTransformOrigin = \"0% 50%\";\ntile.style.transformOrigin = \"0% 50%\";\ntranslateString += \"rotateX( 0deg ) rotateY( \"+ deg + \"deg ) translateZ( -0px )\";\n}\n\n// the user is closer to the top/bottom side (also the default)\n} else {\nvar incline = 10 / (height/150);\n// Tilt on the top\nif ( y < height - y ) {\n\ntile.style.webkitTransformOrigin = \"50% 100%\";\ntile.style.MozTransformOrigin = \"50% 100%\";\ntile.style.msTransformOrigin = \"50% 100%\";\ntile.style.oTransformOrigin = \"50% 100%\";\ntile.style.transformOrigin = \"50% 100%\";\ntranslateString += \"rotateX( \"+incline+\"deg ) rotateY( 0deg ) translateZ( -0px )\";\n\n// Tilt on the bottom\n} else {\n\ntile.style.webkitTransformOrigin = \"50% 0%\";\ntile.style.MozTransformOrigin = \"50% 0%\";\ntile.style.msTransformOrigin = \"50% 0%\";\ntile.style.oTransformOrigin = \"50% 0%\";\ntile.style.transformOrigin = \"50% 0%\";\ntranslateString += \"rotateX( \"+ -incline +\"deg ) rotateY( 0deg ) translateZ( -0px )\";\n}\n}\n\n// Apply transformation to tile.\ntile.style.webkitTransform = translateString;\ntile.style.MozTransform = translateString;\ntile.style.msTransform = translateString;\ntile.style.oTransform = translateString;\ntile.style.transform = translateString;\n\ndocument.addEventListener('mouseup', MouseUp, false);\n\n};\n\nvar MouseDown = function( event ){\n\n// Chrome\nif ( event.offsetX ) {\npushTile( event.offsetX, event.offsetY );\nreturn;\n}\n\n// Non offsetX browsers\nvar tilePosition = elementPosition( tile );\nvar x = event.pageX - tilePosition.x;\nvar y = event.pageY - tilePosition.y;\n\npushTile( x, y );\n\n};\n\n\nvar MouseUp = function( event ){\n\n// Set the element to its idle state\ntile.style.webkitTransform = idleCss;\ntile.style.MozTransform = idleCss;\ntile.style.msTransform = idleCss;\ntile.style.oTransform = idleCss;\ntile.style.transform = idleCss;\n\ndocument.removeEventListener('mouseup', MouseUp, false);\n};\n\n// Element position finding for non webkit browsers.\n// How will this perform on mobile?\nvar getNumericStyleProperty = function(style, prop){\n return parseInt(style.getPropertyValue(prop),10) ;\n}\n\nvar elementPosition = function( e ){\nvar x = 0, y = 0;\nvar inner = true ;\ndo {\nx += e.offsetLeft;\ny += e.offsetTop;\nvar style = getComputedStyle(e,null) ;\nvar borderTop = getNumericStyleProperty(style,\"border-top-width\") ;\nvar borderLeft = getNumericStyleProperty(style,\"border-left-width\") ;\ny += borderTop ;\nx += borderLeft ;\nif (inner){\nvar paddingTop = getNumericStyleProperty(style,\"padding-top\") ;\nvar paddingLeft = getNumericStyleProperty(style,\"padding-left\") ;\ny += paddingTop ;\nx += paddingLeft ;\n}\ninner = false ;\n} while (e = e.offsetParent);\nreturn { x: x, y: y };\n}\n\n// Initialize the tile.\ninitialize();\n}", "function gen1(){\n\t// First tile\n\taddtile(0, 0, le, -le/2, -1.5388*le, 0);\n\t\n\t// Generating tiles around points\n\tfor(var i=0; i<iter; i++){\n\t\tif( isvisiblepoint(i,w,h) ){\n\t\t\tfor(var j=0; j<retries; j++){ fillpoint(i, le); }\n\t\t\t//if(masksum(i)<10){ destroypoint(i); } // optional destroying point if it can't be filled\n\t\t}\n\t}\n\t// Rendering SVG\n\tvar svgstr = createSVGString(w,h,stylepresets[stylepr],drawp);\n\t\n\t// Appending SVG string\n\tappendSVGString(svgstr,'mainbody');\n\t\n\t// Stats\n\tconsole.log('Number of tiles: '+tiles.length+' Number of points: '+points.length+' SVG string length: '+svgstr.length+' Avg. points/tiles: '+points.length/tiles.length+' Tiles/iter: '+tiles.length/iter);\n\n}// End of gen1()", "drawMinimap(centerX, centerY, scale) {\n const start = 0x00c0 << 4; // byte offset in the background tilesheet, tile xC0, 16 bytes per tile, sort of\n const width = 32 // minimap pixels\n const height = 32 // minimap pixels\n const minimapWidth = mapWidth / scale / (256/192); // world tiles. (192 tiles / scale 2) = 96\n const minimapHeight = mapHeight / scale; // world tiles. (128 tiles / scale 2) = 64\n\n const paletteMap = [0, 1, 1, 1, 2, 3, 1];\n const [offsetX, offsetY] = [(centerX - minimapWidth/2), (centerY - minimapHeight/2)];\n const viewToWorld = (x,y) => [offsetX + (x/width) * minimapWidth, offsetY + (y/height) * minimapHeight];\n\n let data = 0x00;\n for (let y=0; y<height; y++)\n for (let x=0; x<width; x++) {\n const [posx, posy] = viewToWorld(x, y);\n const elev = this.elevation(posx, posy);\n const e = Math.floor(elev);\n\n const color = (e == 2 \n ? (x+y*width)%5 == 0 ? paletteMap[5] : paletteMap[2]\n : paletteMap[e]) & 0xff;\n\n data = (data << 2 | color) & 0xff; \n if (x % 4 === 3) {\n const adr = start + (y*32) + (x >> 2);\n // write to the background tile sheet\n setBackgroundData(adr, data);\n }\n }\n }", "function drawTile0() {\n ctx.clearRect(25, 125, 65, 70);\n ctx.fillStyle = palette[2][0];\n ctx.fillRect(25, 125, 65, 70)\n }", "draw(tilex, tiley) {\n // fill background (16x12 tiles worth)\n for (let y=0; y<12; y++) {\n for (let x=0; x<16; x++) {\n // 0 water\n // 1,2,3 grass\n // 4 sand\n // 5 rock\n const e = this.elevation(x, y);\n if (e === 0) {\n this.drawWaterOrSand(x, y, tilex, tiley, 0); // water\n } else if (e === 4) {\n this.drawWaterOrSand(x, y, tilex, tiley, 1); // sand\n } else if (e === 5) {\n this.drawRock(x, y, tilex, tiley);\n } else if (e === 6) {\n drawTile(x + tilex, y + tiley, 0x68, 1); // tree\n } else {\n this.drawGrass(x+tilex, y+tiley, e);\n }\n\n // TODO: Background tiles for\n // caves\n // dungeons\n // buildings and features\n // trees\n }\n }\n }", "function displayPixelArt(colorDataSet, ratio) {\r\n\r\n let blockBoundaryData = fetchBlockLowerBoundaries();\r\n\r\n w = Math.floor(imageWidth / ratio) * 16;\r\n h = Math.floor(imageHeight / ratio) * 16;\r\n\r\n const canvas = document.getElementById('displayMinecraftBlockConstruction');\r\n const context = canvas.getContext('2d');\r\n canvas.width = w;\r\n canvas.height = h;\r\n\r\n\r\n context.fillStyle = '#ffffff';\r\n context.fillRect(0, 0, w, h);\r\n\r\n //used as an index for the pixels that are to be rendered\r\n for (let i = 0; i < colorDataSet.length; i++) {\r\n\r\n //Used as the index for all of the possible block values\r\n for (let j = 0; j < 125; j++) {\r\n\r\n //Checks whether the block fits in the individual constraints, nested ifs were used such that the conditions can actually all be seen.\r\n if (colorDataSet[i].redValue >= blockBoundaryData.redValue[j] && colorDataSet[i].redValue < blockBoundaryData.redValue[j] + 56 /* && colorDataSet.blockValue !== \"\"*/) {\r\n\r\n if (colorDataSet[i].greenValue >= blockBoundaryData.greenValue[j] && colorDataSet[i].greenValue < blockBoundaryData.greenValue[j] + 56) {\r\n\r\n if (colorDataSet[i].blueValue >= blockBoundaryData.blueValue[j] && colorDataSet[i].blueValue < blockBoundaryData.blueValue[j] + 56) {\r\n\r\n colorDataSet[i].minecraftBlockAssigned = blockBoundaryData.blockName[j];\r\n\r\n //'fixes' the weird color gap bug, by masking them with the pixel adjacent.\r\n\r\n console.log(\"db: \" + colorDataSet[i].minecraftBlockAssigned);\r\n if (!((colorDataSet[i].minecraftBlockAssigned).length > 0) && i > 0) {\r\n\r\n colorDataSet[i].minecraftBlockAssigned = colorDataSet[i - 1].minecraftBlockAssigned;\r\n\r\n }\r\n\r\n\r\n\r\n console.log(\"bv: \" + colorDataSet[i].minecraftBlockAssigned + \" xIndex \" + colorDataSet[i].xIndex + \" yIndex \" + colorDataSet[i].yIndex);\r\n context.drawImage(blockImages[blockBoundaryData.blockName[j]], 0, 0, 16, 16, (colorDataSet[i].xIndex * 16) - 16, (colorDataSet[i].yIndex * 16) - 16, 16, 16);\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n console.log(colorDataSet[i]);\r\n\r\n }\r\n\r\n}", "function convert() {\n\t//Get the dimension from select\n\tlet select = document.querySelector(\"#dimensions\");\n\tlet dimensions = select.options[select.selectedIndex].value;\n\tconsole.log(\"Dimensions selected:\", dimensions);\n\n\t//Split image width & height by dimension to get tile size\n\tlet tileW = canvasTo.width / dimensions;\n\tlet tileH = canvasTo.height / dimensions;\n\n\tconsole.log(\"Tile Size:\", tileW, tileH);\n\n let start = new Date();\n\t//Iterate over canvasFrom to get pixel data of image for each tile\n\tfor (let h = 0; h < dimensions; h++) {\n\t\tfor (let w = 0; w < dimensions; w++) {\n\t\t\tlet tilePixels = ctxFrom.getImageData(\n\t\t\t\ttileW * w,\n\t\t\t\ttileH * h,\n\t\t\t\ttileW,\n\t\t\t\ttileH\n );\n \n let color = getMeanColorOfPixels(tilePixels.data);\n ctxTo.fillStyle = \"rgba(\"+color.r+\",\"+color.g+\",\"+color.b+\",\"+color.a+\")\";\n ctxTo.fillRect(w*tileW, h*tileH, tileW, tileH);\n\t\t}\n }\n let endColorDraw = new Date();\n\n console.log(\"Start\", start);\n console.log(\"color draw\", (endColorDraw-start)/1000)+\"sec\";\n\n}", "function TileBuffer( tile, bufferVertices, bufferEdges, material, bufferHeights, processUvs, bufferUIDs ){\n\n //might be useful ...\n this.tile = tile;\n\n var vertexCount = 0;\n bufferVertices.forEach( function(pts){ vertexCount += pts.length;});\n\n //vertex pool\n var vertices = new Float32Array( vertexCount * 3 * 2 );\n\n\n //uvs pool\n var uvs;\n processUvs = Boolean( processUvs );\n if( processUvs ) uvs = new Float32Array( vertexCount * 2 * 2 );\n\n //creates a temp buffer for indices (as we don't know yet how many there will be)\n var indicesBuffer = [];\n\n //get all vertices, their associated uvs and performs triangulation + extrusion\n var inc = 0, p, i;\n\n var vertexInc = 0;\n var uvInc = 0;\n bufferVertices.forEach( function( points, k ){\n\n\n //uvs bounds\n if( processUvs ){\n var uvbounds = new THREE.Vector4(0,0,1,1);\n\n //get uv min / max\n var min = new THREE.Vector2( Math.POSITIVE_INFINITY, Math.POSITIVE_INFINITY );\n var max = new THREE.Vector2( Math.NEGATIVE_INFINITY, Math.NEGATIVE_INFINITY );\n }\n\n //create vertx pool\n for ( i = 0; i < points.length * 2; i++ ) {\n\n //stores 2 versions of each point: the ground and the roof\n p = points[ i % points.length ];\n vertices[vertexInc++] = p[0];\n vertices[vertexInc++] = i >= points.length ? bufferHeights[ k ] : 0;//uses the extrusion height\n vertices[vertexInc++] = p[1];\n\n //check uv min / max\n if( processUvs ){\n min.x = Math.min( p[0], min.x );\n min.y = Math.min( p[1], min.y );\n max.x = Math.max( p[0], max.x );\n max.y = Math.max( p[1], max.y );\n }\n }\n\n //map uvs to uvBounds\n if( processUvs ){\n for( i = 0; i < points.length * 2; i++){\n p = points[ i % points.length ];\n uvs[ uvInc++ ] = uvbounds.x + ( ( p[0] - min.x ) / ( max.x - min.x ) ) * uvbounds.z;\n uvs[ uvInc++ ] = uvbounds.y + ( ( p[1] - min.y ) / ( max.y - min.y ) ) * uvbounds.w;\n }\n }\n\n //retrieves edges corresponding to this vertices set\n var edges = bufferEdges[k];\n\n //tesselation: top\n var result = cdt2d( points, edges, {exterior: false} );\n\n var capIndices = new Uint32Array( result.length * 3 );\n var indicesInc = 0;\n for ( i = 0; i < result.length; i++) {\n capIndices[indicesInc++] = result[i][ 0 ] + points.length;\n capIndices[indicesInc++] = result[i][ 1 ] + points.length;\n capIndices[indicesInc++] = result[i][ 2 ] + points.length;\n }\n capIndices.reverse();\n\n //tesselation: sides ( extrusion )\n var sideIndices = new Uint32Array( points.length * 3 * 2 );\n var sides = points.length;\n var step = 0, back, j, i0, i1, i2, i3;\n indicesInc = 0;\n for ( i = 0; i < 2; i++ ){\n\n //create faces\n if ( step > 0 ){\n\n back = step - sides;\n for ( j = 0; j < sides; j++ ){\n\n i0 = back + j;\n i1 = back + ( j + 1 ) % sides;\n i2 = step + j;\n i3 = step + ( j + 1 ) % sides;\n\n sideIndices[indicesInc++] = i1;\n sideIndices[indicesInc++] = i0;\n sideIndices[indicesInc++] = i2;\n\n sideIndices[indicesInc++] = i1;\n sideIndices[indicesInc++] = i2;\n sideIndices[indicesInc++] = i3;\n\n }\n }\n step += sides;\n }\n\n //merging faces indices, then we'll need to concatenate them\n var indices = new Uint32Array( sideIndices.length + capIndices.length );\n indices.set( sideIndices );\n indices.set( capIndices, sideIndices.length );\n\n indicesBuffer.push( indices );\n\n } );\n\n //merges all indices buffers into one\n var indicesCount = 0;\n indicesBuffer.forEach( function( ind ){ indicesCount += ind.length; });\n\n //final indices buffer\n var indices = new Uint32Array( indicesCount );\n var indicesOffset = 0, inc = 0;\n indicesBuffer.forEach( function( ind, i ){\n\n //the indices offset is the length of the previous vertexbuffer * height 'slices' count ( default 2 for linear extrusion )\n if( i > 0 ) indicesOffset += bufferVertices[ ( i - 1 )].length * 2;\n\n //recursively adds all the faces' indices\n for( var j = 0; j < ind.length; j++){\n indices[inc++] = indicesOffset + ind[ j ];\n }\n\n });\n\n //normals\n var a = new THREE.Vector3();\n var b = new THREE.Vector3();\n var c = new THREE.Vector3();\n var ab = new THREE.Vector3();\n var ac = new THREE.Vector3();\n var no = new THREE.Vector3();\n var normals = new Float32Array( indices.length );\n inc = 0;\n for( i = 0; i< indices.length; i+= 3){\n\n a.x = vertices[ indices[i] * 3];\n a.y = vertices[ indices[i] * 3 + 1 ];\n a.z = vertices[ indices[i] * 3 + 2 ];\n\n b.x = vertices[ indices[i + 1 ] * 3];\n b.y = vertices[ indices[i + 1 ] * 3 + 1 ];\n b.z = vertices[ indices[i + 1 ] * 3 + 2 ];\n\n c.x = vertices[ indices[i + 2 ] * 3];\n c.y = vertices[ indices[i + 2 ] * 3 + 1 ];\n c.z = vertices[ indices[i + 2 ] * 3 + 2 ];\n\n ab.x = b.x- a.x;\n ab.y = b.y- a.y;\n ab.z = b.z- a.z;\n\n ac.x = c.x- a.x;\n ac.y = c.y- a.y;\n ac.z = c.z- a.z;\n\n no = ab.cross( ac ).normalize();\n normals[inc++] = no.x;\n normals[inc++] = no.y;\n normals[inc++] = no.z;\n\n }\n\n //build geometry\n var geom = new THREE.BufferGeometry();\n geom.setIndex( new THREE.BufferAttribute( indices, 1 ) );\n geom.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\n geom.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );\n if( processUvs ){\n console.log( \"processUvs\" );\n geom.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\n }\n THREE.Mesh.call( this, geom, material );\n\n }", "function draw(){\n clear();\n numbers();\n //The below if condition checks that walls cannot be drawn without giving a valid source and destination\n if(src_x!=-1 && src_y!=-1 && des_x!=-1 && des_y!=-1){\n canvas.onmousedown=myDown;\n canvas.onmouseup=myUp;\n }\n\n for(c=1;c<tileColCount;c++){\n for(r=1;r<tileRowCount;r++){\n rect(tiles[c][r].x,tiles[c][r].y,tileW,tileH,tiles[c][r].state,r,c);\n }\n }\n \n}", "function render() {\n \n// These are the game board resources\n var rowImages = [\n 'images/water-block.png',\n 'images/stone-block.png',\n 'images/stone-block.png',\n 'images/stone-block.png',\n 'images/grass-block.png',\n 'images/grass-block.png'\n ],\n numRows = 6,\n numCols = 5,\n row, col;\n\n// Draw the resources to the screen according to the row they are assigned.\n for (row = 0; row < numRows; row++) {\n for (col = 0; col < numCols; col++) {\n ctx.drawImage(Resources.get(rowImages[row]), col * 101, row * 83);\n }\n }\n\n renderEntities();\n }", "static TileToWorld(x, y, out = new b2.Vec2()) {\n // Scale based upon the tile size and translate relative to the world\n // center.\n const bottomLeft = new b2.Vec2();\n Fracker.GetBottomLeft(bottomLeft);\n return out.Set((x * FrackerSettings.k_tileWidth) + bottomLeft.x, (y * FrackerSettings.k_tileHeight) + bottomLeft.y);\n }", "function setTL(){\n for(var i=0; i<im_p.length; i++){\n var c = Math.floor(i /rows); var r = i %rows; //current column /rom of tile in canvas\n tl_p[im_p[i].id] = {px:im_p[i].px, py:im_p[i].py, tx:c *tl_size.w, ty:r *tl_size.h, ord:i};\n }\n drawTL(tl_p); //draw tiles in canvas\n }", "function render() {\n // This array holds the relative URL to the image used\n // for that particular row of the game level.\n var rowImages = [\n 'images/water-block.png', // Top row is water\n 'images/stone-block.png', // Row 1 of 3 of stone\n 'images/stone-block.png', // Row 2 of 3 of stone\n 'images/stone-block.png', // Row 3 of 3 of stone\n 'images/grass-block.png', // Row 1 of 2 of grass\n 'images/grass-block.png' // Row 2 of 2 of grass\n ],\n\n numRows = 6,\n numCols = 5,\n row, col;\n\n // Before drawing, clear existing canvas\n ctx.clearRect(0,0,canvas.width,canvas.height);\n\n // Loop through the number of rows and columns defined above\n // and draw the image for that portion of the \"grid\"\n for (row = 0; row < numRows; row++) {\n for (col = 0; col < numCols; col++) {\n ctx.drawImage(Resources.get(rowImages[row]), col * 101, row * 83);\n }\n }\n renderEntities();\n }", "function render() {\n /* This array holds the relative URL to the image used\n * for that particular row of the game level.\n */\n\n /* TODO map drawing to use an array instead of loops so maps can be specified\n like: ['wwwww',\n 'sssss',\n 'ggggg',\n 'ggggg',\n 'ggggg',\n 'ggggg']\n\n where w, s, and g refer to water-block, stone-block, and grass-block.\n\n This will allow new levels/maps to be defined quickly as they will be easy\n to visualise.\n */\n\n var rowImages = [\n 'images/water-block.png', // Top row is water\n 'images/stone-block.png', // Row 1 of 3 of stone\n 'images/stone-block.png', // Row 2 of 3 of stone\n 'images/stone-block.png', // Row 3 of 3 of stone\n 'images/grass-block.png', // Row 1 of 2 of grass\n 'images/grass-block.png' // Row 2 of 2 of grass\n ],\n numRows = 6,\n numCols = 5,\n row, col;\n\n /* Loop through the number of rows and columns we've defined above\n * and, using the rowImages array, draw the correct image for that\n * portion of the \"grid\"\n */\n for (row = 0; row < numRows; row++) {\n for (col = 0; col < numCols; col++) {\n /* The drawImage function of the canvas' context element\n * requires 3 parameters: the image to draw, the x coordinate\n * to start drawing and the y coordinate to start drawing.\n * We're using our Resources helpers to refer to our images\n * so that we get the benefits of caching these images, since\n * we're using them over and over.\n */\n ctx.drawImage(Resources.get(rowImages[row]), col * tile.width, row * tile.height);\n }\n }\n\n renderEntities();\n\n hud.render();\n }", "function draw(ctx) {\r\n\t\t// Each row\r\n\t\tfor (var y=0; y<height; y++) {\r\n\t\t\t// Each column\r\n\t\t\tfor (var x=0; x<width; x++) {\r\n\t\t\t\t// Set the fill style to the color computed using the returned value and the 1.0 color defined above.\r\n\t\t\t\tctx.fillStyle = `rgba(${heatMap[x][y]*COLORS.red}, ${heatMap[x][y]*COLORS.green}, ${heatMap[x][y]*COLORS.blue}, 1)`;\r\n\t\t\t\t// Draw a tile at the current location using the size.\r\n\t\t\t\tctx.fillRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "rasterize () {\n // Important notes:\n // - Transform and round the vertices first\n // - Feel free to use floating point arithmetic (DDA is recommended)\n // - Take care to hand the filled vs. non-filled cases\n // - Don't forget to pass this.color to setPixel or rasterizeLine calls\n // - Be sure to test your code with all the unusual cases:\n // > Degenerate triangles (all the same point, all in a line)\n // > Triangles where sides are perfectly horizontal or vertical\n // (and combinations of vertical and horizontal)\n\n // NOTE: These lines are temporary, remove them once you are done.\n setPixel(this.P1, this.color)\n setPixel(this.P2, this.color)\n setPixel(this.P3, this.color)\n }", "function drawTile2() {\n ctx.clearRect(165, 125, 65, 70);\n ctx.fillStyle = palette[2][2];\n ctx.fillRect(165, 125, 65, 70)\n }", "function genTile() {\n input = document.getElementById(\"2BPP\");\n table = document.getElementById(\"multi-pixels-table\");\n\n var TBPPText = input.value;\n\n if (TBPPText != \"\") {\n // parse input\n TBPPVals = TBPPText.substring(1).split(\", $\");\n var numBytes = Math.floor(TBPPVals.length/2)*2; // make sure even\n if (numBytes > 16) {\n numBytes = 16;\n }\n // update pixels array\n for (var i=0; i<numBytes; i+=2) {\n var leastSig = parseInt(TBPPVals[i], 16);\n var mostSig = parseInt(TBPPVals[i + 1], 16);\n var row = pixels[i/2];\n for (var j=7; j>=0; j--) {\n var pixelVal = (((mostSig>>j)&0x1)<<1) + ((leastSig>>j)&0x1);\n row[7-j] = pixelVal;\n }\n }\n\n // redraw cells\n var dispRow = 1; // row of display table\n var dispCol = 1; // column of display table\n var tile = table.rows[dispRow].cells[dispCol].children[0];\n for (var i=0; i<8; i++) {\n for (var j=0; j<8; j++) {\n var cell = tile.rows[i].cells[j];\n var newCellVal = pixels[i][j];\n setCellColor(cell, newCellVal);\n cell.setAttribute(\"value\", newCellVal);\n }\n }\n\n // redraw mini\n //generateMini();\n }\n}", "_display() {\r\n\t\t\tlet x = this.p.width * 0.5 - this.p.world.origin.x + this.x * this.tileSize;\r\n\t\t\tlet y = this.p.height * 0.5 - this.p.world.origin.y + this.y * this.tileSize;\r\n\r\n\t\t\t// skip drawing for out-of-view bodies, but\r\n\t\t\t// edges can be very long, so they still should be drawn\r\n\t\t\tif (\r\n\t\t\t\tthis.shape != 'chain' &&\r\n\t\t\t\tthis.p.camera.active &&\r\n\t\t\t\t(x + this.w < this.p.camera.bound.min.x ||\r\n\t\t\t\t\tx - this.w > this.p.camera.bound.max.x ||\r\n\t\t\t\t\ty + this.h < this.p.camera.bound.min.y ||\r\n\t\t\t\t\ty - this.h > this.p.camera.bound.max.y)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tx = fixRound(x);\r\n\t\t\tx -= (this.w * this.tileSize) % 2 ? 0.5 : 0;\r\n\t\t\ty = fixRound(y);\r\n\t\t\ty -= (this.h * this.tileSize) % 2 ? 0.5 : 0;\r\n\r\n\t\t\t// x += this.tileSize * 0.015;\r\n\t\t\t// y += this.tileSize * 0.015;\r\n\r\n\t\t\tthis.p.push();\r\n\t\t\tthis.p.imageMode(p5.prototype.CENTER);\r\n\t\t\tthis.p.rectMode(p5.prototype.CENTER);\r\n\t\t\tthis.p.ellipseMode(p5.prototype.CENTER);\r\n\r\n\t\t\tthis.p.translate(x, y);\r\n\t\t\tif (this.rotation) this.p.rotate(this.rotation);\r\n\t\t\tthis.p.scale(this._mirror.x, this._mirror.y);\r\n\r\n\t\t\tthis.p.fill(this.color);\r\n\r\n\t\t\tthis._draw();\r\n\r\n\t\t\tthis.p.pop();\r\n\t\t\tthis.p.p5play.autoDrawSprites = false;\r\n\r\n\t\t\tthis._cameraActiveWhenDrawn = this.p.camera.active;\r\n\t\t}", "function render() {\n var start = Date.now();\n for (var x = 0; x < canvas.width; x++) {\n for (var y = 0; y < canvas.height; y++) {\n renderPoint(x, y);\n }\n }\n context.putImageData(imageBuffer, 0, 0);\n var end = Date.now(); // for logging\n $(\"#log\").html(\"Rendered in: \" + (end - start) + \"ms\");\n console.log(\"Rendered in: \" + (end - start) + \"ms\");\n}" ]
[ "0.7171772", "0.70247406", "0.69938207", "0.69023806", "0.6890839", "0.676174", "0.6754753", "0.6692558", "0.66662043", "0.66611296", "0.6626367", "0.66016304", "0.65700763", "0.65541524", "0.6511475", "0.64953935", "0.6476145", "0.646591", "0.6449381", "0.64069533", "0.64026284", "0.6365885", "0.6351848", "0.63453066", "0.6325029", "0.63118935", "0.63035667", "0.62893903", "0.62787664", "0.6278643", "0.6259992", "0.6233283", "0.6221942", "0.6221396", "0.6188164", "0.6183583", "0.6173025", "0.6168674", "0.6164725", "0.6158841", "0.61536837", "0.6143842", "0.61384535", "0.6136441", "0.6133141", "0.61253595", "0.6123918", "0.6117475", "0.61113197", "0.60967076", "0.6080769", "0.6053544", "0.60457975", "0.6024029", "0.60178536", "0.60165685", "0.60135984", "0.601291", "0.60071325", "0.6002337", "0.6000974", "0.59912753", "0.59911776", "0.5987889", "0.59698254", "0.5953582", "0.5943483", "0.5941426", "0.5930091", "0.59299517", "0.5925163", "0.59113836", "0.59025574", "0.5899307", "0.5885429", "0.5881029", "0.58782536", "0.5878195", "0.58656543", "0.5864172", "0.5862638", "0.58621424", "0.58607066", "0.5852514", "0.58524626", "0.5850727", "0.584567", "0.58433354", "0.5841703", "0.5836325", "0.58359474", "0.58348364", "0.58266217", "0.58190906", "0.5817205", "0.58166957", "0.580198", "0.5801224", "0.5799109", "0.5794305" ]
0.61062956
49
funcion que contiene el contador
function stopTimer(){ chronometre.innerHTML = count++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciar() {\n \n }", "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function mostrar() {}", "function mostrar() {}", "procesarControles(){\n\n }", "function Go_Funciones()\n {\n if( g_listar == 1 )\n {\n Get_Marca_Producto();\n }\n \n }", "function carterasFunction(){\n console.log(\"SeleccionaCliente\");\n SeleccionaCliente();\n console.log(\"getipoCartera\");\n getipoCartera();\n console.log(\">>>>>>>>>\");\n}", "function miFuncion (){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function fuctionPanier(){\n\n}", "function escolha(p) {\n novoJogo();//chamando a função para limpar a tela\n document.getElementById(\"resultado\").innerHTML = '';//limpando o mostra ganhador\n // document.getElementById(\"aviso\").innerHTML = ''; //limpando o aviso\n escB = p;// x é o parametro de x e O é o parametro de O\n}", "function comprarCurso(e){\n e.preventDefault();\n //delegation para agregar carrito\n\n if(e.target.classList.contains('agregar-carrito')){\n const curso = e.target.parentElement.parentElement;\n //acá lo que hizo es seleccionar una parte del interior de la card del curso\n //se tiene que seleccionar toda la cart, por esto, hizo el segundo parent element,\n //para llegar al padre anterior, ahi ya selecciono toda la card\n\n leerDatosCursos(curso);\n //esta funcion va recibir la info de curso y va a leerla.\n } //se envian los cursos seleccionados pa tomar datos\n\n \n}", "function mostrarPalabra(){\n \n}", "function ChangeFonction(event) {\n\n // // Efface le canvas\n // Contexte.clearRect(0, 0, CanvasWidth, CanvasHeight);\n\n ActiveDiv = event.target;\n\n for (i = 0; i < Onglets.length; i++) {\n Onglets[i].style.backgroundColor = \"white\";\n Onglets[i].style.color = \"black\";\n Onglets[ActiveDiv.customIndex].style.backgroundColor = \"black\";\n Onglets[ActiveDiv.customIndex].style.color = \"white\";\n }\n\n if (ActiveDiv.customIndex === 0) {\n Onglet1 = true;\n FunctionName.innerHTML = \"Fonction formes avec clavier();\"\n } else { Onglet1 = false; }\n if (ActiveDiv.customIndex === 1) {\n Onglet2 = true;\n FunctionName.innerHTML = \"Fonction formes aléatoire();\"\n } else { Onglet2 = false; }\n if (ActiveDiv.customIndex === 2) {\n Onglet3 = true;\n FunctionName.innerHTML = \"Fonction trait qui grossit();\"\n } else { Onglet3 = false; }\n\n}", "function comportement (){\n\t }", "function anhadir() {\n k.anhadirDatos();\n}", "function colocar_dulce(fila,modo=\"aleatorio\",nombre_imagen=0){\r\nvar html_para_agregar=\"\";\r\n if(modo === \"aleatorio\"){\r\n nombre_imagen = numero_entero_al_azar(1,4);\r\n }\r\n html_para_agregar = '<div class=\"candycru fila'+fila+'\"><img src=\"image/'+nombre_imagen+'.png\" alt=\"\"></div>'\r\n return html_para_agregar\r\n}", "function onloevha() {\n}", "function movimiento0($contenido1){\n\t\t\t//definir posicion de la ventana cuando no hay opcion seleccionado\n\t\t\t$('#forma-carteras-window').css({\"margin-left\": -350,\"margin-top\": -200});\n\t\t\t//definir alto de la ventana cuando no hay opcion seleccionado\n\t\t\t$('#forma-carteras-window').find('.carteras_div_one').css({'height':'190px'});\n\t\t\t\n\t\t\t//ancho de la ventana\n\t\t\t$('#forma-carteras-window').find('.carteras_div_one').css({'width':'913px'});\n\t\t\t$('#forma-carteras-window').find('.carteras_div_two').css({'width':'913px'});\n\t\t\t$('#forma-carteras-window').find('#carteras_div_titulo_ventana').css({'width':'873px'});\n\t\t\t$('#forma-carteras-window').find('.carteras_div_three').css({'width':'903px'});\n\t\t\t//posicion de los botones\n\t\t\t$('#forma-carteras-window').find('#botones').css({'width':'886px'});\n\t\t\t\n\t\t\t\n\t\t\t$contenido1.find('input[name=pagosxguardar]').attr({ 'value' : 0});\n\t\t\t$contenido1.find('input[name=monto_ant_selec]').attr({ 'value' : 0});\n\t\t\t\n\t\t\t$contenido1.find('tr.uno').find('td.oculta_anticipo').show();\n\t\t\t$contenido1.find('tr.uno').find('a[href*=busca_cliente]').show();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.cheque').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.cancelar').remove();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.cancelar_pagos').remove();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.transferencia').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.registros').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.tarjeta').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.pago').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.monto').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.monto_total').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.moneda').hide();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.moneda').find('textarea[name=observaciones]').text('');\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.moneda').find('textarea[name=observaciones]').hide();\n\t\t\t\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.anticipo').remove();\n\t\t\t$contenido1.find('tr.registros').hide();\n\t\t\t$contenido1.find('tr.transaccion').remove();\n\t\t\t$contenido1.find('tr.facturas').remove();\n\t\t\t$contenido1.find('tr.anticipo').remove();\n\t\t\t$contenido1.find('tr.uno').find('tbody tr.pago').find('td:eq(3)').find('div span').remove();\n\t\t\t$('#forma-carteras-window').find('#submit_pago').hide();\n\t\t\t$('#forma-carteras-window').find('#submit_cancel').hide();\n\t\t\t\n\t\t\t\n\t\t\tvar input_json = document.location.protocol + '//' + document.location.host + '/'+controller+'/get_tipos_movimiento.json';\n\t\t\t$arreglo = {};\n\t\t\t$.post(input_json,$arreglo,function(entry){\n\t\t\t\t//carga select con todas las monedas\n\t\t\t\t$contenido1.find('select[name=tipo_mov]').children().remove();\n\t\t\t\tvar tipo_mov_hmtl = '<option value=\"0\" selected=\"yes\">Seleccione una opcion</option>';\n\t\t\t\t$.each(entry['Tiposmov'],function(entryIndex,tm){\n\t\t\t\t\t\ttipo_mov_hmtl += '<option value=\"' + tm['id'] + '\" >' + tm['titulo'] + '</option>';\n\t\t\t\t});\n\t\t\t\t$contenido1.find('select[name=tipo_mov]').append(tipo_mov_hmtl);\n\t\t\t\t\n\t\t\t});//termina llamada json\n\t\t\t\n\t\t\t\n\t\t}", "function mossa(pos)\n{\n//reset in casella statistiche e messaggi a sinistra dello schermo\n\tdocument.getElementById(\"faccia\").innerHTML=\"(• ‿ •)\";\n\tif(colturno=='n')\n\t\tdocument.getElementById(\"messaggi\").innerHTML=\"tocca ai neri\";\n\telse\n\t\tdocument.getElementById(\"messaggi\").innerHTML=\"tocca ai bianchi\";\n\n/*_________________________PRIMO CLICK___________________________________*/\n\n\tif(cont%2==0)\n\t{\n\t\tprimo=document.getElementById(pos).innerHTML;\n\t\tvecchiaPos=pos;\n\t\t//ottengo colore giocatore\n\t\tvar lenstr=primo.length;\n\t\tvar colp=primo.charAt(lenstr-7);\n\t\t//controllo se la selezione corrisponde al colore della mossa\n\t\tif(colp!=colturno)\n\t\t{\n\t\t\tdocument.getElementById(\"messaggi\").innerHTML=\"mossa non valida...\";\n\t\t\tdocument.getElementById('faccia').innerHTML=\"(ಠ╭╮ಠ)\";\n\t\t\t\treturn;//esce dalla funzione in caso di selezione colore sbagliato\n\t\t}\n\n\t\t//cambia colore selezionato\n\t\tdocument.getElementById(pos).className=\"selezionato\";\n\t\t//controllo pedina + selezione mosse possibili\n\t\tSeleziona(primo, colp, colturno, pos);\n\t\t\n\t}\n//_____________________________SECONDO CLICK___________________________//\n\n\telse\n\t{\n\t\t//SE LA MOSSA E' VALIDA\n\t\tif(document.getElementById(pos).className==\"selezionato\"&&pos!=vecchiaPos)\n\t\t{\n\t\t\t//se viene mangiata una pedian avversaria, la faccia si stupisce e viene salvata la pedina mangiata in un array\n\t\t\tif(document.getElementById(pos).innerHTML!='<img src=\"imm/vuota.png\">')\n\t\t\t{\n\t\t\t\tdocument.getElementById('faccia').innerHTML=\"(^ ‿ ^)\";\n\t\t\t\tif(colturno=='b')//se era nera\n\t\t\t\t\tmangiate_n.push(document.getElementById(pos).innerHTML);\n\t\t\t\telse\t//se era bianca\n\t\t\t\t\tmangiate_b.push(document.getElementById(pos).innerHTML);\n\t\t\t}\n\t\t\t//se viene mangiato il re finisce il gioco\n\t\t\tif(document.getElementById(pos).innerHTML=='<img src=\"imm/re_b.png\">')//vincono i neri\t\t\t\n\t\t\t\tfine(true);\n\t\t\telse if(document.getElementById(pos).innerHTML=='<img src=\"imm/re_n.png\">')//vincono i bianchi\t\t\t\n\t\t\t\tfine(false);\n\t\t\t\n\t\t\t/*_____________________CONTROLLO ARROCCO____________________*/\n\t\t\tif(pos==\"13\" && isArrocco==true)//nero sx\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"14\").innerHTML='<img src=\"imm/torre_n.png\">'; //assegna alla nuova casella la pedina\n\t\t\t\tdocument.getElementById(\"11\").innerHTML=\"<img src='imm/vuota.png'>\"; //cancella la pedina nella vecchia casella\n\t\t\t\tarrocco[0]=false;\n\t\t\t}\n\t\t\telse if(pos==\"17\" && isArrocco==true)//nero dx\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"16\").innerHTML='<img src=\"imm/torre_n.png\">'; //assegna alla nuova casella la pedina\n\t\t\t\tdocument.getElementById(\"18\").innerHTML=\"<img src='imm/vuota.png'>\"; //cancella la pedina nella vecchia casella\n\t\t\t\tarrocco[0]=false;\n\t\t\t}\n\t\t\telse if(pos==\"83\" && isArrocco==true)//bianco sx\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"84\").innerHTML='<img src=\"imm/torre_b.png\">'; //assegna alla nuova casella la pedina\n\t\t\t\tdocument.getElementById(\"81\").innerHTML=\"<img src='imm/vuota.png'>\"; //cancella la pedina nella vecchia casella\n\t\t\t\tarrocco[3]=false;\n\t\t\t}\n\t\t\telse if(pos==\"87\" && isArrocco==true)//bianco dx\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"86\").innerHTML='<img src=\"imm/torre_b.png\">'; //assegna alla nuova casella la pedina\n\t\t\t\tdocument.getElementById(\"88\").innerHTML=\"<img src='imm/vuota.png'>\"; //cancella la pedina nella vecchia casella\n\t\t\t\tarrocco[3]=false;\n\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t//se è stato mossa una pedina per l'arrocco, ma non è stato fatto (quindi l'arrocco non è più possibile per quelle pedine)\n\t\t\tvar sum=[\"15\", \"11\", \"18\", \"85\", \"81\", \"88\"]\n\t\t\tfor(var i=0; i<6; i++)\n\t\t\t{\n\t\t\t\tif(vecchiaPos==sum[i])\n\t\t\t\t\tarrocco[i]=false;\n\t\t\t\t\t\n\t\t\t}\n\t\t\t//spostamento pedine\n\t\t\tdocument.getElementById(pos).innerHTML=primo; //assegna alla nuova casella la pedina\n\t\t\tdocument.getElementById(vecchiaPos).innerHTML=\"<img src='imm/vuota.png'>\"; //cancella la pedina nella vecchia casella\n\t\t\t//cambiamenti finali\n\t\t\tcontrolloPedoneFinal(pos,primo);//controlla se la pedina spostata era un pedone è arrivato alla parte opposta della scacchiera\n\t\t\tturno++;\n\t\t\ttimersec=300;\n\t\t\tdocument.getElementById(\"mosse\").innerHTML=\"mossa numero: \"+turno;\n\t\t\t//indica a chi tocca il turno successivo\n\t\t\tif(colturno=='b')\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"messaggi\").innerHTML=\"tocca ai neri\";\n\t\t\t\tcolturno='n';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdocument.getElementById(\"messaggi\").innerHTML=\"tocca ai bianchi\";\n\t\t\t\tcolturno='b';\n\t\t\t}\n\t\t}\n\t\t//SE LA MOSSA NON E' VALIDA\n\t\telse\n\t\t\tdocument.getElementById(\"messaggi\").innerHTML=\"mossa non valida!!!\";\n\t\t\n\t\tDeseleziona();//deseleziona tutto\n\t\tvisualEaten();//visualizza le pedine mangiate\t\n\t}\n\tcont++;\n}", "function execute(){\n hr = document.getElementsByTagName(\"header\")[0];\n window.addEventListener(\"resize\", resiz);/*Se ejecuta solo al redimencionar la ventana con el evento resize*/\n resize();/*Necesario para redimencionar el fondo de imagen al cargar la web*/\n \n \n window.addEventListener(\"scroll\", posit);/*efecto paralax*/\n }", "function funcionPrincipal(e){\r\n\t// Momento de inicio de ejecucion del script\r\n\tvar tiempo_ejecucion = new Date().getTime();\r\n\tvar refreshflag = false;\r\n\tvar version = \"2.6c-N MunLightDoll - 【荣耀】沐沐跃进 - 内部版\";\r\n\r\n\tvar arrayRecursosCasilla = new Array();\r\n\r\n\tvar XPFirst = XPathResult.FIRST_ORDERED_NODE_TYPE;\t\t// Constante que devuelve el primer elemento por XPath\r\n\tvar XPList = XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE;\t\t// Constante que devuelve una lista de elementos por XPath\r\n\tvar XPIter = XPathResult.UNORDERED_NODE_ITERATOR_TYPE;\t\t// Constante que deuvelve un iterador de elementos por XPath\r\n\r\n\tvar actual = new Array(4);\t\t// Informacion de recursos almacenados\r\n\tvar total = new Array(4);\t\t// Capacidad de los almacenes y granero\r\n\tvar produccion = new Array(4);\t\t// Produccion por segundo\r\n\tvar imagenes = new Array();\t\t// Imagenes pre-cargadas\r\n\r\n\t// Indica para que servidores esta disponible el servicio de Travian World\r\n\t// IMPORTANTE: Por favor, no cambiar / Please, don't change. Travian World is only available for the servers indicated below\r\n\tvar tw_server = new Array();\r\n\r\n\t// Se estima cada linea como una altura de 20 pixeles\r\n\tvar pixelsPorLinea = 20;\r\n\r\n\tgetGeneralData();\r\n\r\n\tswitch(idioma) {\r\n\t\tcase \"hk\":\r\n\t\tcase \"tw\":\r\n\t\tcase \"cn\":\r\n\t\tdefault:\r\n\t\t\taLang['ALIANZA'] \t= '\\联\\盟';\r\n\t\t\taLang['PERFIL'] \t= '\\个\\人\\资\\料';\r\n\t\t\taLang['SIM'] \t\t= '\\战\\斗\\模\\拟\\器';\r\n\t\t\taLang['CALC'] \t= 'Travian\\计\\算\\机';\r\n\t\t\taLang['SEGURO'] \t= '\\你\\真\\的\\确\\定?';\r\n\t\t\taLang['MARK'] \t= '\\全\\选';\r\n\t\t\taLang['PERDIDAS'] \t= '\\战\\损';\r\n\t\t\taLang['RENT'] \t= '\\得\\益';\r\n\t\t\taLang['SUBIR_NIVEL'] \t= '\\已\\可\\升\\级\\!';\r\n\t\t\taLang['JUGADOR'] \t= '\\玩\\家';\r\n\t\t\taLang['ALDEA'] \t= '\\村\\庄';\r\n\t\t\taLang['HAB'] \t\t= '\\人\\口';\r\n\t\t\taLang['COORD'] \t= '\\座\\标';\r\n\t\t\taLang['ACCION'] \t= '\\行\\动';\r\n\t\t\taLang['ATACAR'] \t= '\\攻\\击';\r\n\t\t\taLang['COMERCIAR'] \t= '\\运\\送\\资\\源';\r\n\t\t\taLang['GUARDADO'] \t= '\\储\\存';\r\n\t\t\taLang['DESP_ABR'] \t= '\\移\\动\\格\\数';\r\n\t\t\taLang['FALTA'] \t= '\\尚\\缺';\r\n\t\t\taLang['HOY'] \t\t= '\\今\\天';\r\n\t\t\taLang['MANYANA'] \t= '\\明\\天';\r\n\t\t\taLang['PAS_MANYANA'] \t= '\\后\\天';\r\n\t\t\taLang['MERCADO'] \t= '\\市\\场';\r\n\t\t\taLang['CUARTEL'] \t= '\\兵\\营';\r\n\t\t\taLang['PUNTO'] \t= '\\集\\结\\点';\r\n\t\t\taLang['CORRAL'] \t= '\\马\\厩';\r\n\t\t\taLang['TALLER'] \t= '\\工\\场';\r\n\t\t\taLang['ENVIAR'] \t= '\\运\\送\\资\\源';\r\n\t\t\taLang['COMPRAR'] \t= '\\买';\r\n\t\t\taLang['VENDER'] \t= '\\卖';\r\n\t\t\taLang['ENVIAR_IGM'] \t= '\\发\\送\\讯\\息';\r\n\t\t\taLang['LISTO'] \t= '\\建\\造\\可\\于';\r\n\t\t\taLang['EL'] \t\t= '\\-';\r\n\t\t\taLang['A_LAS'] \t= '\\-';\r\n\t\t\taLang['EFICIENCIA'] \t= '\\效\\率';\r\n\t\t\taLang['NUNCA']\t= '\\永\\不';\r\n\t\t\taLang['PC'] = '\\文\\明\\点';\r\n\t\t\taLang['FUNDAR'] = '\\您\\可\\以\\兴\\建\\或\\者\\占\\领\\一\\座\\村\\庄';\r\n\t\t\taLang['ALDEAS'] = '\\村\\庄';\r\n\t\t\taLang['ENV_TROPAS']\t= '出兵';\r\n\t\t\taLang['RECURSO1'] = '\\木\\材';\r\n\t\t\taLang['RECURSO2'] = '\\砖\\块';\r\n\t\t\taLang['RECURSO3'] = '\\钢\\铁';\r\n\t\t\taLang['RECURSO4'] = '\\谷\\物';\r\n\t\t\taLang['TIEMPO'] = '\\时\\间';\r\n\t\t\taLang['COMP'] = '\\报\\告\\压\\缩\\器';\r\n\t\t\taLang['STAT']\t\t= '\\统\\计';\r\n\t\t\taLang['OFREZCO']\t= '\\提\\供';\r\n\t\t\taLang['BUSCO']\t= '\\需\\求';\r\n\t\t\taLang['TIPO']\t\t= '\\比\\例';\r\n\t\t\taLang['DISPONIBLE']\t= '\\是\\否\\显\\示\\商\\人\\足\\够\\的';\r\n\t\t\taLang['CUALQUIERA']\t= '\\任\\何';\r\n\t\t\taLang['SI']\t\t= '\\是';\r\n\t\t\taLang['NO']\t\t= '\\否';\r\n\t\t\taLang['LOGIN']\t= '\\重\\新\\登\\录';\r\n\t\t\taLang['MARCADORES'] = '\\书\\签';\r\n\t\t\taLang['ANYADIR'] = '\\加\\入';\r\n\t\t\taLang['ENLACE'] = '\\新\\书\\签\\网\\址';\r\n\t\t\taLang['TEXTO'] = '新书签标题';\r\n\t\t\taLang['MAXTIME']\t= '最大运输时间';\r\n\t\t\taLang['ELIMINAR']\t= '\\删\\除';\r\n\t\t\taLang['MAPA']\t\t= '\\TravMap';\r\n\t\t\taLang['DUNIUMAP']\t= '\\在线地图';\r\n\t\t\taLang['ARCHIVE']\t= '\\存\\档';\r\n\t\t\taLang['RESUMEN']\t= '\\概\\况';\r\n\r\n\t\t\taLang['DEP'] = '仓库';\r\n\t\t\taLang['TROP'] = '军队';\r\n\t\t\taLang['RESS'] = '资源';\r\n\t\t\taLang['MINI'] = '简易';\r\n\t\t\taLang['FT'] = '派对';\r\n\t\t\taLang['FT1'] = '小型派对';\r\n\t\t\taLang['FT2'] = '大型派对';\r\n\r\n\t\t\taLang['LVL'] = '等级';\r\n\t\t\taLang['EXT'] = '扩展';\r\n\t\t\taLang['SLOT'] = '额度';\r\n\t\t\taLang['MAN'] = '绿洲';\r\n\t\t\taLang['IN'] = '在';\r\n\r\n\t\t\taLang['DIST'] = '距离';\r\n\r\n\t\t\taLang['ATT'] = aLang['ATACAR'];\r\n\t\t\taLang['CONS'] = '建筑物';\r\n\r\n\t\t\t//for new\r\n\t\t\taLang['ALDEA_EXTRA1'] \t= '<img src=\"img/un/a/def1.gif\" width=\"12\" border=\"0\" _title=\"出兵\">';\r\n\t\t\taLang['ALDEA_EXTRA2'] \t= '<img src=\"img/un/r/4.gif\" border=\"0\" _title=\"运送资源\">';\r\n\t\t\taLang['ALDEA_EXTRA3'] \t= '<img src=\"img/un/u/44.gif\" width=\"12\" border=\"0\" _title=\"观看地图\">';\r\n\t\t\taLang['UPLV'] \t= '升级到等级';\r\n\r\n\t\t\taLang['ALIANZA_FORUM'] \t= '联盟论坛';\r\n\t\t\taLang['ALIANZA_CHAT'] \t= '联盟 Chat';\r\n\t\t\taLang['ALIANZA_ATTACK']\t= '联盟攻击';\r\n\t\t\taLang['ALIANZA_NEWS'] \t= '联盟新闻';\r\n\t\t\taLang['ALIANZA_OPTION'] \t= '联盟选项';\r\n\r\n\t\t\t//导出短消息用\r\n\t\t\taLang['IGMTITLE'] = '主题';\r\n\t\t\taLang['IGMSENTER'] = '寄件人';\r\n\t\t\taLang['IGMDATE'] = '日期';\r\n\t\t\taLang['IGMTIME'] = '时间';\r\n\t\t\taLang['IGMOUTPUT'] = '显示全部信件内容';\r\n\r\n\t\t\t//\r\n\t\t\taLang['OPENLINK']='开启连结';\r\n\t\t\taLang['MAP']='地图';\r\n\t\t\taLang['ADD_ALL']='全部增加';\r\n\t\t\taLang['SAVEMAPURL1']='请输入名称';\r\n\t\t\taLang['SAVEMAPURL2']='&raquo; 将此地点存入书签';\r\n\r\n\t\t\taLang['QUERYMODE']='查询资源';\r\n\t\t\taLang['REFRESH_INFORMARION'] = '查看全部';\r\n\r\n\t\t\t// Travian Selling Assistant\r\n\r\n\t\t\taLang['CPCTY1'] = '自订单位商人运载量: ';\r\n\t\t\taLang['CPCTY2'] = '使用预设值 ';\r\n\t\t\taLang['CPCTY3'] = '自订 ';\r\n\t\t\taLang['RECORD1'] = '储存过去最新 ';\r\n\t\t\taLang['RECORD2'] = ' 笔纪录。';\r\n\t\t\taLang['DELETE'] = '删除';\r\n\t\t\taLang['LUMBER'] = aLang['RECURSO1'];\r\n\t\t\taLang['CLAY'] = aLang['RECURSO2'];\r\n\t\t\taLang['IRON'] = aLang['RECURSO3'];\r\n\t\t\taLang['CROP'] = aLang['RECURSO4'];\r\n\t\t\taLang['OFFER'] = '提供';\r\n\t\t\taLang['SEARCH'] = '搜寻';\r\n\t\t\taLang['MAXTIME'] = '单向运输时间(小时)';\r\n\t\t\taLang['ALLIANCE'] = '联盟';\r\n\t\t\taLang['UNLIMITED'] = '无上限';\r\n\t\t\taLang['YES'] = '是';\r\n\t\t\taLang['NO'] = '否';\r\n\r\n\t\t\taLang['MARKETPRELOADPAGE'] = '预先载入页数:';\r\n\r\n\t\t\taLang['HOURS'] = '每小时';\r\n\r\n\t\t\taLang['CHECKNEW'] = '\\检\\查\\新\\版\\本';\r\n\r\n\t\t\taLang['ADDOWNTOWNTOTALTROOPSTABLE'] = '此村庄拥有的士兵';\r\n\r\n\t\t\taLang['SAVEREPORT'] = '储存战报';\r\n\t\t\taLang['ANONYMIZE'] = '匿名';\r\n\r\n\t\t\taLang['TOTAL'] = '总计';\r\n\t\t\taLang['PRELOAD'] = '预先载入页数:';\r\n\t\t\taLang['DELETEBERICHTE_T3'] = '选择攻方粮食消耗小于:';\r\n\t\t\taLang['DELETEBERICHTE_T3_BUTTON'] = '战报筛选';\r\n\r\n\t\t\taLang['ALLOWCOORDS'] = '开启分析座标';\r\n\t\t\taLang['ALLOWLINK'] = '开启分析网址';\r\n\t\t\taLang['HTMLON'] = '强化网址分析';\r\n\r\n\t\t\taLangTroops[0] = [\"古罗马步兵\", \"禁卫兵\", \"帝国兵\", \"使者骑士\", \"帝国骑士\", \"将军骑士\", \"冲撞车\", \"火焰投石机\", \"参议员\", \"开拓者\", \"英雄\"];\t//Romans\r\n\t\t\taLangTroops[1] = [\"棍棒兵\", \"矛兵\", \"斧头兵\", \"侦察兵\", \"游侠\", \"条顿骑士\", \"冲撞车\", \"投石车\", \"司令官\", \"开拓者\", \"英雄\"];\t\t\t\t\t//Teutons\"\r\n\t\t\taLangTroops[2] = [\"方阵兵\", \"剑士\", \"探路者\", \"雷法师\", \"德鲁伊骑兵\", \"海顿圣骑\", \"冲撞车\", \"投石车\", \"族长\", \"开拓者\", \"英雄\", \"陷阱\"];\t\t\t\t//Gauls\r\n\r\n\t\t\taLangBattleAnalyse = [\"总攻击力\",\"平均战损\",\"对步兵防御力\",\r\n\t\t\t\t\t\t\t\"对骑兵防御力\",\"统计\",\"资源损失\",\"粮食消耗\",\r\n\t\t\t\t\t\t\t\"英雄经验\",\"掠夺容量\",\"资源得失\",\"占用人口\",\r\n\t\t\t\t\t\t\t\"没有英雄\",\"英雄\",\"掠夺资源量\",\"剩余容量\",\r\n\t\t\t\t\t\t\t\"进攻方\",\"防守方\"];\r\n\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\t// Lenyador\r\n\tvar lenyadorCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[40, 100, 50, 60],\r\n\t\t[65, 165, 85, 100],\r\n\t\t[110, 280, 140, 165],\r\n\t\t[185, 465, 235, 280],\r\n\t\t[310, 780, 390, 465],\r\n\t\t[520, 1300, 650, 780],\r\n\t\t[870, 2170, 1085, 1300],\r\n\t\t[1450, 3625, 1810, 2175],\r\n\t\t[2420, 6050, 3025, 3630],\r\n\t\t[4040, 10105, 5050, 6060],\t// Nivel 10\r\n\t\t[6750, 16870, 8435, 10125],\r\n\t\t[11270, 28175, 14090, 16905],\r\n\t\t[18820, 47055, 23525, 28230],\r\n\t\t[31430, 78580, 39290, 47150],\r\n\t\t[52490, 131230, 65615, 78740], // Nivel 15\r\n\t\t[87660, 219155, 109575, 131490],\r\n\t\t[146395, 365985, 182995, 219590],\r\n\t\t[244480, 611195, 305600, 366715],\r\n\t\t[408280, 1020695, 510350, 612420],\r\n\t];\r\n\r\n\t// Barrera\r\n\tvar barroCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[80, 40, 80, 50],\r\n\t\t[135, 65, 135, 85],\r\n\t\t[225, 110, 225, 140],\r\n\t\t[375, 185, 375, 235],\r\n\t\t[620, 310, 620, 390],\r\n\t\t[1040, 520, 1040, 650],\r\n\t\t[1735, 870, 1735, 1085],\r\n\t\t[2900, 1450, 2900, 1810],\r\n\t\t[4840, 2420, 4840, 3025],\r\n\t\t[8080, 4040, 8080, 5050],\t// Nivel 10\r\n\t\t[13500, 6750, 13500 ,8435],\r\n\t\t[22540, 11270, 22540, 14090],\r\n\t\t[37645, 18820, 37645, 23525],\r\n\t\t[62865, 31430, 62865, 39290],\r\n\t\t[104985, 52490, 104985, 65615], // Nivel 15\r\n\t\t[175320, 87660, 175320, 109575],\r\n\t\t[292790, 146395, 292790, 182995],\r\n\t\t[488955, 244480, 488955, 305600],\r\n\t\t[846555, 408280, 816555, 510350],\r\n\t];\r\n\r\n\t// Mina de hierro\r\n\tvar hierroCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[100, 80, 30, 60],\r\n\t\t[165, 135, 50, 100],\r\n\t\t[280, 225, 85, 165],\r\n\t\t[465, 375, 140, 280],\r\n\t\t[780, 620, 235, 465],\r\n\t\t[1300, 1040, 390, 780],\r\n\t\t[2170, 1735, 650, 1300],\r\n\t\t[3625, 2900, 1085, 2175],\r\n\t\t[6050, 4840, 1815, 3630],\r\n\t\t[10105, 8080, 3030, 6060],\t// Nivel 10\r\n\t\t[16870, 13500, 5060, 10125],\r\n\t\t[28175, 22540, 8455, 16905],\r\n\t\t[47055, 37645, 14115, 28230],\r\n\t\t[78580, 62865, 23575, 47150],\r\n\t\t[131230, 104985, 39370, 78740], // Nivel 15\r\n\t\t[219155, 175320, 65745, 131490],\r\n\t\t[365985, 292790, 109795, 219590],\r\n\t\t[611195, 488955, 183360, 366715],\r\n\t\t[1020695, 846555, 306210, 612420],\r\n\t];\r\n\r\n\t// Granja\r\n\tvar cerealCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[70, 90, 70, 20],\r\n\t\t[115, 150, 115, 35],\r\n\t\t[195, 250, 195, 55],\r\n\t\t[325, 420, 325, 95],\r\n\t\t[545, 700, 545, 155],\r\n\t\t[910, 1170, 910, 260],\r\n\t\t[1520, 1950, 1520, 435],\r\n\t\t[2535, 3260, 2535, 725],\r\n\t\t[4235, 5445, 4235, 1210],\r\n\t\t[7070, 9095, 7070, 2020],\t// Nivel 10\r\n\t\t[11810, 15185, 11810, 3375],\r\n\t\t[19725, 25360, 19725, 5635],\r\n\t\t[32940, 42350, 32940, 9410],\r\n\t\t[55005, 70720, 55005, 15715],\r\n\t\t[91860, 118105, 91860, 26245],\t// Nivel 15\r\n\t\t[153405, 197240, 153405, 43830],\r\n\t\t[256190, 329385, 256190, 73195],\r\n\t\t[427835, 550075, 427835, 122240],\r\n\t\t[714485, 918625, 714485, 204140],\r\n\t];\r\n\r\n\t// Almacen\r\n\tvar warehouseCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[130,160,90,40],\r\n\t\t[165,205,115,50],\r\n\t\t[215,260,145,65],\r\n\t\t[275,335,190,85],\r\n\t\t[350,430,240,105],\r\n\t\t[445,550,310,135],\r\n\t\t[570,705,395,175],\r\n\t\t[730,900,505,225],\r\n\t\t[935,1115,650,290],\r\n\t\t[1200,1475,830,370],\r\n\t\t[1535,1890,1065,470],\r\n\t\t[1965,2420,1360,605],\r\n\t\t[2515,3095,1740,775],\r\n\t\t[3220,3960,2230,990],\r\n\t\t[4120,5070,2850,1270],\r\n\t\t[5275,6490,3650,1625],\r\n\t\t[6750,8310,4675,2075],\r\n\t\t[8640,10635,5980,2660],\r\n\t\t[11060,13610,7655,3405],\r\n\t\t[14155,17420,9800,4355]\r\n\t];\r\n\r\n\t// Academia\r\n\tvar academyCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[220, 160, 90, 40],\r\n\t\t[280, 205, 115, 50],\r\n\t\t[360, 260, 145, 65],\r\n\t\t[460, 335, 190, 85],\r\n\t\t[590, 430, 240, 105], \t\t// Level 5\r\n\t\t[755, 550, 310, 135],\r\n\t\t[970, 705, 395, 175],\r\n\t\t[1240, 900, 505, 225],\r\n\t\t[1585, 1155, 650, 290],\r\n\t\t[2030, 1475, 830, 370], \t// Level 10\r\n\t\t[2595, 1890, 1065, 470],\r\n\t\t[3325, 2420, 1360, 605],\r\n\t\t[4255, 3095, 1740, 775],\r\n\t\t[5445, 3960, 2230, 990],\r\n\t\t[6970, 5070, 2850, 1270], \t// Level 15\r\n\t\t[8925, 6490, 3650, 1625],\r\n\t\t[11425, 8310, 4275, 2075],\r\n\t\t[14620, 10635, 5980, 2660],\r\n\t\t[18715, 13610, 7655, 3405],\r\n\t\t[23955, 17420, 9800, 4355] \t// Level 20\r\n\t];\r\n\r\n\t// Molino\r\n\tvar flourMillCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[500, 440, 380, 1240],\r\n\t\t[900, 790, 685, 2230],\r\n\t\t[1620, 1425, 1230, 4020],\r\n\t\t[2915, 2565, 2215, 7230],\r\n\t\t[5250, 4620, 3990, 13015], \t// Level 5\r\n\t];\r\n\r\n\t// Ladrillar\r\n\tvar brickyardCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[440, 480, 320, 50],\r\n\t\t[790, 865, 575, 90],\r\n\t\t[1425, 1555, 1035, 160],\r\n\t\t[2565, 2800, 1865, 290],\r\n\t\t[4620, 5040, 3360, 525], \t// Level 5\r\n\t];\r\n\r\n\t// Serreria\r\n\tvar sawmillCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[520, 380, 290, 90],\r\n\t\t[935, 685, 520, 160],\r\n\t\t[1685, 1230, 940, 290],\r\n\t\t[3035, 2215, 1690, 525],\r\n\t\t[5460, 3990, 3045, 945], \t// Level 5\r\n\t];\r\n\r\n\t// Fundicion de hierro\r\n\tvar ironFoundryCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[200, 450, 510, 120],\r\n\t\t[360, 810, 920, 215],\r\n\t\t[650, 1460, 1650, 390],\r\n\t\t[1165, 2625, 2975, 700],\r\n\t\t[2100, 4725, 5355, 1260], \t// Level 5\r\n\t];\r\n\r\n\t// Panaderia\r\n\tvar bakeryCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[1200, 1480, 870, 1600],\r\n\t\t[2160, 2665, 1565, 2880],\r\n\t\t[3890, 4795, 2820, 5185],\r\n\t\t[7000, 8630, 5075, 9330],\r\n\t\t[12595, 15535, 9135, 16795], \t// Level 5\r\n\t];\r\n\r\n\t// Mercado\r\n\tvar marketplaceCost = [\r\n\t\t[0, 0, 0, 0], \t\t\t// Level 0\r\n\t\t[80, 70, 120, 70],\r\n\t\t[100, 90, 155, 90],\r\n\t\t[130, 115, 195, 115],\r\n\t\t[170, 145, 250, 145],\r\n\t\t[215, 190, 320, 190], \t\t// Level 5\r\n\t\t[275, 240, 410, 240],\r\n\t\t[350, 310, 530, 310],\r\n\t\t[450, 395, 675, 395],\r\n\t\t[575, 505, 865, 505],\r\n\t\t[740, 645, 1105, 645], \t\t// Level 10\r\n\t\t[945, 825, 1415, 825],\r\n\t\t[1210, 1060, 1815, 1060],\r\n\t\t[1545, 1355, 2320, 1355],\r\n\t\t[1980, 1735, 2970, 1735],\r\n\t\t[2535, 2220, 3805, 2220], \t// Level 15\r\n\t\t[3245, 2840, 4870, 2840],\r\n\t\t[4155, 3635, 6230, 3635],\r\n\t\t[5315, 4650, 7975, 4650],\r\n\t\t[6805, 5955, 10210, 5955],\r\n\t\t[8710, 7620, 13065, 7620], \t// Level 20\r\n\t];\r\n\r\n\t// Granero\r\n\tvar granaryCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[80,100,70,20],\r\n\t\t[100,130,90,25],\r\n\t\t[130,165,115,35],\r\n\t\t[170,210,145,40],\r\n\t\t[215,270,190,55],\r\n\t\t[275,345,240,70],\r\n\t\t[350,440,310,90],\r\n\t\t[450,565,395,115],\r\n\t\t[575,720,505,145],\r\n\t\t[740,920,645,185],\r\n\t\t[945,1180,825,235],\r\n\t\t[1210,1510,1060,300],\r\n\t\t[1545,1935,1355,385],\r\n\t\t[1980,2475,1735,495],\r\n\t\t[2535,3170,2220,635],\r\n\t\t[3245,4055,2840,810],\r\n\t\t[4155,5190,3635,1040],\r\n\t\t[5315,6645,4650,1330],\r\n\t\t[6805,8505,5955,1700],\r\n\t\t[8710,10890,7620,2180]\r\n\t];\r\n\r\n\t// Armeria\r\n\tvar blacksmithCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[170,200,380,130],\r\n\t\t[220,225,485,165],\r\n\t\t[280,330,625,215],\r\n\t\t[355,420,795,275],\r\n\t\t[455,535,1020,350],\r\n\t\t[585,685,1305,445],\r\n\t\t[750,880,1670,570],\r\n\t\t[955,1125,2140,730],\r\n\t\t[1225,1440,2740,935],\r\n\t\t[1570,1845,3505,1200],\r\n\t\t[2005,2360,4485,1535],\r\n\t\t[2570,3020,5740,1965],\r\n\t\t[3290,3870,7350,2515],\r\n\t\t[4210,4950,9410,3220],\r\n\t\t[5390,6340,12045,4120],\r\n\t\t[6895,8115,15415,5275],\r\n\t\t[8825,10385,19730,6750],\r\n\t\t[11300,13290,25255,8640],\r\n\t\t[14460,17015,32325,11060],\r\n\t\t[18510,21780,41380,14155]\r\n\t];\r\n\r\n\t// Armamentaria\r\n\tvar armouryCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[130,210,410,130],\r\n\t\t[165,270,525,165],\r\n\t\t[215,345,670,215],\r\n\t\t[275,440,860,275],\r\n\t\t[350,565,1100,350],\r\n\t\t[445,720,1410,445],\r\n\t\t[570,925,1805,570],\r\n\t\t[730,1180,2310,730],\r\n\t\t[935,1515,2955,935],\r\n\t\t[1200,1935,3780,1200],\r\n\t\t[1535,2480,4840,1535],\r\n\t\t[1965,3175,6195,1965],\r\n\t\t[2515,4060,7930,2515],\r\n\t\t[3220,5200,10150,3220],\r\n\t\t[4120,6655,12995,4120],\r\n\t\t[5275,8520,16630,5275],\r\n\t\t[6750,10905,21290,6750],\r\n\t\t[8640,13955,27250,8640],\r\n\t\t[11060,17865,34880,11060],\r\n\t\t[14155,22865,44645,14155]\r\n\t];\r\n\r\n\t// Edificio principal\r\n\tvar mainBuildingCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[70,40,60,20],\r\n\t\t[90,50,75,25],\r\n\t\t[115,65,100,35],\r\n\t\t[145,85,125,40],\r\n\t\t[190,105,160,55],\r\n\t\t[240,135,205,70],\r\n\t\t[310,175,265,90],\r\n\t\t[395,225,340,115],\r\n\t\t[505,290,430,145],\r\n\t\t[645,370,555,185],\r\n\t\t[825,470,710,235],\r\n\t\t[1060,605,905,300],\r\n\t\t[1355,775,1160,385],\r\n\t\t[1735,990,1485,495],\r\n\t\t[2220,1270,1900,635],\r\n\t\t[2840,1625,2435,810],\r\n\t\t[3635,2075,3115,1040],\r\n\t\t[4650,2660,3990,1330],\r\n\t\t[5955,3405,5105,1700],\r\n\t\t[7620,4355,6535,2180]\r\n\t];\r\n\r\n\t// Plaza de reuniones\r\n\tvar rallyPointCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[110,60,80,60],\r\n\t\t[140,205,115,90],\r\n\t\t[180,260,145,115],\r\n\t\t[230,355,190,145],\r\n\t\t[295,160,215,160],\r\n\t\t[380,550,310,240],\r\n\t\t[485,705,395,310],\r\n\t\t[620,900,505,395],\r\n\t\t[795,430,575,430],\r\n\t\t[1015,1475,830,645], \t// Nivel 10\r\n\t\t[1300,1890,1065,825],\r\n\t\t[1660,2420,1360,1060],\r\n\t\t[2130,3095,1740,1355],\r\n\t\t[2725,3960,2230,1735],\r\n\t\t[3465,5075,2845,2230],\r\n\t\t[4460,6490,3650,2840],\r\n\t\t[5680,8315,4665,3650],\r\n\t\t[7310,10635,5980,4650],\r\n\t\t[9360,13610,7655,5955],\r\n\t\t[11980,17420,9800,7620]\r\n\t];\r\n\r\n\t// Embajada\r\n\tvar embassyCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[180,130,150,80],\r\n\t\t[230,165,190,100],\r\n\t\t[295,215,245,130],\r\n\t\t[375,275,315,170],\r\n\t\t[485,350,405,215],\r\n\t\t[620,445,515,275],\r\n\t\t[790,570,660,350],\r\n\t\t[1015,730,845,450],\r\n\t\t[1295,935,1080,575],\r\n\t\t[1660,1200,1385,740],\r\n\t\t[2125,1535,1770,945],\r\n\t\t[2720,1965,2265,1210],\r\n\t\t[3480,2515,2900,1545],\r\n\t\t[4455,3220,3715,1980],\r\n\t\t[5705,4120,4755,2535],\r\n\t\t[7300,5275,6085,3245],\r\n\t\t[9345,6750,7790,4155],\r\n\t\t[11965,8640,9970,5315],\r\n\t\t[15315,11060,12760,6805],\r\n\t\t[19600,14155,16335,8710]\r\n\t];\r\n\r\n\t// Cuartel\r\n\tvar barracksCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[210,140,260,120],\r\n\t\t[270,180,335,155],\r\n\t\t[345,230,425,195],\r\n\t\t[440,295,545,250],\r\n\t\t[565,375,700,320],\r\n\t\t[720,480,895,410],\r\n\t\t[925,615,1145,530],\r\n\t\t[1180,790,1465,675],\r\n\t\t[1515,1010,1875,865],\r\n\t\t[1935,1290,2400,1105],\r\n\t\t[2480,1655,3070,1415],\r\n\t\t[3175,2115,3930,1815],\r\n\t\t[4060,2710,5030,2320],\r\n\t\t[5200,3465,6435,2970],\r\n\t\t[6655,4435,8240,3805],\r\n\t\t[8520,5680,10545,4870],\r\n\t\t[10905,7270,13500,6230],\r\n\t\t[13955,9305,17280,7975],\r\n\t\t[17865,11910,22120,10210],\r\n\t\t[22865,15245,28310,13065]\r\n\t];\r\n\r\n\t// Corral / Establo\r\n\tvar stableCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[260,140,220,100],\r\n\t\t[335,180,280,130],\r\n\t\t[425,230,360,165],\r\n\t\t[545,295,460,210],\r\n\t\t[700,375,590,270],\r\n\t\t[895,480,755,345],\r\n\t\t[1145,615,970,440],\r\n\t\t[1465,790,1240,565],\r\n\t\t[1875,1010,1585,720],\r\n\t\t[2400,1290,2030,920],\r\n\t\t[3070,1655,2595,1180],\r\n\t\t[3930,2115,3325,1510],\r\n\t\t[5030,2710,4255,1935],\r\n\t\t[6435,3465,5445,2475],\r\n\t\t[8240,4435,6970,3170],\r\n\t\t[10545,5680,8925,4055],\r\n\t\t[13500,7270,11425,5190],\r\n\t\t[17280,9305,14620,6645],\r\n\t\t[22120,11910,18715,8505],\r\n\t\t[28310,15245,23955,10890]\r\n\t];\r\n\r\n\t// Taller\r\n\tvar workshopCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[460,510,600,320],\r\n\t\t[590,655,770,410],\r\n\t\t[755,835,985,525],\r\n\t\t[965,1070,1260,670],\r\n\t\t[1235,1370,1610,860],\r\n\t\t[1580,1750,2060,1100],\r\n\t\t[2025,2245,2640,1405],\r\n\t\t[2590,2870,3380,1800],\r\n\t\t[3315,3675,4325,2305],\r\n\t\t[4245,4705,5535,2950],\r\n\t\t[5430,6020,7085,3780],\r\n\t\t[6950,7705,9065,4835],\r\n\t\t[8900,9865,11605,6190],\r\n\t\t[11390,12625,14855,7925],\r\n\t\t[14580,16165,19015,10140],\r\n\t\t[18660,20690,24340,12980],\r\n\t\t[23885,26480,31155,16615],\r\n\t\t[30570,33895,39787,21270],\r\n\t\t[39130,43385,51040,27225],\r\n\t\t[50090,55535,65335,34845]\r\n\t];\r\n\r\n\t// Escondite\r\n\tvar crannyCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[40,50,30,10],\r\n\t\t[50,65,40,15],\r\n\t\t[65,80,50,15],\r\n\t\t[85,105,65,20],\r\n\t\t[135,160,105,55],\r\n\t\t[170,205,135,70],\r\n\t\t[220,265,175,90],\r\n\t\t[280,340,225,115],\r\n\t\t[360,430,290,145],\r\n\t\t[370,460,275,90]\r\n\t];\r\n\r\n\t// Ayuntamiento\r\n\tvar ayuntamientoCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[1250,1110,1260,600],\r\n\t\t[1600,1420,1615,770],\r\n\t\t[2050,1820,2065,985],\r\n\t\t[2620,2330,2640,1260],\r\n\t\t[3355,2980,3380,1610],\r\n\t\t[4295,3815,4330,2060],\r\n\t\t[5500,4880,5540,2640],\r\n\t\t[7035,6250,7095,3380],\r\n\t\t[9005,8000,9080,4325],\r\n\t\t[11530,10240,11620,5535],\r\n\t\t[14755,13105,14875,7085],\r\n\t\t[18890,16775,19040,9065],\r\n\t\t[24180,21470,27370,11605],\r\n\t\t[30950,27480,31195,14885],\r\n\t\t[39615,35175,39930,19015],\r\n\t\t[40705,45025,51110,24340],\r\n\t\t[64905,57635,65425,31155],\r\n\t\t[83075,73770,83740,39875],\r\n\t\t[106340,94430,107190,51040],\r\n\t\t[136115,120870,137200,65335]\r\n\t];\r\n\r\n\t// Residencia\r\n\tvar residenceCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[580,460,350,180],\r\n\t\t[740,590,450,230],\r\n\t\t[950,755,575,295],\r\n\t\t[1215,965,735,375],\r\n\t\t[1555,1235,940,485],\r\n\t\t[1995,1580,1205,620],\r\n\t\t[2550,2025,1540,790],\r\n\t\t[3265,2590,1970,1015],\r\n\t\t[4180,3315,2520,1295],\r\n\t\t[5350,4245,3230,1660],\r\n\t\t[6845,5430,4130,2125],\r\n\t\t[8765,6950,5290,2720],\r\n\t\t[11220,8900,6770,3480],\r\n\t\t[14360,11390,8665,4455],\r\n\t\t[18380,14580,11090,5705],\r\n\t\t[23530,18660,14200,7300],\r\n\t\t[30115,23885,18175,9345],\r\n\t\t[38550,30570,23260,11965],\r\n\t\t[49340,39130,29775,15315],\r\n\t\t[63155,50090,38110,19600]\r\n\t];\r\n\r\n\t// Palacio\r\n\tvar palaceCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[550,800,750,250],\r\n\t\t[705,1025,960,320],\r\n\t\t[900,1310,1230,410],\r\n\t\t[1155,1680,1575,525],\r\n\t\t[1475,2145,2015,670],\r\n\t\t[1890,2750,2575,860],\r\n\t\t[2420,3520,3300,1100],\r\n\t\t[3095,4505,4220,1405],\r\n\t\t[3965,5765,5405,1800],\r\n\t\t[5075,7380,6920,2305],\r\n\t\t[6495,9445,8855,2950],\r\n\t\t[8310,12090,11335,3780],\r\n\t\t[10640,15478,14505,4835],\r\n\t\t[13150,19805,18570,6190],\r\n\t\t[17430,25355,23770,7925],\r\n\t\t[22310,32450,30425,10140],\r\n\t\t[28560,41540,38940,12980],\r\n\t\t[36555,53170,49845,16615],\r\n\t\t[46790,68055,63805,21270],\r\n\t\t[59890,87110,81670,27225]\r\n\t];\r\n\r\n\t// Plaza de torneos\r\n\tvar tournamentSquareCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[1750,2250,1530,240],\r\n\t\t[2240,2880,1960,305],\r\n\t\t[2865,3685,2505,395],\r\n\t\t[3670,4720,3210,505],\r\n\t\t[4700,6040,4105,645],\r\n\t\t[6015,7730,5255,825],\r\n\t\t[7695,9895,6730,1055],\r\n\t\t[9850,12665,8615,1350],\r\n\t\t[12610,16215,11025,1730],\r\n\t\t[16140,20755,14110,2215],\r\n\t\t[20660,26565,18065,2835],\r\n\t\t[26445,34000,23120,3625],\r\n\t\t[33850,43520,29595,4640],\r\n\t\t[43330,55705,37880,5940],\r\n\t\t[55460,71305,48490,7605],\r\n\t\t[70990,91270,62065,9735],\r\n\t\t[90865,117000,79440,12460],\r\n\t\t[116000,150000,102000,15950],\r\n\t\t[149000,191000,130000,20415],\r\n\t\t[191000,245000,167000,26135]\r\n\t];\r\n\r\n\t// Tesoro\r\n\tvar tesoroCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[2890,2740,2580,990],\r\n\t\t[3685,3505,3300,1265],\r\n\t\t[4720,4490,4225,1620],\r\n\t\t[6040,5745,5410,2075],\r\n\t\t[7730,7355,6925,2660],\r\n\t\t[9595,9415,8865,3400],\r\n\t\t[12665,12050,11345,4355],\r\n\t\t[16215,15425,14525,5575],\r\n\t\t[20755,19745,18590,7135],\r\n\t\t[26565,25270,23795,9130]\r\n\t];\r\n\r\n\t// Oficina de comercio\r\n\tvar oficinaComercioCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[1400,1330,1200,400],\r\n\t\t[1790,1700,1535,510],\r\n\t\t[2295,2180,1965,655],\r\n\t\t[2935,2790,2515,840],\r\n\t\t[3760,3570,3220,1075],\r\n\t\t[4810,4570,4125,1375],\r\n\t\t[6155,5850,5280,1760],\r\n\t\t[7780,7485,6755,2250],\r\n\t\t[10090,9585,8645,2880],\r\n\t\t[12915,12265,11070,6390],\r\n\t\t[16530,15700,14165,4720],\r\n\t\t[21155,20100,18135,6045],\r\n\t\t[27080,25725,23210,9905],\r\n\t\t[34660,32930,29710,9905],\r\n\t\t[44370,42150,38030,12675],\r\n\t\t[56790,53950,48680,16225],\r\n\t\t[72690,69060,62310,20770],\r\n\t\t[93045,88395,79755,26585],\r\n\t\t[119100,113145,102085,34030],\r\n\t\t[152445,144825,130670,43555]\r\n\t];\r\n\r\n\t// Cuartel grande\r\n\tvar greatBarrackCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[630,420,780,360],\t\t// Level 1\r\n\t\t[805,540,1000,460],\r\n\t\t[1030,690,1280,590],\r\n\t\t[1320,880,1635,755],\r\n\t\t[1690,1125,2095,965],\t\t// Level 5\r\n\t\t[2165,1445,2680,1235],\r\n\t\t[2770,1845,3430,1585],\r\n\t\t[3545,2365,4390,2025],\r\n\t\t[4540,3025,5620,2595],\r\n\t\t[5810,3875,7195,3320],\t\t// Level 10\r\n\t\t[7440,4960,9210,4250],\r\n\t\t[9520,6345,11785,5440],\r\n\t\t\t\t[12185,8125,15085,6965],\r\n\t\t[15600,10400,19310,8915],\r\n\t\t[19965,13310,24270,11410],\t// Level 15\r\n\t\t\t\t[25555,17035,31640,14605],\r\n\t\t[32710,21810,40500,18690],\r\n\t\t[41870,27915,51840,23925],\r\n\t\t[53595,35730,66355,30625],\r\n\t\t[68600,45735,84935,39200]\t// Level 20\r\n\t];\r\n\r\n\t// Corral / Establo grande\r\n\tvar greatStableCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[780,420,660,300],\r\n\t\t[1000,540,845,385],\r\n\t\t[1280,690,1080,490],\r\n\t\t[1635,880,1385,630],\r\n\t\t[2095,1125,1770,805],\r\n\t\t[2680,1445,2270,1030],\r\n\t\t[3430,1845,2905,1320],\r\n\t\t[4390,2365,3715,1690],\r\n\t\t[5620,3025,4755,2160],\r\n\t\t[7195,3875,6085,2765],\r\n\t\t[9210,4960,7790,3540],\r\n\t\t[11785,6345,9975,4535],\r\n\t\t[15085,8125,12765,5805],\r\n\t\t[19310,10400,16340,7430],\r\n\t\t[24720,13310,20915,9505],\t// Level 15\r\n\t\t[31640,17035,26775,12170],\r\n\t\t[40500,21810,34270,15575],\r\n\t\t[51840,27915,43865,19940],\r\n\t\t[66355,35730,56145,25520],\r\n\t\t[84935,45735,71870,32665]\r\n\t];\r\n\r\n\t// Muralla\r\n\tvar wallRomansCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[70, 90, 170, 70],\r\n\t\t[90, 115, 220, 90],\r\n\t\t[115, 145, 280, 115],\r\n\t\t[145, 190, 355, 145],\r\n\t\t[190, 240, 455, 190],\r\n\t\t[240, 310, 585, 240],\r\n\t\t[310, 395, 750, 310],\r\n\t\t[395, 505, 955, 395],\r\n\t\t[505, 650, 1225, 505],\r\n\t\t[645, 830, 1570, 645],\r\n\t\t[825, 1065, 2005, 825],\r\n\t\t[1060, 1360, 2570, 1060],\r\n\t\t[1355, 1740, 3290, 1355],\r\n\t\t[1735, 2230, 4210, 1735],\r\n\t\t[2220, 2850, 5390, 2220],\r\n\t\t[2840, 3650, 6895, 2840],\r\n\t\t[3635, 4675, 8825, 3635],\r\n\t\t[4650, 5980, 11300, 4650],\r\n\t\t[5955, 7655, 14160, 5955],\r\n\t\t[7620, 9800, 18510, 7620]\r\n\t];\r\n\r\n\t// Empalizada\r\n\tvar wallGaulsCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[160, 100, 80, 60],\r\n\t\t[205, 130, 100, 75],\r\n\t\t[260, 165, 130, 100],\r\n\t\t[335, 210, 170, 125],\r\n\t\t[430, 270, 215, 160],\r\n\t\t[550, 345, 275, 205],\r\n\t\t[705, 440, 350, 265],\r\n\t\t[900, 565, 450, 340],\r\n\t\t[1155, 720, 575, 430],\r\n\t\t[1475, 920, 740, 555],\r\n\t\t[1890, 1180, 945, 710],\r\n\t\t[2420, 1510, 1210, 905],\r\n\t\t[3095, 1935, 1545, 1160],\r\n\t\t[3960, 2475, 1980, 1485],\r\n\t\t[5070, 3170, 2535, 1900],\r\n\t\t[6490, 4055, 3245, 2435],\r\n\t\t[8310, 5190, 4155, 3115],\r\n\t\t[10635, 6645, 5315, 3990],\r\n\t\t[13610, 8505, 6805, 5105],\r\n\t\t[17420, 10890, 8710, 6535]\r\n\t];\r\n\r\n\t// Terraplen\r\n\tvar wallTeutonsCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[120, 200, 0, 80],\r\n\t\t[155, 255, 0, 100],\r\n\t\t[195, 330, 0, 130],\r\n\t\t[250, 420, 0, 170],\r\n\t\t[320, 535, 0, 215],\r\n\t\t[410, 685, 0, 275],\r\n\t\t[530, 880, 0, 350],\r\n\t\t[675, 1125, 0, 450],\r\n\t\t[865, 1440, 0, 575],\r\n\t\t[1105, 1845, 0, 740],\r\n\t\t[1415, 2360, 0, 945],\r\n\t\t[1815, 3020, 0, 1210],\r\n\t\t[2320, 3870, 0, 1545],\r\n\t\t[2970, 4950, 0, 1980],\r\n\t\t[3805, 6340, 0, 2535],\r\n\t\t[4870, 8115, 0, 3245],\r\n\t\t[6230, 10385, 0, 4155],\r\n\t\t[7975, 13290, 0, 5315],\r\n\t\t[10210, 17015, 0, 6805],\r\n\t\t[13065, 21780, 0, 8710]\r\n\t];\r\n\r\n\tvar cerveceriaCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[1200, 1400, 1050, 2200],\r\n\t\t[1535, 1790, 1345, 2815],\r\n\t\t[1965, 2295, 1720, 3605],\r\n\t\t[2515, 2935, 2200, 4615],\r\n\t\t[3220, 3760, 2820, 5905],\r\n\t\t[4125, 4810, 3610, 7560],\r\n\t\t[5280, 6155, 4620, 9675],\r\n\t\t[6755, 7880, 5910, 12385],\r\n\t\t[8645, 10090, 7565, 15855],\r\n\t\t[11070, 12915, 9685, 20290],\r\n\t\t[14165, 16530, 12395, 25975],\r\n\t\t[18135, 21155, 15865, 33245],\r\n\t\t[23210, 27080, 20310, 42555],\r\n\t\t[29710, 34660, 25995, 54470],\r\n\t\t[38030, 44370, 33275, 69720],\r\n\t\t[48680, 56790, 42595, 89245],\r\n\t\t[62310, 72690, 54520, 114230],\r\n\t\t[79755, 93045, 69785, 146215],\r\n\t\t[102085, 119100, 89325, 187155],\r\n\t\t[130670, 152445, 114335, 239560],\r\n\t];\r\n\r\n\tvar casaHeroeCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[700, 670, 700, 240],\r\n\t\t[930, 890, 930, 320],\r\n\t\t[1240, 1185, 1240, 425],\r\n\t\t[1645, 1575, 1645, 565],\r\n\t\t[2190, 2095, 2190, 750],\r\n\t\t[2915, 2790, 2915, 1000],\r\n\t\t[3875, 3710, 3875, 1330],\r\n\t\t[5155, 4930, 5155, 1765],\r\n\t\t[6855, 6560, 6855, 2350],\r\n\t\t[9115, 8725, 9115, 3125],\t// Nivel 10\r\n\t\t[12125, 11605, 12125, 4155],\r\n\t\t[16125, 15435, 16125, 5530],\r\n\t\t[21445, 20525, 21445, 7350],\r\n\t\t[28520, 27300, 28520, 9780],\r\n\t\t[37935, 36310, 37935, 13005],\r\n\t\t[50450, 48290, 50450, 17300],\r\n\t\t[67100, 64225, 67100, 23005],\r\n\t\t[89245, 85420, 89245, 30600],\r\n\t\t[118695, 113605, 118695, 40695],\r\n\t\t[157865, 151095, 157865, 54125]\r\n\t];\r\n\r\n\tvar trampaCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[100, 100, 100, 100],\r\n\t\t[130, 130, 130,\t130],\r\n\t\t[165, 165, 165,\t165],\r\n\t\t[210, 210, 210, 210],\r\n\t\t[270, 270, 270,\t270],\r\n\t\t[345, 345, 345, 345],\r\n\t\t[440, 440, 440,\t440],\r\n\t\t[565, 565, 565, 565],\r\n\t\t[720, 720, 720, 720],\r\n\t\t[920, 920, 920, 920],\t// Nivel 10\r\n\t\t[1180, 1180, 1180, 1180],\r\n\t\t[1510, 1510, 1510, 1510],\r\n\t\t[1935, 1935, 1935, 1935],\r\n\t\t[2475, 2475, 2475, 2475],\r\n\t\t[3170, 3170, 3170, 3170],\r\n\t\t[4055, 4055, 4055, 4055],\r\n\t\t[5190, 5190, 5190, 5190],\r\n\t\t[6645, 6645, 6645, 6645],\r\n\t\t[8505, 8505, 8505, 8505],\r\n\t\t[10890, 10890, 10890, 10890]\r\n\t];\r\n\r\n\tvar canteroCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[155, 130, 125, 70],\r\n\t\t[200, 165, 160, 90],\r\n\t\t[255, 215, 205, 115],\r\n\t\t[325, 275, 260, 145],\r\n\t\t[415, 350, 335, 190],\r\n\t\t[535, 445, 430, 240],\r\n\t\t[680, 570, 550, 310],\r\n\t\t[875, 730, 705, 395],\r\n\t\t[1115, 935, 900, 505],\r\n\t\t[1430, 1200, 1155, 645],\t// Nivel 10\r\n\t\t[1830, 1535, 1475, 825],\r\n\t\t[2340, 1965, 1890, 1060],\r\n\t\t[3000, 2515, 2420, 1355],\r\n\t\t[3840, 3220, 3095, 1735],\r\n\t\t[4910, 4120, 3960, 2220],\r\n\t\t[6290, 5275, 5070, 2840],\r\n\t\t[8050, 6750, 6490, 3635],\r\n\t\t[10300, 8640, 8310, 4650],\r\n\t\t[13185, 11060, 10635, 5955],\r\n\t\t[16880, 14155, 13610, 7620]\r\n\t];\r\n\r\n\tvar greatWarehouseCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[650, 800, 450, 200],\r\n\t\t[830, 1025, 575, 255],\r\n\t\t[1065, 1310, 735, 330],\r\n\t\t[1365, 1680, 945, 420],\r\n\t\t[1745, 2145, 1210, 535],\r\n\t\t[2235, 2750, 1545, 685],\r\n\t\t[2860, 3520, 1980, 880],\r\n\t\t[3660, 4505, 2535, 1125],\r\n\t\t[4685, 5765, 3245, 1440],\r\n\t\t[5995, 7380, 4150, 1845],\r\n\t\t[7675, 9445, 5315, 2360],\r\n\t\t[9825, 12090, 6800, 3020],\r\n\t\t[12575, 15475, 8705, 3870],\r\n\t\t[16095, 19805, 11140, 4950],\r\n\t\t[20600, 25355, 14260, 6340],\r\n\t\t[26365, 32450, 18255, 8115],\r\n\t\t[33750, 41540, 23365, 10385],\r\n\t\t[43200, 53170, 29910, 13290],\r\n\t\t[55295, 68055, 38280, 17015],\r\n\t\t[70780, 87110, 49000, 21780]\r\n\t];\r\n\r\n\tvar greatGranaryCost = [\r\n\t\t[0, 0, 0, 0],\r\n\t\t[400, 500, 350, 100],\r\n\t\t[510, 640, 450, 130],\r\n\t\t[655, 820, 575, 165],\r\n\t\t[840, 1050, 735, 210],\r\n\t\t[1075, 1340, 940, 270],\r\n\t\t[1375, 1720, 1205, 345],\r\n\t\t[1760, 2200, 1540, 440],\r\n\t\t[2250, 2815, 1970, 565],\r\n\t\t[2880, 3605, 2520, 720],\r\n\t\t[3690, 4610, 3230, 920],\r\n\t\t[4720, 5905, 4130, 1180],\r\n\t\t[6045, 7555, 5290, 1510],\r\n\t\t[7735, 9670, 6770, 1935],\r\n\t\t[9905, 12380, 8665, 2475],\r\n\t\t[12675, 15845, 11090, 3170],\r\n\t\t[16225, 20280, 14200, 4055],\r\n\t\t[20770, 25960, 18175, 5190],\r\n\t\t[26585, 33230, 23260, 6645],\r\n\t\t[34030, 42535, 29775, 8505],\r\n\t\t[43555, 54445, 38110, 10890]\r\n\t];\r\n\r\n\t\tvar maravillaCost = [\r\n\t\t\t\t[0, 0, 0, 0],\r\n\t\t\t\t[49800, 52700, 54800, 4400],\r\n\t\t\t\t[50695, 53650, 55785, 4480],\r\n\t\t\t\t[51610, 54615, 56790, 4560],\r\n\t\t\t\t[52540, 55595, 57815, 4640],\r\n\t\t\t\t[53485, 56600, 58855, 4725], // Nivel 5\r\n\t\t\t\t[54445, 57615, 59915, 4810],\r\n\t\t\t\t[55425, 58655, 60990, 4895],\r\n\t\t\t\t[56425, 59710, 62090, 4985],\r\n\t\t\t\t[57440, 60785, 63205, 5075],\r\n\t\t\t\t[58475, 61880, 64345, 5165], // Nivel 10\r\n\t\t\t\t[59525, 62990, 65505, 5260],\r\n\t\t\t\t[60600, 64125, 66680, 5355],\r\n\t\t\t\t[61690, 65280, 67880, 5450],\r\n\t\t\t\t[62800, 66455, 69105, 5550],\r\n\t\t\t\t[63930, 67650, 70350, 5650], // Nivel 15\r\n\t\t\t\t[65080, 68870, 71615, 5750], // Interpolado\r\n\t\t\t\t[66250, 70110, 72905, 5855],\r\n\t\t\t\t[67445, 71370, 74215, 5960],\r\n\t\t\t\t[68660, 72655, 75550, 6065],\r\n\t\t\t\t[69895, 73965, 76910, 6175], // Nivel 20\r\n\t\t\t\t[71150, 75295, 78295, 6285],\r\n\t\t\t\t[72430, 76650, 79705, 6400],\r\n\t\t\t\t[73735, 78030, 81140, 6515],\r\n\t\t\t\t[75065, 79435, 82600, 6630],\r\n\t\t\t\t[76415, 80865, 84085, 6750], // Nivel 25\r\n\t\t\t\t[77790, 82320, 85600, 6875],\r\n\t\t\t\t[79190, 83800, 87140, 6995],\r\n\t\t\t\t[80615, 85310, 88710, 7125],\r\n\t\t\t\t[82065, 86845, 90305, 7250],\r\n\t\t\t\t[83545, 88410, 91930, 7380], // Nivel 30\r\n\t\t\t\t[85050, 90000, 93585, 7515],\r\n\t\t\t\t[86580, 91620, 95270, 7650],\r\n\t\t\t\t[88135, 93270, 96985, 7785],\r\n\t\t\t\t[89725, 94950, 98730, 7925],\r\n\t\t\t\t[91340, 96655, 101000, 8070], // Nivel 35\r\n\t\t\t\t[92985, 98395, 102000, 8215],\r\n\t\t\t\t[94655, 100000, 104000, 8365],\r\n\t\t\t\t[96360, 102000, 106000, 8515],\r\n\t\t\t\t[98095, 104000, 108000, 8665],\r\n\t\t\t\t[99860, 106000, 110000, 8825], // Nivel 40\r\n\t\t\t\t[102000, 108000, 112000, 8980],\r\n\t\t\t\t[103000, 110000, 114000, 9145],\r\n\t\t\t\t[105000, 111000, 116000, 9310],\r\n\t\t\t\t[107000, 113000, 118000, 9475],\r\n\t\t\t\t[109000, 116000, 120000, 9645], // Nivel 45\r\n\t\t\t\t[111000, 118000, 122000, 9820],\r\n\t\t\t\t[113000, 120000, 125000, 9995],\r\n\t\t\t\t[115000, 122000, 127000, 10175],\r\n\t\t\t\t[117000, 124000, 129000, 10360],\r\n\t\t\t\t[119000, 126000, 131000, 10545], // Nivel 50\r\n\t\t\t\t[122000, 129000, 134000, 10735],\r\n\t\t\t\t[124000, 131000, 136000, 10930],\r\n\t\t\t\t[126000, 133000, 139000, 11125],\r\n\t\t\t\t[128000, 136000, 141000, 11325],\r\n\t\t\t\t[131000, 138000, 144000, 11530], // Nivel 55\r\n\t\t\t\t[133000, 141000, 146000, 11740],\r\n\t\t\t\t[135000, 143000, 149000, 11950],\r\n\t\t\t\t[138000, 146000, 151000, 12165],\r\n\t\t\t\t[140000, 148000, 154000, 12385],\r\n\t\t\t\t[143000, 151000, 157000, 12605], // Nivel 60\r\n\t\t\t\t[145000, 154000, 160000, 12835],\r\n\t\t\t\t[148000, 156000, 163000, 13065],\r\n\t\t\t\t[151000, 159000, 166000, 13300],\r\n\t\t\t\t[153000, 162000, 169000, 13540],\r\n\t\t\t\t[156000, 165000, 172000, 13780], // Nivel 65\r\n\t\t\t\t[159000, 168000, 175000, 14030],\r\n\t\t\t\t[162000, 171000, 178000, 14285],\r\n\t\t\t\t[165000, 174000, 181000, 14540],\r\n\t\t\t\t[168000, 177000, 184000, 14800],\r\n\t\t\t\t[171000, 180000, 188000, 15070], // Nivel 70\r\n\t\t\t\t[174000, 184000, 191000, 15340],\r\n\t\t\t\t[177000, 187000, 194000, 15615],\r\n\t\t\t\t[180000, 190000, 198000, 15895],\r\n\t\t\t\t[183000, 194000, 202000, 16180],\r\n\t\t\t\t[186000, 197000, 205000, 16475], // Nivel 75\r\n\t\t\t\t[190000, 201000, 209000, 16770],\r\n\t\t\t\t[193000, 204000, 213000, 17070],\r\n\t\t\t\t[197000, 208000, 216000, 17380],\r\n\t\t\t\t[200000, 212000, 220000, 17690],\r\n\t\t\t\t[204000, 216000, 224000, 18010], // Nivel 80\r\n\t\t\t\t[208000, 220000, 228000, 18335],\r\n\t\t\t\t[211000, 224000, 232000, 18665],\r\n\t\t\t\t[215000, 228000, 237000, 19000],\r\n\t\t\t\t[219000, 232000, 241000, 19345],\r\n\t\t\t\t[223000, 236000, 245000, 19690], // Nivel 85\r\n\t\t\t\t[227000, 240000, 250000, 20045],\r\n\t\t\t\t[231000, 244000, 254000, 20405],\r\n\t\t\t\t[235000, 249000, 259000, 20775],\r\n\t\t\t\t[239000, 253000, 263000, 21145],\r\n\t\t\t\t[244000, 258000, 268000, 21530], // Nivel 90\r\n\t\t\t\t[248000, 262000, 273000, 21915],\r\n\t\t\t\t[253000, 267000, 278000, 22310],\r\n\t\t\t\t[257000, 272000, 283000, 22710],\r\n\t\t\t\t[262000, 277000, 288000, 23120],\r\n\t\t\t\t[266000, 282000, 293000, 23535], // Nivel 95\r\n\t\t\t\t[271000, 287000, 298000, 23960],\r\n\t\t\t\t[276000, 292000, 304000, 24390],\r\n\t\t\t\t[281000, 297000, 309000, 24830],\r\n\t\t\t\t[286000, 303000, 315000, 25280],\r\n\t\t\t\t[291000, 308000, 320000, 25735], // Nivel 100\r\n\t\t];\r\n\r\n\tvar buildingCost = new Array();\r\n\tbuildingCost[0] = lenyadorCost;\r\n\tbuildingCost[1] = barroCost;\r\n\tbuildingCost[2] = hierroCost;\r\n\tbuildingCost[3] = cerealCost;\r\n\r\n\tbuildingCost[5] = sawmillCost;\r\n\tbuildingCost[6] = brickyardCost;\r\n\tbuildingCost[7] = ironFoundryCost;\r\n\tbuildingCost[8] = flourMillCost;\r\n\tbuildingCost[9] = bakeryCost;\r\n\tbuildingCost[10] = warehouseCost;\r\n\tbuildingCost[11] = granaryCost;\r\n\tbuildingCost[12] = blacksmithCost;\r\n\tbuildingCost[13] = armouryCost;\r\n\tbuildingCost[14] = tournamentSquareCost;\r\n\tbuildingCost[15] = mainBuildingCost;\r\n\tbuildingCost[16] = rallyPointCost;\r\n\tbuildingCost[17] = marketplaceCost;\r\n\tbuildingCost[18] = embassyCost;\r\n\tbuildingCost[19] = barracksCost;\r\n\tbuildingCost[20] = stableCost;\r\n\tbuildingCost[21] = workshopCost;\r\n\tbuildingCost[22] = academyCost;\r\n\tbuildingCost[23] = crannyCost;\r\n\tbuildingCost[24] = ayuntamientoCost;\r\n\tbuildingCost[25] = residenceCost;\r\n\tbuildingCost[26] = palaceCost;\r\n\tbuildingCost[27] = tesoroCost;\r\n\tbuildingCost[28] = oficinaComercioCost;\r\n\tbuildingCost[29] = greatBarrackCost;\r\n\tbuildingCost[30] = greatStableCost;\r\n\tbuildingCost[31] = wallGaulsCost;\r\n\tbuildingCost[32] = wallRomansCost;\r\n\tbuildingCost[33] = wallTeutonsCost;\r\n\tbuildingCost[34] = canteroCost;\r\n\tbuildingCost[35] = cerveceriaCost;\r\n\tbuildingCost[36] = trampaCost;\r\n\tbuildingCost[37] = casaHeroeCost;\r\n\tbuildingCost[38] = greatWarehouseCost;\r\n\tbuildingCost[39] = greatGranaryCost;\r\n\tbuildingCost[40] = maravillaCost;\r\n\r\n\t// Costes de produccion de cada unidad y su carga\r\n\tvar uc = new Array();\r\n\r\n\t// Romanos\r\n\tuc[1] = [120,100,180,40,40]; \t\t// Legionario\r\n\tuc[2] = [100,130,160,70,20]; \t\t// Pretoriano\r\n\tuc[3] = [150,160,210,80,50]; \t\t// Imperano\r\n\tuc[4] = [140,160,20,40,0]; \t\t// Legati\r\n\tuc[5] = [550,440,320,100,100];\t \t// Imperatoris\r\n\tuc[6] = [550,640,800,180,70]; \t\t// Caesaris\r\n\tuc[7] = [900,360,500,70,0]; \t\t// Carnero\r\n\tuc[8] = [950,1350,600,90,0]; \t\t// Catapulta\r\n\tuc[9] = [30750,27200,4500,37500,0]; \t// Senador\r\n\tuc[10] = [5800,5300,7200,5500,1600]; \t// Descubridor\r\n\r\n\t// Germanos\r\n\tuc[11] = [95,75,40,40,60]; \t\t// Lanzador porras\r\n\tuc[12] = [145,70,85,40,40]; \t\t// Luchador lanza\r\n\tuc[13] = [130,120,170,70,50]; \t\t// Luchador hacha\r\n\tuc[14] = [160,100,50,50,0]; \t\t// Emisario\r\n\tuc[15] = [370,270,290,75,110]; \t\t// Paladin\r\n\tuc[16] = [450,515,480,80,80]; \t\t// Caballista teutona\r\n\tuc[17] = [1000,300,350,70,0]; \t\t// Ariete\r\n\tuc[18] = [900,1200,600,60,0]; \t\t// Catapulta\r\n\tuc[19] = [35500,26600,25000,27200,0]; \t// Cabecilla\r\n\tuc[20] = [7200,5500,5800,6500,1600]; \t// Descubridor\r\n\r\n\t// Galos\r\n\tuc[21] = [100,130,55,30,30]; \t\t// Falange\r\n\tuc[22] = [140,150,185,60,45]; \t\t// Luchador espada\r\n\tuc[23] = [170,150,20,40,0]; \t\t// Batidor\r\n\tuc[24] = [350,450,230,60,75]; \t\t// Rayo\r\n\tuc[25] = [360,330,280,120,35]; \t\t// Druida\r\n\tuc[26] = [500,620,675,170,65]; \t\t// Haeduanos\r\n\tuc[27] = [950,555,330,75,0]; \t\t// Carnero\r\n\tuc[28] = [960,1450,630,90,0]; \t\t// Catapulta\r\n\tuc[29] = [30750,45400,31000,37500,0]; \t// Cacique\r\n\tuc[30] = [5500,7000,5300,4900,1600]; \t// Descubridor\r\n\r\n\t// Fauna\r\n\tuc[31] = [0, 0, 0, 0, 0];\t\t// Rata\r\n\tuc[32] = [0, 0, 0, 0, 0];\t\t// Aranya\r\n\tuc[33] = [0, 0, 0, 0, 0];\t\t// Serpiente\r\n\tuc[34] = [0, 0, 0, 0, 0];\t\t// Murcielago\r\n\tuc[35] = [0, 0, 0, 0, 0];\t\t// Jabali\r\n\tuc[36] = [0, 0, 0, 0, 0];\t\t// Lobo\r\n\tuc[37] = [0, 0, 0, 0, 0];\t\t// Oso\r\n\tuc[38] = [0, 0, 0, 0, 0];\t\t// Cocodrilo\r\n\tuc[39] = [0, 0, 0, 0, 0];\t\t// Tigre\r\n\tuc[40] = [0, 0, 0, 0, 0];\t\t// Elefante\r\n\r\n\t// Natares\r\n\tuc[41] = [0, 0, 0, 0, 0];\t\t// Pikeman\r\n\tuc[42] = [0, 0, 0, 0, 0];\t\t// Thorned warrior\r\n\tuc[43] = [0, 0, 0, 0, 0];\t\t// Guardsman\r\n\tuc[44] = [0, 0, 0, 0, 0];\t\t// Birds of prey\r\n\tuc[45] = [0, 0, 0, 0, 0];\t\t// Axerider\r\n\tuc[46] = [0, 0, 0, 0, 0];\t\t// Natarian knight\r\n\tuc[47] = [0, 0, 0, 0, 0];\t\t// Warelephant\r\n\tuc[48] = [0, 0, 0, 0, 0];\t\t// Ballista\r\n\tuc[49] = [0, 0, 0, 0, 0];\t\t// Natarian emperor\r\n\tuc[50] = [0, 0, 0, 0, 0];\t\t// Settler\r\n\r\n\t// Otra nueva raza! (demonios? ojos rojos?)\r\n\tuc[51] = [0, 0, 0, 0, 0];\r\n\tuc[52] = [0, 0, 0, 0, 0];\r\n\tuc[53] = [0, 0, 0, 0, 0];\r\n\tuc[54] = [0, 0, 0, 0, 0];\r\n\tuc[55] = [0, 0, 0, 0, 0];\r\n\tuc[56] = [0, 0, 0, 0, 0];\r\n\tuc[57] = [0, 0, 0, 0, 0];\r\n\tuc[58] = [0, 0, 0, 0, 0];\r\n\tuc[59] = [0, 0, 0, 0, 0];\r\n\tuc[60] = [0, 0, 0, 0, 0];\r\n\r\n\tuc[98] = [0, 0, 0, 0, 0];\t\t// Trampa?\r\n\tuc[99] = [0, 0, 0, 0, 0];\t\t// Trampa?\r\n\r\n\t//0-attack 1-lostunits 2-load 3-maxload 4-food 5-statushero 6-lostfood 7-trap 8-i 9-c\r\n\tvar ats=new Array(0,0,0,0,0,0,0,0,0,0);\r\n\t//0-def1 1-def2 2-lostunits 3-food 4-statushero 5-lostfood\r\n\tvar dts=new Array(0,0,0,0,0,0);\r\n\r\n\t// Travian: Battle Analyse\r\n\t//0-att 1-def1 2-def2 3-lumber 4-clay 5-iron 6-crop 7-food 8-speed 9-load\r\n\tromans=new Array();\r\n\tromans[0] = new Array(40,35,50,120,100,180,40,1,6,40);\t\t\t\t\t// Legionnaire\r\n\tromans[1] = new Array(30,65,35,100,130,160,70,1,5,20);\t\t\t\t\t// Praetorian\r\n\tromans[2] = new Array(70,40,25,150,160,210,80,1,7,50);\t\t\t\t\t// Imperian\r\n\tromans[3] = new Array(0,20,10,140,160,20,40,2,16,0);\t\t\t\t\t\t// Equites Legati\r\n\tromans[4] = new Array(120,65,50,550,440,320,100,3,14,100);\t\t\t// Equites Imperatoris\r\n\tromans[5] = new Array(180,80,105,550,640,800,180,4,10,70);\t\t\t// Equites Caesaris\r\n\tromans[6] = new Array(60,30,75,900,360,500,70,3,4,0);\t\t\t\t\t\t// Battering Ram\r\n\tromans[7] = new Array(75,60,10,950,1350,600,90,6,3,0);\t\t\t\t\t// Fire catapult\r\n\tromans[8] = new Array(50,40,30,30750,27200,45000,37500,4,4,0);\t// Senator\r\n\tromans[9] = new Array(0,80,80,5800,5300,7200,5500,1,5,1600);\t\t// Settler\r\n\tromans[10] = new Array(0,0,0,0,0,0,0,6,0,0);\t\t\t\t\t\t\t\t\t\t// Hero\r\n\tromans[11] = new Array(1,1,1,0,0,0,1,1,1,1,0)\r\n\tromans[12] = new Array(0,0,0,1,1,1,0,0,0,0,0)\r\n\tteutons=new Array();\r\n\tteutons[0] = new Array(40,20,5,95,75,40,40,1,7,60);\t\t\t\t\t\t\t// Clubswinger\r\n\tteutons[1] = new Array(10,35,60,145,70,85,40,1,7,40);\t\t\t\t\t\t// Spearfighter\r\n\tteutons[2] = new Array(60,30,30,130,120,170,70,1,6,50);\t\t\t\t\t// Axefighter\r\n\tteutons[3] = new Array(0,10,5,160,100,50,50,1,9,0);\t\t\t\t\t\t\t// Scout\r\n\tteutons[4] = new Array(55,100,40,370,270,290,75,2,10,110);\t\t\t// Paladin\r\n\tteutons[5] = new Array(150,50,75,450,515,480,80,3,9,80);\t\t\t\t// Teuton Knight\r\n\tteutons[6] = new Array(65,30,80,1000,300,350,70,3,4,0);\t\t\t\t\t// Ram\r\n\tteutons[7] = new Array(50,60,10,900,1200,600,60,6,3,0);\t\t\t\t\t// Catapult\r\n\tteutons[8] = new Array(40,60,40,35500,26600,25000,27200,4,4,0);\t// Chief\r\n\tteutons[9] = new Array(10,80,80,7200,5500,5800,6500,1,5,1600);\t// Settler\r\n\tteutons[10] = new Array(0,0,0,0,0,0,0,6,0,0);\t\t\t\t\t\t\t\t\t\t// Hero\r\n\tteutons[11] = new Array(1,1,1,0,0,0,1,1,1,1,0)\r\n\tteutons[12] = new Array(0,0,0,1,1,1,0,0,0,0,0)\r\n\tgauls = new Array(10);\r\n\tgauls[0] = new Array(15,40,50,100,130,55,30,1,7,30);\t\t\t\t\t\t// Phalanx\r\n\tgauls[1] = new Array(65,35,20,140,150,185,60,1,6,45);\t\t\t\t\t\t// Swordfighter\r\n\tgauls[2] = new Array(0,20,10,170,150,20,40,2,17,0);\t\t\t\t\t\t\t// Pathfinder\r\n\tgauls[3] = new Array(90,25,40,350,450,230,60,2,19,75);\t\t\t\t\t// Theutates Thunder\r\n\tgauls[4] = new Array(45,115,55,360,330,280,120,2,16,35);\t\t\t\t// Druidrider\r\n\tgauls[5] = new Array(140,50,165,500,620,675,170,3,13,65);\t\t\t\t// Haeduan\r\n\tgauls[6] = new Array(50,30,105,950,555,330,75,3,4,0);\t\t\t\t\t\t// Ram\r\n\tgauls[7] = new Array(70,45,10,960,1450,630,90,6,3,0);\t\t\t\t\t\t// Trebuchet\r\n\tgauls[8] = new Array(40,50,50,30750,45400,31000,37500,4,5,0);\t\t// Chieftain\r\n\tgauls[9] = new Array(0,80,80,5500,7000,5300,4900,1,5,1600);\t\t\t// Settler\r\n\tgauls[10] = new Array(0,0,0,0,0,0,0,6,0,0);\t\t\t\t\t\t\t\t\t\t// Hero\r\n\tgauls[11] = new Array(1,1,1,0,0,0,1,1,1,1,0)\r\n\tgauls[12] = new Array(0,0,1,1,1,1,0,0,0,0,0)\r\n\tnature = new Array(10)\r\n\tnature[0] = new Array(10,25,10,0,0,0,0,1,20,0);\t\t\t\t\t\t\t\t\t// Rat\r\n\tnature[1] = new Array(20,35,40,0,0,0,0,1,20,0);\t\t\t\t\t\t\t\t\t// Spider\r\n\tnature[2] = new Array(60,40,60,0,0,0,0,1,20,0);\t\t\t\t\t\t\t\t\t// Serpent\r\n\tnature[3] = new Array(80,66,50,0,0,0,0,1,20,0);\t\t\t\t\t\t\t\t\t// Bat\r\n\tnature[4] = new Array(50,70,33,0,0,0,0,2,20,0);\t\t\t\t\t\t\t\t\t// Wild boar\r\n\tnature[5] = new Array(100,80,70,0,0,0,0,2,20,0);\t\t\t\t\t\t\t\t// Wolf\r\n\tnature[6] = new Array(250,140,200,0,0,0,0,3,20,0);\t\t\t\t\t\t\t// Bear\r\n\tnature[7] = new Array(450,380,240,0,0,0,0,3,20,0);\t\t\t\t\t\t\t// Crocodile\r\n\tnature[8] = new Array(200,170,250,0,0,0,0,3,20,0);\t\t\t\t\t\t\t// Tiger\r\n\tnature[9] = new Array(600,440,520,0,0,0,0,5,20,0);\t\t\t\t\t\t\t// Elephant\r\n\t// Travian: Battle Analyse\r\n\r\n\t// Imagen de un sobre para enviar IGM\r\n\timagenes[\"igm\"] = 'iVBORw0KGgoAAAANSUhEUgAAAAsAAAAICAYAAAAvOAWIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QsKFws6qttDxQAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAAkUlEQVQY05XQTUpDQRAE4K8yz9BuPEduEH8C2Tw8haeT3CQbPZEiIeNmhLdIAvamqerqaqqDdxxwcr0mvAWv+MYHfi4I13hErXCuqmOSp9batFS11qYk26o64gzzmCXJPsl64DvskYHn1cKo995PvfdnPOBl5OjLa/PY3qEGtxm9Bh/MfwG/8Hkj4Bb3+c/rfgHKwRzhskmMfQAAAABJRU5ErkJggg==';\r\n\t// Imagen compuesta para el mercado con 3 secciones: enviar recursos, compra y venta\r\n\timagenes[\"mercado\"] = 'R0lGODlhRgBkAOf/AAABAAYIDhUDABgJAhAPCgQfBSEXBAAbTh8YDRsYHRcYKSsXAAQhQkcMAB0dGygcAzQYBDoeAyglFTEiDSYnERgyCzkmB0EpAAI1cSwuKiU5I10jCTs0D3cYAkMwEDs0HUkxC08wAjU5HEwyBD80HTk2KjU3OlYxAig7UEQ2MSJTAwJLiSNCYBpUIUs5Nz1APE09IVg8Dls5HFVADUhANUJHIVBCGEhBOy9WD2k7CExHIDpITUFGSWlAB1xANA9sHoI1EmdFDGRGFFVKKm87NVNFTC9ZVY42E2NNETVSdkJQYWRMGk9PTU5VNlBXK2FRH1VSRjRmOXNPEmJORlFUWHxPAGtQNHFSIXtSDWleF1RkOHFaKIRSIGBjLzOBCVlfZVljU15fXH5bHkBlk2RfWMI/CLRFD0RnjHlhHHdYVIlcEIxYIIlfBHBjN1dkeIdeGmhnTYVlCVpyPnZkPnNpMWBxVoBnOHJoXW10LmpxSIhhUZxkDHhqUWpta4hyBnJxSJRoHZloEm1wYmB0dn50KJNsJ99NBXZycIN+HoduaatvD3p3daFzIZV9DqhzEJ1+AnyFO0uEynp8eYh7W3OJTHGHXYyBOXl+gp96MHx/dnuCcLV4Do54e558RbF9I759CZCKVpqRG4mOaqiRCoGVY8iEEIqNio6XT8GHJIeaYY6RiJeRcpyZO5KSgYqSmrWaEJCVl5KjaM2SLNWTIZmcmaCehMOYSpyflpWgrZmmgpqiqsyrAOSbHaCmqN+gL5yruO6hG6mtqaa4jam1or23aqmzt928Aq22q/GsMbO1sqa6yMauuMK3l+fHA7e9v+zGAf61MbTHqrfDyrnNpvTPAbbI1rzKwMTGw7zSor/Ky77L0sLOvLzVrMrMyf3ZAtTQwsXZu8bT2s7VvMnYxczX2M3a0svY59XX087a4uzV0tze2tPqwdrm0Nfqydbk7N7o3tfo9+Xn4+Dp6+fr2ufr5ePw2d/t9Ob23+/y7uX1/fD26Pj37vb49PD7/P3//P///yH5BAEKAP8ALAAAAABGAGQAAAj+AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzpk2FknL2ctZNXbyfP891cwZLEs1e3fwpXcq0qT98RGEuxeePn9Wr/ARiZQoV1qGU6qb6s/e0qll+Z6+WReuvm0lYYcuSVTrXHlW7Y/PizUfVqtJrI5MpZVs2nVKqThEfXtx3cK9FHmHJG+xv8uR8S9NZ9pcOH7papOQZ5kyXaj5+iN1uDLMILT7EVEe/dtotFqtXjUj1U4p5sWHX/uJtnEy3stO5VPFtIxVqFzVv1EINQ6x56e7ZaLNibLx0M3HS8L7+kWrknNqzZ9SMnVJH2LjcxfwAWyxNuv7dv6dCGTNvzFiz89FJU9Z3xN2HmDMUhdUeU5iNJk8miDz3zC79NWPhebsIM1d9pAGHHIIRxcWZd03hMwwUUgTySnq7/PeMi+ZZItpclyk12mBoxQOiQyIy5eCNx3CgxiaKqLGfhf814x96r0Tj41K9TTYaWufI1xA6Sk22YVP5DKPDHkRuAkgj1FjYn3//edMMHt18V5Z7/vBVFT/9FGOlQkn5mA9Z96WzDh5qfLLJoHtg4s2LaCLZzCtOiJPXZhzqlWUyDUnpZpZKgROLHGiUUsqgmwQCyIVJomfMK4QEU5ZiTMnDKj7+aO2oUFNSLjWNKF3EMEIMWCjy6aBqOJckNbg14kcX47Bl2GTwuLesbMH1stB9bsazTR5bBBGEFG8EMYEUgg4qxijQKblLHB4IAYIFdIAyT282OjUVYtdImxCtecXThQUeBIHFEh70qogimwi6RyHG7GJLIzMg4EEVEVSSiw1/1IKPm82mgxmfeVUGi6wExVPfjfjMI4ITlMDQRitPfPKroJ6UIgQHSMywRAwBeODJBLmU04ooOszBDD753NiqWP4kQ+lBXLr3jRPDMMNJJeps8YmgqIS5CQjfcutJK1bwMosleQwjTC611ACHk8bJs09sTyXnzzmwINR2ie908U3+LS5U0o0UnpYiqCNEgiAEIJ4g44kPMkhRSCmegCJHNOxoAUUX9AR3jCqQDKPPm2NR9THTmC77lDpdiNMHBiiA8YQaQuzxqSOCBnHFG774YkYDAUyxTCKdoMIIKJXUUY4c8+AzjRMy9PBE2eps6U8vSxO0WJxilaNFLElgYIQGD8DAAQKAhxmEGJ74IosLKEjASTqcFOEJNLJg0kYqlNTDzz7f5OGBFFhAgx1qsSyqdKMX5ygIpuJlnHNwQAMrOAAFnsCvGIhBCpv41Qh0Rj8lMGAAMEiBBN4gC18gg34P0MTb0HKNGgzhCjmYQQ3Y0SpYqEYg5+iODvdWDjRIQQH+HwgBCEaAPlkE4moZnIABGIEMX0wAAULwRAwC0cQSMiIGA7gEO1yFj6dBQRCU0EINvqGl1/QiGwTpkcbKUokFwEEHskDFG2YgBFTI4o5bCNQsSsGvK4DAE3HM3R3jWIglWGAGF3hBNroxjW/AoQYsGIQ+hOGEbXBlJwQxXWbw0Y9VRGADG5jBGzwhBjvakRetwMUV9lCFCXhgADswQQ5MGEdZeOIK/JpBDCwgAF3kwxUfMIAEVuAGf9BDb6ShSjGql40ABEAAzgQAAAIAAHWswQxlMAMEAlDE3PFiD5mAhzkkMYAFLAAG2chEAgwAiCa+wQPwlEEIIvABSYTjF1b+6MEDIJCAHWCjHF2YpjOpWQx7/aMbfblKP/TBjmQcwRBl4AIMCpAFRsgCGZ+4gi6qoY1+5MMUNyCDLnBxCVpkoAQysIEHYhCDIIygBF/QRj6YQD5UBEIGEJiBDYbQBXYkNGnJSOA/nIEY14gDG9M4RyKAIANWQMILOODCJjCRiWrsCR3acEc++iGPLwBACUMhAwEQ0NITgGAR8vCoNqaQhg+MoBSoAMQMALGHLqzjKf9ASzYQKJBr9CUer4nGNszhjmqEQxuCwIEXVDABPlTDH+K0hzvC4Q552EMevfhCMeJU0AEI4AJQKAY/pLHZcIAhCsdYxASq4AtGAAMQYJj+Bnb8US+htokx7ShHNqqBDnf0oxp1wIEmZOoOZ+iBCL3IBznQ0dve5sMc1dCFTHVxA1NsVRcm+AIuvvCDH9AiH8pYhBiwYAddyEMd10DNU/aqDhwa6CnsYMc4pHFYczwXHv3oAwIksIAGUCEf7iAHObIhj3zowhKjeMUrQJENj+LDFTzggw3scIcWVMAEjwXvJaoBjwBHryzO0EV7/3GOyfwjL35hBz2skQ132EMbRYimNKVJgC9QAQDSyIc0/LAL9DzDGH7IMTy+YAdbCKETWwiAApIRDnLYAx7wYG40wLEUsiSjGCP2CVP80g+rTKMc8rjENAFQglIoYgwsmPH+NN1hjj84p8fP8MYrTNEPV8yYmtKk5iXQYQ908EDN00zAU3pxDXkI5LxxM9Bu+KEOB8yYFspAchLG4GhpvgDKq4Dzj3dBiGr04xclIACgM+AKyaLjGsPQRAak6YBF5BAfhCYIluBUVH+sWppfsKo7zhCJMQTCA9KcQHLJ0QZLEOPYdLgEPMKhDnSQQc0ZyEc+wnGNadSDKrQAQAYI5Iob/uMaOkymPw4xYwJ8uclMSEISCoEKaUZgAsHIxhfMAeVf3gLAfDbHnR1AjmtsQx71KEsCAgArfNgjHeqAi6zjVReoqLkPJbOGOWhBAzIoYxKinoEHgHCEL9ijHyCHBRn+eNAHdGTDHia4czTe8R4x02JLzuiFodMoL3+kfMYN5sc6wLFcc8jDHDyA5xjS0AELwMEUtMgEDATQAB/AQx7ZuHGej1EV6hDABGKBdfUGEhYSnQPQVceHPtYRjWtoIxz5QIcbIrGDC0jhBCcIgRBPUAY9RLkYfVCzKfLyGiYEwHRUkQcsyGEQEdXKFGq+QVHRoo9xsFiyv1DCCLAgC0YAQg2MaC0VnAFgctxCzVRgSjECYArgTOYasBCOQYxWFa/OOPQc46Q/2PGOY3A+G1CwwSzUd1Fg2IG31njH59TMA8NcLAEpwItsMHkQcjCGHzdQ8yXekxw6tUMc4TCHOS7+8QZUeH8TV/juNsDRD05WeppLWQQAwN0UdMBCqAeZNWJuPs33cSUt+HiHNchxT1VMohW6UAzkIA/3sBZMcGdEdQ4BcAjv4Sq00Av4kBA5tBkHOGPTRxaGQRZ8Ig+ooQ/v8G/0Rg7ccA/64BfJIWZ5tgz4YAImYHA+kg664G0GgQ4kg3gzhnX3pxSwkACT8Rr6cH3vAA7vYBXvFQzSl23LEG74oAvBwBDFQBwHB2jpQBa1gg/LAACLABuY0Q8A4CGMkQ5qZgIE0AeoERuYkQ2LUAxXMhr5FYajgRn4AAsAEHpwghoC0DEjMhZ0AmgJUB1MkXAgkxADuCr0BwAJ8DH+y7CDAHAIhGEPhAEASMMVhbhZC5QOv/B+D+EMrpJ+ogZoAOAASVgr9AGJfJclsOIPYTBjTCA3hpEPzkALaAQRzqCCfSEPtBAGL3ADJiAJgnEdxSEbAKAYxPEb/mCDAdCDTNENi7AMqgcRJ7cWcSJ7gwEbvFF1/hAANoIYvQEr5yAJi9ALVTYW3eAKzjBiIZKEHLMqpSiK90Fw2AMtW/IatdINnNAL5igR8qCC4oYXcBKOg4GN+PKLTpENsCBiF6EOWFaJmbExvlEVwWgcc8F6VMgZznAJyXCPFZEO0qCP4eYjxIEZ/ACQTpGBaDEa7tALsHCRHHEOy9B1NtIg8jK0GQRXKx9JK+ngCnzlEe6wDNWwRk1Rku7BD3eIPdczIOegCyk5cx+BD+cwi+pAIkdzjTpkGc+iC6aAQNohEvYwFMugGVAobvggAJvIIafmCjh5DhF4EvJADs4wi84wheEGkIGXDsswUrTQkmm5EvJwDtKgC365E8vQlgCwDMngl2ZJPSU2E/iAcEPhDErjDMt0Dd1QYll5E4nGRXl5E5q5mZzZmZ75maAZmqI5mqRZmqZ5EAEBADs=';\r\n\t// Imagen compuesta para militar con 4 secciones: plaza de reuniones, cuartel, establo / corral y taller\r\n\timagenes[\"militar\"] = 'R0lGODlhRgBkAOf/AAABABEQCBsbDiIZCBobFiEfDRgnLiYnGCUnJDAmDTAmFT8kCy4sFjcxISM3PSw3NDM3KDQ4ITg4HEI1FT43Fkc0FBw/VkE4HjFAICpDPFg4FUBDJVI+FkhCIEVBMFk+Dj5HLlJAH01EGUREPSZMZEZGMUBLJ1lEHF9IIWxEHFRPKi5cUVFPQmRNH15RHDtXYEpZL1JXJ1NTPmhQFXFNDWtNHm1OFXNNF1lYK2BVKVJVUmtZCnRTFHxVGFxhMGZeKJpJF1tjO4BYE4JZCzRokVVoOnRcL2piNGlnHWVjQGJiVGJkTIxcCIFiEYBfKIViIGlvKnVpNINuCWlzOFxzYnpwJGJudH9yEGV0T2N4QpFqFG1xWJtoDW90RoxqMYFtQnhwTDmHg5drIG5ycpNtKqJtBpx0FqlwDG+CWJV+CZt1L3aAXKF0MJGAHJd3PXaAZ4F9W3GJUpKALONeEah5J41/UXSNTIOHRad5LnyBgJd/QoGCb5yIDaCGDrh6DpqEPH2OV2qPh5SGSIOQS61/NKeMBoSVQ4COdamEQ5GJa4aRZ3yaVpyVPaqNR5OQeJ6SVZWTcLWMR5GTiryMPZCVl6qdJky1p5+Wa8iOKbyeA42pYoqtYJiif5CpdsKYTrGeY5ygmtSYMpuli6Gijaigia6ieJS1XaqkgJOnscusBLCmdICztsygUaGmqOGfLJW6a8KoVMOtQqG4eJnBadW1Csm0P9m4AN2oUaa6i7e0gNmrVruzjbS0nqTBha24nqy2rbKzsOHAA6LOb4zLz+O0Xr26q7e8v+zGA8W8o63OiOnJB7LDy7bLnsm+svG5YLTPk77Ftq7aecPFwvHAY83HosXKrcjGvNLIm+fPR7Xgd9TOk8rMybTmfL3dl73hjtXNxrbX58/UvdvTpcncscDojM7ZudjWsfPbTdDWydTW08jsm+Pbrdze29Duqeritu7msdnxuurmyeHp2uXn5Ono3+Lu0uLxyvDy6PDy7vf1y/n00fb02/n25/b49P7//P///yH5BAEKAP8ALAAAAABGAGQAAAj+AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzps2GrYxtYzevZ89024xRqtmqmwQGCSLMyuavKYCmUP3hM/aSUrp+/tT5+MOAgQQY9vr1AyC2LNamU4eipMSuKdZ+3F6ZaPTHTj2xZM2W9Xd2m9qRbJvmixYWnz9yiLlFyxbt3lPDhvWKbSptZLG3905hiCbVLLcDFLI4lioV8mR8e/u1+khJ3p4S+bBCKDFrcll7JnYcqffY3zzS+FC/3buNo448/vbtgRAPHz8QGTaRphdNnb0iM0Rwe/q7affuhov+lZs8b4zG3+byjWJAqp++F2E6/Ya7Z1O9TQwoRHvqvb9v4eUMg4ZtlV1kGDUlsNfIKf3kE8ADwnQWzTeAbBPNBgcIA4AxHHKYjm9QGYZEEsKVVSBF8+mzxxKQPEANPvoEoIQw3pCzzSyCLBJOOd10swcA6aTDDjvGfGMMOMbMI9YefRQyH198GcPORG1hZY4CCySyRDz85MMCNdEIAEFcsMDQTTjjMAPKhsakI+WbRPK1ygp93BEcaVIZw4w1EFVpmDlApMBLNfpsIEM+wMyiBAHRCEPAAc9Ek0UXXQBAUJHpGAkUOk2k0Ucf8+01jzGBaOJQW2j5E48HS/Dj3ij+B8QDzSsWOMANNwEc0M4sLjSx30C40NFMm5pOEQsffPTxSImTpSPNPA0NWRpf+ywBh6u7rCAAMuPYQQQJ2XBjwivc2NGECLNYygsTZ3BxhkBAbVNFLG30gWw46JDWzyhprHGiQts0RQ8/rrrDQjj34OOIJQ90A40wAQRwazT/kCNCExNkAcAI7rJ7xg4CbSMKNi7UmwYfV1ARRD/sSJFsG8A01J0MHrjTD8GubkONARl4848pBYAAz0DCFCABCKNY6q677d7xTzIuyBEANmm0wcciccwSxaf2piHUXwdJwxc/JcigD1aobbNNPgX0/E8cRUTTDjxDc5NFFnb8Y+n+JEyfwUQFHMCBTSDDYCNHH2lQMwWy9trLxyA5KTSfOAEYoA+UOm3DywZ2CaRONDDAIIw6dpiwyDh6/4OJGFwwoUECZEwjxzm77BLLOWnU8UgVnxbS+MnSgJKQ2Fgl4gAJ+aCGj5vfUCMMOQK1I0yvM6DxSgc7bCCQpaFgcoMNAWjQAzGnUOPOOtSccskftciBbLLInqwJ2AX9Flw4BBBweT/b6LMFNQSxxyKoBwthdKAJBYjA9nDRvR7g4Q8hQMQ11uGOUqxDHOuIAjYS8IM0eCpZ9ioEEoARM4MYwy3+4McSYNOPNlHjG45Qx0DsAQMXCOARcmlCAmAgie3pgxD+oXiCGswRgV18oQynUMI1qEGNR2ADAAGwmuPScIVY3IMd9BMI8cRCjQOwyh/f2IY5AsAAU/0jG8IogiACQC4KbCAAEBiIpf6hCCE8oQal2AUYEkGKGnzhHegDwy4CUIvGSeEcckiEPPBBCarUjy9oc85UMqWERmhAGP/gRhD2oJhokIMbEQhCFggyR4G8ow4NYAM1MEiNXbAhEecTxy6wUQg+xCIWp5BHWUhoELcIB0pAKYcp3MgNgSwiB5qAXiazkYyClFIgxTACNYzghnWsIwQt2MUEKciIHdRCFXeBJP9akY5LAUcsd+LQNz4DgU2QYxMRmEMQNtAFZRrkmQP+2UcpwOCGRLzjn+sApDjcAQdrlCUyvqFEcQbyIRDhqU1BesUmNhENXEWMAyIgwCwQgk+CJGIdKLCmNTEoDnOoDW2l6Qc+WvEvVIGoO23SSTbsIRBydIABAZDDD0bJUYXwI6QiXQc//qG2Nt0JRP1AhSMFgqrukAYo5SQINyRwgA2QSyEdNYg+MOgOhhbphA4VCy+1CICymvWsaE2rWtfK1ra2dTUhi4xe1Ka2imR1IcAgRZCMIdeyGOMXA+ErlEzTprrGYCJ3JUgHzPgPY+gAFUZqC2oeSk4tRgah/nCT2gxBC2UgISKJhWYIUBACXjS2FVY5of2IA1eigic4hoH+qDFS0dljBIMPDwntPzSAgt6i4ARUQG2moBKqfiyjtekwjFObkjk50OIYtrWtLSoBCYaEdgu+PUELODACSlihGCc8KmSkgdzvONRNnEhFMI5Bi0zYArrBsEUmnJaQjv7AC4P4h29bcAIU1IAFlFgGCjoQMHz8xn5jFYhTV+uPbWTiuco4RoQnrIz4pgIKPSUIM8jABi88YQL+7W0NUJAHYwgYBRpgQVQME7mBSLY/hmkCLdY74egGQxkRji8tdsAMZxbEC2TAAyGErIYK+DYEy2DHCHyrgBAYuDQsNadDUQOFK6x3vZlQL3S3POMKF2AAPZYjQRThBDWw4cxs4DD+GUZL2hCkoLca+IInlvBShRKkoQ6VSiXakArbnoMWqchxhZ97jB304I6iEPNAOKyGRuOBDY8mA4c1wGbSViASHmBFCJqSDrYQBBwOnUdwxGIEPEjhvdHdcjCu/AEeCEEITehh6gTSAjIQQgyEIIQaCIHmNJOBDv3trRucgABWeCIE6DBGK6BFkLYs2DccYFofHhzhLUtYAa/mQQ9sIAQFzrELZDAzpNmgBjyYm8hmxsMFQqAAT0zCE7cgBiLm0eJPh8gfXziDEFrnBy744QzOzYSEK7wDO/Lgez1wAidmnYUgD3nXum60uMmtAU8swA2eyLgRItEILEa12S/1BwT+psAEjzHND2LYAaELYYMeCEHbNxBCD3wx6390Apvm5vCQHy1kPKjhC8QwwgVQYAQUeMETevALswsCarRMAR+8CMENuED1dpWBCzfI8iR6wIMnbJsH2k70M3WhaRToGs0RL/ItEOAJK9xCAU44uh7qXZBvkIYdQrhxE1wxAA34od9ceMIR/pEDTPTA5S/neg/EPpBX6MIZkWgAAVqga1s/mg2IiATbvUCMEMSdFYiwCkJ6wpdjNCETmRBDKCoAxQ/g4BsDoYAraMB1bWvbBqZ9Jiuc4YYGICAAAHDCmXetAGKwguwhcIbnncCKRrT2IB/qhxRqUAVTwMEVFfgFLg7+oTZcKMIHMwjFDG5waLALwQY0fyYxiBF5BBjhFp6IRAUIcQJPEMMZ6y82CuKO9I8fRFr9UAX3cA/lUA1ZcAlZMAhq8waM4AM1EAq11wM3cHuFoAylpAme4AyIoAIK4AVucAsngAXYtHuecATfoAKesH9OoAtgsHQJgQ+ygAa6JBa94AjaAAdgIAlosAfQIAKzN4Gu1nJP8GAAMA6QkANOYASegAjNgAK+kAB7wAzbkIFLOApiYQIpSGJoAAqJthDboBcdIAv4kAufcApZAA3bUA0SEAo2IIRt+AAvYABpAAAH4IFf4AGEcAHNoAnbgAacIA3p4AnTAHpK0g9BwAr+XfANlCANVqAD0SJOMBAETwAHOSABRfAN0rANPmgD2jYBL3AcqLAMeqMCN+cFbBACFWAHmdIL2yANWBAJ0yBvOMAO+AACrAAIqJUDOlBmebAQSYJOdlAEmiAAorAI+PAMDSYCdDADFeAA3oUK4EAFiyAPAAANAkEKJvAPFyCFhXUIeSCInjBsF+APJqALd0AJWzABZEABoPAGDCFYwcEMi2ACivCF/aBLbZAJypAG4GAF4HAIsxBVc/QM0jAFrbgNQGEMyTAK4LB7rOAG7MAC/XABujAF0kBz7vgQvyhO49ALZSEPQTBjlbAFJoCQdLUNAHCSCBlTfJEM5QAK9hf+CYIgD1vgD71wCEsVZhoZKpDUGXqRDstQVPGSkiZJLNF3j1ixfp4gCMe4DHnwfBPxiyrFF5fVk2eRWZkDJDHlJkilUuPQD4AQf0fQD9BACVBJEW0yLXdiGspzlVLBH1FBGsXlFqOSByWEEUSSJKEGIpDhHbDlD9wRcoYhTmXBDqh1lxpBJM4WlwcWl6jRG8olmP8hFK0wJR6Rl/4Aao3ZH6IWGfyxXPc2D4bZSCKxPBziUuYFYwAwmAfWmKKJCmZpmSPhD8agVEeymd2BF/7hHeywDJRglv5XEqbZITyxmfiwmiCCJBzym23iEvPgJrWJCrZpDNLAJkpFCaiQE8Em+RI9wQ5GwiEk1CFLdRPkWZ7meZ7omZ7quZ7s2Z7u+Z7wGZ8HERAAOw==';\r\n\t// Imagen de una grafica para las estadisticas\r\n\timagenes[\"stat\"] = 'R0lGODlhDAAKAIABAAAAAP///yH5BAEAAAEALAAAAAAMAAoAAAIVjA1wi82eFJP0RIhD1Xn77mhKIhoFADs=';\r\n\r\n\t// Imagenes de los tipos de murallas\r\n\timagenes[\"empalizada\"] = 'R0lGODdhSwBkAOf/ABYJAREMFBIRBCIMBxYQKiIaDS0YACQdAhk3AEAkBSEtODsnEzoqBjQuBCotJiwzHkcsAEIwADgwH0EvMS1HDEY+EyNSCFU4FVA8DktCAU48GVY8BEBFEmU3BFNBBWM7AkxGLyhhAkhMQF9ENj9bFEVPUGxLAFdPKGJRAGpKEUpTOHNJDGRTDSxyBH1HEDhsBmNUGVpTOWlPJkJiLlRbJ35OBWVXJTxuG3lWCG9cBnRWGWVbNGNkIDh/CGNiRkh9FndnDkp7KH9mD2BpWFp0LodjEmBqaYJmKV11QV9qeo5pAZhjCHtrLVN+OnZmXXxqOXJjeoNmPopuAXdtRYVzA0aSCYxoMHtrUoRyGnJzV1SMJW51ZZt6D518AIqCF7ZwAJR/DqN1G5N+IJp7H1KhGFCoAmWSQK51HF+bM6x9A4l/WJeIAnWKV2+QSoKDZZCFOZqBOX2FdJaCSKeGBlOzC4KApZGMT3+LipGFe6l/X2GxHIGTcqyLKqOPMLePDpmRZpOSc7OUFV+/FomWgcWQBJGThK2aHIqdbIeiXnavSMCbAaWOl4KqYbqhALqcO7SbW5GqdJimhqWhhJ+khaulYJimkLenQ7yjVqSkk9SkEcWtFM6qFLCofs2rMcWyOMquSKq0h567hqCyseOxBaqusd22Caq3lqi2oaCy0Leylda+DJXNbbS0o9e+Wa/Mo8fBoLXGubjIqODFTLnHsL7Io8fIi6/G2rHJxrzFxcbEsLfVjs7Hm7jSnsXHvsfQn6jawMTXyc7YstnVrc3Zwc3butjVwMXb2d3Wtc/X2dXYzsHd6sXa+dnmxtzkzNfnzcvl+d3k09Dj/drtudDq7+npu9Ts59Xp9c/s9+vl0eroxd3vx+DuztLt//HpweTs2PbqtvTqvObq5+vsz+fr4fb0lOH02tb0//7n4+bv+uDy+/3xvNz3++321vzwz+H39er16f3zxPvzy/ny3fTz6vD34Pr4wPL18fn5yvH2+fv41fz9vef+/ff68Pb7/vn7+P3//CwAAAAASwBkAAAI/gD/CRxIkKC/gwj9FVzI0GDChw0jSlzYr2I/fxYzYsx48eLDgwI5cvznsd/EkyMRekRo76O/lvPs2cOHLyFMlwdrKvynsCLDjA1NCnQps6i9mEaN8rP3bt68cU/HJRsHFanMc/b+nUPIM6RIgj4pIjx38VxNe1iLhkv61JtbbG69QXM2bNYpWsWmQg03LlxMf/PO8UxYkDDJi2C9XqT5Ep9MvkepUoXrtpyzy86aMYsVKxKbQ6ZiDSsGrTQ0bNjk8aMnr/U8eefmJayIESRJg0JtynTslKo3uJTFbWsmjhmxYMF4+QoFqU2TJm1CiRZNa1izbO3yaW/XTp441MnC/vkT/LGrw35mizp+bO9tOXGWvV1m5oxZMFe8QjFC9DxIEOiQhGKKKbQcQ0021IADTjf3xANPN8ewkksyM6m0klA+9eQPTfhgtRZf47jVjDPF0bdNfc4kxwgjiSSChn833OCfGfuBdkw34MSjI47dxAOhJKwUM05L4x2m0E4DlZQWTfb41RaJKNbHzInG6cIiGmRUocUNTcSoRZZotAEJLdncQ02PO1IjDC2hDQPNkPigd1BHO3lE1kVN5hkOiPKJI6Vx2kiDWShY0qEHGS00gcQMN1RBxqFoIOLLMe2Y6aOPvrwSiWjOvDkPY1wh6dVLM+nJFzQjzmccMbG4Io02/tCUo40ZaECqBRtxqBBEFXrQUYYeZtRyTDDCUENNPtQEQwtoxBg3GjLixUkWRgvlpFZs45Q2zDCYsRrLLLEQUw40/DjDSxMwIgCKEXs08UMPWf7QBiigsAGJL9TEIw4tmw7DDDPDnMJKL8hsJZR5t81p1jl8vZNMMbPYZQoxzWKmTTmWyTMLNO/84sAdhQwBggNbEMMGAhbcQAInPljQAgU0mAmIKcMQU1wzpgyCBx7FtMSTSQcDXZtj2Q4DDCynYFLIIJX4u83TzJQTjje8EEFEExaQMUMBeACywBX35DJCMZyYsugNL/Twwh5EUBAufaxOksUUV7wClUmihsTS/qnJAMMKJpiIIsodQ1RS34nlNIMxLWb0UAUddFgQxwNscIBEGztMEY/VFrhcRQudo9HDDbz8S0wkWcTwhByPYIPhbQ4dNQ80dcEiCimi4ELKHXHEwe3T5WxzMRst0CGIIHS0wIYFaISgRQ8/WGDGl47zGkIPZSBPBiSzBJzFDjAAIcYl7eRdGKm024UJLrggg4zud5RQyYjiaLMNO6aEwKuhhjpfxuOCKIPoyHA845FBf8cTRBUYMYtKfA8GOeDCGDyBDWpRpB/4eMq2GliJSrQPGdZ4nxGMsIVZlMMb7GCGN9jwA+TBiw5VeAEaAljAFvSgV8gThB6ap4cftCBR/nsQmQ1yIIQucOET7chKRJ4SsViYohKDGETudneHLRghDiKoxJSiVo5fhIAMvqpCFUKABAuIsQpqu0EIsFSG/40xRhTo3AxEEAMbsEAJXODCHD6RjXlEpB/vcAVzQhEJKA5iC0PYAiKHcIpK0Oxp8NlGLGZwvS1ZgAKsAMQl4UgDCsjocz8IgQX2AA03+OABKgCBDIAgBC50YQ5+4KP5BuIPZuiHEaBwxYBCE7HLEKNmzNCGNthRjkiwgh/ECAURVCABVuziHOLQRdsQ4IYRgOAUKXtB59zADnSUIxQiAEEFhFCELhjRD4H4RDfmEZaQ8IQfvFjFikLhimAcRxtb/nyaMJlBD2hgwggioFQ7AEEESFzBCeA4hzyQJYMr0KICcstCJUSRDFqMgx2xKMEDJAADHFBBCuacAyxb0Q3BMOQd79DFKhJhBkS4omL/ut+ILFMOYmQBEKmQR3bYcAMtBAEUTvhAHuTwBko8QQMicMIxQFCJUyCCEW0Ihja2QAo3eEAIrXzlHPgwB0c44hh+PFhW+kEPbah0pYyAxGVOWI5h0IMe5WigN/aVD3jEA1k/eFQLSOADK6wgBTA4ggs6kAAZyIADJNBCFcpABjZU4gA+sAEQwJDHV6bBiH14RM8Kwg+FlEMaq1gpSyEhrlh5gx7OiEMxWCEJ7cTjHveo/oc8hJFXOhwwC8c6Ri5ScIbeKuERPNUD8uiAABFUwAMoGIMRlzuHMfBBDpwohmzC4g2ZlOOsehgtMZxBj+6xwgeTaEY+XhsPcMDjG3ZVByVs+AISAIIeuRjYBc7wBULIoR2zmIHLbmCBABRgslJQQiC4cFk+cEEMcvhDKnomKme4gx6/UGmL0GAGSASjED7ARCoAMQlx5EMd94AHPBo03nqYiQ1NIAENqEGKwtGDE2FIgwkAsQ133KISM0CAAARQgRyAoQsCNqc5xQCHP3AiFeHpiUCG8Q5vBINFLgqCGUBBDUm8wsPjzQeD6gEPcIT4QVzmDjW0QYss4IEW7KDH/iHGcAYc7OEe2nhHHBqwAw2koA9dKMIcuhCINKSBD3x4gx0mcQpYrEVUxHhHFxkxPZ+2wReu7ZGIwVEPcLRDRyIesT4sHY9jcEIevdAGnMORiiV8oQZ7eMcwdnCCAcigCGDYqhLmwAVFzCEQXUDwzE4BjHDECXbEKI0rGG0GKSPiGPfgjoJEHI92oLfLIlYHl+MhD2z4YBD02EY2MEaPSph6CW4wAgQagAMwFCHGsFxCF8KQCXTCwQ6cmEQsYGGMtRQk2OWIBbHFFIpka9lBmDaveZvN7HxwAhDiOM39LsZdTHwhDDXYgQL6IAIx5CAHVFgDELpABS+swQ9rEMMb/v5A6FsAoxrpaOc/gJGtWEACQKCgBSckoaN4qEMd8OAOzuFxLO28ghlqcAN8LLMNb8iq221OAAYcYIAALKAAAgBABgCwgAUIQAML2AG8JVFoY1xjGuv49UASXY1ZQMJeoEjFFVAgg0tnuh0ipgZs75ENQGBiC9mYUvCc8TRnyCobqTgDBgxgiAYc4QAHsMQEGsCDCMDgBALYAAOGkIpUFPoWxpjGNNKhxIEMYxxlPwQbQCGMVGjAEkwYr4O+wekR74IatABEM95xP3bcbxs0dYY02PGHMwyAATk4wAcOgAIPsMAQDHAEFRrAgDGkYAiD6Lrmr5GOdMTpYO+wxzhg/rGHSOwCHKkYgSHgoKMvZ1pHr98FMQqRDNRuI5h6bwY0pAGNKXyBARjYhAY6UQFDSGEJhMACozAHDIADmZAD10Zvmad5m4cPBTEO/hAOubAFbvAK4CAMC2AIOIBsc2dXNQdb1HAMKrAxzpBC77ddzFAM0tALO/AFFVAEm4AChBABmoADUpAGKTAKXCAAUpAJMDAEomAMysCA61B9YicQsmEPvZAFavAK8SANEsAHVkAL+WB+OnJpDHIPwZAFWDQIwYNP2xIMr8ALtyADhAABY6AIHaAIHqAKOMAHacADOigAa7AJJ7AHXseA12AN1YcO1ycQceIPvaAGfyAMCyUB/mCQBqnQDjfXbK9lXnbVDe3QDX+ACQdQQnWxS5Z3BaZmAHMgBDLQBRkwChmQCVxQBKNwBALQbipwC5pnDtewDtewh2HngLDzEsWgBoBwDPCgDyIAA2mACfkADurAHfBQjB7oI9qRDZPgBiUUC5UQCdLoBiBwBmNQAH6gBCkwByiQCaMoBFJQCjoAAJugBENgDOtgDtMAi3s4DXz4h4txDoM4BX9QDPGQBAwQCHhQXiKmc5k2YjeHc1XIDLMQCVHUfSrwADAAAwDgB1JgAl2QAwE4CjjABaOgAxFQCjiwBWBnDrI4i9xgDdbgh2KXE8eQB1hwBDLgBE5wAIagBvkA/ncOMnCZJm31UA/SRnduoALSGAmQAEV/MAQHkAlUYINS4AcwsAkmwAWlkAIsUAoocAfrMJXmYA7WsIfc8AwjiSEvEQ6v8AhiwAVhgJEAMAdqwB0+YleZNndz9w3fYGL8MghD4JMdVAlDEAGjIAVSkAM3qANK2QWlsAE5MAobIAqyOJXrYA1Z+QzRgA5+KBQtIQ+5cAkElgaB4AUDEAgYoAapMF7QNmIDp2X3YF48IgyvAAh7cAiNZApGAASjwJd8qQQoUApK4AejAAFUsAkNcAseWZXcMIvK8AzPwA2MQRJoMQ+7cAlgEGNpAAYDwAU2YAAggGxrqR35cAyAEAN4/oANyuZswtANqfAHwHAKsSACg1lOLDAHSmACqlAEgUCYhpAJIqAM6VCV5rCYz6AMI/mYQ6F9ufAIY0BgYGAIA1AENlAAB4ANNmdXZsIJ1AgAASAAB4AJyiZwT4gLcUAMIGCRQpAGMjAHRYADpXCUipACmqAITrAO6ECV+MmHYYcY/yA7ufAHQFAEN9gHFXABWHACEiAMxlheQ1BnAzABAcAENAAAeCAP5KAO5HAOxEgO0qAMC8AHgTkHJqAJXLACqsAFhJAJLqAJa5AE71CVs8iYivmOf/gPRJMLgDAFTMACJpACV/cGiyACwvBa7WAHEGoHWDBZBQABBtAABbAL/rEVD295D8OACXggARkgBABwAACABSwwABjgBRjgAVLHA1CwD+m4mO2ID+mgokjyGL1QCW6gBlMQAQCgAhUQCFCAB7u3CxNQATAgABkABl7gBwzQCRGQARKQC/lQJvVAD5SgARiABTIAAiBAVXWQkFAAUEkQrUMwBLZwDb8pnM9Afe4QDkYodr4WDuNZCYcACD4gAbTwAH4QBbESBxxAdSbgAV5ACBugCAyQCRsAA4E6CfkgW5zAA57QCp/QB04QC8BwDfd5De6QjunIjpy6DllJnOngDtZgDn14ML6GD8bQSB0ECA1ADA6gCEeACQ8QAHYQAXiJA4HgByaQBvm4/gJisAA8cAD6IAxO4Ait0AmBwAd90AdvUAnVUA3LYA77MA3cAIvV4A7mUA2dOpXuUJ8iWYQ0IRR9EQ7G8At7EI1uwAHM4AAswJBDMAAsAAauuQKKUARFgAUeMAcroAkRYAAHIAk74AWtwAc6IAVC4AiyYAU7UAjpsA+xiJhKW5ULW4RFKJKG62tKNiThgAwdNAioEwOn4AAAIAAFwAIJ0AlcAAajkAKZAAR+kAM6UARKoAqWQAAMMABwIAtFIANggANw4AkygANYkAJ4gAwNW7TmEA3p+AxFSLH3KZyzeA3VIB7Usifg2kiR4AZXAACSKwABQAOG0AGZUANzkAko/jAKPEAIGmCjNdAIKNAATBABcFAETGAIKHAJj5AAJuAFJuAJlLAFtmAO5VCE3DCV1WAOCXuf0SCc1qAM1VBvh0YS0BIOvXAKS7MFIEAADZCrEZAGnYABo1AEfmAIMLgCm5ABXQAEOWCjnhABlOsFhpADlzAGEFC+G+AIm5ACcAAEkXCf6CC01bAP9euwnvp1xgAMwEAhShQe4ZAMrBAHWxADJ3ACWOWNmRAIG0CbmwBk4qibYZADOIADXWAIEeAAE5ABT9AJY5B4gZAAfNAKCyAFhkADb6AGuou/sOiw1xAN+zuL03DDsJAL0BAOQFMMe9ILhbAFPnACKOAJauuD/qMABiaQCTBIBUqgCCIaAXPAAg9JBRsAABIgARUgC3IwADqLAX3QCh5wBG+AAjnQChkwBYa5DjIMi8GZrdzwxuN5ChsTEwLRC3zBplNgR2CgCmNQm7MpBWIwCkKwCYmYjbqpCCYABh7ABQYAABFQADYgBAzAB2PAAH3QCRoAA4YwAuWbAP7KA6aADrq7DtMAkul4wxHTPUPSEUKSDK/wB0yABUIwB6WQA2lACEJQCkKwBpkgBKNABX5gRIpwAI0AA0qQAX5gABHgCRzAADAwB2KgAZ/gCRegA0gpBXJgAEIwBn3gCB5wB9FgDsowiwo7DUdzCjTzebIhEHaMDa9w/glwIAUE9s64JgWvGQjynJd+EAaBEAgMoAgbwAUeYAgaEAGNkAEw0AnI2gpzkABMwAcfYAifkABYQAUJIAZzcAkyMAS3MLT26Q6rTAu0QAzNMCQ7ISTYkJx9kEe2KQSZYE68vAmE4JpHGQZLLAGbAAFpgAKKsAAJoAgZAAReIAMBuwNg4AcncAl8MAJe4JxiwAeXgAJAIAc7IAr1ScrvcAqRYAov5QzYANYKIV1jTdh5RAiEgAWjcFkHqAiEMJg5MAdh0AhLAACacAFLwANzEAEbkAkAIAN4Kwcb8AligAKfgAUMQAVPMABY4Ad8wAGf/AlFcAWkQLHh4Lih0SzM/vDVFfIP2BAO2CAMnp2GijC6YWAIiLwJfrAEpUAIfuABPKCsjmy2YJADnPsAv2gJgTAGRSAElqDbjiAFECAHhsAFG1AEsoAFTAAER6ADecAKW5BF31Ix3lDOCjEO1ZacBpYG7cYFmYADiqAILqAIXSAFmxDBGLAFg4AJE7ABa3C2QiCDD0AKcjAF4QOwZisLfZAAVuAITEDNrRAFJkAFHpBZYPAAPuAG0Rcu1tHgLWES2DAPne0IP6YIMRbBjbAJS7AJqmAIBrABIwAId0AK6FAHLCAGw8wC8KwAt7MIMfAGlpADStAKmqABUWAIztcKrQAELFDgYiAEhkAFGlB5/lkQCeTJLUZOLU6R3ZcAS12gCGngB9OrCFWuAyiQAU6wC6BwB6IAdtZQAsE9BxDwiQpwC6iACqKgBhFgBa0gC8Vs4yzgCZ+gA2/gBSlgBUzgCUzwBBCSDaYgjUT+JsTbD4OenI7gB4auCJuA53k+AVfACtDQGf57Dc9QDqiAAbKgCHmtBCJgC7bg6agwBE/AB0WgA+O3AoGgyXxw42+wAZawA2BzD93QDdmwC69AC+HSDNhAJP/gFLN1CcDuB37ABYbgvb93Am4wC87wm/f5C8+wDNfwCxIgkRCgCDmgAstwC9iOClmQAeUbBSzQB5fAApZwCQsAA6mO7rC1Ixe4/iYFIiRE0g8ygQ3HQNiwtO8sAAQSIAJEMAOQYAvGIL/csAzckJXLkA6o0AA+mAkXMATrMIQTPwgcwAKOwAdHgAGfoJlR8ASWUAFgow/TpiAJIgzCQAzHABUgIRvzIAyUwAdahQVWj5oB8gvKcJ/coAw7X7TcUA3XIAIfkAGqUAFSOQ3LsAzXfguDYwJPYAViIOMyMAZYYAkRoAYmFg8mpiDgwHrsLgyo4TO8rvItPwZU0KdM4AapAAp7wJs+3/fDaZ8LawsBcKUFcAtT+c3PYO3WfgccAASyEAYrcAlr8AQR8AcN4iDMtiCQv+6pUdIkcRDFoM42YANBNwl7cAqu/hj3z3Cf9lmfVbkPzxAAYvDjbS+Livn6toALQXQCMJDJcBABGMAJ91CFaun7PLcg654N8sAVITEPmKAGQScJmDBRmdfRBou7vkv9AGFOYIkGB+5c43bNHDdr1sLdwrUHDyYJLLAwuAIu3r122eDFgwfv3r2P4Ey2ayev3z+WLP3Zy8WqUqVTt4whe6ZMoUCB7tbx5LlunbI7hYQ+E7guXTVnqSbdsTcIBIcGarqB+0gtXjd44EaGNNlNrLh5/vyxXNmvH7ZZlWABs3YN4U5z19Zx25d3H7eg5qqZ22fublx30IBVyhIpHDtpweLEyacvX7yNIUOOpEYSXLd4Keep/m3Zsl81Y8amCd3586e5dP/2pUP3jJtQwUL5mnO3zx2wU5FMmWIWfJs2WqbuUcs3GeRHsF05i82Grey/laH9pTN32u60urWFptvLLVq02YH9Ltz77h3vPXu0aRu+rZyz966y7JlsOR5Wk/dMxstGHGzMCi00fLi7ZhqF6AKsn33QES8adLCrRjV3qpmmGmJ628MUX+DbZhtmnHGGGW2cieUVWjgR6yRw2jFps2488we0Av/BZ50FT5vmNJ++I48bvlRbp0djYDmlkkiWnIUYZrJphkQnRxyxxFhMoUWbbGZsMcZuspFnnhvR6gc2uc4sUql0rHnmmWuesUYpwTIE/gaWSvDIYgof9ogkFmdEJJGZZoghtMQRiSmOFlqEOUasFrvJB6XpqisQnwnXjGuahhpq002dEpymNDsjyWKHEyo44YQhTHFGHGboIdEbQ0lsZsRgXClul2OEuapXlMIcU61+8LG0oWs2vSa2hpSxRsGbbhFlkD3c8OEEDDDYAIILYhhkGBOd8UZEcQwNjhlinCHGlWBiCWbXRrcE87Mx0cIHNmvQYfNNZtu0RhllQoV2kC2qPbWCDVJYYQMZdgAkl2YA3eZPcst1kph1g6Gl3WyyaUccYCkNTS1iY+M3GmXgVMa0BFPGBZMrZEhBBg2wTaEGHFZYGJAmo6SymVqb/hnGmaCFlpJQYYg5Bhtv5KnxrAKrGxad2KLpd9NlSysNWkCm0MGEFT5IYYMVaijChBSuUMOUWM49VNCKzS2RaKCHKcaZZrCxpyyngx3WUnytdmgaZKZJ+UhM/rCiiCWW+HoFHIqoQYcUngBkkliGIQZzoQnN/NwoSYQmdGiaGWcce87Bx6wan/6n6ZGlDqchTUM15pY6T5FEDTjCWLyIFRAuIngdpnDD8p1rtZtQzInx2WdvoCm99HDwsccskIO1h9h0wlkHn3DCqSac0upkhRVA5Nj9jDNwSCEFHY6w4ogn1PgjFVMyx3wYoH0WtJnQvSndPMYRDnuE4yX+OMdZ/q73tAP2TSjo+J4xknEkWLBCEn9AXxjgYIUoPMGDagBh5U4xi2EMQ3T+Ex00vOENAfLDHtWDofUWyDoyEcuGB/peMpKBjF7EhBOveEQQH/EHQEjigkZMBStykYtkFCN0KBTdO0z3wtRZL4Gro04W52UjtZiFev7w3vdKh4xk9PAVrzjGGZNYPiX2sBi9GEYyQpeMcYQuegR8YfW6KCwCaXFeY3LdS4hVwHOE4xyHPEcxznGMRDYSGWQMBzIiKUYpBvAd9nBh9bK4NwXOkG9ocUkXszfI74UjGYhU5ADDMY9CllKMYswjFfHRD9XtzSWg/GOwyKQ6WpolewUMIwENiPm9QcYyjLHMXh+vBxob5VKXIWsdAmmZQGQSC4x5PEfffrnN6lXRlpTypDNvlJbWCauctOxHAr+YugSqpXq1pN4saRlNMoVTnPe8kVmyWUsZWk+aq+OnDO2JT3wyUzS9rCXUOhlNgLbOjw8laERpSB1PzpOiWhTWQCW6UWge9KJ/BJk5OVqggAAAOw==';\r\n\timagenes[\"muralla\"] = 'R0lGODdhSwBkAOf/AAkFBA8OAxkIDCYTAx0YCBgbCBwZFiofABQxAD0hAC4lGSgnISspFCkpGjEpDSwyEUYoADsoK0EzBTg1JzI3MDo2IEA2GDs0MSRQBDdCKE0+LEdEKFw9H0hFMUNESEhFOmBBD0NJOzxTGjRdE1JLJ1tKFUdUKm1KCCtsBlRUIFxLTVdRPlJUPVNSRTltCl9RPFpVOVZUT3xTDUJvH0ZrK4RXCWBeTjl/CXZeIlxlRHFfL1lnVGlmL2JhXmliR0x6GUaAF1pyOEx8KmpnV4BoH3RoQYZpC31gWoplH1Z8OpNmEkSUBYBvPGp0YXdwVXJxYG9xbG13VE2SG31tY1WNJVaLLYxwNHtxZWSNQGuJTp57E5V8KpF6QoB9YXt+a1CmDmiIc4x/TneHYZiFFHqKUn6BeIiDWIeEX4aBcl+hMX6Dgq6DAI6AaYuGa4SIdX6WTXGeTVi5E3mbXa6NKIeWcZeRbJmNgJSSdZyRZ5KSfYmTlImbao6UhYOahJWShXysVrGbIqWWf62bWXXCOnu9SqCfkZ2khZSpg5qljpamlpaseaekd6akfZCydKWjjqekhqyihZ+npJ6xd6mnmo/CbrWteaG5hbCyiaKyu6O6kKa2pau2nq62l6i1s7Ozpbaznre0lryylLu2iJjQcMi+i7zEjLDImMPAqcDHlsjDnrzJor/GrLnJrbXGyb3GtLjHvc3El8nKi8XIo9HDnsXEvcjEtcvHsK/cktnEs9LOmbrR3bzbqMrXsMfXudPUrdDTu9jSrM3T1+DRrsPY2tfTxMvYztDYxtvUvtbVzdnbq9DfwMPb+djcw8/k6Nfnzdrnx+jivN3lzcvm+dHj/N7l093m3Nvsw83q9NPn9OTk3uvm1+npz+/m0NXu8uHvzvLqu+Lu1Nzs8fLrxOXt4tTx/Obu3P3nxuTs9Nrw/evs6OHu/9j1/+Pz+On32vfzzP3wzfr1vd74+//yxfHz6fXz4/z1xvHz7/rz3O/09/j43vX38/781fX6/fn79/397f3//CwAAAAASwBkAAAI/gD/CRxIsKDBgwgF9luoT5+9hw8bNlxIkWLCixgN8tvIsaPHjxvxiRyJD+THjCgJbkyJMJ29dDBdRmRJMyM/g/oE5sz5L51AnzKzCZ03LyY+oP94/ru5tKbGlQJv8pMIE1/EdPqIaiVKT9s8aq7CFssWM+ZPpwg7DuSoU6TEeQ/n0Su3bVu5ctTolmPWixWnQ4cysTKmzWvMnFj1+WzIFu3CgQ19FoVJVFs5cNHAYcbsTFkvXqYs7ZGTRc4ewax6/WIWTRu9dPQiS4yakunSxlS1lqNHbRvmaN6cOQOnTBnoXY2SY0kiREgSOY0yCVZ17N29e/TMXddWVp/ti41//irml26e5buZo2UG5+yZ+86gG/35k6ZKleYzhFSBI8f0JV7iyCOOO9dxcw833BX1XU0OyXXPXdSoF41wzxRHYYW8yEdfGlLcRwMNLtwgRRpUYKGIL9C4I86KK0JzDDHEIOMTSAUxxRRMPc0zznATTujMhMV5Vpw1z1iziyn0fbFEh0mAYcIMS3whZRpvoJLMit9k+Q0wqXziCS0yomRjSERdFo17EzLDjDLMdPZZL70U95kllKTBIRVCkAFGBkJEGccXacBRii++JJMMocCA8kgeeUwiI1b/9COVRgXhM085mVHjJpxCusnLZ8o481kmjcCBRXM0iNEEGEkAAYQU/lIA8YYio0lSSi6qXGKIF0+0EcgpyJA1KUY5ERWhm7+4ssomm3AqZ6huZmJJI3IkEUQUTqxwwRXMkIHACD8EsQcPNAgRBBmSLEJHE048kUcbjgTy6FqUNnXUXW3yxYomiSDCByKsKOPee9H0YkqpWFQBBA0s9KqBD/vUwoEwkDySwwwuuPDDDNbm0HAXaLDxhCOPLpbWTcVqKqormhQSySSR8NHEJsW9J1wvisBBhRRKztAEA1k8EIQcKTjhDhkzYICBxiiMMIIJGXRxRxtOsBDIJ7hwR15SGPUzTzT6ahJJJ50Eg4kaapThyoVFsiLHDV/E8ScQWWBAxQ9A3ADE/ghJ/CDlDUvEgfEMBZxByix2NJCHJ5/UQkw2JS2I01f6epIILa0EozkmZfSQSJzgPONNL5ZUwfOff6KQhpJyfyEF3HLHMcgXIoiAgBnCpFLHAJNo40ghjtSSjUT4XDSPqH1x0sflmWveChRQ7LA2ON4Ep0gVUkoRZRoYSBG73CjAHvsXCDDwiDCzsFHAHVBc4YYfkwjv0z/2IHQpL9Jlcoi/fCRCth56iF4ZdoAIgTkjOJlQnZSWsAQMZGEGUqBCGm4wgxmgYHZSAgICSIAGO0CCDQbwxD60YQM/mBAXZMGHPorXkYXMAxzIaYQiLPGXPvAhD25wQxN2sINEJOIQ/gf0Bnva0QsahI8KSROBI8SAARGMAAEBCAAAEIAAGkAxB6mARCFWcABP0AMcxPACo8rgiWD8o3jp+A4/XniLUdBHDorIxCY4wQlmbUI4yjCGMqJhDW+0ox19+MQ8lCGJIEDtE7DIhj8kAcUMqGAKHrhAAQAAgB7gQhalIEEDaPGIVHCjCZ/wAxrQMAlcwMQhTRHIC3cxikEQIg1/iGNqONWZ6lmDSO2IRiGg8AFh3GMbewgCHXxwBGGYQxsR6AAdHgGJSlzCEzGgJCNycQoGTKAQNpgAGoagiS44Ag1l8AMtzpHG+TXEHv5gJSFcSYg/ROdTBgRHLuXpjHYoowlt/lhFPu6xD6TdDRVTAEEYjgAAFrQBEpC4RBcIYIAeAAAUjGjABKhxj0IUwhPa+IQhHMEHNdiBFpBTjHeSYg9ntHEQKG1nLHchnJa24zKvQERdeOGOfdTjHsn4QeBQgAEfWEEHGiDABA5AgAGsAABXQAYxDEABAvjANfewwRNWUItjMMMReUBDJGgBE/LUzx78KIc1TkqIsv4BDo1ITR6jQQ1q9MEYj3hEPvYhjnrAAx75+Ibf/kSDKAxoBRMAhSGc0AEAXIAe99AGABTQA3/cgxiA9UQhGuUHPriBD54IVmTA+hAYtnGdZSUEf1Sxil+sYhWcgMEdorGP1u7jG+74/oY8XvsGFwChaXW4xzEm0ABIMEIUkMjmNtxhCwZkIwaecIQbbKENYqBBlKNsVC2qAbmeQKSku6DEKEJLIhOpYo6rOMUjDJGPfMDDrvXYx2zlIY961IMMSXgaNE4xhAV84BGLWIQongADf+TDEA4gxhNO4QfHnWKUpPSCG8BLjFPKBB87MkWd7GSnKmDBErI4xSyYIY650tW98viGetULj328wxwh5sUT3GAMLxTgEaJgBCOeYANi+MEALShDyIaAhg88dwi/8IMXJrGJ0hoDR+kQSTrGYQxTyEFnVKACEH5QJWhAYxspam97xfGOEH8DHt+wKzzMsQ9YMGIbtbAG/jhoAQASnAESn2ABJSkZiUKUwRjBywMJiVEIL2iCE6dlxeOsshN8VKMXmTjVD27wA/28IRnuODE3AgSPE9eDy9aRx11b+0sWIOKP7XCGPloQgA28wAYCaMATahGDCxDjOm64xy/C6IcQGOIUssjwK8ZSkodYJRysOEQSMNacLFDCEtYQB2zN8Y67lriuzi6xO+ohijr4Jh/DUTM1KOAEULRBAwCYhD/84YnD2uJdtViBDTxRgDacghWn2IQrdh0Ol7DQHtlwBR2SQIMKZsESyZBFJSDhjtiK+cv7cIez0xsKd0ThDvlgT3Cs0Q5jFKALcYWEAU5xnUl84BdtuIMj/p7gj0kEwAvRSIUsNqGJVwQjHOwongqXUg1W0CEII6BBEvbgC1v4gAg60LSY08sN3XUgABcgpRu80UfhtEOeai7HA+6wCEaEogFo2EZFp0CPO/ziFP2oRgsa4AxorNx/w2hGM8hplaiMwxViCEIQaJAFUSQDFxoABBPcW49IO2IKKiDABtAQAwMA4ANDYEU7/OgN0YFDzRa/gygWUQcFuKG8NoDCJxwgV2JMoAn3iMYqQOGIYnSjGd2AuT1EMhB7wN0EsN+DLKAhDAUAYgt83wcuAiAAAeQBEipPBSeuEIACuKId7qlekbxBjQzQoeqQCIAf8kENBdiBGJ8ohDYK/tAEsLHCEE14RTe6cY3x4+McDYkKP35hBhyUgARmmMWW8n4CaNh0H5BQwAoUQEkCwOARTpABABAAifBHjScwwWEMPmAI+aVxheAPxEcL8+AFFNAAXbANz+ALnJADrRAPHjh+3XAOI8EU/eAKgrAFRlACRZAK0JAMEzAHW3AKCrcPdwAD27AIVzABcxYCtcAKDUUPznBLcNIXtBACRXAJwHUBEfABDQAAaoAMBAAAheAMhsIJiKAJ5JCFWogO8SCCxTMQvyAIt2cFdZAL4gANB7AFawAJCecOXeAEqQALsJAKNkAAhfAL3EAPFwAAXgAnrDBH+rMJIbBYbdAFAgAA/k1AD34AABTwAIhwDISyConQCuuwDh4YD+OHDjHHekthD8cgCHMwBlaABywIDxNQAmsQCCqyDz4AA7JACqIADDnoD+BwD7UAAHzQBVHwh5uACIewCV4gRQEQAtH0BPvEZhTQB6DACYqyCh5Yieuwhd2ADl54I584B1pABEWAB8AADT1gAXNgB6/lDizgBK9ICnS4Ar90D6cAAL+wD8nwfXRAB32ACBlAAbQwCTZAarZAIJ5gAHmACIbACV3AB+MQD9FYieQwfuQQDuvghQMxD8BwgtlIBETABGjQAwcwBmxQV/ugAFNgC6RwOA+TD9AgDrgwALNQD99gBjngi4kQ/gIF8AHZ0A+TsAALwAwnyQ0nJ2N0kAjNsA7oYInRqIXY0JAQeRPZIAwnaARGoAVQeQISIABzEAZ25Q4ToABX8AlcYgNtkA/bkA+3CAyvpQqGQAc50AcB0AANkHmkJgDZcA/5EAoMQAd7IAaa0A3xIA3ogA7dYIlaKA18eQ4iGJG2gAdE4JRQuQZrMAYCAAglwAOp8AgHMAEBMAB1cApPMAnlVQgxQADMAGbQAAyysAduYD5d8AKOsA3lhgbccAwbwAJiIAadgInQKJRaeA26eQ3YoA6E2RP8kA2HyQSJuZiNOQBawAMOAAAN4ATAcAoXIAC8VQiaYAOUhAan0F7m/mAOLVhNkAAMkPACbfBYaDABDNAEmtAJxRAP16CQ0cgO5BCN1yCY0oANm9gU2VAMhhAFKVCcjQkIESCVAvBIixALohABkzSAABADagAAIQADRQAN7yCh9ZAPJMAIszCHbbACp5APp9ACIRAJmCgNt3mbWUif0hAOEJkU6UALfBAFOVACOHACRjAGRjBJFtAGx/AJCqABC9ADtkABFBAAnHAP8yCF/uADZ2BT4sBsJAAJi4AHlZALleADTkAM/aAGHqAH6jCUloiQ18Ce6ECf2CANXth2+JANw5AIYJADOZACJSABCSAAFsADwCAMjwADDNACnlByGoAGDVBetmAA/lBADG2wASbWXtzwApBANSGXCrPwbXnQD8HQA1DQgUUJmOhADmQKcyIxFWdUDa+gCWAABk2QAyRgAQ4wBafQBV0wBATQAcdwHfQgUVfQAlrnCVI0AU8wBF1gf+IQAwJwAQqgAFmJBqnAJUUAA7bgD7UABWrQDO25DnpJDrs5jeEQDlbBevoQDsOgCX0ABjvAAjbQBbEQC7gABQCwApOQh7/UBkNwATFgA/u0VPA6BfPAB0NwBxlwAWUQAx/gCZ7gBy1AAjAACccACTm6D+PAByGgBsPwgbqJDZoIc2eqQvZQDK8QruK6r6mQCnfQAAowCV0xBB7KAobwCRPgAR+w/k9oEAEaugK0IHYNMAlDELBXMLBPgHgdsAKOgAuteAr+YAxNQAGY0Ak9oAe6kK3scJTayg8qxA/jUAyd0Ac7MARP4ARo4AYRIABskA+4UAv+4AUd8AS/QG4T0AND4A+nIEWVAAuzAAkrgAbZMAkN4AZ9xgcNcFExgAzIYLMd8AmhAAM+YAz+0AkUsAB60AMU0Alqhw3YsA7swFnnt7E5FAho4AMXcAGFKpdosAJdcQy+cwqTQAAXMAFX1QIAQIofKww+wKHa4AXs+gQPWAgeEEl2MAm2sAJtIAxtAANt4A9l0AJyUQs9gAnNALnUuHowgQwD2wZ1cAbZ5AS2MFf7/uQDn0AP3EANQ+AJ44AGUbSuiWUAbTALogCLs1AHf0oPhTAEk/CvF5C7fvABNnAPjpADRSAMoSBVn6ABn5BYLaC010AO7BBz9qAYf+sGTzBVaOAJ2/AJjnAPHocGiUUPT3AH1wEFNoAGBfAL+fALBrAIuQC3JEwKGvAC1FANNrBcoRADtVAL19QCLUAPfGADoCAMTgADV/ABMSCkAqyX4xAR+EALhXAFWKu72HEHLIC1tFAg94Cw3OAPU1CuQ0AP23AMAZDDNuAEV3BQwAAMXbABQusGUOAHNqAAOJYN1HAFhYAMT/Ck+usDfxoChKoLqFcN1RAO45BkyFAIHXQM/tRQCCTHDcFDD/OgW3LZBj4ADVKMBhuwttzQjguKNlDQAyGwA11wCpdAAk6QD8jwSJ5gBzawbmXQATZQCKegAaEQCsAQstADBXbcC7uGZMhAC19CDMcgSsGzDQjiCadQF9zADXdgC9vwAZCwAVOQDv6wVHxQDLRANp2gCQEUAoEADEWgAZ6AD2hwBfpIC37wBMWwChgMChowC6lACi1QDmgzDM7ACoMRxCt0DtmAC9RQC368tY7ADLbwTa55xeUFlhrABh2Ar8ewAgsACqMnsGNDNpEQAk4gDGxwACxAD7XQAnZws3ZQqLziCR3QBalQCR0wD1CgB8UQbKxQDEEs/hnZgH2FYEKFUAvGcAynoLWN4wXYi4f5MAF50AEjXQAFwAemwAiGsAmv0AmREAmYcLRqq8kWUAHEoA0NYKkBAAVuMARDANMWoDs24A8h0Ad9QAeZ0AvlABdgpQ/Z4M2FMAkX9cLMcAyP8AmTgAaWlQdeQA/0QAEFIEUUQAeXoDz8ogetUNRkk9TPEwIfawMV4Agd4An94AkAwNhu0Kc2wAYiMw4U0AR0cAhxMtb1kxRnLbCeMAmT4Ai2wA3GoM954DgX1TtuYABuEAL42At7YAIDbK3XoAvDgAmaoAlJfTYdEAq48Ak2YAAEgAZqYADX99puYAcfMAVPkA0E0ASq/oAm8AxWUIsMteAlL3wKp/AJtvB1n3AMxxAKp+AGC2AAiucLd7oJPlTbkbupulDUvY0JeuABqHA4TjCsHrAAtYAGHfDCVxADMeAI5fDT+SA6dtEPSoFv2G0LtoALpxAvpD0JnkAM9vwBE6AH1cAMwPALqWAIrqCX0kAOfVni0jAMrTDfZ7MBs9DifuAB0TQERPwJpyBUCiBOAdAC43Am4DAP6bcY2YDd3A3Bn5B9RL5LPYAGxNCCtiAMjtAEiXCJ0MiF/CCUt90KrdAJvR0CbYALsxAKwxgDPTAJxsAABwAJtuAACvACUPB5euQMPu4dHJEO2vDCEAwKp5Bcor3A/thpWr4gCrOgCW7QCboZD/FZifGwqSWO21je23rw27PQBSwwD2VgB9nwAhsgC62VCj4ACr+gPACTwgc8EDCx0rZA47WwChAsM15QQKqwCHvAC8zwC30wDIF56ENZ4n1JrYHdCrqQ1DEQCLBwBh2giFPQs/ZnU333DVYmC5zACr/AHTvBokrFOL6cfU3gA4WwCryACpIgCWHdDeu5DvMpmOoglFNO4rs+DLrg676uBjCQCl2QA/7gUItMV+d1V1pyKMDADNXgEg0hEkFuC4wz2m7QBW4AaKqgCntABn3wChFr6OUumF6K7iWehWMqDe2e4p2wAaDgA2t7ARj8WujF/ndaYmXboA0PAbU9sdKMUwg3JHKysAq+UAqK8JOv0J6CuQz0WaKbeps/P5S3/QqY8Ao2cAcV4AfaoAHC8GHudV5YwuxXZhjz0BM9UcuewAcc9QmpcAofmwqZYAivwKnSsAxmP+KHXolequtCuanSUH7NMAx8QAsd4AaBSwwNQGbQhl5a8g1nmPKUcUZp6rwWNQl0xAqoIAuIkAeJMPaCOQ2CqYUJmfYVf+gkvg6QOwzFoAc3iwZODcMSGmLuFWbyoCIronVecRXnV8ua8AmasAnxtgr+AvHNQPYJWaK4juu5noWV2AzhEAwu6gUhMAQTlQcvsCL1oGmmH2IDsiLY/lEUVa8Y+WnLrV8LRTZvwzDxaS/lao/ubd/9RRkP4VANoS0G4AAGUrQCPpAP7BViXcYipi8OqE880q9UtRAWu71rDIn27smFUl7xALEu3jqC69Chk4Zu3Ks+UQy1e+ZsUwUW0PbJq5exnjx38r59lPfu3T16+tL9+2cyXbVir1y+ajVsWLeC5AYSjIeuXzx20qahExgUJ0F17IZpOpTpkjVn7Zyy4pRvm7t93+q9CynunTiu37jRO4lPHz9+6dJlQ1ZM7athza5dI0eQXFyc7OKpm5ZXmkB0NoEOjGfP2CYxh6wdBgfumbfDvBy6c1fvo+RvHiPfu6fv38mU+PBV/gtXTOawt27hzsUZj18/dT5/oosXO55Ngt2uHRJDx5Ipb87GJWbcGOqqS8msueP67uM3cdw2/+MH3SS+dOeqNcNO+m031LL5DVymjiC/vwbV4cu2ClWpQ4d6OfXWblwvZfW9Md72TNUhVLySQfsGGq7cGYkelA4ky6xszgkHu9LQuaYbCbvhCaFppJHmmoJk66YZWq5YYQMYxHjPGWueAccZFetTJkVvnlGGFVZUkcUXYJbTSpuT0tEMJX48MyscIZtBh0hs+urmIGwuxJC27naxJBMTJKBSggMeYKUdb6BpBxxvtknxmW3uU4yXXlRB0xdfBBTnHh+j8xElfTzD/uccO8PBBs88seETwybfuqaZVlrR5A4xonBAAghASCABABKBqEtnvBTTmd6ceSYia3oxUxU1oblHR86gO5DOdDwLRx0838LwGj6xkQbW0obphI8nYNBgg0RP4BUEEDgoxMtLJ10M00xhdIYXZXj5hRc1fdnGwAMRjE4zfuypU88l+8SwGWwCDVTQQpwgoQQQIJAAhBOUUKIGEEi4g5lMvVEsIkydiSaaFZ1R5pd+e/mFGW7Mem5asn6k0zM7+XQVO2ya0SXQ0TTJgwl1TwAhXRnYdfeFO1bp5V5jmWGRZGeYYeZklJmhRhtt5hmVMzitJStbdV719mGJZXKpEDyY/kCihhpk4LUGdmUAoYgzOOkl5EzxPVkZFfN1hppoqMG65WwIlvlNslLSZ6xzFD5H1exGc8kVTQIxwwok2q0BY6PZPaGILjhhJWRl9E15ZZazpqaaasapBmaxDp428YPHOjVbO7Nr6RVNNHmkjTCsYLdddXFAonMdmKADb/pSvvpqrKuhZhzVxylnnq25VjzxHqMjayxU8QltGJdY0QQRQyx3W4nOcSgBByaON8MMQ0Q3JuWsBS9nddXNSscebMd67us4v+Y+JX7CtkefcMZpppdXWNmEk00MueOMyzsngokiikg+eUMe4cQVY6oOXHDBVc8GzOZhvbDho2CxgxOc/lCCD9rV7B/UYckreiEjTrDvDHgIAxc0aAYxnIEOhlie+lbxC2IYoxrRm55ZYAY+Av7DHg1UYOIMhqA4Hc4ehDNGMWS0CUQ8AhJ1wAMe6lAHQyACFOrjxCpWUUITBm4cZrFH9Rg4J+wZME7UItUMZYigsfBjHoSrhjGI8QtXbOIUp/jEJzhxilXUohauIEYxSlgM1KkOZtYTS9hol8UYZlGLCeRjILuojyj6DxmHNAY11JLDamSjkf8bXDaiiK3wGTBsW+zjFjWZyQP1ox/eo449vkg9AaZQQaeKIvjyyEA/+lF7moQlqQ6WQNr1qB82dCEhwxdFz1iPgIT0HiBlQknDWBYTlgrs3h7htEsCvvCB35vW7AJpTGrGkpNXhA4tU4Kgk2jGitUEZziRWcw9bk+Y4UTnJg3WR21uj5jTDGdAAAA7';\r\n\timagenes[\"terraplen\"] = 'R0lGODdhSwBkAOf/ABUKBR0TAi8TIiggADEmDUUnADAuGSE3Hy0vNT0rH0cxCjY2KkE3CD86HStGFjlCGTVND2A8D0xFGFJHAWc/AUdGM05HKlhFGmFECDZaFDBkDj1cKUtPS1hIT2pMH1dVNlBbMlhVQWRYIExgRz1xFX9TCmNbLWhURnRaCnFZG21aK0l5EkCAEFxuLWZkSkl8LlN3Mll0P09/JWhtYXxmXlx1ZWl0TYxsGZlnEnRvTEqPFmR1W31xLnhwRIlsLXxwPHFxWWtxcIJwN0qaDGKHOFiQLomBGI9/KmmNSbN1CnGJWYmBUZJ+S4KDXot/XK18EYuDSqd8J3yGbYSCb3+DfW2XRVGzAKeFDWiRfHWOcH6QUVqtHaGLEmSpM5mORoKPgnidV2+nSImiMoaZbpmSYZOUbZ2TWYOeZZ2RbZaTfo6YfpOVlGq+KoOrWL6eG6uhSaugT5moWKefbayhWpSqeJimkJumiIO8WpCybqOlgLWoR6WlkLCjfa+nbH+2o52oq4e3maKooIHJTb2rVKezcbuvZ5u0pbyxX6XCVp69h6PCaby0dqnCX7q0gKe7j662nKS6orG+arSznaq5mbi1ka23tJLVZbfDY9i3ZJvOo8rBbcfCdqjPitDCZNG/dbPJmIvXwMrFibXIusHFrLvLpbvKrNfLYMjGpObSFL7Jt7bLx8DHw87InsTYasfVerzO1NTTgt7Rf+HPg97TduvNgdjWl+LOqsrcq8fctMPa1NLYv97WrtrXtc7cvMzdwsXb49HayM/Z2OzZiufegNba0OfVv+jWt/bXjN7Yyuffjcbe9dbnzNnnx9npwsvl/t7ly97l1ODl2/Hc3ubpu9Dq/OroxdDt99fq9NPt8tju7PLpweDw0PXqvOft0/zmweHt7ebu3N/s+ujr6Onu4/Xr1PDs3fnsy9f0/97y/+Lz+f3xu+j32tz3+/vyw//wx+v14/n2vOP49ev26ur29Ov0/fTz6vjz5Pz3zfr31vH2+fT28vT81v/6yuz//Pr8+f3//CwAAAAASwBkAAAI/gD/CRxIsKDBgf4SKjzIsKHDhxAj/luYkKHCihIzarSoMN/EiyBDLtxIEmK+hCdT+sunkuXKlCxV+jt4sSRJlB1xnlyJUp8+fz95ehQYcudMmyZfJpSmr564pj6b1tMnruo4aODGjauX7+e/rvLGRVU6EmlBkEypSq1ab5zVtsig+eqFq64vaMTEQXvGjFmzXsCglZvq0iNGpBdP+rQarTE0aI4fPwbWixQnTng40YH0qA6dRJc5fSKlS5fgeiu/li2JM2q9xtEkQ9Plq7YvXc+A+SKVCA+YNlXOZJFiA0mVMG3C4MHjaNKoVMjE8jz8MORX1f7EtY1GDBiwUbR7/onvdds2KUe+wcBAEsPGDiVIiBQhUqWKljN06DgqpYtYOaUZwYSTP9LU8xo0wKSSCmej2CaeL8vQVoojZ4BRxQswtAeCC1IooQURICIRnxb3jbEfMYQN5ZBRXU3lj4HylHPVMwpWIkkgddRRii99MbPMM8v40hsYYRSB4QY2gACCEh7CAAMRMkD5AohgnOEIaahRd9ZEir0WWDSvgQOkLwrWEciZX3zxyCjL9PXjMr0kUoUOOgyhwwsxbBBDCy2ICKIMgMrAAqBFVNFGIrhAw9VRDCkWWyqlTEIKKb48IxeZklSiqaZrUPFFKkBuIyozpJxRxBBbbNEFCy9kIMMK/jqssMKrsLKgAwu4slBEEW184os4qVmkTznPTOgIHcvt14suvZRiSCCVrPLKtH9QwYEhQC4j6jN0vKBDqlYM0cUKttZpJ53m0pmrrlXgUQqYjBqkTze4YAbGvYbikUgp/NrxRSCrBPOKtJVQEcQMqXTTzTbMyHMGC1ZsMcTEsZqb6q3lUowrCTK88MIZk0DjFUPv3MLJHWEUWUTKbTDX3Bg1/LtKJZ0GEfMIdTTDjKjrZKLBxHayoAEMgqpLggYklIuxxxgiYSUwwDbUDCeWCKKqDl1kHUZwzamhxg41zCB2DSMEokYdvWyzzjLvrOPLBkmzcHQLfIwBQwZHQwAC/gQwxH10hno6Tcgu9sSLkD633GF1qqoKojUY+44yySn88tfNsjwyvM42auxhTy94tPBABXtQgowxhMQAAQRNnBDCGBu8IAN7NtSuBBhxEFJL4QbN9A7VVrORqvBsZF3FJ+vo0kwpOm+T9jbNRN/NM3sEwUEx5FRTRgx0uEAD9vbsc88EPdiSwBo5KDGGHewTd/tvcdzyX+/6rMOJIMQPz4Yg/L+ARCnraAbDlrG5bhBwHckDQhNGgQ9z4EMLMiiCDEhBAwaYgQlMkAMTFJCAKdjiA2oYAx2QoIQQLIEQcYBfLbphuInIYxmKCB4bZkhDQVgiDC9QwtrWAY7pKewd/qmog8J4sY928MMet5DBEKyggQy4QAgpKIEIPFACDxAgBaLLALo2AAI5bCIOccCDImpBjhb6Qx64uEMXGLeFGlrijXfYwDbesQxwsA0cUtDFHvaAj324gx/tgAc+prGCLURMAza4hztscQoPPCEJOCgBHJQgAytYgQUHOMMmFHEJRihijPhoYT7AkQk1SqyNM+TfG28Ig22AA4jAeMQH9tCNe9jyHtq4Bzfc4Q5uxCFpJMhAGepxCkmswpFJSIIHpPGKDWhABgegASxgcYlLuOKayejGyBACjk+grAsTa6MqBWGnDJyBGVMAQhokoYY8kAMf6gAkP/hhS3eo4x7T/tDC3UCwC0nkoA7x4MMjcdCBDoTgABUwAAJO4QlPaEITm3AFLMi4mhdyIgzqotMai+A4HRQhA6yoRh5OgQ983MOkuWxHO7hxj3YoEh7tMIc5uDENXgBBCp9ohjz4EIUSdGABOYjELELhBBUUYg5zKMQhNOEJWeyiGlwpiD58gYcwrAtXOtBAFzCWgV00EB+7cIdKVeoObYiVGyrlB0y9gQ9byIEcq6CH2qDRCBRMAAGNaAUsIpGMZJiiE4NAalI34YlaeGNRBBlHKc7wAhI49mgZcICtWOAAHcCgGvzAhzbIykt7irUdYlUHPGxJDnK4QA3rqEY3ArgOQyCgAta8/oNsOeGKYWBCsHBQqid2wQt7oAYh4oCE3TSANKE1EVcaUMIdElFPc9gTkLxUh1lbest9UKIM4MDK5sABvXcEYQBykAUj7lAFIsThmpfwAhS8AIekFiIUhKNONOqwgw04k7hNxNsLIEDEasiBD+awJT86qw15aqOP+DhFNZogBYWtzUf7WEcgEiAHYdDiZK3SAic+KQsveBip77UFMnhHlGg8Ygcj2EAGMtBECEg2A0rAxzNOgAILuEOR6uAsN+bJj2qgoQ5A8MvCDIjAZqxjFRVwgjCSIQxCKKINHouDImDhCTOY4cN9WAQrRqwPoviDGHuQwggesAEHZAACMXCE/gYcwIp7FCMBehACPm4MyF3eYx/8YMUuTiGFrCxsH6LahraaAQ0OfCAUsLimlO/gijhMMxme4AEUJg2FOfSBFbwYx1FWAuYpuGAEIDCzA0BQAQg44h7q2EUC3HAEk06DrGTN8zRYoYs0AIOOOxPg2vaxBgL0oZqMQMQna4uJWcxCGLBYBBSW0IMlkIEMpnvKQOoRjD04IQQmUBIIWjABAgDABuS4MQHcUAJe2NKIA9aGA+c5jWZUgBi6AEcAGQahVFQgB3N4gysUgYhkWFMYxzhGMmYRi0KQoQcI70EZ9gCdTesDzEVVgQl6YAIeuMENBGBAMe68AC744BT34PEt/mVaYH70wgZfqIAaVosLZugCGH9oQKXnYE1OHKMWrojFwGMRC2HMAQo5cIELcjCFNKwiagJ5uCScAMUUpIAHN7j4BcggyGokgAtJ4CM3dllWfqgjx4p0hzHQEIgAfAE8kZpEEA7QhzkMYhCdIHjPh9EJYchCFgVnttCBIDOkv6gco0BD01GAghs8wQ0YoII91LoAETxhD6gGbYB3rFJF3tkdz0iDFKTwiEewjwMNkANS4bBUnvN8ybEYRijMAIUe5EBsa6hEMMRBEH1EI/BMIDzho+CGKKSgAWkwxj6CoAAuoMEcZuWlEXX5x63/8Za86EUd1JCFGVTADHPI7Rw8/oGJusfC2MOIRSNE0IMm5AAIawBYMOiBkHpA4xQaLEEKCB91VGCA8BegQgcIwAUnmPTGuORSndUOOSZa8MAP2tAEI3A2M0AAfFAIXgCBheAJh9BQeDcLw+ADKrAETcB3f1AJv7B+tfcMuBdFJUB4JUABFMAFXPAEKcAAANB/bGUOu9BSoAVa9DRPX/d100AJeVAHLrAGIaACfYAJejAIcEB6hUBYhzAIsdAHZNAELkAFH/gKv3AN9MAo+gANgScEukd/hncFT/AEV8AFAsAFF+AElIAPnNVS9qRLBPh1aKUNvEAJTZBOJ7AEfUB67TV6PIBUmyAHTRACMxB7r6AM/thwDemghSSIBkzgAyIgAiZgAiJgBG4ghklQhgFwBSpAAA1ADiEHWjt4g2bFDZulDdqwC9pgC3swBVNQASCwBFDQCG0HB2/gBYvQCE5QARVQiJVghb+ADdiADg7XiD0gBNnmHh9wAChQhmRohiggAgFAAMaADzBlTweoDp3lQNWAiu7gDdywC/20BkEwBSFgASEgBF4QB7fIAxdAABwQBH+gClZoDddgDdaADuyXdMBQCmXwAz/gHiNANgcwASpoeFzAABfgUwgwDd7gDaKljd5gDt7wRwfYS6HFDeoQjqxACWlQB1IABCFQAQuwABxgkkEQe6qQC8GIj/h4DSfB/o+SUAYIlwVYUAM4iQUPIAITMAElgAEAcAFXkAYccAvwAFP24A5z9pCgJVZnNVY0NQ3iSAl7lAZpMAVUkJXpR4/AaA2/QA3UYA3UgIWMYmJNAAI2kAV+4AdYgAWgEAR7YAYioAAB8AENwAU58AXdMArGsAeBoAsO5IYDiFbUlW7TUA2nQAmSYAdTkH5/8JgD8wvKcA2/IJb4CJbUsI8CIQ57kAMmYANY4AegAAqi6QdUsAy4cAIGUAoG4AYmIApBgAALAALZBgKUUA3O5VydpXx/tFJbl4odCTDSMi2/IJnK4Awu6ZKKuBObGQguAAIjEJqjOZ01YAjbUAYP4AsH/uAGPLAABnAG/EYInKAFIJAGpUWAyjdWKwWOpiiOxsALucCSh1iZ1uAMzgCWLnkO14AO4ZAOE0EUgXCO0Tmdo5kJI2AIvtAED9ALC+ADF2ACfbBviBAHrUAIi/AB/ucO8KCNu6lS3OAN4iiOrMAKsncNiRiW+4kO7HCP1oAN54AN7JAO7DcU/lAJQDACAxmafgAIoLABOwAJvZADH+ALVCAACxAKySAHhJBzrnAJsBAKTEAGA7abqKgN4bgLtmAL4piKK5kN6YAO6HAN7HAO1nAO56CiZAqm6eARKrIKU2ADI7ADN9mWG4AFdUAJo3ACCTADIQAAMxAKfygM4WdN/rUFCz9ACUnJS4qEiiG6C5jGC92oD/NwDftpppZqqezADpdJljS6CmrQITuwA1KQBVmgBnQwCWuAAB3gAkwABQtwAhaQA2hgBsnQCcMwDJcQCZuwCT/wDO2gbsZAg6xQC1mapU9VDc0QD9kQDKpQqeeQqWNKpvaImYuoIsQwfdRnB2rAPpPQC19gABWApBN1C2bwAxdQlyKAd8kgUbCQDFCQBopkDsZgC8ZgDCOqZ5C6WvggD/EwD9gQD+hwpmWaqQE7lmAZDujQDzRKDJAyCZPQHJLSC6+wAA/gZGLgSYjgCnLQAAYQACYQCp4wDO3aV6HQA+ZADvVqC6xgDCFa/g3kUA7gIA/ykA3xEA/ikA7Z8A3ZAKZnqp9iSQ33OaMDMQ6+UArNUjmlsA0d8AGuMAv7xgitwAiRUAh8EAASQAc8UAiz0FexYAqyYAKUIKxaygvGUA3PoDDjwK81u7Y1qw/xoJ/UAKZgqQz4KKPB4g/RAAy6UAoNwi+psAMWkAy3ugmhoAit0AbG5gVC0AMD0AS04AkERwuxEApN0ASUwArcMKKQugzdkBUzmw2gC7rxoA/8Kg/pQKnXQA0tiY/skA/z0GX/sIWpIDmd13lE2QmxIAvrtQnTVFt/tQkS0AAVwAQNFQu0gAmLEAJZMAl5QArVYLb7+g5RwbbfEA/9/lCzoHu6lIm6ZZoO8eC6NPodzEsHeZAHagAEU5AMi6ACTFALW1sLA9cJnTAHjWACCqACoXAIhTAIh0AGFYAFhvAs0SAOMju6Buy28UAP87DANluz1/ANlFqcxfkNuRAM0eATE1EPuuCD+TEGWlAGSUJxPWAGhfB9s1ALsiAMnrAJXnAIh7AEEgABSTUHD7AA2YAN1jCZJlq94vC6pCsP77Cm8/AN7KCzNwy60RAMwUAMSpwKq5AXsDsOusAKKFTFcTAHh8AD3mMBPfADWntssrCrP1BpR3AEc2AGOdAA1SmMwogO6ZAO7OC2bkuz1ssScAy63xANz7DHwLDHpXEK/jZydLTnD+VwC6EQCpEQCWCkCEK1CTkAAB3bA1/crrGQbCZABo3ABC5AAAgQBK8QrXAMpgGrD9kgDmwrDt+QyjoLG3v8vLipDfW6JlAsEPbAC7eQyInMyIwgDLNgAgAAAB/wAX2gCbkrDH9VC8FrAQawAPLoDOygoulwpm/sxsuaDXNcs29Ms1cBDacTrN2IVjVlDMgAxQlRDrtQC6GwCZGgCVKrCLHQCRfKASHgBCKwfXj3V41QAegLBFRghZlqpv98DtrrlYnopezgpd+AFWJStsj3WXNYDeI8FUFRDlO8q5vwUNX0fZvQAwswBRLwA43gCYWACYewCU3AAcEg/gqGoAplag3s8LYB27NqSqnTkg3z8MbY8Bi8AMsVuUvqOQ3m0A2DERXDwguNsAibsISeYMKzIAs/AKt6iEEMwAOHAAUGsAYqSg3nMLdlCtA9a6llKsGgKw7ZoAvVsAum+KG9tHUqBdQvKw4n8RTIkJh9UAiF8FDHBgvCIAyLwABO0NcXMAcZNAYmSalhaZ/3qdWWGrCivNUt/QuvcA16+wzGsHVct0vaMA2m2EDdUDgJURXEIAloQAZt51DgJwyxsAgNQAZZ7AReAMMDMAPHCbTUMNuXGtNmqthmaqLYwJKVAKlWWpGgZYq2ZKXV4A7k4FtAgQzigAx70ARLgH13/u0JyXCLtcAHBnACHJBQC4AAHPAH92mfsx2tlzqmPBvTmIkOIbgHyDAFxvCUtmTZuXRg5OAi/sDcq5AGQNAD64VUh9AHfDAHi2ACJCnP8fgHykDb92mmARut5h3TuH0Nz3oN4aDEaeACTfAM+ABIi4qKppjZ+FDfCkEMyJDfOYBwUIB9k0YITSABFiAJwPAFNaAKX3kNzkC3ZQqmLk2ml4qpMXqp1vANweCmQNANl3vcaLVSuVRWIe7Zn10PYHbiYzxp5SoBFSAFdiAFqZAL2bDViW2mLp0NBMvguM3g+AjmBx0MkrAHavAMdvAAD0AK32iKv5rZ7uCy5BAU9y0O/qHdBJQGBQdHA2sgCqlQA3ZQs5oKluVtvezQD/3As88ao19K5tTgvamgBjaQB9DgNs2Q6Q4kVpmNm92ID06eD1WBDDM5aS3AgWoQCDTwCtmQC/HwzwGNqdng6Gd6n2Me6c96DvSADrlgCJDgCI4wDdCgNtuAC1mwD82wC4dZpc+b3HrOFdEgCU1gA9eO5ZBgCH8Aowf9z1p9j1qdqf3wzDfuDGAarTkereIADJCgPjvDDGuD7M2AC83LCy2rDaWVJQnBFeIQCFPAYFlgCKLA5f/s0mJ5ptCqpo7On/YZDs8669D6rMKYB01gIp8gKtBAQL7AMMleOaTQC84e7XrO/hL/IA6VUAdZAAiQIAowuuO5rdWMrYgz8ejoYJ9v3LNvew7hQA9z/QmfQAdYgAub0wxsUxvkIe/O0wunQAqncAu8wAvPoNzMOREp3fIGf+aYialm6uj9QA887wzhQLdjOqazjg1DTgUh0AAfgAa+UPTVsAzQ0CNzQUA+ogukwC+nwAvIUA4/YRgf8Q29nQ2XiZkyD9Be3/C1jdjn8OgAzQ63QOwPwAAKwAAMMAAGkArrsDND1g3M0Ava4iN9IR553wu8MBg5cRLzkKk4nPBmirBuXO647uWMD+bW0A/n8AuqMAZj0AQDoAAFEAEFUAABIEQLswzaoi3bMGR8ASfj/nEbW1ETX5EP6aD1XR3p5S7Kc4vY4x6t/fAKM7AAA0AAHcsAGKCCERABFpAGz7D8osK5Z8sMfDH6ny8eL/cf0gAS+UAPrc/63o77AJEO3TVnzpQVDBcO3blz7ByeQzcjgIIIEQpMvPHkyQ0PCvboYsZs2Tpm20SG7BVSZC+Qz6KN0+fPX75/Mv3pS4fN2k6GEM9do0bNYDhn1NChS+fQYTZ2575NEVGCAoUIHgqUwJGkhAIFanwtWxYSbNhlX32d7QUWGrRy4mLanJkvH7101s7tFHow6F6gSNnNi8duJ7tsv4g58ZFVa4oIWLV6UDFlUq+vKpf1wgyy1zPOzKCB/quX761MmnLzYUsH9BrQgtSsrRY4L+k8dthqYwOWq9QeJxmTJMFBFSsOHBhUNLFTKi3nZbqe6dKF+VlZzt3qjc7nrybpfHWtBX39i9o1a9iupUMvEB02bLmgiRL16FGTHz6eAC8R4YIHHzduCOmhjElKKeUszZjJ7KzpOJMHJrn+qWm77PJJKCjxLHRNJ/NWY689VQCB5JFJ6kBDhcR+KyEFEVQw8QcmmijjkQJ9ScmssZjrZhlw7JFGpu0gnFC0fMQh75edyltttdeoUeaXX3SDxI5JHrHDjiZ68CExHHxIoYcmvoRxDzseGWXG5zhzbpm1PgNHHnn0+VE7CG0a/vIbJX/Bxkkjf2lSmSZ/AQYSSBxxZBJD61CjCSZ8WBRAGNWoMo8pSxkFGEt9gYYzaNTsBpxOGxwNQlEllEucbHLJBU8jqXGSVSdfUUWUUkiZlcApES2DDF3LKEONPOqQj8xRUoHumUzVVBOcz8ZhVp+3RhUVrpnEiQZVUVTRk9VXtl0FPkgIxIzAUkScco88+MiDEvlGGVaXSi0FZk02y4GmQZj0Ec1HaGvK7iZ9xHkPElCuffWVVWJNhcCzFgYmFV9SGYVMSSCmOBVLicEYmmg21niczxoUx617+9131JlmAmwZRwABxBBVYI1VxhnHUvNiYFYhBplUkFkFGYx96CYmmqA33phZZsWByU18faSp5B/7dRacUliGRBSDRUkllZS6WTYacMDZOGiMxx47mpDNDjltca7T57pxTobbaadlclYeUiapehVggiHms3LksaeecepRm9poghGHmJAVT/zstJ3FF/KlT5YbWjlHzU4faHKJd223tItpO3/dKpza0ockPXJ8RddO38ortwlf0/iNlvWTnS29dGfjjvCf7Hp/XW7SbIId7phMM00caYZc3lnTbqLp8uCn31f6uX2HO3bZVRfHnx6Pd5168ce3nM7spDm++6VHC59898nv16bvb4qL6ff3DQgAOw==';\r\n\r\n\t// Imagenes para cada una de las celdas productoras de un recurso\r\n\timagenes[\"r0\"] = 'R0lGODdhSABHAOf+AAcGBwoYBSkMAAYeARwZDQ8oARsoBTIiChU2AConGRw0Ah4yDiIyBSUyHTM0BRpBBUEyATE4GCc/ECRCCSJGACtBBjBAEksyGy1DHEQ4HTRAKCZRBTdMBy1PEy1OGzFQCCtXADlOFDZOHjlMJ1BCKENJJlNEGT9MNGI/JzJgCG0/HDZfFUpMSDZlAz9fC2dIH1JNPz9eGD9cJGlLDU9UMU9YK39FE0tcJ0dcNV5TJ2RTHE1fHWdQKFRcJWRSNE5bQj1wAj9uEEJuGUhtEERtIkVtMFhmNU9uJVFsL1BrOHZdH1doQGVgS1dnT3NhKnFgNX1dMGBjX3ddQ15uLUp+EIRfI1F8IFx4J1J8MFN9KVl+GFt5MpBgKmhuTF15PHJsSY9gPGR7I157RoRtLn1uQmN5Um53Rml2WlmMHnJ0aFuNKGOIMXt0W12MMWCLPWeIP22FQF2VGGmISWmHUm6LNmuSJ7JuLJh4QXWEZniHWX6HS2aYM2iWO4t9ZmeaLYCDZ4OEXHCVPKR7PIyCW4KDfK16SXeZT2+nNXWkNXiXc3KkP32ZYHyjNHakSIiXaZyMb3KvLYeXd3qsLZSUa5STcpKTe5eYWo6UiYSmSX2sPnmxPn2vUn+wSpGreouyZoi8RJ2jk56hnKSpYYHBQZWqhp6oeZqnipSwb6Wkg6GlirGieZO8VYvFVovMOZDMS4bWOrO1eqW5kq+wq6a4mqW8irK3irO1k5LXQay3qLO3nZfXVJDnLqHMk6PXWq/JmcLCn7XKo7/ImsnGisnDm73Io8HFq7rKrcHGwb3Kt8XHt7/YqM7SuMbXuc/Yp8bbs8/atM7Xzd3WrdHZx9vat9bX1c/fwdbcwdrlxt3mzdfrw+jkweLk2NXtztbr19vr0eTpxOHtuujnz9/r2e7queHtzeTs1Ofp5urs4eX32tP/5ef7y/r3suv50u705/P20fr2v/v3uer45e/33fTz6fP18v34yff33/76w/X1+/b+7P/3/fn7+Pz6/vz99Pz+//3//CwAAAAASABHAAAI/gD/CRxIsKDBgwL3DVRYkOE+hggTNnxI8WHEixj5DdTIUKPGf/w+GgwJUmQ/fyEf0ltJD6NLhPwUhvxo8eVCkP7oxcTHct9Km0A3/oNYEiRIogZbivynD5+5p/NYBn0pUmRHoQdnhqLGUaE+etuWSdsWteXUqU+X/jtG7SK+KG1J9uOJbFYsZuLazTvrkiRIWbI+eiQUSu1CfiyoOaVGbRs9c7M6naJV7Vw7oAz9FZUoMd8+ffzOhNLnrx/OEpf4+ctJ7di/1sfoBcA19tgxWYSOzVpk6JQyb3sxD0Q5NGbR0vtC/vjDD59ppxjOrKa377Z1aLgCVNJ7bt8yZPJI/sHh4+nUNXFBrwr0KLK0PtI4zqjud1KcAhrUcF06h7tdvnj5nFHAD/aEE088Z+ASDzByBIKJJ86gZ5NVZkEUEkr9NCdNCCJs448985iDywMWXCJOOO1c0kQ85HgTzwgSSICNPd5UcwIu7XQjxhqNbOIJNlMpRI0s6xU3VGsK+TOLCzKYkl8x0OBBQQdNyOONPWf8IA858qSCgAcKmNIOOs4wEEk7xhjxBo+nVDPhUf3IEoVpfoWEG1PmJELFEDhsg0058ZSxwgojWIMOOTjgkM038uCBAAUVjLANOqQU0MQ+3ZAyxwpZeMKMTJpFRNM/hCTQDkTU4RMKIefYRgQV/kB4gIs87kgjQgsbIDArMCIgEMt/TSjwwAQGIBPPDQucAI0/0ogRAxZvGIMUTEP9008aCWyTkDm2vUVIP/QcswIauF6CDjvMeNCCCwiwQOkEMtRQjTQGiEDBBANcgowCHCxgDDqObOHGGlm8MU9FyWmUD0j6WMuPPifhIEIo/kAjyyWoJNNPHkuUgw8eIMSRQhBwmdPEB0C00MEEykTyQQwNIFOJAhs88MACaXTRwAYF4CGPMTjQocYacLBkDj0NV0uSWQ0fI8IHeFATiiyT5iNOEhIg004ZQFDhdRnd4ILAECmksEEHIkggBMx4aMABBRtQIEEBASyAgKX2sIMD/hJHxHCDONskkwwostBjSi70rHYOt42Zg0cMMXRYToDWtINMBSAkAswGXlNhBQIYeADCEEIQAcIRCnSwLgIDSPDBA3GLUMEAWFghQQN4oNNNJGXQUAI00pBihhlNLAHHDbL4s80IGoywQAQnSECEFQ9sd44GxibiQhwIPCCEECDwjIAbG5QvRAtBrDCACylQ8IEBX3awAQcMVPBAHKsoAEAa5KBjDjJ/IIExSLGINbyhAUSowxGaYI48bEEMWDiCGETwAPSBgAbt2Ab2uBGDIFChAxXYAgLmEIITFGEVdeAD7IIQhAogYGQpGIIHEGCBByBgAhJAwCF0IYkHnMBY/layBiV8MAtHGIIPWQiAFT6BiQVoQAZrwIIWtLAFCawgZS3AATSMYYBZzOIDWjjCEiLQgx0koQc58IIc4LCGGHhgA0DoAAKEEIQNgIAICDBAzYiwgAJA4hauaEQiSJEIZpDjGqjwgSPmYIhM7GEFiuCECDEgAixQQYo3KAAIgBAEIDyAFGWYwB9mMYUY9OALlYAFONahDWFYwgw1mIIXJDABFyjABStoAfrqOABPjKIXLSCCInqhC1a0oA5vWAQ5rPEIHxgiC23IxCFYsYcWxKADS8BAB9RQhCHcoAErCEILgLACD0zgAyf4QQ3EIIp11KMe67hHON45Dlt0YQlT/vjA3UAQzhYIIY4eaMQrXuGKVbwBCKMYRRxasYobGMMYk/hCINqghk0oAhFBEEIE1yCHeo1gAgUI3TiBEEcKbAEDNdBDNO5xj3qwlKXwcOk7okEG3wWAA0MgKSdXsIBWvOIWvWgFJKzghw5o4hat6MUnhFCKQZChEXvYgyI0oYhNcEIRaLCCDArgAqX6QQgbgGEKHrWDGpihGS6Fx0theo93xLQZgKjBCBRAgRQIoWwgKMItXqGLUQCSE0r9xCfUgIZVzMERTlXDHtBABU1kYhOQgIQf1NCBAqBhFz/VBRXuWDoExAAJZhBGTF360nfK1K31EEYXujCHmnWgCIOK/kEvbhHZn7riFrcYxR6ssAEZzCESgPgCH/bgtcdu4hCaUEMbiiCBTfBVF66ABBVSAAQKKOAGPZjEPdYR05autR7wUKta71ELI3ACEUOYkhsasQI19CKhA8XtKD5xCEhsogzMiMUkJsGHHh1iD1loRCAMEYMhIEEEcKACEbDACE64AQRBmEAFemCGd7Q0vKRda3jDa+FxmKEOq1DhA7KwCRYqQhe4ja8rDuGHOnxgFtVoRjCM4YbhckINK3CBdUPwhg/Ubw0vi8HrOqA+Uw7iHvBw61qXvOGXTuIG1yxAEfjgWD6kgBWtGAWKXeGK3jaBFPHgBjcO+cw2UHUNdAhD/gzesAUFYAAEfOBEIBAggiTgCwEuqMEw3vHOeDK5rUtOLQ6SEIMNtOETjm3EA/ygi168tw2joMIAmtCO/pVDHOfYAhH4gAhE8MENdchCFso5B0Qgdw8dEMMWYiCGImygB9pwJ3gD7dJ6WNitfI5GDwxxVU3EQRKMaMSrenGIRlxyE6PgJjLCIY54+KQTZhCDDCJAAAZEQAMNGIEh6qsIafrBCoSVxBwcQIN3LlnDgE73O95hBD1AdhSQ0AQn/JCAJrwCEh4oAhpcoQkh3ADM8qDOPgaYhCVoAAANSEMlmjAAM49iE3zAAhbccIVAhKEADMiBNlhq7u+u1cIvHQcN/kIgBE1EFhKHsEIJsDDQoArVD0SwQDW8IQ+KMKMapMgGHgjAgn0kQgYPSAHEzXa2N2RBBh6IlxFUcesMv3S867b1uoWxBDGsgBOaOMQhFNEGERDhFa2ogxbqoAiiJQIdBzrVP7CBDZqz4QJRMEcS3KCIPXAiCHv4tBskPqwiiKAGk5i10z+O2nXfoxR6MMQGpMqJRvBBCCfwgC72YAACJKAIMhCBMa7hon34Yx/YEAc65PF2FpiiCJGEBCeosIcWt7EDR3BDDBRgBDLY2rvnTneS7wEOPazhCiBQQxYwQb4kyOIEBDOBFEggBvyi41Dy6EdyLl0OeQziBVHABi2G/qAG5GqiEWrQQgwssAAZiNoLSagBLNTq9MEbfh2w2IEkMrGKVViBvQgART5IgAEj6GAMfZAP3qA76HAN5aAQ+zCA3UAOTlAFPgMOIYAFVgUJXHcEDDACb5QFV3AEf0cG0dBxuZduzaAHenALjaYIQdAIGtUAf8ADoQANSsAFoZAP5YAO3nANW3Iw/zCALEIGDpgPyBABSeACexBvfOABEmAEfCNqMSADRpBS49BdpUVaIDcOenADp5BlcUAFasAJFjUADXABtrAMPDADzbAN7VCD3kAO5BAO1MEN2cAN1zAGXJAD1mALKpABARAIm2AIHfAybiAEK+AFopYFWIAE/jwwCCu1ZOs2WtOgB0fACLcFCSvwAXyQCZHlB4cQApdwDTNQBdbwDX+AC+dwKNiADObAD9WQDcAQCSZwBzUQCZ2gCl/QIFgwAKmmaRuwAkeQBVYwBFdQBEbgBE4AC+PwdEh2D+NQC2YwBZjACrjlCm7wAY1QXyj3CXAAA8WgA0qQC6WQC2mQBuJgDdZQDOawD9VgDMDgCD2QAXpQBrQwDGUgB0SGAyPAADeABd+TBZoWRUXwAFtwBT5ABo8wDNpwkMPwSmW0CkGFW71APmtgUdN0CDBjDDoABakwDb9ACD9wBsZgDdBAHdfADMQQDLVgC8HADL4QDKQgARageZXA/gCVJHH8iAUrsAUr8AaNoAh5cAM1UAM9EJRGcARbcARWsAo+BXausAIP4AKO92lZYAFMsI1Q8AfykA3SwAZ/UAnWcA7UgQzikA3sMHPfgA3c8AzpgAcv0AXSkAsOwAAxEIgx0DcUQARE4AZ78Al7oAaZkAmI0GDBhgmNoAW3pWJ7sAYb8AZHQAEecAPKFwljAAWT4AyVswx/YAvJkIr8QAqk8JHkwA3u4CffgA59AAZSkI4jtwL6eE0UcARFUAQUQAUnh3ImF1lU1TWu0AomCEis0AhHhwEAYAqOIAUX8Ac6AAFLEAvGIA7LQAm2kAvdsQ+LIAdloH/OgA6T8g3M/sAGNvAEzlAKIXADAnMFmrYFWyAHMoAFjSBvx6UJWddtmVAHWDAExKRlrSBUiOAJNxAAAJALgMADFyA8gDALwMAM4VAMqFAMqUANyXEKhuAFswAKeQAM9HAozJADYJADnUBCSLCLRFkEH9ABIRAAK7AJmuAHfsAJW5d1WdcGRLACn5BluqALQhUHQsCfwakHOZABs+AL1ZAOcVgO0zANuQCdQ2EMhmAIclAEWCAGvmCDzGAMpgAMsUAKGVACIYAASZAEbYAAPSADGxAHnOBIVoAJ7qkFgdAIVhAGVrBgt7ALNPoKcRABGSAAAAAAeDAIOZADtKAMzrAN3GAKf1AM/suQC9JAHf7ADA6KBVnACV7QCezgDeVQDuHwDdeQC1LgA7HgAQtgAUIQAQkQAVgwCo1gCG0AAkLABy3QiylgBWugBm6ABO9VBHGgCFiAB2wABixwBvrlAxDQCcrADfMgislQDJVQDGTxENDADIvwBp12BJ2QDTY4qc1mCyiAAl5EAwfAABqAAhdQA0TQAUSwCWtwBIPyBljQBm2QBXywAgGwA+5aBDdwA8ggBSqgjcAACCYACHngDPKQDLlQDMVQpNZwgD5hDt0QC6eACYxgBLTQIqYQD+WADelQC1yAAsyADChQCDDwCE6AAmlQBiJQB/KGBV6wCDHgi2hABHPA/p8mkAMEcAIX4APMAAY2cAKx4AuRYAvD8AzEag2pkArkiA1u6BPtcA7SAAwOGgtriA2zQA7f8A3c4AhcoAK2QAxSwAVNQAZK8ALJkA4jywl08D4DMAFu8DkY0AR3SgJjQAJdAAZQEAlQYAM4oAy+0AzsMA2ocAZB+wcfiQ3S8B3naLTdUA2GGw/iIA41yA3PlwtPwAVgMAcraQm08AVjkAF/kA1zgAkiYARLkAEZEAlJcAMHEACkAAgt+AIkAAhkQAZ4AAWCcALKAAzOYAwIygagsAzhcA3YkI64gIo+QQ/t0A436A1/4g0D+HwFaApS8AiJ0AmOUAq+gApOQAJ9/lAKXwABP4AOqQADJEAMiTACYJAAsYC3T8ADX9AMpyAMbAC7GYAHzuAIlPAMl5AKkzqp3tANGesYOYEP8zAP4sB21cAl5LAMxgAKoJAIZcAElRAJpVAMfZAKj6AEF5AbTKADURAPtiAFPFAKzdAFdmACkzBjX2ACNeAMvOALMIACNnABqhAJjpAPfxAJ9lAO5FAOyNsN3CAO1PEPK8EPwtu7UWoLlVDEQTsLplCOgpoKoFC5Y2ACzKAMUmAHNKAMs/CypqAMZGAHKIAKvFALTqAEX6AMzLAMj/AIlEAKzPAIuRANgJAP3WCD3GDD5BAPP5wTLDEPfrIMSIwKlPAH/oDMBnggsDOnO85guTkQGRlQCBngCJHgBDpgCs6AB1XAA3+gDKWgBGPwBMqgDNdwDVwiZtKQkYDAeWv4DeWAhqfSwxSxEu0gDcYwC6hgCpUwy8aguzYsD+hgw9lABjMAAaVAC0xgAqbgC5NQBVUwCcrwB2NACTlbCk4gCDzQp8AwDddgg+jQDrkwDX/ADLs8rfFQFkbxEHhMD0hrDEGbzsZQDechDeIQy9nQDGwwBjkQCbxQDM+pDICAzMp8Dc3ADMDgC6UABXfwArXgC7RgDM+AduIACqbgDpNgCt3QDc3mlQL3EB5BD/jAE9sADQA7C6lgCrYwCw81L8xQDN4c/gxfAMmAoAzV4AzOoM9cUAUtnQ2sGAvAoAc68AJP4AjAENCHRLS2UA/RgAfG4A2Y1g70UBYCtx4+wROP4dG4kAumEAkwTArKyQzWMMDOQAwnyQzqgA5wqAyTcAc0HazcQMbMqgp9UAvPcHPL9AepYA/aUAvDUAzSMBbmoNQX7REJEbzmcA7bEDi4UNV5IAZJUAZnEAnG0Lu8y7v2QA5hCQwtowRQcAa+AAwLONHgwA7zAA5rOA148AW2oA3fMAy/YA3eMBbnUBY+oRr/ECoUAcQb/RTQcAy4wDtbmgQ4UAamwM7VwA0TLQ7ksA3fENBnAAEQgNl/qg3tIA7qQA7t/pAOP8MEcx0NX/AL2HAe8XAOi8MSOUERRkESKvEYgZ0fppAIreaaScDYwe0NO/wnLdLVxWAMzHDf3bCGVoK8SIxW4NAMqGAN1+DOwxsiLAHV+4APKLEUrbwST7ENuJ0Ki2SeXlAGd+Gz6SgN3YANbPgNz0AOwc0NSM12220NwxAN0aANtpAKrd0O4KITKwHVOiHeIxETKsET+LAN1FAXnTCdXiAGHuwM1RClzPAn+Fu8240N1nDSubAM0TAN2hAOy7ANi6MaNk4dLDHjGF0QgpEQWf4U1AANBgy9joDTyvAM1aDaBojU4rDhRLsMhRq0v7AM+DwM8/AVNu55nzcdsCqRHBhtGOtB3ln+v+bQ0XVhDM7w1px3vDhMtOW4DEQssLpbpE+BDxaRHCuhEnl+FIB+EFvueSvxv48BODdXDX8iDvIgD8OLDLiAC8gK56qACrobIvpwMBit5znxeSlh40bRFymhEroeE/Mg4+2w10o9D0c7D4JtDv87D8kgDeEQFeDyMMkxFBTxebN9671OFXl+7RQRFXx97CHyFN5N7oPd2kgj3gkzE79+68ZxEAEBADs=';\r\n\timagenes[\"r1\"] = 'R0lGODdhRwBJAOf/ABEIByEHCjcJAC4SAh4WLiAgBy0fCVQcAEgkBCcuREcpGUglLDU9BUI1Hzk4MUg6CmYsCVsxDTQ+anAzA208B3o5GV1HIGZEGVRQEm9JCHRDHkFQZ4FAEIhAAFRWJlVJaWhRFFFRVJRAAm9TA1JYPm9MM0NnHU1RgmhULWBURklRlWVVOHRSKZVFIYhTA4JYApdODJJPHVVzGaVPE41UPYFdMlRbvEx9HFJ5KlpimcJKAIVmEYphI1xngrNTB5RdJqRdAJVbNJxhAZRmAnhsL2N2NoJpLJFmFFtnrG1wTXRmcF9ktYdlSHlsS4FrQKheHJViO2dwbmdplnJvWXhxQ5FoPqdhMXCFHV6MK5J7CWWLPaV1EXJ7i8hlHXmCWnOEbKt7BYaBT5F8ULluMK5yOoyCRniCf6N3RcFzCXGOVKtzR4KGUnR/pdVpE7hwQOFmC+tiB6p9Nb58BGqeM3OAvY+DZHOZSmukK55/Z3SeP6p/Wp2MQ3WB7oSeLo6Md79+QMN8SrKEUJiQWbyATo+UXsZ6YYWZb4yUd3+I385/Q4mUj3auQsKRNYWsXr+TSH+2PXW8OcuNW9aMWamgcJ2mcduNUpGtc8KZW5imjcmVY5ungcmWceaLYteWVJaf2befh7+ed+qRVeWUU+SVWqCqqbOphe+WSuqUZOqYUJi8b/OWQ9OjV92bZ+WYYvOTV+OYafCWUfmQWe+Tba+tl+OeXKOtvsytT+2bWtipSeybYPOaXsevZ7mxg6W6j6i3nYzYQLG3kZLXUfafb6XHf/Cmcemug/WxWLXJmrjJorfIq8bDoePCZ8DEv8XGr/TAUNq/pfO/Z9HInvHNV9fTnsfbq8fassnau9TXutHYw9rUwNnat9XX3NbZz+TYyfXXuNbnzfLay93mzdTry+vmr+Hl29/qy+Tm1eznut3uxt/q2N3u1Nnu4OTs1PPn2ufr6Ob1xevt4/Pr4+j21ev03eX33v30sfHy4vr2v+r36/Xz6vv4yv/8sPT28//7w/r8+f3//CwAAAAARwBJAAAI/gD/CRTor6DBgvzccctmSJMhQl681KFCJYygSZOydTPHkSM5cvDi5YNHsiS8fPn48Ts4sKXLgf4I/jOo8iRHX74waerVS5PPKUCTEApDqFS2o926tYsXzx3TpyJVrmQZ86XVqjThmYOHDFm1asiOJaNGthq1Y71yOiS0htCkUpOAlWp2LVuzo0c5tpM69WBBqy1jHuRHTlkzr16/fiuXTpxjcejeURNH9hglQ20JXcTIq5TnUrx4RatrLh7fvoADz/Sn0lxYZMmsWUNXrhy7dPDS4ZMnjt66dPMimz22lpBbQYLKiEGOHKNhjUylGkwNEyE8a1+rlVP3LXLv7fTe/q1bx40ZJkzf1qkTZy2sJkqUNJeZr3x587fN7nZzqnI6YIT8XFcNe/KUQ4866xyIz4HtHdIECBB6oIw7wLHzTXu9wGdcGVTMtwd9zE0SmjLZcGPaVKmxxo9s1tRWID21YYNNM4eIIYYRPGSwhRByyPECL/wAN0856FAWFnxrULHGGmGUsYcYyoUYVzPYpOTfS/7kE4414tSmDj3yXENCEiBkkKMQaMpxxBZAAAHGDlSMh5Mv12ypTTLJINPTIUPR52cZglDCSzLYpGPlXy8F+M2i6XzzTjnzrPBADVvIgQYQLriwhQtovHAEGC7s0AAfSJxwggQJhGBGFGZ8oQgm/rMA45MXTRIRRkWEUAJMV9V8o449KwHGz6K1mfPOO/4o8sAuZLwwBBBCHOHCEUN0+gKaW2TAhicqSMGGBAQkkMAGJ+TQQxSYKHMMJodEFNEhmBwDDJfofJPOVii6xI854VyjjTzv0ENKAXtIg8sIRzib8BDP7gAGDHI8MYQTYMpDDz3aYOMLKWwgQscGilhDDVjJAAMMJsgoo41jsuU3o2mIDsTPNqQoQgoptdRiwQjLOOPMDi8EzTDDT2wxRJpj7HDILHU0Y48firgjzz8dqxCCNfJoZQ477BSaDjmLYlLHFHUsnU2+MG3DRg5IILHEBxbgYszcl2TwgwtCQIsm/hiVairEEBAMMsgmbnRAAR7AlGMGEohIEEUyi35zTTnhLErhFBZcwMIKJPjRTDxX/jMzHTmoQMcHA2TiszPQQOPsC3gP8QIHL/CdBQUvRMABIMQAIkIXMERQgx/MSIAIHzZsoPwGIWzQwwZcsBECC56WoAQXZpDCDdqib6NECCngUUMGuECDy+pgvLDF+juM0P4IBwBgAC5xsGL/GF200cEBZzDxCcdIUEEObEBAAi7BBnyQggFqB4IPSEEKPeBCLbaBtpnpARDCMAUxoLALEAygCqxjBQUykIELBMAARLAAKEAAAAwsgweiQIUoRNCGN3ShBQdQAwqaIY9qaEIR/qxShBCjwCoHZGAIGUjB2gQIwQnG7B/t0IUuVgGFCRzAFg8IgBGkAQ1GxGEPDgAAAAbwgAUsIwMAWMELUbGJIMzgDXC44QEqoAcLKONiF1vHPPBID18MAAEXsEA00KGJKPSADWzgAgX/UpB2CEMYUKiAGzjgCBRocRlddEQcxAiAEthiALaIAwfigAsQoOIPMfABHLsggifAABBq2IQeQDGX/PgBVoe4JQkaMIuLzaMdpOiBtxYpGH6A4xW5oEEAKACBOBghADxgHRgc4YgAyC8DDRiANLZpix9UoAZQgMAMfEDOGcxABLEQBidaIYlcqEENg3gnFNQACj94Dh/4/vgaPNyhCCRIoRbu8Ms2WEALSTCBCUE4Qw0EcARnLIMRoQRAAR6wCkJcwBFMeAAKOAAEDvxhDFawAgdqEIQnjKEStwiFLmCBCljAQoq3gOlBmTCFWajjpvDo5wkUAbpidoMIZNAFKkLxBxdAgQVMWMUybHEJRxigAAVoHwqcMAAexKEFLVDDK9hpP1Yk4hKX6EQrWhGKULgiF6LIxS1yQYxRtCIXp4iEGljQBHnIYx5+QMIHpsCMgBYkHj+NhCxQIdRWFCMQVaAAD3hQBTFYswG72AULBlGIRFTiFaeQ4h/UUAMUoGAFLKhBDfQQia3qghi0oMUobrFaUajCFKig/kUxqvAJMJlhCSeIAk+nEo9PFEIYumjFK0QhiVeYohWJsMIPOECGMALACEQIgipioQu3nmITTViBFyYRjXPowxvP+IQTUFCFSERCEmOIQSVygYqW3kKGodhgHebxjn6+zQzMmEo3NiEMVbQ3FKjgxCtQ4QZWnIIWraBFCQAQAEcwQgOdkAQtYlsIFoihFO/oRz3q0Q993EMf76BEGGoQCBpAQQ9BCMIrVnyKt+oCEHowED2QsQEb0GEKhiDHSsChB2SKohW3MIUpRMGKXIwiF29tBQ3EKIY41GATunAFKwKxAkFMox9Yvsc9NKzlDk9DEB4QwykS4YYakKESY1Vp/iRSkCB0qGMeZghBFL5gCWukpBtQcEM719pOIZtCrbQQxYuZcIE4BAIFkehCKAJRAy+MA8tZ3rKH+/FhfXy5Bn8gsxoiIdbMdqIG18CHOG5jD3Iw4xBpyEMq5mHMcFohErAQLjFWmgtWxEISKY5BECbAiD1c4Ak+iAELqKANLOujHlveMqWz3OFzNEENgJBEJMaQiESEIhedAEEv1rGgA920F6lORTnwweMKWGEQlRhqK9QQhBjEwAoxeEIXdNAFCnggDiDwQRvIgIJJnEPD/9YHpZFdD4FT+sOzmGwrRHELNNMiF7kYRAnqoIxqYKMcdgW3HcSdD3CogQxqaKco/mAxChhMIAZdgMMb2lBD/V1iGXGYQRt+4ISDSxrZHf4wznOuj2ezQhQPR3IuXCGMV6jhDINYQRPQQY9kGCINlqgSODYhCUmQtRXEaIUq38D1lZOzCxNYwRF4MIMu8EAQHNYwpA0e6WSDuBRVYEUoLDuKWHAiFqiAeJRna4FZfKMXdqgzPMBRjFas9hatYIXv8ucDGDyBAghAAAQmoIdlBGICE8hANHZubA57/uDIvkc9qlGCV1RiDIAIhTBcwXDCwtUVxNBDCpJxDEsMwxrsIDyQRTGKI7vhALoTQQAOQIEJcEAEHEDAEVaAAA2sQBuV1nLBOwzpg2e5HucoQZFZ/iGJUPx86MEFRCaou4lPcKMXqRhGNdjRDt2PguG5iEQQBjAAAECgBeM8Zwd+sIxVXCAGHlBpHKYPxzZwWLZzW7YP74ACxXBtlUALskALrhALmYAFN7ACg/MM2eALvdAIw0AN1tAO7VAM3Nd7okAMRgcFERABxQcDMBADE1ABOxAHuoMC45BhWzZ9kbaDXZZ9kXBWvSdUuSALKPAIwdAHIPAAVOAFaZAGHkgN5dB+4MAKaEZWsHALtyAMuZAJasBMGqABEaAAl7AKEQABKLALG9Z51ZdsyqZzylADrKAL10YL/tUKRmACwfALwfAIN4ADWvCHGzcyS0F4pjcKxOBS/qbgCqYgCb1zAAKAAA1gAIAkeVV2bKJHgNW3g2s3CXAoh2iVVo5wBY+gh8Gwh3NwB3MwB4HXFUxBeKxgeNW2WkNFXZIACBAQebg4ABDQAFRAgAbHYVoWjMpmifrgBGcQU2OlC6cgDDywCHo4BzcQjYswB3mABVhgCWIxiMXQVqJQCZVQdW51C2mFgsLlBiwQAQjAASVgAcDAdjlnczlIgPdQCigQCLcQa60QZa8AAnOwh1qABam4CKiYB1pgCb2ADPHQfoWXVrlgdd84Cg/XCatldUU3CpsgC5vQWN5wDjdnfct2Dhw2DU3ABJkwVJIwCq6gC4NABDdgiqX4CHdw/gfVWJBokZCERwyikJNuxXChgFnVBQtARwuw8Gex8AqRgAJoB5LuyGxYNg5hgAJMEAmmEGu5YAqxsAkeAAm/oIePsAgwOQfWWJBh0YokaHWjEAokJwwkN1a5gFI5+QqjgAqmcAudMAgaAArTIHBd5g0btmH6EA14sAJk4AbrlQuhIFxXiQF3QIq/8AiQgIrWGHjHgJD2AA7PsAmXsAnnNVat4AqjUAnVBgiJIJp6lgtX2AqREAgWBgq+WGm+WApOUANMYD9qhYU/5gqtAAKNUIpaCQnTeAPWmAfYeAxM0Q3K8AygkJygUAybwAqoII7fWAlu4AaDEAmD0HviKFyb/nBUVcBd3nUOszALTUBeg2B4RhYKgnZksCAMVeABJmCEv7AI1hiNWqBq1ICQhGEX+aEN2hANyqAHlyCOiKd4sMQBmMcKxHALruAKK5aRVVADLMACnrUCJSAGxdAJJBeEgpZWLUUMK2ACN/AIj6AFfYgDOGAHHvgVKpEP/HIhkRMO2pAJrNV7qBkJZNABZPCCr1hWoXBkxNAJXWVYg0ABMfAHC4qea7VerYV4F1CfWIADJhClJuCHjXAMsrGi6ZClvmIv3IAHaqALa+WjkoByMNABExAJRSZFLMV7cIWW3cgK6gmmwYVeZmmIPMAAN5AHUrqngWcN6WANK8EP9mAh/uxgG9/ADEwAZD3KWrrwBG+kA8gHASQod2HKcHK4oOJoZIbpgIBgBdE2BpwQCUSQB/IpA1AKpVEKddYAD9gQqPYwD+pQqOvRDBdwbVIkh6EgAomgcjMwARdwABPQCadwmEemWrwXXEfGmb0nCawwCH8ACH/gBkHQAFgwjXkAjSY6pVC3DvwQDioSJBaiDozxDYdAAkygByf2CXqwdTY0BlYUASWAk7DQYrFFVjGVk2sFV1s1VpHwrDwgA3cwjamYik9qommQDFuRDioyEunANbYxD1xjDbtSDtfAAilXQ2/gAyIwAzFwAG4AcZwgDO3VexB3ZEaGkq6gUg2XCJIA/gVFsAhe2ZUEiwV/aAiAGiBTESDm4CvqEA7hQA/hoBv4UA5iYAVdsHIr1wZd4AMzQAEtMGVqwAlChWBu9ZkqpQtCJkNrpQsY6QFYcAePOQcCS7MF2ar/AA984Q4dcRsYF6vhYA+bQENch7FKu7RAgACBggIhdwu0kKm6cJ7XhpqBEAjsFgQ0QAL1GbADC5Z5kAa9kA6BCiD7RA7m0LDsEA7ygA7W0AxV8ARwoHJw1AYisLHnNAXYiAw0IAzi6FJACXFYl5FOIAZj4wef0A2G8AVaILYymQfX2gh15g4CYSVpCw+Um6XroQ5ORwRx4EovSAYfYgRQUAV5Ui+lt4yu/kBy8ZcJZ1AFePAJzeALycBt+WQNhlAEOACWkdkIqWAN64AorPGtCQESxruz33AW8oIMoUEWI4M1jSEO2JAC/CULuSAMxMBoFJcNhTIP6ZBHN0W+fkizqVpnkFsVqwG/CeEO5MAN3BA5tcEYQtsYCZIOX9Ib+IAJHvADIdWyTKAN9jAe4mBXtUEb6vCnhvCHOFAEY+IFvjDBgdEX0pEQ5MENWyOr4nBTRnxTBsIOsPpmGoMJfkACX4ANe+RtN6XEDrsohsCEaeAFY+IH3OBXgTEY8IvB3FC8DmsbN+Vt5TBqCvwlwHEx4fBm82AvXMM14VDH3+AYyeAQX/AFh6AI/sygYxRcHX/hwyrhDgpRxgrcKGd8INsRq+kQx7H6JbD6DexwxJjMHemRJ8ngC7PQDNvzRIQ8E5Gbth9BuZVbx20LKT3LNfOwyJe7wPMgI3dcx7exHuLwDdhgDdiQDduAyMFCHYz0vmOcyDLSKIsiD1WcxlV8yQ0bDrucDJUjyVVcG43SKCDRU4N8FWL8vqaswdyADT57ubHKNQ27zLFKx5FMx1yDxN+wFVrhDv2xzdw8HTlLExd8yuHss7UcDrCqxOVczoTasMZrIfaCD2jbF6L8HzKBz4GatmQsI4VyyZW8xK4MHBUCHPaA0fgSuaEjzNUxExUMIKchz4gcMzGRdhL5gE98gQ8BkhKnodDUkSINPRgPzRcVTBAUjBDE7NAKzRIzPdOCwRIxzdM6PdIxcdM/3dNB3dSE7Bc04Rc1DdVRDdQL7dQpMsxUvdVc3dVY/dVYQsz33NVLDdRgfdY6ndRV3dVQvdRojdZazdZiHCxWTc+pERAAOw==';\r\n\timagenes[\"r2\"] = 'R0lGODlhRwBKAOf+ABcWDhwxBS81BSNADydCBDMzQCpGAjFLGjpAP0FGLT1DTTZRFjNVDFhCHj9ONjxVI0JVFEVQK01PLElNUD1aLztjEU9SSkJhHk1TT0ZeKUNhJV9TKFZTQVFWWltXOlpeNUdvElNhRU9oPFJsI0twI05tLFZqLltgWlJsNmNgSHJeOGNhUl1hZV1sSlN5Klt1RVl5N19xVmRuXleBHWxsWWdtZGJ4PFeCJm50SmxucWpud1uEM2CDP216ToNxS2mDUXx4WW+EX3OBbH2AV3h9dn58bHh8f39+ZHl7hWmQTGaYLGyUPXWRTHaRV4SJeXWdOXSaTHqRbYSJg3yTZIOJi2+mJ4uLb4iPZHClOnOmMIiTXYeMlo6Lj3ekSImUdJWSaYCgWYOfZIegb4eqRn2yRZSfcnu4M4+gf56cc5WcjJiWqZaanJ2cf4WwVpedmJecpZGwaJGyc5+isJixdqWohpayfpyviqKrkKirgZ+xf5+xhaino6Ksn6errbaulKqut6i6gaLAd6LDc6TAhKTCgKfAk7W5lqnBjK2+lrG1v7K5s7K9o7u6orS8q7m1xr69k7O7va7LiK7Ng6/Lj7m8xr68wK/TgbTNmL3MkcHJpbXUkLPUlrnSlsDGyMDFz7vRo8TLscfD1bzRq8nOobzVn9HKo9HIrsXMusbLxMDZnL3dmcjN173eoMnP0b3ij8HcpsLflcTdocbatMXcrcjcp73iqs7WxMzZu8HjpM/cqb/jsdDatcXkn87dsNjUxcnipdbXvtHW2MfkrdPT6tPV4NrbrtLa0czjtNHZ4s/jvMzpqdXhxdvb1tfgztnd4Nvc6Njoztrrutrpyd/nzt7rxOHl6N/q1+Pm4uTo1+/nxuPm8PHrs9/v1fDrv+rr1Orp3+bu1OTx0ebt4ujw3ujt8O3v6//xtuv43Oz25Pv3wP/1wO/26/35tfn6u/L08f/4u+781P/2yPL09/v5yP76w/f27Pr53Pb49fP/7Pj88vn7+Pv7//v9+v/+9f79//3//CwAAAAARwBKAAAI/gD/CRxIsKDBgwgTKlzIsKHCffv+RSz3T5+/iBIdatxokB/GjBC5sGDmT59FfyA5qnT4USC/f/K45JApLyLEixJtQtzJcye/lysb+kP5z6M/eTqYbTmRQ9+/ixGB7nv5s6rJq/p4BnVI1F+fLdV05Ohw8WJNd/eu1lurL627t2nvyb26dSHQp0YqtarEYkK1rEPXNWuGDRy4cePQnTM8bZm1dZDXyb2Hs65BiHf36SBGrlKfCZDkOXWHypZhbtyghYOGOrU0aNbEYZv27Vu9e1MtEySK8Z67HPK0OfM8YYKUb6dOgZvGGBy0adOgvZb2GtoyUIx8fXOXtaXlewJ3/lba0kobskSe1rw50UjarnPorFkbxy0ct2mnFkGT/vqWITR++MJdUboNVFJE8hiBQA7PtIJMJ5C8kQMGUtgDjhNpjAOONfVxg4oTToDCnyiioPEFG9ql5d1WFuW0BhI6INABJKs8g8x5ayCQRhonnDCNfeeEcw4qaxDBBzzhLOMfHV8AiI07JRX41F0stOLMFgq8EcyWDlJiRAcdJCJFGvBYE4406LiRiA4TgGKLNbeIgoghhoBiG2UrruQPP045k0M1rXSyhg5/3BiMM6tA8ocOjvzhBDXcSEMNOmusIscbCrBgDJyy3OLpnRnpxg9OfaxRDaLI/EGFgzd6woIR/p6EkkgN3KADDzeNKKINMZ2ooYgQUYjiqTTLcYdSnhuhxKc/q1ZDTjWrOPOGlTduQQULb6ziSQ5CNHNOMkK44UwwqGgTBQk8iJBGnNJMM049TiG70ahHGRGMPOSQ0wqshq5CBSQYdPBHIgDzcQ43pyiyxxqopHEBFkqIcMcdZyByCzjrmOSRUw5xbOA/4OmTQ77aXEOFG50Eg4wzckCCDJZIyKqGEPhIc6uQ4UChhBlVdJFECTyIgQg046RlkjsdY2STRENdc0I5wRnTSjXIaPPMM6sYc82+HbyRyBoyJMbhOdCcIwYUXYBwgwsu+FxHMtagY9E+4DG050BUCeTO/j459EEOvjeS48yNz2hDTjDVBEPEGhBKcYIMTpyyDD7c8NFDCRqUsATETNQhyzTY3KYP0kIJ1KKy/lRihDzXPHujNsIRA/upp/4BSTCQJLLFGkbUIMMy4ZwyTZx2NLFEFk0gsssytpRztEYQme5UP/6s4Yg2zl6DTPbM+MJMOc9ueSMynniSCAs6QEKEcvZ4s4h8ssQBRh6ySLMMMOXIRVHppu+DUj/34EIl8nUNYxhDEWkowgpS4AEJrOAERuiDypAxDG2tSQdvaMQ6wrEcsoUjHPCAzn5iIxfSNeQnUfpHOfDRjy0Qo3DVUMQRUnAEOmSiGPPYxiPQAAQOSEER/oNzUCgcoQMWSIEPfADHOaYhjSXKJzrLmEYzxFGO/dltKFNyRyVWgAEuPGMYzujDCqzgB3vEgx7qUMc20hgPHq5gDwa8USi2gAQEcGACe1gHPKhBjSguQxqeWgQoUHENEzLkJXP7QwcUkQMkeCIYexijOcyhDnpY8h3pyCQmi/GFN17ji56ABCSMkIg/yMAOdThGMmQRDWjcgg5WYAMbGPG9nkTPIJTJSh9yMAFPbGECOqjEH1bAhmxUEo3psKQm25GObWSDDSvoAxIcCQlFeOIPb3CCGMJQiFnIQhTJiIEXGMEGKzTCGFYcyC0LUhJ/sIAKfYhQDnKwhiIAoRSZ/rSkOtKRxnTMgx7M9CcwgJADI8BIlJ14w1IQ8QkxdFMWsghCJhgBhFl+rypVCU9H/tGKHASqEp6gBBeKwIFHvKMdx0SjJZF50nbQwxyP4IAbVoEEKqCiD39AQg1i4NA6FOITn8gEDhaRhlk24xo9+clB+lGRhXlCG8EgBjEqYc9uvIMdylzpPuMxj3ym4x3vOIIUVqHIVUFiC0ZwQBB+MIcm/FQPHwAGMNigiG9cAyg/wcyKRmWva1TDasRgBg3oMI92sGOfyVRmYjPJTEvS4Qi4i1G2EvEGKURhDjYQgx7i0IM7gMIJd1gEOvXBp6tEpSDUY4YRqtEJeTzjhYLF/qdh04jGSiZzjemIRzK/+ogUuEwbkGDBH0LhCTfEQBlwsIEeJjEHQ1ghDaFFxTd4ghXv+IM0XBhO7K6xBw7s4p9aVeYxczsPrvpzGx7AQNXcsAUMUkIRLUgCIAAxBU3kIQIJSEAQznCKa5DWI/vIxz66sxN/2AMbNOiDIxIhj3FdgwgeiAc72gFefaqUHu9Qxzy6etJ5eAAA/0qDOKRQgDdAwgk/QMEUgnAJQlTgCUpgwhUaIQ6TBDgrogEMePohjRicoBVc6ETinNEJLnDAqvSo8EotPA/aNrMbHNBBAdSwMi/9wQ1nIEUcXiACLRACClggwxLEAAqkdse0O7lH/j7EQYMUNGMPbhBcVB3BhRXItpK0ZXJK6ZHJUqwgEWqQAzHGBwkh2IEQkhhEHZrQBDjcoAtQqAMoxGG0trRFLvvoRz2sYQcZoCKGzjAPBRMxUjY0OcPh1WeF/TmPL6RgAmoYxo2c4YlGnGESgZDEJgZRiEHEYQc7iPQtrlGTrBi7Rf04Byq34Ak5wG7QyCAHJPbgBCB0Yx7vWHJK4xEP22o4HkAoAhJK7IzEOSEEU7gAGAix60FsYhNxEAQhCjFFk8ijhKJBST4WcQhWdKIToRjGMLAXjEVU7AohoEM8sn3hC3+1Hdsorx9W4IhVvEERtoBEB6JAARtkgABxIEQk/nY9iUhoghCfsAZaTDKZtzjlFGfYBCxsIQ5kvLATi7CDolmRhx7goBRNXrI+z3jVd8SjFEBwAiqEEAMRvCAKZ6gDBUZAgAEcIAyDCMQmxBByQpBiGusYsDzG/ha7XiMNosCFK0Qh2hvxwQ6fsIQlJKEKOwDhC9vQtkq5ClaIoyEFXohABnhwgyUkYRKbuAADUHAACmSAEJYgxCAGEYlAkMIa5RhwW9xRjmv4gg9T4AUvakH6yQ+iFsLYRC14wYpa4OITdfiAFiIOUHbYnh2ongcnP3AFMOwAC1WoAhY0EIYfaIAEbOMB8euwCUI4nxCXmAalS+gOcjCjEXboNy5Y/kEK0nuf9ML4BSta/4tclAEHQ3hEebn9zzPOAw9DwEEZEMGDJZDh/l1gwAEMwIAduIAEMPAAAbAAhHBygTAIn7AM4kA3vuEOBbQIiEAKvJAKtUALnPALscAJGshcnJAKv1ALrEALuWAHOCABQ4AGpRAP2ZANpQB/JtADZQAIGXABI7AEXdAFPBAAB/AABFABLgBsGrAAJQADkUAIgUAIh3ALKkc38uAO4mAMmfAJrCB6sUAKr/AKpCAMwnAJiPcKscAKsfALdaAHepABHzAEQ8BAH7CGQ3AFeoAJkzAJTRAGcQAFFcAA+hcBGsADF3ABPFACI1ACQvh8cVAIt7AM/vfQhO4gD+LQDLJwCaywCcqAeuL3C7hAeqSwfR74C5yAAhqgAUtAAiVwgaSQCsLQC4hwBWLwCpeQCpsQh4TAAAZgAxAQADfQBnYIAQ8wAA6wAGGgCZLgfJMgLHHxFuUgDrcwC6+gCqyQCqnwCk0wB8LgjKzwCr/gjK9wCMhXAWF2A5qwfds3C5dQB5eQeqygCq/4Aw9gAyjwAA+wBDfAACWAAiLgUJNXhJoQCZPwCbJwFcYoDsswC+PngbHwCoMwCcLwCsKgDKmgCb9AC9DIAF2ABWagBBWQBF+oCqrwheO3feO3CbgwCA9wAAugAYAQB4w2CCInCILwbpFgcpvA/gnelGac14jJQAupwAuxEAvPKAysEAdhcAjCAAsP2QthQAJkYAZY8ARLAAO0cAxXqAoEqQrXaImtt2jMx24xOQiH0Hy6NgiagI6cQAqygIj45oTTAFHOqArbtwk7OQmTFwZ6IAyqUAuf8AID8AQ8gwUVAAfKgAm/EH7KgJOwAAvj94E+mQqR+G6ToAnvVgvwNgmsoAmccAnCsgwHUkLHOA3JIJA8qZPb53qbcAhSOHrJIAYvRgZt0AYlUAe1EA2/gAhhEAafMAuWSAsguH2xoHrvtgmsgAu4EAuTsGiDYIWX8AmHiA3+QBkN2HnyIQ3J8ArnGIapgAs+WQuYgAuj/icKQYACSzACEKABKDALuoAIhRABVfcDx/ALv/AJr5AKsVALXqiYVJkKnPAKyjAINqALs/AJhYAIomAL9bacbTF2VSQOTNSZUPkKuPAKm6CQ5wgLynAJIqABDCAAHyAGdnAMupABBnAAGnABGVALIScMwNmModmRl1iNCkl6hVAHiAAKzdB5Q3EVmvkWkIEO65APsYALmzAHg2CNYbkJuqALrzAJG6ACx3AMXEcAQwhsF8AEJCAIqqCQuACfBQmGwemMqUALs6AKg6AHiLAItmBXzlOjLEd9LqcPkAGV74YLv6AKylCQChkLKqACr1ACF0ACFwADLqA2JGAAINAG/pGgmysanBvZk7NQCIcgpmNqC1pTRU/BE5OBaZVWD+uQDMcgDDyJC2zpo6TnAw1wCE0ABj9TAjtwAyQQqEsAAknwgV54jbUQC7xAlbRwCXlAhnawCI1wClpTDVU0FGiaZphmEWmRD+gwDp05CxCpmMqwCb+QAg3QBJcANAQAASPgAndYAmBAAiDYo613pbUglZxwCHlgB+i6CIvgq9dwDVAjDy5RWm0BEZaWS0aDqejADcegmJ5ack0gBnVwCD5VCFNwABXQBl0QBgcQB7AAkdKpCrCgCpewCZdQCGQYWo3QCKjADMyQL+XwFigBFRVREoBhrJp3afXgDuBwk6zA/gmvOAiAgHibEH61kAE20AWuoAp1cIGwEAuf4LKUOQmYUAiPsAiGsAiMcArMYKbuSg6LSBD0ikLGdiBYIRoBNg630Au0gAmckI8x2YGkMI5xEAca6Zuc8IXiiAlqiwmPcAtuAqnMoDWt8xZ0a0gCARUnoTHHtieXtg7jAA270Atrq7ak8Am9IAqf0JmXUKSiAFEQVQqjkAvFUAzA4A21URviwHny8LFN2ITIQrLCWqMnaxIk+w3jMA3FkAujsLq7AB3iEDfj0AwkEkXY4A3W4A3ekA24Ww/b0bnVt4ggexFpgRChS7JZwSf02hYkuxaIYRiWux23kQ/lsA6vWw75tXAbvgEv/TA6+1C3ddu9c1EZBiGsJyGsUVGyNqp598AW+iAaouEbclETRsOAJWE0lAEllHER5cs/LjEUHlERx3ZplYYVfFJs9majeWsRWcGc8kCy8kK8wloUGBG6mjcUuYQVx2taGzM3eWvB7VS8RKEnXVGjaVES9VC/RmO8NoYV9buc7VS+WBTB4wvCNFzDNnzDOJzDOrzDPNzDPvzDQBzEQjzERFzERnzESJzESrzETMzDAQEAOw==';\r\n\timagenes[\"r3\"] = 'R0lGODdhRwBJAOf+ACUcAEI3GlA9Em5GIlhTH2lQNHNSEF9ZMmldE2pZKmRdK2NaQGdeJF5hLnpXH4RRJ5JOG2paWXxcM3JpNW1tNXtoN5ZlE3ZuSGV4VIBzK3p2M4B0M294TIFwVm51cXd3WIh0Pn5yZWt3iXx7Rn97PoJ6R6hqO3V/aoZ8VKJxRnGAho2COIaERpWAOo+CQYaFUI2CUYuGQpGESZKDXYKOUYqIXpuDS4KNYHyNdJaGbZmLUIKSbq2CUZaQRZSQS5OQUp2ORZ2OTJOSXJqPXIaNnsJ+TImSiqWQSpiVa46bbrOJa6KbU6iaSamZVI6eg6aVc56cZJSbiZOiaKGdXpede4+hfKmaXpmcgbiWVrSUcs2PXsGVatOQWJyrgLKkaqSpfZmtibKoYJ+udLapVrulYK2rb6KrkJuygqCpp+KWWaiui7KrgeWaY6W5jNasVMK2VtCmhr2vkL22a8O2Y8O0b7i4eqm9irS4i6i9mMS2eLK7l86zebC7oeaoeK3BlNmvhLS6tNKxlM3AYM++dLPLisLFiNDEbczEerXKpLfPmrzMn7jPob/Iuc3IoOK+oMPNp9TErOzDcbzSq8zKq8rJwMrSksTPtrzZmszJy+HNftvRf9nQj+7IgtrRidjJusDapOHSdsTZs8Xaq9HXptrTpenbgMrexdnauOzce9Hevc3hutPby9TcxOrgdu3gbu7SufDedureifPcfNnZ1fLcg/Dci+Lep+nfkPHgf+/gherYyO3gme/goPXlg+Llut7otdznxvnnf9jpz/Tqf/bnjPzoef/mgP7mhvrmkvTomeDo0Pnph/3mjfXpk/nmmd/o1tjuye/ppvPpoOLl5Nns2PjnoPfop/Th1fjuiv/thOLuzv7tit/v1Pvxfvzukdzw4uXs4ubu1eTu3PHo2fzyhu/p4fTtyf/zj/7znvbyu+zu7P71l+b53+z24fz9nOP77vv6tfL16/z4wf35u/T61Pr+sP35yPT28/r08//7xPv88vr8+f/6+fj9//78//3//CwAAAAARwBJAAAI/gD/CRz4r5/BgwcJ7rsX757DhfsiEpxIcWDEixUzZvTHr6NHjwL7OcEjKV48ff/2pVQp0N9Ch/ckCtzXT53Ne+oc8vvnbyLHjz0pBg25kme/fSKMmLGzSFQqkyZjxoy3T18oSY8sMQIECA0aI0acgEkCxgwfcDH7+Vvr8qhbhQN7RlzLby2+adNEiMABZlGiRIsWSZKUytLVq5IW+VG8CBEiPHicOEFjBseNLl3alAVTDio4fRdpzl07N+VamOrwYiIiwgOONokFB36kB4+eLn5yJ9mdJLOopos+fWoqqo2oUYrO7KhCpQqYNpDBlZMOrmFEfvfk+nOYehqm1XpP/oC5FFuSIj93upQpAwXK+kJTyuQpVKPGjUeSREn6dOlSot9+fQIGBjsU2Bt0eLQB3SpoibaPSzRNMwsaRFTIGg6EEGKKKYh0UUcdhRyiyYiggFKKIbTk4k0vvSSTyRIsfFGFE3z8dpgoiRASShVV4IHBGUAq2MYZbfjxSIPZXYcXhay15kRsijwyioiagKJJKaC00kovsMgCCyzBeAkLNsRocsgm7N2RxB09NiWcKFchIkkoftjxlx8K4vHIMzE92A8+EzapghF4NLYIGFRAockwtNCCCyqQtoJKLpMSk0svsjCDCy694BJMMMW4coscndRxQxJU8JFIlFf99oki/olBViQilrST3T13eRKCB0mRlIgpXSSRSSkstoJLLqWUgoqyqLTypSzGGLOMK8uwuEwusCwTDDHbELMOLbdkAgQOVcTZFKyC4ZFZkYpUt9M9s+QgQQEeMLJhKpIUEs06wWxJTC+oELMipZtySsy/y2SzzDHMLLPiMstwa0w2wayDTimF2FHIHXYoIgqOogxHpB+OhRLPUd514IABCUjCDjv0VCLGLcRkY0wvxBjyxqSokInNOoYYUgs66DTjDTLoEOMMMskk08wy22BDztRTe7POLWFIIcUZwSVyySeJ4LaYJeBwNA0RIRhggQA44BCFJL5QEMMc2JyTTTa0vIHL/orY9LJNMmP0MEg1zjR9SzKxNJ2MNLw0w4zA2QwzDDnFnEMmPHLQQMhgIQOYXyrg7JMaZQwYEMAJJxjhgQcBXLABHd5Mvo7A3nizDcTJ0EHHJtJEI00y1VSjuDTWbMJL8M447jfl5JCJTjJynGDKVaqEEsoooTzljzqApGKKKHFEkAMLQzyRAwALdMAAGesMs8062Gxzu/yLEx/878I3o780m3jhxR684MUunMEMZijsbhA7xjIuoAZLQCMVD/SeKahyD2pAgxrtMEIHYtEKQ5SiDgQIQAAOQIAeOG4bCrQd/ZwRvGoMsBbOcEYschELTZDBBkvIg/F44YxabGob/rY7hvyMkYkyFAIY3OCGMJShjIb04x7PCIc5fqGITHSjG+5gRvOksAARUsAHzPAGM44hxGAYAxnIqMUualGLW6TRh7goExms0IldBJAXbGxUAYEoP2x0wxudGIUShfEMcVAFO+IQBjv0EIZzGG0YzegF1JoRBgaEUBC2IwY6CtgLNtaCFrXIBTFK8axcZCIWM+xFLhpVC2QkqxS5wAUKicEMdJzjHIYIgy+o8QxutKMqCxEHN55hhjAEIxeXisXNYNGLZhwiDD4QxL9Q8ShIfalZuICFpHCRrGNho1mwKEWjMsEMWLaib+TIBgqZAT9iLMEO9OClOPoExWdQ4wpy/jhms2oBClx8E2eaqAUqVMmigl1qWTSMBTZQiUpKOetR3VTWo4bhinSqs1vr2EYuOiEKbYSDG6K5xyqowQ0q0EEWyHSFJsZgCA5iCxe0YEYsUQELavaCF3WAkSUVoAANbMAKdKhFLAp2rFhOdBACm5/8GhaMc8QiD4oABjvwESE+AKMdV9BEMS7VikxkIAxz0EQuZEHWUnATUjQ0BAwmgII1NMIc5jhFI9aAAgUMYRC3mKFRO9WpPORhELEIIhBlQY5ubOMWd9CGMvRhkGkYARHcuMIhikEMbKg0DLuIBSxLIQtaUBNS3rjFEkjwgjqkIx/2SK09zLHaNcwABFaI/gYy/iXJaqHCCjoggzO8gQ1jANEbxwhGNrwRDUGG4x+AioIl2KGGTLiDTOSgRSaacSkWxdKzrciFDUGAAl7IIx/zmMd35aFae5DiBSNYAwyNJj9ioKIJmiDGOaCW0T5ugxzeOMQZWMGOf6gDDYyYhjCoMAd1eoMczdiGMYRbjC89VJVzIAEMxpGPdMhDHuENrzTCS950/IACmUieN6DmDWK0QnJTC8Y2mCE/4B6DGIcghCVY8Y97UIJB4LjCJppXDWsALxnJm2GyanHiW7xABqQ4bT4unI8mN5nJTbbFC2ZgDdstbBvDxTI5tnEOgR2jxOvIBjbmkAhEQCMlUFSG/jioUIdbOkMazZDGLm6RPDSCggyGAEUZJrAG1C55yeMFdKDTUYcL7CHBK8ZyENOpymaQcRl9y68YEKEKaAQzHM+4AgvaF0PgSSOGhdMEE0DgAhIo4AL2yIc5AP1kQX/XwhVGwRSSIUY+FrBv2PDGKoWI5WygQwg7QEQqXHIPcYijHZYQAjrIgQzqOmOALqzGIDJggxb84AJPsMc8Us3qQDP5whiOgwuSdrSkoQONSa1d1MgxjHPcggBmQEQoUhKPdthTGUhIMDFmS7gWdsIHLpjDHOiggEZUeNXcHu93KzzedKSjERNIBjqW1mynNQMZjzsHCrt8Dm/I4QB8EHZB/iqoDWGEowa3WDEytgHDZKhx2mF4wxvkQABfhNce5LXGn7397XSYgwBOe3bhpFENaUhjtvILxs+awYQeNCDk0OiIPsIBDW584wOd0PiK0ZELZIwKmlN4wxigcAB7wMMaC9/5kpVsYSabQwG/YyHhjL6LECMjYV1OxrSnwAFEPAIYBtmHOEgqjgUcwh2+zYYmm/G8MCBgCksgQw0W4At4wGMeTh5vanX+ZHD/PO49Nno06ABfdPQ6Fz04QgumIIVEqEIbKQGHEsOxZi+soxnJQOMyilEMd9yCpz+YwhQIEAe4Pvm0qW2yPWDNcHmcAu7AE2AzLBYGOtCisN2oRw8Q/hAEELygC5I4BTf+wY9pXIEV2hCHGYYQC9xj/L7dIMc6NkGAMczhFhtYA84Fzfm1p/q08pAO87AGIwBnMCRiRBM/5OAO0iAHS5ABU/ACL2Bm2tAO5FcOHRAHTWQKFBAG8ABktXMM5PBizaAJveAO6LAEJYBz4pVq36VzTIZ8FmYPLzAF6AAKc7By2LCDdyN/e1ABKxAGPzACNYAHoQAN7WCB91AOM/AEp/AN1HABGjA4zsBrUNNx7iBcxDAICXAH4IV5TrZkqcV8S5YHCkAH6LAMsuANkdMN7dYtYyADKMAESzACDeAEpqBIJpES47AHNqAG7/ANOzABOnB067AM/hnVC+cgOQpEDNIAAzNACjg3iahlD5yHc+lgD7YwAj9wC7igMPDTDZVTC2TABAgQAzoQBFCQBHiQCsbWDuAADuQ3DpHgBjBgCuxwBShQAV5ANMTAa8EwOQKFC82QBxcwA+YgXmhHXmH4XeZlBRNAB80gXCi0DOewDofQAlZABivQAz7wAlDwCNDADt8QizjxD/pAi26ABTVADY+AAgSgANGgbsdwDmRUCqGkJbFABhUQieSVataQfAGYD7YABRQABQrVCsWAM881Bi0AAjoQBj1AAxSAAU5AD+wgDO1ACZRgEP8wDuZQi1gwA8JgDk9wATAQDUlzDr51DI3CQa7g/gqtcAteUAElkAdpp3xLtgcjUAJQYAu1AAvFYAzHgAyxwAQyIAM24AM90AMv8AFgYArQ4FHiMAtrwRP4wAlu4AY88ATs8A6WYAMVUAnxAzXbUFDI0jfIdAyCoAMJAAN78Fbm1QhxUAIM4AKDUAvNMFDZUAzegA5kQABM0AQr8ANCkAQ7UHUa+QyrgAnkNxPj8Ac24AA8IAE7sCE2IABhkFFmCTE4kyKo4JJk5Qx0oAMgMAEEQAAMQAEy8ANy0FDUpE5ftgQxIANH0ARBUAYcsAOSUHXcQA2r8EsPMhD4QAkFkAAgkAIp0AHUgAgH4ANaJ0RWiA2PAjDIVAqxcAu7/rALYaBD2GkplyILwbAMcVQKcpABQeACYwAEJHAqZlZ17BAOgKAO+nCVAqEOmBABBAACJpAGD2AJpvABQcBH3qB12xAMLPJZX3JN2gUEYyAHOFMtwpUwQtQMc5ABGmAFLiAHP8ABN2AJ3AAM4dAOq7AK+rATPDEQ10AJESAADmACbPAAUZCLViA/KCQ/QsQi5YQsjxIqy6IzoMAi47kMBcQw24AOmuADGhADMeACHwZ+wpBE5lAOs4AS/jUR5cCiAwABRcAFBUAJ+qBp9XijwLUNw9BJmeBKzdIsLEILpaBoe1RitcQMmkCbMsACOhAD7vmbI3oKgMAPKIEPRCEQ/vigC0pgAkWgBTxwBe8QDnHAAnx0o+3lDWPQBG1kVMQQUyo0DApEoBonai3gAjKgAz/wA1XQm0rEDox5DzxxD/1QECj6D9egC3BQBIk6A6zwDY5KA0JkO776Yt4ABAiAV8h0C4fTflpmo1pGDq3ggBlwBDpQBiNQB4tQaR7VDowgDhzBFnXxqgJRDtfQB2mgBE8wCexADewwCRegCQdWDMMlNc3gDHNwBIPgDHmVOLdAOM5ADESqYOfQC95QghVgA0GwBHIgBWKAB6bADZgGDoAwDTvhrSrRD7F6DeHKBVkwCcKArsBwCheQCfeVDQwDP3OQOC40Z8mgnbtAOMgg/lgUUztMwARBcAQu4AMHaxxIFA4lugopMRGxKhC6cA1/wAN3AAzK8AzgIA6+8AK3wIYK0wx6mUYrezxztrKEE1giaAz4hQ6xkAnnGQRN4AM0cAZ+cITxqQyMEA/8wBIaIavX4AhKEAeWYAnP8AztAAwlQAbnsGXMwDQS53Vy50IBRDjsNTXGgA61sARA0ANB0AMxQANSAAZH6EuM8Azx0LNsmxEWS6tZkAM5wAjnCgxIsALoIFzMEEOzFa8tFDzWYA27gA4FejfZ4A6o5wJWwAJLsASQa4QaibZpi447MRQZUQ7lQKsp8AASkAPjCA13QLr3VUDvV2JtRDjo4AV0/jBd/Bo1+jMHG6ABXiAEFEADYtAGkMVLqwCmPbutbfsP5YAP1wAHx4u8V4Cuk9ADsaBxDFOgKvaXFUeamkBrteMNtOAMTUCYPjAFHyYGZ/AIymBvq3C5O4EdBSG8FdG+1xAIKQABEPAABRAF1KANMTAG90VGPagwR9Ns6PA7RlM7pTAGLnCbK7AEwvcCsKEK4RAOuvANKKESP2GfGoEPuaIEGgwBA7AAUvkELXAM7uAOdwNE+lNim8QMwxB/PwMKh8AELRAEViADZZAEW2OEIgoI4MAPr+qtr5q5GQHE1+AJh6rBDzADfCAMa7ACc2AIiGY7b1AK8qWI71M7zSAu/kcws0CgA0JQCFuTCJKgDQxLCQ/CEQJRF+tLnGocCFpgAiaQAlsQB9xwCj+wAitwC2lYOzLXPOcgXCxkQ02gjUewBGEwBRqwNXYgCkrECChRFxQcyYQKxOrgCXCgBbaqBVvwBO2AXhqwApEwfe4QsLBbYqUQBoS5AqlsBVYgfFIwtoKhDcEpi6Zxy7isDk+kDm8LB2zABVygqE+gBhwwAi1wBD1gCLpDB7cQw03ABBmwAukZBmDbA0IgvkwBQcIACAWBXOqLyxOBD/6gy7rgCOKaBuWcBaeQzi7AnitAAqiYihlgBRkABEvgjVPAAiygNbBBGIw5xinxqi5B0BRx/h1qrNBp0NJc8AevgAcjYLsyAAQboANKiptk8MJN8AMsALligMipIKLxsAqzQMakgcYo/cgGgSvFy9LjnMn0UAYMMAReYAMx7I0bHQZLYAM6MAEj0AWIXGnQgGmz4Krb6sjouNQEQbERrA/X8Ap/wAZsoAVKAAnAkApJ0ABT0AM2QAYtwARjsARNAAI3wAFk8XfQUNaMSQnlgBKs+rPeytaDyg/4MA6voNB9kMmQcLSmoAZfUAIX8AKl6gNCIAQ3QL6KjYvcMB2rwKoBnaKUnREdoRL8UA6vEAi6PQlHW0jicAqpQAVmoAZiM9TAcNzQIA70oAwPTBUD4ZGznRGvsrq2HlG8kzAJp6AM8iQOH5WRwqANikwNHyyi6Wdsz4APwcsW3BzdBBHBQAyuTGS03MBEwkBIyqDISdQOH6Vm4nC+J2EUKdERPszeFEHGT/REUBSiwgAM4M0NHnXDSqTI4UANzC3GOrEPtswRFEvgbSvgZNwQq2AKrBClSZRETAThykBIjBCLDaHelm3bHL6+1P0S6sAIJLVEz6AMSkQNhCQMI16O5RATlq3hA2GlMT4QAQEAOw==';\r\n\r\n\t// Itt kezdodnek a css-ek;\r\n\r\n\t// Travian: Battle Analyse\r\n\timagenes[\"imgpack\"]=\"data:image/gif;base64,R0lGODlhEAAQAOYAAAAAAP////z6/Pz+/Pz+9Pz65Pz67Pz21PTu1Pz23OzGROTSlPzqrPzuvOzivPzyzOzCROS6RNy2TNSyVPzafNS6dOTKhPzilPzinPzmpNzKlOzapPzqtPTmvPzuxPTqzPzy1PTu3Pz25PS+POS2POy+ROS2RNSqRNSuTNy2VPzWdNy+dOTGfOzOhPTWjPzelOzSlOTOlOzWnPzmrPzqvOzevPzuzOy2PPS+ROSyRPzGTOy6TPTCVNyyVNSuVPTKbOS+bNy6bPTOfPzajOzOjPTWlPTerPzmtPTq1OSqNPzCTOy2TNyuVNSqVPTOhOTCfOzKhPTSjPzalNzCjPzirOzatOSqPMyaPNSmVNyyZNy2dOzGhNy6fPTOjOzKjPzanOzWrOzexMyOLMSKLNyeNMySNMyWPOSuVNSmXOS2bNy6hOzavPzqzPz27MyONNSiVOzChOTKpNSiXPzy5MyORMySTOSydNSWVP///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAHgALAAAAAAQABAAAAfqgHiCggMhFk8gA4OLggYbKTIWPgttjHgEDkAxIiJGMys+YAKDHywsCAQENEwuVEVZEx14MBIbSDUaUxVBUkJfVFBYXBMFbDAtQD1mHwc0LypUQ2UpBSBHTkJCZ1QcGCo4JC5mKSIgIDRDP0tDQzo3JTtEZj0iBw82HFI8SiMKJSY5vLhBUe5BAw4zKChQEIGEFStbxJwokMADBwZULvjLkYRMGjhjVnDpkKBBBgwvIHA8s8VOnTd4qjR5YuMBgwsRcnSBc6dOnEFt4lx58sBDFCJyxqiZYwkEFzFEtNDJgsTSojBo5KxRtCgQADs=\";\r\n\timagenes[\"imgpackgo\"]=\"data:image/gif;base64,R0lGODlhEAAQAOYAAAAAAP///xx6BESSLEyWNFyiRJTChDSGFJzGjCx+BFyePESOHGSiRDyKDESSFDyGDIS2ZJzChKTKjEySHFSaJHSqTIy6bKTGjKzOlFyaLGSeNHyuVKzKlISyXGSeLGyiNHSmPLTOlPz+9Pz65Pz21PTu1Pz23PTmtPzuvPzyzNy2TNSyVNy+ZPzehNS6dOTKhPzinPzmpNzKlOzapPzqtPTmvPzuxPzy1Pz25PS+POy+TNSqRNSuTNy2VPzWdNy+dOTGfOzOhPTWjPzelOzSlOzWnPzqvOzevPzuzOSyROy6TPTCVNyyVNSuVPTKbOS+bPzWfNy6bPTOfPzajOzOjPTWlPTerPzmtPTq1OSyTNyuVNSqVPTOhOTCfOzKhPzalNzCjOTKlPzirMyaPNSmVNyyZNy2dOzGhNy6fPzanOzWrOzexMyOLMSKLMySNMyWPNSmXOzavPzqzNSiXMyORP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAHUALAAAAAAQABAAAAffgHWCg3UvXTeEiYJFPUUvTUSKgyxEODhWJz8raolAQCUiIkhaUGJVZWWCRCozWEcyYC5RVVJpYl5kaCsjckRBT0xuSCZGQz4xLW49IzdXXFJSWWI0MD45SUJvPTg3N0ZTTllTUyAaOkpUbkw4JClIRl9LSzkfGxlZXm483CkoNCAfPnjYgKGCgzNsdowwYcNIjA8hMHDgYEECgwNtfqCpwTCGBgwWLEDoACGCggSCtnRBkiKDBAkXEEAwwGABoTBjulCY4KCBApoDJKFhQ8UMnQcFCEgStAbOnDgHBBAKBAA7\";\r\n\timagenes[\"imgcopy\"]=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAHMAaQBai4lpJQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9ALFw00KOKzIOYAAAF8SURBVHiclZGxjtNAFEWP40UpE4oUKf0HLtLRsGMKFJbGNPGHQLTaBimSRZfPmPQIZavkF7ZyRZEGLU2Q0IR1PGNnKCI7BDsWjDTS09y5590340wmE8uFtVgsnLK21r5sunMFEMdxTZjP5wgh7Gq1cmri3wAAz/POBNd1uf/ymddv3rZCOm30D7d3AAghLo551XSoU8Wnj+/5/mPP1+SBVzfviKJoXepSyuuLCXSqsFqRZ088f/YTu38EIAxD4jhmMBgQBMG6EfCnudCKQ7bD0QqA4XCI53m4rstyuawgnTZzoVOcPKuNOJ1OAQiCYF29QZO50AoO+pRQa2azGdvtliRJGI/HpwRN5iJL6dhjAmMMWmu01nS7XZRSp1943CR8M0/Y/Bc2SyHfccj3kO2w+TFBnucVoNwV4IW4afrNavm+f5bAGENRFEeAlPJaSlkzRVG0DsOQfr+PMaZKUIIqQFvn0WhEr9c761zW/wTYbDY1838lEEK0yfi+z29BFRgySKHeAQAAAABJRU5ErkJggg==\";\r\n\timagenes[\"imgpaste\"]=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAHMAaQBai4lpJQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9ALFw00HbQA5MUAAAHMSURBVHichZM9aFNRFMd/j/e6FyoFJ0mqiy7ZTQikAUGlgzgp3US6ZBE6KA6ObumcwS0OLhFBgkQcSkimQsmHWQRFYjEggqZ5ybsf7zg076WxaXrgcOHe8//d83GvwwLbSKzK1u0kl9c0h602r9/iLIoD8ADS6bSc3tzZXuHh40+0D/ZIJNvAK/n+Kz0nrNfrDoCXyWSkXC6jlALgTWmTe9sfaR/sMRj8IAi+cuPqJaDOzpN9rLVYaykUCtLr9RxPRFBK0Wg0sNYC8OjBNQD+jK5P71sH1qnVamitMcbEsV6UUkRe23jGzSuGSqVypt5mswlAMpkkDMMZIAgCjDGEYYi1Nj4slUpnIMVikW63y2QymQGUUjEggkSWSCTmAK7r8uH9O27d2aLf788AWmtEJIYss92nzwHI5XLiiUhcwkUANR7y8sUug99jvnw+ZPPufeIpXARQ4yGihthgxOrKMUyOTnoQAbTWAAsBp8VGHSNqiBMMZ008XULky8Q2GOOImmUAnAtYJA7VXxwzHaPv+1SrVTzv5E39D1gkDgMfogxarZbT6XTmPpPrumSzWX5+63KkfcSMQE1X7SN6BEadO2YA8vm8AEs9lUrJP7/afV7h9kN4AAAAAElFTkSuQmCC\";\r\n\timagenes[\"imgatti\"]=\"data:image/gif;base64,R0lGODlhEAAQAOYAAJoxM5EqLocoK8BKTre6vsnKy6mqq/T58nu0X1qNQOTv3srivFN8OU1zNVuGPnGiUFqAQXqnXJG9c4yyc4Kla+rz5FqEPVF3N0xuNGqYSoKtZIWvaIClZoivbZnAfpq9gcfcuNnozsXatevv4vH06vj49KGhoJ2dnNjUwevj1uamSNKeUuKrW7+RT7SKTeizZLOMVKOCUamPaa2VcsashtnBnamXfMSxlsOJN7KEQ+fWv9HLw7Kro/Ls5qmop7KNeqRuX71vZrJVTqlSTbtMTOrq6unp6eXl5ePj4+Li4t3d3dra2tjY2NbW1tDQ0M7OzsrKysnJycjIyMbGxsXFxcPDw729vbu7u7m5ubi4uLa2trW1tbOzs66urqurq6mpqaWlpaOjo6KiopOTk////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAGQALAAAAAAQABAAAAengFlWWmSFhlJXXIZkYFFFUYtNSklii2RdVUdPhV1JS16WhSZTSFBPVEhjoYZfS0xYRlsFq4ZhTU4ntIsEBig/QENBJZY1MDcpPkICAgBEI6EzLywxQQECAQM9ljw5LTo2CwkNCQgVizIrODuFFRkYDhoKiy4qNIsRDRYRILqFGvkZJIgwR2sDAwYWHnjoMEFeqA8NIFi4kGHDBA2rQnCgQILMgQOFAgEAOw==\";\r\n\timagenes[\"imgattc\"]=\"data:image/gif;base64,R0lGODlhEAAQAPcAAAEBAxEYIyktMxIXHictNMnKy1x4kig8TVd4k0JYajFRaUlrhhklLVZnc0ZleElpfGB+j4eXoExTV0VldV15hxsjJ1R4iEdhbU1pdnCLmHCDjCs7Qp+ts0hfZ05ueU1nb0lhaVRud5Oip0pqc5qxuG58gE5VV2tydExnbmJ9hBEVFm+Ch7jEx7C4ulVkZ3+Tl3uFh7m+v77O0Wdtbougo5yqrIqcnrPDxYiQkY6YmbC7vK+6uyswMMvY2MDMzL/Ly3B3d2BmZj9DQz5CQi0wMM7a2s3Z2cPPz73IyLvGxrG8vJukpFNYWMTPz5CYmI6Wlo2VlX6FhX2EhGhublleXs7Z2Tw/Pzs+PikrK52kpJGXlx0eHr/Fxc7a2aawr6avrnN6eW1ycYKHhl9nZTw/PlxhXVNYU4mNiaGhoOamSNKeUr+RT7SKTeizZLOMVKmPaa2VcsashtnBncSxlsOJN7KEQ9HLw7KrowMCAerq6unp6eXl5ePj4+Li4t3d3dra2tjY2NbW1s7OzsrKysnJycjIyMbGxsXFxcPDw729vbu7u7m5ubi4uLa2trW1tbOzs66urqurq6mpqaWlpaOjo6KiopOTkwAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAJgALAAAAAAQABAAAAjfABklaoSpoMFCih4ZxDSJUB5CCwP56VNpISZIiPYIKgipz59IFguiMcRnkKBDfCyFNCjpD6BFehwVKBhBRkhKMVqcMFNmTIASJkJymSEAwIADChoQSGBQjps5O0JsYLDAAAISLDgshNPmUgUMDoqIOfPCSxaDd+qswWNhgoYuVHT8IAPmCKY3aujYUfGAQpMvQYoUyQEDCSY2aeJg8jDiRhEfVnAUyQAhjMUPKXpUgSJkiAQQF7TYNYiCRhEjW6Jg4uFiBZMlCzuIEGyloBMiWIBIWWijhuArBpNMeaIkIAA7\";\r\n\t// Travian: Battle Analyse\r\n\r\n\tvar cssStyle = \"\";\r\n// cssStyle += \"#resumen {position: relative; width:900px; float: bottom;}\";\r\n\tcssStyle += \"#tabla_mapa {width:800px;}\";\r\n\tcssStyle += \".bttable {width:100%; height:129px;}\";\r\n\tcssStyle += \".dcol {color:#A0A0A0;}\";\r\n\tcssStyle += \".tb_coords { word-break: keep-all; font: 11px/1.5em Tahoma,Verdana,Arial !important; color:grey; }\";\r\n\tGM_addStyle(cssStyle);\r\n\r\n\t/**\r\n\t * Funcion que no hace absolutamente nada. Usada cuando no hay mas remedio que usar alguna funcion\r\n\t */\r\n\tfunction dummy(){}\r\n\r\n\tfunction getRandTimeRange(maxrange){ // input in milliseconds output in milliseconds\r\n\t\tvar nr = Math.floor(maxrange * (0.6+0.4*Math.random()));\r\n\t\t//log(3, \"Calculated RandTimeRange : \"+nr+\" ms.\");\r\n\t\treturn nr;\r\n\t}\r\n\r\n\t/**\r\n\t * Funcion que extrae el nombre de un fichero de una ruta o URL\r\n\t *\r\n\t * Params:\r\n\t * \tpath: Ruta o URL para extraer el nombre del fichero\r\n\t *\r\n\t * Returns:\r\n\t *\tEl nombre del fichero al que apunta la ruta o URL\r\n\t */\r\n\tfunction basename(path) { return path.replace( /.*\\//, \"\" ); }\r\n\r\n\t/**\r\n\t * Funcion que convierte un numero en su version de 2 digitos. Anyade un 0 si solo tiene un digito\r\n\t *\r\n\t * Params:\r\n\t *\tn\tNumero a convertir\r\n\t *\r\n\t * Returns:\r\n\t * \tEl numero convertido con al menos dos digitos\r\n\t */\r\n\tfunction LZ(n){\treturn (n > 9 ? n : '0' + n); }\r\n\r\n\t/**\r\n\t * Crea un nuevo elemento de tipo DIV con un contenido prefijado\r\n\t *\r\n\t * Params:\r\n\t *\tcontent\tContenido del nuevo elemento creado\r\n\t *\r\n\t * Returns:\r\n\t * \tReferencia al nuevo elemento\r\n\t */\r\n\tfunction div(content){ return elem(\"div\", content); }\r\n\r\n\t/**\r\n\t * Wrapper para la funcion getElementById\r\n\t *\r\n\t * Params:\r\n\t *\tid\tTexto del ID del elemento a buscar\r\n\t *\r\n\t * Returns:\r\n\t * \tElemento del documento con el ID especificado\r\n\t */\r\n\tfunction get(id){ return document.getElementById(id); }\r\n\tfunction $(id){ return document.getElementById(id); }\r\n\r\n\t/**\r\n\t * Multiplica cada elemento de un array por un valor\r\n\t *\r\n\t * Params:\r\n\t *\ta\tArray con los elementos a procesar\r\n\t *\tn\tValor numero por el que multiplicar el array\r\n\t *\r\n\t * Returns:\r\n\t *\tNuevo array con los valores calculados\r\n\t */\r\n\tfunction arrayByN(a, n){\r\n\t\tvar b = arrayClone(a);\r\n\t\tfor(var i in b){ b[i] *= n; }\r\n\t\treturn b;\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza una copia por valor de un array\r\n\t *\r\n\t * Params:\r\n\t *\ta\tArray a copiar\r\n\t *\r\n\t * Returns:\r\n\t *\tReferencia a un nuevo array con el mismo contenido que el original\r\n\t */\r\n\tfunction arrayClone(a){\r\n\t\tvar b = new Array();\r\n\t\tfor(var i in a){ b[i] = a[i]; }\r\n\t\treturn b;\r\n\t}\r\n\r\n\t/**\r\n\t * Suma el contenido de dos arrays. Si cualquiera de los dos tiene valor nulo, se devuelve una copia del otro\r\n\t *\r\n\t * Params:\r\n\t *\ta\tPrimer array sumando\r\n\t *\tb\tSegundo array sumando\r\n\t *\r\n\t * Returns:\r\n\t *\tReferencia a un nuevo array con la suma\r\n\t */\r\n\tfunction arrayAdd(a, b){\r\n\t\tif(!a){ return arrayClone(b); }\r\n\t\tif(!b){ return arrayClone(a); }\r\n\t\tvar c = new Array();\r\n\t\tfor(var i = 0; i < Math.max(a.length,b.length); c[i] = a[i] + b[i++]);\r\n\t\treturn c;\r\n\t}\r\n\r\n\t/**\r\n\t * Comprueba si un valor esta presente en un array determinado\r\n\t *\r\n\t * Params:\r\n\t *\tarray\tArray a comprobar\r\n\t *\tvalue\tValor a buscar en el array\r\n\t *\r\n\t * Returns:\r\n\t *\ttrue si el valor esta en el array, false en caso contrario\r\n\t */\r\n\tfunction arrayValueExist(array, value){\r\n\t\tfor(var i = 0; i < array.length; i++) if (array[i] == value) return true;\r\n\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * Convierte ciertas entidades HTML en su equivalente ASCII\r\n\t *\r\n\t * Params:\r\n\t *\tstring: Cadena a convertir\r\n\t *\r\n\t * Returns:\r\n\t *\tCadena convertida\r\n\t */\r\n\tfunction decodeEntity(string){\r\n\t\treturn string.replace(/&lt;/g,\"<\").replace(/&gt;/g,\">\").replace(/&apos;/g,\"'\").replace(/&quot;/g,\"\\\"\").replace(/&amp;/g, \"&\");\r\n\t}\r\n\r\n\t/**\r\n\t* Elimina un elemento\r\n\t*\r\n\t* Param:\r\n\t*\telem\tEl elemento a eliminar\r\n\t*/\r\n\r\n\tfunction removeElement(elem){ if (elem) elem.parentNode.removeChild(elem) }\r\n\r\n\t/**\r\n\t * Mueve un elemento de lugar en un arbol DOM\r\n\t *\r\n\t * Params:\r\n\t *\telem: Elemento a desplazar\r\n\t *\tdest: Nuevo padre del elemento\r\n\t */\r\n\tfunction moveElement(elem, dest){\r\n\t\tremoveElement(elem);\r\n\t\tdest.appendChild(elem);\r\n\t}\r\n\r\n\t/**\r\n\t * Suma todos los valores de un array\r\n\t *\r\n\t * Params:\r\n\t *\ta\tArray a sumar\r\n\t *\r\n\t * Returns:\r\n\t *\tValor con la suma de todos los elementos del array\r\n\t */\r\n\tfunction arrayToInt(a){\r\n\t\tvar h = 0;\r\n\t\tfor(var i in a){ h += a[i]; }\r\n\t\treturn h;\r\n\t}\r\n\r\n\t/**\r\n\t * Inserta un nodo despues de otro\r\n\t *\r\n\t * Params:\r\n\t *\tnode\t\tNodo de referencia\r\n\t *\treferenceNode\tNodo a insertar\r\n\t */\r\n\tfunction insertAfter(node, referenceNode) {\r\n\t\tnode.parentNode.insertBefore(referenceNode, node.nextSibling);\r\n\t}\r\n\r\n\tfunction insertBefore(node, referenceNode) {\r\n\t\tnode.parentNode.insertBefore(referenceNode, node);\r\n\t}\r\n\r\n\t/**\r\n\t * Crea un elemento cualquiera con un contenido\r\n\t *\r\n\t * Params:\r\n\t *\ttag\tEtiqueta del nuevo elemento\r\n\t *\tcontent\tContenido del nuevo elemento en formato texto\r\n\t *\r\n\t * Returns:\r\n\t *\tReferencia al nuevo elemento creado\r\n\t */\r\n\tfunction elem(tag, content, idt, idv, class){\r\n\t\tvar ret = document.createElement(tag);\r\n//\t\tret.innerHTML = content;\r\n\r\n\t\tif(content) ret.innerHTML=content;\r\n\t\tif(idt) ret.setAttribute(idt, idv);\r\n\t\tif(class) ret.className=class;\r\n\r\n\t\treturn ret;\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza una busqueda en el documento usando XPath\r\n\t *\r\n\t * Params:\r\n\t *\txpath\tExpresion de busqueda\r\n\t *\txpres\tTipo de busqueda\r\n\t *\r\n\t * Returns:\r\n\t *\tReferencia a un elemento resultado de XPath\r\n\t */\r\n\tfunction find(xpath, xpres, startnode, doc){\r\n\t\tif (!startnode) {startnode=document;}\r\n\t\tdoc = doc != null ? doc : document;\r\n\r\n\t\txpres = xpres ? xpres : XPathResult.ORDERED_NODE_SNAPSHOT_TYPE;\r\n\r\n\t\tvar ret = doc.evaluate(xpath, startnode, null, xpres, null);\r\n\t\treturn xpres == XPFirst ? ret.singleNodeValue : ret;\r\n\t}\r\n\r\n\t/**\r\n\t * xingulin︰\r\n\t * 注意︰\r\n\t *\t原始程式有中文乱码的问题,因为 GM_setValue() 与 GM_getValue() 不支援 UTF-8 字集,修改如下︰\r\n\t *\t\tGM_setValue(name, encodeURI(value))\r\n\t *\t\tdecodeURI(GM_getValue(name, null))\r\n\t * 参考网址︰\r\n\t *\thttp://angusdev.mysinablog.com/index.php?op=ViewArticle&articleId=513171\r\n\t *\thttp://www.nabble.com/-greasemonkey-users--GM_setValue-loses-unicode-characters-t2840046.html\r\n\t */\r\n\r\n\t/**\r\n\t * Crea o actualiza el valor de una cookie con una determinada duracion\r\n\t *\r\n\t * 变量:\r\n\t *\tname\tNombre de la cookie\r\n\t *\tvalue\tContenido de la cookie\r\n\t *\tdays\tDuracion de la validez de la cookie\r\n\t */\r\n\tfunction createCookie(name, value, days){\r\n\t\tif (typeof GM_setValue == \"undefined\"){\r\n\t\t\tif (days){\r\n\t\t\t\tvar date = new Date();\r\n\t\t\t\tdate.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\r\n\t\t\t\tvar expires = \"; expires=\" + date.toGMTString();\r\n\t\t\t}else{ var expires = \"\"; }\r\n\t\t\tdocument.cookie = name + \"=\" + value + expires + \"; path=/\";\r\n\t\t}else GM_setValue(name, encodeURI(value));\r\n\t}\r\n\r\n\tfunction setOption(key, value) {\r\n\t var options = readCookie(\"options\");\r\n\t if(options != '') options = options.split(\",\");\r\n\t else options = [];\r\n\t var myOption = options.indexOf(key);\r\n\t if(myOption < 0) {\r\n\t\t options.push(key);\r\n\t\t options.push(encodeURIComponent(value));\r\n\t } else {\r\n\t\t options[myOption + 1] = encodeURIComponent(value);\r\n\t }\r\n\t options.join(\",\");\r\n\t createCookie(\"options\", options);\r\n\t}\r\n\r\n\t/**\r\n\t * @param key: name of the parameter in the cookie.\r\n\t * @param defaultValue: this is returned if the parameter is not found in the cookie.\r\n\t * @param type: if set, type conversion occurs. Values {string, integer, boolean} The conversion occurs only if it is not the defaultValue being returned.\r\n\t */\r\n\tfunction getOption(key, defaultValue, type) {\r\n\t var options = readCookie('options');\r\n\t options = options.split(\",\");\r\n\t var myOption = options.indexOf(key);\r\n\t if(myOption < 0) {return defaultValue;}\r\n\t switch(type) {\r\n\t\t case \"boolean\":\r\n\t\t\t var myOption = ( options[myOption + 1] == \"true\" || options[myOption + 1] == \"1\") ? true:false;\r\n\t\t break;\r\n\t\t case \"integer\":\r\n\t\t\t var myOption = parseInt(options[myOption + 1]);\r\n\t\t break;\r\n\t\t case \"string\":\r\n\t\t default:\r\n\t\t\t var myOption = decodeURIComponent(options[myOption + 1]);\r\n\t\t\t break;\r\n\t }\r\n\t return myOption;\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * Recupera el valor de una cookie\r\n\t *\r\n\t * 变量:\r\n\t *\tname\tNombre de la cookie\r\n\t *\r\n\t * 返回值:\r\n\t *\tContenido de la cookie o null si no existe\r\n\t */\r\n\tfunction readCookie(name, defaultVal){\r\n\t\tif (typeof GM_getValue == 'undefined'){\r\n\t\t\tvar ca = document.cookie.split(';');\r\n\t\t\tvar nameEQ = name + \"=\";\r\n\t\t\tfor(var i = 0; i < ca.length; i++) {\r\n\t\t\t\tvar c = ca[i];\r\n\t\t\t\twhile (c.charAt(0) == ' ') c = c.substring(1, c.length); // Elimina espacios\r\n\t\t\t\tif (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);\r\n\t\t\t}\r\n\t\t\treturn defaultVal;\r\n\t\t}else return decodeURI(GM_getValue(name, defaultVal));\r\n\t}\r\n\r\n\t/**\r\n\t * Elimina una cookie\r\n\t *\r\n\t * 变量:\r\n\t *\tname\tNombre de la cookie\r\n\t */\r\n\tfunction eraseCookie(name){ createCookie(name, \"\", -1); }\r\n\r\n\t/**\r\n\t * Crea una ruta a una imagen basandose en el path del pack grafico\r\n\t *\r\n\t * Params:\r\n\t *\tref\tRuta relativa a la imagen\r\n\t *\r\n\t * Returns:\r\n\t *\tRuta absoluta a la imagen\r\n\t */\r\n\tfunction img(ref, lang_dependant){ return (!lang_dependant ? pack_grafico + \"img/un/\" + ref : pack_grafico + \"img/\" + idioma + '/' + ref); }\r\n\r\n\t/**\r\n\t * Calcula el identificador de una casilla partiendo de sus coordenadas X e Y\r\n\t *\r\n\t * Params:\r\n\t *\tx\tCoordenada X\r\n\t *\ty\tCoordenada Y\r\n\t *\r\n\t * Returns:\r\n\t *\tID de la casilla correspondiente a las coordenadas\r\n\t */\r\n\tfunction xy2id(x, y){ return (1 + (parseInt(x) + 400) + (801 * Math.abs(parseInt(y) - 400))); }\r\n\tfunction zid2x(z){ return (((z - 1) % 801) - 400); }\r\n\tfunction zid2y(z){ return (400 - (parseInt(((z - 1) / 801)))); }\r\n\r\n\t/**\r\n\t * Calcula el numero de segundos de una hora expresada en formato xx:xx:xx\r\n\t *\r\n\t * Params:\r\n\t *\tmyElement\tTexto con la hora a calcular\r\n\t *\r\n\t * Returns:\r\n\t *\tNumero de segundos que expresa la hora\r\n\t */\r\n\tfunction calcular_segundos(myElement) {\r\n\t\tvar p = myElement.split(\":\");\r\n\t\treturn (p[0] * 3600) + (p[1] * 60) + (p[2] * 1);\r\n\t}\r\n\r\n\t/**\r\n\t * Convierte una cantidad en segundos en su representacion en horas.\r\n\t * Funcion inversa de \"calcular_segundos\"\r\n\t *\r\n\t * Params:\r\n\t *\ts\tNumero de segundos\r\n\t *\r\n\t * Returns:\r\n\t *\tTexto con la representacion en horas o la cadena \"0:00:0?\" si es negativo\r\n\t */\r\n\tfunction formatear_tiempo(s){\r\n\t\tif(s > -1){\r\n\t\t\tvar horas = Math.floor(s/3600);\r\n\t\t\tvar minutos = Math.floor(s/60) % 60;\r\n\t\t\tvar segundos = s % 60;\r\n\t\t\tvar t = horas + \":\" + LZ(minutos) + \":\" + LZ(segundos);\r\n\t\t}else var t = \"0:00:0?\";\r\n\t\treturn t;\r\n\t}\r\n\r\n\tfunction formatear_tiempo2(s){\r\n\t\tif(s > -1){\r\n\t\t\tvar horas = Math.floor(s/3600);\r\n\t\t\tvar minutos = Math.floor(s/60) % 60;\r\n\t\t\tvar segundos = s % 60;\r\n\t\t\tvar t = horas + \":\" + LZ(minutos);\r\n\t\t}else var t = \"00:0?\";\r\n\t\treturn t;\r\n\t}\r\n\r\n\t/**\r\n\t * Funcion encargada de mostrar el texto de recursos restantes para una construccion\r\n\t */\r\n\tfunction calculateBuildTime(){\r\n\t\t// Las celdas son los enlaces susceptibles de ser sustituidos por la nueva informacion\r\n\t\tvar celdas = find(\"//span[@class='c']\", XPList);\r\n\t\t// Las tablas son por cada uno de los edificios ampliables que se han detectado en la pagina\r\n\t\tvar tablas = find(\"//table[@class='f10' and not(@width)]\", XPList);\r\n\t\tvar k = celdas.snapshotLength - 1;\r\n\r\n\t\t// Se comienza por el final para evitar confusiones con otra informacion, ya que suele\r\n\t\t// estar lo ultimo en el caso de un unico edificio\r\n\t\tfor(j = tablas.snapshotLength - 1; j >= 0; j--) {\r\n\t\t\tvar tabla = tablas.snapshotItem(j);\r\n\t\t\tvar celda = tabla.rows[0].firstChild;\r\n\t\t\tvar recursos = celda.textContent.split(\"|\").splice(0,4);\r\n\t\t\tif(recursos.length != 4) continue;\r\n\r\n\t\t\tvar a = calculateResourceTime(recursos);\r\n\t\t\tvar b = celdas.snapshotItem(k);\r\n\t\t\t// Por si hay mas tablas que celdas\r\n\t\t\tif (b){\r\n\t\t\t\t// Si lo que hay antes de la celda es un enlace, entonces se trata de la cola del Plus\r\n\t\t\t\tif (b.firstChild && b.previousSibling.previousSibling.nodeName == 'A') continue;\r\n\t\t\t\t// Se elimina la informacion existente antes de poner la nueva\r\n\t\t\t\tif (a != null){\r\n\t\t\t\t\tif (b.firstChild && b.previousSibling.previousSibling.nodeName == 'TABLE') while(b.hasChildNodes()) b.removeChild(b.firstChild);\r\n\t\t\t\t\tb.appendChild(div(a));\r\n\t\t\t\t\tk--;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Recupera el identificador de la aldea activa\r\n\t *\r\n\t * Returns:\r\n\t *\tEl ID de la aldea o 0 si es la unica aldea\r\n\t */\r\n\tfunction getIdAldea(){\r\n\t\tvar a = find(\"//span[@class='c2']/a\", XPFirst);\r\n\t\tif (a){\r\n\t\t\ta.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\t\treturn RegExp.$1;\r\n\t\t}else return 0;\r\n\t}\r\n\r\n\t/**\r\n\t * Calcula el desplazamiento en pixeles a partir del 23� enlace\r\n\t * lateral (aldeas o enlaces personalizados)\r\n\t *\r\n\t * Returns:\r\n\t *\tEl desplazamiento en pixeles\r\n\t */\r\n\tfunction longitudPantalla(){\r\n\t\tvar enlaces = 0;\r\n\r\n\t\t// Se estima que caben 19 enlaces hasta que empiecen a ser demasiados y a ser tenidos en cuenta\r\n\t\tvar a = find(\"//div[@id='lright1']//span[text()]\", XPList).snapshotLength;\r\n\t\tif (a > 0) a += 3;\r\n\r\n\t\tvar b = obtenerValorCookie(\"marcadores\").length;\r\n\t\tif (b > 0) a += b + 2;\r\n\r\n\t\tvar c = find(\"//ul/li\", XPList);\r\n\t\tif (c > 0) a += c + 2;\r\n\r\n\t\ta -= 23;\r\n\t\tif (a > 0) enlaces += a * pixelsPorLinea;\r\n\r\n\t\t// Se tiene en cuenta el numero de construcciones\r\n\t\tvar a = find(\"//div[@id='ba']//table[@class='f10' and @width='100%']//tr\", XPList).snapshotLength - 2;\r\n\t\tif (a) enlaces += pixelsPorLinea * (a > 0 ? a : 0);\r\n\r\n\t\t// Se tiene en cuenta el banner de publicidad\r\n\t\tvar a = find(\"//iframe\", XPFirst);\r\n\t\tif (a != null) enlaces += parseInt(a.height);\r\n\r\n\r\n\t\treturn enlaces;\r\n\t}\r\n\r\n\t/**\r\n\t * Calcula los recursos restantes y el tiempo necesario para unas cantidades deseadas y devuelve\r\n\t * una cadena de texto en HTML con esa informacion\r\n\t *\r\n\t * Params:\r\n\t *\tnecesario:\tArray con la cantidad deseada de cada tipo de recurso\r\n\t *\r\n\t * Returns:\r\n\t *\tCadena de texto en HTML con la informacion sobre el tiempo y recursos que faltan\r\n\t */\r\n\r\n//\t//计算资源时间\r\n//\tfunction calculateResourceTime(necesario){\r\n//\t\tvar texto_restante = '';\r\n//\t\tvar tiempo_max = 0;\r\n//\t\tvar a = null;\r\n//\r\n//\t\t// Calcula y crea una cadena con lo que falta de cada recurso\r\n//\t\tfor (i = 0; i < 4; i++){\r\n//\t\t\trestante = necesario[i] - actual[i];\r\n//\t\t\tif (restante > 0){\r\n//\t\t\t\ttexto_restante += '<img src=\"' + img('r/' + (i+1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\"><span id=\"timeout' + i + '\">' + restante + '</span> | ';\r\n//\t\t\t\tvar tiempo = Math.round(restante / produccion[i]);\r\n//\t\t\t\tif (tiempo > tiempo_max) tiempo_max = tiempo;\r\n//\t\t\t\tif (tiempo < 0) tiempo_max = 'Infinity';\r\n// if (total[i] - actual[i] == 0) tiempo_max = 'Infinity';\r\n//\t\t\t}\r\n//\t\t}\r\n//\r\n//\t\t// Calcula y crea una cadena con el tiempo que falta hasta conseguir los recursos\r\n//\t\tif (tiempo_max == 'Infinity'){\r\n//\t\t\ta = T('FALTA') + ' ' + texto_restante + ' <br><img src=\"' + img('a/clock.gif') + '\" width=\"18\" height=\"12\" title=\"' + T('TIEMPO') + '\"> ' + T('NUNCA');\r\n//\t\t}else if (tiempo_max > 0){\r\n//\t\t\tvar tiempo2 = formatear_tiempo(tiempo_max + 5); // Introduce un margen de 5 segundos para compensar la desviancion de los temporizadores de javascript\r\n//\t\t\tvar fecha = new Date();\r\n//\t\t\tfecha.setTime(fecha.getTime() + (tiempo_max * 1000));\r\n//\r\n//\t\t\ta = T('FALTA') + ' ' + texto_restante + ' <br><img src=\"' + img('a/clock.gif') + '\" width=\"18\" height=\"12\" title=\"' + T('TIEMPO') + '\"> <span id=\"timeout\">' + tiempo2 + '</span><br/> ' + T('LISTO') + ' ' + calcularTextoTiempo(fecha);\r\n//\t\t}\r\n//\t\treturn a;\r\n//\t}\r\n\r\n\t//计算资源时间\r\n\tfunction calculateResourceTime(necesario, special_case)\r\n\t{\r\n\t\tvar texto_restante = '';\r\n\t\tvar tiempo_max = 0;\r\n\t\tvar a = null;\r\n\r\n\t\t// Calcula y crea una cadena con lo que falta de cada recurso\r\n\t\tfor (i = 0; i < 4; i++){\r\n\t\t\trestante = necesario[i] - actual[i];\r\n\t\t\tif (restante > 0){\r\n\t\t\t\ttexto_restante += '<img src=\"' + img('r/' + (i+1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\"><span id=\"timeout' + (i) + '\">' + restante + '</span> ( <span id=\"timeout\" noreload=\"1\">' + formatear_tiempo(Math.round(restante / produccion[i])) + '</span> )' + ((special_case) ? '<br />' : ' | ');\r\n\t\t\t\tvar tiempo = Math.round(restante / produccion[i]);\r\n\t\t\t\tif (tiempo > tiempo_max) tiempo_max = tiempo;\r\n\t\t\t\tif (tiempo < 0) tiempo_max = 'Infinity';\r\n\t\t\t\tif (total[i] - actual[i] == 0) tiempo_max = 'Infinity';\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Calcula y crea una cadena con el tiempo que falta hasta conseguir los recursos\r\n\t\tif (tiempo_max == 'Infinity'){\r\n\t\t\ta = T('FALTA') + ' ' + texto_restante + ' <img src=\"' + img('a/clock.gif') + '\" width=\"18\" height=\"12\" title=\"' + T('TIEMPO') + '\"> ' + T('NUNCA');\r\n\t\t}else if (tiempo_max > 0){\r\n\t\t\tvar tiempo2 = formatear_tiempo(tiempo_max + 5); // Introduce un margen de 5 segundos para compensar la desviancion de los temporizadores de javascript\r\n\t\t\tvar fecha = new Date();\r\n\t\t\tfecha.setTime(fecha.getTime() + (tiempo_max * 1000));\r\n\r\n\t\t\ta = T('FALTA') + ((special_case) ? '<br />' : ' ') + '' + texto_restante + ' <img src=\"' + img('a/clock.gif') + '\" width=\"18\" height=\"12\" title=\"' + T('TIEMPO') + '\"> <span id=\"timeout\">' + tiempo2 + '</span><br/> ' + T('LISTO') + ' ' + calcularTextoTiempo(fecha);\r\n\t\t}\r\n\t\t//资源时间\r\n\t\t/*\r\n\t\tif ((tiempo_max == 'Infinity')||(tiempo_max > 0)){\r\n\t\t\ta='<div style=\"color:#999\">' + a + '</div>';\r\n\t\t}\r\n\t\t*/\r\n\t\treturn a;\r\n\t}\r\n\r\n\t/**\r\n\t * Formatea el tiempo necesario hasta alcanzar determinada fecha\r\n\t *\r\n\t * Params:\r\n\t *\tfecha:\tObjeto de tipo Date con la fecha futura\r\n\t *\r\n\t * Returns:\r\n\t *\tCadena de texto con el calculo de tiempo restante\r\n\t */\r\n\tfunction calcularTextoTiempo(fecha){\r\n\t\tahora = new Date();\r\n\r\n\t\t// Calcula la diferencia de horas entre la fecha dada y la actual\r\n\t\t// para saber si se trata de las proximas 72 horas\r\n\t\thoras = ((fecha.getTime() - ahora.getTime()) / 1000 / 60 / 60);\r\n\t\thoras += ahora.getHours() + (ahora.getMinutes() / 60);\r\n\t\tif (horas < 24) tiempo_restante = T('HOY');\r\n\t\telse if (horas < 48) tiempo_restante = T('MANYANA');\r\n\t\telse if (horas < 72) tiempo_restante = T('PAS_MANYANA');\r\n\t\telse tiempo_restante = T('EL') + \" \" + LZ((fecha.getMonth()+1)) + \"/\" + LZ(fecha.getDate());\r\n\r\n\t\treturn tiempo_restante + \" \" + T('A_LAS') + \" \" + LZ(fecha.getHours()) + \":\" + LZ(fecha.getMinutes()) + \":\" + LZ(fecha.getSeconds());\r\n\t}\r\n\r\n\t/**\r\n\t * Calcula el tiempo maximo estimado hasta conseguir los recursos especificados basandose\r\n\t * en la cantidad actual y en la produccion de cada tipo de recurso\r\n\t *\r\n\t * Params:\r\n\t *\tnecesario:\tArray con la cantidad deseada de cada tipo de recurso\r\n\t *\r\n\t * Returns:\r\n\t *\tTiempo maximo en segundos hasta conseguir los recursos deseados\r\n\t */\r\n\tfunction calculateTime(necesario){\r\n\t\tvar tiempo_max = 0;\r\n\t\tvar tiempo = 0;\r\n\r\n\t\tfor (i = 0; i < 4; i++){\r\n\t\t\tvar restante = necesario[i] - actual[i];\r\n\t\t\tif (restante > 0){\r\n\t\t\t\ttiempo = Math.round(restante / produccion[i]);\r\n\t\t\t\tif (tiempo > tiempo_max) tiempo_max = tiempo;\r\n\t\t\t\tif (tiempo < 0) tiempo_max = 'Infinity';\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (tiempo_max > 0 && tiempo_max != 'Infinity') tiempo_max = formatear_tiempo(tiempo_max + 5); // Se introduce un margen de 5 segundos para compensar posibles desviaciones en los temporizadores de javascript\r\n\t\treturn tiempo_max;\r\n\t}\r\n\r\n\tfunction calculateHighlight (produccionHora, tiempo, tiempoRestante) {\r\n\t\tvar color = '';\r\n\r\n\t\tif (produccionHora < 0) {\r\n\t\t\tcolor = '#FF0000';\r\n\t\t} else if (tiempo <= 3600) {\r\n\t\t\tcolor = 'Magenta';\r\n\t\t} else if (tiempo <= 18000) {\r\n\t\t\tcolor = '#ffa500';\r\n\t\t} else if (tiempo <= 36000) {\r\n\t\t\tcolor = '#7b68ee';\r\n\t\t}\r\n\r\n\t\tvar ret = tiempoRestante;\r\n\t\tif (color != '') ret = '<font color=\"' + color + '\">' + ret + '</font>';\r\n\r\n\t\treturn ret;\r\n\t}\r\n\r\n\t/**\r\n\t * Calcula y muestra el tiempo estimado hasta el llenado/vaciado de los almacenes y graneros\r\n\t */\r\n\tfunction calculateFillTime(){\r\n\t\t// Por cada tipo de recurso calcula el tiempo hasta el llenao\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tif (produccion[i] < 0) var tiempo = Math.round(actual[i] / -produccion[i]);\r\n\t\t\t// Si la produccion es 0, el tiempo es infinito\r\n\t\t\telse if (produccion[i] == 0) var tiempo = -1;\r\n\t\t\t// Si la produccion es negativa, se calcula el tiempo hasta el vaciado\r\n\t\t\telse var tiempo = Math.round((total[i] - actual[i]) / produccion[i]);\r\n\t\t\t\t\t\tif(getv2()!=1){\r\n\t\t\t\t\t\tvar produccionHora = get('l' + (4-i)).title;} else{\r\n\t\t\t\t\t\tvar produccionHora = get('l' + (1+i)).title;}\r\n\t\t\t\t\t\tvar tiempoRestante = \"<span id='timeouta' style='font-weight:bold' noreload='1'>\" + formatear_tiempo(tiempo) + \"</span>\";\r\n\t\t\t\t\t\tvar celda = elem(\"span\", \"<span style='font-size:9px; color:#909090; position: absolute; top:13px; height: 20px; text-align:left;'>(\" + (produccionHora > 0 ? '+' : '') + produccionHora + ', ' + calculateHighlight(produccionHora, tiempo, tiempoRestante) + ')</span>');\r\n\t\t\t\t\t\t//var celda = elem(\"DIV\", \"<span style='font-size:9px; color:#909090; position: absolute; top:13px; height: 20px; text-align:left;'>(\" + (produccionHora > 0 ? '+' : '') + produccionHora + ', ' + (produccionHora < 0 ? '<font color=\"#FF0000\">' + tiempoRestante + '</font>' : tiempoRestante) + ')</span>');\r\n\t\t\tif(getv2()!=1){\r\n\t\t\t\tvar a = get('l'+(4-i)).previousSibling;\r\n\t\t\t} else {\r\n\t\t\t\tvar a = get('l'+(1+i)).previousSibling;\r\n\t\t\t}\r\n\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\tif (a.nodeName == '#text') a = a.previousSibling;\r\n\t\t\ta.appendChild(celda);\r\n\t\t}\r\n\r\n\t\tget('l1').style.cssText = 'padding-bottom: 5px;';\r\n\t}\r\n\r\n\t/**\r\n\t * Traduce una cadena de texto usando el idioma global detectado\r\n\t *\r\n\t * Params:\r\n\t *\ttexto:\tCadena de texto a traducir\r\n\t *\r\n\t * Returns:\r\n\t *\tCadena de texto traducida\r\n\t */\r\n\tfunction T(texto){\r\n\t\t// Intenta usar el array del idioma, y si no esta disponible utiliza el castellano por defecto\r\n//\t\ttry{\r\n//\t\t\teval('var language = lang_' + idioma);\r\n//\t\t}catch(e){\r\n//\t\t\teval('var language = lang_hk');\r\n//\t\t}\r\n//\r\n//\t\ttexto = texto.toUpperCase();\r\n//\r\n//\t\t// Si una cadena concreta no esta traducida en el idioma, utiliza por defecto el castellano\r\n//\t\tif (language[texto] == undefined) {\r\n//\t\t\treturn language[texto] == undefined ? '!'+texto+'!' : lang_hk[texto];\r\n//\t\t} else {\r\n//\t\t\treturn language[texto];\r\n//\t\t}\r\n\r\n\t\ttexto = texto.toUpperCase();\r\n\r\n\t\ttry{\r\n\t\t\treturn aLang[texto] == undefined ? '!'+texto+'!' : aLang[texto];\r\n\t\t}catch(e){\r\n\t\t\treturn '!'+texto+'!';\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Traduce una cadena de texto usando el idioma global detectado\r\n\t *\r\n\t * Params:\r\n\t *\ttexto: Cadena de texto a traducir\r\n\t *\targs: Argumentos a sustituir en la cadena a traducir\r\n\t *\r\n\t * Returns:\r\n\t * \tCadena de texto traducida\r\n\t */\r\n\tfunction F(texto, args){\r\n//\t\t// \"args\" debe ser un array asociativo del tipo {'a':'b', 'c':'d'} y puede ser opcional\r\n//\t\ttry{ eval('var language = lang_' + idioma); }\r\n//\t\tcatch(e){ eval('var language = lang_es'); }\r\n//\t\tif (language[texto] == undefined) texto = lang_es[texto]; else texto = language[texto];\r\n\r\n\t\ttexto = aLang[texto] == undefined ? '!'+texto+'!' : aLang[texto];\r\n\r\n\t\tif (args != undefined) for(var i in args) texto = texto.replace(i, args[i]);\r\n\t\treturn texto;\r\n\t}\r\n\r\n\t/**\r\n\t * Recupera informacion generica inicial para el resto de funciones\r\n\t */\r\n\tfunction getv2(){\r\n\t//\t\t\tfind(\"//script[@type='text/javascript']\", XPFirst).src.search(/(\\d).js$/);\r\n\t\t\t\tvar a=document.title;\r\n\t\t\t\tif (a==\"Travian cnt\") {\r\n\t\t\t\treturn 1 }else {\r\n\t\t\t\treturn 3}\r\n\t\t}\r\n\tfunction getGeneralData(){\r\n\t\t// Idioma\r\n//\t\tfind(\"//script[@type='text/javascript']\", XPFirst).src.search(/\\/([^\\/]+)?3.js$/);\r\n\t\tfind(\"//img[contains(@src, 'plus.gif')]\", XPFirst).src.search(/\\/img\\/([^\\/]+)\\//);\r\n\t\tidioma = RegExp.$1;\r\n\r\n\t\t// Ruta al pack grafico\r\n\t\tfind(\"//link[@rel='stylesheet'][2]\", XPFirst).href.search(/^(.*\\/)(.*)\\.css$/);\r\n\t\tpack_grafico = RegExp.$1;\r\n\r\n//\t\talert(find(\"//link[@rel='stylesheet'][2]\", XPFirst).href);\r\n\r\n\t\t// Identificador de aldea actual\r\n\t\tid_aldea = getIdAldea();\r\n\r\n\t\t// Identificador de usuario\r\n\t\tfind(\"//td[@class='menu']\", XPFirst).innerHTML.search(/spieler.php\\?uid=(\\d+)/);\r\n\t\tuid = RegExp.$1;\r\n\r\n\t\t// Nombre del servidor\r\n\t\tlocation.href.search(/http:\\/\\/(.*)\\//);\r\n\t\tserver = RegExp.$1;\r\n\r\n\t\t// Por cada tipo de recurso: cantidad actual almacenada, capacidad total del almacen / granero y produccion por segundo\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tvar a = get('l' + (4-i));\r\n\t\t\tactual[i] = a.innerHTML.split(\"/\")[0];\r\n\t\t\ttotal[i] = a.innerHTML.split(\"/\")[1];\r\n\t\t\tproduccion[i] = a.title/3600;\r\n\t\t}\r\n\r\n\t\t// Plus\r\n\t\tif (find(\"//img[contains(@src, 'travian1.gif')]\", XPFirst)) plus = true; else plus = false;\r\n\r\n\r\n\t\tstoreurl=readCookie(\"storeurl\", '');\r\n\t}\r\n\t/**\r\n\t * Oculta el anuncio de publicidad\r\n\t */\r\n\tfunction hideAd(){\r\n\t\tvar ad = find(\"//iframe\", XPFirst);\r\n\t\tif (ad) ad.style.display = 'none';\r\n\t}\r\n\r\n\t/**\r\n\t * Crea nuevos enlaces en la barra de menu izquierda. Son enlaces internos y externos al juego separados por una linea\r\n\t */\r\n\tfunction quickLinks(){\r\n\t\tvar menu = find(\"//td[@class='menu']\", XPFirst);\r\n\t\tfor (var j = 0; j < 2; j++) for (var i = 0; i < menu.childNodes.length; i++) if (menu.childNodes[i].nodeName == 'BR') removeElement(menu.childNodes[i]);\r\n\t\tvar links = [\t0,\r\n\t\t\t\t[T('ENV_TROPAS'), \"a2b.php\"],\r\n\t\t\t\t[\"联盟概况\", \"allianz.php\"],\r\n\t\t\t\t[T('ALIANZA_ATTACK'), \"allianz.php?s=3\"],\r\n\t\t\t\t[T('SIM'), \"warsim.php\"],\r\n\t\t\t\t[\"行宫\", \"build.php?gid=25\"],\r\n\t\t\t\t[\"皇宫\", \"build.php?gid=26\"],\r\n\t\t\t\t[\"英雄园\", \"build.php?gid=37\"],\r\n//\t\t\t\t[\"市镇厅\", \"build.php?gid=24\"],\r\n\t\t\t\t[\"中心大楼\", \"build.php?gid=15\"],\r\n//\t\t\t\t[T('COMP'), \"http://trcomp.sourceforge.net/?lang=\" + idioma, \"_blank\"],\r\n//\t\t\t\t[T('CALC'), \"http://www.denibol.com/~victor/travian_calc/\", \"_blank\"],\r\n\t\t\t\t0,\r\n\t\t\t\t[T('DUNIUMAP'), \"http://tra.duniu.com/map/\", \"_blank\"],\r\n\t\t\t\t[T('MAPA'), \"http://travmap.shishnet.org/?lang=zh\", \"_blank\"],\r\n\t\t\t\t[T('LOGIN'), \"login.php\"],\r\n//\t\t\t\t[T('CHECKNEW'), \"http://userscripts.org/users/51651/scripts\", \"_blank\"],\r\n//\t\t\t\t['TB-CN &#37197;&#32622;', \"spieler.php?s=2\"],\r\n//\t\t\t\t['Travian Beyond', \"http://www.denibol.com/proyectos/travian_beyond/\", \"_blank\"]\r\n\t\t];\r\n\r\n\t\tfor(var i = 0; i < links.length; i++){\r\n\t\t\tif(links[i]){\r\n\t\t\t\tvar a = elem(\"A\", links[i][0]);\r\n\t\t\t\ta.href = links[i][1];\r\n\t\t\t\tif(links[i][2]) a.setAttribute('target', links[i][2]);\r\n\t\t\t\tmenu.appendChild(a);\r\n\t\t\t}else menu.appendChild(document.createElement('HR'));\r\n\t\t}\r\n\r\n\t\tGM_registerMenuCommand('Travian Beyond > '+T('CHECKNEW'), function(){ GM_openInTab(\"http://userscripts.org/users/51651/scripts\")});\r\n\t}\r\n\r\n\t/**\r\n\t * Anyade un dialogo de confirmacion a los enlaces de cancelacion de construcciones\r\n\t */\r\n\tfunction confirmDelete(){\r\n\t\tvar links = find(\"//img[contains(@src, 'del.gif')]\", XPList);\r\n\t\tfor (var i = 0; i < links.snapshotLength; i++){\r\n\t\t\tlinks.snapshotItem(i).setAttribute('onClick', 'javascript:return confirm(\"' + T('SEGURO') + '\");');\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Anyade nuevos enlaces a edificios en la barra superior\r\n\t */\r\n\tfunction buildingLinks(){\r\n\t\t// Localiza la barra de enlaces superiores\r\n\t\tvar barra = find(\"//div[@id='ltop5']\", XPFirst);\r\n\r\n\t\t// Asocia el mapa del mercado con la imagen especifica creada\r\n\t\tbarra.innerHTML += '<img usemap=\"#mercado\" class=\"fl2\" src=\"data:image/gif;base64,' + imagenes[\"mercado\"] + '\" border=\"0\" title=\"' + T('MERCADO') + '\">';\r\n\r\n\t\t// Asocia el mapa de los edificios militares con la imagen creada a tal efecto\r\n\t\tbarra.innerHTML += '<img usemap=\"#militar\" class=\"fl2\" src=\"data:image/gif;base64,' + imagenes[\"militar\"] + '\" border=\"0\" title=\"' + T('CUARTEL') + '\">';\r\n\r\n\t\t// Mapa para el mercado\r\n\t\tbarra.innerHTML += '<map name=\"mercado\"><area shape=\"rect\" coords=\"0,0,70,50\" href=\"build.php?gid=17\" title=\"' + T('ENVIAR') + '\"><area shape=\"rect\" coords=\"0,50,35,100\" href=\"build.php?gid=17&t=1\" title=\"' + T('COMPRAR') + '\"><area shape=\"rect\" coords=\"35,50,70,100\" href=\"build.php?gid=17&t=2\" title=\"' + T('VENDER') + '\"></map>';\r\n\r\n\t\t// Mapa para los edificios militares\r\n\t\tbarra.innerHTML += '<map name=\"militar\"><area shape=\"rect\" coords=\"0,0,35,50\" href=\"build.php?gid=16\" title=\"' + T('PUNTO') + '\"><area shape=\"rect\" coords=\"35,0,70,50\" href=\"build.php?gid=19\" title=\"' + T('CUARTEL') + '\"><area shape=\"rect\" coords=\"0,50,35,100\" href=\"build.php?gid=20\" title=\"' + T('CORRAL') + '\"><area shape=\"rect\" coords=\"35,50,70,100\" href=\"build.php?gid=21\" title=\"' + T('TALLER') + '\"></map>';\r\n\r\n\t\t// Desplaza el menu del Plus a la izquierda para hacer hueco a las nuevas imagenes\r\n\t\tvar a = find(\"//a[contains(@href, 'plus.php')]\", XPFirst);\r\n\t\ta.style.marginLeft = '0px';\r\n\t\ta.style.position = 'absolute';\r\n\t\ta.style.left = '-250px';\r\n\t}\r\n\r\n\t/**\r\n\t * Crea un enlace al servicio de estadisticas de Travian World que recibe la busqueda como parametro\r\n\t *\r\n\t * Params:\r\n\t *\tparam\tParametro de busqueda para la estadistica\r\n\t */\r\n\tfunction createStatLink(param){\r\n\t\tvar statlink = elem('a', \"<img src='data:image/gif;base64,\" + imagenes[\"stat\"] + \"' style='margin:0px 1px 0px 1px; display: inline' title='\" + T('STAT') + \"' alt='Stat' border=0>\");\r\n\t\tstatlink.href = \"javascript:void(0);\";\r\n\t\tvar ref = 'http://www.denibol.com/proyectos/travian_world/stat2.php?server=' + server + '&' + param;\r\n\t\tstatlink.addEventListener(\"mouseover\", function(){ timeout = setTimeout(function(){ var a = get(\"tb_tooltip\"); a.innerHTML = \"<img src='\" + ref + \"' border='0'/>\"; a.style.display = 'block'; }, 1000); }, 0);\r\n\t\tstatlink.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\t\tstatlink.addEventListener(\"click\", function(){ var popup = window.open(ref, 'popup', 'width=350, height=250'); popup.focus(); return false; }, 0);\r\n\t\treturn statlink;\r\n\t}\r\n\r\n\t//show distance from all villages in tooltip\r\n\tfunction getVillageDist(x,y) {\r\n\t\treturn function(e) {\r\n\t\t\tvar cities = find(\"//div[@id='lright1']//table[@class='f10']\", XPFirst);\r\n\t\t\tif(cities){\r\n\t\t\t\tvar txt1=new Array();\r\n\t\t\t\ttxt1.push('<tr><td colspan=2 align=center><b>'+x+'|'+y+'</b><tr><td style=\"border-bottom:solid 1px #00C000;\"><b>'+T('ALDEA')+'</b><td align=right style=\"border-bottom:solid 1px #00C000;\"><b>'+T('Dist')+'</b>');\r\n\t\t\t\tcities = cities.firstChild;\r\n\t\t\t\tfor (var j = 0; j < cities.childNodes.length; j++){\r\n\t\t\t\t\tvar city = cities.childNodes[j];\r\n\t\t\t\t\tvar cityname=city.childNodes[0].childNodes[2].textContent;\r\n\t\t\t\t\tcity.textContent.search(/\\((.*)\\n?\\|\\n?(.*)\\)/);\r\n\t\t\t\t\tvar x2=parseInt(RegExp.$1,10);\r\n\t\t\t\t\tvar y2=parseInt(RegExp.$2,10);\r\n\t\t\t\t\tvar dist=Math.sqrt(Math.pow(x-x2,2)+Math.pow(y-y2,2)).toFixed(2);\r\n\t\t\t\t\ttxt1.push('<tr><td>'+cityname+'<td align=right>'+dist);\r\n\t\t\t\t}\r\n//\t\t\t\tvar table = elem('table', txt1.join(''));\r\n//\t\t\t\tvar tooltip = get('tb_tooltip');\r\n////\t\t\t\tdocument.body.appendChild(tooltip);\r\n//\r\n//\t\t\t\ttooltip.innerHTML = \"\";\r\n//\t\t\t\ttooltip.appendChild(table);\r\n//\t\t\t\ttooltip.style.display = 'block';\r\n\r\n\t\t\t\ttimeout = setTimeout(function(){\r\n\t\t\t\t\tvar div = get(\"tb_tooltip\");\r\n\r\n\t\t\t\t\tdiv.innerHTML = \"\";\r\n\t\t\t\t\tdiv.appendChild(elem('table', txt1.join('')));\r\n\r\n\t\t\t\t\tdiv.style.display = 'block';\r\n\t\t\t\t}, 100);\r\n\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Crea un enlace para mandar un IGM cuando aparece un enlace al perfil de un jugador, un enlace de\r\n\t * ataque rapido cuando aparece un enlace a una ubicacion del mapa, y otro enlace de estadisticas si\r\n\t * esta soportado para el idioma del servidor activo\r\n\t */\r\n\tfunction playerLinks(){\r\n\t\tvar links = document.getElementsByTagName(\"a\");\r\n\r\n\t\tvar arrayplayerLinks = new Array();\r\n\r\n\t\tdocument.title.search(/travian\\s(\\w+$)/i);\r\n\t\tvar idioma2 = RegExp.$1;\r\n\r\n\t\tvar vx = 0, vy = 0;\r\n\r\n\t\tif(find(\"//a[@class='active_vl']\",XPFirst) != null) {\r\n\t\t\tfind(\"//a[@class='active_vl']\",XPFirst).parentNode.nextSibling.textContent.match(/\\(([-\\d]+)\\n\\|\\n([-\\d]+)\\)/);\r\n\t\t\tvx = RegExp.$1;\r\n\t\t\tvy = RegExp.$2;\r\n\t\t}\r\n\r\n\t\tfor(var i = 0; i < links.length; i++){\r\n\r\n//\t\t\tif (links[i].className == 'done') continue;\r\n\t\t\tif (links[i].className == 'done' || links[i].getAttribute('done')) continue;\r\n\r\n\t\t\t// Por cada enlace a una ficha de jugador\r\n\t\t\tif(links[i].href.search(/spieler.php\\?uid=(\\d+$)/) > 0) {\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (links[i].parentNode.className == 'menu') continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('uid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = 'spieler.php?uid=' + a;\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\t// Introduce el enlace para enviar mensajes usando su ID\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='data:image/gif;base64,\" + imagenes[\"igm\"] + \"' style='margin:3px 0px 1px 3px; display: inline' _title='\" + T('ENVIAR_IGM') + \"' _alt='\" + T('ENVIAR_IGM') + \"' border=0>\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = 'nachrichten.php?t=1&id=' + a;\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"#\", 'target', '_blank', 'done');\r\n\t\t\t\t\tigmlink2.href = \"http://www.travutils.com/?s=\" + idioma2 + \"&idu=\" + a;\r\n\r\n\t\t\t\t\tigmlink2.style.cssText = 'display: inline; margin-left: 5px; color: #6F84FF';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t// Por cada enlace a una localizacion del mapa\r\n\t\t\t}else if (links[i].href.search(/karte.php\\?d=(\\d+)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('id=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('span', ' ( ' + zid2x(a) + ' | ' + zid2y(a) + ' ) ', null, null, 'done tb_coords');\r\n//\t\t\t\t\tigmlink2.style.cssText = 'word-break: keep-all; font: 11px/1.5em Tahoma,Verdana,Arial !important; color:grey;';\r\n//\t\t\t\t\tigmlink2.className = 'tb_coords';\r\n\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tif (vx || vy) {\r\n\t\t\t\t\t\tigmlink2.addEventListener(\"mouseover\", getVillageDist(zid2x(a), zid2y(a)), 0);\r\n\t\t\t\t\t\tigmlink2.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',\"<img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' _title='\" + T('ATACAR') + \"' _alt='\" + T('ATACAR') + \"' border='0'>\");\r\n\t\t\t\t\tigmlink2.href = 'a2b.php?z=' + a;\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',T('ALDEA_EXTRA2'));\r\n\t\t\t\t\tigmlink2.href = 'build.php?z=' + a + '&gid=17';\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a',T('ALDEA_EXTRA3'));\r\n\t\t\t\t\tigmlink2.href = 'karte.php?z=' + a;\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t\tlinks[i].addEventListener(\"mouseover\", crearEventoRecursosCasilla(links[i].href, links[i]), 0);\r\n\t\t\t\tlinks[i].addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\r\n//\t\t\t\tvar atklink = elem('span',\r\n//\t\t\t\t\t\"<a href='a2b.php?z=\" + a + \"'><img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' title='\" + T('ATACAR') + \"' alt='\" + T('ATACAR') + \"' border='0'></a>\"\r\n//\t\t\t\t\t+ \"<a href='build.php?z=\" + a + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"\r\n//\t\t\t\t\t+ \"<a href='karte.php?z=\" + a + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"\r\n//\t\t\t\t);\r\n//\r\n//\t\t\t\tlinks[i].parentNode.insertBefore(atklink, links[i].nextSibling);\r\n\r\n//\t\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"));\r\n//\t\t\t\tcity.appendChild(elem(\"TD\", \"<a href='karte.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"));\r\n\r\n\t\t\t// Por cada enlace a la ficha de una alianza\r\n\t\t\t}else if (links[i].href.search(/allianz.php\\?aid=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"#\");\r\n\t\t\t\t\tigmlink2.href = \"http://www.travutils.com/?s=\" + idioma2 + \"&ida=\" + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\t\t\t\t\tigmlink2.style.cssText = 'display: inline; margin-left: 5px; color: #6F84FF';\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t}else if (links[i].href.search(/allianz.php\\?s=2/) > 0){\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/berichte.php\\?id=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = 'berichte.php?id=' + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/nachrichten.php\\?id=(\\d+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = 'nachrichten.php?id=' + a;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\r\n\t\t\t} else if (links[i].href.search(/build.php\\?id=\\d+&t=1&a=(.+$)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\t\t\t} else if (links[i].href.search(/a2b.php\\?d=(\\d+)&c=.+$/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\tif (a == 0) continue;\r\n\t\t\t\tif (arrayValueExist(tw_server, server)) links[i].parentNode.insertBefore(createStatLink('aid=' + a), links[i].nextSibling);\r\n\r\n\t\t\t\tif (arrayplayerLinks[links[i].href]) {\r\n\t\t\t\t\tvar linkspan = elem('span', arrayplayerLinks[links[i].href]);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar linkspan = elem('span', \"\");\r\n\r\n\t\t\t\t\tvar igmlink2 = elem('a', \"<img src='\" + img(\"a/external.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' border=0>\");\r\n\t\t\t\t\tigmlink2.href = links[i].href;\r\n\r\n\t\t\t\t\tigmlink2.target = '_blank';\r\n\t\t\t\t\tigmlink2.className = 'done';\r\n\t\t\t\t\tigmlink2.setAttribute('done', 1);\r\n\r\n\t\t\t\t\tlinkspan.appendChild(igmlink2);\r\n\r\n\t\t\t\t\tarrayplayerLinks[links[i].href] = linkspan.innerHTML;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlinks[i].parentNode.insertBefore(linkspan, links[i].nextSibling);\r\n\t\t\t}\r\n\r\n\t\t\tif (!links[i].className) links[i].className = 'done';\r\n\t\t\tlinks[i].setAttribute('done', 1);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Anyade un nuevo boton en la vista de informes y mensajes para marcar todas las casillas\r\n\t */\r\n\tfunction opcionesMensajes(){\r\n\r\n\t\tvar a = find(\"//*[@class='s7']\", XPList);\r\n\t\tvar fila;\r\n\r\n\t\tfor (var i = 0; i < a.snapshotLength - 1; i++){\r\n\t\t\tfila = a.snapshotItem(i);\r\n\t\t\tif ((fila.firstChild != null) && (fila.firstChild.nodeName == \"INPUT\")){\r\n\t\t\t\tfila.innerHTML += ' <input class=\"std\" name=\"mtodo\" type=\"button\" value=\"' + T('MARK') + '\" onClick=\"for(var x = 0; x < document.msg.elements.length; x++) document.msg.elements[x].checked = \\'checked\\';\"/>';\r\n\t\t\t\tif (!plus) fila.innerHTML += ' <input class=\"std\" name=\"archive\" type=\"Submit\" value=\"' + T('ARCHIVE') + '\"/>';\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar a = find(\"//p[@class='txt_menue']\", XPFirst);\r\n\t\tif (a && location.href.indexOf('nachrichten.php?t=1') <= 0) {\r\n\r\n\t\t\tvar Input3 = elem('input', null, 'value', getOption(\"opcionesmensajespreload\",0,\"integer\"), 'fm');\r\n\t\t\tInput3.size = 4;\r\n\t\t\tInput3.addEventListener('change', function(){\r\n\t\t\t\tsetOption('opcionesmensajespreload', this.value);\r\n\t\t\t\tdocument.location.reload();\r\n\r\n\t\t\t}, false);\r\n\r\n\t\t\tif (location.href.match(/berichte.php/)) {\r\n\t\t\t\tvar Input4 = elem('input', null, 'value', getOption(\"deleteberichte_t3\",0,\"integer\"), 'fm');\r\n\t\t\t\tInput4.size = 4;\r\n\t\t\t\tInput4.addEventListener('change', function(){\r\n\t\t\t\t\tsetOption('deleteberichte_t3', this.value);\r\n\r\n\t\t\t\t}, false);\r\n\t\t\t\tinsertAfter(a, Input4);\r\n\t\t\t\tinsertAfter(a, document.createTextNode(' ' + T('deleteberichte_t3')));\r\n\r\n//\t\t\t\tfila.innerHTML += ' <input class=\"std\" type=\"button\" value=\"' + T('deleteberichte_t3_button') + '\"/>';\r\n\r\n\t\t\t\tvar Input5 = createElementAppend('input', fila, null, 'type', 'button', 'std');\r\n\t\t\t\tInput5.value = T('deleteberichte_t3_button');\r\n\t\t\t\t_attachEvent(Input5, 'click', function () {\r\n\r\n\t\t\t\t\tif (getOption(\"deleteberichte_t3\",0,\"integer\") <= 0) return;\r\n\r\n\t\t\t\t\tvar ids = find(\"//form[@name='msg']//input[contains(@name, 'n') and @type='checkbox']\", XPList);\r\n\r\n\t\t\t\t\tfor (var i = 0; i < ids.snapshotLength ; i++){\r\n\t\t\t\t\t\tvar linkid = ids.snapshotItem(i).value;\r\n\r\n\t\t\t\t\t\tajaxRequest('berichte.php?id='+linkid, \"GET\", null, function (t) {\r\n\t\t\t\t\t\t\tvar ajaxdoc = new ajaxCreateDocument(t);\r\n\t\t\t\t\t\t\tvar ans = ajaxdoc.ans;\r\n\t\t\t\t\t\t\tvar ansdoc = ajaxdoc.ansdoc;\r\n\r\n\r\n\t\t\t\t\t\t\tvar tab=find(\"//table[@class='tbg']/tbody\", XPList, ans, ansdoc);\r\n\r\n\t\t\t\t\t\t\tif(tab.snapshotItem(1)==undefined)return;\r\n\t\t\t\t\t\t\tif(tab.snapshotItem(1).parentNode.id=='MeXaon_ver_table')return;\r\n\t\t\t\t\t\t\tif(tab.snapshotItem(1).parentNode.getElementsByTagName(\"td\").length < 24)return;\r\n\t\t\t\t\t\t\tif(tab.snapshotItem(1).getElementsByTagName(\"td\")[0].textContent.charCodeAt(0)==160) return;\r\n\r\n\t\t\t\t\t\t\t// fix anchors\r\n\t\t\t\t\t\t\tvar fa = tab.snapshotItem(0).getElementsByTagName('a');\r\n\t\t\t\t\t\t\tfor( var i = 0; i < fa.length; i++) {\r\n\t\t\t\t\t\t\t\tfa[i].href = fa[i].href;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//\r\n\r\n\t\t\t\t\t\t\tvar table=tab.snapshotItem(1).getElementsByTagName(\"td\");\r\n\r\n\t\t\t\t\t\t\tvar troops=0; //1-romans 2-teutons 3-gauls\r\n\t\t\t\t\t\t\tvar tm;\r\n\r\n\t\t\t\t\t\t\tif(table[3].innerHTML.indexOf(\"u/1.gif\")>0) troops=1;\r\n\t\t\t\t\t\t\tif(table[3].innerHTML.indexOf(\"u/11.gif\")>0) troops=2;\r\n\t\t\t\t\t\t\tif(table[3].innerHTML.indexOf(\"u/21.gif\")>0) troops=3;\r\n\t\t\t\t\t\t\tswitch (troops){\r\n\t\t\t\t\t\t\t\tcase 1:tm=romans;break;\r\n\t\t\t\t\t\t\t\tcase 2:tm=teutons;break;\r\n\t\t\t\t\t\t\t\tcase 3:tm=gauls;break;\r\n\t\t\t\t\t\t\t\tdefault:tm=null;break;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tvar statushero=0;\r\n\r\n\t\t\t\t\t\t\tif(table[13].innerHTML.indexOf(\"img\")>0) {statushero=1;}\r\n\t\t\t\t\t\t\tvar tda=14+statushero;\r\n\r\n\t\t\t\t\t\t\tvar eat = 0;\r\n\r\n\t\t\t\t\t\t\tfor(var i=0;i<=(9+statushero);i++){\r\n\t\t\t\t\t\t\t\teat = eat + table[tda+i].textContent*tm[i][7];\r\n\t\t\t\t\t\t\t}\r\n\r\n//\t\t\t\t\t\t\talert(eat);\r\n\t\t\t\t\t\t\tvar deleteberichte_t3 = getOption(\"deleteberichte_t3\",0,\"integer\");\r\n\r\n\t\t\t\t\t\t\tif (eat <= deleteberichte_t3 || !deleteberichte_t3) {\r\n\t\t\t\t\t\t\t\tt.url.match(/\\?id=(\\d+)/);\r\n\t\t\t\t\t\t\t\tvar linkid = RegExp.$1;\r\n\r\n\t\t\t\t\t\t\t\tvar ids = find(\"//form[@name='msg']//input[@value='\"+linkid+\"' and @type='checkbox']\", XPFirst);\r\n\t\t\t\t\t\t\t\tids.checked = true;\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}, dummy);\r\n\r\n//\t\t\t\t\t\talert(linkid);\r\n\r\n//\t\t\t\t\t\talert(linkid);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\tinsertBefore(Input5, document.createTextNode(' '));\r\n\t\t\t}\r\n\r\n\t\t\tinsertAfter(a, Input3);\r\n\t\t\tinsertAfter(a, document.createTextNode(T('PRELOAD')));\r\n\t\t\tinsertAfter(a, elem(\"P\"));\r\n\t\t}\r\n\r\n\t\topcionesMensajesPage();\r\n\t}\r\n\r\n\tfunction opcionesMensajesPage (page) {\r\n\t\tvar prepage = 10;\r\n\t\tvar opcionesmensajespreload = getOption(\"opcionesmensajespreload\",0,\"integer\");\r\n\r\n\t\tif (!opcionesmensajespreload) {\r\n\t\t\treturn 1;\r\n\t\t} else if (!page) {\r\n\t\t\treturn opcionesMensajesPage (1);\r\n\t\t}\r\n\r\n\t\tlocation.href.match(/\\?(.*&)?s=(\\d+)/);\r\n\t\tvar pagenow = RegExp.$2;\r\n\t\tpagenow = pagenow ? pagenow : 0;\r\n\r\n\t\tvar pagelink = find(\"//form[@name='msg']//table[@class='tbg']//tr[@class='rbg'][2]//td[@class='r7']//a\", XPList);\r\n\r\n\t\tif (page<=opcionesmensajespreload) {\r\n//\t\t setTimeout(opcionesMensajesPage(1),getRandTimeRange(600));\r\n\r\n//\t\t var linkpages = xpathEvaluate(\"//form[@name='msg']//table[@class='tbg']//tr[@class='rbg'][2]//td[@class='r7']//a[contains(@href, 's=')]\");\r\n\r\n\t\t\tvar linkxpres = \"//form[@name='msg']//table[@class='tbg']//tr[@class='rbg'][2]//td[@class='r7']//a[contains(@href, 's=')]\";\r\n\t\t\tvar linkpages = find(linkxpres, XPList);\r\n\t\t\tif (!linkpages.snapshotLength) {\r\n\t\t\t\tlinkxpres = \"//form[@name='msg']//table[@class='tbg']//tr[@class='rbg'][2]//td[3]//a[contains(@href, 's=')]\";\r\n\t\t\t\tlinkpages = find(linkxpres, XPList);\r\n\t\t\t}\r\n\r\n\t\t\tif (linkpages.snapshotLength > 0) {\r\n\t\t\t\tfor (var i=0; i<linkpages.snapshotLength; i++) {\r\n\t\t\t\t\tif (linkpages.snapshotItem(i).href.search(/s=(\\d+)/)) {\r\n\t\t\t\t\t\tvar a = parseInt(RegExp.$1);\r\n\t\t\t\t\t\tif (a == 0) continue;\r\n\r\n\t\t\t\t\t\tvar npage = 0;\r\n\r\n\t\t\t\t\t\tif (a <= pagenow || (i == 0 && linkpages.snapshotLength > 1)) {\r\n\t\t\t\t\t\t\tnpage = a - prepage * opcionesmensajespreload;\r\n\t\t\t\t\t\t\tif (npage <= 0) npage = 0;\r\n\t\t\t\t\t\t\tlinkpages.snapshotItem(i).href = linkpages.snapshotItem(i).href.replace(/(s=(\\d+))/igm, \"s=\"+npage);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tnpage = a + prepage;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (npage <= 0) npage = 0;\r\n\r\n//\t\t\t\t\t\tlinkpages.snapshotItem(i).href = linkpages.snapshotItem(i).href.replace(/(s=(\\d+))/igm, \"s=\"+npage);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n//\t\t\t\tif (!a || npage <= (pagenow + page * prepage)) return;\r\n\t\t\t\tif (!a || a < pagenow) return;\r\n\r\n//\t\t\t\talert(a +':' + npage + ':' + (pagenow + (page) * prepage));\r\n\r\n\t\t\t\tajaxRequest(linkpages.snapshotItem(i-1).href, \"GET\", null,\r\n\t\t\t\t\tfunction (t) {\r\n\t\t\t\t\t\tpagenow = pagenow + page * prepage;\r\n\r\n\t\t\t\t\t\tvar ajaxdoc = new ajaxCreateDocument(t);\r\n\t\t\t\t\t\tvar ans = ajaxdoc.ans;\r\n\t\t\t\t\t\tvar ansdoc = ajaxdoc.ansdoc;\r\n\r\n\t\t\t\t\t\tvar xpres = ansdoc.evaluate(\"//form[@name='msg']//table[@class='tbg']//tr\", ans, null, XPList, null);\r\n\r\n\t\t\t\t\t\tvar linktr = find(\"//form[@name='msg']//table[@class='tbg']//tr[@class='rbg'][2]\", XPFirst);\r\n\r\n\t\t\t\t\t\tfor(var i=1;i<xpres.snapshotLength-1; i++) {\r\n\t\t\t\t\t\t\tvar mrow = xpres.snapshotItem(i);\r\n\r\n\t\t\t\t\t\t\tinsertBefore(linktr, mrow);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar linkpages2 = find(linkxpres, XPList, ans, ansdoc);\r\n\t\t\t\t\t\tvar linkpages = find(linkxpres, XPList);\r\n//\t\t\t\t\t\tif (linkpages.snapshotLength > 0) {\r\n\r\n\t\t\t\t\t\t\tif (linkpages.snapshotLength > 0 && linkpages2.snapshotLength > 0) {\r\n\t\t\t\t\t\t\t\tfor (var i=0; i<linkpages.snapshotLength; i++) {\r\n\t\t\t\t\t\t\t\t\tif (linkpages.snapshotItem(i).href.search(/s=(\\d+)/)) {\r\n\t\t\t\t\t\t\t\t\t\tvar a = parseInt(RegExp.$1);\r\n\t\t\t\t\t\t\t\t\t\tif (a == 0) continue;\r\n\r\n\t\t\t\t\t\t\t\t\t\tvar npage = 0;\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (a < pagenow || (i == 0 && linkpages.snapshotLength > 1)) {\r\n\t\t\t\t\t\t\t\t\t\t\tnpage = a - prepage;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\tnpage = a + prepage;\r\n\t\t\t\t\t\t\t\t\t\t\tlinkpages.snapshotItem(i).href = linkpages.snapshotItem(i).href.replace(/(s=(\\d+))/igm, \"s=\"+npage);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n//\t\t\t\t\t\t\t\t\talert(a+':'+npage);\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tpage++;\r\n\t\t\t\t\t\t\t\tif (page <= opcionesmensajespreload && linkpages2.snapshotLength > 1) {\r\n\t\t\t\t\t\t\t\t\topcionesMensajesPage(page);\r\n\r\n//\t\t\t\t\t\t\t\t\talert(page);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\r\n//\t\t\t\t\t\t\tfor (var i=0; i<linkpages.snapshotLength; i++) {\r\n//\t\t\t\t\t\t\t\tif (linkpages2.snapshotItem(i).href.search(/s=(\\d+)/)) {\r\n//\t\t\t\t\t\t\t\t\tvar a = parseInt(RegExp.$1);\r\n//\t\t\t\t\t\t\t\t\tif (a == 0) continue;\r\n//\r\n//\t\t\t\t\t\t\t\t\tvar npage = 0;\r\n//\r\n//\t\t\t\t\t\t\t\t\tif (a <= pagenow || (i == 0 && linkpages.snapshotLength > 1)) {\r\n//\t\t\t\t\t\t\t\t\t\tnpage = a - prepage;\r\n//\t\t\t\t\t\t\t\t\t} else {\r\n//\t\t\t\t\t\t\t\t\t\tnpage = a + prepage;\r\n//\t\t\t\t\t\t\t\t\t}\r\n//\r\n//\t\t\t\t\t\t\t\t\tif (npage <= 0) npage = 0;\r\n//\r\n//\t\t\t\t\t\t\t\t\tlinkpages2.snapshotItem(i).href = linkpages.snapshotItem(i).href.replace(/(s=(\\d+))/igm, \"s=\"+npage);\r\n//\t\t\t\t\t\t\t\t}\r\n//\t\t\t\t\t\t\t}\r\n//\r\n//\t\t\t\t\t\t\tpage++;\r\n//\t\t\t\t\t\t\tif (page <= opcionesmensajespreload && npage > pagenow) {\r\n//\t\t\t\t\t\t\t\topcionesMensajesPage(page);\r\n//\t\t\t\t\t\t\t}\r\n//\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tplayerLinks();\r\n\r\n//\t\t\t\t\t\talert(i + xpres.snapshotItem(i).innerHTML);\r\n\t\t\t\t\t}\r\n\t\t\t\t, dummy);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n\t}\r\n\r\n\tfunction ajaxCreateDocument (xmlHttpRequest) {\r\n\t\tthis.ans = elem(\"DIV\", xmlHttpRequest.responseText);\r\n\t\tthis.ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tthis.ansdoc.appendChild(this.ans);\r\n\t}\r\n\r\n\t/**\r\n\t * Crea eventos para enviar al formulario de envio de materias primas del mercado las coordenadas\r\n\t * de las propias aldeas.\r\n\t *\r\n\t * Codigo sugerido por Bafox\r\n\t */\r\n\tfunction quickCity(){\r\n\t\t// Comprueba si esta el formulario de envio\r\n\t\tif (find(\"//form[@name='snd']\", XPFirst) == null) return;\r\n\t\tvar ciudades = new Array();\r\n\r\n\t\t// Recupera la coordenada X\r\n\t\tvar n = find(\"//table[@class='dtbl']//td[@class='right dlist1']\", XPList);\r\n\t\tfor(var i = 0; i < n.snapshotLength; i++){\r\n\t\t\tciudades[i] = new Object();\r\n\t\t\ttry{ ciudades[i].x = n.snapshotItem(i).innerHTML.split('(')[1]; }catch(e){}\r\n\t\t}\r\n\r\n\t\t// Recupera la coordenada Y\r\n\t\tn = find(\"//table[@class='dtbl']//td[@class='left dlist3']\", XPList);\r\n\t\tfor(var i = 0; i < n.snapshotLength; i++){\r\n\t\t\ttry{ ciudades[i].y = n.snapshotItem(i).innerHTML.split(')')[0]; } catch(e){}\r\n\t\t}\r\n\r\n\t\t// Por cada par de coordenadas crea un evento para copiarlas al formulario\r\n\t\tn = find(\"//table[@class='dtbl']//tr\", XPList);\r\n\t\tfor (var i = 0; i < ciudades.length; i++){\r\n\t\t\tvar elem = n.snapshotItem(i);\r\n\t\t\telem.setAttribute('onClick',\"snd.x.value='\" + ciudades[i].x + \"';snd.y.value='\" + ciudades[i].y + \"'\");\r\n\t\t\telem.setAttribute('onMouseOver', 'this.style.color=\"red\"');\r\n\t\t\telem.setAttribute('onMouseOut', 'this.style.color=\"black\"');\r\n\t\t\telem.style.cursor = \"pointer\";\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Calcula y muestra informacion adicional en los informes de los ataques\r\n\t * Codigo inicial de Bafox\r\n\t */\r\n\tfunction reportBatalla(){\r\n\t\tvar t = find(\"//table[@class='tbg']//table[@class='tbg']\", XPList);\r\n\t\tif (t.snapshotLength < 2) return;\r\n\r\n\t\t// Encuentra y suma todas las cantidades del botin\r\n\t\tvar botin = null;\r\n\t\tvar a = find(\"//tr[@class='cbg1']\", XPList);\r\n\t\tif (a.snapshotLength >= 3){\r\n\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\tif (a.snapshotItem(1).childNodes.length == 4){\r\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[3];\r\n\t\t\t}else{\r\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[1];\r\n\t\t\t}\r\n\t\t\tif (b.childNodes.length == 8){\r\n\t\t\t\tvar cantidades_botin = new Array();\r\n\t\t\t\tcantidades_botin[0] = parseInt(b.childNodes[1].nodeValue);\r\n\t\t\t\tcantidades_botin[1] = parseInt(b.childNodes[3].nodeValue);\r\n\t\t\t\tcantidades_botin[2] = parseInt(b.childNodes[5].nodeValue);\r\n\t\t\t\tcantidades_botin[3] = parseInt(b.childNodes[7].nodeValue);\r\n\t\t\t\tbotin = arrayToInt(cantidades_botin);\r\n\t\t\t\tvar info_botin = '';\r\n\t\t\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\t\t\tinfo_botin += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\r\n\t\t\t\t\tinfo_botin += cantidades_botin[i];\r\n\t\t\t\t\tif (i < 3) info_botin += ' + '; else info_botin += ' = ';\r\n\t\t\t\t}\r\n\t\t\t\tinfo_botin += botin;\r\n\t\t\t\tb.innerHTML = info_botin;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar perds = new Array();\r\n\t\tvar carry = new Array();\r\n\t\t// Por cada participante en la batalla (atacante, defensor y posibles apoyos)\r\n\t\tfor(var g = 0; g < t.snapshotLength; g++){\r\n\t\t\tcarry[g] = 0;\r\n\t\t\tvar tt = t.snapshotItem(g);\r\n\t\t\tvar num_elementos = tt.rows[1].cells.length - 1;\r\n\t\t\tfor(var j = 1; j < 11; j++){\r\n\t\t\t\t// Recupera la cantidades de tropa de cada tipo que han intervenido\r\n\t\t\t\tvar u = uc[tt.rows[1].cells[j].getElementsByTagName('img')[0].src.replace(/.*\\/.*\\//,'').replace(/\\..*/,'')];\r\n\t\t\t\tvar p = tt.rows[3] ? tt.rows[3].cells[j].innerHTML : 0;\r\n\t\t\t\t// Basandose en el coste por unidad y su capacidad, se calculan las perdidas y la capacidad de carga total\r\n\t\t\t\tvar ptu = arrayByN(u, p);\r\n\t\t\t\tperds[g] = arrayAdd(perds[g], ptu.slice(0, 4));\r\n\t\t\t\tcarry[g] += (tt.rows[2] ? tt.rows[2].cells[j].innerHTML - p : 0) * u[4];\r\n\t\t\t}\r\n\r\n\t\t\t// Anyade la nueva informacion como una fila adicional en cada tabla\r\n//\t\t\t另有插件 将其移除\r\n//\t\t\tvar informe = document.createElement(\"TD\");\r\n//\t\t\tfor (var i = 0; i < 4; i++){\r\n//\t\t\t\tinforme.innerHTML += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\r\n//\t\t\t\tinforme.innerHTML += perds[g][i];\r\n//\t\t\t\tif (i < 3) informe.innerHTML += ' + '; else informe.innerHTML += ' = ';\r\n//\t\t\t}\r\n//\t\t\tvar perdidas = arrayToInt(perds[g]);\r\n//\t\t\tinforme.innerHTML += perdidas;\r\n//\t\t\tinforme.colSpan = num_elementos;\r\n//\t\t\tinforme.className = \"s7\";\r\n//\t\t\tvar fila = document.createElement(\"TR\");\r\n//\t\t\tfila.className = \"cbg1\";\r\n//\t\t\tfila.appendChild(elem(\"TD\", T('PERDIDAS')));\r\n//\t\t\tfila.appendChild(informe);\r\n//\t\t\ttt.appendChild(fila);\r\n\r\n\t\t\t// Solo para el atacante se calcula y muestra la rentabilidad y eficiencia del ataque\r\n\t\t\tif (g == 0 && botin != null){\r\n\t\t\t\tvar datos = document.createElement(\"TD\");\r\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\r\n\t\t\t\tdatos.colSpan = num_elementos;\r\n\r\n\t\t\t\t// La rentabilidad muestra el botin en comparacion con las perdidas\r\n\r\n\t\t\t\tvar rentabilidad = Math.round((botin - perdidas) * 100 / botin);\r\n\t\t\t\tif (botin == 0)\tif (perdidas == 0) rentabilidad = 0; else rentabilidad = -100;\r\n\t\t\t\tdatos.innerHTML = rentabilidad + \"%\";\r\n\t\t\t\tdatos.className = \"s7\";\r\n\t\t\t\tfila_datos.className = \"cbg1\";\r\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('RENT')));\r\n\t\t\t\tfila_datos.appendChild(datos);\r\n\t\t\t\ttt.appendChild(fila_datos);\r\n\r\n\t\t\t\tvar datos = document.createElement(\"TD\");\r\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\r\n\t\t\t\tdatos.colSpan = num_elementos;\r\n\r\n\t\t\t\t// La eficiencia muestra el botin en comparacion con la cantidad de tropas utilizadas\r\n\r\n\t\t\t\tvar eficiencia = 100 - Math.round((carry[g] - botin) * 100 / carry[g]);\r\n\t\t\t\tif (carry[g] == 0) eficiencia = 0;\r\n\t\t\t\tdatos.innerHTML = eficiencia + \"%\";\r\n\t\t\t\tdatos.className = \"s7\";\r\n\t\t\t\tfila_datos.className = \"cbg1\";\r\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('EFICIENCIA')));\r\n\t\t\t\tfila_datos.appendChild(datos);\r\n\t\t\t\ttt.appendChild(fila_datos);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza un resumen de la pagina de produccion\r\n\t * It makes a summary of the production page\r\n\t * 生产\r\n\t */\r\n\t/*\r\n\tfunction preCalculate1(){\r\n\t\tvar data = 0;\r\n\t\tvar resourcesDescs = new Array();\r\n\t\tvar resourcesLinks = new Array();\r\n\t\tvar resourcesfieldlv = new Array();\r\n\r\n\r\n\t}\r\n\t*/\r\n\tfunction preCalculate1(){\r\n\t\tvar datos = 0;\r\n\r\n\t\t// Crea una matriz inicializada a 0 con todos los posibles niveles de cada tipo de recurso\r\n\t\tvar grid = new Array(4);\r\n\t\tfor(i = 0; i < 4; i ++) {\r\n\t\t\tgrid[i] = new Array(26);\r\n\t\t\tfor(j = 0; j <= 25; j++) {\r\n\t\t\t\tgrid[i][j] = 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Solo hay 6 tipos de aldeas de 15 casillas cada uno. Se describe el tipo de recurso por casilla\r\n\t\tvar dist = [\r\n\t\t\t[3, 3, 0, 3, 3, 1, 2, 3, 3, 2, 2, 3, 3, 0, 3, 1, 0, 1], // 9 cereales\r\n\t\t\t[2, 3, 0, 2, 1, 1, 2, 3, 3, 2, 2, 3, 3, 0, 3, 1, 0, 1],\r\n\t\t\t[0, 3, 0, 2, 1, 1, 2, 3, 3, 2, 2, 3, 3, 0, 3, 1, 0, 1],\r\n\t\t\t[0, 3, 0, 1, 1, 1, 2, 3, 3, 2, 2, 3, 3, 0, 3, 1, 0, 1],\r\n\t\t\t[0, 3, 0, 2, 0, 1, 2, 3, 3, 2, 2, 3, 3, 0, 3, 1, 0, 1],\r\n\t\t\t[3, 3, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3] // 15 cereales\r\n\t\t];\r\n\r\n\t\tfind(\"//div[starts-with(@id, 'f')]\", XPFirst).id.search(/f(\\d)/);\r\n\t\tvar tipo = RegExp.$1;\r\n\r\n\t\t// Recupera todas las casillas y rellena la matriz con los niveles detectados\r\n\t\tfor (var i = 1; i <= 18; i++){\r\n\t\t\tvar a = find(\"//img[@class='rf\" + i + \"']\", XPFirst);\r\n\t\t\tif (a){\r\n\t\t\t\ta.src.search(/\\/s(\\d+).gif$/);\r\n\t\t\t\tgrid[dist[tipo - 1][i - 1]][RegExp.$1]++;\r\n\t\t\t}else{\r\n\t\t\t\tgrid[dist[tipo - 1][i - 1]][0]++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Crea una tabla mostrando por cada tipo de recurso un representante de cada nivel que se ha encontrado\r\n\t\t// Muestra al lado de cada uno los recursos y tiempo restantes hasta poder subirlo de nivel\r\n\t\tvar table = document.createElement('TABLE');\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"align\", \"center\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\t\tvar fila1 = document.createElement('TR');\r\n\t\tvar fila2 = document.createElement('TR');\r\n\t\tfila1.setAttribute(\"class\", \"rbg\");\r\n\t\ttable.appendChild(fila1);\r\n\t\ttable.appendChild(fila2);\r\n\t\tfor (var i = 0; i < 4; i++)\r\n\t\t{\r\n\t\t\tvar td1 = elem('TD', '<img src=\"' + img('r/' + (i+1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">');\r\n\t\t\tfila1.appendChild(td1);\r\n\r\n\t\t\tvar td2 = document.createElement('TD');\r\n\t\t\ttd2.setAttribute('valign', 'top');\r\n\t\t\tfila2.appendChild(td2);\r\n\r\n\t\t\tvar table2 = document.createElement('TABLE');\r\n\t\t\ttable2.setAttribute(\"align\", \"center\");\r\n\t\t\ttd2.appendChild(table2);\r\n\t\t\tfor (var j = 0; j < 25; j++)\r\n\t\t\t{\r\n\t\t\t\tif (grid[i][j] > 0 && buildingCost[i][j+1] != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tdatos = 1;\r\n\t\t\t\t\tvar fila3 = document.createElement('TR');\r\n\t\t\t\t\t//var tipDiv = document.createElement('DIV');\r\n\t\t\t\t\tfila3.setAttribute('id', 'tip_' + i + '_' + j);\r\n\t\t\t\t\tvar imagen = '<div style=\"width: 0%;\"><img src=\"data:image/gif;base64,' + imagenes[\"r\" + i] + '\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\r\n\t\t\t\t\tif (j > 0) imagen += '<img src=\"' + img('g/s/s' + j + '.gif') + '\" style=\"position:relative; bottom:52px; left: 27px;\" border=\"0\">';\r\n\t\t\t\t\timagen += '</div>';\r\n\t\t\t\t\tvar td = elem(\"TD\", imagen);\r\n\t\t\t\t\tfila3.appendChild(td);\r\n\r\n\t\t\t\t\tvar restante = calculateResourceTime(buildingCost[i][j+1], true);\r\n\t\t\t\t\tvar td3 = document.createElement('TD');\r\n\t\t\t\t\t//td3.setAttribute('class', 'c f7');\r\n\t\t\t\t\ttd3.setAttribute('style','color:#333; font-size: 12px; vertical-align: top');\r\n\r\n\t\t\t\t\tfila3.appendChild(td3);\r\n\t\t\t\t\ttable2.appendChild(fila3);\r\n\r\n\t\t\t\t\tif (restante != null) td3.innerHTML = restante;\r\n\t\t\t\t\telse td3.innerHTML = '<span style=\"color: #FF6F0F; font-weight: bold;\">' + T('SUBIR_NIVEL') + '</span>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n//\t\ttable.style.position = 'absolute';\r\n\t\ttable.setAttribute(\"id\", \"resumen\");\r\n\t\t// Se desplaza la tabla hacia abajo para no interferir con la lista de aldeas / enlaces derecha\r\n//\t\ttable.style.top = 580 + longitudPantalla() + 'px';\r\n\t\tif (datos == 1) {\r\n\r\n\t\t\tvar divt = document.createElement('DIV');\r\n\t\t\tdivt.style.display = 'block';\r\n\t\t\tdivt.style.position = 'absolute';\r\n\r\n\t\t\tvar oh = 290;\r\n\t\t\tvar height = get('ltrm') ? get('ltrm').clientHeight : 0;\r\n\t\t\tvar height2 = get('lbau1') ? get('lbau1').clientHeight : 0;\r\n\r\n\t\t\tdivt.style.top = 610 + ((oh - height - height2) >= 0 ? 0 : (height + height2 - oh)) + longitudPantalla() + 'px';\r\n\r\n\t\t\tdivt.appendChild(table);\r\n\t\t\tdocument.body.appendChild(divt);\r\n\r\n//\t\t\tdocument.body.appendChild(table);\r\n\t\t}\r\n\r\n//\t\t/**\r\n//\t\t* xingulin︰加上资源田提示 tip\r\n//\t\t* Begin\r\n//\t\t*/\r\n//\t\t// 加入 tip 区块\r\n//\t\tif($('#lbau1').length != 0)\r\n//\t\t{\r\n//\t\t\t$('#lbau1').after(\"<div id='stateTip' style='border: 1px solid #CCC; color: #333; display: none; font-size: 12px; width: 500px; height: 75px;'></div>\");\r\n//\t\t}\r\n//\t\telse\r\n//\t\t{\r\n//\t\t\t$('#lmid2').append(\"<div id='stateTip' style='position: absolute; left: 30px; color: #333; top: 350px; font-size: 12px; width: 500px; height: 75px; border: 1px solid #CCC; display: none;'></div>\");\r\n//\t\t}\r\n//\r\n//\t\t// 帮每个资源田加上 Hover Event Handler,处理 tip 的显示与隐藏\r\n//\t\t//for (var i = 1; i <= 18; i++)\r\n//\t\t$('//map[@name=\"rx\"]/area').each(function(i)\r\n//\t\t{\r\n//\t\t\tif(i != 18) // 跳过最后一个<area />(村庄中心)\r\n//\t\t\t{\r\n//\t\t\t\tvar resource;\r\n//\t\t\t\tvar resource_level;\r\n//\t\t\t\tvar resource_type;\r\n//\t\t\t\tif ( resource = $('img.rf' + (i + 1) + ':eq(0)') )\r\n//\t\t\t\t{\r\n//\t\t\t\t\t$(resource).attr('src').search(/\\/s(\\d+).gif$/);\r\n//\t\t\t\t\tresource_level = parseInt(RegExp.$1);\r\n//\t\t\t\t\tresource_type = parseInt(dist[tipo - 1][i]);\r\n//\t\t\t\t\t$($('//map[@name=\"rx\"]/area:eq(' + i + ')')).hover\r\n//\t\t\t\t\t(\r\n//\t\t\t\t\t\tfunction()\r\n//\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\tvar imagen = '<div style=\"width: 0%;\"><img src=\"data:image/gif;base64,' + imagenes[\"r\" + resource_type] + '\" border=\"0\" title=\"' + T('RECURSO' + (resource_type + 1)) + '\">';\r\n//\t\t\t\t\t\t\tif (resource_level > 0)\r\n//\t\t\t\t\t\t\t\timagen += '<img src=\"' + img('g/s/s' + resource_level + '.gif') + '\" style=\"position:relative; bottom:52px; left: 27px;\" border=\"0\">';\r\n//\t\t\t\t\t\t\timagen += '</div>';\r\n//\r\n//\t\t\t\t\t\t\tvar restante = calculateResourceTime(buildingCost[resource_type][resource_level + 1], false);\r\n//\t\t\t\t\t\t\tif(restante == null)\r\n//\t\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\t\trestante = '<span style=\"color: #FF6F0F; font-weight: bold;\">' + T('SUBIR_NIVEL') + '</span>';\r\n//\t\t\t\t\t\t\t}\r\n//\r\n//\t\t\t\t\t\t\t$('#stateTip').attr('innerHTML', '<div style=\"float: left; display: table-cell\">' + imagen + '</div><div style=\"float: left; display: table-cell; padding-top: 10px; width: 400px;\">' + restante + '</div>');\r\n//\t\t\t\t\t\t\tif($('#lbau1').length != 0)\r\n//\t\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\t\t$('#summary').css('top', parseInt($('#summary').css('top')) + (parseInt($('#lbau1').attr('height')) + $('#stateTip').height() - 115));\r\n//\t\t\t\t\t\t\t}\r\n//\t\t\t\t\t\t\telse\r\n//\t\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\t\t$('#summary').css('top', parseInt($('#summary').css('top')) + ($('#stateTip').height() - 115));\r\n//\t\t\t\t\t\t\t}\r\n//\t\t\t\t\t\t\t$('#stateTip').show();\r\n//\t\t\t\t\t\t},\r\n//\t\t\t\t\t\tfunction()\r\n//\t\t\t\t\t\t{\r\n//\t\t\t\t\t\t\t$('#summary').css('top', 580 + longitudPantalla() + 'px');\r\n//\t\t\t\t\t\t\t$('#stateTip').hide();\r\n//\t\t\t\t\t\t\t$('#stateTip').attr('innerHTML', '');\r\n//\t\t\t\t\t\t}\r\n//\t\t\t\t\t);\r\n//\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n//\t\t});\r\n//\t\t/**\r\n//\t\t* END\r\n//\t\t*/\r\n\t}\r\n\r\n\t/**\r\n\t * It makes a summary of the page of buildings of the village\r\n\t * 建筑物列表\r\n\t */\r\n//\tfunction preCalculate2(){\r\n//\t\tvar data = 0;\r\n//\t\tvar buildingsImages = new Array();\r\n//\t\tvar buildingsDescs = new Array();\r\n//\t\tvar buildingsLinks = new Array();\r\n//\r\n//\t\t// recoge los nombres de cada uno\r\n//\t\txpathResult = find('//map[@name=\"map1\"]/area/@title', XPIter);\r\n//\t\twhile ((buildingsDescs[buildingsDescs.length] = xpathResult.iterateNext())) {}\r\n//\r\n//\t\t// los enlaces para acceder directamente a ellos\r\n//\t\txpathResult = find('//map[@name=\"map1\"]/area/@href', XPIter);\r\n//\t\twhile ((buildingsLinks[buildingsLinks.length] = xpathResult.iterateNext())) {}\r\n//\r\n//\r\n//\t\t// Procesa as imagenes de los edificios\r\n//\t\t//var xpathResult = find('//td[@class=\"s3\"]/img/@src', XPIter);\r\n//\t\tvar xpathResult = find('//div[@id=\"lmid2\"]/img/@src', XPIter);\r\n//\t\tbuildingsImages[0] = document.createTextNode(img(\"g/g16.gif\"));\r\n//\t\twhile ((buildingsImages[buildingsImages.length] = xpathResult.iterateNext())) {}\r\n//\t\t// Soporte para murallas\r\n//\t\tvar a = find(\"//div[starts-with(@class, 'd2_x')]\", XPFirst);\r\n//\t\tif (a){\r\n//\t\t\tswitch(a.className){\r\n//\t\t\t\tcase 'd2_x d2_0': break;\r\n//\t\t\t\tcase 'd2_x d2_1': var b = \"g/g31.gif\"; break;\r\n//\t\t\t\tcase 'd2_x d2_11': var b = \"g/g32.gif\"; break;\r\n//\t\t\t\tcase 'd2_x d2_12': var b = \"g/g33.gif\"; break;\r\n//\t\t\t}\r\n//\t\t\tif (b) buildingsImages[buildingsDescs.length - 4] = document.createTextNode(img(b));\r\n//\t\t}\r\n//\r\n//\t\t//主层表格\r\n//\t\tvar rowcell = 3;\r\n//\t\tvar table = document.createElement('TABLE');\r\n//\t\t//table.setAttribute(\"class\", \"tbg\");\r\n//\t\t//table.setAttribute(\"align\", \"center\");\r\n//\t\ttable.setAttribute(\"cellspacing\", \"0\");\r\n//\t\ttable.setAttribute(\"cellpadding\", \"3\");\r\n//\t\ttable.setAttribute(\"style\", \"width:100%;border-collapse:collapse;\");\r\n//\t\tvar colgroup = document.createElement('COLGROUP');\r\n//\t\tvar col = document.createElement('COL');\r\n//\t\tcol.setAttribute(\"style\", 'width:' + Math.floor(100 /rowcell) +'%;');\r\n//\t\tcol.setAttribute(\"span\", rowcell);\r\n//\t\tcolgroup.appendChild(col);\r\n//\t\ttable.appendChild(colgroup);\r\n//\r\n//\t\tvar tablecell = new Array();\r\n//\t\tvar j = 0;\r\n//\t\t//显示方式\r\n//\t\tfor(var i = 0; i < buildingsDescs.length - 3; i++)\r\n//\t\t{\r\n//\t\t\tif(buildingsDescs[i] != null && basename(buildingsImages[i].nodeValue) != 'iso.gif')\r\n//\t\t\t{\r\n//\t\t\t\t// Por cada edificio se recoge su nivel y su codigo en el juego\r\n//\t\t\t\tbuildingLevel = buildingsDescs[i].nodeValue.split(\" \");\r\n//\t\t\t\tbuildingLevel = parseInt(buildingLevel[buildingLevel.length-1]);\r\n//\r\n//\t\t\t\tbuildingCode = buildingsImages[i].nodeValue.split(\"/\");\r\n//\t\t\t\tbuildingCode = buildingCode[buildingCode.length-1].split(\".\");\r\n//\t\t\t\tbuildingCode = parseInt(buildingCode[0].substring(1, buildingCode[0].length));\r\n//\r\n//\t\t\t\t// Si es actualizable se muestra junto con los recursos que necesita\r\n//\t\t\t\tif (buildingCost[buildingCode] != null && buildingCost[buildingCode][buildingLevel+1] != null)\r\n//\t\t\t\t{\r\n//\t\t\t\t\tdata = 1;\r\n//\t\t\t\t\ttablecell[j] = document.createElement(\"TD\");\r\n//\t\t\t\t\t//tablecell[j].setAttribute('class', 'f10');\r\n//\t\t\t\t\ttablecell[j].setAttribute(\"style\", \"border:1px solid #C0C0C0;vertical-align:top;\");\r\n//\t\t\t\t\tvar title = document.createElement(\"DIV\");\r\n//\t\t\t\t\tvar state = document.createElement(\"DIV\");\r\n//\t\t\t\t\tvar state2 = document.createElement(\"DIV\");\r\n//\r\n//\t\t\t\t\ttitle.setAttribute('class', 'f10');\r\n//\t\t\t\t\ttitle.innerHTML = '<a href=\"' + buildingsLinks[i].nodeValue + '\">' + buildingsDescs[i].nodeValue + '</a>&nbsp;&nbsp;<span>(<a href=\"javascript:void(null)\" class=\"tip\" style=\"color: #387AD7;\">展开/折迭</a>)</span>';\r\n//\r\n//\t\t\t\t\tvar restante = calculateResourceTime(buildingCost[buildingCode][buildingLevel+1]);\r\n//\t\t\t\t\t//将此处更改为升级2级 by Arrack\r\n//\t\t\t\t\tif (buildingCost[buildingCode] != null && buildingCost[buildingCode][buildingLevel+2] != null)\r\n//\t\t\t\t\t{\r\n//\r\n//\t\t\t\t\t\tvar restante_temp=[0,0,0,0];\r\n//\r\n//\t\t\t\t\t\tfor (var ii = 0; ii < 4; ii++){\r\n//\t\t\t\t\t\t\trestante_temp[ii] = buildingCost[buildingCode][buildingLevel+1][ii]+buildingCost[buildingCode][buildingLevel+2][ii];\r\n//\t\t\t\t\t\t}\r\n//\r\n//\t\t\t\t\t\tvar restante2 = calculateResourceTime(restante_temp);\r\n//\r\n//\t\t\t\t\t\t//var restante2 = calculateResourceTime(buildingCost[buildingCode][buildingLevel+2]);\r\n//\t\t\t\t\t}\r\n//\t\t\t\t\t//state.setAttribute('class', 'c f10');\r\n//\t\t\t\t\tstate.setAttribute('style','color:#333; font-size: 12px; margin-top: 5px;');\r\n//\r\n//\t\t\t\t\tstate.innerHTML += T('UPLV') + (buildingLevel+1) + '<br>';\r\n//\r\n//\t\t\t\t\tif (restante != null)\r\n//\t\t\t\t\t{\r\n//\t\t\t\t\t\tstate.innerHTML += restante;\r\n//\t\t\t\t\t}\r\n//\t\t\t\t\telse // 可升级\r\n//\t\t\t\t\t{\r\n//\t\t\t\t\t\t//明显的连结标示\r\n//\t\t\t\t\t\tstate.innerHTML += '<a href=\"' + buildingsLinks[i].nodeValue + '\" style=\"color: #FF6F0F;\">' + T('SUBIR_NIVEL') + '</a>';\r\n//\t\t\t\t\t}\r\n//\r\n//\t\t\t\t\t//state.innerHTML += '<br>--<br>' + T('UPLV') + (buildingLevel+2) + '<br>';\r\n//\t\t\t\t\tstate2.setAttribute('style', 'display: none; font-size: 12px; color: #333; margin-top: 10px; padding-top: 10px; border-top: 1px dashed');\r\n//\t\t\t\t\tstate2.setAttribute('class', 'state2');\r\n//\t\t\t\t\tstate2.innerHTML = T('UPLV') + (buildingLevel+2) + '<br>';\r\n//\r\n//\t\t\t\t\tif (restante2 != null)\r\n//\t\t\t\t\t{\r\n//\t\t\t\t\t\tstate2.innerHTML += restante2;\r\n//\t\t\t\t\t}\r\n//\t\t\t\t\telse // 可升级\r\n//\t\t\t\t\t{\r\n//\t\t\t\t\t\t//明显的连结标示\r\n//\t\t\t\t\t\tstate2.innerHTML += '<a href=\"' + buildingsLinks[i].nodeValue + '\" style=\"color: #FF6F0F;\">' + T('SUBIR_NIVEL') + '</a>';\r\n//\t\t\t\t\t}\r\n//\r\n//\r\n//\t\t\t\t\ttablecell[j].appendChild(title);\r\n//\t\t\t\t\ttablecell[j].appendChild(state);\r\n//\t\t\t\t\ttablecell[j].appendChild(state2);\r\n//\t\t\t\t\tj++;\r\n//\t\t\t\t}\r\n//\r\n//\t\t\t}\r\n//\t\t}\r\n//\r\n//\r\n//\t\tvar tablerow = new Array();\r\n//\t\tvar rowno = Math.ceil(tablecell.length / rowcell);\r\n//\t\tfor(var i = 0; i < rowno; i++)\r\n//\t\t{\r\n//\t\t\ttablerow[i] = document.createElement(\"TR\");\r\n//\r\n//\t\t\t// xingulin: 奇数行加上背景色\r\n//\t\t\tif(i % 2 == 0) {\r\n//\t\t\t\ttablerow[i].setAttribute('style', 'background-color: #E5EDF7');\r\n//\t\t\t}\r\n//\t\t}\r\n//\r\n//\t\tvar k = 0;\r\n//\t\tvar l = 0;\r\n//\t\tfor(var i = 0; i < tablecell.length; i++) {\r\n//\t\t\ttablerow[k].appendChild(tablecell[i]);\r\n//\t\t\tl++;\r\n//\t\t\tif(l % rowcell == 0) {k++;}\r\n//\t\t}\r\n//\t\t//填补空格\r\n//\t\tif(tablecell.length%rowcell != 0){\r\n//\t\t\tfor(var i = 0; i < rowcell-(tablecell.length % rowcell); i++) {\r\n//\t\t\t\tvar emptycell = document.createElement(\"TD\");\r\n//\t\t\t\temptycell.setAttribute(\"style\", \"border:1px solid #C0C0C0;vertical-align:top;\");\r\n//\t\t\t\ttablerow[rowno - 1].appendChild(emptycell);\r\n//\t\t\t}\r\n//\t\t}\r\n//\t\tfor(var i = 0; i < rowno; i++) {\r\n//\t\t\t table.appendChild(tablerow[i]);\r\n//\t\t}\r\n//\t\ttable.style.position = 'absolute';\r\n//\t\t//table.setAttribute(\"id\", \"resumen\");\r\n//\t\t// Se desplaza la table hacia abajo para no interferir con la lista de aldeas / enlaces derecha\r\n//\t\ttable.style.top = 625 + longitudPantalla() + 'px';\r\n//\t\tif (data == 1) document.body.appendChild(table);\r\n//\r\n//\t\t/**\r\n//\t\t * xingulin︰加入切换升两级的提示区块的 Click Event Handler\r\n//\t\t * Begin\r\n//\t\t */\r\n//\t\t$(\"a.tip\").each(function(i)\r\n//\t\t{\r\n//\t\t\t$(this).click\r\n//\t\t\t(\r\n//\t\t\t\tfunction()\r\n//\t\t\t\t{\r\n//\t\t\t\t\t$($(\"div.state2\").get(i)).toggle();\r\n//\t\t\t\t}\r\n//\t\t\t);\r\n//\t\t});\r\n//\t\t/**\r\n//\t\t * End\r\n//\t\t */\r\n//\t}\r\n\r\n\tfunction preCalculate2(){\r\n\t\tvar edificiosPorFila = 3; // hany epulet legyen egy sorban\r\n\t\tvar datos = 0;\r\n\t\tvar buildingsImages = new Array();\r\n\t\tvar buildingsDescs = new Array();\r\n\t\tvar buildingsLinks = new Array();\r\n\r\n\t\t// recoge los nombres de cada uno\r\n\t\tvar xpathResult = find('//map[@name=\"map1\"]/area/@title', XPIter);\r\n\t\twhile ((buildingsDescs[buildingsDescs.length] = xpathResult.iterateNext())) {}\r\n\r\n\t\t// los enlaces para acceder directamente a ellos\r\n\t\txpathResult = find('//map[@name=\"map1\"]/area/@href', XPIter);\r\n\t\twhile ((buildingsLinks[buildingsLinks.length] = xpathResult.iterateNext())) {}\r\n\r\n\t\t// Procesa as imagenes de los edificios\r\n\t\tvar xpathResult = find('//div[@id=\"lmid2\"]/img/@src', XPIter);\r\n\t\tbuildingsImages[0] = document.createTextNode(img(\"g/g16.gif\"));\r\n\t\twhile ((buildingsImages[buildingsImages.length] = xpathResult.iterateNext())) {}\r\n\t\t// Soporte para murallas\r\n\t\tvar a = find(\"//div[starts-with(@class, 'd2_x')]\", XPFirst);\r\n\t\tif (a){\r\n\t\t\tswitch(a.className){\r\n\t\t\t\tcase 'd2_x d2_0': break;\r\n\t\t\t\tcase 'd2_x d2_1': var b = \"g/g31.gif\"; break;\r\n\t\t\t\tcase 'd2_x d2_11': var b = \"g/g32.gif\"; break;\r\n\t\t\t\tcase 'd2_x d2_12': var b = \"g/g33.gif\"; break;\r\n\t\t\t}\r\n\t\t\tif (b) buildingsImages[buildingsDescs.length - 4] = document.createTextNode(img(b));\r\n\t\t}\r\n\r\n\t\tvar table = document.createElement('TABLE');\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"align\", \"left\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar j = 0;\r\n\t\tfor(var i = 0; i < buildingsDescs.length - 3; i++) {\r\n\t\t\tif(buildingsDescs[i] != null && basename(buildingsImages[i].nodeValue) != 'iso.gif') {\r\n\t\t\t\t// Por cada edificio se recoge su nivel y su codigo en el juego\r\n\t\t\t\tvar buildingLevel = buildingsDescs[i].nodeValue.split(\" \");\r\n\t\t\t\tbuildingLevel = parseInt(buildingLevel[buildingLevel.length-1]);\r\n\r\n\t\t\t\tvar buildingCode = buildingsImages[i].nodeValue.split(\"/\");\r\n\t\t\t\tbuildingCode = buildingCode[buildingCode.length-1].split(\".\");\r\n\t\t\t\tif (buildingCode[0].search(/(\\d+)/)) buildingCode = parseInt(RegExp.$1);\r\n//\t\t\t\tbuildingCode = parseInt(buildingCode[0].substring(1, buildingCode[0].length));\r\n\r\n\t\t\t\t// Si es actualizable se muestra junto con los recursos que necesita\r\n\t\t\t\tif (buildingCost[buildingCode] != null && buildingCost[buildingCode][buildingLevel+1] != null){\r\n\t\t\t\t\t// Se reparten los edificios entre las columnas disponibles en las filas que haga falta\r\n\t\t\t\t\tif (j % edificiosPorFila == 0){\r\n\t\t\t\t\t\tvar fila = document.createElement('TR');\r\n\r\n\t\t\t\t\t\tif(j % 2 == 0) {\r\n\t\t\t\t\t\t\tfila.setAttribute('style', 'background-color: #E5EDF7');\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\ttable.appendChild(fila);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t\tdatos = 1;\r\n\r\n\t\t\t\t\t// Soporte para murallas\r\n\t\t\t\t\tswitch(buildingCode){\r\n\t\t\t\t\t\tcase 31: buildingsImages[i].nodeValue = 'data:image/gif;base64,' + imagenes[\"empalizada\"]; break;\r\n\t\t\t\t\t\tcase 32: buildingsImages[i].nodeValue = 'data:image/gif;base64,' + imagenes[\"muralla\"]; break;\r\n\t\t\t\t\t\tcase 33: buildingsImages[i].nodeValue = 'data:image/gif;base64,' + imagenes[\"terraplen\"]; break;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t\ttd.setAttribute('width','25%');\r\n\t\t\t\t\ttd.setAttribute('valign','bottom');\r\n\t\t\t\t\tfila.appendChild(td);\r\n\r\n\t\t\t\t\tvar table2 = document.createElement('TABLE');\r\n\t\t\t\t\ttable2.setAttribute(\"align\", \"left\");\r\n\t\t\t\t\ttable2.setAttribute('class','bttable');\r\n\r\n//\t\t\t\t\ttable2.setAttribute(\"height\", \"100%\");\r\n//\t\t\t\t\ttable2.setAttribute(\"width\", \"100%\");\r\n\r\n\t\t\t\t\ttable2.setAttribute(\"cellspacing\", \"0\");\r\n\t\t\t\t\ttable2.setAttribute(\"cellpadding\", \"0\");\r\n\r\n\t\t\t\t\ttd.appendChild(table2);\r\n\r\n\t\t\t\t\tvar nametr = document.createElement('TR');\r\n\t\t\t\t\ttable2.appendChild(nametr);\r\n\t\t\t\t\tvar nametd = elem('TD','<a href=\"' + buildingsLinks[i].nodeValue + '\" title=\"'+ buildingsDescs[i].nodeValue +'\">' + buildingsDescs[i].nodeValue+'</a>' );\r\n\t\t\t\t\tnametd.setAttribute('colspan',\"2\");\r\n\t\t\t\t\tnametd.setAttribute('class', 'f10');\r\n\t\t\t\t\tnametr.appendChild(nametd);\r\n\r\n\t\t\t\t\tvar fila2 = document.createElement('TR');\r\n\t\t\t\t\ttable2.appendChild(fila2);\r\n\r\n\t\t\t\t\tvar td2 = document.createElement(\"TD\");\r\n\t\t\t\t\ttd2.setAttribute('class', 'f10');\r\n\t\t\t\t\ttd2.innerHTML = '<a href=\"' + buildingsLinks[i].nodeValue + '\" title=\"'+ buildingsDescs[i].nodeValue +'\"><img src=\"' + buildingsImages[i].nodeValue + '\" border=\"0\"></a>';\r\n\t\t\t\t\tfila2.appendChild(td2);\r\n\r\n\t\t\t\t\tvar restante = calculateResourceTime(buildingCost[buildingCode][buildingLevel+1], 1);\r\n\t\t\t\t\tvar td3 = document.createElement(\"TD\");\r\n//\t\t\t\t\ttd3.setAttribute('class', 'dcol f7');\r\n\t\t\t\t\ttd3.setAttribute('style','color:#333; font-size: 12px; padding-bottom: 5px;');\r\n\t\t\t\t\ttd3.setAttribute('valign','bottom');\r\n\t\t\t\t\tfila2.appendChild(td3);\r\n\r\n\t\t\t\t\tif (restante != null) {\r\n\t\t\t\t\t td3.setAttribute('valign', 'bottom');\r\n// \t\t\t\t\t td3.setAttribute('align', 'left');\r\n\t\t\t\t\t td3.innerHTML = restante;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t td3.setAttribute('valign', 'center');\r\n// td3.innerHTML = T('SUBIR_NIVEL');\r\n\r\n\t\t\t\t\t td3.innerHTML += '<a href=\"' + buildingsLinks[i].nodeValue + '\" style=\"color: #FF6F0F;\">' + T('SUBIR_NIVEL') + '</a>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile (j % edificiosPorFila != 0) {\r\n\t\t fila.appendChild(elem(\"TD\", '', 'style', 'background-color: #FFFFFF'));\r\n\t\t j++;\r\n\t\t}\r\n\t\t//table.style.position = 'absolute';\r\n\t\ttable.setAttribute(\"id\", \"resumen\");\r\n\t\t// Se desplaza la tabla hacia abajo para no interferir con la lista de aldeas / enlaces derecha\r\n\t\t//table.style.top = 625 + longitudPantalla() + 'px';\r\n\t\tif (datos == 1) {\r\n\t\t\tvar middleblock = get('lmidall');\r\n\t\t\tmiddleblock.appendChild(document.createElement('BR'));\r\n\t\t\tmiddleblock.appendChild(table);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza un resumen de la pagina del mapa\r\n\t * 地图预处理\r\n\t */\r\n\tfunction preCalculate3(){\r\n\r\n//\t\treturn;\r\n//\r\n//\t\tvar datos = 0;\r\n//\t\tvar a = find(\"//*/area[@onmouseover]\", XPList);\r\n//\t\t//fix by arrack 移动地图的问题\r\n//\t\tvar b=document.getElementById('table_map');\r\n//\t\tif(b){\r\n//\t\t\t//alert(b.innerHTML);\r\n//\t\t\tb.innerHTML='';\r\n//\t\t}\r\n//\t\tvar table = document.createElement('TABLE');\r\n//\t\ttable.setAttribute(\"id\", \"table_map\");\r\n//\t\ttable.setAttribute(\"sortCol\", -1);\r\n//\t\ttable.setAttribute(\"class\", \"tbg\");\r\n//\t\ttable.setAttribute(\"align\", \"center\");\r\n//\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n//\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n//\t\tvar thead = document.createElement(\"THEAD\");\r\n//\t\tvar tbody = document.createElement(\"TBODY\");\r\n//\t\tvar row = document.createElement('TR');\r\n//\t\trow.setAttribute('class', \"rbg\");\r\n//\t\tthead.appendChild(row);\r\n//\t\ttable.appendChild(thead);\r\n//\t\tvar etiquetas_table = [\"JUGADOR\", \"ALIANZA\", \"ALDEAS\", \"HAB\", \"COORD\", \"ACCION\"];\r\n//\r\n//\t\tfor (var i = 0; i < 6; i++){\r\n//\t\t\tvar td = elem('TD', T(etiquetas_table[i]));\r\n//\t\t\tif (i < 4){\r\n//\t\t\t\tswitch(i){\r\n//\t\t\t\t\tcase 3: td.addEventListener(\"click\", sortTable('table_map', i, 'int'), 0); break;\r\n//\t\t\t\t\t//有待除错\r\n//\t\t\t\t\tdefault: td.addEventListener(\"click\", sortTable('table_map', i), 0);\r\n//\t\t\t\t}\r\n//\t\t\t\ttd.style.cursor = \"pointer\";\r\n//\t\t\t}\r\n//\t\t\trow.appendChild(td);\r\n//\t\t}\r\n//\t\t// Procesa todas las casillas visibles del mapa\r\n//\t\tfor(var i = 0; i < a.snapshotLength; i++) {\r\n//\t\t\tvar aldea = a.snapshotItem(i);\r\n//\t\t\tvar mouseOver = aldea.getAttribute(\"onmouseover\");\r\n//\t\t\t// Por cada aldea se muestra toda la informacion posible y enlaces rapidos para atacar y enviar recursos\r\n//\t\t\tif(mouseOver.substring(0,1) != \"x\") {\r\n//\t\t\t\tdatos = 1;\r\n//\t\t\t\tvar row = document.createElement('TR');\r\n//\t\t\t\ttbody.appendChild(row);\r\n//\t\t\t\tdatos_aldea = mouseOver.substring(4, mouseOver.length - 1).split(\",\");\r\n//\t\t\t\tvar href = aldea.getAttribute(\"href\");\r\n//\t\t\t\trow.appendChild(elem('TD', datos_aldea[1].substring(1, datos_aldea[1].length - 1)));\r\n//\t\t\t\trow.appendChild(elem('TD', datos_aldea[3].substring(1, datos_aldea[3].length - 1)));\r\n//\t\t\t\trow.appendChild(elem('TD', datos_aldea[0].substring(1, datos_aldea[0].length - 1)));\r\n//\t\t\t\trow.appendChild(elem('TD', datos_aldea[2].substring(1, datos_aldea[2].length - 1)));\r\n//\t\t\t\trow.appendChild(elem('TD', '<a href=\"' + href + '\">' + datos_aldea[4].substring(1, datos_aldea[4].length - 1) + \", \" + datos_aldea[5].substring(1, datos_aldea[5].length - 1) + '</a>'));\r\n//\t\t\t\trow.appendChild(elem('TD', '<a href=\"' + href.replace(\"karte.php?d\", \"a2b.php?z\") + '\">' + T('ATACAR') + '</a> / <a href=\"' + href.replace(\"karte.php?d\", \"build.php?ze\") + '&gid=17\">' + T('COMERCIAR') + '</a>'));\r\n//\t\t\t}\r\n//\t\t}\r\n//\t\ttable.appendChild(tbody);\r\n//\t\ttable.style.position = 'absolute';\r\n//\t\t//table.setAttribute(\"id\", \"resumen\");\r\n//\t\ttable.style.top = 580 + longitudPantalla() + 'px';\r\n//\t\tif (datos == 1) document.body.appendChild(table);\r\n\r\n\t\tinstallMapEventHandler();\r\n\t}\r\n\r\n\tfunction installMapEventHandler() {\r\n\t\tvar origpe = unsafeWindow.ve;\r\n\t\tunsafeWindow.ve = function(pd,qd) {\r\n\t\t\tvar rv = origpe(pd,qd);\r\n\t\t\tsetTimeout(infoRecursos,10);\r\n\t\t\treturn rv;\r\n\t\t};\r\n\r\n\t\tfor(var i=1;i<50;i++){\r\n\t\t\tvar k1=(i-1)%7;\r\n\t\t\tvar k2=Math.floor((49-i)/7);\r\n\r\n\t\t\tvar area = get(\"a_\"+k1+\"_\"+k2);\r\n\t\t\tvar mevobj = createMapInfoObj(area,i-1);\r\n\t\t\tarea.addEventListener(\"mouseover\",mevobj.mouseOverEvent,false);\r\n\t\t\tarea.addEventListener(\"mouseout\", mevobj.mouseOutEvent,false);\r\n\r\n//\t\t\tarea.addEventListener(\"mouseover\", crearEventoRecursosCasilla(area.href, links[i]), 0);\r\n//\t\t\tarea.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction createMapInfoObj(area,pos){\r\n\t\tvar mev = new Object();\r\n\t\tmev.area=area;\r\n\t\tmev.pict=get(\"i_\"+area.id.substring(2));\r\n\t\tmev.pos=pos;\r\n\t\tmev.timeout=0;\r\n\r\n\t\tmev.mouseOverEvent = function(){\r\n//\t\t\tif (mev.pict.src.match(/\\/(d|t)\\d*.gif$/)) {\r\n//\t\t\t\tmev.timeout = setTimeout(function(){\r\n//\t\t\t\tajaxRequest(mev.area.href, \"GET\", null, function(t) {if (mev.timeout!=0) procesarCasilla(t,mev)}, dummy); }\r\n//\t\t\t\t, 300);\r\n//\t\t\t}\r\n\r\n\t\t\tvar mapdata = arrayRecursosCasilla[mev.area.href] ? arrayRecursosCasilla[mev.area.href] : mev.area.getAttribute(\"casilla\");\r\n\r\n\t\t\tif (mapdata) {\r\n\t\t\t\ttimeout = setTimeout(function(){\r\n\t\t\t\t\tvar div = get(\"tb_tooltip\");\r\n\t\t\t\t\tdiv.style.display = 'block';\r\n\t\t\t\t\tdiv.innerHTML = mapdata;\r\n\t\t\t\t}, 100);\r\n\t\t\t} else {\r\n\t\t\t\tif (mev.pict.src.match(/\\/(d|t)\\d*.gif$/)) {\r\n\t\t\t\t\tmev.timeout = setTimeout(function(){\r\n\t\t\t\t\tajaxRequest(mev.area.href, \"GET\", null, function(t) {if (mev.timeout!=0) procesarCasilla(t,mev)}, dummy); }\r\n\t\t\t\t\t, 300);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t};\r\n\t\tmev.mouseOutEvent = function(){ clearTimeout(mev.timeout); mev.timeout = 0; get(\"tb_tooltip\").style.display = 'none'; };\r\n\t\tmev.scan = function(){\r\n\r\n\t\t\tvar mapdata = arrayRecursosCasilla[mev.area.href] ? arrayRecursosCasilla[mev.area.href] : mev.area.getAttribute(\"casilla\");\r\n\r\n\t\t\tif (mapdata) {\r\n\t\t\t\ttimeout = setTimeout(function(){\r\n\t\t\t\t\tvar div = get(\"tb_tooltip\");\r\n\t\t\t\t\tdiv.style.display = 'block';\r\n\t\t\t\t\tdiv.innerHTML = mapdata;\r\n\t\t\t\t}, 100);\r\n\t\t\t} else {\r\n//\t\t\t\tajaxRequest(mev.area.href, \"GET\", null, function(t) {parseFieldType(t,mev)}, dummy);\r\n\t\t\t\tajaxRequest(mev.area.href, \"GET\", null, function(t) {procesarCasilla2(t,mev.area)}, dummy);\r\n\t\t\t}\r\n\t\t};\r\n\t\treturn mev;\r\n\t}\r\n\r\n\t/**\r\n\t* Ordena en orden ascendete y descendente\r\n\t*\r\n\t* Params:\r\n\t* \tsTableID: \tID de la tabla a ordenar\r\n\t* \tiCol: \t\tIndice de la columna a ordenar\r\n\t* \tsDataType:\tTipo de datos de la columna, valor por defecto:texto\r\n\t*/\r\n\tfunction sortTable(sTableID, iCol, sDataType) {\r\n\t\treturn function(){\r\n\t\t\tvar oTable = document.getElementById(sTableID);\r\n\t\t\tvar oTBody = oTable.tBodies[0];\r\n\t\t\tvar colDataRows = oTBody.rows;\r\n\t\t\tvar aTRs = new Array;\r\n\r\n\t\t\tfor (var i = 0; i < colDataRows.length; i++) aTRs[i] = colDataRows[i];\r\n\t\t\tif (oTable.getAttribute(\"sortCol\") == iCol) aTRs.reverse();\r\n\t\t\telse aTRs.sort(generateCompareTRs(iCol, sDataType));\r\n\r\n\t\t\tvar oFragment = document.createDocumentFragment();\r\n\t\t\tfor (var i = 0; i < aTRs.length; i++) oFragment.appendChild(aTRs[i]);\r\n\r\n\t\t\toTBody.appendChild(oFragment);\r\n\t\t\toTable.setAttribute(\"sortCol\", iCol);\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Convierte un elemento a un determinado tipo segun un argumento\r\n\t *\r\n\t * Params:\r\n\t *\telemento: elemento a convertir\r\n\t *\tsDataType: nuevo tipo de datos (int o float)\r\n\t *\r\n\t * Returns:\r\n\t *\tEl elemento convertido al nuevo tipo de datos\r\n\t */\r\n\tfunction convert(element, sDataType) {\r\n\t\tswitch(sDataType) {\r\n\t\t\tcase \"int\": return ((element.nodeValue == null) || !element.nodeValue.match(/\\d+/)) ? 0 : parseInt(element.nodeValue);\r\n\t\t\tcase \"float\": return ((element.nodeValue == null) || !element.nodeValue.match(/\\d+/)) ? 0 : parseFloat(element.nodeValue);\r\n\t\t\tdefault: return (element == null) ? '' : element.textContent.toLowerCase();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza una comparaci�n entre las casillas de la misma columna en distintas filas\r\n\t *\r\n\t * Params:\r\n\t *\tiCol: numero de columna dentro de la fila a comparar\r\n\t *\tsDataType: tipo de datos de la comparacion\r\n\t *\r\n\t * Returns:\r\n\t * \tDevuelve -1, 1 o 0 segun el resultado de la comparacion\r\n\t */\r\n\tfunction generateCompareTRs(iCol, sDataType) {\r\n\t\treturn function compareTRs(oTR1, oTR2) {\r\n\t\t\tvar vValue1 = convert(oTR1.cells[iCol].firstChild, sDataType);\r\n\t\t\tvar vValue2 = convert(oTR2.cells[iCol].firstChild, sDataType);\r\n\r\n\t\t\tif (vValue1 < vValue2) return -1;\r\n\t\t\telse if (vValue1 > vValue2) return 1;\r\n\t\t\telse return 0;\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Implementa y muestra un bloc de notas. Guarda las notas como cookies en el navegador local\r\n\t */\r\n\tfunction blocNotas(){\r\n\t\tvar a = find(\"//form[@name='msg']\", XPFirst);\r\n\r\n\t\t// Carga las notas previas si existen\r\n\t\tvar notas = readCookie(\"notas_\" + server);\r\n\t\tif (notas == null) notas = ''; else notas = unescape(notas);\r\n\r\n\t\t// Crea la estructura HTML del bloc\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\t\tvar td = document.createElement(\"TD\");\r\n\t\tvar p1 = document.createElement(\"P\");\r\n\t\tvar p2 = document.createElement(\"P\");\r\n\t\tvar textarea = elem(\"TEXTAREA\", notas);\r\n\t\tvar input = document.createElement(\"INPUT\");\r\n\r\n\t\ttabla.setAttribute(\"width\", \"430\");\r\n\t\ttd.setAttribute(\"align\", \"center\");\r\n\t\ttd.setAttribute(\"background\", img('msg/block_bg.gif', true));\r\n\t\ttextarea.setAttribute(\"cols\", \"30\");\r\n\t\ttextarea.setAttribute(\"rows\", \"16\");\r\n\t\ttextarea.setAttribute(\"style\", 'background-image: url(' + img('msg/underline.gif', true) + '); border : 0px; overflow:auto');\r\n\t\tinput.setAttribute(\"type\", \"image\");\r\n\t\tinput.setAttribute(\"border\", \"0\");\r\n\t\tinput.setAttribute(\"src\", img('b/s1.gif', true));\r\n\t\t// En el evento del boton de guardado actualiza el valor de la cookie (1 a�o de duracion por defecto)\r\n\t\tinput.addEventListener(\"click\", function(){ createCookie(\"notas_\" + server, escape(textarea.value), 365); alert(T('GUARDADO')); }, 0);\r\n\r\n\t\ttd.appendChild(elem(\"P\", \"&nbsp;\"));\r\n\r\n\t\tp1.appendChild(textarea);\r\n\t\ttd.appendChild(p1);\r\n\t\tp2.appendChild(input);\r\n\t\ttd.appendChild(p2);\r\n\t\ttr.appendChild(td);\r\n\t\ttabla.appendChild(tr);\r\n\t\ta.parentNode.appendChild(document.createElement(\"P\"));\r\n\t\ta.parentNode.appendChild(tabla);\r\n\t}\r\n\r\n\t/**\r\n\t* Crea una funcion que se encarga del evento al desplazarse en el mapa. Actualiza la direccion destino en\r\n\t* base al desplazamiento configurado\r\n\t*\r\n\t* Params:\r\n\t* \ti:\tOrdinal sobre la orientacion de la flecha\r\n\t*\r\n\t* Returns\r\n\t*\tLa funcion que gestiona el evento\r\n\t**/\r\n\r\n\tfunction createEventoMapa(e, i, href){\r\n\t\tvar funcion = function (){\r\n\r\n//\t\t\talert(href);\r\n\r\n\t\t\tif (href == 'javascript:void(0)' || href == 'javascript: void(0)') {\r\n\r\n//\t\t\t\tinfoRecursos();\r\n//\t\t\t\tdesplazarMapa();\r\n//\t\t\t\tpreCalculate3();\r\n\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tvar despl = [-801, 1, 801, -1];\r\n//\t\t\tvar d = document.getElementsByName(\"desp\")[0].value;\r\n//\t\t\tvar d = parseInt(document.getElementsByName(\"desp\")[0].value);\r\n\r\n\t\t\tvar d = readCookie(\"desp\");\r\n\r\n//\t\t\tif (d < 1) d = 1;\r\n\t\t\tif (d < 1 || d > 20 || d == 'NaN' || d == NaN || !d || d == null || d == 'null') d = 3;\r\n\t\t\t// Actualiza el valor de la cookie\r\n\t\t\tcreateCookie(\"desp\", d, 365);\r\n\t\t\tvar base = parseInt(e.href.split(\"=\")[1]);\r\n\t\t\tajaxRequest(\"ajax.php?action=map_content&z=\" + (base + (despl[i] * (d - 1))), \"GET\", null,\r\n\t\t\t\tfunction(t){\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif (t.responseText) get(\"map_content\").innerHTML = t.responseText;\r\n\t\t\t\t\t\tinfoRecursos();\r\n\t\t\t\t\t\tdesplazarMapa();\r\n\t\t\t\t\t\tremoveElement(get(\"tabla_mapa\"));\r\n\t\t\t\t\t\tpreCalculate3();\r\n\t\t\t\t\t} catch (E) {}\r\n\t\t\t\t}\r\n\t\t\t, dummy);\r\n\t\t};\r\n\t\treturn funcion;\r\n\t}\r\n\r\n\t/**\r\n\t * Crea una casilla para introducir el desplazamiento deseado en el mapa e inserta los\r\n\t * eventos en las flechas de direccion\r\n\t */\r\n\tfunction desplazarMapa(){\r\n\t\t// Crea y anyade la casilla del desplazamiento\r\n//\t\tvar b = find(\"//form[@method='post']\", XPFirst).parentNode;\r\n\r\n\t\t// bluelovers\r\n\t\tvar b = find(\"//form[@action='karte.php']\", XPFirst);\r\n\t\tif (b) {\r\n\t\t\tb = b.parentNode;\r\n\t\t} else {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// bluelovers\r\n\r\n//\t\tvar tr = document.createElement(\"TR\");\r\n//\t\t// Carga el ultimo valor utilizado si existe\r\n//\t\tvar d = readCookie(\"desp\");\r\n//\r\n//\t\t// bluelovers\r\n//\t\td = parseInt(d);\r\n//\t\tif (d < 1 || d > 20 || d == 'NaN' || d == NaN || !d) d = 5;\r\n//\t\t// bluelovers\r\n//\r\n//\t\tvar td1 = elem(\"TD\", \"<b>\" + T('DESP_ABR') + \"</b>\");\r\n//\t\tvar td2 = elem(\"TD\", '<input name=\"desp\" value=\"' + (d == null ? '1' : d) + '\" size=\"2\" maxlength=\"4\" class=\"fm fm25\">');\r\n//\t\ttd1.setAttribute(\"colspan\", 2);\r\n//\t\ttd2.setAttribute(\"colspan\", 2);\r\n//\t\ttr.appendChild(td1);\r\n//\t\ttr.appendChild(td2);\r\n//\t\tb.appendChild(tr);\r\n\r\n//\t\tif (location.href.match(/karte.php($|\\?z=)/) && arrayValueExist(tw_server, server)){\r\n//\t\t\tvar center_id = xy2id(find(\"//input[@name='xp']\", XPFirst).value, find(\"//input[@name='yp']\", XPFirst).value);\r\n//\t\t\tvar href = \"http://www.denibol.com/proyectos/travian_world/karte3.php?z=\" + center_id + \"&server=\" + server + \"&user=\" + uid;\r\n//\t\t\tvar td3 = elem(\"TD\", '<a href=\"' + href + '\" onClick=\"pop(\\'' + href + '\\'); return false;\" target=\"_blank\"><img src=\"' + img('m/max.gif') + '\" width=\"33\" height=\"25\" border=\"0\" alt=\"' + T('MAP_EXT') + '\" title=\"' + T('MAP_EXT') + '\"></a>');\r\n//\t\t\ttd3.setAttribute(\"colspan\", 2);\r\n//\t\t\ttr.appendChild(td3);\r\n//\t\t}\r\n\r\n\t\t// Inserta los eventos para manipular los desplazamientos\r\n\t\tvar a = find(\"//map/area[@onclick]\", XPList);\r\n\t\tfor (var i = 0; i < a.snapshotLength; i++){\r\n\t\t\tvar b = a.snapshotItem(i);\r\n\t\t\tb.setAttribute(\"onclick\", '');\r\n\t\t\tb.addEventListener(\"click\", createEventoMapa(b, i % 4, b.href), 0);\r\n//\t\t\tb.href = 'javascript:void(0)';\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Crea una nueva columna en las ofertas del mercado para mostrar la alianza de los\r\n\t * vendedores\r\n\t */\r\n\tfunction alianzaMercado(){\r\n\t\tvar a = find(\"//tr[@class='rbg']\", XPFirst).parentNode;\r\n\r\n\t\t// Prepara la insercion de la nueva columna\r\n\t\tvar b = a.getElementsByTagName(\"TR\");\r\n\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\tb[0].childNodes[b[0].childNodes.length == 3 ? 1 : 0].setAttribute('colspan', '8');\r\n\t\tb[b.length - 1].childNodes[0].setAttribute(\"colspan\", \"8\");\r\n\r\n\t\t// Crea e inserta la columna\r\n\t\tvar columna = document.createElement(\"TD\");\r\n\t\tcolumna.innerHTML = T('ALIANZA');\r\n\t\tb[1].appendChild(columna);\r\n\r\n\t\t// Rellena la columna con los nombres de las alianzas\r\n\r\n\t\tfor(var i = 2; i < b.length - 1; i++){\r\n\t\t\tvar alianza = document.createElement(\"TD\");\r\n\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\tvar alianza_txt = b[i].childNodes[b[i].childNodes.length == 12 ? 8 : 4].getAttribute('title');\r\n\t\t\tif (alianza_txt != null) alianza.innerHTML = alianza_txt;\r\n\t\t\tb[i].appendChild(alianza);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Crea una funcion que procesa el evento al seleccionar una cantidad de un recurso al enviar materias primas\r\n\t * desde el mercado\r\n\t *\r\n\t * Params:\r\n\t *\trecurso:\tOrdinal del recurso\r\n\t *\tcantidad:\tCantidad a incrementar del determinado recurso\r\n\t *\r\n\t * Returns:\r\n\t *\tLa funcion que gestiona el evento\r\n\t */\r\n\tfunction crearEventoRecursosMercado(recurso, cantidad){\r\n\t\treturn function(){\r\n//\t\t\tvar a = document.getElementsByTagName('input')[recurso + 1].value;\r\n\t\t\tvar a = get('r' + (recurso + 1)).value;\r\n\t\t\tif (a == '') var suma = 0; else var suma = parseInt(a);\r\n\t\t\tsuma += cantidad;\r\n\t\t\t// La cantidad a enviar no puede superar lo disponible\r\n\t\t\tif (suma > actual[recurso]) suma = actual[recurso];\r\n\t\t\t// La cantidad a enviar no debe poder superar la capacidad de los comerciantes disponibles\r\n\t\t\tvar max_capacidad = parseInt(find(\"//p//b\", XPFirst).innerHTML);\r\n\t\t\tvar max_comercian = parseInt(find(\"//table[@class='f10']//tr//td[@colspan='2']\", XPFirst).innerHTML.split(' ')[1].split('/')[0]);\r\n\t\t\tvar max_transport = max_capacidad * max_comercian;\r\n\t\t\tif (suma > max_transport) suma = max_transport;\r\n\r\n//\t\t\tdocument.getElementsByTagName('input')[recurso + 1].value = suma;\r\n\t\t\tget('r' + (recurso + 1)).value = suma;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Inserta nuevas cantidades seleccionables al enviar recursos desde el mercado\r\n\t 商人\r\n\t */\r\n\tfunction recursosMercado(){\r\n\t\tif (find(\"//input[@type='text']\", XPList).snapshotLength != 7) return;\r\n\r\n\t\t// Array con las nuevas cantidades\r\n\t\tvar max_capacidad = parseInt(find(\"//p//b\", XPFirst).innerHTML);\r\n\t\t/*\r\n\t\tvar cantidades = [100, 250, 500, 1000];\r\n\t\tvar repetido = false;\r\n\t\tfor (var i = 0; i < cantidades.length; i++) if (max_capacidad == cantidades[i]){ repetido = true; break; }\r\n\t\tif (!repetido) cantidades = [100, 500, 1000, max_capacidad];\r\n\t\t*/\r\n\t\tif(max_capacidad ==null){max_capacidad=500;}\r\n\r\n\t\tvar cpcty = readCookie('cpcty', 0);\r\n\t\tmax_capacidad = cpcty <= 0 ? max_capacidad : cpcty;\r\n\r\n\t\tvar cantidades =[max_capacidad,max_capacidad*2,max_capacidad*3,max_capacidad*4]\r\n\r\n\t\tvar a = find(\"//table[@class='f10']\", XPFirst);\r\n\t\tvar k = 0;\r\n\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\ta = a.childNodes[a.childNodes.length == 2 ? 1 : 0].childNodes;\r\n\t\tfor (var i = 0; i < a.length; a.length == 8 ? i += 2 : i++){\r\n\t\t\t// Se eliminan las posibilidades originales\r\n\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\ta[i].removeChild(a[i].childNodes[a[i].childNodes.length > 4 ? 5 : 3]);\r\n\r\n\t\t\t// Por cada nueva cantidad y recurso se crea un enlace con el evento asociado\r\n\t\t\tfor(var j = 0; j < cantidades.length; j++){\r\n\t\t\t\tvar enlace = document.createElement('A');\r\n\t\t\t\tenlace.href = \"javascript:void(0)\";\r\n\t\t\t\tenlace.innerHTML = '(' + cantidades[j] + ')';\r\n\t\t\t\tenlace.addEventListener('click', crearEventoRecursosMercado(k, cantidades[j]), false);\r\n\r\n\t\t\t\ta[i].appendChild(enlace);\r\n\t\t\t}\r\n\t\t\tk++;\r\n\t\t}\r\n\r\n\t\t//add code by Arrack\r\n\t\t//var a = document.createElement('DIV');\r\n\t\t//商人全部增加\r\n\t\tvar a = find(\"//p[@class='txt_menue']\", XPFirst);\r\n\t\tvar b = document.createElement('DIV');\r\n\t\tb.setAttribute(\"style\",\"padding-top::5px;background-color: #FFFFCC;\");\r\n\t\t//a.setAttribute(\"style\",\"position:relative; top:999px;\");\r\n\t\t//setAttribute(\"style\",\"position:relative; bottom:52px;\");\r\n\t\tb.innerHTML=T('ADD_ALL')+':';\r\n\t\tfor(var j = 0; j < cantidades.length; j++){\r\n\t\t\tvar enlace = document.createElement('A');\r\n\t\t\tenlace.href = \"javascript:void(0)\";\r\n\t\t\tenlace.innerHTML = '(' + cantidades[j] + ')';\r\n\t\t\tenlace.addEventListener('click', crearEventoRecursosMercado_ALL(cantidades[j]), false);\r\n\r\n\t\t\tb.appendChild(enlace);\r\n\t\t}\r\n\r\n\t\tvar enlace = document.createElement('A');\r\n\t\tenlace.href = \"javascript:void(0)\";\r\n\t\tenlace.innerHTML = '(CLEAR)';\r\n\t\tenlace.addEventListener('click', crearEventoRecursosMercado_ALL(0), false);\r\n\r\n\t\tb.appendChild(enlace);\r\n\t\ta.appendChild(b);\r\n\r\n\t\tvar form = document.getElementsByName('id')[0].parentNode;\r\n\r\n\t\tvar inputCpcty = document.createElement('input');\r\n\t\t\tinputCpcty.value = cpcty;\r\n\t\t\tinputCpcty.className = 'fm';\r\n\t\t\tinputCpcty.size = 4;\r\n\t\t\tinputCpcty.addEventListener('change', function(){\r\n\t\t\t\tcreateCookie('cpcty', this.value);\r\n\t\t\t\tcpcty = this.value;\r\n\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t}, false);\r\n\r\n\t\t\tvar setCpctyBar = document.createElement('span');\r\n\t\t\tsetCpctyBar.appendChild(document.createTextNode(T('CPCTY1')));\r\n\t\t\tsetCpctyBar.appendChild(inputCpcty);\r\n\t\t\tform.parentNode.insertBefore(setCpctyBar, form);\r\n\t}\r\n\t//function crearEventoRecursosMercado(recurso, cantidad){\r\n\tfunction crearEventoRecursosMercado_ALL(cantidad){\r\n\t\treturn function(){\r\n\t\t\tvar recurso=0;\r\n\r\n\t\t\tvar max_capacidad = parseInt(find(\"//p//b\", XPFirst).innerHTML);\r\n\t\t\tvar max_comercian = parseInt(find(\"//table[@class='f10']//tr//td[@colspan='2']\", XPFirst).innerHTML.split(' ')[1].split('/')[0]);\r\n\t\t\tvar max_transport = max_capacidad * max_comercian;\r\n\r\n\t\t\tfor(var j = 0; j < 4; j++){\r\n\t\t\t\trecurso=j;\r\n\r\n//\t\t\t\tvar a = document.getElementsByTagName('input')[recurso + 1].value;\r\n\t\t\t\tvar a = get('r' + (recurso + 1)).value;\r\n\r\n\t\t\t\tif (a == '') var suma = 0; else var suma = parseInt(a);\r\n\t\t\t\tif(cantidad!=0){\r\n\t\t\t\t\tsuma += cantidad;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tsuma=0;\r\n\t\t\t\t}\r\n\t\t\t\t// La cantidad a enviar no puede superar lo disponible\r\n\t\t\t\tif (suma > actual[recurso]) suma = actual[recurso];\r\n\t\t\t\t// La cantidad a enviar no debe poder superar la capacidad de los comerciantes disponibles\r\n\r\n\t\t\t\tif (suma > max_transport) suma = max_transport;\r\n\r\n//\t\t\t\tdocument.getElementsByTagName('input')[recurso + 1].value = suma;\r\n\t\t\t\tget('r' + (recurso + 1)).value = suma;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/*\r\n\t * Check if this is a 3X speed server\r\n\t * TeYoU: 检查是否为SPEED伺服器\r\n\t */\r\n\t function check3X(){\r\n\t\tvar url = location.href;\r\n\t\tif(url.match(\"speed\"))\r\n\t\t\treturn true;\r\n\t\treturn false;\r\n\t }\r\n\r\n\t/**\r\n\t * Calcula el numero de aldeas que se posee en funcion de los puntos de cultura disponibles.\r\n\t * Funcion estandard no valida para version Speed\r\n\t *\r\n\t * Params:\r\n\t *\tpuntos: cantidad de puntos de cultura\r\n\t *\r\n\t * Returns:\r\n\t * \tel numero de aldeas que se dispone con esos puntos\r\n\t */\r\n\t //TeYoU: 计算文明点的 (Point)\r\n\tfunction pc2aldeas(puntos){ return Math.round(Math.pow((puntos / 1000) / 1.6, 1 / 2.3)); }\r\n\tfunction pc2aldeas3X(puntos){ return Math.round(Math.pow((puntos / 100) / 16 * 3, 1 / 2.3)); }\r\n\r\n\t/**\r\n\t * Calcula el numero de puntos necesarios para obtener un determinada cantidad de aldeas\r\n\t * Funcion estandard no valida para version Speed\r\n\t *\r\n\t * Params:\r\n\t *\taldeas: numero de aldeas\r\n\t *\r\n\t * Returns:\r\n\t * \tcantidad de puntos de cultura necesarios\r\n\t */\r\n\t //TeYoU: 计算文明点的 (Village)\r\n\tfunction aldeas2pc(aldeas){ return Math.round(1.6 * Math.pow(aldeas, 2.3)) * 1000; }\r\n\tfunction aldeas2pc3X(aldeas){ return Math.round(16 / 3 * Math.pow(aldeas, 2.3)) * 100; }\r\n\r\n\t/**\r\n\t * puntosCultura = CulturePoints\r\n\t * Calcula y muestra los puntos de cultura necesarios para la siguiente aldea y el tiempo para conseguirlo, o\r\n\t * las aldeas adicionales que se pueden fundar con los puntos actuales\r\n\t */\r\n\tfunction puntosCultura(){\r\n\t\tvar a = find(\"//div[@id='lmid2']//b\", XPList);\r\n\t\tif (a.snapshotLength != 5) return;\r\n\r\n\t\t// Produccion de puntos de cultura de todas las aldeas\r\n\t\tvar pc_prod_total = parseInt(a.snapshotItem(2).innerHTML);\r\n\t\t// Cantidad de puntos de cultura actuales\r\n\t\tvar pc_actual = parseInt(a.snapshotItem(3).innerHTML);\r\n\t\t// Puntos de cultura necesarios para fundar la siguiente aldea\r\n\t\tvar pc_aldea_prox = parseInt(a.snapshotItem(4).innerHTML);\r\n\r\n\t\t// 下一个的村庄数\r\n\t\tvar aldeas_actuales = (check3X() )? pc2aldeas3X(pc_aldea_prox) : pc2aldeas(pc_aldea_prox) ;\r\n\t\t// 目前村庄数\r\n\t\tvar aldeas_posibles = (check3X() )? pc2aldeas3X(pc_actual) : pc2aldeas(pc_actual) ;\r\n\r\n\t\tvar texto = '<table class=\"tbg\" align=\"center\" cellspacing=\"1\" cellpadding=\"2\"><tr class=\"rbg\"><td>' + T('ALDEA') + '</td><td>' + T('PC') + \"</td></tr>\";\r\n\t\tvar j = pc_f = 0;\r\n\t\tfor (var i = 0; i < 3; i++){\r\n\t\t\tvar idx = i + j;\r\n\r\n\t\t\ttexto += '<tr><td>' + (aldeas_actuales + idx + 1) + '</td><td>';\r\n\r\n\t\t\t// 下一级需要的文明\r\n\t\t\tvar pc_necesarios = (check3X() )? aldeas2pc3X(aldeas_actuales + idx) : aldeas2pc(aldeas_actuales + idx) ;\r\n\r\n\t\t\t// Si hay PC de sobra\r\n\t\t\tif (pc_necesarios < pc_actual) {\r\n\t\t\t\ttexto += T('FUNDAR');\r\n\t\t\t\tpc_f = 1;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t// Tiempo en segundos hasta conseguir los puntos de cultura necesarios\r\n\t\t\t\tvar tiempo = ((pc_necesarios - pc_actual) / pc_prod_total) * 86400;\r\n\r\n\t\t\t\tvar fecha = new Date();\r\n\t\t\t\tfecha.setTime(fecha.getTime() + (tiempo * 1000));\r\n\t\t\t\tvar texto_tiempo = calcularTextoTiempo(fecha);\r\n\r\n\t\t\t\ttexto += T('FALTA') + ' <b>' + (pc_necesarios - pc_actual) + '</b> ' + T('PC') +'<br/>';\r\n\t\t\t\ttexto += T('LISTO') + \" \" + texto_tiempo;\r\n\t\t\t}\r\n\t\t\ttexto += '</td></tr>';\r\n\r\n\t\t\tif (pc_f && pc_necesarios >= pc_actual) {\r\n\t\t\t\tj = idx + 1;\r\n\t\t\t\tpc_f = i = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\ttexto += '</table>';\r\n\r\n\t\ta.snapshotItem(4).parentNode.innerHTML += \"<p>\" + texto + \"</p>\";\r\n\t}\r\n\r\n\t/**\r\n\r\n\r\n\t * Oculta un elemento y le asgina un atributo de tipo filtro\r\n\t *\r\n\t * Params:\r\n\t *\toferta: elemento a modificar\r\n\t *\tfiltro: nombre del filtro que se le aplicara como atributo\r\n\t */\r\n\tfunction asignarFiltro(oferta, filtro){\r\n\t\toferta.setAttribute(\"style\", \"display:none\");\r\n\t\toferta.setAttribute(\"filtro\" + filtro, \"on\");\r\n\t}\r\n\r\n\t/**\r\n\t * Elimina un atributo de tipo filtro de un elemento y elimina su estilo si no tiene ningun filtro activo\r\n\t *\r\n\t * Params:\r\n\t *\toferta: elemento a modificar\r\n\t *\tfiltro: nombre del filtro a quitar\r\n\t *\tfiltros: lista de filtros a comprobar para quitar el estilo\r\n\t */\r\n\tfunction quitarFiltro(oferta, filtro, filtros){\r\n\t\toferta.removeAttribute(\"filtro\" + filtro);\r\n\t\tvar remove = true;\r\n\t\tfor (var i = 0; i < filtros.length; i++) if (oferta.getAttribute(\"filtro\" + filtros[i]) == 'on') remove = false;\r\n\t\tif (remove == true) oferta.removeAttribute(\"style\");\r\n\t}\r\n\r\n\t/**\r\n\t * Crea la funcion que gestiona el evento de los filtros en el mercado\r\n\t *\r\n\t * Param:\r\n\t *\ttipo\tTipo de filtro (0 para ofrezco, 1 para busco y 2 para tipo)\r\n\t *\trecurso\tRecurso del filtro (0-4 recursos basicos, 5 para cualquiera)\r\n\t *\r\n\t * Returns:\r\n\t *\tLa funcion que gestiona el evento\r\n\t */\r\n\tfunction funcionFiltrosMercado(tipo, recurso){\r\n\t\tvar funcion = function (){\r\n\t\t\tvar a = find(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]//tr[not(@class)]\", XPList);\r\n\t\t\tfor (var i = 0; i < a.snapshotLength - 1; i++){\r\n\t\t\t\tvar b = a.snapshotItem(i);\r\n\t\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\t\tif (b.childNodes.length > 8) var error = true; else var error = false;\r\n\t\t\t\tb.childNodes[error ? 1 : 0].firstChild.src.search(/\\/(\\d).gif$/); var ofrezco = RegExp.$1;\r\n\t\t\t\tb.childNodes[error ? 4 : 2].firstChild.src.search(/\\/(\\d).gif$/); var busco = RegExp.$1;\r\n\t\t\t\tvar ofrezco_cantidad = parseInt(b.childNodes[error ? 2 : 1].innerHTML);\r\n\t\t\t\tvar busco_cantidad = parseInt(b.childNodes[error ? 6 : 3].innerHTML);\r\n\t\t\t\tif (b.childNodes[error ? 11 : 6].className == 'c') var carencia = true; else var carencia = false;\r\n\t\t\t\tvar tiempo = calcular_segundos(b.childNodes[error ? 10 : 5].innerHTML);\r\n\r\n\t\t\t\t// Para mantener 4 filtros activos a la vez sobre cada oferta, utiliza 3 atributos distintos\r\n\t\t\t\t// sobre cada fila\r\n\t\t\t\tswitch(tipo){\r\n\t\t\t\t\tcase 0: if ((ofrezco != recurso) && recurso != 5) asignarFiltro(b, \"Ofrezco\");\r\n\t\t\t\t\t\telse quitarFiltro(b, \"Ofrezco\", [\"Busco\", \"Tipo\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 1: if ((busco != recurso) && recurso != 5) asignarFiltro(b, \"Busco\");\r\n\t\t\t\t\t\telse quitarFiltro(b, \"Busco\", [\"Ofrezco\", \"Tipo\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (ofrezco_cantidad != busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: if (ofrezco_cantidad <= busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 3: if (ofrezco_cantidad >= busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 4: quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\tcase 3: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (carencia == true) asignarFiltro(b, \"Carencia\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Carencia\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: quitarFiltro(b, \"Carencia\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\tcase 4: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (tiempo > (60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: if (tiempo > (2*60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 3: if (tiempo > (3*60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 4: quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Para mantener un unico sombreado por cada filtro, activa el que se ha seleccionado y elimina\r\n\t\t\t// el resto de su tipo\r\n\t\t\tfor (var i = 0; i < 5; i++){\r\n\t\t\t\tfor (var j = 0; j < 6; j++){\r\n\t\t\t\t\tvar a = find(\"//td[@id='filtro\" + i + j + \"']\", XPFirst);\r\n\t\t\t\t\tif (a){\r\n\t\t\t\t\t\tif (i == tipo && j == (recurso - 1)){\r\n\t\t\t\t\t\t\ta.setAttribute(\"style\", \"background-color:#F5F5F5\");\r\n\t\t\t\t\t\t}else if (i == tipo){\r\n\t\t\t\t\t\t\ta.removeAttribute(\"style\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\treturn funcion;\r\n\t}\r\n\r\n\t/**\r\n\t * Establece filtros por tipo de recurso y proporcion de intercambio en las oferta de venta del\r\n\t * mercado\r\n\t */\r\n//\tfunction filtrosMercado(){\r\n//\t\tvar table = document.createElement(\"TABLE\");\r\n//\t\ttable.setAttribute(\"class\", \"tbg\");\r\n//\t\ttable.setAttribute(\"style\", \"width:100%\");\r\n//\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n//\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n//\r\n//\t\t// Se crea la tabla con 3 filas, Ofrezco, Busco y Tipo\r\n//\t\tvar etiquetas = [T('OFREZCO'), T('BUSCO')];\r\n//\t\tfor (var j = 0; j < 2; j++){\r\n//\t\t\tvar tr = document.createElement(\"TR\");\r\n//\t\t\ttr.appendChild(elem(\"TD\", etiquetas[j]));\r\n//\t\t\t// Para Ofrezco y Busco se muestran 4 materiales y un quinto comodin\r\n//\t\t\tfor (var i = 0; i < 4; i++){\r\n//\t\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\t\ttd.setAttribute(\"id\", \"filtro\" + j + i);\r\n//\t\t\t\tvar ref = elem(\"A\", \"<img src='\" + img('r/' + (i+1) + '.gif') + \"' width='18' height='12' border='0' title='\" + T('RECURSO' + (i+1)) + \"'>\");\r\n//\t\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(j, i+1), 0);\r\n//\t\t\t\ttd.appendChild(ref);\r\n//\t\t\t\ttr.appendChild(td);\r\n//\t\t\t}\r\n//\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\ttd.setAttribute(\"style\", \"background-color:#F5F5F5\");\r\n//\t\t\ttd.setAttribute(\"id\", \"filtro\" + j + \"4\");\r\n//\t\t\tvar ref = elem(\"A\", T('CUALQUIERA'));\r\n//\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n//\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(j, 5), 0);\r\n//\t\t\ttd.appendChild(ref);\r\n//\t\t\ttr.appendChild(td);\r\n//\t\t\ttable.appendChild(tr);\r\n//\t\t}\r\n//\r\n//\t\t// Tipo de transaccion segun la relacion entre oferta y demanda\r\n//\t\tvar tr = document.createElement(\"TR\");\r\n//\t\ttr.appendChild(elem(\"TD\", T('TIPO')));\r\n//\t\ttable.appendChild(tr);\r\n//\t\tvar etiquetas_tipo = [\"1:1\", \"1:>1\", \"1:<1\", \"1:x\"];\r\n//\t\tfor (var i = 0; i < 4; i++){\r\n//\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\ttd.setAttribute(\"id\", \"filtro\" + 2 + i);\r\n//\t\t\tif (i == 3) td.setAttribute(\"style\", \"background-color:#F5F5F5\");\r\n//\t\t\tvar ref = elem(\"A\", etiquetas_tipo[i]);\r\n//\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n//\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(2, (i+1)), 0);\r\n//\t\t\ttd.appendChild(ref);\r\n//\t\t\ttr.appendChild(td);\r\n//\t\t}\r\n//\t\ttr.appendChild(document.createElement(\"TD\"));\r\n//\r\n//\t\t// Tiempo maximo de transporte\r\n//\t\tvar tr = document.createElement(\"TR\");\r\n//\t\ttr.appendChild(elem(\"TD\", T('MAXTIME')));\r\n//\t\ttable.appendChild(tr);\r\n//\t\tvar etiquetas_tipo = [\"1\", \"2\", \"3\", \">3\"];\r\n//\t\tfor (var i = 0; i < 4; i++){\r\n//\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\ttd.setAttribute(\"id\", \"filtro\" + 4 + i);\r\n//\t\t\tif (i == 3) td.setAttribute(\"style\", \"background-color:#F5F5F5\");\r\n//\t\t\tvar ref = elem(\"A\", etiquetas_tipo[i]);\r\n//\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n//\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(4, (i+1)), 0);\r\n//\t\t\ttd.appendChild(ref);\r\n//\t\t\ttr.appendChild(td);\r\n//\t\t}\r\n//\t\ttr.appendChild(document.createElement(\"TD\"));\r\n//\r\n//\t\t// Filtro por disponibilidad de recursos y mercaderes\r\n//\t\tvar tr = document.createElement(\"TR\");\r\n//\t\ttr.appendChild(elem(\"TD\", T('DISPONIBLE')));\r\n//\t\ttable.appendChild(tr);\r\n//\t\tvar etiquetas_carencia = [T('SI'), T('NO')];\r\n//\t\tfor (var i = 0; i < 2; i++){\r\n//\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\ttd.setAttribute(\"colspan\", \"2\");\r\n//\t\t\ttd.setAttribute(\"id\", \"filtro\" + 3 + i);\r\n//\t\t\tif (i == 1) td.setAttribute(\"style\", \"background-color:#F5F5F5\");\r\n//\t\t\tvar ref = elem(\"A\", etiquetas_carencia[i]);\r\n//\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n//\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(3, (i+1)), 0);\r\n//\t\t\ttd.appendChild(ref);\r\n//\t\t\ttr.appendChild(td);\r\n//\t\t}\r\n//\t\ttr.appendChild(document.createElement(\"TD\"));\r\n//\r\n//\t\t// Busca la tabla de ofertas y la inserta justo antes\r\n//\t\tvar a = find(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]\", XPFirst);\r\n//\t\tvar p = document.createElement(\"P\");\r\n//\t\tp.appendChild(table);\r\n//\t\ta.parentNode.insertBefore(p, a);\r\n//\t}\r\n\r\nfunction filtrosMercado(){\r\n\r\n\t/**\r\n\t * Crea la funcion que gestiona el evento de los filtros en el mercado\r\n\t *\r\n\t * Param:\r\n\t *\ttipo\tTipo de filtro (0 para ofrezco, 1 para busco y 2 para tipo)\r\n\t *\trecurso\tRecurso del filtro (0-4 recursos basicos, 5 para cualquiera)\r\n\t *\r\n\t * Returns:\r\n\t *\tLa funcion que gestiona el evento\r\n\t */\r\n\tfunction funcionFiltrosMercado(tipo, recurso){\r\n\t\treturn function () {\r\n\t\t\tsetOption(\"market\"+tipo,recurso);\r\n\t\t\tfilterMarket(tipo,recurso);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction filterMarket(tipo, recurso){\r\n\t\t\tvar a = find(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]//tr[not(@class)]\", XPList,get(\"lmid2\"));\r\n\t\t\tfor (var i = 0; i < a.snapshotLength - 1; i++){\r\n\t\t\t\tvar b = a.snapshotItem(i);\r\n\t\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\t\tif (b.childNodes.length > 8) var error = true; else var error = false;\r\n\t\t\t\tb.childNodes[error ? 1 : 0].firstChild.src.search(/\\/(\\d).gif$/); var ofrezco = RegExp.$1;\r\n\t\t\t\tb.childNodes[error ? 4 : 2].firstChild.src.search(/\\/(\\d).gif$/); var busco = RegExp.$1;\r\n\t\t\t\tvar ofrezco_cantidad = parseInt(b.childNodes[error ? 2 : 1].innerHTML);\r\n\t\t\t\tvar busco_cantidad = parseInt(b.childNodes[error ? 6 : 3].innerHTML);\r\n\t\t\t\tif (b.childNodes[error ? 11 : 6].className == 'c') var carencia = true; else var carencia = false;\r\n\t\t\t\tvar tiempo = calcular_segundos(b.childNodes[error ? 10 : 5].innerHTML);\r\n\r\n\t\t\t\t// Para mantener 4 filtros activos a la vez sobre cada oferta, utiliza 3 atributos distintos\r\n\t\t\t\t// sobre cada fila\r\n\t\t\t\tswitch(tipo){\r\n\t\t\t\t\tcase 0: if ((ofrezco != recurso) && recurso != 5) asignarFiltro(b, \"Ofrezco\");\r\n\t\t\t\t\t\telse quitarFiltro(b, \"Ofrezco\", [\"Busco\", \"Tipo\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 1: if ((busco != recurso) && recurso != 5) asignarFiltro(b, \"Busco\");\r\n\t\t\t\t\t\telse quitarFiltro(b, \"Busco\", [\"Ofrezco\", \"Tipo\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (ofrezco_cantidad <= busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: if (ofrezco_cantidad < busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 3: if (ofrezco_cantidad >= busco_cantidad) asignarFiltro(b, \"Tipo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 4: quitarFiltro(b, \"Tipo\", [\"Ofrezco\", \"Busco\", \"Carencia\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\tcase 3: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (carencia == true) asignarFiltro(b, \"Carencia\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Carencia\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: quitarFiltro(b, \"Carencia\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Tiempo\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t\tcase 4: switch(recurso){\r\n\t\t\t\t\t\t\tcase 1: if (tiempo > (60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 2: if (tiempo > (2*60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 3: if (tiempo > (3*60*60)) asignarFiltro(b, \"Tiempo\");\r\n\t\t\t\t\t\t\t\telse quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 4: quitarFiltro(b, \"Tiempo\", [\"Ofrezco\", \"Busco\", \"Tipo\", \"Carencia\"]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} break;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Para mantener un unico sombreado por cada filtro, activa el que se ha seleccionado y elimina\r\n\t\t\t// el resto de su tipo\r\n\t\t\tfor (var i = 0; i < 5; i++){\r\n\t\t\t\tfor (var j = 0; j < 6; j++){\r\n\t\t\t\t\tvar a = find(\"//td[@id='filtro\" + i + j + \"']\", XPFirst);\r\n\t\t\t\t\tif (a){\r\n\t\t\t\t\t\tif (i == tipo && j == (recurso - 1)){\r\n\t\t\t\t\t\t\ta.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\t\t\t\t}else if (i == tipo){\r\n\t\t\t\t\t\t\ta.removeAttribute(\"style\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t}\r\n\r\n\tfunction applyMarketFilters() {\r\n\t\tvar defaults=[5,5,4,2,4];\r\n\t\tfor (var i = 0; i < 5; i++){\r\n\t\t\tvar marketi = getOption(\"market\"+i,defaults[i],\"integer\");\r\n\t\t\tif (marketi!=defaults[i]) filterMarket(i,marketi);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction createPreloadFunc(page) {\r\n\t\treturn function() {\r\n\t\t\t\tvar pageu = page * 40;\r\n\r\n\t\t\t\tajaxRequest(\"build.php?id=\"+linkid+\"&t=1&u=\"+(page*40)+\"#h2\", \"GET\", null,\r\n\t\t\t\tfunction(t){\r\n\t\t\t\t var ans = elem(\"DIV\", t.responseText);\r\n\t\t\t\t var ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\t\t\t ansdoc.appendChild(ans);\r\n\t\t\t\t var xpres = ansdoc.evaluate(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]/tbody/tr\", ans, null, XPList, null);\r\n//\t\t\t\t log(2,\"preload return.\"+xpres.snapshotLength);\r\n\r\n\t\t\t\t var linktrl = find(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]/tbody/tr\", XPList,get(\"lmid2\"));\r\n\t\t\t\t var linktrlind=3;\r\n\t\t\t\t var linktr = linktrl.snapshotItem(linktrlind);\r\n\t\t\t\t var linktimedata = calcular_segundos(linktr.childNodes[linktr.childNodes.length >= 12 ? 10 : 6].innerHTML);\r\n\r\n\t\t\t\t for(var i=2;i<xpres.snapshotLength-1; i++) {\r\n\t\t\t\t\tvar mrow = xpres.snapshotItem(i);\r\n\t\t\t\t\tvar timedata = calcular_segundos(mrow.childNodes[mrow.childNodes.length == 12 ? 10 : 6].innerHTML);\r\n\t\t\t\t\tvar alianza = document.createElement(\"TD\");\r\n\t\t\t\t\tvar playercell = mrow.childNodes[mrow.childNodes.length == 12 ? 8 : 4];\r\n\t\t\t\t\tvar alianza_txt = playercell.getAttribute('title');\r\n\t\t\t\t\tif (alianza_txt != null) alianza.innerHTML = alianza_txt;\r\n\t\t\t\t\tmrow.appendChild(alianza);\r\n\r\n//\t\t\t\t\tvar a = playercell.innerHTML.match(/karte.php\\?d=(\\d+)/)[0];\r\n//\r\n//\t\t\t\t var atklink = elem('a',\"<img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' title='\" + T('ATACAR') + \"' alt='' border='0'>\");\r\n//\t\t\t\t atklink.href = 'a2b.php?z=' + a;\r\n//\t\t\t\t playercell.insertBefore(atklink, playercell.firstChild.nextSibling);\r\n\r\n//\t\t\t\t\tlog(2,\"mrow \"+i+\" time is: \"+ timedata); // timedata is in seconds\r\n\t\t\t\t\twhile(linktimedata<timedata&&linktrlind<linktrl.snapshotLength-1) {\r\n\t\t\t\t\t\tlinktrlind++\r\n\t\t\t\t\t\tlinktr = linktrl.snapshotItem(linktrlind);\r\n\t\t\t\t\t\tif (linktr.innerHTML.indexOf('class=\"rowpic\"')<0) {\r\n\t\t\t\t\t\t linktimedata = calcular_segundos(linktr.childNodes[linktr.childNodes.length >= 12 ? 10 : 6].innerHTML);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t linktimedata=999999;\r\n\t\t\t\t\t\t}\r\n//\t\t\t\t\t log(2,\"mrow \"+i+\":\"+linktrlind+\" comptime is: \"+ linktimedata+\" lgt:\"+linktrl.snapshotLength); // timedata is in seconds\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlinktr.parentNode.insertBefore(mrow,linktr);\r\n\t\t\t\t }\r\n\t\t\t\t applyMarketFilters();\r\n\r\n\t\t\t\t\tvar marketpreload = getOption(\"marketpreload\",0,\"integer\");\r\n\t\t\t\t if (page<marketpreload) {\r\n\t\t\t\t\t setTimeout(createPreloadFunc(page+1),getRandTimeRange(600));\r\n\t\t\t\t } else {\r\n\t\t\t\t\tplayerLinks();\r\n\t\t\t\t }\r\n\t\t\t\t}\r\n\t\t\t, dummy);\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t\tvar table = document.createElement(\"TABLE\");\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"style\", \"width:100%\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\t// Se crea la tabla con 3 filas, Ofrezco, Busco y Tipo\r\n\t\tvar etiquetas = [T('OFREZCO'), T('BUSCO')];\r\n\t\tfor (var j = 0; j < 2; j++){\r\n\t\t\tvar marketj = getOption(\"market\"+j,5,\"integer\");\r\n\t\t\tvar tr = document.createElement(\"TR\");\r\n\t\t\ttr.appendChild(elem(\"TD\", etiquetas[j]));\r\n\t\t\t// Para Ofrezco y Busco se muestran 4 materiales y un quinto comodin\r\n\t\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\ttd.setAttribute(\"id\", \"filtro\" + j + i);\r\n\t\t\t\tvar ref = elem(\"A\", \"<img src='\" + img('r/' + (i+1) + '.gif') + \"' width='18' height='12' border='0' title='\" + T('RECURSO' + (i+1)) + \"'>\");\r\n\t\t\t\tif (i+1 == marketj) td.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(j, i+1), 0);\r\n\t\t\t\ttd.appendChild(ref);\r\n\t\t\t\ttr.appendChild(td);\r\n\t\t\t}\r\n\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\tif (marketj==5) td.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\ttd.setAttribute(\"id\", \"filtro\" + j + \"4\");\r\n\t\t\tvar ref = elem(\"A\", T('CUALQUIERA'));\r\n\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(j, 5), 0);\r\n\t\t\ttd.appendChild(ref);\r\n\t\t\ttr.appendChild(td);\r\n\t\t\ttable.appendChild(tr);\r\n\t\t}\r\n\r\n\t\t// Tipo de transaccion segun la relacion entre oferta y demanda\r\n\t\tvar market2 = getOption(\"market2\",4,\"integer\");\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\t\ttr.appendChild(elem(\"TD\", T('TIPO')));\r\n\t\ttable.appendChild(tr);\r\n\t\tvar etiquetas_tipo = [\"1:>1\", \"1:1\", \"1:<1\", \"1:x\"];\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\ttd.setAttribute(\"id\", \"filtro\" + 2 + i);\r\n\t\t\tif (i+1 == market2) td.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\tvar ref = elem(\"A\", etiquetas_tipo[i]);\r\n\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(2, (i+1)), 0);\r\n\t\t\ttd.appendChild(ref);\r\n\t\t\ttr.appendChild(td);\r\n\t\t}\r\n\t\ttr.appendChild(document.createElement(\"TD\"));\r\n\r\n\t\t// Tiempo maximo de transporte\r\n\t\tvar market4 = getOption(\"market4\",4,\"integer\");\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\t\ttr.appendChild(elem(\"TD\", T('MAXTIME')));\r\n\t\ttable.appendChild(tr);\r\n\t\tvar etiquetas_tipo = [\"1\", \"2\", \"3\", \">3\"];\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\ttd.setAttribute(\"id\", \"filtro\" + 4 + i);\r\n\t\t\tif (i+1 == market4) td.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\tvar ref = elem(\"A\", etiquetas_tipo[i]);\r\n\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(4, (i+1)), 0);\r\n\t\t\ttd.appendChild(ref);\r\n\t\t\ttr.appendChild(td);\r\n\t\t}\r\n\t\ttr.appendChild(document.createElement(\"TD\"));\r\n\r\n\t\t// Filtro por disponibilidad de recursos y mercaderes\r\n\t\tvar market3=getOption(\"market3\",2,\"integer\");\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\t\ttr.appendChild(elem(\"TD\", T('DISPONIBLE')));\r\n\t\ttable.appendChild(tr);\r\n\t\tvar etiquetas_carencia = [T('SI'), T('NO')];\r\n\t\tfor (var i = 0; i < 2; i++){\r\n\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\ttd.setAttribute(\"colspan\", \"2\");\r\n\t\t\ttd.setAttribute(\"id\", \"filtro\" + 3 + i);\r\n\t\t\tif (i+1 == market3) td.setAttribute(\"style\", \"background-color:#E5E5E5\");\r\n\t\t\tvar ref = elem(\"A\", etiquetas_carencia[i]);\r\n\t\t\tref.setAttribute(\"href\", \"javascript:void(0)\");\r\n\t\t\ttd.addEventListener(\"click\", funcionFiltrosMercado(3, (i+1)), 0);\r\n\t\t\ttd.appendChild(ref);\r\n\t\t\ttr.appendChild(td);\r\n\t\t}\r\n\t\ttr.appendChild(document.createElement(\"TD\"));\r\n\t\tapplyMarketFilters();\r\n\r\n\t\t// Busca la tabla de ofertas y la inserta justo antes\r\n\t\tvar a = find(\"//table[@cellspacing='1' and @cellpadding='2' and @class='tbg' and not(@style)]\", XPFirst,get(\"lmid2\"));\r\n\t\tvar p = document.createElement(\"P\");\r\n\t\tp.appendChild(table);\r\n\r\n//\t\tsetOption('marketpreload', 1);\r\n\r\n\t\tvar Input3 = document.createElement('input');\r\n\t\t\tInput3.value = getOption(\"marketpreload\",0,\"integer\");\r\n\t\t\tInput3.className = 'fm';\r\n\t\t\tInput3.size = 4;\r\n\t\t\tInput3.addEventListener('change', function(){\r\n\t\t\t\tsetOption('marketpreload', this.value);\r\n\t\t\t\tdocument.location.reload();\r\n\r\n\t\t\t}, false);\r\n\r\n\t\tp.appendChild(document.createElement(\"P\"));\r\n\t\tp.appendChild(document.createTextNode(T('MARKETPRELOADPAGE')));\r\n\t\tp.appendChild(Input3);\r\n\r\n\t\ta.parentNode.insertBefore(p, a);\r\n\r\n\t\t// market preload\r\n\t\tvar linkid=find('//td[@class=\"rowpic\"]/a',XPFirst,a).href.match('id=([0-9]*)&')[1];\r\n//\t\tlog(2,\"linkid:\"+linkid); // http://s3.travian.hu/build.php?id=30&t=1&u=40#h2\r\n\r\n\t\tvar marketpreload = getOption(\"marketpreload\",0,\"integer\");\r\n\t\tif (0<marketpreload) {\r\n\t\t\t setTimeout(createPreloadFunc(1),getRandTimeRange(600));\r\n\r\n\t\t\tvar linkpages = xpathEvaluate(\"//a[contains(@href, '&t=1&u=')]\");\r\n\t\t\tif (linkpages.snapshotLength > 0) {\r\n\t\t\t\tfor (var i=0; i<linkpages.snapshotLength; i++) {\r\n\t\t\t\t\tif (linkpages.snapshotItem(i).href.search(/&t=1&u=(\\d+)\\#/)) {\r\n\t\t\t\t\t\tvar a = RegExp.$1;\r\n\t\t\t\t\t\tif (a == 0) continue;\r\n\r\n\t\t\t\t\t\tvar npage = 0;\r\n\r\n\t\t\t\t\t\tif (i == 0 && linkpages.snapshotLength > 1) {\r\n\t\t\t\t\t\t\tnpage = parseInt(a) - marketpreload * 40;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tnpage = parseInt(a) + marketpreload * 40;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (npage <= 0) npage = 0;\r\n\r\n\t\t\t\t\t\tif (marketpreload) {\r\n\t\t\t\t\t\t\tlinkpages.snapshotItem(i).href = \"build.php?id=\"+linkid+\"&t=1&u=\"+npage+\"#h2\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Crea una funcion encargada de calcular e insertar el coste necesario segun una cantidad de una casilla\r\n\t *\r\n\t * Params:\r\n\t *\tid: identificador de unidad\r\n\t *\tcoste: coste de una sola unidad\r\n\t *\r\n\t * Returns:\r\n\t *\tla funcion de procesamiento\r\n\t */\r\n\t\tfunction crearFuncionExplorarUnidades(id, coste){\r\n\t\t\t\tvar funcion = function (){\r\n\t\t\t\t\t\tvar a = find(\"//input[@type='text']\", XPList).snapshotItem(id - 1);\r\n\t\t\t\t\t\tvar b = find(\"//div[@name='exp\" + id + \"']\", XPFirst);\r\n\t\t\t\t\t\tvar c = calculateResourceTime(arrayByN(coste, a.value));\r\n\t\t\t\t\t\tif (c) b.innerHTML = c; else b.innerHTML = '';\r\n\t\t\t\t};\r\n\t\t\t\treturn funcion;\r\n\t\t}\r\n\r\n\t\tfunction tiempoExplorarUnidades(){\r\n\t\t\t\tif (!find(\"//form[@name='snd']//input[@type='image' and @value='ok']\", XPFirst)) return;\r\n\t\t\t\tvar a = find(\"//table[@class='tbg']//tr[not(@class)]//table[@class='f10']\", XPList);\r\n\t\t\t\tfor (var i = 0; i < a.snapshotLength; i++){\r\n\t\t\t\t\t\tvar b = a.snapshotItem(i);\r\n\t\t\tvar c = b.getElementsByTagName(\"TD\")[2].textContent.split(\" \")[0].split(\"|\");\r\n\r\n\t\t\tvar div = document.createElement(\"DIV\");\r\n\t\t\t\t\t\tdiv.setAttribute(\"name\", \"exp\" + (i+1));\r\n\t\t\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\t\t\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t\t\ttd.setAttribute(\"colspan\", \"2\");\r\n\t\t\t\t\t\ttd.setAttribute(\"class\", \"c f7 s7\");\r\n\t\t\t\t\t\ttd.appendChild(div);\r\n\t\t\t\t\t\ttr.appendChild(td);\r\n\r\n\t\t\t\t\t\t// FIXME: Apanyo para Firefox. FF mete un nodo extra al principio de la tabla\r\n\t\t\t\t\t\tvar d = b.childNodes;\r\n\t\t\t\t\t\td[d.length - 1].appendChild(tr);\r\n\r\n\t\t\t\t\t\tb.parentNode.parentNode.getElementsByTagName(\"INPUT\")[0].addEventListener(\"keyup\", crearFuncionExplorarUnidades((i+1), c), 0);\r\n\t\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction tiempoExplorar(){\r\n\t\t\t\tvar a = find(\"//table[@class='tbg']//tr[@class='cbg1']\", XPFirst);\r\n\t\t// FIXME: Apanyo para Firefox. FF mete varios nodos extras entre las columnas\r\n\t\t\t\tif (a == null || (a.childNodes.length != 2 && a.childNodes.length != 4)) return;\r\n\r\n\t\tvar a = a.parentNode.childNodes;\r\n\t\tfor (var i = 1; i < a.length; i++){\r\n\t\t\tvar b = a[i];\r\n\t\t\tvar c = b.getElementsByTagName(\"DIV\");\r\n\t\t\tif (c.length == 2 && c[1].className == 'c'){\r\n\t\t\t\tvar d = b.getElementsByTagName(\"TD\")[3].textContent.split(\"|\").splice(0,4);\r\n\t\t\t\tvar e = calculateResourceTime(d);\r\n\t\t\t\tif (e) c[1].innerHTML = e;\r\n\t\t\t}\r\n\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Modifica el valor por defecto del tipo de ataque a enviar\r\n\t\t */\r\n\t\tfunction ataqueDefecto(){\r\n\t\t\t\tvar accion = 4; // 2 -> Apoyo, 3 -> Ataque, 4 -> Atraco\r\n\r\n\t\t\t\tvar cities = find(\"//div[@id='lright1']//table[@class='f10']\", XPFirst);\r\n\t\t\t\tif(cities && location.href.search(/z=(\\d+)/) >= 0){\r\n\t\t\t\t\t\tvar z = RegExp.$1;\r\n\t\t\t\t\t\tcities = cities.firstChild;\r\n\t\t\t\t\t\tfor (var i = 0; i < cities.childNodes.length; i++){\r\n\t\t\t\t\t\t\t\tvar city = cities.childNodes[i];\r\n\t\t\t\tcity.textContent.search(/\\((.*)\\n?\\|\\n?(.*)\\)/);\r\n\t\t\t\t\t\t\t\tvar id = xy2id(RegExp.$1, RegExp.$2);\r\n\t\t\t\t\t\t\t\tif (id == z) accion = 2;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar o = find(\"//input[@name='c' and @value='\" + accion + \"']\", XPFirst);\r\n\t\t\t\tif (o) o.checked = true;\r\n\t\t}\r\n\r\n\t/**\r\n\t * Inserta un nuevo marcador y lo almacena\r\n\t *\r\n\t * Params:\r\n\t *\ttexto:\tTexto del marcador\r\n\t *\tenlace:\tEnlace a donde apunta el marcador\r\n\t */\r\n\tfunction agregarElementoCookie(cookie, values){\r\n\t\tvar nuevo = '';\r\n\t\tfor (var i = 0; i < values.length; i++){\r\n\t\t\tif (values[i] != ''){\r\n\t\t\t\tnuevo += values[i];\r\n\t\t\t\tif (i != values.length - 1) nuevo += '$';\r\n\t\t\t}else return;\r\n\t\t}\r\n\t\tvar a = readCookie(cookie + \"_\" + server);\r\n\t\tif (a != null && a != '' && a != 'null' && a != 'undefined') a += \"$$\" + nuevo;\r\n\t\telse a = nuevo;\r\n\t\tcreateCookie(cookie + \"_\" + server, a, 365);\r\n\t}\r\n\r\n\t/**\r\n\t * Crea el evento de eliminar un marcador. Lo elimina y ademas refresca la lista donde estan mostrados\r\n\t *\r\n\t * Params:\r\n\t * \tnum:\tIdentificador de marcador a eliminar\r\n\t */\r\n\tfunction crearEventoEliminarCookie(cookie, num, funcion){\r\n\t\t\t\treturn function(){\r\n\t\t\tvar a = readCookie(cookie + \"_\" + server);\r\n\t\t\tif (a != null){\r\n\t\t\t\ta = a.split(\"$$\");\r\n\t\t\t\ta.splice(num, 1);\r\n\t\t\t\tcreateCookie(cookie + \"_\" + server, a.join(\"$$\"), 365);\r\n\t\t\t\tremoveElement(find(\"//*[@id='\" + cookie + \"']\", XPFirst));\r\n\t\t\t\tfuncion();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Recupera los marcadores almacenados. Dos marcadores estan separados por el simbolo $$ y\r\n\t * en cada marcador el enlace y el texto estan separados por $. No se espera encontrar esos simbolos\r\n\t * en el texto o en los enlaces, ya que de lo contrario fallaria.\r\n\t *\r\n\t * Returns:\r\n\t *\tUn array con cada uno de los marcadores\r\n\t */\r\n\tfunction obtenerValorCookie(cookie){\r\n\t\t// Importar marcadores de versiones antiguas del script\r\n\t\t// FIXME: Eliminar dentro de unas cuantas versiones\r\n\t\tvar b = readCookie(cookie); if (b != null && b != '' && b != 'undefined'){ createCookie(cookie + \"_\" + server, b, 365); eraseCookie(cookie); }\r\n\r\n\t\tvar res = new Array();\r\n\t\tvar a = readCookie(cookie + \"_\" + server);\r\n\t\tif (a != null && a != '' && a != 'undefined'){\r\n\t\t\ta = a.split(\"$$\");\r\n\t\t\tfor (var i = 0; i < a.length; i++) res[i] = a[i].split(\"$\");\r\n\t\t}\r\n\t\treturn res;\r\n\t}\r\n\r\n\t/**\r\n\t * Muestra los marcadores almacenados\r\n\t //书签\r\n\t */\r\n\tfunction mostrarMarcadores(){\r\n\t\t// Intenta insertarlos en la lista derecha, si no existe la crea\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba){\r\n\t\t\tba = document.createElement(\"DIV\");\r\n\t\t\tba.setAttribute(\"id\", \"lright1\");\r\n\t\t\tfind(\"//body\", XPFirst).appendChild(ba);\r\n\t\t}\r\n\t\tvar div = document.createElement(\"DIV\");\r\n\t\tvar titulo = elem(\"B\", T('MARCADORES') + \":\");\r\n\t\tvar enlace = elem(\"A\", T('ANYADIR'));\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"f10\");\r\n\t\tdiv.setAttribute(\"id\", \"marcadores\");\r\n\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t// Al anyadir se pide el texto y el enlace, si se cancela o se deja vacio alguno se aborta\r\n\t\t// Despues de insertar se refresca la lista volviendola a insertar\r\n\t\tenlace.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\tvar a = prompt(T('ENLACE'));\r\n\t\t\t\t\t\t\t\tif (a == null || a == '' || a == 'undefined') return;\r\n\t\t\t\t\t\t\t\tvar b = prompt(T('TEXTO'));\r\n\t\t\t\t\t\t\t\tif (b == null || b == '' || b == 'undefined') return;\r\n\t\t\t\t\t\t\t\tagregarElementoCookie(\"marcadores\", [b, a]);\r\n\t\t\t\t\t\t\t\tremoveElement(find(\"//div[@id='marcadores']\", XPFirst));\r\n\t\t\t\t\t\t\t\tmostrarMarcadores();\r\n\t\t\t\t\t\t}, 0);\r\n\t\ttitulo.setAttribute(\"class\",\"f10\");\r\n\t\tdiv.appendChild(titulo);\r\n\t\tdiv.appendChild(document.createTextNode(\" (\")); div.appendChild(enlace); div.appendChild(document.createTextNode(\")\"));\r\n\t\tdiv.appendChild(tabla);\r\n\t\tvar p = document.createElement(\"P\");\r\n\t\tp.appendChild(div);\r\n\t\tba.appendChild(p);\r\n\r\n\t\t// Se obtienen los marcadores y se insertan junto con un enlace para eliminarlos\r\n\t\tvar marcadores = obtenerValorCookie(\"marcadores\");\r\n\t\tfor (var i = 0; i < marcadores.length; i++){\r\n\t\t\tvar tr = document.createElement(\"TR\");\r\n//\t\t\tvar td = elem(\"TD\", \"<span>&#8226;</span>&nbsp; <a href='\" + marcadores[i][1] + \"'>\" + marcadores[i][0] + \"</a>\");\r\n\r\n\r\n\t\t\tif (marcadores[i][1].search(/karte.php\\?d=(\\d+)/) > 0){\r\n\t\t\t\tvar a = RegExp.$1;\r\n\r\n\t\t\t\tvar td = elem(\"TD\",\r\n\t\t\t\t\t\"<span>&#8226;</span>&nbsp; <a href='\" + marcadores[i][1] + \"' class='done' done='1'>\" + marcadores[i][0] + \"</a>\"\r\n\r\n\t\t\t\t\t+ '<span class=\"done\" style=\"word-break: keep-all; font: 9px/1.5em Tahoma,Verdana,Arial !important; color:grey;\"> ( ' + zid2x(a) + ' | ' + zid2y(a) + ' ) </span>'\r\n\r\n\t\t\t\t\t+ \" <a href='a2b.php?z=\" + a + \"'><img src='\" + img(\"a/att_all.gif\") + \"' style='margin:3px 0px 1px 3px; display: inline' height='10' width='10' title='\" + T('ATACAR') + \"' alt='\" + T('ATACAR') + \"' border='0'></a>\"\r\n\t\t\t\t\t+ \" <a href='build.php?z=\" + a + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"\r\n\t\t\t\t\t+ \" <a href='karte.php?z=\" + a + \"' target='_blank'>\" + T('ALDEA_EXTRA3') + \"</a>\"\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tvar td = elem(\"TD\", \"<span>&#8226;</span>&nbsp; <a href='\" + marcadores[i][1] + \"'>\" + marcadores[i][0] + \"</a>\");\r\n\t\t\t}\r\n\r\n\t\t\tvar enlace = elem(\"A\", \" <img src='\" + img('a/del.gif') + \"' width='12' height='12' border='0' title='\" + T('ELIMINAR') + \"'>\");\r\n\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\tenlace.addEventListener(\"click\", crearEventoEliminarCookie(\"marcadores\", i, mostrarMarcadores), 0);\r\n\t\t\ttd.appendChild(enlace);\r\n\t\t\ttr.appendChild(td);\r\n\t\t\ttabla.appendChild(tr);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Crea enlaces directos en la lista de aldeas para enviar tropas o enviar comerciantes\r\n\t */\r\n\t\tfunction cityLinks(){\r\n\t\t// Localiza la lista de aldeas\r\n\t\t\t\tvar cities = find(\"//div[@id='lright1']//table[@class='f10']\", XPFirst);\r\n\t\t\t\tif (!cities) return;\r\n\r\n\t\tcities = cities.firstChild;\r\n\t\tfor (var i = 0; i < cities.childNodes.length; i++){\r\n\t\t\t// Utiliza el texto de las coordenadas para averiguar el ID necesario para los enlaces\r\n\t\t\tvar city = cities.childNodes[i];\r\n\t\t\tcity.textContent.search(/\\((.*)\\n?\\|\\n?(.*)\\)/);\r\n\t\t\tvar id = xy2id(RegExp.$1, RegExp.$2);\r\n\t\t\t/*\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='a2b.php?z=\" + id + \"'><img src='\" + img('a/def1.gif') + \"' width='12' border='0' title='\" + T('ENV_TROPAS') + \"'></a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'><img src='\" + img('r/4.gif') + \"' height='12' border='0' title='\" + T('ENVIAR') + \"'></a>\"));\r\n\t\t\t*/\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='a2b.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA1') + \"</a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='build.php?z=\" + id + \"&gid=17'>\" + T('ALDEA_EXTRA2') + \"</a>\"));\r\n\t\t\tcity.appendChild(elem(\"TD\", \"<a href='karte.php?z=\" + id + \"'>\" + T('ALDEA_EXTRA3') + \"</a>\"));\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Convierte todos los enlaces a la propia pagina del tipo \"#\" como enlaces vacios de javascript\r\n\t */\r\n\tfunction sanearEnlaces(){\r\n\t\tvar a = find(\"//a[@href='#']\", XPList);\r\n\t\tfor (var i = 0; i < a.snapshotLength; i++) a.snapshotItem(i).href = 'javascript:void(0)';\r\n\t}\r\n\r\n\t/**\r\n\t * Muestra una tabla en la pagina de perfil con los valores almacenados en cookies por el script\r\n\t */\r\n\t\tfunction mostrarConfiguracion(){\r\n\t\t\t\tvar a = find(\"//form\", XPFirst);\r\n\t\t\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\t\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\t\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\t\t\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\t\t\ttabla.setAttribute(\"id\", \"configuracion\");\r\n\r\n\t\t\t\tvar fila = document.createElement(\"TR\");\r\n\t\t\t\tvar td = elem(\"TD\", \"Travian Beyond\");\r\n\t\t\t\ttd.setAttribute(\"class\", \"rbg\");\r\n\t\t\t\ttd.setAttribute(\"colspan\", \"2\");\r\n\t\t\t\tfila.appendChild(td);\r\n\t\t\t\ttabla.appendChild(fila);\r\n\r\n\t\t// Parametros reconocidos\r\n\t\t\t\tvar parametros = [\"desp\", \"marcadores_\" + server, \"notas_\" + server, \"ventas_\" + server, 'cpcty'];\r\n\t\t\t\tfor (var i = 0; i < parametros.length; i++){\r\n\t\t\t\t\t\tfila = document.createElement(\"TR\");\r\n\t\t\t\t\t\tfila.appendChild(elem(\"TD\", parametros[i]));\r\n\t\t\t\t\t\tvar valor = readCookie(parametros[i]);\r\n\t\t\t\t\t\tfila.appendChild(elem(\"TD\", \"<input type='text' name='\" + parametros[i] + \"' value='\" + (valor != null ? valor : '') + \"' class='fm' style='width:275px;'/>\"));\r\n\t\t\t\t\t\ttabla.appendChild(fila);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar parametros = [\"marketpreload\", 'allowlink', 'htmlon'];\r\n\t\t\t\tfor (var i = 0; i < parametros.length; i++){\r\n\t\t\t\t\t\tfila = document.createElement(\"TR\");\r\n\t\t\t\t\t\tfila.appendChild(elem(\"TD\", parametros[i]));\r\n\t\t\t\t\t\tvar valor = getOption(parametros[i]);\r\n\t\t\t\t\t\tfila.appendChild(elem(\"TD\", \"<input id='setoption' type='text' name='\" + parametros[i] + \"' value='\" + (valor != null ? valor : '') + \"' class='fm' style='width:275px;'/>\"));\r\n\t\t\t\t\t\ttabla.appendChild(fila);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tinsertAfter(a, tabla);\r\n\r\n\t\t\t\tvar imagen = document.createElement(\"IMG\");\r\n\t\t\t\timagen.setAttribute(\"src\", img('b/s1.gif', true));\r\n\t\t\t\timagen.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\tvar parametros = get('configuracion').getElementsByTagName(\"INPUT\");\r\n\t\t\t\t\t\tfor (var i = 0; i < parametros.length; i++) {\r\n\t\t\t\t\t\t\tif (parametros.id == 'setoption') {\r\n\t\t\t\t\t\t\t\tsetOption(parametros[i].name, parametros[i].value);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tcreateCookie(parametros[i].name, parametros[i].value, 365);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\talert(T('GUARDADO'));\r\n\t\t\t\t}, 0);\r\n\t\t\t\tvar p = document.createElement(\"P\");\r\n\t\t\t\tp.setAttribute(\"align\", \"center\");\r\n\t\t\t\tp.appendChild(imagen);\r\n\t\t\t\tinsertAfter(tabla, p);\r\n\t\t}\r\n\r\n\t/**\r\n\t * Calcula y muestra el tiempo que ha tardado desde el inicio de ejecucion del script\r\n\t */\r\n\tfunction calcularTiempoEjecucion(){\r\n\t\tvar tiempo = new Date().getTime() - tiempo_ejecucion;\r\n//\t\tvar div = find(\"//div[@id='ltime']/b\", XPFirst);\r\n\t\tvar div = find(\"//div[@id='ltime']\", XPFirst);\r\n\t\tdiv.style.fontSize = '12px';\r\n\t\tdiv.appendChild(elem(\"span\", \"<span style='font-size:12px; position: absolute; left:200px; top:0px; height: 30px; width:500px; text-align:left;'>TB \" + version + '<a href=\"spieler.php?s=2\"><font color=\"' + ((readCookie(\"feature_\" + server) == '1')?'yellow\">[&#24050;&#20801;&#35768;&#21361;&#38505;&#21151;&#33021;':'lightgreen\">[&#24050;&#31105;&#27490;&#21361;&#38505;&#21151;&#33021;') + \"]</font></a>: \" + tiempo + \" ms</span>\"));\r\n\r\n//\t\tvar div = xpath(\"//div[@id='ltime']/b\");\r\n//\t\tif (div.snapshotLength == 0) return;\r\n\r\n//\t\tdiv = div.snapshotItem(0);\r\n\r\n//\t\tdiv.appendChild(elem(\"span\", \"TB: \" + tiempo + \" ms\"));\r\n\r\n//\t\tinsertAfter(elem(\"span\", \"&nbsp;ms&nbsp;TB: <b>\" + tiempo + \"</b>\"), div);\r\n//\t\txpath(\"//div[@id='ltime']\").snapshotItem(0).insertBefore(elem(\"span\", \"&nbsp;ms,&nbsp;TB: <b>\" + tiempo + \"</b>\"), div.nextSibling);\r\n\r\n//\t\tdiv.innerHTML=div.innerHTML.replace(\" ms<br>\",'ms.&nbsp;TB: <b>'+tiempo+'</b>ms<br>');\r\n\t}\r\n\r\n\t/**\r\n\t * Procesa una respuesta XmlHttpRequest de la pagina de una casilla para mostrar un tooltip con\r\n\t * informacion sobre sus recursos\r\n\t */\r\n\tfunction procesarCasilla2(t, who){\r\n\t\tif (timeout == null || !timeout || timeout == 0) return;\r\n\r\n\t\t// Solo hay 6 tipos de casillas\r\n\t\tvar dist = [\r\n\t\t\t[3, 3, 3, 9],\r\n\t\t\t[3, 4, 5, 6],\r\n\t\t\t[4, 4, 4, 6],\r\n\t\t\t[4, 5, 3, 6],\r\n\t\t\t[5, 3, 4, 6],\r\n\t\t\t[1, 1, 1, 15]\r\n\t\t];\r\n\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = document.createElement('DIV');\r\n\t\tans.innerHTML = t.responseText;\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\t\t// Parece haber dos versiones del juego, asi que se contemplan las dos\r\n\t\tif (ansdoc.evaluate(\"//div[starts-with(@id, 'f')]\", ans, null, XPFirst, null).singleNodeValue)\r\n\t\t\tansdoc.evaluate(\"//div[starts-with(@id, 'f')]\", ans, null, XPFirst, null).singleNodeValue.id.search(/f(\\d)/);\r\n\t\telse\r\n\t\t\tansdoc.evaluate(\"//img[@id='resfeld']\", ans, null, XPFirst, null).singleNodeValue.src.search(/\\/f(\\d)\\.jpg$/);\r\n\r\n\t\tvar info = dist[RegExp.$1 - 1];\r\n\t\tvar div = get(\"tb_tooltip\");\r\n\t\tdiv.style.display = 'block';\r\n\t\tdiv.innerHTML = '';\r\n\t\tfor (var i = 1; i < 5; i++) div.innerHTML += '<img src=\"' + img('r/' + i + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + i) + '\">' + info[i-1] + ' ';\r\n\r\n\t\tif (who.href) {\r\n\t\t\tarrayRecursosCasilla[who.href] = div.innerHTML;\r\n\t\t\twho.setAttribute(\"casilla\", div.innerHTML);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction procesarCasilla(t,mev){\r\n\t\tvar fieldtype=parseFieldType(t,mev);\r\n\t\tshowFieldTypeInTooltip(fieldtype,mev);\r\n\t}\r\n\r\n\tfunction parseFieldType(t,mev){\r\n//\t\tlog(1,\"fieldtypeparseresp: \"+mev.pos);\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = document.createElement('DIV');\r\n\t\tans.innerHTML = t.responseText;\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\t\t// Parece haber dos versiones del juego, asi que se contemplan las dos\r\n\t\tif (ansdoc.evaluate(\"//div[starts-with(@id, 'f')]\", ans, null, XPFirst, null).singleNodeValue)\r\n\t\t\tansdoc.evaluate(\"//div[starts-with(@id, 'f')]\", ans, null, XPFirst, null).singleNodeValue.id.search(/f(\\d)/);\r\n\t\telse\r\n\t\t\tansdoc.evaluate(\"//img[@id='resfeld']\", ans, null, XPFirst, null).singleNodeValue.src.search(/\\/f(\\d)\\.jpg$/);\r\n\r\n\t\tvar fieldtype = RegExp.$1;\r\n\t\t//save to storage\r\n\t\tvar pos = mev.area.href.match(/d=(\\d+)/).pop();\r\n\r\n\t\tif (fieldtype>6) {\r\n//\t\t\tlog(1,\"invalid fieldtype at pos:\"+pos+\" ft:\"+fieldtype);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tshowCellInfo(mev.pos+1,fieldtype);\r\n\r\n\t\tif (storeurl!='') gmAjaxRequest(storeurl,\"POST\",\"cmd=mapset&namespace=\"+server+\"&pos=\"+pos+\"&value=\"+fieldtype,dummy);\r\n\t\treturn fieldtype;\r\n\t}\r\n\r\n\tfunction showCellInfo(pos,type) {\r\n\t\tvar itext=['','(9)','<img src='+img('r/3.gif',false)+'>','(6)','<img src='+img('r/2.gif',false)+'>','<img src='+img('r/1.gif',false)+'>','(15)'];\r\n\t\tlog(3,\"cellinfo pos:\"+pos+\" type:'\"+type+\"'\");\r\n\r\n\t\tvar celldiv = get('map_info_'+pos);\r\n\t\tcelldiv.innerHTML=itext[type];\r\n\r\n\t\tvar showInfo = getOption(\"showmapinfo\",true,\"boolean\") ? 1 : 1;\r\n\t\tcelldiv.style.display=showInfo?'':'none';\r\n\t}\r\n\r\n\tfunction showFieldTypeInTooltip(fieldtype, mev) {\r\n\r\n\t\tvar div = get(\"tb_tooltip\");\r\n\r\n\t\tif (mev.area.getAttribute(\"casilla\")) {\r\n\t\t\tdiv.innerHTML = mev.area.getAttribute(\"casilla\");\r\n\t\t\tdiv.style.display = 'block';\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Solo hay 6 tipos de casillas\r\n\t\tvar dist = [\r\n\t\t\t[3, 3, 3, 9],\r\n\t\t\t[3, 4, 5, 6],\r\n\t\t\t[4, 4, 4, 6],\r\n\t\t\t[4, 5, 3, 6],\r\n\t\t\t[5, 3, 4, 6],\r\n\t\t\t[1, 1, 1, 15]\r\n\t\t];\r\n\t\tvar info = dist[fieldtype-1];\r\n\t\tdiv.innerHTML = '';\r\n\t\tfor (var i = 1; i < 5; i++) div.innerHTML += '<img src=\"' + img('r/' + i + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + i) + '\">' + info[i-1] + ' ';\r\n\r\n\t\tdiv.style.display = 'block';\r\n\r\n\t\tif (mev.area.href) {\r\n\t\t\tarrayRecursosCasilla[mev.area.href] = div.innerHTML;\r\n\t\t\tmev.area.setAttribute(\"casilla\", div.innerHTML);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Actualiza la posicion del tooltip. Solo puede haber un tooltip a la vez porque solo hay un puntero de cursos\r\n\t */\r\n\tfunction updateTooltip(e){\r\n//\t\tvar div = get(\"tb_tooltip\");\r\n//\t\tdiv.style.left = (e.pageX + 15) + \"px\";\r\n//\t\tdiv.style.top = (e.pageY + 5) + \"px\";\r\n\r\n\t\tvar dx = 15;\r\n\t\tvar dy = 10;\r\n\r\n\t\tvar div = get(\"tb_tooltip\");\r\n\t\t//if(div.clientWidth==0 || div.clientHeight==0) return;\r\n\t\tif(div.clientWidth!=0 && e.pageX+dx+div.clientWidth - document.documentElement.scrollLeft > document.documentElement.clientWidth)\r\n\t\t\tdiv.style.left = (e.pageX - dx - div.clientWidth) + \"px\";\r\n\t\telse\r\n\t\t\tdiv.style.left = (e.pageX + dx) + \"px\";\r\n\r\n\t\tif(div.clientHeight!=0 && e.pageY+dy+div.clientHeight - document.documentElement.scrollTop > document.documentElement.clientHeight)\r\n\t\t\tdiv.style.top = (e.pageY - dy - div.clientHeight) + \"px\";\r\n\t\telse\r\n\t\t\tdiv.style.top = (e.pageY + dy) + \"px\";\r\n\t}\r\n\r\n\t/**\r\n\t * Crea el objeto usado para meter la informacion del tooltip\r\n\t */\r\n\tfunction crearTooltip(){\r\n\t\tvar div = document.createElement(\"DIV\");\r\n\t\tdiv.setAttribute(\"id\", \"tb_tooltip\");\r\n\t\tdiv.setAttribute(\"style\", \"position:absolute; display: block; padding: 4px; z-index: 100; border: solid 1px #CCC; background-color: #FEFFE3; display: none;\");\r\n\t\tdocument.body.appendChild(div);\r\n\r\n\t\t// Solo puede haber un tooltip simultaneamente\r\n\t\tdocument.addEventListener(\"mousemove\", updateTooltip, 0);\r\n\t}\r\n\r\n//\tfunction createMenu()\r\n//\t{\r\n//\t\t//var menu = $('<table id=\"tb_menu\" cellspacing=\"2\" cellpadding=\"2\" style=\"font-size: 12px; border: 1px solid #CCC; z-index: 100; width: 160px; position: absolute; background-color: #FFF; display: none\"><tr style=\"background-image: url(img/un/a/c2.gif);\" height=\"20\"><td width=\"140\" align=\"center\" style=\"font-weight: bold\" id=\"menu_title\"></td><td><a id=\"close_menu\" href=\"javascript: void(null);\" style=\"color: #333; font-weight: normal;\">X</a></td></tr><tr height=\"20\"><td colspan=\"2\" id=\"menu_1\"></td></tr><tr height=\"20\"><td colspan=\"2\" id=\"menu_2\"></td></tr></table>');\r\n//\t\t//change by arrack\r\n//\t\tvar menu = $('<table id=\"tb_menu\" cellspacing=\"2\" cellpadding=\"2\" style=\"font-size: 12px; border: 1px solid #CCC; z-index: 100; width: 160px; position: absolute; background-color: #FFF; display: none\"><tr style=\"background-image: url(img/un/a/c2.gif);\" height=\"20\"><td width=\"140\" align=\"center\" style=\"font-weight: bold\" id=\"menu_title\"></td><td><a id=\"close_menu\" href=\"javascript: void(null);\" style=\"color: #333; font-weight: normal;\">X</a></td></tr><tr height=\"20\"><td colspan=\"2\" id=\"menu_1\"></td></tr></table>');\r\n//\r\n//\t\t$(menu).find('#close_menu').click(function() {\r\n//\t\t\t$('#tb_menu').hide();\r\n//\t\t});\r\n//\t\t$(document.body).append(menu);\r\n//\t}\r\n\r\n\t/**\r\n\t * Crea el evento de cuando se coloca el raton sobre una casilla del mapa\r\n\t *\r\n\t * Params:\r\n\t *\thref: URL de la casilla\r\n\t */\r\n\tfunction crearEventoRecursosCasilla(href, who){\r\n\t\t// Espera 1 segundo antes de realizar la peticion asincrona\r\n\t\treturn function(){\r\n\r\n\t\t\tif (href == 'javascript:void(0)' || href == 'javascript: void(0)') {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\tvar mapdata = arrayRecursosCasilla[href] ? arrayRecursosCasilla[href] : who.getAttribute(\"casilla\");\r\n\r\n\t\t\tif (mapdata) {\r\n\t\t\t\ttimeout = setTimeout(function(){\r\n\t\t\t\t\tvar div = get(\"tb_tooltip\");\r\n\t\t\t\t\tdiv.style.display = 'block';\r\n\t\t\t\t\tdiv.innerHTML = mapdata;\r\n\t\t\t\t}, 100);\r\n\t\t\t} else {\r\n\t\t\t\ttimeout = setTimeout(function(){\r\n\t\t\t\t\tajaxRequest(href, \"GET\", null, function (t) { procesarCasilla2(t, who); }, dummy);\r\n\t\t\t\t}, 1000);\r\n\t\t\t}\r\n\t\t};\r\n\t\t//return function(){ alert(href); timeout = setTimeout(function(){ ajaxRequest(href, \"GET\", null, function() { alert(\"success\")}, dummy); }, 1000); };\r\n\t}\r\n\r\n//\t//建立地图\r\n//\tfunction createMenuToResource(href, xPos, yPos, xPagePos, yPagePos)\r\n//\t{\r\n//\t\t$('#tb_menu').find('#menu_title').html(T('MAP') + \" (\" + xPos + \",\" + yPos + \")\");\r\n//\t\t//$('#tb_menu').find('#menu_1').html(\"<a href='\" + href + \"'>\" + T('OPENLINK') + \"</a>\");\r\n//\t\t$('#tb_menu').find('#menu_1').html('<a href=\"javascript: void(null);\">' + T('OPENRESINFO') + '</a>');\r\n//\t\t//$('#tb_menu').find('#menu_2').html('<a href=\"javascript: void(null);\">' + T('OPENRESINFO') + '</a>');\r\n//\t\t$('#tb_menu #menu_1 a').eq(0).click(function() {\r\n//\t\t\ttimeout = setTimeout(function() {\r\n//\t\t\t\t\t$.ajax({\r\n//\t\t\t\t\t\ttype: \"GET\",\r\n//\t\t\t\t\t\turl: href,\r\n//\t\t\t\t\t\tsuccess: function(msg){\r\n//\t\t\t\t\t\t\tprocesarCasilla(msg, xPos, yPos);\r\n//\t\t\t\t\t\t}\r\n//\t\t\t\t\t});\r\n//\t\t\t\t}, 0);\r\n//\t\t});\r\n//\t\t$('#tb_menu').css('display', 'block');\r\n//\t\t$('#tb_menu').css('left', (xPagePos + 5) + \"px\");\r\n//\t\t$('#tb_menu').css('top', (yPagePos + 5) + \"px\");\r\n//\r\n//\t}\r\n\r\n\t/**\r\n\t * Agrega un evento para mostrar la informacion de recursos sobre las casillas del mapa\r\n\t */\r\n//\tfunction infoRecursos(){\r\n////\t\tvar casillas = find(\"//img[starts-with(@class, 'mt')]\", XPList);\r\n////\t\tvar areas = find(\"//map//area[@shape='poly' and not(@onclick)]\", XPList);\r\n////\r\n////\t\tfor (var i = 0; i < casillas.snapshotLength; i++){\r\n////\t\t\tif (casillas.snapshotItem(i).src.match(/\\/(d|t)\\d*.gif$/)){\r\n////\t\t\tvar area = areas.snapshotItem(i);\r\n////\t\t\t\tarea.addEventListener(\"mouseover\", crearEventoRecursosCasilla(area.href, area), 0);\r\n////\t\t\t\tarea.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\r\n////\t\t\t}\r\n////\t\t}\r\n//\t}\r\n\r\n\t\t/**\r\n\t * Agrega un evento para mostrar la informacion de recursos sobre las casillas del mapa\r\n\t * Map resourceinfo generator\r\n\t */\r\n\tfunction infoRecursos(){\r\n\r\n\t/**\r\n\t * Actualiza la posicion del tooltip. Solo puede haber un tooltip a la vez porque solo hay un puntero de cursos\r\n\t */\r\n//\tfunction updateTooltip(e){\r\n//\t\tvar div = get(\"tb_tooltip\");\r\n//\t\tdiv.style.left = (e.pageX + 5) + \"px\";\r\n//\t\tdiv.style.top = (e.pageY + 5) + \"px\";\r\n//\t}\r\n\r\n\tfunction processMapGetResponse(r) {\r\n//\t\tlog(1,\"server response is:'\"+r+\"'\");\r\n\t\tvar cellinfos = r.split(\",\");\r\n\t\tfor (var i=0;i<49;i++) {\r\n\t\t\tif (cellinfos[i]>0&&cellinfos[i]<10) showCellInfo(i+1,cellinfos[i]);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Crea el objeto usado para meter la informacion del tooltip\r\n\t */\r\n//\tfunction crearTooltip(){\r\n//\t\tvar div = document.createElement(\"DIV\");\r\n//\t\tdiv.setAttribute(\"id\", \"tb_tooltip\");\r\n//\t\tdiv.setAttribute(\"style\", \"position:absolute; display: block; padding: 4px; z-index: 100; border: solid 1px #00C000; background-color: #FEFFE3; display: none;\");\r\n//\t\tdocument.body.appendChild(div);\r\n//\r\n//\t\t// Solo puede haber un tooltip simultaneamente\r\n//\t\tdocument.addEventListener(\"mousemove\", updateTooltip, 0);\r\n//\t}\r\n\r\n\r\n\t\t\t/**\r\n\t * Crea una funcion que se encarga del evento al desplazarse en el mapa. Actualiza la direccion destino en\r\n\t * base al desplazamiento configurado\r\n\t *\r\n\t * Params:\r\n\t * \ti:\tOrdinal sobre la orientacion de la flecha\r\n\t *\r\n\t * Returns:\r\n\t *\tLa funcion que gestiona el evento\r\n\t */\r\n\tfunction createEventoMapa(i, href){\r\n\t\tvar funcion = function (){\r\n\t\t\tvar despl = [-801, 1, 801, -1];\r\n\t\t\tvar d = parseInt(document.getElementsByName(\"desp\")[0].value);\r\n\t\t\tif (isNaN(d) || d < 1) d = 1;\r\n\t\t\tsetOption(\"desp\", d);\r\n\t\t\tvar base = parseInt(href.split(\"=\")[1]);\r\n\t\t\tvar zval = i<4?(base + (despl[i] * (d - 1))):(base + (despl[i%4] * 6));\r\n// log(1,\"base: \"+base+\" i:\"+i+\" d:\"+d+\" despli:\"+despl[i]+\" zval:\"+zval);\r\n\t\t\tajaxRequest(\"ajax.php?action=map_content&z=\" + zval, \"GET\", null,\r\n\t\t\t\tfunction(t){\r\n\t\t\t\t\tget(\"map_content\").innerHTML = t.responseText;\r\n\t\t\t\t\tinfoRecursos();\r\n\t\t\t\t\tremoveElement(get(\"tabla_mapa\"));\r\n\t\t\t\t\tgenMapTable();\r\n\t\t\t\t}\r\n\t\t\t, dummy);\r\n\t\t};\r\n\t\treturn funcion;\r\n\t}\r\n\r\n\tfunction mapScan() {\r\n\t\tvar mapcontent=get('map_content');\r\n\t\tvar j=0;\r\n\t\tfor(var i=1;i<50;i++){\r\n\t\t\tif (get('map_info_'+i).innerHTML=='') {\r\n\t\t\t\tvar k1=(i-1)%7;\r\n\t\t\t\tvar k2=Math.floor((49-i)/7);\r\n\t\t\t\tif (get(\"i_\"+k1+\"_\"+k2).src.match(/\\/(d|t)\\d*.gif$/)) {\r\n//\t\t\t log(1,'map cell should be scanned: '+i+\" a_\"+k1+\"_\"+k2);\r\n\t\t\t\t\tvar area = get(\"a_\"+k1+\"_\"+k2);\r\n\t\t\t\t\tvar mevobj = createMapInfoObj(area,i-1);\r\n\t\t\t\t\tsetTimeout(mevobj.scan,j*600+getRandTimeRange(600));\r\n\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfunction changeHide() {\r\n\t\tvar showInfo = getOption(\"showmapinfo\",true,\"boolean\");\r\n\t\tshowInfo=!showInfo;\r\n\t\tvar changeHidea = get(\"changehide\");\r\n\t\tchangeHidea.innerHTML=(showInfo?T('HIDEINFO'):T('SHOWINFO'));\r\n\t\tfor(var i=1;i<50;i++){\r\n\t\t\tget('map_info_'+i).style.display=showInfo?'':'none';\r\n\t\t}\r\n\r\n\t\tsetOption(\"showmapinfo\",showInfo);\r\n\t}\r\n\r\n\t/**\r\n\t */\r\n\tfunction desplazarMapa(){\r\n\t\tif (get('map_opts'))\r\n\t\t\tremoveElement(get('map_opts'));\r\n\r\n\t\t// Crea y anyade la casilla del desplazamiento\r\n\t\tvar b = find(\"//form[@method='post']\", XPFirst).parentNode;\r\n\t\tvar ctable = document.createElement(\"TABLE\");\r\n\t\tctable.setAttribute(\"id\", \"map_opts\");\r\n\t\tvar ctbody = document.createElement(\"TBODY\");\r\n\r\n\t\tif (storeurl!='') {\r\n\t\t\tvar showInfo = getOption(\"showmapinfo\",true,\"boolean\");\r\n\t\t\tvar changeHidea = elem(\"A\",showInfo?T('HIDEINFO'):T('SHOWINFO'));\r\n\t\t\tchangeHidea.setAttribute(\"id\", \"changehide\");\r\n\t\t\tchangeHidea.addEventListener(\"click\", changeHide, 0);\r\n\t\t\tchangeHidea.href = 'javascript:void(0)';\r\n\t\t\tvar trc = document.createElement(\"TR\");\r\n\t\t\tvar tdc = document.createElement(\"TD\");\r\n\t\t\ttdc.setAttribute(\"colspan\", 2);\r\n\t\t\ttdc.appendChild(changeHidea);\r\n\t\t\ttrc.appendChild(tdc);\r\n\t\t\tctbody.appendChild(trc);\r\n\r\n\t\t\tvar mapScana = elem(\"A\",T('MAPSCAN'));\r\n\t\t\tmapScana.setAttribute(\"id\", \"mapscan\");\r\n\t\t\tmapScana.addEventListener(\"click\", mapScan, 0);\r\n\t\t\tmapScana.href = 'javascript:void(0)';\r\n\t\t\ttrc = document.createElement(\"TR\");\r\n\t\t\ttdc = document.createElement(\"TD\");\r\n\t\t\ttdc.setAttribute(\"colspan\", 2);\r\n\t\t\ttdc.appendChild(mapScana);\r\n\t\t\ttrc.appendChild(tdc);\r\n\t\t\tctbody.appendChild(trc);\r\n\t\t}\r\n\t\tctable.appendChild(ctbody);\r\n\t\tb.appendChild(ctable);\r\n\r\n\t\tdocument.addEventListener(\"mousemove\", updateTooltip, 0);\r\n\r\n\t\t// Inserta los eventos para manipular los desplazamientos\r\n//\t\tvar a = find(\"//map/area[@onclick]\", XPList);\r\n//\t\tfor (var i = 0; i < a.snapshotLength; i++){\r\n//\t\t\tvar b = a.snapshotItem(i);\r\n//\t\t\tb.setAttribute(\"onclick\", '');\r\n//\t\t\tb.addEventListener(\"click\", createEventoMapa(i, b.href), 0);\r\n//\t\t\tb.href = 'javascript:void(0)';\r\n//\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Realiza un resumen de la pagina del mapa\r\n\t */\r\n\tfunction genMapTable(){\r\n\t\tif (get('tabla_mapa')) removeElement(get('tabla_mapa'));\r\n\r\n\t\tvar table = document.createElement('TABLE');\r\n\r\n\t\ttable.setAttribute(\"id\", \"tabla_mapa\");\r\n\t\ttable.setAttribute(\"sortCol\", -1);\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"align\", \"left\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\t\tvar thead = document.createElement(\"THEAD\");\r\n\t\tvar tbody = document.createElement(\"TBODY\");\r\n\t\tvar fila = document.createElement('TR');\r\n\t\tfila.setAttribute('class', \"rbg\");\r\n\t\tthead.appendChild(fila);\r\n\t\ttable.appendChild(thead);\r\n//\t\tvar etiquetas_tabla = [\"JUGADOR\", \"ALIANZA\", \"ALDEA\", \"HAB\", \"COORD\", \"ACCION\"];\r\n\t\tvar etiquetas_tabla = [\"JUGADOR\", \"ALIANZA\", \"ALDEA\", \"HAB\"];\r\n\t\tfor (var i = 0; i < etiquetas_tabla.length; i++){\r\n\t\t\tvar td = elem('TD', T(etiquetas_tabla[i]));\r\n\t\t\tif (i < 4){\r\n\t\t\t\tswitch(i){\r\n\t\t\t\t\tcase 3: td.addEventListener(\"click\", sortTable('tabla_mapa', i, 'int'), 0); break;\r\n\t\t\t\t\tdefault: td.addEventListener(\"click\", sortTable('tabla_mapa', i), 0);\r\n\t\t\t\t}\r\n\t\t\t\ttd.style.cursor = \"pointer\";\r\n\t\t\t}\r\n\t\t\tfila.appendChild(td);\r\n\t\t}\r\n\t\tvar datos = 0;\r\n\t\tvar area;\r\n\t\tfor(var i = 0; i < 7; i++)\r\n\t\t\tfor(var j = 0; j < 7; j++) {\r\n\t\t\t\tarea = document.getElementById('a_'+i+'_'+j).wrappedJSObject;//.getAttribute('details');//lmc.ad[i][j];\r\n\t\t\t\tvar cellinfo=area.details;\r\n//\t\t\t\tlog(1,'cellinfo i:'+i+' j:'+j+' x: '+cellinfo.x+' y: '+cellinfo.y);\r\n\t\t\t\tif (cellinfo && cellinfo.name !=null ) {\r\n\t\t\t\t\tdatos=1;\r\n\t\t\t\t\tvar inforow = document.createElement('TR');\r\n\t\t\t\t\tvar href=area.href;\r\n\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.name));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.ally));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href + '\">' + cellinfo.dname + '</a>'));\r\n\t\t\t\t\tinforow.appendChild(elem('TD', cellinfo.ew));\r\n\r\n//\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href + '\">' + cellinfo.x + \", \" + cellinfo.y + '</a>'));\r\n//\t\t\t\t\tinforow.appendChild(elem('TD', '<a href=\"' + href.replace(\"karte.php?d\", \"a2b.php?z\") + '\">' + T('ATACAR') + '</a> / <a href=\"' + href.replace(\"karte.php?d\", \"build.php?z\") + '&gid=17\">' + T('COMERCIAR') + '</a>'));\r\n\t\t\t\t\ttbody.appendChild(inforow);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\ttable.appendChild(tbody);\r\n\t\tif (datos == 1) {\r\n\r\n\t\t\tif (get('tabla_mapa_div')) {\r\n\t\t\t\tvar divt = get('tabla_mapa_div');\r\n\t\t\t} else {\r\n\t\t\t\tvar divt = document.createElement('DIV');\r\n\t\t\t\tdivt.style.display = 'block';\r\n\t\t\t\tdivt.style.position = 'absolute';\r\n\t\t\t\tdivt.id = 'tabla_mapa_div';\r\n\t\t\t\tdivt.style.top = 610 + longitudPantalla() + 'px';\r\n\t\t\t\tdocument.body.appendChild(divt);\r\n\t\t\t}\r\n\r\n\t\t\tdivt.appendChild(table);\r\n\r\n\t\t\tplayerLinks();\r\n\r\n//\t\t\tvar middleblock = get('lmidall');\r\n//\t\t\t//middleblock.appendChild(document.createElement('BR'));\r\n//\t\t\tmiddleblock.appendChild(table);\r\n\t\t}\r\n\t}\r\n\tfunction genMapInfoBlock() {\r\n\t\tvar mapinfo = get(\"map_info\");\r\n\t\tif (mapinfo) { removeElement(mapinfo); }\r\n\t\tvar firstpos=get(\"a_0_6\").href.match(/d=(\\d+)/).pop();\r\n//\t\tlog(1,\"mapfirstpos:\"+firstpos);\r\n\t\tmapinfo = document.createElement(\"div\");\r\n\t\tmapinfo.setAttribute(\"id\",\"map_info\");\r\n\t\tfor(var i=1;i<50;i++){\r\n\t\t\tvar divs=elem('div','<div id=\"map_info_'+i+'\" t=\"0\" style=\"position:relative;left:31px;top:48px;z-index: 90;border: solid 1px #00C000; background-color: #FEFFE3;-moz-border-radius: 8px; display: none\"></div>')\r\n\t\t\tdivs.className='mt'+i;\r\n\t\t\tdivs.setAttribute(\"style\",\"z-index: 2;\");\r\n\t\t\tmapinfo.appendChild(divs);\r\n\t\t}\r\n\t\tget(\"a_0_6\").parentNode.appendChild(mapinfo);\r\n\t\tif (storeurl!='') gmAjaxRequest(storeurl,\"POST\",\"cmd=mapget&namespace=\"+server+\"&pos=\"+firstpos,processMapGetResponse);\r\n\t}\r\n\r\n\t\tgenMapTable();\r\n\t\tdesplazarMapa();\r\n\t\tcrearTooltip();\r\n\t\tvar mapcontent=get('map_content');\r\n\t\tvar casillas = find(\"//div[@class='mdiv' and @style='z-index: 2;']/img\", XPList,mapcontent); // areatypeimage\r\n\t\tvar areas = find(\"//map//area[@shape='poly' and (@coords)]\", XPList,mapcontent);\r\n\t\tif (areas.snapshotLength>0) {\r\n\t\t\tgenMapInfoBlock();\r\n\r\n\t\t\tvar oasisdata='';\r\n\t\t\tfor (var i = 0; i < casillas.snapshotLength; i++){\r\n\t\t\t\tvar area = areas.snapshotItem(i);\r\n\t\t\t\tif (casillas.snapshotItem(i).src.match(/\\/o(\\d+)\\.gif/)){\r\n\t\t\t\t\tvar otype = casillas.snapshotItem(i).src.match(/\\/o(\\d+)\\.gif/).pop();\r\n\t\t\t\t\tif (otype && storeurl!='') {\r\n\t\t\t\t\t\tvar pos = area.href.match(/d=(\\d+)/).pop();\r\n\t\t\t\t\t\toasisdata+=\"&pos=\"+pos+\"&value=\"+(Number(otype)+10);\r\n//\t\t\t\t\t log(2,\"src[\"+i+\"] pos:\"+pos+\" type:\"+otype);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (storeurl!=''&&oasisdata!='') gmAjaxRequest(storeurl,\"POST\",\"cmd=mapset&namespace=\"+server+oasisdata,dummy);\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Funcion que realiza una peticion XML asincrona\r\n\t *\r\n\t * Params:\r\n\t *\turl: Direccion a la que realizar la peticion\r\n\t *\tmethod: Metodo de la peticion. Puede ser GET o POST\r\n\t *\tparam: Parametros codificados como URI (solo con POST, null si no se usan)\r\n\t *\tonSuccess: Funcion a invocar cuando se reciba el resultado\r\n\t *\tonFailure: Funcion a invocar si la peticion falla\r\n\t */\r\n\tfunction ajaxRequest(url, method, param, onSuccess, onFailure){\r\n\t\tvar xmlHttpRequest = new XMLHttpRequest();\r\n\t\txmlHttpRequest.onreadystatechange = function() {\r\n\t\t\tif (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200 && onSuccess != null) onSuccess(xmlHttpRequest);\r\n\t\t\telse if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status != 200 && onFailure != null) onFailure(xmlHttpRequest);\r\n\t\t};\r\n\t\txmlHttpRequest.open(method, url, true);\r\n\t\txmlHttpRequest.url = url;\r\n\t\tif (method == 'POST') xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\r\n\t\txmlHttpRequest.send(param);\r\n\t}\r\n\r\n\tfunction gmAjaxRequest(url, method, param, onSuccess){\r\n\t\tGM_xmlhttpRequest({ method: method,url: url, headers:{'Content-type':'application/x-www-form-urlencoded'},\r\n\t\tdata: param, onload: function(responseDetails) { onSuccess(responseDetails.responseText); }});\r\n\t}\r\n\r\n\t//导出短信息\r\n\tfunction archiveIGM(){\r\n\t\tvar a = find(\"//form[@name='msg']\", XPFirst);\r\n\t\t// Creates structure HTML of the pad\r\n\t\tvar table = document.createElement(\"TABLE\");\r\n\t\tvar row1 = document.createElement(\"TR\");\r\n\t\tvar row2 = document.createElement(\"TR\");\r\n\t\tvar row3 = document.createElement(\"TR\");\r\n\t\tvar cell1 = document.createElement(\"TD\");\r\n\t\tvar cell2 = document.createElement(\"TD\");\r\n\t\tvar cell3 = document.createElement(\"TD\");\r\n\t\tvar p = document.createElement(\"P\");\r\n\t\tvar textarea = elem(\"TEXTAREA\", \"\");\r\n\t\tvar input = document.createElement(\"INPUT\");\r\n\t\t//设定属性\r\n\t\ttable.setAttribute(\"class\", \"tbg\");\r\n\t\ttable.setAttribute(\"cellpadding\", \"2\");\r\n\t\ttable.setAttribute(\"cellspacing\", \"1\");\r\n\t\trow1.setAttribute(\"class\", \"rbg\");\r\n\t\tcell1.innerHTML = T('IGMOUTPUT');\r\n\t\ttextarea.setAttribute(\"name\", \"IGMoutput\");\r\n\t\ttextarea.setAttribute(\"rows\", \"12\");\r\n\t\ttextarea.setAttribute(\"style\", 'font-size: 10pt; width: 98%;overflow-x:none');\r\n\t\trow3.setAttribute(\"class\", \"rbg\");\r\n\t\tinput.setAttribute(\"type\", \"button\");\r\n\t\tinput.setAttribute(\"value\", T('IGMOUTPUT'));\r\n\t\tinput.addEventListener(\"click\", function(){ outputIGM(); }, 0);\r\n\r\n\t\trow1.appendChild(cell1);\r\n\t\tcell2.appendChild(textarea);\r\n\t\trow2.appendChild(cell2);\r\n\t\tcell3.appendChild(input);\r\n\t\trow3.appendChild(cell3);\r\n\t\ttable.appendChild(row1);\r\n\t\ttable.appendChild(row2);\r\n\t\ttable.appendChild(row3);\r\n\t\ta.parentNode.appendChild(p);\r\n\t\ta.parentNode.appendChild(table);\r\n\t}\r\n\r\n\tfunction getIGM(t){\r\n\t\tvar ans = document.createElement('DIV');\r\n\t\tans.innerHTML = t.responseText;\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\t\tvar igmsingle = '';\r\n\t\tigmsingle += T('IGMSENTER') + ':' + ansdoc.evaluate(\"//form[@action='nachrichten.php']//tr[2]/td[3]\", ans, null, XPFirst, null).singleNodeValue.textContent + '\\n';\r\n\t\tigmsingle += T('IGMTITLE') + ':' + ansdoc.evaluate(\"//form[@action='nachrichten.php']//tr[3]/td[2]\", ans, null, XPFirst, null).singleNodeValue.textContent + '\\n';\r\n\t\tigmsingle += T('IGMDATE') + ':' + ansdoc.evaluate(\"//form[@action='nachrichten.php']//tr[2]/td[4]\", ans, null, XPFirst, null).singleNodeValue.textContent + ',';\r\n\t\tigmsingle += T('IGMTIME') + ':' + ansdoc.evaluate(\"//form[@action='nachrichten.php']//tr[3]/td[3]\", ans, null, XPFirst, null).singleNodeValue.textContent + '\\n';\r\n\t\tigmsingle += ansdoc.evaluate(\"//form[@action='nachrichten.php']//tr[5]/td[2]\", ans, null, XPFirst, null).singleNodeValue.textContent;\r\n\t\tigmsingle += '\\n\\n==========\\n\\n';\r\n\t\t//return igmsingle;\r\n\t\tvar a = find(\"//textarea[@name='IGMoutput']\", XPFirst);\r\n\t\ta.value+=igmsingle;\r\n\t}\r\n\r\n\tfunction outputIGM(){\r\n\t\tvar igms = find(\"//form[@name='msg']//td[2]/a\", XPList);\r\n\t\tvar a = find(\"//textarea[@name='IGMoutput']\", XPFirst);\r\n\t\ta.value='';\r\n\r\n\t\tfor (var i = igms.snapshotLength -1; i >=0 ; i--){\r\n\t\t\tvar igmlink = igms.snapshotItem(i);\r\n\t\t\tajaxRequest(igmlink.href, \"GET\", null, getIGM, dummy);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction changeText(){\r\n\t\ttry{\r\n\t\t\teval('var text = text_' + language);\r\n\t\t\treemplazartextRecursivo(document.body, text);\r\n\t\t}catch(e){}\r\n\t}\r\n\r\n\t/**\r\n\t * Inserta un enlace y peticion bajo demanda de la ultima version disponible del script\r\n\t */\r\n\tfunction checkUpdate(){\r\n\t\tvar b = find(\"//div[@id='lmid2']\", XPFirst);\r\n\t\tvar div = document.createElement(\"DIV\");\r\n\t\tdiv.innerHTML = \"<b>Travian Beyond v\" + version + \"</b><br/>\";\r\n\t\tvar a = elem(\"T\",\"目前最新版本为 <img style='vertical-align: bottom;' src='http://www.denibol.com/proyectos/travian_beyond/version.php'/>\");\r\n\t\tvar div2 = document.createElement(\"DIV\");\r\n\t\tdiv2.appendChild(a);\r\n\t\tdiv.appendChild(div2);\r\n\t\tb.appendChild(div);\r\n\t}\r\n\r\n\tfunction mostrarVentas(){\r\n\t\tif (!find(\"//input[@type='hidden' and @name='t' and @value='2']\", XPFirst)) return;\r\n\t\tfind(\"//form\", XPFirst).setAttribute(\"name\", \"sell\");\r\n\r\n\t\tvar a = find(\"//input[@type='image' and @name='s1']\", XPFirst);\r\n\t\ta.addEventListener(\"click\", function(){\r\n\t\t\tvar param = [\"m1\", \"m2\", \"rid1\", \"rid2\", \"d2\"];\r\n\t\t\tvar checks = [\"d1\", \"ally\"];\r\n\t\t\tvar values = new Array();\r\n\t\t\tfor(var i = 0; i < param.length; i++) eval(\"values[\" + i + \"] = find(\\\"//*[@name='\" + param[i] + \"']\\\", XPFirst).value\");\r\n\t\t\tfor(var i = 0; i < checks.length; i++){\r\n\t\t\t\ttry{\r\n\t\t\t\t\teval(\"var b = find(\\\"//*[@name='\" + checks[i] + \"']\\\", XPFirst).checked\");\r\n\t\t\t\t\tif (b == true) values[i + param.length] = '1'; else values[i + param.length] = '0';\r\n\t\t\t\t}catch(e){}\r\n\t\t\t}\r\n\t\t\tagregarElementoCookie(\"ventas\", values);\r\n\t\t}, 0);\r\n\r\n\t\tvar ventas = obtenerValorCookie(\"ventas\");\r\n\t\tif (ventas.length > 0){\r\n\t\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\t\ttabla.setAttribute(\"id\", \"ventas\");\r\n\t\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\t\tvar tr = document.createElement(\"TR\");\r\n\t\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\t\tvar columnas = [T('OFREZCO'), T('BUSCO'), T('MAXTIME'), T('ALIANZA'), T('VENDER'), T('ELIMINAR')];\r\n\t\t\tfor (var i = 0; i < columnas.length; i++) tr.appendChild(elem(\"TD\", columnas[i]));\r\n\t\t\ttabla.appendChild(tr);\r\n\r\n\t\t\tfor (var i = 0; i < ventas.length; i++){\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\ttd = elem(\"TD\", '<img src=\"' + img('r/' + (ventas[i][2]) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (ventas[i][2])) + '\"> ' + ventas[i][0]); tr.appendChild(td);\r\n\t\t\t\ttd = elem(\"TD\", '<img src=\"' + img('r/' + (ventas[i][3]) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (ventas[i][3])) + '\"> ' + ventas[i][1]); tr.appendChild(td);\r\n\t\t\t\ttd = elem(\"TD\", ventas[i][5] == '1' ? ventas[i][4] : T('NO')); tr.appendChild(td);\r\n\t\t\t\ttd = elem(\"TD\", ventas[i][6] == '1' ? T('SI') : T('NO')); tr.appendChild(td);\r\n\r\n\t\t\t\ttd = elem(\"TD\", '<a href=\"javascript:void(0);\" onClick=\"sell.m1.value=' + ventas[i][0] + ';sell.m2.value=' + ventas[i][1] + ';sell.rid1.value=' + ventas[i][2] + ';sell.rid2.value=' + ventas[i][3] + ';sell.d2.value=' + ventas[i][4] + ';sell.d1.checked=' + (ventas[i][5] == '1') + (ventas[i][6] ? ';sell.ally.checked=' + (ventas[i][6] == '1') : '') + ';sell.submit();\"><img src=\"' + img('b/ok1.gif', true) + '\" title=\"' + T('VENDER') + '\" alt=\"' + T('VENDER') + '\" border=\"0\"></a>'); tr.appendChild(td);\r\n\t\t\t\ttabla.appendChild(tr);\r\n\r\n\r\n\t\t\t\tvar enlace = elem(\"A\", \" <img src='\" + img('a/del.gif') + \"' width='12' height='12' border='0' title='\" + T('ELIMINAR') + \"'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoEliminarCookie(\"ventas\", i, mostrarVentas), 0);\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\ttd.appendChild(enlace);\r\n\t\t\t\ttr.appendChild(td);;\r\n\t\t\t}\r\n\t\t\tinsertAfter(a, tabla);\r\n\t\t}\r\n\t}\r\n\r\n//\tfunction procesarAldea(t){\r\n//\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n//\t\tvar ans = elem(\"DIV\", t.responseText);\r\n//\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n//\t\tansdoc.appendChild(ans);\r\n//\r\n//\t\t// ID de aldea\r\n//\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n//\t\tvar did = RegExp.$1;\r\n//\t\tvar times = new Array();\r\n//\r\n//\t\t// Materias primas\r\n//\t\tvar a = '';\r\n//\t\tfor (var i = 1; i < 5; i++){\r\n//\t\t\tvar b = ansdoc.getElementById(\"l\" + (i));\r\n//\t\t\tvar perc = Math.round((b.innerHTML.split(\"/\")[0] * 100) / b.innerHTML.split(\"/\")[1]);\r\n//\t\t\tvar cant = b.innerHTML.split(\"/\")[0];\r\n//\t\t\t// Espero que la \"k\" sea internacional\r\n//\t\t\tif (cant % 1000 == 0) txt_cant = (cant / 1000) + \"k\"; else txt_cant = cant;\r\n//\t\t\tvar c = '';\r\n//\t\t\tc += '<img src=\"' + img('r/' + i + '.gif') + '\" border=\"0\" title=\"' + T('RECURSO' + i) + '\">';\r\n//\t\t\tc += '<span title=\"' + b.title + '\">' + (cant < 0 ? '<font color=\"#ff0000\">' + txt_cant + '</font>' : txt_cant) + '</span> <span style=\"font-size:9px; color:#909090\" title=\"' + b.innerHTML + '\">(' + perc + '%)</span>';\r\n//\t\t\ta += '<nobr>' + c + '</nobr>';\r\n//\t\t\tif (i != 4) a += \" | \";\r\n//\t\t}\r\n//\t\tfind(\"//td[@id='aldea\" + did + \"_0\" + \"']\", XPFirst).innerHTML = a;\r\n//\r\n//\t\t// Ataques\r\n//\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_1\" + \"']\", XPFirst);\r\n//\t\tvar a = ansdoc.evaluate(\"//div[@id='ltbw1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n//\t\tif (a){\r\n//\t\t\tvar a = a.firstChild;\r\n//\t\t\tvar b = new Array();\r\n//\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n//\t\t\t\tvar tr = a.childNodes[i];\r\n//\t\t\t\t// FIXME: Apanyo para FF. Firefox mete nodos vacios\r\n//\t\t\t\tvar error = (tr.childNodes.length == 5 ? false : true);\r\n//\t\t\t\ttimes.push(tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0]);\r\n//\t\t\t\tb[i] = '<nobr><a href=\"build.php?newdid=' + did + '&gid=16\" title=\"' + tr.childNodes[error ? 3 : 1].textContent.split(\" \")[1] + '\">' + tr.childNodes[error ? 1 : 0].firstChild.innerHTML + \"</a> <span id='timeouta'>\" + tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0] + '</span></nobr>';\r\n//\t\t\t}\r\n//\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n//\t\t}else casilla.innerHTML = '-';\r\n//\r\n//\t\t// Construcciones\r\n//\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_2\" + \"']\", XPFirst);\r\n//\t\tvar a = ansdoc.evaluate(\"//div[@id='lbau1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n//\t\tif (a){\r\n//\t\t\tvar b = new Array();\r\n//\t\t\tfor (var i = 0; i < a.firstChild.childNodes.length; i++){\r\n//\t\t\t\ttimes.push(a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0]);\r\n//\t\t\t\tb[i] = '<nobr><img src=\"' + img('a/bau.gif') + '\" title=\"' + a.firstChild.childNodes[i].childNodes[1].innerHTML + '\"/> <span id=\"timeouta\">' + a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0] + \"</span></nobr>\";\r\n//\t\t\t}\r\n//\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n//\t\t}else casilla.innerHTML = '-';\r\n//\r\n//\t\t// Tropas\r\n//\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_3\" + \"']\", XPFirst);\r\n//\t\tvar a = ansdoc.evaluate(\"//div[@id='ltrm']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue.firstChild;\r\n//\t\tif (a.firstChild.childNodes.length == 3){\r\n//\t\t\tvar b = new Array();\r\n//\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n//\t\t\t\tvar tr = a.childNodes[i];\r\n//\t\t\t\ttr.childNodes[0].firstChild.firstChild.setAttribute(\"title\", tr.childNodes[2].innerHTML);\r\n//\t\t\t\tb[i] = '<nobr>' + tr.childNodes[0].firstChild.innerHTML + tr.childNodes[1].innerHTML + '</nobr>';\r\n//\t\t\t}\r\n//\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n//\t\t}else casilla.innerHTML = '-';\r\n//\r\n//\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n//\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n//\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n//\r\n// // Auto Refresh\r\n//\t\tif (times.length > 0){\r\n//\t var time = Number.POSITIVE_INFINITY;\r\n// \t for (var i = 0; i < times.length; i++) {\r\n// \t times[i] = calcular_segundos(times[i]);\r\n// \tif (times[i] < time) time = times[i];\r\n//\t }\r\n// \t setTimeout(crearEventoActualizarAldea(did), 1000 * time);\r\n//\t\t}\r\n//\r\n//\t\t// FIXME: Firefox rendering bug\r\n//\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n//\t}\r\n\r\n\tfunction procesarAldea(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\tvar times = new Array();\r\n\r\n\t\t// Materias primas\r\n\t\tvar a = '';\r\n\t\tvar imgno = 1;\r\n\t\t/*修正显示相反的问题 */\r\n\t\tfor (var i = 4; i >= 1; i--){\r\n\r\n\t\t\tvar b = ansdoc.getElementById(\"l\" + (i));\r\n\t\t\tvar perc = Math.round((b.innerHTML.split(\"/\")[0] * 100) / b.innerHTML.split(\"/\")[1]);\r\n\t\t\tvar cant = b.innerHTML.split(\"/\")[0];\r\n\t\t\t// Espero que la \"k\" sea internacional\r\n\t\t\tif (cant % 1000 == 0) txt_cant = (cant / 1000) + \"k\"; else txt_cant = cant;\r\n\t\t\tvar c = '';\r\n\r\n\t\t\t/* TeYoU: 资源概况 dorf3.php */\r\n\t\t\tc += '<img src=\"' + img('r/' + imgno++ + '.gif') + '\" border=\"0\" title=\"' + T('RECURSO' + i) + '\">';\r\n\t\t\tc += '<span title=\"' + b.title + '\">' + (cant < 0 ? '<font color=\"#ff0000\">' + txt_cant + '</font>' : txt_cant) + '</span> <span style=\"font-size:9px; color:#909090\" title=\"' + b.innerHTML + '\">(' + perc + '%)</span>';\r\n\t\t\ta += '<nobr>' + c + '</nobr>';\r\n\t\t\tif (i != 4) a += \" | \";\r\n\t\t}\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_0\" + \"']\", XPFirst).innerHTML = a;\r\n\r\n\t\t// Ataques\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_1\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='ltbw1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar a = a.firstChild;\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n\t\t\t\tvar tr = a.childNodes[i];\r\n\t\t\t\t// FIXME: Apanyo para FF. Firefox mete nodos vacios\r\n\t\t\t\tvar error = (tr.childNodes.length == 5 ? false : true);\r\n\t\t\t\ttimes.push(tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0]);\r\n//\t\t\t\tb[i] = '<nobr><a href=\"build.php?newdid=' + did + '&gid=16\" title=\"' + tr.childNodes[error ? 3 : 1].textContent.split(\" \")[1] + '\">' + tr.childNodes[error ? 1 : 0].firstChild.innerHTML + \"</a> <span id='timeouta'>\" + tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0] + '</span></nobr>';\r\n\t\t\t\tb[i] = '<nobr><a href=\"build.php?newdid=' + did + '&gid=16\" title=\"' + tr.childNodes[error ? 3 : 1].textContent.split(\" \")[1] + '\">' + tr.childNodes[error ? 1 : 0].firstChild.innerHTML + \"</a> \"+ tr.childNodes[error ? 3 : 1].textContent+ ' ' + tr.childNodes[error ? 5 : 2].textContent + \" <span id='timeouta'>\" + tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0] + '</span></nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\t// Construcciones\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_2\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lbau1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.firstChild.childNodes.length; i++){\r\n\t\t\t\ttimes.push(a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0]);\r\n\t\t\t\tb[i] = '<nobr><img src=\"' + img('a/bau.gif') + '\" title=\"' + getInnerText(a.firstChild.childNodes[i].childNodes[1]) + '\"/> <span id=\"timeouta\" title=\"' + getInnerText(a.firstChild.childNodes[i].childNodes[1]) + '\">' + a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0] + \"</span></nobr>\";\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\t// Tropas\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_3\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='ltrm']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue.firstChild;\r\n\t\tif (a.firstChild.childNodes.length == 3){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n\t\t\t\tvar tr = a.childNodes[i];\r\n\t\t\t\ttr.childNodes[0].firstChild.firstChild.setAttribute(\"title\", tr.childNodes[2].innerHTML);\r\n\t\t\t\tb[i] = '<nobr>' + tr.childNodes[0].firstChild.innerHTML + tr.childNodes[1].innerHTML + '</nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n//\t\tswitchActiveVillage_list(did);\r\n\r\n\t\t// Auto Refresh\r\n\t\tif (times.length > 0){\r\n\t\t\t\t\tvar time = Number.POSITIVE_INFINITY;\r\n\t\t\t\t\tfor (var i = 0; i < times.length; i++) {\r\n\t\t\t\t\t\t\ttimes[i] = calcular_segundos(times[i]);\r\n\t\t\t\t\t\t\tif (times[i] < time) time = times[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//TeYoU: 注解自动更新\r\n\t\t\t\t\t//setTimeout(crearEventoActualizarAldea(did), 1000 * time);\r\n\t\t}\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction crearEventoActualizarAldea(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"dorf1.php?newdid=\" + did, \"GET\", null, procesarAldea,\r\n\t\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n//\tfunction resumenAldeas(){\r\n//\t\tif (plus) return;\r\n//\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n//\t\tif (!ba) return;\r\n//\r\n//\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n//\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n//\r\n//\t\tvar tabla = document.createElement(\"TABLE\");\r\n//\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n//\t\ttabla.setAttribute(\"align\", \"center\");\r\n//\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n//\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n//\r\n//\t\tvar tr = document.createElement(\"TR\");\r\n//\t\tvar td = elem(\"TD\", T('RESUMEN'));\r\n//\t\ttd.setAttribute(\"colspan\", \"3\");\r\n//\t\ttr.appendChild(td);\r\n//\t\ttr.setAttribute(\"class\", \"rbg\");\r\n//\t\ttabla.appendChild(tr);\r\n//\r\n//\t\tfor (var i = 0; i < aldeas.length; i++){\r\n//\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n//\t\t\t\tvar did = RegExp.$1;\r\n//\t\t\t\tvar tr = document.createElement(\"TR\");\r\n//\r\n//\t\t\t\tvar td = document.createElement(\"TD\");\r\n//\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" + img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n//\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n//\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea(did), 0);\r\n//\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n//\t\t\t\tnobr.appendChild(enlace);\r\n//\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n//\t\t\t\ttd.appendChild(nobr);\r\n//\t\t\t\ttd.setAttribute(\"rowspan\", \"2\");\r\n//\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n//\t\t\t\ttr.appendChild(td);\r\n//\r\n//\t\t\t\tfor (var j = 0; j < 4; j++){\r\n//\t\t\t\t\tif (j != 2 && j != 0) tr = document.createElement(\"TR\");\r\n//\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n//\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n//\t\t\t\t\ttd.setAttribute(\"align\", \"center\");\r\n//\t\t\t\t\tif (j != 1 && j != 2) td.setAttribute(\"width\", \"100%\");\r\n//\t\t\t\t\tif (j == 0) td.setAttribute(\"colspan\", \"2\");\r\n//\t\t\t\t\telse if(j == 3){\r\n//\t\t\t\t\t\ttd.setAttribute(\"colspan\", \"3\");\r\n//\t\t\t\t\t\ttd.setAttribute(\"style\", \"border-bottom-style: solid; border-bottom-width: thin\");\r\n//\t\t\t\t\t}\r\n//\t\t\t\t\ttr.appendChild(td);\r\n//\t\t\t\t\tif (j != 1) tabla.appendChild(tr);\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n//\t\t}\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t}\r\n\r\n\tfunction switchActiveVillage_list(currentActiveVillage) {\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + currentActiveVillage + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\t}\r\n\r\n\tfunction switchActiveVillage(did, surl, sw) {\r\n\t\tif(!isInt(did)) {return;\t}\r\n\r\n\t\tsurl = surl ? surl + '&newdid=' + did : \"dorf1.php?newdid=\"+did;\r\n\r\n\t//\tget(\"dorf1.php?newdid=\"+did, null, null);\r\n\t\tajaxRequest(surl, 'GET', null, (!sw ? null : function () {\r\n\t\t\tvar currentActiveVillage = getActiveVillage();\r\n\t\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\t\tfind(\"//a[contains(@href, '\" + currentActiveVillage + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\t\t}), null);\r\n\r\n\t\tif (sw) {\r\n\t\t\tajaxRequest(surl, 'GET', null, function () {\r\n\t\t\t\tvar currentActiveVillage = getActiveVillage();\r\n//\t\t\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n//\t\t\t\tfind(\"//a[contains(@href, '\" + currentActiveVillage + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n\t\t\t\tswitchActiveVillage_list(currentActiveVillage);\r\n\t\t\t}, null);\r\n\t\t} else {\r\n\t\t\tajaxRequest(surl, 'GET', null, null, null);\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tfunction isInt(x) {\r\n\t\tvar y = parseInt(x);\r\n\t\tif (isNaN(y)) {return false;}\r\n\t\treturn x==y && x.toString()==y.toString();\r\n\t}\r\n\r\n\t/** @return newdid of the currently selected village */\r\n\tfunction getActiveVillage() {\r\n\t\tvar oActiveLink = xpath(\"//a[@class='active_vl']\");\r\n\t\tif(oActiveLink.snapshotLength > 0) {\r\n\t\t\tvar sHref = oActiveLink.snapshotItem(0).href;\r\n\t\t\tvar aMatch = sHref.match(/newdid=([0-9]*)/i);\r\n\t\t\tif(!aMatch) {\r\n\t\t\t\treturn false;\r\n\t\t\t} else {\r\n\t\t\t\treturn aMatch[1];\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\t/** @return name of one of your one villages. */\r\n\tfunction getVillageName(iVillageDid) {\r\n\t\tif(iVillageDid == '' || iVillageDid == 'null') { //no village id\r\n\t\t\treturn '';\r\n\t\t}\r\n\t\tvar sVillageName = '';\r\n\t\tvar xpathResult = xpath(\"id('lright1')/table/tbody/tr/td/a[contains(@href, '\" +iVillageDid+ \"')]\");\r\n\t\tif(xpathResult.snapshotLength > 0) {\r\n\t\t\treturn xpathResult.snapshotItem(0).innerHTML;\r\n\t\t} else {\r\n\t\t\treturn 'unknown';\r\n\t\t}\r\n\t}\r\n\r\n\tfunction getElementsByClassName(oElm, strTagName, strClassName){ // searches the oElm for strTagName objects with strClassName class\r\n\t\tvar arrElements = (strTagName == \"*\" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);\r\n\r\n\t\tvar arrReturnElements = new Array();\r\n\t\tstrClassName = strClassName.replace(/\\-/g, \"\\\\-\");\r\n\t\tvar oRegExp = new RegExp(\"(^|\\\\s)\" + strClassName + \"(\\\\s|$)\");\r\n\t\tvar oElement;\r\n\t\tfor(var i=0; i<arrElements.length; i++){\r\n\t\t\toElement = arrElements[i];\r\n\t\t\tif(oRegExp.test(oElement.className)){\r\n\t\t\t\tarrReturnElements.push(oElement);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arrReturnElements;\r\n\t}\r\n\r\n\tfunction resumenAldeas(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * 整体检视页面 讯息 Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//自动点击\r\n\t\t\t\t\t\t\t\t\t\tvar j = 1;\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea(did,1), 1000 * 1);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tj++;\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\tvar currentActiveVillage = getActiveVillage();\r\n\t\t\t\t\t\t\t\t\t\tsetTimeout(switchActiveVillage(currentActiveVillage,'',1), (1000 * j));\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", T('RESUMEN'));\r\n\t\ttd2.setAttribute(\"colspan\", \"2\");\r\n\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: 概况黄色按钮\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" +/*灰色按钮 */ img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n//\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"javascript:void(0);\" onclick=\"crearEventoActualizarAldea(' + did + ');\">' + aldeas[i].innerHTML + '</a>'));\r\n\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"2\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n\t\t\t\t/* TeYoU: 产生资源概况 */\r\n\t\t\t\tfor (var j = 0; j < 4; j++){\r\n\t\t\t\t\tif (j != 2 && j != 0) tr = document.createElement(\"TR\");\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"center\");\r\n\t\t\t\t\tif (j != 1 && j != 2) td.setAttribute(\"width\", \"100%\");\r\n\t\t\t\t\tif (j == 0) td.setAttribute(\"colspan\", \"2\");\r\n\t\t\t\t\telse if(j == 3){\r\n\t\t\t\t\t\ttd.setAttribute(\"colspan\", \"3\");\r\n\t\t\t\t\t\ttd.setAttribute(\"style\", \"border-bottom-style: solid; border-bottom-width: thin\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 1) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\t}\r\n\r\n/** Tableau dépot */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\tfunction crearEventoActualizarAldea1(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"dorf1.php?newdid=\" + did, \"GET\", null, procesarArmazem,\r\n\t\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarArmazem(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\t// Materias primas\r\n\t\tvar a = ''; var c = 0;\tvar Tiempos = new Array(4);\r\n\t\tfor (var i = 4; i > 0; i--){\r\n\t\t\tvar b = ansdoc.getElementById(\"l\" + i);\r\n\t\t\tvar d = ansdoc.getElementById(\"l\" + i).title;\r\n\t\t\tvar perc = Math.round((b.innerHTML.split(\"/\")[0] * 100) / b.innerHTML.split(\"/\")[1]);\r\n\t\t\tvar perc1 = (b.innerHTML.split(\"/\")[0]);\r\n\t\t\tvar perc2 = (b.innerHTML.split(\"/\")[1]);\r\n\t\t\tvar neg = ''; var color= ''; var color1= '';\r\n\t\t\tif (perc > 60) {color = '<font color=orange>'; color1= '</font>';}\r\n\t\t\tif (perc > 90) {color = '<font color=red>'; color1= '</font>';}\r\n\t\t\tif (perc < 20) {color = '<font color=green>'; color1= '</font>';}\r\n\t\t\tif (d < 1) {neg = '<font color=red>'; color1= '</font>';}\r\n\t\t\ta = '<nobr><span title=\"' + b.innerHTML.split(\"/\")[0] + '/' + b.innerHTML.split(\"/\")[1] + ' + ' + d + '\"> <b>' + color + perc + '</b>%' + color1 + ' </span></nobr>';\r\n\t\t\tif (d < 0) var tiempo = Math.round((perc1 / -d)*3600);\r\n\t\t\t// Si la produccion es 0, el tiempo es infinito\r\n\t\t\telse if (d == 0) var tiempo = -1;\r\n\t\t\t// Si la produccion es negativa, se calcula el tiempo hasta el vaciado\r\n\t\t\telse var tiempo = Math.round(((perc2 - perc1) / d)*3600);\r\n\r\n\t\t\tTiempos[i]= tiempo;\r\n\t\t\tif (i > 1) {\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ c + \"']\", XPFirst).innerHTML = \ta;\r\n\t\t\t}\r\n\t\t\tc++;\r\n\t\t\tif (i == 2) {\r\n\t\t\t\tvar min = Tiempos[4];\r\n\t\t\t\tfor(j = 4; j > 1; j--){if(Tiempos[j] < min){\r\n\t\t\t\t\tmin = Tiempos[j];}\r\n\t\t\t\t}\r\n\t\t\t\tclock= \"<span id='timeouta'>\" + formatear_tiempo(min) + \"</span>\";\r\n\r\n\t\t\t\tvar tiempoRestante = \"\" + calculateHighlight (1, min, clock);\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 3 + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t\t}\r\n\r\n\t\t\tif (i == 1) {\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 4 + \"']\", XPFirst).innerHTML = \ta;\r\n\t\t\t\tvar tiempoRestante = neg + \"<span id='timeouta'>\" + formatear_tiempo(tiempo) + \"</span>\" + color1 ;\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 5 + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t\t}\r\n\r\n\t//\tfind(\"//td[@id='aldea\" + did + \"_\"+ c + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t}\r\n\t\t// Construcciones\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_6\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lbau1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.firstChild.childNodes.length; i++){\r\n\t\t\t\tb[i] = '<nobr><img src=\"' + img('a/bau.gif') + '\" title=\"' + a.firstChild.childNodes[i].childNodes[1].innerHTML + \" \" + a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0] + '\"></nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" \");\r\n\t\t} else casilla.innerHTML = '-';\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n//\t\tswitchActiveVillage_list(did);\r\n\r\n\t// setTimeout(crearEventoActualizarAldea3(did), 1000 * 10);\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas2(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea1(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\r\n\r\n//\t\tvar td2 = elem(\"TD\", \"<img src='img/un/r/1.gif'>\" + '</td><td>' + \"<img src='img/un/r/2.gif'>\" + '</td><td>' + \"<img src='img/un/r/3.gif'>\" + '</td><td>' + \"<img src='img/un/a/clock.gif'>\" + '</td><td>' + \"<img src='img/un/r/4.gif'>\" + '</td><td>' + \"<img src='img/un/a/clock.gif'>\" + '</td>');\r\n////\t\ttd2.setAttribute(\"colspan\", \"7\");\r\n//\t\ttr.appendChild(td2);\r\n\r\n\t\tvar td2 = elem(\"TD\", '');\r\n\t\ttd2.appendChild(FullRefresh);\r\n\t\ttr.appendChild(td2);\r\n\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/1.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/2.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/3.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('a/clock.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/4.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('a/clock.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", ''));\r\n\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" +/*Bouton gris */ img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea1(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 7; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 4) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\t}\r\n\r\n/** Tableau mini */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\tfunction crearEventoActualizarAldea2(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"dorf1.php?newdid=\" + did, \"GET\", null, procesarAldeaMini,\r\n\t\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\t\tfunction procesarAldeaMini(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\tvar times = new Array();\r\n\r\n\t\t// Ataques\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_0\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='ltbw1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (!a) var a = ansdoc.evaluate(\"//div[@id='ltbw0']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar a = a.firstChild;\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n\t\t\t\tvar tr = a.childNodes[i];\r\n\t\t\t\t// FIXME: Apanyo para FF. Firefox mete nodos vacios\r\n\t\t\t\tvar error = (tr.childNodes.length == 5 ? false : true);\r\n\t\t\t\ttimes.push(tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0]);\r\n\t\t\t\tb[i] = '<nobr><a href=\"build.php?newdid=' + did + '&gid=16\" title=\"' + tr.childNodes[error ? 3 : 1].textContent.split(\" \")[1] + '\">' + tr.childNodes[error ? 1 : 0].firstChild.innerHTML + \"</a> <span id='timeouta'>\" + tr.childNodes[error ? 9 : 4].textContent.split(\" \")[0] + '</span></nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\t// Construcciones\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_1\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lbau1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.firstChild.childNodes.length; i++){\r\n\t\t\t\ttimes.push(a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0]);\r\n\t\t\t\tb[i] = '<nobr><img src=\"' + img('a/bau.gif') + '\" title=\"' + a.firstChild.childNodes[i].childNodes[1].innerHTML + '\"/> <span id=\"timeouta\">' + a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0] + \"</span></nobr>\";\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\t// Tropas\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_2\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='ltrm']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue.firstChild;\r\n\t\tif (a.firstChild.childNodes.length == 3){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n\t\t\t\tvar tr = a.childNodes[i];\r\n\t\t\t\ttr.childNodes[0].firstChild.firstChild.setAttribute(\"title\", tr.childNodes[2].innerHTML +\" \"+tr.childNodes[1].innerHTML.split(\">\")[1].split(\"<\")[0]);\r\n\t\t\t\tb[i] = '<nobr>' + tr.childNodes[0].firstChild.innerHTML + '</nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\"\");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas3(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea2(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", T('ATT') + ' | ' + T('CONS') + ' | ' + T('TROP'));\r\n\t\ttd2.setAttribute(\"colspan\", \"7\");\r\n\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" +/*Bouton gris */ img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea2(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 3; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 3) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/** Tableau troupes */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\tfunction crearEventoActualizarAldea3(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"dorf1.php?newdid=\" + did, \"GET\", null, procesarTropas,\r\n\t\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarTropas(t){\r\n\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\t\tvar a = ''\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\t\tvar times = new Array();\r\n\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_0\" + \"']\", XPFirst).innerHTML = a;\r\n\t\t// Tropas complet\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_0\" + \"']\", XPFirst); //class=\"b f16\"\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='ltrm']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue.firstChild;\r\n\t\tif (a.firstChild.childNodes.length == 3){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.childNodes.length; i++){\r\n\t\t\t\tvar tr = a.childNodes[i];\r\n\t\t\t\ttr.childNodes[0].firstChild.firstChild.setAttribute(\"title\", tr.childNodes[2].innerHTML);\r\n\t\t\t\tb[i] = '<nobr>' + tr.childNodes[0].firstChild.innerHTML + '<span>' + tr.childNodes[1].innerHTML + '</nobr>';\r\n\t\t\t}\r\n\t\t\tcasilla.innerHTML = b.join(\" | \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_1\"+ \"']\", XPFirst).innerHTML = '<a href=\"build.php?gid=16&newdid=' + did + '\"><img src=\"img/un/a/b4.gif\" width=\"5\" ></a>';\r\n\r\n\t\t// céréale\r\n {\t\tvar a = '';\r\n\t\tfor (var i = 4; i < 5; i++){\r\n\t\t\tvar b = ansdoc.getElementById(\"l\" + (5-i));\r\n\t\t\tvar perc = Math.round((b.title.split(\"/\")[0] * 100) / b.title.split(\"/\")[1]);\r\n\t\t\tvar cant = b.innerHTML.split(\"/\")[0];\r\n\t\t\tvar color= '';\r\n\t\t\tif (b.title < 0) {color = '<font color=red>';}\r\n\t\t\tif (b.title > 0) {color = '<font color=gray>';}\r\n\t\t\tvar c = '';\r\n\t\t\tc += color + b.title ;\r\n\t\t\ta += '<nobr>' + c + '</nobr>';\r\n\t\t}\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_2\" + \"']\", XPFirst).innerHTML = a;\r\n\t}\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n\t\t// Auto Refresh\r\n\t\tif (times.length > 0){\r\n\t\t\t\t\tvar time = Number.POSITIVE_INFINITY;\r\n\t\t\t\t\tfor (var i = 0; i < times.length; i++) {\r\n\t\t\t\t\t\t\ttimes[i] = calcular_segundos(times[i]);\r\n\t\t\t\t\t\t\tif (times[i] < time) time = times[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//TeYoU: ??????\r\n\t\t\t\t\t//setTimeout(crearEventoActualizarAldea(did), 1000 * time);\r\n\t\t}\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\r\n\tfunction resumenAldeas4(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea3(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", T('TROP') + ' ' + T('IN') + ' ' + T('ALDEA'));\r\n\t\ttd2.setAttribute(\"colspan\", \"7\");\r\n\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" +/*Bouton gris */ img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea3(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 3; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 3) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/** Tableau ressource */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\r\n\tfunction crearEventoActualizarAldea5(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"dorf1.php?newdid=\" + did, \"GET\", null, procesarArmazembis,\r\n\t\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarArmazembis(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\t// Materias primas\r\n\t\tvar a = ''; var c = 0;\tvar Tiempos = new Array(4);\r\n\t\tfor (var i = 4; i > 0; i--){\r\n\t\t\tvar b = ansdoc.getElementById(\"l\" + i);\r\n\t\t\tvar d = ansdoc.getElementById(\"l\" + i).title;\r\n\t\t\tvar cant = b.innerHTML.split(\"/\")[0];\r\n\t\t\tif (cant % 1000 == 0) txt_cant = (cant / 1000) + \"k\"; else txt_cant = cant;\r\n\t\t\tvar perc = Math.round((b.innerHTML.split(\"/\")[0] * 100) / b.innerHTML.split(\"/\")[1]);\r\n\t\t\tvar perc1 = (b.innerHTML.split(\"/\")[0]);\r\n\t\t\tvar perc2 = (b.innerHTML.split(\"/\")[1]);\r\n\r\n\t\t\tvar neg = ''; var color= ''; var color1= '';\r\n\r\n//\t\t\tif (perc > 60) {color = '<font color=orange>'; color1= '</font>';}\r\n//\t\t\tif (perc > 90) {color = '<font color=red>'; color1= '</font>';}\r\n//\t\t\tif (perc < 20) {color = '<font color=green>'; color1= '</font>';}\r\n//\t\t\tif (d < 1) {neg = '<font color=red>'; color1= '</font>';}\r\n\r\n\t\t\tif (d < 0) var tiempo = Math.round((perc1 / -d)*3600);\r\n\t\t\t// Si la produccion es 0, el tiempo es infinito\r\n\t\t\telse if (d == 0) var tiempo = -1;\r\n\t\t\t// Si la produccion es negativa, se calcula el tiempo hasta el vaciado\r\n\t\t\telse var tiempo = Math.round(((perc2 - perc1) / d)*3600);\r\n\r\n\t\t\ta = '<nobr><span title=\"' + b.innerHTML.split(\"/\")[0] + '/' + b.innerHTML.split(\"/\")[1] + ' + ' + d + '\"> <b>' + calculateHighlight(d, tiempo, cant) + '</b>' + color1 + ' </span></nobr>';\r\n\r\n\t\t\tTiempos[i]= tiempo;\r\n\r\n\t\t\tif (i > 1) {find(\"//td[@id='aldea\" + did + \"_\"+ c + \"']\", XPFirst).innerHTML = \ta;}c++;\r\n\r\n\t\t\tif (i == 2) {\r\n\t\t\t\tvar min = Tiempos[4];\r\n\t\t\t\tfor(j = 4; j > 1; j--){\r\n\t\t\t\t\tif(Tiempos[j] < min){\r\n\t\t\t\t\t\tmin = Tiempos[j];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tclock= \"<span id='timeouta'>\" + formatear_tiempo(min) + \"</span>\";\r\n\r\n\t\t\t\tvar tiempoRestante = \"\" + calculateHighlight (1, min, clock);\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 3 + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t\t}\r\n\r\n\t\t\tif (i == 1) {\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 4 + \"']\", XPFirst).innerHTML = \ta;\r\n\t\t\t\tvar tiempoRestante = calculateHighlight(d, tiempo, \"<span id='timeouta'>\" + formatear_tiempo(tiempo) + \"</span>\") ;\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 5 + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t\t}\r\n\r\n\t//\tfind(\"//td[@id='aldea\" + did + \"_\"+ c + \"']\", XPFirst).innerHTML = tiempoRestante;\r\n\t\t}\r\n\t\t// Construcciones\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_6\" + \"']\", XPFirst);\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lbau1']//table[@class='f10']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\tif (a){\r\n\t\t\tvar b = new Array();\r\n\t\t\tfor (var i = 0; i < a.firstChild.childNodes.length; i++){\r\n\t\t\tb[i] = '<nobr><img src=\"' + img('a/bau.gif') + '\" title=\"' + a.firstChild.childNodes[i].childNodes[1].innerHTML + \" \" + a.firstChild.childNodes[i].childNodes[2].textContent.split(\" \")[0] + '\"></nobr>'; }\r\n\t\t\tcasilla.innerHTML = b.join(\" \");\r\n\t\t}else casilla.innerHTML = '-';\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='lright1']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n\t// setTimeout(crearEventoActualizarAldea3(did), 1000 * 10);\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas6(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea5(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\t\tvar td2 = elem(\"TD\", '');\r\n\t\ttd2.appendChild(FullRefresh);\r\n\t\ttr.appendChild(td2);\r\n\r\n//\t\tvar td2 = elem(\"TD\", \"<img src='img/un/r/1.gif'>\" + '</td><td>' + \"<img src='img/un/r/2.gif'>\" + '</td><td>' + \"<img src='img/un/r/3.gif'>\" + '</td><td>' + \"<img src='img/un/a/clock.gif'>\" + '</td><td>' + \"<img src='img/un/r/4.gif'>\" + '</td><td>' + \"<img src='img/un/a/clock.gif'>\" + '</td>');\r\n////\t\ttd2.setAttribute(\"colspan\", \"7\");\r\n//\t\ttr.appendChild(td2);\r\n\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"img/un/r/1.gif\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/2.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/3.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('a/clock.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('r/4.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", '<img src=\"' + img('a/clock.gif') + '\">'));\r\n\t\ttr.appendChild(elem(\"TD\", ''));\r\n\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" +/*Bouton gris */ img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea5(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 7; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 4) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/** Tableau PC sauf palais*/\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\r\n\tfunction crearEventoActualizarAldea4(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"build.php?newdid=\" + did + \"&gid=25&s=4\", \"GET\", null, procesarPC,\r\n\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarPC(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\t// info PC\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lmid2']//b\", ans, null, XPFirst, null).singleNodeValue;\r\n\r\n\t\tif (a == null) return;\r\n\r\n\t//\tif (a.snapshotLength != 5) return;\r\n\t\tvar lvl = a.innerHTML.split(T('LVL'))[1].split(\"</b>\")[0];\r\n\r\n\t\tvar b = ansdoc.evaluate(\"//table[@class='tbg']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\taldeis= b.innerHTML.split(\"(\").length;\r\n//\t\tgg = b.getElementsByTagName(\"A\").length;\r\n\r\n//\t\tif(gg>1) hehe = b.getElementsByTagName(\"A\")[1].innerHTML; else hehe = \"\";\r\n//\t\tif(gg>3) hehe1 = b.getElementsByTagName(\"A\")[3].innerHTML; else hehe1 = \"\";\r\n\r\n\t\t// Pontos Cultura\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 0 + \"']\", XPFirst).innerHTML = lvl;\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 1 + \"']\", XPFirst).innerHTML = (aldeis-1) + \"/\" + parseInt(lvl/10);\r\n//\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 3 + \"']\", XPFirst).innerHTML = hehe;\r\n//\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 4 + \"']\", XPFirst).innerHTML = hehe1;\r\n\r\n//\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 3 + \"']\", XPFirst).innerHTML = '';\r\n//\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 4 + \"']\", XPFirst).innerHTML = '';\r\n\r\n\t\tvar b = xpath(\"//table[@class='tbg']//a\", ans, ansdoc);\r\n\t\tif (b.snapshotLength) {\r\n\r\n\t\t\tget(\"aldea\" + did + \"_\"+ 3).innerHTML = '';\r\n\t\t\tget(\"aldea\" + did + \"_\"+ 3).appendChild(b.snapshotItem(1));\r\n\r\n\t\t\tif (b.snapshotLength >3) {\r\n\t\t\t\tget(\"aldea\" + did + \"_\"+ 4).innerHTML = '';\r\n\t\t\t\tget(\"aldea\" + did + \"_\"+ 4).appendChild(b.snapshotItem(3));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 2 + \"']\", XPFirst).innerHTML = '<a href=\"build.php?gid=25&newdid=' + did + '\"><img src=\"img/un/a/b4.gif\" width=\"5\" ></a>';\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='ba']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n//\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_1\" + \"']\", XPFirst);\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas5(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea4(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n//\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", '');\r\n\t\ttd2.appendChild(FullRefresh);\r\n\t\ttr.appendChild(td2);\r\n\r\n\t\ttr.appendChild(elem(\"TD\", T('LvL')));\r\n\t\ttr.appendChild(elem(\"TD\", T('Slot')));\r\n\t\ttr.appendChild(elem(\"TD\", ''));\r\n\t\ttr.appendChild(elem(\"TD\", T('EXT') + '1'));\r\n\t\ttr.appendChild(elem(\"TD\", T('EXT') + '2'));\r\n\r\n\r\n//\t\tvar td2 = elem(\"TD\", T('LvL') + ' | ' + T('Slot') + ' | ' + T('EXT') +'1' + ' | ' + T('EXT') +'2');\r\n//\t\ttd2.setAttribute(\"colspan\", \"5\");\r\n//\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" + img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea4(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 5; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 5) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/** Tableau petie fete */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\r\n\tfunction crearEventoActualizarAldea6(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"build.php?newdid=\" + did + \"&gid=24\", \"GET\", null, procesarPF,\r\n\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarPF(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\t// info lvl\r\n//\t\tvar a = ansdoc.evaluate(\"//div[@id='lmid2']//b\", ans, null, XPFirst, null).singleNodeValue;\r\n//\t\tvar a = ansdoc.evaluate(\"//form[@action='build.php']//a\", ans, null, XPFirst, null).singleNodeValue;\r\n\r\n\t\tvar xp = xpath('//h1', ans, ansdoc);\r\n\t\tif (xp.snapshotLength == 0) return;\r\n//\t var lvl = xp.snapshotItem(0).innerHTML.split(T('LVL'))[1].split(\"</b>\")[0];\r\n\r\n\t\tvar lvl = xp.snapshotItem(0).innerHTML.split(T('LVL'));\r\n\r\n\t\tif (lvl.length <= 1) return;\r\n\t\tlvl = lvl[1].split(\"</b>\")[0];\r\n\r\n\t\tif (!lvl) return;\r\n\r\n\t//\tif (a.snapshotLength != 5) return;\r\n//\t\tvar lvl = a.innerHTML.split(T('LVL'))[1].split(\"</b>\")[0];\r\n//\t\tvar b = ansdoc.evaluate(\"//table[@class='tbg']\", ans, null, XPFirst, null).singleNodeValue;\r\n//\t\taldeis= b.innerHTML.split(\"(\").length;\r\n//\r\n//\t\tgg = b.getElementsByTagName(\"A\").length;\r\n//\t\tif(gg>1) fete1 = b.getElementsByTagName(\"A\")[1].innerHTML; else fete1 = \"\";\r\n//\t\tif(gg>3) fete2 = b.getElementsByTagName(\"A\")[3].innerHTML; else fete2 = \"\";\r\n\r\n\t\tvar b = xpath(\"//form//table[@class='tbg']//table[@class='f10']//a\", ans, ansdoc);\r\n\t\tvar c = xpath(\"//form//table[@class='tbg']//td[@width='28%']\", ans, ansdoc);\r\n\r\n\t\t// Fete\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 0 + \"']\", XPFirst).innerHTML = lvl;\r\n\r\n\t\tif (c.snapshotLength) {\r\n\t\t\tfor(var i=0; i<c.snapshotLength; i++) {\r\n\t\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ (i+1) + \"']\", XPFirst).innerHTML = '<a href=\"build.php?gid=24&newdid=' + did + '\">' + getInnerText(c.snapshotItem(i)) + '</a>' ;\r\n\t\t\t}\r\n//\t\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 2 + \"']\", XPFirst).innerHTML = '<a href=\"build.php?gid=24&newdid=' + did + '\">' + getInnerText(c.snapshotItem(2)) + '</a>' ;\r\n\t\t}\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n//\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n//\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='ba']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n//\t\tswitchActiveVillage_list(did);\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tvar casilla = find(\"//td[@id='aldea\" + did + \"_1\" + \"']\", XPFirst);\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas7(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea6(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n//\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", '');\r\n\t\ttd2.appendChild(FullRefresh);\r\n\t\ttr.appendChild(td2);\r\n\r\n\t\ttr.appendChild(elem(\"TD\", T('LvL')));\r\n\t\ttr.appendChild(elem(\"TD\", T('FT1')));\r\n\t\ttr.appendChild(elem(\"TD\", T('FT2')));\r\n\r\n//\t\tvar td2 = elem(\"TD\", T('LvL') + ' | ' + T('FT1')+ ' | ' + T('FT2'));\r\n//\t\ttd2.setAttribute(\"colspan\", \"4\");\r\n//\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" + img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea6(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 3; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 3) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/** Tableau Manoir */\r\n/**---------------------------------------------------------------------------------------------------------------------------------------*/\r\n\r\n\r\n\tfunction crearEventoActualizarAldea7(did){\r\n\t\treturn function(){\r\n\t\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b3.gif');\r\n\t\t\tajaxRequest(\"build.php?newdid=\" + did + \"&gid=37&land\", \"GET\", null, procesarMA,\r\n\t\t\tfunction(){ find(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b4.gif'); }\r\n\t\t\t);\r\n\t\t};\r\n\t}\r\n\r\n\tfunction procesarMA(t){\r\n\t\t// Carga la pagina resultado en un arbol DOM para hacer busquedas por XPath\r\n\t\tvar ans = elem(\"DIV\", t.responseText);\r\n\t\tvar ansdoc = document.implementation.createDocument(\"\", \"\", null);\r\n\t\tansdoc.appendChild(ans);\r\n\r\n\t\t// ID de aldea\r\n\t\tansdoc.evaluate(\"//a[@class='active_vl']\", ans, null, XPFirst, null).singleNodeValue.getAttribute(\"href\").search(/\\?newdid=(\\d+)/);\r\n\t\tvar did = RegExp.$1;\r\n\r\n\t\t// info\r\n\t\tvar a = ansdoc.evaluate(\"//div[@id='lmid2']//b\", ans, null, XPFirst, null).singleNodeValue;\r\n\r\n\t//\tif (a.snapshotLength != 5) return;\r\n\t\tvar lvl = a.innerHTML.split(T('LVL'))[1].split(\"</b>\")[0];\r\n\r\n\t\tvar b = ansdoc.evaluate(\"//table[@class='tbg']\", ans, null, XPFirst, null).singleNodeValue;\r\n\t\taldeis= b.innerHTML.split(\"(\").length;\r\n\t\tgg = b.getElementsByTagName(\"A\").length;\r\n\r\n\t\tif(gg>1) hehe = b.getElementsByTagName(\"A\")[1].innerHTML; else hehe = \"\";\r\n\t\tif(gg>2) hehe1 = b.getElementsByTagName(\"A\")[2].innerHTML; else hehe1 = \"\";\r\n\t\tif(gg>3) hehe2 = b.getElementsByTagName(\"A\")[3].innerHTML; else hehe2 = \"\";\r\n\r\n\t\t// Pontos Cultura\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 0 + \"']\", XPFirst).innerHTML = lvl;\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 1 + \"']\", XPFirst).innerHTML = (aldeis-2) + \"/\" + parseInt(lvl/10);\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 2 + \"']\", XPFirst).innerHTML = '<a href=\"build.php?gid=37&newdid=' + did + '\"><img src=\"img/un/a/b4.gif\" width=\"5\" ></a>';\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 3 + \"']\", XPFirst).innerHTML = hehe;\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 4 + \"']\", XPFirst).innerHTML = hehe1;\r\n\t\tfind(\"//td[@id='aldea\" + did + \"_\"+ 5 + \"']\", XPFirst).innerHTML = hehe2;\r\n\r\n\t\tfind(\"//img[@id='aldea\" + did + \"_boton']\", XPFirst).src = img('a/b2.gif');\r\n\t\tfind(\"//span[@class='c2']\", XPFirst).removeAttribute(\"class\");\r\n\t\tfind(\"//a[contains(@href, '\" + did + \"') and ancestor::div[@id='ba']]\", XPFirst).parentNode.firstChild.className = 'c2';\r\n\r\n//\t\tswitchActiveVillage_list(did);\r\n\r\n\t\t// FIXME: Firefox rendering bug\r\n\t\tcasilla.parentNode.setAttribute(\"style\", \"width:100%\");\r\n\t}\r\n\r\n\tfunction resumenAldeas8(){\r\n//\t\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\tvar a = find(\"//div[@id='lmid2']\", XPFirst);\r\n\r\n\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\ttabla.setAttribute(\"class\", \"tbg\");\r\n\t\ttabla.setAttribute(\"align\", \"center\");\r\n\t\ttabla.setAttribute(\"cellspacing\", \"1\");\r\n\t\ttabla.setAttribute(\"cellpadding\", \"2\");\r\n\r\n\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t/**\r\n\t\t * TeYoU\r\n\t\t * Vue d'ensemble pages message Refresh\r\n\t\t */\r\n\t\tvar FullRefresh = elem(\"A\",T('REFRESH_INFORMARION'));\r\n\t\tFullRefresh.href=\"javascript:void(0);\";\r\n\t\tFullRefresh.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\t\t//Cliquez automatique\r\n\t\t\t\t\t\t\t\t\t\tvar aldeas = ba.getElementsByTagName(\"A\");\r\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\t\t\t\t\t\t\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetTimeout(crearEventoActualizarAldea7(did), 1000 * 1);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}, 0);\r\n\t\ttr.appendChild(FullRefresh);\r\n\r\n\t\tvar td2 = elem(\"TD\", T('LvL') + ' | ' + T('Slot') + ' | ' + T('EXT') +'1' + ' | ' +'2'+ ' | ' +'3');\r\n\t\ttd2.setAttribute(\"colspan\", \"6\");\r\n\t\ttr.appendChild(td2);\r\n\t\ttr.setAttribute(\"class\", \"rbg\");\r\n\t\ttabla.appendChild(tr);\r\n\r\n\t\tfor (var i = 0; i < aldeas.length; i++){\r\n\t\t\tif (aldeas[i].getAttribute(\"href\").search(/\\?newdid=(\\d+)/) >= 0){\r\n\t\t\t\tvar did = RegExp.$1;\r\n\t\t\t\tvar tr = document.createElement(\"TR\");\r\n\r\n\t\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\t\t//TeYoU: Vue d'ensemble bouton jaune\r\n\t\t\t\tvar enlace = elem(\"A\", \"<img src='\" + img('a/b5.gif') + \"' border='0' title='\" + T('ACTUALIZAR') + \"' id='aldea\" + did + \"_boton'>\");\r\n\t\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t\tenlace.addEventListener(\"click\", crearEventoActualizarAldea7(did), 0);\r\n\t\t\t\tvar nobr = document.createElement(\"NOBR\");\r\n\t\t\t\tnobr.appendChild(enlace);\r\n\t\t\t\tnobr.appendChild(elem(\"SPAN\", ' <a href=\"dorf1.php?newdid=' + did + '\">' + aldeas[i].innerHTML + '</a>'));\r\n\t\t\t\ttd.appendChild(nobr);\r\n\t\t\t\ttd.setAttribute(\"rowspan\", \"1\");\r\n\t\t\t\ttd.setAttribute(\"align\", \"left\");\r\n\t\t\t\ttr.appendChild(td);\r\n\r\n /* test*/\r\n\t\t\t\tfor (var j = 0; j < 6; j++){\r\n\t\t\t\t\ttd = elem(\"TD\", \"-\");\r\n\t\t\t\t\ttd.setAttribute(\"id\", \"aldea\" + did + \"_\" + j);\r\n\t\t\t\t\ttd.setAttribute(\"align\", \"Center\");\r\n\t\t\t\t\ttr.appendChild(td);\r\n\t\t\t\t\tif (j != 6) tabla.appendChild(tr);\r\n\t\t\t\t}\r\n\t\t}\r\n\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==true || posvilleinfo == null) {\r\n//\t\tif (a.firstChild) insertAfter(a.firstChild, tabla);\r\n//\t\telse a.appendChild(tabla);\r\n//\t\t}\r\n//\tposvilleinfo = readCookie(\"posvilleinfo\" + server);\r\n//\tif(posvilleinfo==false || posvilleinfo == null) {\r\n//\t\ta.appendChild(elem('p', ''));\r\n//\t\ta.appendChild(tabla);\r\n//\t\t}\r\n\r\n\t\ta.appendChild(elem('p', ''));\r\n\t\ta.appendChild(tabla);\r\n\r\n\t}\r\n\r\n/**\r\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n*/\r\n\r\n\t/**\r\n\t * Modifica el estilo del mensaje de borrado de cuenta para adaptarlo a los cambios que realiza el script\r\n\t */\r\n\tfunction borrarCuenta(){\r\n\t\tvar a = find(\"//p[parent::div[@id='lleft'] and @style]\", XPFirst);\r\n\t\tif (a){\r\n\t\t\tmoveElement(a, document.body);\r\n\t\t\ta.setAttribute(\"style\", \"position:absolute; display: block; padding: 4px; z-index: 2; border: solid 1px #00C000; background-color: #FEFFE3; width:130px; text-align:center; right:0px; top:0px;\");\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Agrega una nueva opcion en cualquier menu superior de opciones\r\n\t *\r\n\t * Params:\r\n\t *\ttexto: texto para colocar al final de menu\r\n\t */\r\n\tfunction opcionMenuSuperior(texto){\r\n\t\tvar a = find(\"//p[@class='txt_menue']\", XPFirst);\r\n\t\tif (a) {\r\n\t\t\ta.innerHTML += texto;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction opcionOcultaMensajes(){ if (!plus) opcionMenuSuperior(' | <a href=\"nachrichten.php?t=3\">' + T('ARCHIVE') + '</a>'); }\r\n\tfunction opcionOcultaInformes(){ if (!plus) opcionMenuSuperior(' | <a href=\"berichte.php?t=5\">' + T('ARCHIVE') + '</a>'); }\r\n\r\n\tfunction crearTemporizadorRecurso(i){\r\n\t\treturn function(){\r\n\t\t\t/*\r\n\t\t\t * Actualiza las cantidades restantes por cada tipo de recurso si corresponde hacerlo en este\r\n\t\t\t * ciclo de reloj segun la adaptacion de frecuencias anterior\r\n\t\t\t */\r\n\t\t\tvar recursos = find(\"//*[@id='timeout\" + i + \"']\", XPList);\r\n\t\t\tfor (var j = 0; j < recursos.snapshotLength; j++){\r\n\t\t\t\tvar cantidad = recursos.snapshotItem(j).innerHTML - 1;\r\n\t\t\t\tif (cantidad >= 0) {\r\n\t\t\t\t\trecursos.snapshotItem(j).innerHTML = cantidad;\r\n\t\t\t\t} else if (recursos.snapshotItem(j).getAttribute('noreload') != 1) {\r\n\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar tbodyNode = recursos.snapshotItem(j).parentNode.parentNode;\r\n\t\t\t\t\tif (tbodyNode.childNodes.length<=2) {\r\n\t\t\t\t\t\tvar resourceCellNode = tbodyNode.parentNode.parentNode;\r\n\t\t\t\t\t\tremoveElement(tbodyNode.parentNode);\r\n\t\t\t\t\t\tresourceCellNode.setAttribute('valign', 'center');\r\n\t\t\t\t\t\tresourceCellNode.innerHTML = T('SUBIR_NIVEL');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tremoveElement(recursos.snapshotItem(j).parentNode);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Crea el temporizador encargado de actualizar los nuevos relojes y las cantidades de recursos que faltan\r\n\t */\r\n\tfunction setTimers(){\r\n\t\t// Calcula cada cuantos segundos debe actualizar cada contador de recursos restantes para\r\n\t\t// aprovechar el temporizador del resto de relojes\r\n\t\tvar frecuencia = new Array(4);\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tfrecuencia[i] = (1 / produccion[i]) * 1000;\r\n\t\t\tif (!isFinite(frecuencia[i]) || frecuencia[i] < 0) frecuencia[i] = Number.POSITIVE_INFINITY;\r\n\t\t\t\t\t\tif (total[i] - actual[i] == 0) frecuencia[i] = Number.POSITIVE_INFINITY;\r\n\t\t\tsetInterval(crearTemporizadorRecurso(i), Math.floor(frecuencia[i]));\r\n\t\t}\r\n\r\n\t\tsetInterval(function () {\r\n\t\t\t/*\r\n\t\t\t * Se distinguen dos tipos de temporizadores, timeout y timeouta. Solo los primeros\r\n\t\t\t * provocan que la pagina se actualice al llegar a 0.\r\n\t\t\t */\r\n\t\t\tvar relojes = find(\"//*[@id='timeout' or @id='timeouta']\", XPList);\r\n\t\t\tfor (var i = 0; i < relojes.snapshotLength; i++){\r\n\t\t\t\tvar tiempo = calcular_segundos(relojes.snapshotItem(i).innerHTML) - 1;\r\n\t\t\t\tif (tiempo >= 0) relojes.snapshotItem(i).innerHTML = formatear_tiempo(tiempo);\r\n//\t\t\t\telse if (relojes.snapshotItem(i).id == 'timeout') document.location.reload();\r\n\t\t\t\telse if (relojes.snapshotItem(i).id == 'timeout' && relojes.snapshotItem(i).getAttribute('noreload') != 1) document.location.reload();\r\n\t\t\t}\r\n\t\t},1000);\r\n\r\n\t}\r\n\r\n\r\n\t//Create by Arrack 储存地点\r\n\tfunction MapaQuickSave(){\r\n\t\t// Intenta insertarlos en la lista derecha, si no existe la crea\r\n\t\t\tvar ba = find(\"//div[@class='map_details_actions']\", XPFirst);\r\n\r\n\t\t\tif (!ba) return;\r\n\r\n\t\t\t/*\r\n\t\t\tba.innerHTML.search(/\\?z=(\\d+)/);\r\n\t\t\tvar linkid = RegExp.$1;\r\n\t\t\t*/\r\n\t\t\tvar div = document.createElement(\"DIV\");\r\n\t\t\tvar enlace = elem(\"A\", T('SAVEMAPURL2'));\r\n\t\t\tvar tabla = document.createElement(\"TABLE\");\r\n\t\t\ttabla.setAttribute(\"class\", \"f10\");\r\n\t\t\tvar tr = document.createElement(\"TR\");\r\n\t\t\tvar td = document.createElement(\"TD\");\r\n\t\t\tenlace.href = \"javascript:void(0);\";\r\n\t\t\t// Al anyadir se pide el texto y el enlace, si se cancela o se deja vacio alguno se aborta\r\n\t\t\t// Despues de insertar se refresca la lista volviendola a insertar\r\n\t\t\tenlace.addEventListener(\"click\", function(){\r\n\t\t\t\t\t\t\t\t\tvar a = window.location;\r\n\t\t\t\t\t\t\t\t\tvar b = prompt(T('SAVEMAPURL1'));\r\n\t\t\t\t\t\t\t\t\tif (b == null || b == '' || b == 'undefined') return;\r\n\t\t\t\t\t\t\t\t\tagregarElementoCookie(\"marcadores\", [b, a]);\r\n\t\t\t\t\t\t\t\t\tremoveElement(find(\"//div[@id='marcadores']\", XPFirst));\r\n\t\t\t\t\t\t\t\t\tmostrarMarcadores();\r\n\t\t\t\t\t\t\t}, 0);\r\n\t\t\ttd.appendChild(enlace);\r\n\t\t\ttr.appendChild(td);\r\n\t\t\ttabla.appendChild(tr);\r\n\t\t\tdiv.appendChild(tabla);\r\n\t\t\tba.appendChild(div);\r\n\t}\r\n\r\n\tfunction getActiveVillageCoordZ() {\r\n\t\tvar activeVillageLink = xpathEvaluate('//a[@class=\"active_vl\"]/../../td/table/tbody/tr/td');\r\n\t\tvar coordXCurrentActiveVillage = -10000;\r\n\t\tvar coordYCurrentActiveVillage = -10000;\r\n\t\tif (activeVillageLink.snapshotLength > 0) {\r\n\t\t\tcoordXCurrentActiveVillage = parseInt(activeVillageLink.snapshotItem(0).innerHTML.replace(\"(\", \"\"));\r\n\t\t\tcoordYCurrentActiveVillage = parseInt(activeVillageLink.snapshotItem(2).innerHTML.replace(\")\", \"\"));\r\n\t\t}\r\n\t\treturn xy2id(coordXCurrentActiveVillage, coordYCurrentActiveVillage);\r\n\t}\r\n\r\n\tfunction createElemRadio (name, value, checked, enabled) {\r\n\t\tvar myRadioInput = document.createElement('input');\r\n\r\n\t\tmyRadioInput.type = 'radio';\r\n\t\tmyRadioInput.name = name;\r\n\t\tmyRadioInput.value = value;\r\n\r\n\t\tif (checked) {\r\n\t\t\tmyRadioInput.setAttribute('checked', 'checked');\r\n\t\t} else {\r\n\t\t\tmyRadioInput.removeAttribute('checked');\r\n\t\t}\r\n\r\n\t\treturn myRadioInput;\r\n\t}\r\n\r\n\tfunction createElemCheckbox (name, value, checked, enabled) {\r\n\t\tvar myRadioInput = document.createElement('input');\r\n\r\n\t\tmyRadioInput.type = 'checkbox';\r\n\t\tmyRadioInput.name = name;\r\n\t\tmyRadioInput.value = value;\r\n\r\n\t\tif (checked) {\r\n\t\t\tmyRadioInput.setAttribute('checked', 'checked');\r\n\t\t} else {\r\n//\t\t\tmyRadioInput.setAttribute('checked', '');\r\n//\t\t\tmyRadioInput.removeAttribute('checked');\r\n\t\t}\r\n\r\n\t\treturn myRadioInput;\r\n\t}\r\n\r\n\tfunction createElementAppend(newElementTag, parentElement, content, idt, idv, class) {\r\n//\t\tvar newElement = document.createElement(newElementTag);\r\n\t\tvar newElement = elem(newElementTag, content, idt, idv, class);\r\n\r\n\t\tparentElement.appendChild(newElement);\r\n\t\treturn newElement;\r\n\t}\r\n\r\n\tfunction createElemAppendAndSetInner(newElementTag, parentElement, innerHTM, idt, idv, class) {\r\n\t\tvar newElement = createElementAppend(newElementTag, parentElement);\r\n\t\tnewElement.innerHTML = innerHTM;\r\n\t\treturn newElement;\r\n\t}\r\n\r\n\t/** createElemTravianTable */\r\n\tfunction createElemTravianTable(tableTitle, tableParent, isTitleSingleCell) {\r\n\t\tvar table = createElementAppend('table', tableParent);\r\n\t\ttable.className = \"tbg\";\r\n\t\ttable.cellSpacing = \"1\";\r\n\t\ttable.cellPadding = \"2\";\r\n\r\n\t\tvar tbody = createElementAppend('tbody', table);\r\n\r\n\t\tvar tr = createElementAppend('tr', tbody);\r\n\t\ttr.className = \"rbg\";\r\n\r\n\t\tvar td = createElemAppendAndSetInner('td', tr, tableTitle);\r\n\r\n\t\tif (isTitleSingleCell) {\r\n\t\t\ttd.colSpan = \"0\";\r\n\t\t}\r\n\r\n\t\treturn tbody;\r\n\t}\r\n\r\n\t/** createElemTravianButton */\r\n\tfunction createElemTravianButton(buttonText, buttonParent, buttonId) {//, buttonEventListenerFunction) {\r\n\t\tvar button = document.createElement('input');\r\n\t\tbutton.type = \"button\";\r\n\t\tbutton.value = buttonText;\r\n\t\tbutton.id = buttonId;\r\n\t\tbutton.className = \"std\";\r\n\t//\tbutton.addEventListener('click',\tfunction() {buttonEventListenerFunction();}, true);\r\n\t\tbuttonParent.appendChild(button);\r\n\t\treturn button;\r\n\t}\r\n\r\n\t/**\r\n\t* createElemTravianCPTable\r\n\t*/\r\n\tfunction createElemTravianCPTable(tableParent, villagesText, cpText, currentTotalCPs, currentTotalCPsPerDay) {\r\n\t\tvar tbody = createElemTravianTable(villagesText, tableParent, false);\r\n\t\tcreateElemAppendAndSetInner('td', tbody.rows[0], cpText);\r\n\t\tcreateElemAppendAndSetInner('td', tbody.rows[0], '<img src=\"'+IMGS_CLOCK+'\"/>');\r\n\r\n\r\n\t\tvar cpArray;\r\n\t\tswitch (CONFIG_TRAVIAN_SERVER_TYPE) {\r\n\t\t\tcase DEF_TRAVIAN_SERVER_TYPE_2:\t\tcpArray = DEF_CP_TRAVIAN_2;\t\tbreak;\r\n\t\t\tcase DEF_TRAVIAN_SERVER_TYPE_3:\t\tcpArray = DEF_CP_TRAVIAN_3;\t\tbreak;\r\n\t\t\tcase DEF_TRAVIAN_SERVER_TYPE_SPEED:\tcpArray = DEF_CP_TRAVIAN_SPEED;\tbreak;\r\n\t\t\tdefault: debug(DBG_HIGHEST, \"[createElemTravianCPTable] ERROR: wrong CONFIG_TRAVIAN_SERVER_TYPE \" + CONFIG_TRAVIAN_SERVER_TYPE); break;\r\n\t\t}\r\n\r\n\r\n\t\tvar nextVillage = searchCPValue(currentTotalCPs, cpArray);\r\n\r\n\t\tvar numberOfVillages = xpathEvaluate('//div[@id=\"lright1\"]/table[1]/tbody/tr/td/a[contains(@href, \"newdid\")]').snapshotLength;\r\n\r\n\t\tvar villagesToBeBuiltWithCurrentCPs = (nextVillage-1) - numberOfVillages;\r\n\r\n\t\tif (villagesToBeBuiltWithCurrentCPs > 0) {\r\n\t\t\tcreateElemTravianCPTableRow(tbody, cpArray, numberOfVillages, currentTotalCPs, currentTotalCPsPerDay);\r\n\t\t\tif (villagesToBeBuiltWithCurrentCPs > 1) {\r\n\t\t\t\tcreateElemTravianCPTableRow(tbody, false, \"...\", currentTotalCPs, currentTotalCPsPerDay);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor(var i=0; i<3; i++) {\r\n\t\t\tcreateElemTravianCPTableRow(tbody, cpArray, nextVillage - 1 + i, currentTotalCPs, currentTotalCPsPerDay);\r\n\t\t}\r\n\t}\r\n\r\n\t/** createElemTravianCPTableRow */\r\n\tfunction createElemTravianCPTableRow(rowParent, cpArray, index, currentTotalCPs, currentTotalCPsPerDay) {\r\n\t\tvar tr = createElementAppend('tr', rowParent);\r\n\t\ttr.style.backgroundColor = \"palegreen\";\r\n\t\tvar td = createElemAppendAndSetInner('td', tr, index);\r\n\t\tvar timeToReachNextLevel = 0;\r\n\t\tif (cpArray) {\r\n\t\t\tvar cpValueOfLevel = \"?\";\r\n\t\t\tif (index < cpArray.length) {\r\n\t\t\t\tcpValueOfLevel = cpArray[index];\r\n\t\t\t\tif (cpValueOfLevel > currentTotalCPs) {\r\n\t\t\t\t\ttimeToReachNextLevel = (cpValueOfLevel - currentTotalCPs) / currentTotalCPsPerDay;\r\n\t\t\t\t\ttr.style.backgroundColor = \"lightpink\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar td = createElemAppendAndSetInner('td', tr, cpValueOfLevel);\r\n\t\t} else {\r\n\t\t\tvar td = createElemAppendAndSetInner('td', tr, \"...\");\r\n\t\t}\r\n\t\ttimeToReachNextLevel = timeInSecondsToColonSeparatedTxtWithDays(timeDaysToSeconds(timeToReachNextLevel));\r\n\t\tvar td = createElemAppendAndSetInner('td', tr, timeToReachNextLevel);\r\n\t\treturn tr;\r\n\t}\r\n\r\n\tfunction QP_addOwnTownTotalTroopsTable () {\r\n\t\tvar activeVillageCoordZ = getActiveVillageCoordZ();\r\n\r\n\t\tvar ownTroopsTables = xpathEvaluate('//div[@id=\"lmid2\"]/table/tbody/tr/td[1]/a[contains(@href, ' + activeVillageCoordZ + ')]/../../../..|//div[@id=\"lmid2\"]/p[@class=\"b f16\"]');\r\n\r\n\t\tif (ownTroopsTables.snapshotLength > 0) {\r\n\t\t\tvar newTable = ownTroopsTables.snapshotItem(0).cloneNode(true);\r\n\t\t\tvar newTableTitleRow = newTable.rows[0];\r\n\t\t\tvar newTableIconsRow = newTable.rows[1];\r\n\t\t\tvar newTableTroopsRow = newTable.rows[2];\r\n\t\t\tvar newTableCropRow = newTable.rows[3];\r\n\r\n\t\t\tnewTableIconsRow.cells[0].width = newTable.rows[0].cells[0].width;\r\n//\t\t\tnewTableCropRow.cells[0].width = newTable.rows[0].width;\r\n\r\n\t\t\tfor(var i=1, len=ownTroopsTables.snapshotLength; i<len; i++) {\t// table 0 is the cloned one above\r\n\t\t\t\tvar currentTable = ownTroopsTables.snapshotItem(i);\r\n\r\n\t\t\t\t// doesn't count on oasis to not double count\r\n\t\t\t\tif (currentTable.nodeName == \"P\") { break; }\r\n\r\n\t\t\t\tvar currentTroopsCells = xpathEvaluateInContext(currentTable, 'tbody/tr[3]').snapshotItem(0);\r\n\r\n\t\t\t\t// creates the hero column in case it wasn't in the \"totals\" table but the hero belongs to this town now\r\n\t\t\t\tif (currentTroopsCells.cells.length == 12) {\r\n\t\t\t\t\t// clone the hero icon cell\r\n\t\t\t\t\tvar currentTroopsHeroIconCell = xpathEvaluateInContext(currentTable, 'tbody/tr[2]/td[12]').snapshotItem(0);\r\n\t\t\t\t\tnewTableIconsRow.appendChild(currentTroopsHeroIconCell.cloneNode(true));\r\n\t\t\t\t\t// create the hero amount cell (with 0 amount, it will be added as normal)\r\n\t\t\t\t\tvar newHeroAmountCell = currentTroopsCells.cells[11].cloneNode(true);\r\n\t\t\t\t\tnewHeroAmountCell.innerHTML = 0;\r\n\t\t\t\t\tnewTableTroopsRow.appendChild(newHeroAmountCell);\r\n\r\n\t\t\t\t\tnewTableCropRow.cells[1].colSpan = 11;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// ADDS UP THE TROOPS\r\n\t\t\t\tfor(var j=1; j<currentTroopsCells.cells.length; j++) {\t// cell 0 has the word \"troops\"\r\n\t\t\t\t\tnewTableTroopsRow.cells[j].innerHTML = parseInt(newTableTroopsRow.cells[j].innerHTML) + parseInt(currentTroopsCells.cells[j].innerHTML);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar currentCropCells = xpathEvaluateInContext(currentTable, 'tbody/tr[4]').snapshotItem(0);\r\n\t\t\t\tnewTableCropRow.cells[1].innerHTML = parseInt(newTableCropRow.cells[1].textContent ? newTableCropRow.cells[1].textContent : newTableCropRow.cells[1].innerText) + parseInt(currentCropCells.cells[1].textContent ? currentCropCells.cells[1].textContent : currentCropCells.cells[1].innerText) ? parseInt(currentCropCells.cells[1].textContent ? currentCropCells.cells[1].textContent : currentCropCells.cells[1].innerText) : 0;\r\n\r\n\t\t\t}\r\n\t\t\t// make the totals 0s greyed out and the non-0s non-grayed out\r\n\t\t\tfor(var j=1; j<newTableTroopsRow.cells.length; j++) {\t// cell 0 has the word \"troops\"\r\n\t\t\t\tnewTableTroopsRow.cells[j].className = (newTableTroopsRow.cells[j].innerHTML == 0) ? \"c\" : \"\";\r\n\t\t\t}\r\n\t\t\t// change the title row\r\n\t\t\tvar newTableTitleCell = newTableTitleRow.cells[0];\r\n\t\t\tnewTableTitleRow.innerHTML = \"\";\r\n\t\t\tnewTableTitleRow.appendChild(newTableTitleCell);\r\n\t\t\tnewTableTitleCell.colSpan = 0;\r\n\t\t\t// remove all and re-insert the 1st 3 rows - removes the upkeep/arrival row\r\n\r\n\r\n\t\t\tnewTableCropRow.cells[1].innerHTML += ' <img class=\"res\" src=\"' + img('r/4.gif') + '\"> ' + T('HOURS');\r\n\r\n\t\t\tnewTable.innerHTML = \"\";\r\n\t\t\tnewTable.appendChild(newTableTitleRow);\r\n\t\t\tnewTable.appendChild(newTableIconsRow);\r\n\t\t\tnewTable.appendChild(newTableTroopsRow);\r\n\r\n\t\t\tnewTable.appendChild(newTableCropRow);\r\n\r\n\t\t\t// add the newly created table with the totals\r\n\t\t\tvar paragraph = xpathEvaluate('//div[@id=\"lmid2\"]/p[@class=\"f10\"]').snapshotItem(0);\r\n\t\t\tparagraph.parentNode.insertBefore(newTable, paragraph.nextSibling);\r\n\r\n\t\t\tvar igmlink2 = elem('p', \"<b>\" + T('addOwnTownTotalTroopsTable') + \"</b><p/>\");\r\n\r\n\t\t\tparagraph.parentNode.insertBefore(igmlink2, paragraph.nextSibling);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction resumomenu(){\r\n\t//\tif (plus) return;\r\n\t\tvar ba = find(\"//div[@id='lright1']\", XPFirst);\r\n\t\tif (!ba) return;\r\n\r\n\t\tif (plus) {\r\n\t\t\tvar a = find(\"//div[@id='lmid2']//p[@class='txt_menue']\", XPFirst);\r\n\r\n//\t\t\ta.appendChild(elem('span', ' | <a href=\"dorf3.php?s=0\">' + T(\"MINI\") + '</a>'));\r\n\r\n\t\t\ta.appendChild(elem('span', ' | <a href=\"dorf3.php?s=6\">' + T(\"TROP\") + '2</a>'));\r\n\t\t\ta.appendChild(elem('span', ' | <a href=\"dorf3.php?s=7\">' + T(\"FT\") + '</a>'));\r\n\t\t\ta.appendChild(elem('span', ' | <a href=\"dorf3.php?s=8\">' + T(\"MAN\") + '</a>'));\r\n\t\t} else {\r\n\t\t\tfind(\"//span[@class='c b']\", XPFirst).innerHTML = '<a href=\"dorf3.php?s=0\">' + T(\"MINI\") + '</a></span> | <a href=\"dorf3.php?s=2\">' + T(\"RESS\") + '</a>'; //</span> | <span class=\"c c\"><a href=\"dorf3.php?s=2\"> Prod. Trav+ </a>'; // ne rien mettre\r\n\t\t\tfind(\"//span[@class='c b']\", XPFirst).setAttribute(\"class\", \"c c\"); // ressources\r\n\t\t\tfind(\"//span[@class='c b']\", XPFirst).setAttribute(\"class\", \"c d\"); // Dépôt de ressource\r\n\t\t\tfind(\"//span[@class='c b']\", XPFirst).setAttribute(\"class\", \"c e\"); // PC\r\n\t\t\tfind(\"//span[@class='c b']\", XPFirst).setAttribute(\"class\", \"c f\"); // Troupes\r\n\r\n\t\t\tfind(\"//span[@class='c d']\", XPFirst).innerHTML = '<a href=\"dorf3.php?s=3\">' + T(\"DEP\") + '</a>';//</span> | <a href=\"dorf3.php?s=1\"> test2 </a></span> | <a href=\"dorf3.php?s=1\"> test3 </a></span> | <a href=\"dorf3.php?s=2\"> test4 </a>';\r\n\t\t\tfind(\"//span[@class='c e']\", XPFirst).innerHTML = '<a href=\"dorf3.php?s=4\">' + T(\"PC\") + '</a>';\r\n\t\t\tfind(\"//span[@class='c f']\", XPFirst).innerHTML = '<a href=\"dorf3.php?s=5\">' + T(\"TROP\") + '</a></span> | <span class=\"c f\"><a href=\"dorf3.php?s=7\">' + T(\"FT\") + '</a></span> | <span class=\"c f\"><a href=\"dorf3.php?s=8\">' + T(\"MAN\") + '</a></span>';\r\n\t\t}\r\n\r\n\t\ttabela = find(\"//table[@class='tbg']\", XPFirst).innerHTML;\r\n\t\t//find(\"//table[@class='tbg']\", XPFirst).innerHTML = '';\r\n\t\treturn tabela;\r\n\t}\r\n\r\n\tfunction preg_replace(search, replace, str) {\r\n\t\tvar len = search.length;\r\n\t\tfor(var i = 0; i < len; i++) {\r\n\t\t\tre = new RegExp(search[i], \"ig\");\r\n\t\t\tstr = str.replace(re, typeof replace == 'string' ? replace : (replace[i] ? replace[i] : replace[0]));\r\n\t\t}\r\n\t\treturn str;\r\n\t}\r\n\r\n\tfunction addslashes(str) {\r\n\t\treturn preg_replace(['\\\\\\\\', '\\\\\\'', '\\\\\\/', '\\\\\\(', '\\\\\\)', '\\\\\\[', '\\\\\\]', '\\\\\\{', '\\\\\\}', '\\\\\\^', '\\\\\\$', '\\\\\\?', '\\\\\\.', '\\\\\\*', '\\\\\\+', '\\\\\\|'], ['\\\\\\\\', '\\\\\\'', '\\\\/', '\\\\(', '\\\\)', '\\\\[', '\\\\]', '\\\\{', '\\\\}', '\\\\^', '\\\\$', '\\\\?', '\\\\.', '\\\\*', '\\\\+', '\\\\|'], str);\r\n\t}\r\n\r\n\tfunction splitN (a, c) {\r\n\t\tvar value = a.split(c);\r\n\r\n\t\tfor (var i=0; i<value.length; i++) {\r\n\t\t\tvalue[i] = parseInt(value[i]);\r\n\t\t}\r\n\r\n\t\treturn value;\r\n\t}\r\n\r\n\tfunction convertToBBLetters () {\r\n\t\tfunction parseBBCode(str, htmlon, allowlink, allowcoords) {\r\n//\t\t\tvar ret;\r\n//\t\t\tret=str;\r\n//\t\t\tret=ret.replace(/\\[b\\](.*?)\\[\\/b\\]/gi,'<span style=\"font-weight:bold\">$1</span>');\r\n//\t\t\tret=ret.replace(/\\[i\\](.*?)\\[\\/i\\]/gi,'<span style=\"font-style:italic\">$1</span>');\r\n//\t\t\tret=ret.replace(/\\[u\\](.*?)\\[\\/u\\]/gi,'<span style=\"text-decoration:underline\">$1</span>');\r\n//\t\t\tret=ret.replace(/\\[color=(.*?)\\](.*?)\\[\\/color\\]/gi,'<span style=\"color:$1\">$2</span>');\r\n\r\n\t\t\tvar ret = str;\r\n\r\n\t\t\tif (allowlink) {\r\n\t\t\t\tif (htmlon) {\r\n\t\t\t\t\tret=ret.replace(/(<br>|<br \\/>|\\b)[^'\\[\\\"]((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k){1}:\\/\\/[\\w\\.\\/\\?\\[&amp;|&\\]=\\$\\-_\\.\\+!\\*'\\(\\)]+)[^\\[\\\"'](\\r|<br>|<br \\/>|\\b|$)/gim, '$1<a href=\"$2\" _target=\"_blank\" title=\"$2\">$2</a>$4');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tret=ret.replace(/(<br>|<br \\/>|\\b)((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k){1}:\\/\\/[\\w\\.\\/\\?\\[&amp;|&\\]=\\$\\-_\\.\\+!\\*'\\(\\)]+)(<br>|<br \\/>|\\b|$)/gim, '$1<a href=\"$2\" _target=\"_blank\" title=\"$2\">$2</a>$4');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n//\t\t\tret= ret.replace(/(<br>|<br \\/>|\\b|$)(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k){1}:\\/\\/([^\\[\\\"']+?)(<br>|<br \\/>|\\b|$)/igm, '<a href=\"$2://$3\" target=\"_blank\" title=\"$2://$3\">$2://$3</a>');\r\n\r\n\t\t\tvar searcharray = [\r\n//\t\t\t\t'\\\\\\[b\\\\\\](.*?)\\\\\\[\\\\\\/b\\\\\\]'\r\n//\t\t\t\t, '\\\\\\[i\\\\\\](.*?)\\\\\\[\\\\\\/i\\\\\\]'\r\n//\t\t\t\t, '\\\\\\[u\\\\\\](.*?)\\\\\\[\\\\\\/u\\\\\\]'\r\n//\t\t\t\t, '\\\\\\[color=(.*?)\\\\\\]([^\\]co].*)\\\\\\[\\\\\\/color\\\\\\]'\r\n\r\n\r\n\t\t\t\t'\\\\\\[b\\\\\\]'\r\n\t\t\t\t, '\\\\\\[\\\\\\/b\\\\\\]'\r\n\r\n\t\t\t\t, '\\\\\\[i\\\\\\]'\r\n\t\t\t\t, '\\\\\\[\\\\\\/i\\\\\\]'\r\n\r\n\t\t\t\t, '\\\\\\[u\\\\\\]'\r\n\t\t\t\t, '\\\\\\[\\\\\\/u\\\\\\]'\r\n\r\n\t\t\t\t, '\\\\\\[color=([^\\\\\\[\\\\\\<]+?)\\\\\\]'\r\n\t\t\t\t, '\\\\\\[\\\\\\/color\\\\\\]'\r\n\r\n\t\t\t\t, '\\\\\\['+addslashes(T('total'))+'\\\\\\]'\r\n\t\t\t];\r\n\r\n\t\t\tvar replacearray = [\r\n//\t\t\t\t'<b style=\"font-weight:bold\">$1</b>'\r\n//\t\t\t\t, '<i style=\"font-style:italic\">$1</i>'\r\n//\t\t\t\t, '<u style=\"text-decoration:underline\">$1</u>'\r\n//\t\t\t\t, '<span style=\"color:$1\">$2</span>'\r\n\r\n\t\t\t\t'<b style=\"font-weight:bold\">'\r\n\t\t\t\t, '</b>'\r\n\r\n\t\t\t\t, '<i style=\"font-style:italic\">'\r\n\t\t\t\t, '</i>'\r\n\r\n\t\t\t\t, '<u style=\"text-decoration:underline\">'\r\n\t\t\t\t, '</u>'\r\n\r\n\t\t\t\t, '<font style=\"color:$1\">'\r\n\t\t\t\t, '</font>'\r\n\r\n\t\t\t\t, '<img src=\"' + imagenes[\"imgpackgo\"] + '\" title=\"' + T('total') + '\">'\r\n\t\t\t];\r\n\r\n\t\t\tret = preg_replace(searcharray, replacearray, ret);\r\n\r\n\t\t\tret= ret.replace(/\\[url=www.([^\\[\\\"']+?)\\](.+?)\\[\\/url\\]/ig, '<a href=\"http://www.$1\" target=\"_blank\" title=\"http://www.$1\">$2</a>');\r\n\t\t\tret= ret.replace(/\\[url\\]\\s*(www.|https?:\\/\\/|ftp:\\/\\/|gopher:\\/\\/|news:\\/\\/|telnet:\\/\\/|rtsp:\\/\\/|mms:\\/\\/|callto:\\/\\/|bctp:\\/\\/|ed2k:\\/\\/){1}([^\\[\\\"']+?)\\s*\\[\\/url\\]/ig, '<a href=\"$1://$2\" target=\"_blank\" title=\"$1://$2\">$3</a>');\r\n\r\n\t\t\tfor (var i=aLangTroops.length-1; i>=0; i--) {\r\n\t\t\t\tfor (var j=0; j<aLangTroops[i].length; j++) {\r\n\t\t\t\t\tret = preg_replace(['\\\\\\['+addslashes(aLangTroops[i][j])+'\\\\\\]'], ['<img src=\"' + img('u/'+(j < 10 ? (i*10+j+1) : 'hero')+'.gif') + '\" class=\"res\" title=\"' + aLangTroops[i][j] + '\">'], ret);\r\n\r\n//\t\t\t\t\talert('['+addslashes(aLangTroops[i][j])+'] = ' + img('u/'+(i*j+1)+'.gif' + ret));\r\n//\r\n//\t\t\t\t\treturn ret;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tfor (i=1; i<=4; i++) {\r\n\t\t\t\tret = preg_replace(['\\\\\\['+addslashes(T('RECURSO'+i))+'\\\\\\]'], ['<img src=\"' + img('r/'+i+'.gif') + '\" class=\"res\" title=\"' + T('RECURSO'+i) + '\">'], ret);\r\n\t\t\t}\r\n\r\n\t\t\tret = ret.replace(/\\[img\\]\\s*([^\\[\\<\\r\\n]+?)\\s*\\[\\/img\\]/ig, '<img src=\"$1\" border=\"0\" alt=\"\" />');\r\n\r\n\t\t\tif (allowcoords) {\r\n\t\t\t\tvar coords = ret.match(/([\\(]?)([ | ]?)(\\-?[0-9]{1,3})\\s?\\|\\s?(\\-?[0-9]{1,3})([ | ]?)([\\)]?)/gi);\r\n\r\n\t\t\t\tif (coords) {\r\n\t\t\t\t\tfor (var i=0; i<coords.length; i++) {\r\n\t\t\t\t\t\tcoords[i].match(/(\\-?[0-9]{1,3})\\s?\\|\\s?(\\-?[0-9]{1,3})/ig);\r\n\t\t\t\t\t\tvar x = RegExp.$1;\r\n\t\t\t\t\t\tvar y = RegExp.$2;\r\n\r\n\t\t\t\t\t\tif ( x > 400 || y > 400) continue;\r\n\r\n\t\t\t\t\t\tvar z = xy2id(x, y);\r\n\t\t\t\t\t\tif (coordsData[coords[i]]) continue;\r\n\r\n\t\t\t\t\t\tcoordsData[coords[i]] = z;\r\n\r\n\t\t\t\t\t\tret = ret.replace(coords[i]\r\n\t\t\t\t\t\t, '<span class=\"tb_coords\"> ( ' + x + ' | ' + y + ' ) </span>'\r\n\t\t\t\t\t\t+ '<a href=\"a2b.php?z=' + z + '\" target=\"_blank\"><img src=\"' + img(\"a/att_all.gif\") + '\" style=\"margin:3px 0px 1px 3px; display: inline\" height=\"10\" width=\"10\" border=\"0\"></a>'\r\n\t\t\t\t\t\t+ '<a href=\"build.php?z=' + z + '&gid=17\" target=\"_blank\">' + T('ALDEA_EXTRA2') + '</a>'\r\n\t\t\t\t\t\t+ '<a href=\"karte.php?z=' + z + '\" target=\"_blank\">' + T('ALDEA_EXTRA3') + '</a> '\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (!htmlon) ret = preg_replace(['\\t','(\\r\\n|\\n|\\r)'], [' ', '<br />'], ret);\r\n\t\t\tif (htmlon) ret = preg_replace(['&amp;', '&nbsp;', '&lt;', '&gt;'], ['&', ' ', '<', '>'], ret);\r\n\r\n//\t\t\tret=ret.replace(/\\[url\\](.*?)\\[\\/url\\]/gi,'<a href=\"$1\" target=\"_blank\">$1</a>');\r\n//\t\t\tret=ret.replace(/\\[url=(.*?)\\](.*?)\\[\\/url\\]/gi,'<a href=\"$1\" target=\"_blank\">$2</a>');\r\n//\t\t\tret=ret.replace(/\\[img\\](.*?)\\[\\/img\\]/gi,'<img src=\"$1\" />');\r\n//\t\t\tret=ret.replace(/(<br>|<br \\/>|\\b|^)((ftp|http|https|file):\\/\\/[\\w\\.\\/\\?&=\\$\\-_\\.\\+!\\*'\\(\\)]+)(<br>|<br \\/>|\\b|$)/gim, '$1<a href=\"$2\" target=\"_blank\">$2</a>$4');\r\n//\t\t\tcoords=ret.match(/\\W\\-?\\d+\\W\\-?\\d+\\W/gi);\r\n//\t\t\troot=\"http://\"+document.domain;\r\n//\t\t\tif (coords)\r\n//\t\t\t{\r\n//\t\t\t\tfor (i=0;i<coords.length;i++)\r\n//\t\t\t\t{\r\n//\t\t\t\t\tcurrent=coords[i];\r\n//\t\t\t\t\txs=current.replace(/\\W(\\-?\\d+)\\W(\\-?\\d+)\\W/gi,\"$1\");\r\n//\t\t\t\t\tys=current.replace(/\\W(\\-?\\d+)\\W(\\-?\\d+)\\W/gi,\"$2\");\r\n//\t\t\t\t\tx=parseInt(xs)-400;\r\n//\t\t\t\t\ty=400-parseInt(ys);\r\n//\t\t\t\t\tz=801*(y+1)+x;\r\n//\t\t\t\t\tret=ret.replace(current,current+'[<a href=\"'+root+'/a2b.php?z='+z+'\">T</a> '+\r\n//\t\t\t\t\t'<a href=\"'+root+'/build.php?z='+z+'&gid=17\">M</a> <a href=\"'+root+'/karte.php?z='+z+'\">C</a>]');\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n\t\t\treturn ret;\r\n\t\t}\r\n\r\n\t\tvar coordsData = new Array();\r\n\r\n\t\tvar OurArea = xpath(\"//form[@action='nachrichten.php']//td[@colspan='3']\");\r\n\r\n\t\tif (!OurArea.snapshotLength) OurArea = xpath(\"//table[@class='tbg']//div[@class='postbody']\");\r\n\r\n\t\tif (OurArea.snapshotLength) {\r\n\t\t\tvar useLinkification = getElementsByClassName(document, 'a', 'linkification-ext').length > 0 ? 1 : 0;\r\n\r\n\t\t\tvar allowlink = getOption(\"allowlink\", useLinkification ? false : true, \"boolean\");\r\n\t\t\tvar htmlon = getOption(\"htmlon\", useLinkification ? true : false, \"boolean\");\r\n\t\t\tvar allowcoords = getOption(\"allowcoords\", useLinkification ? false : true, \"boolean\");\r\n\r\n\t\t\tfor (var i = 0; i < OurArea.snapshotLength; i++) {\r\n\t\t\t\tvar LetterArea = OurArea.snapshotItem(i);\r\n\r\n//\t\t\t \tif (htmlon) {\r\n//\t\t\t\t\tLetterArea.innerHTML = parseBBCode(LetterArea.innerHTML, htmlon, allowlink, allowcoords);\r\n//\t\t\t\t} else {\r\n//\t\t\t \tLetterArea.innerHTML = parseBBCode(htmlon ? LetterArea.innerHTML : getInnerText(LetterArea), htmlon, allowlink, allowcoords);\r\n//\t\t\t }\r\n\r\n\t\t\t\tLetterArea.innerHTML = parseBBCode(htmlon ? LetterArea.innerHTML : getInnerText(LetterArea), htmlon, allowlink, allowcoords);\r\n\t\t\t}\r\n\r\n\t\t\tplayerLinks();\r\n\r\n\t\t\tvar a = find(\"//input[@type='image' and @name='s1']\", XPFirst);\r\n\r\n\t\t\tif (!a) {\r\n\t\t\t\ta = find(\"//table[@class='tbg']\", XPFirst);\r\n\r\n\t\t\t\tif (!a) return;\r\n\t\t\t};\r\n\r\n\t\t\tvar elel = elem('label', '');\r\n\r\n\t\t\tvar elec = createElemCheckbox('htmlon', 1, !htmlon);\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\telel.addEventListener('change', function(){\r\n\t\t\t\thtmlon = htmlon ? false : true;\r\n\r\n\t\t\t\tsetOption('htmlon', htmlon);\r\n\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t}, false);\r\n\r\n\t\t\tvar elec = elem('span', T('htmlon'));\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\tinsertAfter(a, elel);\r\n\r\n\r\n\t\t\tvar elel = elem('label', '');\r\n\r\n\t\t\tvar elec = createElemCheckbox('allowlink', 1, allowlink);\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\telel.addEventListener('change', function(){\r\n\t\t\t\tallowlink = allowlink ? false : true;\r\n\r\n\t\t\t\tsetOption('allowlink', allowlink);\r\n\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t}, false);\r\n\r\n\t\t\tvar elec = elem('span', T('allowlink'));\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\tinsertAfter(a, elel);\r\n\r\n\t\t\tvar elel = elem('label', '');\r\n\r\n\t\t\tvar elec = createElemCheckbox('allowcoords', 1, allowcoords);\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\telel.addEventListener('change', function(){\r\n\t\t\t\tallowcoords = allowcoords ? false : true;\r\n\r\n\t\t\t\tsetOption('allowcoords', allowcoords);\r\n\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t}, false);\r\n\r\n\t\t\tvar elec = elem('span', T('allowcoords'));\r\n\t\t\telel.appendChild(elec);\r\n\r\n\t\t\tinsertAfter(a, elel);\r\n\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tfunction _attachEvent(obj, evt, func) {\r\n\t\tif(obj.addEventListener) {\r\n\t\t\tobj.addEventListener(evt, func, false);\r\n\t\t} else if(obj.attachEvent) {\r\n\t\t\tobj.attachEvent(\"on\" + evt, func);\r\n\t\t}\r\n\t}\r\n\r\n\tfunction parseBattleAnalyse() {\r\n\r\n\t\tvar tab;\r\n\t\tvar warsim=0;\r\n\r\n\t\tvar worksave = 1;\r\n\t\tvar saveBeta = '';\r\n\r\n\t\tfunction mainBattleAnalyse(){\r\n\t\t\tif(readCookie('oazis')==undefined)createCookie('oazis','');\r\n\r\n\t\t\ttab=find(\"//table[@class='tbg']/tbody\",XPList);\r\n\t\t\tif (window.location.href.match(/warsim.php/)){\r\n\r\n\t\t\t\tif(find('//table[@class=\"f10\"]',XPList).snapshotLength>0){\r\n\t\t\t\t\tnn=find('//table[@class=\"f10\"]/tbody/tr/td[2]/div',XPList);\r\n\t\t\t\t\tif(nn.snapshotLength==0)return;\r\n\t\t\t\t\timgpa=elem('img');\r\n\t\t\t\t\timgpa.id='ba_imgp';\r\n\t\t\t\t\timgpa.src=imagenes[\"imgpaste\"];\r\n\t\t\t\t\timgpa.setAttribute('style', 'cursor:pointer');\r\n\t\t\t\t\timgpa.addEventListener('click',function (ev){\r\n\t\t\t\t\t\tvar mass=readCookie('oazis').split(',');\r\n\t\t\t\t\t\tif(document.getElementsByName('a2_'+mass[0]).length==0)return;\r\n\t\t\t\t\t\tfor(var i=1;i<11;i++){\r\n\t\t\t\t\t\t\tdocument.getElementsByName('a2_'+parseInt(30+i))[0].value=0;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tfor(var i=0;i<mass.length-1;i+=2){\r\n\t\t\t\t\t\t\tdocument.getElementsByName('a2_'+mass[i])[0].value=mass[i+1];\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t},false);\r\n\t\t\t\t\tnn.snapshotItem(0).childNodes[0].appendChild(imgpa);\r\n\t\t\t\t\tvar mass=readCookie('oazis').split(',');\r\n\t\t\t\t\tif(document.getElementsByName('a2_'+mass[0]).length==0){\r\n\t\t\t\t\t\timgpa.style.display='none';\r\n\t\t\t\t\t};\r\n\t\t\t\t};\r\n\t\t\t\tif(tab.snapshotLength<3)return;\r\n\t\t\t// Warsim\r\n\t\t\t\twarsim=1;\r\n\t\t\t// End Warsim\r\n\t\t\t}else{\r\n\t\t\t\tif(tab.snapshotItem(1)==undefined)return;\r\n\t\t\t\tif(tab.snapshotItem(1).parentNode.id=='MeXaon_ver_table')return;\r\n\t\t\t\tif(tab.snapshotItem(1).parentNode.getElementsByTagName(\"td\").length < 24)return;\r\n\t\t\t\tif(tab.snapshotItem(1).getElementsByTagName(\"td\")[0].textContent.charCodeAt(0)==160) return;\r\n\t\t\t\t// fix anchors\r\n\t\t\t\t\tvar fa = tab.snapshotItem(0).getElementsByTagName('a');\r\n\t\t\t\t\tfor( var i = 0; i < fa.length; i++) {\r\n\t\t\t\t\t\tfa[i].href = fa[i].href;\r\n\t\t\t\t\t}\r\n\t\t\t\t//\r\n\r\n\t\t\t\tif (worksave > 1) {\r\n\t\t\t\t\tsaveBeta =getInnerText(tab.snapshotItem(0));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsaveBeta ='<table><tbody>' + tab.snapshotItem(0).innerHTML + '</tbody></table>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\ttable=tab.snapshotItem(1-warsim).getElementsByTagName(\"td\");\r\n\t\t\tattacktable();\r\n\t\t\tfor(var i=(2-warsim);i<tab.snapshotLength;i++){\r\n\t\t\t\tif(tab.snapshotItem(i).parentNode.id!='MeXaon_ver_table'){\r\n\t\t\t\t\ttable=tab.snapshotItem(i).getElementsByTagName(\"td\");\r\n\t\t\t\t\tdeftable();\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tgeneratereport();\r\n\t\t}\r\n\r\n\t\tfunction attacktable(){\r\n\t\t\tvar statushero=0;\r\n\t\t\tvar statustrap=0;\r\n\t\t\tvar troops=0; //1-romans 2-teutons 3-gauls\r\n\t\t\tvar lostres=new Array(0,0,0,0);\r\n\t\t\tvar atstemp=new Array(0,0,0,0,0,0,0,0,0,0);\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/1.gif\")>0) troops=1;\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/11.gif\")>0) troops=2;\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/21.gif\")>0) troops=3;\r\n\t\t\tswitch (troops){\r\n\t\t\t\tcase 1:tm=romans;break;\r\n\t\t\t\tcase 2:tm=teutons;break;\r\n\t\t\t\tcase 3:tm=gauls;break;\r\n\t\t\t\tdefault:tm=null;break;\r\n\t\t\t}\r\n\t\t\tvar rescell=find(\"//tr[@class='cbg1']/td[@class='s7']\",XPFirst);\r\n\t\t\tif(tm!=null){\r\n\t\t\t\tif(table[13-warsim*2].innerHTML.indexOf(\"img\")>0) {statushero=1;ats[5]=1;}\r\n\t\t\t\tvar tda=14+statushero-warsim*2;\r\n\t\t\t\tvar tdl=25+statushero*2-warsim*2;\r\n\t\t\t\tvar tdt=0;\r\n\t\t\t\tif(!warsim&&(table.rows>4)){\r\n\t\t\t\t\tif(table[36+statushero*3].getAttribute('colspan')==null)tdt=36+statushero*3;\r\n\t\t\t\t}\r\n\t\t\t\tfor(var i=0;i<=(9+statushero);i++){\r\n\t\t\t\t\tatstemp[0]=atstemp[0]+table[tda+i].textContent*tm[i][0];\r\n\t\t\t\t\tlostres[0]=lostres[0]+table[tdl+i].textContent*tm[i][3];\r\n\t\t\t\t\tlostres[1]=lostres[1]+table[tdl+i].textContent*tm[i][4];\r\n\t\t\t\t\tlostres[2]=lostres[2]+table[tdl+i].textContent*tm[i][5];\r\n\t\t\t\t\tlostres[3]=lostres[3]+table[tdl+i].textContent*tm[i][6];\r\n\t\t\t\t\tatstemp[4]=atstemp[4]+table[tda+i].textContent*tm[i][7];\r\n\t\t\t\t\tatstemp[6]=atstemp[6]+table[tdl+i].textContent*tm[i][7];\r\n\t\t\t\t\tatstemp[8]=atstemp[8]+table[tda+i].textContent*tm[11][i]*tm[i][0];\r\n\t\t\t\t\tatstemp[9]=atstemp[9]+table[tda+i].textContent*tm[12][i]*tm[i][0];\r\n\t\t\t\t\tif(tdt!=0){\r\n\t\t\t\t\t\tatstemp[7]=atstemp[7]+table[tdt+i].textContent*tm[i][7];\r\n\t\t\t\t\t\tatstemp[3]=atstemp[3]+(table[tda+i].textContent-table[tdl+i].textContent-table[tdt+i].textContent)*tm[i][9];\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tatstemp[3]=atstemp[3]+(table[tda+i].textContent-table[tdl+i].textContent)*tm[i][9];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tatstemp[1]=lostres[0]+lostres[1]+lostres[2]+lostres[3];\r\n\t\t\t\tif (rescell!=null){\r\n\t\t\t\t\tres=rescell.textContent.split(\" \");\r\n\t\t\t\t\tatstemp[2]=parseInt(res[0])+parseInt(res[1])+parseInt(res[2])+parseInt(res[3]);\r\n//\t\t\t\t\trescell.appendChild(elem('span','<i><b> ('+atstemp[2]+')</b></i>', null, null, 'f8'));\r\n\r\n\t\t\t\t\trescell.innerHTML = '';\r\n\t\t\t\t\tfor(var i=0; i<4; i++) {\r\n\t\t\t\t\t\trescell.innerHTML += '<img src=\"'+img('r/'+(i+1)+'.gif')+'\" class=\"res\" title=\"' + T('RECURSO'+i) + '\"> '+res[i]+'&nbsp;';\r\n\t\t\t\t\t}\r\n\t\t\t\t\trescell.innerHTML = '' + rescell.innerHTML + ' <img src=\"'+imagenes[\"imgpackgo\"]+'\" title=\"'+T('total')+'\"> <i><b class=\"f8\">('+atstemp[2]+')</b></i>';\r\n\r\n\t\t\t\t}\r\n\t\t\t\tattHTML = '<img src=\"'+imagenes[\"imgatti\"]+'\" align=\"left\" height=\"15\" width=\"15\" style=\"padding-left: 3px\">&nbsp;<font class=\"f8\"><i>'+atstemp[8]+'</i></font><br>';\r\n\t\t\t\tattHTML += '<img src=\"'+imagenes[\"imgattc\"]+'\" align=\"left\" height=\"15\" width=\"15\" style=\"padding-left: 3px\">&nbsp;<font class=\"f8\"><i>'+atstemp[9]+'</i></font><br>';\r\n\t\t\t\tattHTML += '<img title=\"'+aLangBattleAnalyse[0]+'\" src=\"'+img('a/att_all.gif')+'\" align=\"left\" height=\"15\" width=\"15\" style=\"padding-left: 3px\">&nbsp;<font class=\"f8\"><i>'+atstemp[0]+'</i></font>';\r\n\t\t\t\ttable[2-warsim*2].innerHTML=attHTML;\r\n\t\t\t\trowi=elem(\"tr\");\r\n\t\t\t\tcell1=elem(\"td\");\r\n\t\t\t\tcell1.innerHTML='<font class=\"f8\"><i>'+aLangBattleAnalyse[1]+'</i></font>';\r\n\t\t\t\tcell2=elem(\"td\");\r\n\t\t\t\tcell2.setAttribute(\"align\",\"left\");\r\n\t\t\t\tcell2.setAttribute(\"colspan\",10+statushero);\r\n\r\n\t\t\t\tcell2.innerHTML = '';\r\n\r\n\t\t\t\tfor(var i=0; i<4; i++) {\r\n//\t\t\t\t\tcell2.innerHTML='<font class=\"f8\"><i><img src=\"'+img('r/1.gif')+'\" class=\"res\" title=\"' + T('RECURSO'+i) + '\">'+lostres[0]+'&nbsp;<img src=\"'+img('r/2.gif')+'\">'+lostres[1]+'&nbsp;<img src=\"'+img('r/3.gif')+'\">'+lostres[2]+'&nbsp;<img src=\"'+img('r/4.gif')+'\">'+lostres[3]+'&nbsp; <b>(-'+atstemp[1]+')</b></i></font>';\r\n\r\n\t\t\t\t\tcell2.innerHTML += '<img src=\"'+img('r/'+(i+1)+'.gif')+'\" class=\"res\" title=\"' + T('RECURSO'+(i+1)) + '\"> '+lostres[i]+'&nbsp;';\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcell2.innerHTML='<font class=\"f8\"><i>' + cell2.innerHTML + ' <img src=\"'+imagenes[\"imgpackgo\"]+'\" title=\"'+T('total')+'\"> <b>(-'+atstemp[1]+')</b></i></font>';\r\n\r\n\t\t\t\trowi.appendChild(cell1);\r\n\t\t\t\trowi.appendChild(cell2);\r\n\t\t\t\ttable[0].parentNode.parentNode.appendChild(rowi);\r\n\t\t\t};\r\n\t\t\tfor(var i=0;i<ats.length;i++){\r\n\t\t\t\tats[i]=ats[i]+atstemp[i];\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\tfunction deftable(){\r\n\t\t\tvar statushero=0;\r\n\t\t\tvar troops=0; //1-romans 2-teutons 3-gauls 4-nature\r\n\t\t\tvar lostres=new Array(0,0,0,0);\r\n\t\t\tvar dtstemp=new Array(0,0,0,0,0,0);\r\n\t\t\tvar lostEnable = 1\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/1.gif\")>0) troops=1;\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/11.gif\")>0) troops=2;\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/21.gif\")>0) troops=3;\r\n\t\t\tif(table[3-warsim*2].innerHTML.indexOf(\"u/31.gif\")>0) troops=4;\r\n\t\t\tswitch (troops){\r\n\t\t\t\tcase 1:tm=romans;break;\r\n\t\t\t\tcase 2:tm=teutons;break;\r\n\t\t\t\tcase 3:tm=gauls;break;\r\n\t\t\t\tcase 4:tm=nature;break;\r\n\t\t\t\tdefault:tm=null;break;\r\n\t\t\t}\r\n\t\t\tif(tm!=null){\r\n\t\t\t\tif(table[13].innerHTML.indexOf(\"img\")>0) {statushero=1;dts[4]=1;}\r\n\t\t\t\tvar tda=14+statushero-warsim*2;\r\n\t\t\t\tvar tdl=25+statushero*2-warsim*2;\r\n\t\t\t\tif (!table[tdl]) {\r\n\t\t\t\t\tlostEnable = 0;\r\n\t\t\t\t}\r\n\t\t\t\tfor(var i=0;i<=(9+statushero);i++){\r\n\t\t\t\t\tdtstemp[0]=dtstemp[0]+table[tda+i].textContent*tm[i][1];\t// def1\r\n\t\t\t\t\tdtstemp[1]=dtstemp[1]+table[tda+i].textContent*tm[i][2];\t// def2\r\n\t\t\t\t\tdtstemp[3]=dtstemp[3]+table[tda+i].textContent*tm[i][7];\r\n\t\t\t\t\tif (lostEnable){\r\n\t\t\t\t\t\tlostres[0]=lostres[0]+table[tdl+i].textContent*tm[i][3];\r\n\t\t\t\t\t\tlostres[1]=lostres[1]+table[tdl+i].textContent*tm[i][4];\r\n\t\t\t\t\t\tlostres[2]=lostres[2]+table[tdl+i].textContent*tm[i][5];\r\n\t\t\t\t\t\tlostres[3]=lostres[3]+table[tdl+i].textContent*tm[i][6];\r\n\t\t\t\t\t\tdtstemp[5]=dtstemp[5]+table[tdl+i].textContent*tm[i][7];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tdtstemp[2]=lostres[0]+lostres[1]+lostres[2]+lostres[3];\r\n\t\t\t\ttable[2-warsim*2].innerHTML='<img title=\"'+aLangBattleAnalyse[2]+'\" src=\"'+img('a/def_i.gif')+'\" align=\"absmiddle\" height=\"15\" width=\"15\">&nbsp;<font class=\"f8\"><i>'+dtstemp[0]+'</i></font><br><img title=\"'+aLangBattleAnalyse[3]+'\" src=\"'+img('a/def_c.gif')+'\" align=\"absmiddle\" height=\"15\" width=\"15\">&nbsp;<font class=\"f8\"><i>'+dtstemp[1]+'</i></font>';\r\n\t\t\trowi=elem(\"tr\");\r\n\t\t\tcell1=elem(\"td\");\r\n\t\t\tcell1.innerHTML='<font class=\"f8\"><i>'+aLangBattleAnalyse[1]+'</i></font>';\r\n\t\t\tcell2=elem(\"td\");\r\n\t\t\tcell2.setAttribute(\"align\",\"left\");\r\n\t\t\tcell2.setAttribute(\"colspan\",10+statushero);\r\n//\t\t\tcell2.innerHTML='<font class=\"f8\"><i><img src=\"'+img('r/1.gif')+'\">'+lostres[0]+'&nbsp;<img src=\"'+img('r/2.gif')+'\">'+lostres[1]+'&nbsp;<img src=\"'+img('r/3.gif')+'\">'+lostres[2]+'&nbsp;<img src=\"'+img('r/4.gif')+'\">'+lostres[3]+'&nbsp; <b>(-'+dtstemp[2]+')</b></i></font>';\r\n\r\n\t\t\tcell2.innerHTML = '';\r\n\t\t\tfor(var i=0; i<4; i++) {\r\n\t\t\t\tcell2.innerHTML += '<img src=\"'+img('r/'+(i+1)+'.gif')+'\" _class=\"res\" title=\"' + T('RECURSO'+(i+1)) + '\"> '+lostres[i]+'&nbsp;';\r\n\t\t\t}\r\n\r\n\t\t\tcell2.innerHTML='<font class=\"f8\"><i>'+cell2.innerHTML+' <img src=\"'+imagenes[\"imgpackgo\"]+'\" title=\"'+T('total')+'\"> <b>(-'+dtstemp[2]+')</b></i></font>';\r\n\r\n\t\t\trowi.appendChild(cell1);\r\n\t\t\trowi.appendChild(cell2);\r\n\t\t\ttable[0].parentNode.parentNode.appendChild(rowi);\r\n\t\t\t};\r\n\t\t\tfor(var i=0;i<dts.length;i++){\r\n\t\t\t\tdts[i]=dts[i]+dtstemp[i];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction generatereport(){\r\n\t\t\tif(ats[3]==0)ats[2]=0;\r\n\t\t\tvar lostA=ats[2]-ats[1];\r\n\t\t\tvar lostB=dts[2]+ats[2];\r\n\r\n\t\t\ttrep=elem(\"table\");\r\n\t\t\trow1=elem(\"tr\");\r\n\t\t\trow2=elem(\"tr\");\r\n\t\t\trow3=elem(\"tr\");\r\n\t\t\trow4=elem(\"tr\");\r\n\t\t\trow5=elem(\"tr\");\r\n\r\n\t\t\tcell=elem(\"td\");\r\n\t\t\tcell.appendChild(elem(\"b\",aLangBattleAnalyse[4], null, null, \"c1 b\"));\r\n\t\t\tcell.setAttribute(\"colspan\",\"5\");\r\n\t\t\trow1.className=\"cbg1\";\r\n\t\t\trow1.appendChild(cell);\r\n\r\n\t\t\tcell1=elem(\"td\");\r\n\t\t\tcell1.innerHTML=\"&nbsp;\";\r\n\t\t\tcell2=elem(\"td\");\r\n\t\t\tcell2.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[5]+\"</i>\", null, null, \"f8\"));\r\n\t\t\tcell3=elem(\"td\");\r\n\t\t\tcell3.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[6]+\"</i>\", null, null, \"f8\"));\r\n\t\t\tcell4=elem(\"td\");\r\n\t\t\tcell4.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[7]+\"</i>\", null, null, \"f8\"));\r\n\t\t\tcell5=elem(\"td\");\r\n\t\t\tcell5.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[8]+\"</i>\", null, null, \"f8\"));\r\n\t\t\trow2.appendChild(cell1);\r\n\t\t\trow2.appendChild(cell2);\r\n\t\t\trow2.appendChild(cell3);\r\n\t\t\trow2.appendChild(cell4);\r\n\t\t\trow2.appendChild(cell5);\r\n\r\n\t\t\tcell1=elem(\"td\");\r\n\t\t\tcell1.className=\"c2 b\";\r\n\t\t\tcell1.innerHTML=aLangBattleAnalyse[15];\r\n\t\t\tcell2=elem(\"td\");\r\n\t\t\tcell2.setAttribute(\"align\",\"right\");\r\n\t\t\tcell2.innerHTML=lostA+'*<img src=\"'+img('r/4.gif')+'\" title=\"'+aLangBattleAnalyse[9]+'\">';\r\n\t\t\tcell3=elem(\"td\");\r\n\t\t\tcell3.setAttribute(\"align\",\"right\");\r\n\t\t\tcell3.innerHTML=ats[4]+'*<img src=\"'+img('r/5.gif')+'\" title=\"'+aLangBattleAnalyse[10]+'\">';\r\n\t\t\tcell4=elem(\"td\");\r\n\t\t\tcell4.setAttribute(\"align\",\"right\");\r\n\t\t\tif(ats[5]==0){\r\n\t\t\t\t\tcell4.innerHTML='0*<img src=\"'+img('a/del.gif')+'\" title=\"'+aLangBattleAnalyse[11]+'\">';\r\n\t\t\t}else cell4.innerHTML=dts[5]+'*<img src=\"'+img('u/hero.gif')+'\" title=\"'+aLangBattleAnalyse[12]+'\">';\r\n\t\t\tcell5=elem(\"td\");\r\n\t\t\tcell5.setAttribute(\"align\",\"right\");\r\n\t\t\tcell5.setAttribute(\"rowspan\",\"2\");\r\n\t\t\tcell5.innerHTML=ats[2]+'*<img src=\"'+imagenes[\"imgpackgo\"]+'\" title=\"'+aLangBattleAnalyse[13]+'\"><br>'+ats[3]+'*<img src=\"'+imagenes[\"imgpack\"]+'\" title=\"'+aLangBattleAnalyse[14]+'\">';\r\n\t\t\trow3.appendChild(cell1);\r\n\t\t\trow3.appendChild(cell2);\r\n\t\t\trow3.appendChild(cell3);\r\n\t\t\trow3.appendChild(cell4);\r\n\t\t\trow3.appendChild(cell5);\r\n\r\n\t\t\tcell1=elem(\"td\");\r\n\t\t\tcell1.className=\"c1 b\";\r\n\t\t\tcell1.innerHTML=aLangBattleAnalyse[16];\r\n\t\t\tcell2=elem(\"td\");\r\n\t\t\tcell2.setAttribute(\"align\",\"right\");\r\n\t\t\tcell2.innerHTML=(-lostB)+'*<img src=\"'+img('r/4.gif')+'\" title=\"'+aLangBattleAnalyse[9]+'\">';\r\n\t\t\tcell3=elem(\"td\");\r\n\t\t\tcell3.setAttribute(\"align\",\"right\");\r\n\t\t\tcell3.innerHTML=dts[3]+'*<img src=\"'+img('r/5.gif')+'\" title=\"'+aLangBattleAnalyse[10]+'\">';\r\n\t\t\tcell4=elem(\"td\");\r\n\t\t\tcell4.setAttribute(\"align\",\"right\");\r\n\t\t\tif(dts[4]==0){\r\n\t\t\t\t\tcell4.innerHTML='0*<img src=\"'+img('a/del.gif')+'\" title=\"'+aLangBattleAnalyse[11]+'\">';\r\n\t\t\t}else cell4.innerHTML=ats[6]+'*<img src=\"'+img('u/hero.gif')+'\" title=\"'+aLangBattleAnalyse[12]+'\">';\r\n\t\t\trow4.appendChild(cell1);\r\n\t\t\trow4.appendChild(cell2);\r\n\t\t\trow4.appendChild(cell3);\r\n\t\t\trow4.appendChild(cell4);\r\n\r\n\t\t\tif (warsim != 1 && worksave >= 1) {\r\n\t\t\t\tvar travilogForm = elem(\"form\");\r\n\t\t\t\ttravilogForm.setAttribute('action', 'http://travilog.org.ua');\r\n\t\t\t\ttravilogForm.setAttribute('method', 'post');\r\n\t\t\t\ttravilogForm.setAttribute('target', 'tba_travilogIFrame');\r\n\t\t\t\ttravilogForm.setAttribute('id', 'tba_travilogForm');\r\n\r\n\t\t\t\t_attachEvent(travilogForm, 'submit', function() {\r\n\t\t\t\t\t$(\"tba_travilogIframeRow\").style.display = \"\";\r\n\t\t\t\t\t$(\"tba_travilogIframeRowDiv\").style.display = \"\";\r\n\t\t\t\t\t$(\"tba_travilogIFrameId\").style.display = \"none\";\r\n\t\t\t\t});\r\n\r\n\t\t\t\tvar data1 = elem(\"input\");\r\n\t\t\t\tdata1.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata1.setAttribute(\"name\", \"new_old\");\r\n\t\t\t\tdata1.setAttribute(\"value\", \"new\");\r\n\r\n\t\t\t\tvar data2 = elem(\"input\");\r\n\t\t\t\tdata2.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata2.setAttribute(\"name\", \"act\");\r\n\t\t\t\tdata2.setAttribute(\"value\", \"inputlog\");\r\n\r\n\t\t\t\tvar data3 = elem(\"input\");\r\n\t\t\t\tdata3.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata3.setAttribute(\"name\", \"server\");\r\n\t\t\t\tdata3.setAttribute(\"value\", \"\");\r\n\r\n\t\t\t\tvar data4 = elem(\"input\");\r\n\t\t\t\tdata4.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata4.setAttribute(\"name\", \"lng\");\r\n\t\t\t\tdata4.setAttribute(\"value\", idioma ? idioma : 'en');\r\n\r\n\t\t\t\tvar data5 = elem(\"input\");\r\n\t\t\t\tdata5.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata5.setAttribute(\"name\", \"tools\");\r\n\t\t\t\tdata5.setAttribute(\"value\", (worksave > 1 ? \"\" : \"tba\"));\r\n\r\n\t\t\t\tvar data6 = elem(\"input\");\r\n\t\t\t\tdata6.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata6.setAttribute(\"name\", \"GMT\");\r\n\t\t\t\tvar cd = new Date()\r\n\t\t\t\tdata6.setAttribute(\"value\", cd.getTimezoneOffset());\r\n\r\n\t\t\t\tvar data7 = elem(\"input\");\r\n\t\t\t\tdata7.setAttribute(\"type\", \"hidden\");\r\n\t\t\t\tdata7.setAttribute(\"name\", \"text\");\r\n\t\t\t\tdata7.value = saveBeta;\r\n\r\n\t\t\t\tvar button1 = elem(\"input\");\r\n\t\t\t\tbutton1.setAttribute(\"type\", \"submit\");\r\n\t\t\t\tbutton1.setAttribute(\"value\", T(\"savereport\"));\r\n\t\t\t\tbutton1.setAttribute(\"onclick\", \"document.getElementById('tba_travilogForm').submit()\");\r\n\r\n\t\t\t\tvar button2 = elem(\"input\");\r\n\t\t\t\tbutton2.setAttribute(\"type\", \"checkbox\");\r\n\t\t\t\tbutton2.setAttribute(\"name\", \"anonymous\");\r\n\t\t\t\tbutton2.setAttribute(\"value\", \"1\");\r\n\r\n\t\t\t\ttravilogForm.appendChild(data1);\r\n\t\t\t\ttravilogForm.appendChild(data2);\r\n\t\t\t\ttravilogForm.appendChild(data3);\r\n\t\t\t\ttravilogForm.appendChild(data4);\r\n\t\t\t\ttravilogForm.appendChild(data5);\r\n\t\t\t\ttravilogForm.appendChild(data6);\r\n\t\t\t\ttravilogForm.appendChild(data7);\r\n\t\t\t\ttravilogForm.appendChild(button1);\r\n\t\t\t\ttravilogForm.appendChild(button2);\r\n\t\t\t\ttravilogForm.appendChild(elem(\"span\", T(\"anonymize\")));\r\n\r\n\t\t\t\tvar travilogIFrame = elem(\"iframe\");\r\n\t\t\t\ttravilogIFrame.setAttribute('name', 'tba_travilogIFrame');\r\n\t\t\t\ttravilogIFrame.setAttribute('id', 'tba_travilogIFrameId');\r\n\r\n\t\t\t\t_attachEvent(travilogIFrame, 'load', function() {\r\n\t\t\t\t\t$(\"tba_travilogIFrameId\").style.display = \"\";\r\n\t\t\t\t\t$(\"tba_travilogIframeRowDiv\").style.display = \"none\";\r\n\t\t\t\t});\r\n\r\n\t\t\t\ttravilogIFrame.setAttribute('style', 'border: 0px; width: 100%; height: 7.5em');\r\n\t\t\t\ttravilogIFrame.innerHTML = \"Loading\";\r\n\r\n\t\t\t\tvar divLoading = elem('div');\r\n\t\t\t\tdivLoading.id = 'tba_travilogIframeRowDiv';\r\n\t\t\t\tdivLoading.innerHTML = \"<b>--= Loading =--</b>\";\r\n\r\n\t\t\t\tcell1 = elem(\"td\");\r\n\t\t\t\tcell1.setAttribute('colspan', '5');\r\n\t\t\t\tcell1.setAttribute('align', 'left');\r\n\t\t\t\tcell1.appendChild(travilogForm);\r\n\r\n\t\t\t\trow6=elem(\"tr\");\r\n\t\t\t\trow6.appendChild(cell1);\r\n\r\n\t\t\t\tcell1 = elem(\"td\");\r\n\t\t\t\tcell1.setAttribute('colspan', '5');\r\n\t\t//\t\tcell1.setAttribute('align', 'left');\r\n\t\t\t\tcell1.appendChild(divLoading);\r\n\t\t\t\tcell1.appendChild(travilogIFrame)\r\n\r\n\t\t\t\trow7=elem(\"tr\");\r\n\t\t\t\trow7.id = 'tba_travilogIframeRow';\r\n\t\t\t\trow7.style.display = 'none';\r\n\t\t\t\trow7.appendChild(cell1);\r\n\t\t\t}\r\n\r\n\r\n\t\t\ttrep.setAttribute(\"cellpadding\",\"2\");\r\n\t\t\ttrep.setAttribute(\"cellspacing\",\"1\");\r\n\t\t\ttrep.className=\"tbg\";\r\n\t\t\ttrep.appendChild(row1);\r\n\t\t\ttrep.appendChild(row2);\r\n\t\t\ttrep.appendChild(row3);\r\n\t\t\ttrep.appendChild(row4);\r\n\t\t\tif (warsim != 1 && worksave >= 1) {\r\n\t\t\t\ttrep.appendChild(row5);\r\n\t\t\t\ttrep.appendChild(row6);\r\n\t\t\t\ttrep.appendChild(row7);\r\n\t\t\t}\r\n\r\n\t\t\ttab.snapshotItem(0).getElementsByTagName(\"td\")[5].appendChild(elem(\"p\"));\r\n\t\t\tif(warsim==0){\r\n\t\t\t\ttab.snapshotItem(0).getElementsByTagName(\"td\")[5].appendChild(trep);\r\n\t\t\t}else{\r\n\t\t\t\ttab.snapshotItem(1).parentNode.parentNode.insertBefore(trep,tab.snapshotItem(1).parentNode.nextSibling);\r\n\t\t\t\ttab.snapshotItem(1).parentNode.parentNode.insertBefore(elem('p'),tab.snapshotItem(1).parentNode.nextSibling);\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tmainBattleAnalyse();\r\n\r\n\t}\r\n\r\n\tfunction genreporta2b(){\r\n\t\tvar trep=elem(\"table\");\r\n\t\tvar row1=elem(\"tr\");\r\n\t\tvar row2=elem(\"tr\");\r\n\t\tvar row3=elem(\"tr\");\r\n\r\n\t\tvar cell=elem(\"td\");\r\n\t\tcell.appendChild(elem(\"b\", aLangBattleAnalyse[4], null, null,\"c1 b\"));\r\n\t\tcell.setAttribute(\"colspan\",\"5\");\r\n\t\trow1.className=\"cbg1\";\r\n\t\trow1.appendChild(cell);\r\n\r\n\t\tvar cell1=elem(\"td\");\r\n\t\tcell1.style.width='60%';\r\n\t\tcell1.setAttribute('colspan','3');\r\n\t\tcell1.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[15]+\"</i>\", null, null, \"f8\"));\r\n\t\tvar cell3=elem(\"td\");\r\n\t\tcell3.style.width='20%';\r\n\t\tcell3.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[6]+\"</i>\", null, null, \"f8\"));\r\n\t\tvar cell5=elem(\"td\");\r\n\t\tcell5.style.width='20%';\r\n\t\tcell5.appendChild(elem(\"font\",\"<i>\"+aLangBattleAnalyse[8]+\"</i>\", null, null, \"f8\"));\r\n\t\trow2.appendChild(cell1);\r\n\t\trow2.appendChild(cell3);\r\n\t\trow2.appendChild(cell5);\r\n\r\n\t\tcell1=elem(\"td\");\r\n\t\tcell1.setAttribute(\"align\",\"right\");\r\n\t\tcell1.innerHTML='<span id=\"ats0\">'+ats[0]+'</span>*<img src=\"'+img('a/att_all.gif')+'\" title=\"'+aLangBattleAnalyse[0]+'\">';\r\n\t\tvar cell2=elem(\"td\");\r\n\t\tcell2.setAttribute(\"align\",\"right\");\r\n\t\tcell2.innerHTML='<span id=\"ats1\">'+ats[1]+'</span>*<img src=\"'+img('a/def_i.gif')+'\" title=\"'+aLangBattleAnalyse[2]+'\">';\r\n\t\tcell3=elem(\"td\");\r\n\t\tcell3.setAttribute(\"align\",\"right\");\r\n\t\tcell3.innerHTML='<span id=\"ats2\">'+ats[2]+'</span>*<img src=\"'+img('a/def_c.gif')+'\" title=\"'+aLangBattleAnalyse[3]+'\">';\r\n\t\tvar cell4=elem(\"td\");\r\n\t\tcell4.setAttribute(\"align\",\"right\");\r\n\t\tcell4.innerHTML='<span id=\"ats4\">'+ats[4]+'</span>*<img src=\"'+img('r/5.gif')+'\" title=\"'+aLangBattleAnalyse[10]+'\">';\r\n\t\tcell5=elem(\"td\");\r\n\t\tcell5.setAttribute(\"align\",\"right\");\r\n\t\tcell5.setAttribute(\"rowspan\",\"2\");\r\n\t\tcell5.innerHTML='<span id=\"ats3\">'+ats[3]+'</span>*<img src=\"'+imagenes[\"imgpack\"]+'\" title=\"'+aLangBattleAnalyse[14]+'\">';\r\n\t\trow3.appendChild(cell1);\r\n\t\trow3.appendChild(cell2);\r\n\t\trow3.appendChild(cell3);\r\n\t\trow3.appendChild(cell4);\r\n\t\trow3.appendChild(cell5);\r\n\r\n\t\ttrep.setAttribute(\"cellpadding\",\"2\");\r\n\t\ttrep.setAttribute(\"cellspacing\",\"1\");\r\n\t\ttrep.className=\"tbg\";\r\n\t\ttrep.appendChild(row1);\r\n\t\ttrep.appendChild(row2);\r\n\t\ttrep.appendChild(row3);\r\n\r\n\t\tvar t=find('//div[@id=\"lmid2\"]/form/table[@class=\"f10\"]',XPList);\r\n\t\tt.snapshotItem(0).parentNode.insertBefore(trep,t.snapshotItem(0));\r\n\t\tt.snapshotItem(0).parentNode.insertBefore(elem('p'),t.snapshotItem(0));\r\n\t}\r\n\r\n\tfunction a2b(){\r\n\t\tats=[0,0,0,0,0,0,0,0];\r\n\t\tvar list=find('//table[@class=\"p1\"]/tbody/tr/td/table[@class=\"f10\"]/tbody/tr/td/input',XPList);\r\n\t\tif(list.snapshotLength==0){alert('Error:Find Table,a2b');return;}\r\n\t\tif(list.snapshotItem(0).parentNode.parentNode.childNodes[1].innerHTML.indexOf(\"u/1.gif\")>0) troops=1;\r\n\t\tif(list.snapshotItem(0).parentNode.parentNode.childNodes[1].innerHTML.indexOf(\"u/11.gif\")>0) troops=2;\r\n\t\tif(list.snapshotItem(0).parentNode.parentNode.childNodes[1].innerHTML.indexOf(\"u/21.gif\")>0) troops=3;\r\n\t\tswitch (troops){\r\n\t\t\tcase 1:tm=romans;break;\r\n\t\t\tcase 2:tm=teutons;break;\r\n\t\t\tcase 3:tm=gauls;break;\r\n\t\t\tdefault:tm=null;break;\r\n\t\t}\r\n\t\tif(tm==null){alert('Error:Bad troops,a2b');return;}\r\n\t\tfor(var i=0;i<list.snapshotLength;i++){\r\n\t\t\tunit=parseInt(list.snapshotItem(i).getAttribute('name').match(/(\\d+)/).pop())-1;\r\n\t\t\tval=parseInt(list.snapshotItem(i).value);\r\n\t\t\tif(isNaN(val))val=0;\r\n\t\t\tats[0]=ats[0]+val*tm[unit][0];\t// attack\r\n\t\t\tats[1]=ats[1]+val*tm[unit][1];\t// def1\r\n\t\t\tats[2]=ats[2]+val*tm[unit][2];\t// def2\r\n\t\t\tats[3]=ats[3]+val*tm[unit][9];\t// load\r\n\t\t\tats[4]=ats[4]+val*tm[unit][7];\t// food\r\n\t\t}\r\n\t\teats0=$('ats0');\r\n\t\teats1=$('ats1');\r\n\t\teats2=$('ats2');\r\n\t\teats3=$('ats3');\r\n\t\teats4=$('ats4');\r\n\t\teats0.textContent=ats[0];\r\n\t\teats1.textContent=ats[1];\r\n\t\teats2.textContent=ats[2];\r\n\t\teats3.textContent=ats[3];\r\n\t\teats4.textContent=ats[4];\r\n\t};\r\n\r\n\tfunction kartec () {\r\n\t\tnn=$('pr');\r\n\t\tif(nn != null) {\r\n\t\t\timgc=elem('img');\r\n\t\t\timgc.src=imagenes[\"imgcopy\"];\r\n\t\t\timgc.id='tba_imgcopy';\r\n\t\t\timgc.setAttribute('style', 'cursor:pointer');\r\n\t\t\timgc.addEventListener('click',function(ev){\r\n\t\t\t\tvar str='';\r\n\t\t\t\tvar tdl=find('//div[@id=\"pr\"]/table/tbody/tr/td',XPList);\r\n\t\t\t\tvar race=parseInt(tdl.snapshotItem(0).firstChild.src.match(/u\\/(\\d+)/).pop()/10);\r\n\t\t\t\tfor(var i=0;i<tdl.snapshotLength;i+=3){\r\n\t\t\t\t\tut=parseInt(tdl.snapshotItem(i).firstChild.src.match(/u\\/(\\d+)/).pop());\r\n\t\t\t\t\tuc=parseInt(tdl.snapshotItem(i+1).innerHTML.match(/(\\d+)/).pop());\r\n\t\t\t\t\tstr=str+ut+','+uc+',';\r\n\t\t\t\t}\r\n\t\t\t\tcreateCookie('oazis',str);\r\n\t\t\t},false);\r\n\t\t\tnn.childNodes[1].appendChild(imgc);\r\n\t\t\toazicinfo();\r\n\t\t}\r\n\t}\r\n\r\n\tfunction oazicinfo(){\r\n\t\tvar m=[0,0,0,0];\r\n\t\tvar tdl=find('//div[@id=\"pr\"]/table/tbody/tr/td',XPList);\r\n\t\tif(tdl.snapshotItem(0).firstChild.src.match(/u\\/(\\d+)/)==undefined){\r\n\t\t\t$('tba_imgcopy').style.display='none';\r\n\t\t\treturn;\r\n\t\t};\r\n\t\tvar race=parseInt(tdl.snapshotItem(0).firstChild.src.match(/u\\/(\\d+)/).pop()/10)*10;\r\n\t\tfor(var i=0;i<tdl.snapshotLength;i+=3){\r\n\t\t\tut=parseInt(tdl.snapshotItem(i).firstChild.src.match(/u\\/(\\d+)/).pop())-race-1;\r\n\t\t\tuc=parseInt(tdl.snapshotItem(i+1).innerHTML.match(/(\\d+)/).pop());\r\n\t\t\tm[0]=m[0]+uc*nature[ut][0];\t//att\r\n\t\t\tm[1]=m[1]+uc*nature[ut][1];\t//def1\r\n\t\t\tm[2]=m[2]+uc*nature[ut][2]; //def2\r\n\t\t\tm[3]=m[3]+uc*nature[ut][7]; //food\r\n\t\t}\r\n\t\ttrep=elem(\"table\");\r\n\t\trow1=elem(\"tr\");\r\n\t\trow2=elem(\"tr\");\r\n\t\trow3=elem(\"tr\");\r\n\t\trow4=elem(\"tr\");\r\n\r\n\t\tcell1=elem(\"td\");\r\n\t\tcell1.setAttribute(\"align\",\"right\");\r\n\t\tcell1.innerHTML=+m[0]+'*<img src=\"'+img('a/att_all.gif')+'\" title=\"'+aLangBattleAnalyse[0]+'\">';\r\n\t\trow1.appendChild(cell1);\r\n\r\n\t\tcell1=elem(\"td\");\r\n\t\tcell1.setAttribute(\"align\",\"right\");\r\n\t\tcell1.innerHTML='<span id=\"ats1\">'+m[1]+'</span>*<img src=\"'+img('a/def_i.gif')+'\" title=\"'+aLangBattleAnalyse[2]+'\">';\r\n\t\trow2.appendChild(cell1);\r\n\r\n\t\tcell1=elem(\"td\");\r\n\t\tcell1.setAttribute(\"align\",\"right\");\r\n\t\tcell1.innerHTML='<span id=\"ats2\">'+m[2]+'</span>*<img src=\"'+img('a/def_c.gif')+'\" title=\"'+aLangBattleAnalyse[3]+'\">';\r\n\t\trow3.appendChild(cell1);\r\n\r\n\t\tcell1=elem(\"td\");\r\n\t\tcell1.setAttribute(\"align\",\"right\");\r\n\t\tcell1.innerHTML='<span id=\"ats4\">'+m[3]+'</span>*<img src=\"'+img('r/5.gif')+'\" title=\"'+aLangBattleAnalyse[10]+'\">';\r\n\t\trow4.appendChild(cell1);\r\n\r\n\t\ttrep.setAttribute(\"style\",\"width: 80%\");\r\n\t\ttrep.className=\"tbg\";\r\n\t\ttrep.appendChild(row1);\r\n\t\ttrep.appendChild(row2);\r\n\t\ttrep.appendChild(row3);\r\n\t\ttrep.appendChild(row4);\r\n\r\n\t\t$('pr').appendChild(trep);\r\n\t}\r\n\r\n//\tif (location.href.match(/karte2.php($|\\?z=)/)){\t\tdesplazarMapa(); return; }\r\n\r\n\t/* Acciones generales a todas las paginas */\r\n\r\n//\tgetGeneralData();\r\n\tsanearEnlaces();\r\n\thideAd();\r\n\tquickLinks();\r\n\tbuildingLinks();\r\n\tplayerLinks();\r\n\tcalculateFillTime();\r\n\tcityLinks();\r\n\tcrearTooltip();\r\n//\tcreateMenu();\r\n\tborrarCuenta();\r\n\tconfirmDelete();\r\n\r\n\r\n\t/* Acciones especificas para algunas paginas */\r\n\tif (location.href.indexOf('build.php?') != -1){\t\tquickCity(); recursosMercado(); tiempoExplorarUnidades(); tiempoExplorar(); QP_addOwnTownTotalTroopsTable(); }\r\n\tif (location.href.indexOf('build.php') != -1){ \t\tcalculateBuildTime(); tiempoExplorarUnidades(); tiempoExplorar(); mostrarVentas(); }\r\n\tif (location.href.indexOf('dorf1') != -1)\t\tpreCalculate1();\r\n\tif (location.href.indexOf('dorf2') != -1)\t\tpreCalculate2();\r\n//\tif (location.href.indexOf('berichte.php?id=') != -1)\treportBatalla();\r\n\tif (location.href.indexOf('a2b.php') != -1){\r\n\t\tquickCity();\r\n\t\tataqueDefecto();\r\n\r\n\t\t// Travian: Battle Analyse\r\n\t\tgenreporta2b();\r\n\t\tdocument.addEventListener('keyup',a2b,false);\r\n\t\tdocument.addEventListener('click',a2b,false);\r\n\t\t// Travian: Battle Analyse\r\n\t}\r\n\tif (location.href.indexOf('nachrichten.php') != -1)\t{\r\n\t\topcionOcultaMensajes();\r\n\r\n\t\tif (location.href.match(/nachrichten.php\\?(.*&)?id=/) && location.href.indexOf('nachrichten.php?t=1') <= 0) convertToBBLetters();\r\n\t}\r\n\r\n\tif (location.href.match(/allianz.php\\?(.*&)?s=2&aid=(\\d+)&tid=(\\d+)/)) convertToBBLetters();\r\n\r\n\tif (location.href.indexOf('berichte.php') != -1)\t{ opcionOcultaInformes(); }\r\n//\tif (location.href.match(/dorf3.php($|\\?newdid=(\\d+)$)/)) resumenAldeas();\r\n\r\n\r\n\tif (location.href.match(/dorf3.php/)) {\r\n\t\tif (location.href.search(/dorf3.php\\?(.*&)?s=(\\d+)/)) {\r\n\t\t\tvar a = parseInt(RegExp.$2);\r\n\r\n\t\t\tswitch (a) {\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tresumenAldeas6();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 0:\r\n\t\t\t\t\tresumenAldeas3();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tresumenAldeas4();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tresumenAldeas5();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tresumenAldeas2();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 7:\r\n\t\t\t\t\tresumenAldeas7();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 8:\r\n\t\t\t\t\tresumenAldeas8();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tresumenAldeas();\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tresumenAldeas();\r\n\t\t}\r\n\r\n\t\tresumomenu();\r\n\t}\r\n\r\n\tif (location.href.match(/build.php\\?(.*)&s=2/))\t\tpuntosCultura();\r\n\tif (location.href.match(/build.php\\?(.*)&t=1/)){\talianzaMercado(); filtrosMercado(); }\r\n\tif (location.href.match(/karte.php($|\\?z=|\\?new)/)){\tpreCalculate3(); desplazarMapa(); infoRecursos(); }\r\n\tif (location.href.match(/karte.php($|\\?d=)/)){\r\n\t\tMapaQuickSave();\r\n\r\n\t\tkartec();\r\n\t}\r\n\tif (location.href.match(/nachrichten.php($|\\?t=|\\?s=)/) || location.href.match(/berichte.php($|\\?t=|\\?s=)/)) opcionesMensajes();\r\n\r\n\t//if (location.href.match(/nachrichten.php$/))\t\tblocNotas();\r\n\tif (location.href.match(/nachrichten.php$/) || location.href.match(/nachrichten.php($|\\?.*s=)/))\t\tarchiveIGM();\r\n\r\n\tif (location.href.match(/spieler.php\\?s=2/)) mostrarConfiguracion();\r\n\tif (location.href.match(/plus.php\\?id=3/))\t\tcheckUpdate();\r\n\r\n\r\n\tif (location.href.match(/warsim.php/)) {\r\n\t\tparseBattleAnalyse();\r\n\t}\r\n\r\n\tif (location.href.match(/berichte.php\\?(.*&)?id=/)) {\r\n\t\tparseBattleAnalyse();\r\n\t}\r\n\r\n\tmostrarMarcadores();\r\n\t/* Mas acciones generales */\r\n\t//mostrarMarcadores();\r\n\tsetTimers();\r\n\tcalcularTiempoEjecucion();\r\n\r\n//\tplayerLinks();\r\n\r\n\tfunction fix_title()\r\n\t{\r\n\t\tvar xp = xpath('//h1');\r\n\t\tif (xp.snapshotLength == 0) return;\r\n\t\tvar title = xp.snapshotItem(0).innerHTML.replace(/\\<[^>]*?\\>/g, '');\r\n\r\n\t\tvar title = getInnerText(xp.snapshotItem(0)).replace(/\\<[^>]*?\\>/g, '');\r\n\r\n\t\tif (window.location.pathname.indexOf('/dorf2.php') == 0)\r\n\t\t\ttitle = String.fromCharCode(164, 32) + title;\r\n\t\tdocument.title += ' - ' + title;\r\n\t}\r\n\r\n\tfunction xpath(xp, context, doc)\r\n\t{\r\n\r\n\t\tdoc = doc != null ? doc : document;\r\n\t\tcontext = context != null ? context : document;\r\n\r\n\t\treturn doc.evaluate(xp, context, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n\r\n//\t return document.evaluate(xp, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n\t}\r\n\r\n\t/**\r\n\t* xpathEvaluate Finds nodes in the HTML DOM using XPath expression.\r\n\t* @param {String} xpathExpr XPath expression to be evaluated and found in the document.\r\n\t* @return Node iterator with the nodes that obey the XPath expression.\r\n\t*/\r\n\tfunction xpathEvaluate(xpathExpr) {\r\n\t\treturn document.evaluate(xpathExpr, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );\r\n\t}\r\n\r\n\r\n\t/**\r\n\t* xpathEvaluate Finds nodes in the HTML DOM using XPath expression.\r\n\t* @param {Node} context Node from where to search.\r\n\t* @param {String} xpathExpr XPath expression to be evaluated and found in the document.\r\n\t* @return Node iterator with the nodes that obey the XPath expression.\r\n\t*/\r\n\tfunction xpathEvaluateInContext(context, xpathExpr) {\r\n\t\treturn document.evaluate(xpathExpr, context, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );\r\n\t}\r\n\r\n\t/**\r\n\t * Custom log function .\r\n\t * @param {int} level\r\n\t * @param:{int} msg Message to log.\r\n\t */\r\n\tfunction log(level, msg) {\r\n//\t\tif (level <= LOG_LEVEL) {\r\n//\t\t\tif (console != undefined) {\r\n//\t\t\t\tconsole.log(msg);\r\n//\t\t\t\tif (storeurl!=''&& LOG_LEVEL>128)\r\n//\t\t\t\t\tgmAjaxRequest(storeurl,\"POST\",\"cmd=log&namespace=\"+server+\"_\"+uid+\"&msg=\"+encodeURIComponent(msg),dummy);\r\n//\t\t\t}\r\n//\t\t}\r\n\t}\r\n\r\n\tfix_title();\r\n}", "function soltaObj(ele){ \n\t//console.log(\"soltou!!\");\n\t\n\tif(!elementoCarregado)return; \t\n\t\t\n\t$(\"#\"+elementoCarregado.id).css(\"pointer-events\", \"all\");\n\t$(\"#\"+elementoCarregado.id).css(\"z-index\", \"7\");\n\n\tvar pontoX = $(elementoCarregado).position().left/prop+($(elementoCarregado).width())/2;\n\tvar pontoY = $(elementoCarregado).position().top/prop+($(elementoCarregado).height())/2;\n\t\n\t\tif (pontoX > $(\"#areaDrop\").position().left/prop && pontoY > $(\"#areaDrop\").position().top/prop && pontoY < ($(\"#areaDrop\").position().top/prop+$(\"#areaDrop\").height()) && pontoX < ($(\"#areaDrop\").position().left/prop+$(\"#areaDrop\").width())) {\n\t\t\n\t\t\t\t$(elementoCarregado).fadeOut(200, function(){\n\t\t\t\t\t$(elementoCarregado).css({ top:posOriginTop, left:posORiginLeft});\n\t\t\t\t\t$(elementoCarregado).fadeIn(200);\n\t\t\t\t\telementoCarregado = null;\n\t\t\t\t\tobjEmMovimento = false;\n\n\t\t\t\t\tdinArrastado = Number(dinArrastado);\n\n\t\t\t\t\tfaltandoP -= parseFloat(dinArrastado.toFixed(2));\n\t\t\t\t\tmeuDinheiro -= parseFloat(dinArrastado.toFixed(2));\n\n\t\t\t\t\t$(\"#dinPago\").html(\"R$ \"+mascaraValor(faltandoP.toFixed(2)));\n\t\t\t\t\t$(\".boxMeuDinheiro span+span\").html(mascaraValor(meuDinheiro.toFixed(2)));\n\n\t\t\t\t\tverificaCarteira();\n\n\t\t\t\t\tif (parseFloat(faltandoP.toFixed(2)) <= 0.00) {//Math.floor(faltandoP)\n\t\t\t\t\t\t$(\"#dinPago\").html(\"R$ 0,00\");\n\t\t\t\t\t\tmeuTroco = Number(faltandoP.toFixed(2))*-1\n\t\t\t\t\t\t//$(\".boxMeuDinheiro span+span\").html(mascaraValor(meuDinheiro.toFixed(2)));\n\n\t\t\t\t\t\tconsole.log(\"TudoPago\");\n\t\t\t\t\t\tChamaModalFinal();\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\n\t\t\t\treturn;\n\t\t}else{\n\t\t\t\n\t\t}\t\n\t\n\t$(elementoCarregado).animate({left:posORiginLeft, top:posOriginTop},function(){\n\t\tobjEmMovimento = false;\n\t});\t\n\telementoCarregado = null;/**/\n\t\n}", "saludar(fn){//recepcion de funcion\n var {nombre, apellido}=this //desgrloce de variables\n console.log(`Hola me llamo ${nombre} ${apellido}`)\n if(fn){\n fn(nombre, apellido, true)\n }\n }", "function mostrarVentanaCajero(){\n\tnav = 20;\n\tvar nombre = datosUsuario[0][\"nombre\"];\n\tvar txt= forPantallaCajero('Cajero', nombre);\n\t$('#contenedor').html(txt);\n\t$('#contenedor').append(cargarModal());//Agrega HTML del formulario modal\n\tvar parametros ={\"opc\": nav};\n\tejecutarAjax(parametros, nav);\n}", "function pintarActividades(pListaActividades){ //aqui repintamos la lista completa\n seccionActividades.innerHTML = \"\"; //aqui estoy borrando todas actividades antes pintadas para que se muestren las que pinto ahora\n\n if(pListaActividades.length !=0) {\n pListaActividades.forEach( actividad => { //aqui estamos recorriendo los elementos de la lista para ver cual cumple lo que buscamos\n pintarActividad(actividad); //aqui reutilizamos la funcion pintarActividad que se encuentra en la linea 133\n })\n\n } else{\n seccionActividades.innerHTML = \"<h2>No hay registros con esas condiciones</h2>\" \n }\n}", "function DibujarConTeclas(eventos)\n{\n\n\t//se actualiza para saber que datos que coloco el usuario\n\tcolor = color_Id.value;\n\tsize = parseInt(size_Id.value);\n\t\n\t//movimiento por cada teclado\n\tvar movimiento = 5;\n\n\t\n\tswitch(eventos.keyCode) {\n\n\n\t\t//Izquierdad\n\t\tcase 37:\n\t\t\tDibujar(papel, x, y, x - movimiento, y, color, size);\n\t\t\t\n\t\t\tx = x - movimiento;\n\t\tbreak;\n\n\t\t//Arriba\n\t\tcase 38:\n\t\t\tDibujar(papel, x, y, x, y - movimiento, color, size);\n\n\t\t\ty = y - movimiento;\n\t\tbreak;\n\n\t\t//Derecha\n\t\tcase 39:\n\t\t\tDibujar(papel, x, y, x + movimiento, y, color, size);\n\n\t\t\tx = x + movimiento;\n\t\tbreak;\n\n\t\t//Abajo\n\t\tcase 40:\n\t\t\tDibujar(papel, x, y, x, y + movimiento, color, size);\n\n\t\t\ty = y + movimiento;\n\t\tbreak;\n\t}\n\n}", "function choquebloques() {\n let fichas = document.getElementsByClassName('ficha');\n let bolas = document.getElementsByClassName('bola');\n for (let c = 0; c < fichas.length; c++) {\n for (let x = 0 ; x < bolas.length; x++) {\n if (((bolas[x].offsetLeft + 16) > fichas[c].offsetLeft) && (bolas[x].offsetLeft < (fichas[c].offsetLeft + fichas[c].offsetWidth))) {\n if (((bolas[x].offsetTop + 16) > fichas[c].offsetTop) && (bolas[x].offsetTop < (fichas[c].offsetTop + fichas[c].offsetHeight)) && (bolas[x].getAttribute('puedegolp') == 1)) {\n bolas[x].setAttribute('puedegolp', 0);\n bolas[x].setAttribute('velocidad', (parseFloat(bolas[x].getAttribute('velocidad')) + 0.30));\n recargabola = setTimeout(carga, 22);\n choqueficha(fichas[c], bolas[x]);\n /*calculo angulo salida choque*/\n /*activacion de buff*/\n /*desaparicion ficha*/\n\n x = bolas.length;\n }\n }\n\n }\n }\n\n\n }", "function handleContador(){\n props.incrementCounter(1);\n }", "function carrusel(contenedor){\r\n contenedor.addEventListener('click', e =>{\r\n //botones\r\n let leftArrow = contenedor.querySelector('#arrow-left'),\r\n rightArrow = contenedor.querySelector('#arrow-right');\r\n\r\n //Llamar las imagenes dentro del container\r\n let imgIzq = contenedor.querySelector('#imagenIzquierda'),\r\n imgCentro = contenedor.querySelector('#imagenCentro'),\r\n imgDer = contenedor.querySelector('#imagenDerecha'),\r\n tgt = e.target; //Identificador de que elemento esta siendo targeted\r\n\r\n //Target cuando se hace click en el boton izq\r\n if(tgt == leftArrow || tgt == imgIzq){\r\n validarPosLeft();\r\n imgIzq.src = imagenes[posicionIzq];\r\n imgCentro.src = imagenes[posicion];\r\n imgDer.src = imagenes[posicionDer];\r\n cambioBigPic();\r\n }\r\n\r\n //Target cuando se hace click en el boton der\r\n if(tgt == rightArrow || tgt == imgDer){\r\n validarPosRight();\r\n imgIzq.src = imagenes[posicionIzq];\r\n imgCentro.src = imagenes[posicion];\r\n imgDer.src = imagenes[posicionDer];\r\n cambioBigPic();\r\n }\r\n\r\n \r\n\r\n });\r\n}", "function funcionPorDefinicion(){\n //Body\n }", "function cargarFondo()\n{\n fondo.cargaOK = true;\n dibujar();\n}", "saludar(fn){\n console.log(`Hola me llamo ${this.nombre} ${this.apellido}`)\n if(fn){\n fn(this.nombre,this.apellido, false)\n }\n }", "function retourDeMonClic(idClique)\r\n {\r\n \r\n // console.log(idClique)+\" = clic\";\r\n // ex: e1, c1 ...\r\n\r\n // Affiche et garde la première lettre (position 0)\r\n let premiereLettreDeId = idClique.charAt(0); // ex: e\r\n\r\n\r\n// *********** Objectif retirer la première lettre pour avoir le numéro de l'id \r\n \r\n // Remplacer c ou e par rien\r\n let numeroId = idClique.replace(premiereLettreDeId, \"\");\r\n\r\n\r\n // On / off \r\n // (si = e + int et première lettre égal à e)\r\n\r\n if(idClique== (premiereLettreDeId + numeroId) && (premiereLettreDeId == \"e\")){\r\n\r\n x = document.getElementById(idClique).parentNode.nodeName;\r\n // console.log(x +\" lien parent\") // DIV\r\n\r\n let PointageCibleOn=document.getElementById(\"tache\"+numeroId);\r\n // console.log(numeroId + \" : id cliqué !\");\r\n\r\n let cibleIcon=document.getElementById(\"ico\"+numeroId);\r\n\r\n // Ajout du fond vert \"tache\"+numeroId\r\n PointageCibleOn.style.backgroundColor=\"rgba(232, 255, 117, 1)\";\r\n\r\n\r\n // ajout de class pour le design css\r\n\r\n cibleIcon.setAttribute(\"class\",\"far fa-check-circle\");\r\n\r\n// *********** Chercher le key de maListeDesTaches qui contient comme id: x le id cliqué \r\n \r\n for (let a = 0; a < maListeDesTaches.length; a++) {\r\n const element = maListeDesTaches[a];\r\n // console.log(element);\r\n\r\n// *********** Etat à true (pour mémoriser la couleur et ico validé)\r\n\r\n if (maListeDesTaches[a].id==numeroId) {\r\n // alert(\"L'array \"+a+\" à la valeur\"+maListeDesTaches[a].tache);\r\n maListeDesTaches[a].etat=true;\r\n console.log(maListeDesTaches)\r\n\r\n // ****** storage à sauver (mis à jour)\r\n localStorage.setItem(\"donnesSauvegardees\", JSON.stringify(maListeDesTaches));\r\n\r\n // break fonctionne également\r\n return;\r\n }\r\n }\r\n\r\n }\r\n\r\n// *********** Supprimer le Div cliqué\r\n\r\n if(idClique== (premiereLettreDeId + numeroId) && (premiereLettreDeId == \"c\")){\r\n\r\n function supprimerDiv() {\r\n \r\n // pointer le div tache et son numéro\r\n let myobj = document.getElementById(\"tache\"+numeroId);\r\n console.log(numeroId + \" Numéro Id cliqué\")\r\n\r\n // supprime la cible\r\n myobj.remove();\r\n\r\n\r\n// *********** supprimer la clef de id cliqué de l'objet ******************************************************************************\r\n \r\n // Supprimer de mon tableau id correspondant 1 = le nombre entrée(s) à supprimer\r\n maListeDesTaches.splice(numeroId, 1);\r\n\r\n // ****** storage à sauver (mis à jour)\r\n localStorage.setItem(\"donnesSauvegardees\", JSON.stringify(maListeDesTaches));\r\n }\r\n\r\n // Appel fonction\r\n supprimerDiv();\r\n\r\n\r\n } // fin condition if\r\n } // fin retourDeMonClic", "saludar(fn){\n console.log(`Hola me llamo ${this.nombre} ${this.apellido} y soy programador`)\n if(fn){\n fn(this.nombre,this.apellido, true)\n }\n }", "function cargarpista1 (){\n \n}", "function letra(key){\n\tif(letra_buscar == key.text()){\n\n\t\tkey.css(\"background-color\", \"green\");\n\n\t\tcontP++;\n\n\t\tif(contB == contP){\n\n\t\t\tmostrarMensaje(\"../../imagen/icon/exito.png\",\"lenguaje/felicitaciones.webm\",\"../../audio/efecto_sonido/felicitaciones.ogg\");\n\n\t\t\tfin = getActual();\t\n\n\t\t\tanotarDesempeno();\n\n\t\t\tsetTimeout(function(){\n\t\t\t\tcargarActividad();\n\t\t\t}, 3000);\n\n\t\t\t$(\"#intentoCont\").val(0);\n\t\t\tcontP = 0;\n\t\t}\n\t}\n\telse{\n\t\tkey.css(\"background-color\", \"red\");\n\n\t\tsetTimeout(function(){\n\t\t\tkey.css(\"background-color\", \"#81c8ce\");\n\t\t}, 3000);\n\n\t\t$(\"#intentoCont\").val( parseInt($(\"#intentoCont\").val()) + 1 );\n\t}\n}", "function acceder(){\r\n limpiarMensajesError()//Limpio todos los mensajes de error cada vez que corro la funcion\r\n let nombreUsuario = document.querySelector(\"#txtUsuario\").value ;\r\n let clave = document.querySelector(\"#txtClave\").value;\r\n let acceso = comprobarAcceso (nombreUsuario, clave);\r\n let perfil = \"\"; //variable para capturar perfil del usuario ingresado\r\n let i = 0;\r\n while(i < usuarios.length){\r\n const element = usuarios[i].nombreUsuario.toLowerCase();\r\n if(element === nombreUsuario.toLowerCase()){\r\n perfil = usuarios[i].perfil;\r\n usuarioLoggeado = usuarios[i].nombreUsuario;\r\n }\r\n i++\r\n }\r\n //Cuando acceso es true \r\n if(acceso){\r\n if(perfil === \"alumno\"){\r\n alumnoIngreso();\r\n }else if(perfil === \"docente\"){\r\n docenteIngreso();\r\n }\r\n }\r\n}", "function opacidade_control(image,atual,origem)\n{\n // image - objeto da imagem\n // atual - localidação atual das imagens, número da ordem de exibição\n // origem - Qual página pertence\n \n // Faz imagem desaparecer aos poucos\n image.classList.add('Efeito_troca_imagem_desaparece');\n\n // Remove classe que faz imagem desaparecer aos poucos\n setTimeout(function () {\n image.classList.remove('Efeito_troca_imagem_desaparece');\n },2000);\n\n // Apaga imagem\n setTimeout(function () {\n image.classList.add('opacidade');\n },2000); \n\n // Aparece com nova imagem aos poucos e remove o apagador de imagem(opacidade)\n setTimeout(function () {\n image.src = imagem_caminho(origem,atual);\n image.classList.remove('opacidade');\n image.classList.add('Efeito_troca_imagem_aparece');\n },2000); \n\n // Remove classe que faz imagem aparecer aos poucos\n setTimeout(function () {\n image.classList.remove('Efeito_troca_imagem_aparece');\n },3500);\n \n}", "function cargarFondo()\n{\n console.log(\"Cargo Fondo\");\n fondo.cargaOK= true; \n dibujar();\n}", "function survoler(contexte){\n //console.log(contexte.target.id);\n //clientX, client Y: coordonnées souris sur l'écran \n //quand je survole la banniere (#nom)? quand le buttom?\n //quel est l'element survole?\n //contexte.target\n var elementID= contexte.target.id;\n \n switch(elementID){\n case \"buttonActu\": \n refBulle.innerHTML = \"cliquer pour actualiser\";\n break;\n case \"automatiquement\": \n refBulle.innerHTML = \"cocher pour actualiser\";\n break;\n case \"labelAutour\": \n refBulle.innerHTML = \"cliquer pour cocher\";\n break;\n default:\n //refBulle.innerHTML= \"\";\n return; \n }\n //if(refBulle.innerHTML!=\"\"){\n refBulle.style.top=(parseInt(contexte.clientY) +15) + \"px\";\n //console.log(contexte.clientY);\n\n //window.innerWidth pour calculer et connaitre la tailler de l'écran\n if(contexte.clientX < window.innerWidth/2) {\n //bulle a droite\n refBulle.style.left=(parseInt(contexte.clientX)) + \"px\";\n refBulle.style.right=\"\";\n }\n else{\n //bulle a gauche\n refBulle.style.left =\"\";\n refBulle.style.right=(parseInt(window.innerWidth) - parseInt(contexte.clientX)) + \"px\";\n \n }\n refBulle.style.display = \"inline\";\n\n //cacher la boule dans 2 seconde\n window.setTimeout(cacherBulle,1000)\n}", "function mostrarDevoluciones(){ // Cuando toque el boton \"devoluciones\" voy a ver la seccion (hacer devoluciones)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; // habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; // oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divEntregas\").style.display = \"none\"; // oculto tabla\r\n document.querySelector(\"#divDevoluciones\").style.display = \"block\"; // muestro redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "function etapa4() {\n \n //recebe a quantidade de funcionario selecionado\n var qtdFuncionario = document.getElementById('qtdFuncioanrio').value;\n \n //verifica se tem pelo menos 1 funcionario\n if(qtdFuncionario == 0){\n \n msgTratamentoEtapa3.textContent = \"Não foi possível seguir para a 4º Etapa! É obrigatório adicionar no mínimo um animador. =)\" \n \n }else{\n \n msgTratamentoEtapa3.innerHTML = \"\";\n \n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"4º Etapa - Pacote & Adicionais\"; \n \n document.getElementById('selecionarPacotes').style.display = ''; //habilita a etapa 4\n document.getElementById('selecionarFuncionarios').style.display = 'none'; //desabilita a etapa 3 \n }\n \n }", "function escreveConteudo(){}", "function Buscar() {\n //todos objBusqueda esta en los respectivos js\n var objConf = objConfiguracionGlobal;\n var objBus = objBusquedaGlobal;\n\n //recibe el valor id cama.js\n var valor = get(objBus.id);\n\n //url absoluta y agrega el contenido de la tabla a divContenedor\n fetchGet(`${objBus.url}/?${objBus.nombreParametro}=` + valor, function (res) {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n\n /* fetch(`${objBus.url}/?${objBus.nombreParametro}=` + valor)\n .then(res => res.json())\n .then(res => {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n */\n\n //pintar({\n // //ahora cambia esta linea\n // url: `${objBus.url}/?${objBus.nombreParametro}=` + valor,\n // id: objConf.id,\n // cabeceras: objConf.cabeceras,\n // propiedades: objConf.propiedades\n\n //}, objBus)\n\n}", "function init(){\n\tresultado = document.getElementById(\"display\"); //guarda valor en visor\n\t//captura\nvar botones =document.getElementsByClassName('tecla');\n\t\tfor (var i = 0; i < botones.length; i++) {\n\t\t\tbotones[i].addEventListener('click', agregar);\n\t\t\tbotones[i].addEventListener('click', reduceTamaño);\n\t\t\t\n\t\t}\t\n}", "function contadorOfertas(){\n\tmarcadoresTiempo = document.getElementsByClassName(\"marcadorTiempo\");\n\ttitulo = document.getElementById(\"tituloOferta\");\n\timg = document.getElementsByClassName(\"imgOferta\")[0];\n\tmensaje = document.getElementById(\"mensajeOferta\");\n\tprecioOferta = document.getElementById(\"precioOferta\");\n\tprecio = document.getElementById(\"precio\");\n\tunidades = document.getElementById(\"unidadesOferta\");\n\t// Se rellenan los datos del primer producto\n\tactualizarProductoOferta(0);\n\t// Se dibuja en los elementos de clase \"marcadorTiempo\" el tiempo inicial\n\tactualizarMarcador(tiempo);\n\t// Se inicia el contador\n\tcontador = window.setInterval(contar, 1000);\n}", "function executaFuncao (funcao){\n funcao();\n}", "function IndicadorRangoEdad () {}", "function resultat() {\n let o = operH.innerHTML;\n let a = mem2;\n let b = mem1;\n /* It avaluates all the content keeped inside tags and asign to these variables */\n\n screenH.innerHTML = calculadora(o, a, b);\n /* Invokes to calculadora function and it writes inside screenH */\n subScreenH.innerHTML = \"0\";\n operH.innerHTML = \"\";\n /* It resets content of subScreenH and operH */\n}", "function cargarHoras(segundos,minutos){\r\n let txtHoras;\r\n\r\n if(segundos == -1 && minutos == 0 && horas !== 0){\r\n setTimeout(() =>{\r\n horas--;\r\n },500)\r\n }else if(segundos == -1 && minutos == 0 && horas == 0){\r\n setTimeout(() =>{\r\n horas = 2;\r\n },500)\r\n }\r\n\r\n //Mostrar Horas en pantalla\r\n if(horas < 10){\r\n txtHoras = `0${horas}`;\r\n }else{\r\n txtHoras = horas;\r\n }\r\n document.getElementById('horas').innerHTML = txtHoras;\r\n}", "function falso(){\n\tif(cont==2||cont==3||cont==5||cont==6||cont==7||cont==8||cont==10||cont==11||cont==13||cont==17||cont==19){\n\t\talert(\"ESA ES MI CHICA! CORRECTO\");\n\t\tpuntos = puntos + 1;\n\t}else{\n\t\talert(\"MALA NOVIA!!! ERROR\");\n\t}\n\tconsole.log(puntos);\n\tcambiarPagina();\n}", "function bodoAmat(){\r\n console.log(\"Ini result Function Bodo Amat\");\r\n}", "function submeterRequerimentoDesenhaEsqueleto(passo)\r\n{\r\n\tswitch (passo)\r\n\t{\r\n\t\tcase 2: // PASSO 2\r\n\t\t\tdocument.getElementById(\"text\").innerHTML = \r\n\t\t\t\t'<a title=\"Ajuda\" id=\"help\" onmousedown=\"help(\\'submeteRequerimento_2\\')\" href=\"#\">Ajuda</a>' + \r\n\t\t\t\t'<div id=\"processo\">' +\r\n\t\t\t\t\t'<div id=\"titulo\" class=\"titulo\"></div>' +\r\n\t\t\t\t\t'<div id=\"passos\"></div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t'<div id=\"conteudo\">' +\r\n\t\t\t\t\t'<div id=\"descricao\"></div>' +\r\n\t\t\t\t\t\t'<fieldset>' +\r\n\t\t\t\t\t\t'<div id=\"lista_unidades_curriculares\" class=\"lista_ucs\"></div>' +\r\n\t\t\t\t\t\t'<div id=\"lista_formacoes_associadas\" class=\"lista_formacoes\"></div>' +\r\n\t\t\t\t\t\t'</fieldset>' +\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t'<div id=\"botao_continuar\">' +\r\n\t\t\t\t\t\t'<input type=\"button\" onclick=\"submeterRequerimento(1)\" value=\"Voltar\">' +\r\n\t\t\t\t\t\t'<input type=\"button\" onclick=\"submeterRequerimento(3)\" value=\"Continuar\">' +\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t'</div>'\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 3: // PASSO 3\r\n\t\t\tdocument.getElementById(\"text\").innerHTML = \r\n\t\t\t\t'<a title=\"Ajuda\" id=\"help\" onmousedown=\"help(\\'submeteRequerimento_3\\')\" href=\"#\">Ajuda</a>' + \r\n\t\t\t\t\t'<div id=\"processo\">' +\r\n\t\t\t\t\t'<div id=\"titulo\" class=\"titulo\"></div>' +\r\n\t\t\t\t\t'<div id=\"passos\"></div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t\t'<div id=\"cabecalho\">' +\r\n\t\t\t\t\t\t\t'<div id=\"descricao\"></div>' +\r\n\t\t\t\t\t\t'</div>' +\r\n\t\t\t\t\t\t'<div id=\"formacoes\"></div>' +\r\n\t\t\t\t\t\t'<div id=\"botoes\">' +\r\n\t\t\t\t\t\t\t'<input type=\"button\" onclick=\"submeterRequerimento(2)\" value=\"Voltar\">' +\r\n\t\t\t\t\t\t\t'<input type=\"button\" onclick=\"submeterRequerimento(4)\" value=\"Concluir\">' +\r\n\t\t\t\t\t\t'</div>' +\r\n\t\t\t\t\t'</div>'\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tcase 4: // Conclusão\r\n\t\t\tdocument.getElementById(\"text\").innerHTML = \r\n\t\t\t\t'<a title=\"Ajuda\" id=\"help\" onmousedown=\"help(\\'submeteRequerimento_4\\')\" href=\"#\">Ajuda</a>' + \r\n\t\t\t\t\t'<div id=\"processo\">' +\r\n\t\t\t\t\t'<div id=\"titulo\" class=\"titulo\"></div>' +\r\n\t\t\t\t\t'<div id=\"passos\"></div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t\t'<div id=\"mensagem_conclusao\"></div>' +\r\n\t\t\t\t\t'</div>'\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t\tdefault: // PASSO 1\r\n\t\t\tdocument.getElementById(\"text\").innerHTML = \r\n\t\t\t\t'<a title=\"Ajuda\" id=\"help\" onmousedown=\"help(\\'submeteRequerimento_1\\')\" href=\"#\">Ajuda</a>' + \r\n\t\t\t\t'<div id=\"processo\">' +\r\n\t\t\t\t\t'<div id=\"titulo\" class=\"titulo\"></div>' +\r\n\t\t\t\t\t'<div id=\"passos\"></div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t'<div id=\"conteudo\">' +\r\n\t\t\t\t\t\t'<div id=\"descricao\"></div>' +\r\n\t\t\t\t\t\t'<fieldset>' +\r\n\t\t\t\t\t\t'<div id=\"lista_formacao_realizada\" class=\"lista_formacoes\"></div>' +\r\n\t\t\t\t\t\t'<div id=\"lista_anexos_associados\" class=\"lista_anexos\"></div>' +\r\n\t\t\t\t\t\t'</fieldset>' +\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t\t'<br />' +\r\n\t\t\t\t\t'<div id=\"botao_continuar\">' +\r\n\t\t\t\t\t\t'<input type=\"button\" onclick=\"submeterRequerimento(2)\" value=\"Continuar\">' +\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t'</div>'\r\n\t\t\tbreak;\r\n\t}\r\n\t\t\t\r\n\t// adiciona campos à vista\r\n\tadicionarObjetos(passo);\r\n\t\r\n}", "function nombreFuncion(parametro){\n return \"regresan algo\"\n}", "function mostrarServicios(){\n\n //llenado de la tabla\n cajas_hoy();\n cajas_ayer() ;\n}", "function listar(){\n//funsiones a llenar combobox\n tipo();\n ciudad();\n inicializarSlider();\n playVideoOnScroll();\n\n}", "function activarHerramientaPerfil() {\n console.log(\"Activar herramienta perfil\");\n\n crearYCargarCapaLineaPerfil();\n activarControlDibujo();\n\n\n}", "function fMasc(objeto,mascara) \n{\n\tobj=objeto\n\tmasc=mascara\n\tsetTimeout(\"fMascEx()\",1)\n}", "function lista ()\r\n{\r\n var okno_div = document.createElement(\"div\");\r\n okno_div.style.position = \"fixed\";\r\n okno_div.style.border = \"solid\";\r\n \r\n if (window.location.href.indexOf(\"/Pages/Search/\") > 0)\r\n {\r\n \t// var strona = document.getElementById('ctl00_ctl00_ctl00_MainContainer'); // Najlepsze rozwiazanie!\r\n var strona = document.getElementById(\"ctl00_ctl00_ctl00_TopBannerAdvertisementCMS\");\r\n }\r\n \r\n else if (window.location.href.indexOf(\"/Pages/Default.aspx\") > 0)\r\n {\r\n var strona = document.getElementById(\"ctl00_ctl00_TopBannerAdvertisementCMS\");\r\n }\r\n \r\n else if (window.location.href.indexOf(\"multiverseid\") > 0)\r\n {\r\n var strona = document.getElementById(\"ctl00_ctl00_ctl00_TopBannerAdvertisementCMS\");\r\n }\r\n \r\n strona.appendChild(okno_div);\r\n okno_div.style.zIndex = 199;\r\n okno_div.style.background = \"white\";\r\n okno_div.style.padding = \"15px\";\r\n okno_div.style.width = \"750px\";\r\n okno_div.style.height = \"450px\";\r\n okno_div.style.overflow = \"scroll\"\r\n okno_div.id = \"okienko\";\r\n okno_div.style.textAlign = \"left\";\r\n \r\n okno_div.style['-webkit-box-shadow'] = \"10px 10px 5px #888\"; // Dodaje cień.\r\n okno_div.style['-moz-box-shadow'] = \"10px 10px 5px #888\"; // Dodaje cień.\r\n okno_div.style.boxShadow = \"10px 10px 5px #888\"; // Dodaje cień.\r\n \r\n var menu = document.createElement(\"div\");\r\n okno_div.appendChild(menu);\r\n menu.innerHTML = \"<button onClick=\\\"zap(); return false;\\\">Save and close</button> <button onClick=\\\"druk(); return false;\\\">Save and print</button> <br />Click on the card to delete it from the list.\";\r\n \r\n var lista = zapisane.split(',');\r\n \r\n\tfor (var z=0; z<lista.length - 1; z++) \r\n\t{\r\n var rys = document.createElement(\"img\");\r\n rys.src = lista[z];\r\n rys.id = z;\r\n rys.className = \"listakart\";\r\n rys.style.width = \"100px\";\r\n \trys.style.height = \"139.333px\";\r\n rys.style.margin = \"5px\";\r\n rys.onclick = function() { document.getElementById(\"okienko\").removeChild(this); }; \r\n okno_div.appendChild(rys);\r\n }\r\n \r\n\treturn false; \r\n}", "function nascer()\n{\n\n estado = 3;\n flag_vida = 1;\n vidas_jogador[jog_activo]--;\n\tsom_inicio.play();\n if(jog_activo == 0)\n move_obj($('jogador_1'),290,320);\n else\n move_obj($('jogador_2'),290,320);\n\n // coloca objectos iniciais\n inicializa_objectos();\n objectos_comida();\n for(i = 0; i < 5; i++)\n {\n chama_objecto(i);\n }\n\n move_obj($('preparado'),320,450);\n setTimeout(\"move_obj($('jogador_1'),-1000,0); move_obj($('jogador_2'),-1000,0); move_obj($('preparado'),-1000,0); actividade(); \", 2143);\n}", "function mostraretro1() {\n retrouno.style.display=\"block\";\n fronte1fronte1.replaceChild(retrouno,fronte1);\n //modifica delle descrizioni con il contenuto della lettera\n testo.style.display=\"block\";\n descrizionedescrizione.replaceChild(testo, descrizione); \n }", "function funAtualizarConta(parametros,callbackf) {\n var query = \"\";\n var queryItens = \"\";\n var parcela = 0;\n\tvar totalParcelas = 0;\n var resposta = null;\n\tvar conexao = null;\n\tvar dataEmissao = null;\n\tvar dataVencimento = null;\n\n resposta = {\n status: 1,\n mensagem: [],\n titulo: null\n }\n\n try{\n if(parametros.idEntidade == \"\" || parametros.idEntidade == \"undefined\"){\n resposta.status = 0;\n resposta.mensagem.push(\"O cliente não foi informado.\");\n }\n\n if(parametros.nrTitulo == \"\" || parametros.nrTitulo == \"undefined\"){\n resposta.status = 0;\n resposta.mensagem.push(\"O documento não foi informado.\");\n }\n\n if(!parametros.idParcelamento){\n resposta.status = 0;\n resposta.mensagem.push(\"A forma de parcelamento não foi informada.\");\n }\n\n if(parametros.emissao == \"\" || parametros.emissao.indexOf(\"undefined\") >= 0){\n resposta.status = 0;\n resposta.mensagem.push(\"A data de emissão não foi informada.\");\n }\n\n if(parametros.valor == \"\" || parametros.valor == \"undefined\" || isNaN(parametros.valor)){\n resposta.status = 0;\n resposta.mensagem.push(\"Valor do documento é inválido ou não foi informado.\");\n }\n\n if(!(parametros.hasOwnProperty(\"parcelas\")) || parametros.parcelas.length == 0){\n resposta.status = 0;\n resposta.mensagem.push(\"As parcelas não foram informadas.\");\n }\n else{\n dataEmissao = new Date(parametros.emissao.substring(0,4),parseInt(parametros.emissao.substring(5,7)) - 1,parametros.emissao.substring(8,10));\n for(parcela = 0; parcela < parametros.parcelas.length; parcela++){\n if(parametros.parcelas[parcela].documento == \"\" || parametros.parcelas[parcela].documento == \"undefined\"){\n resposta.status = 0;\n resposta.mensagem.push(\"A parcela \" + (parcela + 1).toString().trim() + \" não possui o documento.\");\n }\n if(parametros.parcelas[parcela].parcela == \"\" || parametros.parcelas[parcela].parcela == \"undefined\"){\n resposta.status = 0;\n resposta.mensagem.push(\"A parcela \" + (parcela + 1).toString().trim() + \" não possui o número informado.\");\n }\n if(parametros.parcelas[parcela].vencimento == \"\" || parametros.parcelas[parcela].vencimento == \"undefined\"){\n resposta.status = 0;\n resposta.mensagem.push(\"A parcela \" + (parcela + 1).toString().trim() + \" não possui a data de vencimento.\");\n }\n\t\t\t\telse{\n\t\t\t\t\tdataVencimento = new Date(parametros.parcelas[parcela].vencimento.substring(0,4),parseInt(parametros.parcelas[parcela].vencimento.substring(5,7)) - 1,parametros.parcelas[parcela].vencimento.substring(8,10));\n\t\t\t\t\tif(dataVencimento.getTime() < dataEmissao.getTime()){\n\t\t\t\t\t\tresposta.status = 0;\n\t\t\t\t\t\tresposta.mensagem.push(\"A data de vencimento da parcela \" + (parcela + 1).toString().trim() + \" é anterior à data de emissão do documento.\");\n\t\t\t\t\t}\n\t\t\t\t}\n if(parametros.parcelas[parcela].valor == \"\" || parametros.parcelas[parcela].valor == \"undefined\" || isNaN(parametros.parcelas[parcela].valor)){\n resposta.status = 0;\n resposta.mensagem.push(\"A parcela \" + (parcela + 1).toString().trim() + \" não possui valor.\");\n }\n\t\t\t\telse{\n\t\t\t\t\ttotalParcelas += parseFloat(parametros.parcelas[parcela].valor);\n\t\t\t\t}\n }\n\t\t\tif(resposta.status == 1){\n\t\t\t\tconsole.log(parametros);\n\t\t\t\tif(parseFloat(parametros.valor) != totalParcelas){\n\t\t\t\t\tresposta.status = 0;\n\t\t\t\t\tresposta.mensagem.push(\"A soma dos valores das parcelas difere do total do documento.\")\n\t\t\t\t}\n\t\t\t}\n }\n\n if(resposta.status == 1){\n if(parametros.idTitulo == \"\"){\n parametros.idTitulo = general.guid();\n query = \"insert into contas_receber (id,id_empresa,id_entidade,id_venda,id_notafiscal,id_parcelamento,id_plano_contas_financeiro,id_origem,nm_documento,dt_emissao,nm_competencia,vl_valor,sn_dre,nm_observacao) values(\"\n query += \"'\" + parametros.idTitulo + \"',\";\n query += \"'\" + EnterpriseID + \"',\";\n query += \"'\" + parametros.idEntidade + \"',\";\n query += (!parametros.idPedido ? \"null\" : \"'\" + parametros.idPedido + \"'\") + \",\";\n query += (!parametros.idNotaFiscal ? \"null\" : \"'\" + parametros.idNotaFiscal + \"'\") + \",\";\n query += \"'\" + parametros.idParcelamento + \"',\";\n query += (!parametros.idContaFinanceira ? \"null\" : \"'\" + parametros.idContaFinanceira + \"'\") + \",\";\n query += (!parametros.idOrigem ? \"null\" : \"'\" + parametros.idOrigem + \"'\") + \",\";\n query += \"'\" + parametros.nrTitulo + \"',\";\n query += \"'\" + parametros.emissao + \"',\";\n query += \"'\" + parametros.competencia + \"',\";\n query += parametros.valor.toString().trim() + \",\";\n query += parametros.dre.toString().trim() + \",\";\n query += \"'\" + parametros.observacao + \"'\";\n query += \"); \";\n\n query += \"insert into contas_receber_parcelas (id,id_empresa,id_contas_receber,id_Banco,id_forma_pagamento,id_configuracao_cnab,id_plano_contas_financeiro,nr_parcela,nm_documento,sn_fluxocaixa,dt_data_vencimento,vl_valor)\";\n query += \" values \";\n\t\t\t\t\n for(parcela = 0; parcela < parametros.parcelas.length; parcela++){\n parametros.parcelas[parcela].idParcela = general.guid();\n\t\t\t\t\tif(parcela > 0)\n\t\t\t\t\t\tquery += \",\";\n query += \"(\";\n query += \"'\" + parametros.parcelas[parcela].idParcela + \"',\";\n query += \"'\" + EnterpriseID + \"',\";\n query += \"'\" + parametros.idTitulo + \"',\";\n query += (!parametros.parcelas[parcela].idBanco ? \"null\" : \"'\" + parametros.parcelas[parcela].idBanco + \"'\") + \",\"; \n query += (!parametros.parcelas[parcela].idFormaPagamento ? \"null\" : \"'\" + parametros.parcelas[parcela].idFormaPagamento + \"'\") + \",\";\n query += (!parametros.parcelas[parcela].idConfCNAB ? \"null\" : \"'\" + parametros.parcelas[parcela].idConfCNAB + \"'\") + \",\";\n query += (!parametros.parcelas[parcela].idContaFinanceira ? \"null\" : \"'\" + parametros.parcelas[parcela].idContaFinanceira + \"'\") + \",\";\n query += \"'\" + parametros.parcelas[parcela].parcela + \"',\";\n query += \"'\" + parametros.parcelas[parcela].documento + \"',\";\n query += parametros.parcelas[parcela].fluxoCaixa + \",\";\n query += \"'\" + parametros.parcelas[parcela].vencimento + \"',\";\n query += parametros.parcelas[parcela].valor.toString().trim()\n query += \")\";\n }\n\t\t\t\t\n\t\t\t\tconexao = new sql.ConnectionPool(config,function (err) {\n\t\t\t\t\tif (err){\n\t\t\t\t\t\tresposta.status = -2;\n\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\trespsota.titulo = null;\n\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tvar transacao = conexao.transaction();\n\t\t\t\t\t\t\ttransacao.begin(err =>{\n\t\t\t\t\t\t\t\tvar request = transacao.request();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\trequest.query(query, function (err, recordset) {\n\t\t\t\t\t\t\t\t\tif(err){\n\t\t\t\t\t\t\t\t\t\tresposta.status = -3;\n\t\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\t\t\t\ttransacao.rollback();\n\t\t\t\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\tresposta.status = 1;\n\t\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"ok\"];\n\t\t\t\t\t\t\t\t\t\tresposta.titulo = parametros;\n\t\t\t\t\t\t\t\t\t\ttransacao.commit();\n\t\t\t\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(err){\n\t\t\t\t\t\t\tresposta.status = -4;\n\t\t\t\t\t\t\trespsosta.mensagem = [\"ok\"];\n\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n }\n else{\n\t\t\t\tquery = \"select sum(vl_valor) totalbaixas from contas_receber_baixas where id_empresa = '\" + EnterpriseID + \"' and id_contas_receber_parcela in (select id from contas_receber_parcelas where id_contas_receber = \";\n\t\t\t\tquery += \"(select id from contas_receber where id_empresa = '\" + EnterpriseID + \"' and id = '\" + parametros.idTitulo + \"'))\";\n\t\t\t\t\n conexao = new sql.ConnectionPool(config,function (err) {\n\t\t\t\t\tif (err){\n\t\t\t\t\t\tresposta.status = -5;\n\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tvar request = conexao.request();\n\t\t\t\t\t\t\trequest.query(query, function (err, recordset) {\n\t\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\t\tif(err){\n\t\t\t\t\t\t\t\t\t\tresposta.status = -6;\n\t\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\tif(recordset.recordsets[0][0].totalbaixas == null){\n\t\t\t\t\t\t\t\t\t\t\tqueryItens = \"delete contas_receber_parcelas where id_empresa = '\" + EnterpriseID + \"' and id_contas_receber = '\" + parametros.idTitulo + \"'; \"\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"update contas_receber set \"\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_parcelamento = '\" + parametros.idParcelamento + \"',\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_plano_contas_financeiro = \" + (!parametros.idContaFinanceira ? \"null\" : \"'\" + parametros.idContaFinanceira + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"nm_competencia = '\" + parametros.competencia + \"',\"\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"nm_observacao = '\" + parametros.observacao + \"'\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" where id = '\" + parametros.idTitulo + \"'\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" and id_empresa = '\" + EnterpriseID + \"'; \";\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"insert into contas_receber_parcelas (id,id_empresa,id_contas_receber,id_Banco,id_forma_pagamento,id_plano_contas_financeiro,nr_parcela,nm_documento,sn_fluxocaixa,dt_data_vencimento,vl_valor)\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" values \";\n\t\t\t\t\t\t\t\t\t\t\tfor(parcela = 0; parcela < parametros.parcelas.length; parcela++){\n\t\t\t\t\t\t\t\t\t\t\t\tif(parcela > 0)\n\t\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \",\";\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tparametros.parcelas[parcela].idParcela = general.guid();\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"(\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + parametros.parcelas[parcela].idParcela + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + EnterpriseID + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + parametros.idTitulo + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += (!parametros.parcelas[parcela].idBanco ? \"null\" : \"'\" + parametros.parcelas[parcela].idBanco + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += (!parametros.parcelas[parcela].idFormaPagamento ? \"null\" : \"'\" + parametros.parcelas[parcela].idFormaPagamento + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += (!parametros.parcelas[parcela].idContaFinanceira ? \"null\" : \"'\" + parametros.parcelas[parcela].idContaFinanceira + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + parametros.parcelas[parcela].parcela + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + parametros.parcelas[parcela].documento + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += parametros.parcelas[parcela].fluxoCaixa + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"'\" + parametros.parcelas[parcela].vencimento + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += parametros.parcelas[parcela].valor.toString().trim();\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \")\";\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\t\tqueryItens = \"update contas_receber set \"\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_plano_contas_financeiro = \" + (!parametros.idContaFinanceira ? \"null\" : \"'\" + parametros.idContaFinanceira + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"nm_competencia = '\" + parametros.competencia + \"',\"\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"nm_observacao = '\" + parametros.observacao + \"'\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" where id = '\" + parametros.idTitulo + \"'\";\n\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" and id_empresa = '\" + EnterpriseID + \"'\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfor(parcela = 0; parcela < parametros.parcelas.length; parcela++){\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"; \";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"update contas_receber_parcelas set \";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_banco = \" + (!parametros.parcelas[parcela].idBanco ? \"null\" : \"'\" + parametros.parcelas[parcela].idBanco + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_forma_pagamento = \" + (!parametros.parcelas[parcela].idFormaPagamento ? \"null\" : \"'\" + parametros.parcelas[parcela].idFormaPagamento + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"id_plano_contas_financeiro = \" + (!parametros.parcelas[parcela].idContaFinanceira ? \"null\" : \"'\" + parametros.parcelas[parcela].idContaFinanceira + \"'\") + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"nm_documento = '\" + parametros.parcelas[parcela].documento + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"sn_fluxocaixa = \" + parametros.parcelas[parcela].fluxoCaixa + \",\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"dt_data_vencimento = '\" + parametros.parcelas[parcela].vencimento + \"',\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \"vl_valor = \" + parametros.parcelas[parcela].valor.toString().trim();\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" where id_empresa = '\" + EnterpriseID + \"'\";\n\t\t\t\t\t\t\t\t\t\t\t\tqueryItens += \" and id = '\" + parametros.parcelas[parcela].idParcela + \"'\";\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tvar transacao = conexao.transaction();\n\t\t\t\t\t\t\t\t\t\ttransacao.begin(err =>{\n\t\t\t\t\t\t\t\t\t\t\tvar request = transacao.request();\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\trequest.query(queryItens, function (err, recordset) {\n\t\t\t\t\t\t\t\t\t\t\t\tif(err){\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.status = -7;\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransacao.rollback();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.status = 1;\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"ok\"];\n\t\t\t\t\t\t\t\t\t\t\t\t\tresposta.titulo = parametros;\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransacao.commit();\n\t\t\t\t\t\t\t\t\t\t\t\t\tconexao.close();\n\t\t\t\t\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch(err){\n\t\t\t\t\t\t\t\t\tresposta.status = -8;\n\t\t\t\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(err){\n\t\t\t\t\t\t\tresposta.status = -9;\n\t\t\t\t\t\t\tresposta.mensagem = [\"\" + err];\n\t\t\t\t\t\t\tresposta.titulo = null;\n\t\t\t\t\t\t\tcallbackf(resposta);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n }\n else{\n resposta.titulo == null;\n callbackf(resposta);\n }\n }\n catch(erro){\n resposta.status = -1;\n resposta.mensagem = [];\n resposta.mensagem.push(\"f: \" + erro);\n resposta.titulo = null;\n callbackf(resposta);\n }\n}", "function acceder(usuario){\n console.log(`2. ${usuario} Ahora puedes acceder`)\n entrar();\n}", "function iniciar() {\n\tcrearEscena();\n\tcrearCamara();\n\tcrearLuces();\n\tcrearMundo();\n\tcrearCohete();\n\n\tmensaje = document.getElementById('mensaje');\t\n\tciclo();\n}", "function cnsFrn_fecha(preencheLinha){\n if(!empty($CNSFORNECdimmer)){\n \n //A CONSULTA NAO ESTA INCLUIDA EM UMA OUTRA TELA\n if(empty(objFornecedor.divDaConsulta)){\n //VOLTA O SCROLL PRA CIMA\n $(CNSFORNEC_DIV_TABELA).animate({ scrollTop: \"=0\" }, \"fast\");\n $(\"#cnsFornec_pesquisa\").select();\n return;\n }\n\n // VOU FECHAR A CONSULTA SEM TER QUE PREENCHER AS LINHAS\n if(!preencheLinha){\n $CNSFORNECdimmer.dimmer(\"consulta hide\");\n\n //RETORNA O FOCO\n if(!empty(objFornecedor.returnFocus)) objFornecedor.returnFocus.select();\n // if(!empty(objCliente.returnFocus)) objCliente.returnFocus.select();\n\n return;\n }\n\n var posicao = $('#cnsFornec_position').val();\n var divDaConsulta = objFornecedor.divDaConsulta; //conteudo do objeto\n\n objFornecedor.fornecNum = objTabelaFornec.registros[posicao].fo_number;\n objFornecedor.fornecAbrev = objTabelaFornec.registros[posicao].fo_abrev;\n objFornecedor.razao = objTabelaFornec.registros[posicao].fo_razao;\n objFornecedor.cnpj = objTabelaFornec.registros[posicao].fo_cgc;\n objFornecedor.telefone = objTabelaFornec.registros[posicao].fo_fone;\n objFornecedor.cep = objTabelaFornec.registros[posicao].fo_cep;\n objFornecedor.endereco = objTabelaFornec.registros[posicao].fo_ender;\n objFornecedor.enderNum = objTabelaFornec.registros[posicao].fo_endnum;\n objFornecedor.bairro = objTabelaFornec.registros[posicao].fo_bairro;\n objFornecedor.cidade = objTabelaFornec.registros[posicao].fo_cidade;\n objFornecedor.uf = objTabelaFornec.registros[posicao].fo_uf;\n objFornecedor.calculoSt = objTabelaFornec.registros[posicao].fo_calc_st;\n objFornecedor.lucro = objTabelaFornec.registros[posicao].fo_lucro;\n objFornecedor.conta = objTabelaFornec.registros[posicao].fo_grdesp;\n objFornecedor.divDaConsulta = divDaConsulta; //recupera divDaConsulta\n\n for(var i in objTabelaFornec.registros[posicao]){\n objFornecedor[i] = objTabelaFornec.registros[posicao][i];\n }\n \n if($('#'+objFornecedor.divDaConsulta).hasClass('active')){\n $CNSFORNECdimmer.dimmer(\"consulta hide\");\n }\n cnsFrn_retorno();\n }\n}", "function nombreFuncion(){\n \n}", "efficacitePompes(){\n\n }", "function activaFuncionamientoReloj() {\n let tiempo = {\n hora: 0,\n minuto: 0,\n segundo: 0\n };\n\n tiempo_corriendo = null;\n\n\n tiempo_corriendo = setInterval(function () {\n // Segundos\n tiempo.segundo++;\n if (tiempo.segundo >= 60) {\n tiempo.segundo = 0;\n tiempo.minuto++;\n }\n\n // Minutos\n if (tiempo.minuto >= 60) {\n tiempo.minuto = 0;\n tiempo.hora++;\n }\n\n $horasDom.text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);\n $minutosDom.text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);\n $segundosDom.text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);\n }, 1000);\n corriendo = true;\n\n }", "chequearAbajo(ficha) {\n let cont = 1;\n if(ficha.getFilUbicada() > 0) {\n let aux = this.arregloDePosiciones[ficha.getColUbicada()][ficha.getFilUbicada() - 1];\n if(ficha.getJugador() == aux[2].getJugador()) {\n cont += this.chequearAbajo(aux[2]);\n }\n }\n return cont;\n }", "function tecla(evt) {\r\n if(!evt) {\r\n evt=event;\r\n codi=evt.keyCode;\r\n }\r\n else {\r\n codi=evt.which;\r\n }\r\n switch(codi) {\r\n case 8:\r\n parent.dibuix.escriu.borrarUlt();\r\n break;\r\n case 13:\r\n parent.dibuix.escriu.comprovar();\r\n break;\r\n default:\r\n var car=String.fromCharCode(codi);\r\n var trobat=cercaChar(lletres,car);\r\n if(trobat!=-1) {\r\n\tparent.dibuix.escriu.add(car);\r\n }\r\n break;\r\n }\r\n window.frames[1].focus();\r\n}", "function aviso_CEP(campo, escolha){\r\r\n\r\r\n //TEXTO SIMPLES\r\r\n var label = document.createElement(\"label\")\r\r\n\r\r\n //ESCOLHENDO O TIPO DE AVISO\r\r\n if (escolha == 1 ){ \r\r\n\r\r\n //TEXTO DE AVISO DE OBRIGATORIO\r\r\n var text = document.createTextNode(\"Preenchimento Obrigatório\")\r\r\n\r\r\n //COLOCANDO O ID NA LABEL E BR CRIADAS\r\r\n label.id = \"aviso_cep\"\r\r\n\r\r\n //INSERINDO O TEXTO DE AVISO NO CAMPO QUE SERA COLOCADO\r\r\n label.appendChild(text)\r\r\n }\r\r\n else if (escolha == 2){ \r\r\n\r\r\n //COLOCANDO O ID NA LABEL E BR CRIADAS\r\r\n label.id = \"aviso_cep1\"\r\r\n\r\r\n //TEXTO DE AVISO DE INVÁLIDO\r\r\n var text = document.createTextNode(\"CEP inválido!\")\r\r\n\r\r\n //INSERINDO O TEXTO DE AVISO NO CAMPO QUE SERA COLOCADO\r\r\n label.appendChild(text)\r\r\n }\r\r\n\r\r\n //REFERENCIA DE ONDE SERA COLOCADO O ITEM\r\r\n var lista = document.getElementsByTagName(\"p\")[5]\r\r\n var itens = document.getElementsByTagName(\"/p\") \r\r\n\r\r\n //INSERINDO O AVISO EM VERMELHO\r\r\n lista.insertBefore( label, itens[0]);\r\r\n label.style.color = \"red\";\r\r\n\r\r\n //MUDANDO O BACKGROUND\r\r\n erro(campo)\r\r\n}", "function mostrarEstDocente(){ // Cuando toque el boton \"estadisticas\" voy a ver la seccion (ver estadisticas)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"block\"; // muestro visualizar estadisticas\r\n generarListaAlumnos();\r\n}", "function elegidoSelect() {\n //recogemos el destino que se ha elegido.\n var elegidoSel = document.getElementById('otro').value;\n if (elegidoSel == \"\") {\n //si no se ha elegido ninguno volvemos a la funcion de inicio\n inicio();\n }\n\n //si si que se ha elegido alguno, lo llevamos a su funcion personalizada\n else if (elegidoSel == 'VQC') {\n vqc();\n } else if (elegidoSel == 'P.COLORES') {\n colores();\n } else if (elegidoSel == 'MALVINAS') {\n malvinas();\n } else {\n fin();\n }\n}", "function ingresaContenido(nombre) {\n document.getElementById('nombrer').innerHTML = '';\n document.getElementById('descripcionr').innerHTML = '';\n document.getElementById('horarior').innerHTML = '';\n document.getElementById('ubicacionr').innerHTML = '';\n document.getElementById('mapa').innerHTML = '';\n document.getElementById('menu').innerHTML = '';\n document.getElementById('boton1').innerHTML = '';\n document.getElementById('boton2').innerHTML = '';\n document.getElementById('boton3').innerHTML = '';\n document.getElementById('boton4').innerHTML = '';\n document.getElementById('boton5').innerHTML = '';\n if (nombre === \"restaurante La Feria\") {\n restaurante1();\n }\n if (nombre === \"restaurante Mundo de Sabores\") {\n restaurante2();\n }\n if (nombre === \"restaurante Nuevo Hong Kong\") {\n restaurante3();\n }\n if (nombre === \"restaurante Rostizados\") {\n restaurante4();\n }\n if (nombre === \"restaurante La Garza\") {\n restaurante5();\n }\n ingresaBotones();\n}", "function verAcuerdoEspecialBonificaciones(id)\n{\nif(document.getElementById(\"divDatosAcuerdoEspecialBonificaciones\"+id).style.display==\"block\")\n {\n document.getElementById(\"divDatosAcuerdoEspecialBonificaciones\"+id).style.display=\"none\";\n document.getElementById(\"buttonVerDatosAcuerdoEspecialBonificaciones\"+id).innerHTML=\"Ver\";\n }\nelse\n {\n var requerimiento = new RequerimientoGet();\n requerimiento.setURL(\"acuerdobonificaciones/seleccionaracuerdo/ajax/datosAcuerdoBonificaciones.php\");\n requerimiento.addParametro(\"id\",id);\n requerimiento.addListener(respuestaVerDatosAcuerdoEspecialBonificaciones);\n requerimiento.ejecutar();\n }\n\n}", "function proposer(element){\n\t\t\t\t\t\n\t\t\t\t\t// Si la couleur de fond est lightgreen, c'est qu'on a déja essayé - on quitte la fonction\n\t\t\t\t\tif(element.style.backgroundColor==\"lightGreen\" ||fini) return;\n\t\t\t\t\t\n\t\t\t\t\t// On récupere la lettre du clavier et on met la touche en lightgreen (pour signaler qu'elle est cliqu�e)\n\t\t\t\t\tvar lettre=element.innerHTML;\n\t\t\t\t\tchangeCouleur(element,\"lightGrey\");\n\t\t\t\t\t\n\t\t\t\t\t// On met la variable trouve false;\n\t\t\t\t\tvar trouve=false;\n\t\t\t\t\t\n\t\t\t\t\t// On parcours chaque lettre du mot, on cherche si on trouve la lettre s�l�ectionn�e au clavier\n\t\t\t\t\tfor(var i=0; i<tailleMot; i++) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si c'est le cas :\n\t\t\t\t\t\tif(tableauMot[i].innerHTML==lettre) {\n\t\t\t\t\t\t\ttableauMot[i].style.visibility='visible';\t// On affiche la lettre\n\t\t\t\t\t\t\ttrouve=true;\n\t\t\t\t\t\t\tlettresTrouvees++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Si la lettre n'est pas présente, trouve vaut toujours false :\n\t\t\t\t\tif(!trouve){\n\t\t\t\t\t\tcoupsManques++;\n\t\t\t\t\t\tdocument.images['pendu'].src=\"asset/image/pendu_\"+coupsManques+\".jpg\"; // On change l'image du pendu\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si on a rate 9 fois :\n\t\t\t\t\t\tif(coupsManques==8){\n\t\t\t\t\t\t\talert(\"Vous avez perdu !\");\n\t\t\t\t\t\t\tfor(var i=0; i<tailleMot; i++) tableauMot[i].style.visibility='visible';\n\t\t\t\t\t\t\tfini=true;\n\t\t\t\t\t\t\t// on affiche le mot, on fini le jeu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(lettresTrouvees==tailleMot){\n\t\t\t\t\t\talert(\"Bravo ! Vous avez découvert le mot secret !\");\n\t\t\t\t\t\tfini=true;\n\t\t\t\t\t}\n\t\t\t\t}", "function PlcEvento (){\r\n\t\r\n}", "function mostrar(){\n document.write('Hola sobreescribiendo el método anterior');\n}", "function mostrarAsignarNivel(){ // Cuando toque el boton \"asignar nivel\" voy a ver la seccion (Asignar nivel a alumnos)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#divMostrarTablaXDocente\").innerHTML = \"\"; //limpio tabla por posible interaccion anterior\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"block\"; // muestro asignar nivel\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "function borraContenidoCeldas(grid,fila,posxinicio,posxfinal)\n{\n\tvar objCelda,objHeader,tipo,objCampo;\n\tfor(var i=posxinicio; i<=posxfinal; i++)\n\t{\n\t\tobjCelda=document.getElementById(grid+\"_\"+i+\"_\"+fila);\n\t\tif(!objCelda)\n\t\t\treturn false;\n\t\tobjHeader=document.getElementById(\"H_\"+grid+i);\n\t\tif(!objHeader)\n\t\t\treturn false;\n\t\ttipo=(objHeader.tipo)?objHeader.tipo:objHeader.getAttribute(\"tipo\");\n\t\tif(tipo==\"checkbox\")\n\t\t{\n\t\t\tobjCampo=document.getElementById(grid+\"_\"+i+\"_\"+fila);\n\t\t\tif(!objCampo)\n\t\t\t\treturn false;\n\t\t\tobjCampo.checked=false;\n\t\t\tobjCelda.valor=\"\";\n\t\t\tobjCelda.setAttribute(\"valor\",\"\");\n\t\t}\n\t\telse if(tipo == \"decimal\")\n\t\t{\n\t\t\tobjCelda.valor=0;\n\t\t\tobjCelda.setAttribute(\"valor\",0);\n\t\t}\n\t\telse if(tipo!=\"libre\" && tipo !=\"eliminador\" && tipo !=\"formula\")\n\t\t{\n\t\t\tobjCelda.valor=\"\";\n\t\t\tobjCelda.setAttribute(\"valor\",\"\");\n\t\t}\n\t\t\t\n\t\tif(tipo!=\"libre\" && tipo !=\"eliminador\" && tipo != \"oculto\")\n\t\t{\n\t\t\tobjCelda.innerHTML=\"&nbsp;\";\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tAplicaFormula(objCelda);\t\t\n\t}\n\treturn true;\n}", "function orden(op,campo,buscador)\n{\nobj = document.getElementById(op);\nvar left=obj.offsetParent.offsetLeft;\nvar query = window.location.search.substring(1);\ndocument.getElementById('marco').style.marginLeft=left+'px';\ndocument.getElementById('marco').style.marginTop=60+'px';\nmuestra_submen();\ncol=\"<div><div id=item><ul><li><a href=javascript:ira('asc','\"+campo+\"','\"+buscador+\"') onclick=oculta_submen()>Ordenar Ascendente</a></li></ul></div><div id=item2><ul><li><a href=javascript:ira('desc','\"+campo+\"') onclick=oculta_submen()>Ordenar Descendente</a></li></ul></div>\";\ndocument.getElementById('interior').innerHTML=col;\n}", "function limpiarCapas(){\n limpiarCapaRecorridos();\n limpiarCapaParadas();\n limpiarCapaNuevaRuta();\n limpiarCapturaNuevaRuta();\n limpiarCapaEstudiantes();\n}", "function Guarda_Clics_EES_Menos()\r\n{\r\n\tGuarda_Clics(1,0);\r\n}", "function controlloPedoneFinal(pos,primo)\n{\n\ttorre_b=\"torre_b\";torre_n=\"torre_n\";cavallo_b=\"cavallo_b\";cavallo_n=\"cavallo_n\";alfiere_b=\"alfiere_b\";alfiere_n=\"alfiere_n\";//è necessario per passare i parametri alla funzione 'trasforma'\n\t\n\tif(pos>=11 && pos<=18 && primo=='<img src=\"imm/pedone_b.png\">') //se il bianco è arrivato alla fine\n\t\tdocument.getElementById(\"transPedone\").innerHTML='<p>Sostituisci il pedone con una di queste pedine</p><img class=\"transs\" onClick=\"trasforma('+pos+','+torre_b+')\" src=\"imm/torre_b.png\"><br><img class=\"transs\" onClick=\"trasforma('+pos+','+cavallo_b+')\" src=\"imm/cavallo_b.png\"><br><img class=\"transs\" onClick=\"trasforma('+pos+','+alfiere_b+')\" src=\"imm/alfiere_b.png\">';\t\n\tif(pos>=81 && pos<=88 && primo=='<img src=\"imm/pedone_n.png\">') //se il nero è arrivato alla fine\n\t\tdocument.getElementById(\"transPedone\").innerHTML='<p>Sostituisci il pedone con una di queste pedine</p><img class=\"transs\" onClick=\"trasforma('+pos+','+torre_n+')\" src=\"imm/torre_n.png\"><br><img class=\"transs\" onClick=\"trasforma('+pos+','+cavallo_n+')\" src=\"imm/cavallo_n.png\"><br><img class=\"transs\" onClick=\"trasforma('+pos+','+alfiere_n+')\" src=\"imm/alfiere_n.png\">';\n}", "function executaEscolha(escolha, campoResultado)\n{\n //alert(\"entrou\");\n passos.push(parseInt(escolha.name)); //Adiciona no vetor qual o número da escolha atual\n //alert(escolha.innerHTML);\n //var tituloResultado = escolha.innerHTML;\n //resultado.innerHTML += \"<br><p><b>\"+escolha.innerHTML+\"</b><br>Teste danadão</p>\";\n var textoResultado = \"<br><p id=\\\"resultado\\\"><span>\"+escolha.innerHTML+\"</span><br>\";\n textoResultado += historia(escolha, passos);\n textoResultado += \"</p>\";\n campoResultado.innerHTML += textoResultado;\n window.scrollBy(0,1000);\n}", "function mostrar() {\n\n\n var input1 = document.getElementById(\"text\").value;\n var input2 = document.getElementById(\"text2\").value;\n\n document.getElementById(\"hConta1\").innerHTML = contar(input1);\n document.getElementById(\"hConta2\").innerHTML = contar(input2)\n}", "function PasarPagina( clicked_id ,FilasAMostrarXPagina,MaxPaginasAMostrar,usuario){ \n\t\n\tloading_show('DatosDePagina');\n Pag = parseInt(clicked_id); \n\tcont = 0;\n\tLimitINICIO = 0;\n\t\n\t//Cambia los limites segun el ide de la pagina\n\tif (Pag>=0){\n\t\t//while(cont <= Pag){\n\t\t\ttry\n\t\t\t{\n\t\t\t\tLimitINICIO = Pag*FilasAMostrarXPagina;\n\t\t\t}catch (e){//alert(\"Error \" + e)\n\t\t\tLimitINICIO = 0;\n\t\t\t} \n\t\t\t\n\t\t\t// alert(\"while cont : \"+cont+\" Pag: \"+ Pag+\" LimitINICIO : \" + LimitINICIO );\n\t\t\t//cont+=1;\n\t\t\t//}\n\t\t}\n\t\t\n\t\tif (Pag > PagActivoIni)\n\t\t{\n\t\t\t\n\t\t//limpia Primer cuadro de los 10 al pasar al segundo cuadro\n\t $(\"#\"+PagActivoIni).removeClass(\"NumPaginaACTIVO\");\n\t $(\"#\"+PagActivoIni).addClass(\"NumPagina\");\n\t \n\t\t}\n\t\t\n\t\t//if (Pag==0)\n // $(\"#Anterior\").css(\"display\",\"none\");\n\t if (Pag > 0)\n\t $(\"#Anterior\").css(\"display\",\"inline\");\n\t \n\t \n// alert(\"Pag: \"+ Pag+\" LimitINICIO : \" + LimitINICIO );\n\t //llama a la funcion que devuelve los datos de la pagina\n\t \n\t ObtieneDatosDePagia(LimitINICIO,25,usuario,Busqueda,\"NOMostrarRutero\");\n\t//ObtieneDatosDePagia(LimitINICIO,25,usuario,Busqueda,\"\");\n\t\n\n\t//elemento = document.getElementById(clicked_id);\n\t\telemento = document.getElementById(Pag);\n\t\n\t\t\t \n\t\t /*el elemento es null cuando se pasa de 9 a 10 ya que el elemento 10 se crea hasta despues de salir de la funcion Siguiente()*/ \n\t\t\n\tif (elemento != null){\n\t\tPagBackup.className = \"NumPagina\";\n\t PagBackup = elemento;\n\t\t}\n\t\n\t//activa y desactiva los cuadros\n\tif (elemento.className == \"NumPaginaACTIVO\") {\n\t\telemento.className = \"NumPagina\";\n\t\t}\n\telse {\n\t\t elemento.className = \"NumPaginaACTIVO\";\n\t }\n\n //Si el numero de la pagina es mayor al bloque de paginas mostradas\n\tif (Pag > PagActivoIni){\n\t\t\n\t\t$(\"#Anterior\").className = \"NumPagina\";\n\t\t//limpia Primer cuadro de los 10 al pasar al segundo cuadro\n\t $(\"#\"+PagActivoIni).removeClass(\"NumPaginaACTIVO\");\n\t $(\"#\"+PagActivoIni).addClass(\"NumPagina\");\n\t\t}\n\t\n\t\n \t//ObtieneDatosDePagia(LimiteINICIO,LimiteFIN); \n\t\n\t // loading_hide('DatosDePagina');\n\t\n}", "function funcEjemplo() {\n console.log(\"Ejemplo de funcion opcional\");\n}", "function mostrar() {\n miLibro.mostrar();\n}", "function verAcuerdoBonificaciones(id)\n{\nif(document.getElementById(\"divDatosAcuerdoBonificaciones\"+id).style.display==\"block\")\n {\n document.getElementById(\"divDatosAcuerdoBonificaciones\"+id).style.display=\"none\";\n document.getElementById(\"buttonVerDatosAcuerdoBonificaciones\"+id).innerHTML=\"Ver\";\n }\nelse\n {\n var requerimiento = new RequerimientoGet();\n requerimiento.setURL(\"acuerdobonificaciones/seleccionaracuerdo/ajax/datosAcuerdoBonificaciones.php\");\n requerimiento.addParametro(\"id\",id);\n requerimiento.addListener(respuestaVerDatosAcuerdoBonificaciones);\n requerimiento.ejecutar();\n }\n\n}", "function buscar(){ // função de executar busca ao clicar no botão\n \n let buscaId = document.getElementById('txtBuscar');\n buscaDados(buscaId.value.toLowerCase());\n}", "function punto(posX , posY){\n\n // Almacena la cantidad de puntos que hay en el cuerpo\n canLesiones++;\n\n // Arma la estructura del #id\n var idLesion = 'Puntolesion_' + canLesiones;\n\n // Ancho y alto del contenedor del cuerpo\n var ancho = $(\"#cont_cuerpo\").width();\n var alto = $(\"#cont_cuerpo\").height();\n\n // Distancia del scroll con respecto a la parte superior de la ventana\n var scroll = $(window).scrollTop();\n\n // Calculo de la posición para el punto , teniendo en cuenta la posición del scroll y los 60px de alto de la bara de navegación de la página.\n var totalY = (posY + scroll) - 133;\n\n // Creación de un punto en el DOM\n $(\"#cont_cuerpo\").append(\"<div class='lesion' id='\"+idLesion+\"' onclick='consultarLesion(\"+ lesiones.length +\" , this.id, event)'></div>\");\n\n // Ubicaciones en el eje x - y para el punto\n var puntoX =( (posX * 100)/ancho) - 0.4;\n var puntoY = (totalY * 100)/alto;\n\n // Ubicar el punto en las cordenadas correspondientes\n $(\"#\" + idLesion).css({\n top : puntoY + \"%\",\n left : puntoX + \"%\"\n });\n\n // Crear objeto temporal para almacenar la información del punto\n var tempLesion={\n 'infoPunto':{\n 'posX':puntoX,\n 'posY':puntoY\n },\n 'infoLesion':infoLesion\n };\n\n // Agreagar tempLesion al final del arreglo lesiones\n lesiones.push(tempLesion);\n\n }", "function permite(elEvento, permitidos)\r\n{\r\n // Variables que definen los caracteres permitidos\r\n var numeros = \"0123456789.\";\r\n var caracteres = \" abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ\";\r\n var numeros_caracteres = numeros + caracteres;\r\n var teclas_especiales = [8, 9, 37, 39, 46, 44, 13];\r\n var telefonos = \"1234567890-()+\";\r\n var date = \"1234567890-/\";\r\n // 46 = Supr, 37 = flecha izquierda, 39 = flecha derecha, 9=Tab\r\n \r\n \r\n // Seleccionar los caracteres a partir del parámetro de la función\r\n switch(permitidos) {\r\n case 'num':\r\n permitidos = numeros;\r\n break;\r\n case 'car':\r\n permitidos = caracteres;\r\n break;\r\n case 'tel':\r\n permitidos = telefonos;\r\n break;\r\n case 'num_car':\r\n permitidos = numeros_caracteres;\r\n case 'date':\r\n permitidos = date;\r\n break;\r\n }\r\n \r\n // Obtener la tecla pulsada \r\n var evento = elEvento || window.event;\r\n var codigoCaracter = evento.charCode || evento.keyCode;\r\n var caracter = String.fromCharCode(codigoCaracter);\r\n //window.alert(codigoCaracter);//pruebas\r\n \r\n // Comprobar si la tecla pulsada es alguna de las teclas especiales\r\n // (teclas de borrado y flechas horizontales)\r\n var tecla_especial = false;\r\n for(var i in teclas_especiales) {\r\n if(codigoCaracter == teclas_especiales[i]) {\r\n tecla_especial = true;\r\n break;\r\n }\r\n }\r\n \r\n // Comprobar si la tecla pulsada se encuentra en los caracteres permitidos\r\n // o si es una tecla especial\r\n return permitidos.indexOf(caracter) != -1 || tecla_especial;\r\n}", "function inicia(){\n controlVisualizacion.iniciaControlVisualizacion();\n controlVisualizacion.creaHTMLGeneral(); \n controlVisualizacion.iniciaElementosDOM();\n\n //iniciamos con la escena 1\n controlVisualizacion.comenzamos();\n}", "function inicia(){\n controlVisualizacion.iniciaControlVisualizacion();\n controlVisualizacion.creaHTMLGeneral(); \n controlVisualizacion.iniciaElementosDOM();\n\n //iniciamos con la escena 1\n controlVisualizacion.comenzamos();\n}", "function posarBoleta(e) {\r\n// console.log(\"has clicat el \"+ e.target.getAttribute('id'));\r\n if (numDeClics==0) {\r\n //si guanya\r\n if (e.target.getAttribute('id')==aleatorio) {\r\n resultat(\"guany\", \"Felicitats :)\");\r\n // resultat(\"Felicitats :)\");\r\n //si perd\r\n }else{\r\n // resultat(\"Torna a provar! :S\");\r\n resultat(\"perd\", \"Torna a provar! :S\");\r\n\r\n }\r\n numDeClics=numDeClics+1;\r\n }\r\n}", "function copiafyv(principal, copia) {\n try {\n /*Analizo primero el root principal */\n principal.lista_Nodo.forEach(function (element) {\n if (element.tipo == \"Clase\") {\n MYFPrincipal = [];\n MYFfCopia = [];\n /*por cada calse encontrada, la busco en el otro arbol*/\n copia.lista_Nodo.forEach(function (element2) {\n if (element2.tipo == \"Clase\") {\n /*Por cada clase que encuentro en el otro root compruebo si son los mismos*/\n if (element.descripcion == element2.descripcion) {\n /*recorro para encontrar los metodos y funciones de la clase principal*/\n element.lista_Nodo.forEach(function (element3) {\n if (element3.tipo == \"Funcion\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosMF) {\n if (parametrosMF.tipo == \"Parametros\") {\n var parametroslst = returnLst(parametrosMF.lista_Nodo);\n element2.lista_Nodo.forEach(function (fmCopia) {\n if (fmCopia.tipo == \"Funcion\" && element3.tipodato == fmCopia.tipodato) {\n fmCopia.lista_Nodo.forEach(function (paramCopia) {\n if (paramCopia.tipo == \"Parametros\") {\n var parametroslstCopia = returnLst(paramCopia.lista_Nodo);\n if (parametroslst.toString() == parametroslstCopia.toString()) {\n console.log(\"las funciones \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia_Clase.push(element.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n else if (element3.tipo == \"Metodo\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosF) {\n if (parametrosF.tipo == \"Parametros\") {\n var parametroslstM = returnLst(parametrosF.lista_Nodo);\n element2.lista_Nodo.forEach(function (mCopia) {\n if (mCopia.tipo == \"Metodo\" && element3.descripcion == mCopia.descripcion) {\n mCopia.lista_Nodo.forEach(function (paramCopiaM) {\n if (paramCopiaM.tipo == \"Parametros\") {\n var parametroslstCopiaM = returnLst(paramCopiaM.lista_Nodo);\n if (parametroslstM.toString() == parametroslstCopiaM.toString()) {\n console.log(\"los metodos \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia.push(element3.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n });\n if (MYFPrincipal.toString() == MYFfCopia.toString()) {\n console.log(\"las clases \" + element.descripcion + \" Son iguales en ambos archivos\");\n }\n }\n }\n });\n }\n });\n }\n catch (error) {\n }\n}", "function dibujarFresado118(modelo,di,pos,document){\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5]\n\tEAction.handleUserMessage(\"ha entrado 11111111111111111 \");\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (n=0;n<5;n=n+1){ \n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado11 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior) //nuevo\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca) //muevo\n\t\n\tvar fresado23 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\t\n\t\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado14b = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5-alaInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14b , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\n\t}else{\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\tEAction.handleUserMessage(\"ha entrado 44444444444444444444444444 \");\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x-anchura1+pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n\t}\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){ \n\t\tvar fresado4 = new RVector(pos.x-anchura1-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x-anchura1-anchura2+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){ \n\t\tvar fresado6 = new RVector(pos.x-anchura1-anchura2-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>(pliegueInf4*2)){ \n\t\tvar fresado8 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\n\t//anchura4 - Inferior\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado10 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado11 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t\n\t\n\n\tEAction.handleUserMessage(\"ha entrado 555555555555555555555555555555555555555555555555 \");\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){ \n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x-anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){ \n\t\tvar fresado31 = new RVector(pos.x-anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2){ \n\t\tvar fresado43 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado41 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado45 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado46 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado45 , fresado46 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura5 - Superior\n\tif (anchura5>pliegueSuperior){ \n\t\tvar fresado49 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado50 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado47 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado48 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\treturn op_fresado;\n\t\n\t\n\t\n\t\n\t\n}" ]
[ "0.65542704", "0.6495829", "0.6143127", "0.6143127", "0.60917383", "0.60357255", "0.595808", "0.59304494", "0.5917927", "0.5917927", "0.5917927", "0.5916683", "0.57877177", "0.5783338", "0.57822526", "0.5778104", "0.57690966", "0.5768726", "0.57636976", "0.57540953", "0.57509667", "0.5750191", "0.57281655", "0.5723539", "0.5715702", "0.5707313", "0.5707133", "0.57044494", "0.5702836", "0.5695034", "0.5680521", "0.5679578", "0.56763566", "0.56632686", "0.5641458", "0.563923", "0.5636035", "0.5633623", "0.5631829", "0.56298465", "0.56221193", "0.562207", "0.5612993", "0.5611868", "0.5608106", "0.55991036", "0.55915946", "0.55899686", "0.5589877", "0.55888706", "0.5584629", "0.5581778", "0.5580819", "0.5578078", "0.5578025", "0.557664", "0.55683875", "0.55628955", "0.55609137", "0.55605954", "0.55535984", "0.5550831", "0.55504316", "0.5550126", "0.5549025", "0.55443907", "0.55420583", "0.5540503", "0.5540229", "0.5538712", "0.5534266", "0.55313903", "0.5525762", "0.5525312", "0.5521659", "0.55184567", "0.5513723", "0.55090004", "0.5507899", "0.55037665", "0.5498144", "0.5492511", "0.54924774", "0.54923856", "0.54897386", "0.54810417", "0.5476074", "0.54696107", "0.5469506", "0.5466012", "0.5465005", "0.5462268", "0.5461361", "0.54590863", "0.54537094", "0.54512703", "0.54501694", "0.54501694", "0.5445638", "0.5443045", "0.5442532" ]
0.0
-1
funcion que detiene el cronometro
function stops(){ window.clearInterval(timer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function continuar() {\n emp2=new Date(); //fecha actual\n emp2=emp2.getTime(); //pasar a tiempo Unix\n emp3=emp2-cro; //restar tiempo anterior\n emp=new Date(); //nueva fecha inicial para pasar al temporizador \n emp.setTime(emp3); //datos para nueva fecha inicial.\n elcrono=setInterval(tiempo,10); //activar temporizador\n marcha=1; //indicar que esta en marcha\n document.cron.boton2.value=\"parar\"; //Cambiar estado del botón\n document.cron.boton1.disabled=false; //activar boton 1 si estuviera desactivado\n }", "function cronJob() {\n\t\t//Schedule Synchronized Loop, so we dont get of sync \n\t\tnextMinute(function () {\n util.log(\"Exec loop\"); \n MomoInstance.execCronsNow(); \n cronJob();\n\t\t});\n\t}", "function timer(){\n cronometro = window.setInterval(Iniciar, 1000);\n}", "function inicializaCronometro() {\n\t\n\tcampo.one(\"focus\", function () { // a função one descarta eventos iguais seguintes\n//campo.on(\"focus\", function () { // a função on capta o 1º e todos os eventos posteriores\n\t\tvar tempoRestanteSPAN = $(\"#tempo-digitacao\");\n\t\tvar tempoRestante = tempoRestanteSPAN.text();\n\n\t\tdesabilitaIcon(\"#botao-reiniciar\");\n\t\t\t/*$(\"#botao-reiniciar\").attr(\"disabled\",true);\n\t\t\t$(\"#botao-reiniciar\").addClass(\"disabled\");*/\n\t\tvar cronometroID = setInterval(function () {\n\t\t\ttempoRestanteSPAN.text(--tempoRestante);\n\t\t\t// .attr(\"atributo da tag\", ?) devolve e define, como a .text(?).\n\t\t\tif( tempoRestante < 1 ) {\n\t\t\t\tclearInterval(cronometroID);\n\t\t\t\tfinalizaJogo();\n\t\t\t}\n\n\t\t}, 1000);\n\t});\n}", "function iniciarCronometro(){\n \n intervaloTempo = setInterval(function(){\n\n tempoJogo.segundos++;\n \n if(tempoJogo.segundos < 10){\n tempoJogo.segundos = '0'+tempoJogo.segundos;\n }\n if(tempoJogo.segundos < 60 && tempoJogo.minutos === 0){\n tempoJogo.minutos=0;\n tempoJogo.minutos = '0'+tempoJogo.minutos;\n }\n \n if(tempoJogo.segundos === 60){\n tempoJogo.minutos++;\n tempoJogo.segundos = '0'+0;\n if(tempoJogo.minutos < 10){\n tempoJogo.minutos = '0'+tempoJogo.minutos;\n }\n }\n\n if(tempoJogo.minutos === 60){\n tempoJogo.minutos = 0;\n tempoJogo.horas++;\n if(tempoJogo.horas < 10){\n tempoJogo.horas = '0'+tempoJogo.horas;\n }\n }\n\n if(tempoJogo.horas == 24){\n tempoJogo.horas = 0;\n tempoJogo.dias++\n }\n\n //Ganho de estamina por tempo\n if(tempoJogo.minutos % 5 == 0 && tempoJogo.segundos == 0 && jogador1.estamina < 100){\n jogador1.estamina++;\n gravarLS('estaminaJ', jogador1.estamina);\n mostraInfoJogador();\n }\n\n //Tempo referente ao rendimento no banco\n if(tempoJogo.horas % 1 == 0 && tempoJogo.minutos == 0 && tempoJogo.segundos == 0){\n jogador1.saldoConta += jogador1.rendimento;\n jogador1.saldoConta = parseInt(jogador1.saldoConta);\n console.log(`saldo: ${jogador1.saldoConta}`)\n gravarLS('saldo', jogador1.saldoConta);\n mostraInfoJogador(); \n }\n\n //Ganhos diários do cabaré\n if(tempoJogo.horas % 6 == 0 && tempoJogo.minutos == 0 && tempoJogo.segundos == 0){\n if(cabareG1.pagamentoDia == null){\n return\n }else{\n cabareG1.ganhos = parseInt(cabareG1.ganhos)\n cabareG1.ganhos += (cabareG1.pagamentoDia);\n localStorage.setItem('meuCabare', JSON.stringify(cabareG1))\n mostraMeuCabare()\n } \n }\n \n gravarLS('min', tempoJogo.minutos);\n gravarLS('horas', tempoJogo.horas);\n gravarLS('dias', tempoJogo.dias);\n \n $horas.innerHTML = `<i class=\"far fa-clock\"></i> ${tempoJogo.horas} : ${tempoJogo.minutos}`;\n $dias.innerHTML = `<i class=\"far fa-calendar-alt\"></i> Dia: ${tempoJogo.dias}` ;\n },100) \n}", "function startCron (){\n\n stopCron();\n if(CRON_STATUS =='START'){\n interval = setInterval(postInit,CRON_INTERVAL*60*1000 )\n }\n return pushData();\n\n}", "function cronometro () { \n timeActual = new Date();\n acumularTime = timeActual - timeInicial;\n acumularTime2 = new Date();\n acumularTime2.setTime(acumularTime);\n ss = acumularTime2.getSeconds();\n mm = acumularTime2.getMinutes();\n hh = acumularTime2.getHours()-21;\n if (ss < 10) {ss = \"0\"+ss;} \n if (mm < 10) {mm = \"0\"+mm;}\n if (hh < 10) {hh = \"0\"+hh;}\n timer.innerHTML = hh+\" : \"+mm+\" : \"+ss;\n}", "function create() {\n // cronJobs.push(createCron('RT Movies', '* 30 11 * * 0-6', movies.updateMovies.bind(movies))); // This cron runs every weekday at 11:30am\n cronJobs.push(createCron('RT Movies', '* 30 11 * * 0-6', movies.updateMovies.bind(movies))); // This cron runs every weekday at 11:30am\n log.info('Cron Jobs successfully created');\n}", "static get schedule() {\n // once every minute\n return '0 0 10 1/1 * ? *'\n }", "getSchedule(){\n // return CRON schedule format\n // this sample job runs every 15 seconds\n return '*/15 * * * * *';\n }", "function cronMaker(obj) {\n let hour = obj.hour;\n let min = obj.min;\n let weekDay = obj.weekDay;\n let monthdate = obj.monthdate;\n let delayInDays = obj.delayInDays;\n\n let expression = \"\";\n if (obj.type === 'Daily') {\n expression = min + \" \" + hour + \" */\" + delayInDays + \" * ?\";\n }\n else if (obj.type === 'Weekly') {\n expression = min + \" \" + hour + \" ? * \" + weekDay;\n }\n else if (obj.type === 'Monthly') {\n expression = min + \" \" + hour + \" \" + monthdate + \" * ?\";\n }\n \n return expression;\n}", "function cronCallbackTimer(arg, cron_id) {\n let hourNow = rtc.getTimeHours();\n let minNow = rtc.getTimeMinutes();\n\n print('[cronCallbackTimer] Hour: ' + JSON.stringify(hourNow));\n print('[cronCallbackTimer] Min: ' + JSON.stringify(minNow));\n\n if (hourOn !== hourOff) {\n if (yHour[hourNow]) {\n if (hourNow === JSON.parse(hourOn)) {\n if (minNow >= JSON.parse(minOn)) {\n print('On')\n applyBoardConfig();\n } else {\n print('Off');\n turnOffLed();\n }\n } else {\n print('On')\n applyBoardConfig();\n }\n } else {\n if (hourNow === JSON.parse(hourOff)) {\n if (minNow >= JSON.parse(minOff)) {\n print('Off');\n turnOffLed();\n } else {\n print('On')\n applyBoardConfig();\n }\n } else {\n print('Off');\n turnOffLed();\n }\n }\n }\n\n if (JSON.parse(hourOn) === JSON.parse(hourOff)){\n if (yHour[hourNow]) {\n if (hourNow === JSON.parse(hourOn)) {\n if(yMin[minNow]) {\n applyBoardConfig();\n } else {\n turnOffLed();\n }\n } else {\n applyBoardConfig();\n }\n } else {\n if (hourNow === JSON.parse(hourOff)) {\n if(yMin[minNow]) {\n applyBoardConfig();\n } else {\n turnOffLed();\n }\n } else {\n turnOffLed();\n }\n }\n }\n \n}", "function job() {\n exec(str)\n schedule.scheduleJob('* */30 * * * *', () => {\n exec(str)\n });\n}", "function cron() {\n console.log(`Updating db - ${new Date()}`);\n updateDb(payload)()\n .then((res) => console.log('sucess!'))\n .catch((err) => console.error(err));\n }", "static get schedule() {\n // once every hour\n return '* */1 * * *';\n }", "ScheduleAt(time){\n \tconsole.log(\"scheduleprofecionales at\");\n }", "async function sendOrdersCron() {\n \n var rule = new schedule.RecurrenceRule();\n rule.hour = 8;\n rule.minute = 0;\n\n let cronCounter = 0\n\n schedule.scheduleJob(rule, async () => { \n console.log('Ran cron: ', new Date())\n if (process.env.NODE_ENV == 'test') return cronCounter++\n \n await sendOrdersForShops()\n })\n}", "static cron(options) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_applicationautoscaling_CronOptions(options);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.cron);\n }\n throw error;\n }\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const year = fallback(options.year, '*');\n // Weekday defaults to '?' if not supplied. If it is supplied, day must become '?'\n const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*');\n const weekDay = fallback(options.weekDay, '?');\n return new class extends Schedule {\n constructor() {\n super(...arguments);\n this.expressionString = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`;\n }\n _bind(scope) {\n if (!options.minute) {\n core_1.Annotations.of(scope).addWarning('cron: If you don\\'t pass \\'minute\\', by default the event runs every minute. Pass \\'minute: \\'*\\'\\' if that\\'s what you intend, or \\'minute: 0\\' to run once per hour instead.');\n }\n return new LiteralSchedule(this.expressionString);\n }\n };\n }", "function calculadora(){\n\n // Conjunto de instrucciones a ejecutar\n console.log(\"Hola, soy la calculadora\" ) ;\n console.log(\"si soy yo\");\n console.log(\"cuantas veces quieras\")\n\n return \"Hola soy la programadora\"\n \n}", "function Scheduler(guild_id) {\n\tlet timeRule, timeJob, midnightRule, midnightJob;\n\tfunction init(time = \"00:00\", timezone, timeCommand, midnightCommand) {\n\t\ttimeRule = new schedule.RecurrenceRule();\n\t\tmidnightRule = new schedule.RecurrenceRule();\n\t\tif (timezone) {\n\t\t\ttimeRule.tz = timezone;\n\t\t\tmidnightRule.tz = timezone;\n\t\t}\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob = schedule.scheduleJob(timeRule, (time) => {\n\t\t\ttry {\n\t\t\t\ttimeCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t\t[midnightRule.hour, midnightRule.minute] = [0, 0];\n\t\tmidnightJob = schedule.scheduleJob(midnightRule, (time) => {\n\t\t\ttry {\n\t\t\t\tmidnightCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t}\n\tfunction setTimezone(timezone) {\n\t\ttimeRule.tz = timezone;\n\t\ttimeJob.reschedule(timeRule);\n\t\tmidnightRule.tz = timezone;\n\t\tmidnightJob.reschedule(midnightRule);\n\t}\n\tfunction setTime(time = \"00:00\") {\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob.reschedule(timeRule);\n\t}\n\tfunction destroy() {\n\t\ttimeJob.cancel();\n\t\tmidnightJob.cancel();\n\t\tdelete schedulers[guild_id];\n\t}\n\treturn {\n\t\tinit,\n\t\tsetTimezone,\n\t\tsetTime,\n\t\tdestroy\n\t}\n}", "function calculadora(){\n\tconsole.log(\"soy una calculadora\");\n}", "function pushNotificationCron() {\n async.waterfall([\n // connectDB,\n getListAutoPush,\n putItemIntoQueue,\n getUserIdBySearhQuery,\n // closeDB\n ], function (err, result) {\n if (err) {\n pushToSlack(\"@loint\", err);\n }\n });\n}", "static cron(options) {\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const day = fallback(options.day, '*');\n const weekDay = fallback(options.weekDay, '*');\n return new LiteralSchedule(`${minute} ${hour} ${day} ${month} ${weekDay}`);\n }", "function pollAuctionContractCronJob() {\n // Run CronJob Every Minute\n new Cron.CronJob(\n '* * * * *',\n function () {\n cron.pollAuctionContract();\n },\n null,\n true,\n 'America/Los_Angeles',\n );\n}", "function schedule(){\n console.log(Date());\n cron.schedule('0 9 * * *', function(){\n knex.select('users.first_name', 'users.phone_number', 'tasks.title', 'tasks.description', 'due_date').from('tasks').leftJoin('users', 'tasks.user_id', 'users.id').where('due_date', new Date().toISOString().slice(0,10)).andWhere('tasks.is_complete', 'false')\n .then(function(data){\n console.log('cron');\n var messages =[];\n for(var i = 0; i < data.length; i++){\n messages.push(sendMessage(data[i].phone_number, data[i].title));\n }\n\n Promise.all(messages).then(function(results){\n console.log(results);\n })\n .catch(function(err){\n console.log(err);\n });\n });\n });\n}", "function cronRule( rule ) { return ( typeof rule === \"undefined\" ) ? \"*\" : rule; }", "function cronValidate(cronExpression) {\n if (!cronExpression) {\n return false;\n } // alert(\"校验函数的开始!\");\n\n\n let cronParams = cronExpression.split(' ');\n\n if (cronParams.length < 6 || cronParams.length > 7) {\n return false;\n } // CronTrigger cronTrigger = new CronTrigger();\n // cronTrigger.setCronExpression( cronExpression );\n\n\n if (cronParams[3] == '?' || cronParams[5] == '?') {\n // Check seconds param\n if (!checkSecondsField(cronParams[0])) {\n return false;\n } // Check minutes param\n\n\n if (!checkMinutesField(cronParams[1])) {\n return false;\n } // Check hours param\n\n\n if (!checkHoursField(cronParams[2])) {\n return false;\n } // Check day-of-month param\n\n\n if (!checkDayOfMonthField(cronParams[3])) {\n return false;\n } // Check months param\n\n\n if (!checkMonthsField(cronParams[4])) {\n return false;\n } // Check day-of-week param\n\n\n if (!checkDayOfWeekField(cronParams[5])) {\n return false;\n } // Check year param\n\n\n if (cronParams.length == 7) {\n if (!checkYearField(cronParams[6])) {\n return false;\n }\n }\n\n return true;\n }\n return false;\n\n}", "function getCronFromTime(time){\n const d = new Date()\n const d1 = new Date()\n const timeStr = time.toString()\n const hours = timeStr.split(\":\")[0]\n const min = timeStr.split(\":\")[1]\n // convert UTC Time to local Time \n const utc_offeset = d.getTimezoneOffset()\n let utc_date = new Date( d.setMinutes(d.getMinutes() + utc_offeset)) \n \n const deff_hours = d1.getHours() - utc_date.getHours()\n const deff_min = d1.getMinutes() - utc_date.getMinutes()\n const actualHour = deff_hours + parseInt(hours)\n const actualMinutes = deff_min + parseInt(min)\n \n return `${actualMinutes} ${actualHour} * * *`\n}", "function exec() {\n const valor = 'Local'\n minhaFuncao()\n}", "function activaFuncionamientoReloj() {\n let tiempo = {\n hora: 0,\n minuto: 0,\n segundo: 0\n };\n\n tiempo_corriendo = null;\n\n\n tiempo_corriendo = setInterval(function () {\n // Segundos\n tiempo.segundo++;\n if (tiempo.segundo >= 60) {\n tiempo.segundo = 0;\n tiempo.minuto++;\n }\n\n // Minutos\n if (tiempo.minuto >= 60) {\n tiempo.minuto = 0;\n tiempo.hora++;\n }\n\n $horasDom.text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);\n $minutosDom.text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);\n $segundosDom.text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);\n }, 1000);\n corriendo = true;\n\n }", "function getCronConfig() {\n return {\n daily: `${wakeUpMinute} ${wakeupHour} * * *`,\n weekly: {\n sun: `${wakeUpMinute} ${wakeupHour} * * sun`,\n mon: `${wakeUpMinute} ${wakeupHour} * * mon`,\n tue: `${wakeUpMinute} ${wakeupHour} * * tue`,\n wed: `${wakeUpMinute} ${wakeupHour} * * wed`,\n thu: `${wakeUpMinute} ${wakeupHour} * * thu`,\n fri: `${wakeUpMinute} ${wakeupHour} * * fri`,\n sat: `${wakeUpMinute} ${wakeupHour} * * sat`,\n },\n makeDaily: makeDaily,\n makeWeekly: makeWeekly,\n makeMonthly: makeMonthly\n }\n}", "function startTimer () {\n console.log(\"Start timer...\")\n if (isMarch == false) { \n timeInicial = new Date();\n control = setInterval(cronometro, 10);\n isMarch = true;\n }\n}", "function RequestScheduler() {}", "function update_time()\n{\n\t$('.cronos').each(function() {\n\t\tvar name = $(this).attr(\"name\");\n\t\tvar estado = parseInt($(this).attr(\"estado\"));\n\t\tvar time = $(this).val();\n\t\tvar ID = name.substring(6); // a partir de la 6 posicio\n\t\tvar capa = '#time_'+ID;\n\t\tvar capabotons = '#capabotons_'+ID;\n\t\t\n\t\t// color\n\t\tvar color = \"blue\";\n\t\tif (time<3600) color = \"orange\";\n\t\tif (time<300) color = \"red\";\n\t\t$(capa).html(strtotime(time));\n\t\t$(capa).css(\"color\", color);\n\t\t$(this).val(time-1);\n\t\tif (time<0 && estado < 5)\n\t\t\t$(capabotons).hide();\t\n\t});\t\n}", "scheduleWatchMessages() {\n this.cronJob = schedule(checkFrequency, this.checkNewMessages.bind(this), {});\n }", "function activar(quien, //requerido\nmomento, //opcional\nobjeto = 'omarxxx' //dato por defecto\n) {\n momento ? console.log(\"quien\" + quien, \"objeto\" + objeto, \"momento\" + momento) : console.log(\"quien\" + quien, \"objeto\" + objeto);\n}", "function shellGetS()\n{\n krnGetScheduler();\n}", "async start() {\n try {\n this.job = new CronJob('00 00 22 * * *', async () => {\n logger.info(\n 'MIS-report generator running at ',\n moment().format('DD/MM/YYYY'), this.job.cronTime.source,\n );\n await this.generateReportData();\n }, null, true, 'Asia/Kolkata');\n this.job.start();\n } catch (e) {\n logger.info(e);\n throw new InstabikeError(e);\n }\n }", "function init() {\n\n\t// Stop and delete cronjobs before restarting them\n\tfor (var i in cronjobs) {\n\t\tvar job = cronjobs[i];\n\t\tjob.stop();\n\t\tdelete(cronjobs[i]);\n\t}\n\n\n\tvar sites = storage.getItem('sites');\n\n\t// Start a cronjob for each site\n\t_.each(sites, function(site, k){\n\t\t\n\t\t// If the cron is set\n\t\tif (site.cron) {\n\n\t\t\t// Store it to be able to stop the jobs\n\t\t\tcronjobs.push( \n\t\t\t\tnew cronjob(\n\t\t\t\t\tsite.cron, \n\t\t\t\t\tfunction(){\n\t\t\t\t\t\tthis.k = k;\n\t\t\t\t\t\t// start the backup and the download\n\t\t\t\t\t\tvar backup = new akeeba(this.url, this.key);\n\t\t\t\t\t\tbad.backupAndDownload(backup, this);\n\t\t\t\t\t},\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\n\t\t\t\t\t}, \n\t\t\t\t\ttrue, // Start now\n \t\t\t\t\tnull,\n\t\t\t\t\tsite // Context\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t});\n}", "function cron(req, config, callback){\n checkETLStatus(req, config, function(err, response, data){\n if (err){\n callback(err);\n } else {\n console.log(\"ETL Status Check Successful\", data);\n fetchPIList(req, config, function(err, response, data){\n if (err){\n callback(err);\n } else {\n console.log(\"Investigators List Successfully fetched and uploaded to S3\");\n }\n });\n }\n });\n}", "function modeReloj(idde){\n\tvar reloj = document.getElementById(\"cronometro\");\n\tif(idde == \"cronometro\"){\n\t\tcontrarreloj=true;\n\t\treloj.style.backgroundColor=\"#009920\";\n\t}\n}", "constructor() {\n const params = { cronProcessId: cronProcessId };\n\n super(params);\n\n const oThis = this;\n\n oThis.canExit = true;\n }", "function runScheduler()\n{\n schedulerTick();\n setTimeout(runScheduler, scheduler_tick_interval);\n}", "function iniciarJuego() {\n\n\n //se determina el tiempo en milisegundos para ir cambiando\n setInterval(function() {\n segTranscurridos += 1;\n document.getElementById('cronometro').innerHTML = \"Tiempo: \" + segTranscurridos;\n }, 1000);\n\n\n\n //mando llamar la funcion para dibujar solo las minas\n dibujarMinas(ancho, alto, 'bombas');\n campoJuego = crearCampoJuego(ancho, alto, numMinas);\n\n var botonsitos = document.getElementsByName('botonsitos');\n\n for (var i = 0; i < botonsitos.length; i++) {\n document.getElementById(botonsitos[i].id).onclick = posicionactual;\n }\n segTranscurridos = 0;\n}", "async function funzioneAsincrona(req, res){\n const { execFile } = require('child_process');\n const child = execFile('letturaDati.py', {}, (error, stdout, stderr) => {\n if (error) {\n reject('BB Non è stato possibile leggere nella funzione checkExist');\n }\n res.pipe(child.stdout);\n });\n}", "static async _schedule() {\n\t\t// Register the task definition first\n\t\tconsole.log(\"SCHEDULE 1) Register Task Definition\");\n\t\tconst taskDefinition = await ECSManager.registerTaskDefinition();\n\t\tconst taskDefinitionArn = taskDefinition.taskDefinition.taskDefinitionArn;\n\n\t\t// Register a Cloudwatch event for this task definition as a cron job\n\t\tconsole.log(\"SCHEDULE 2) Register CloudWatch event\")\n\t\tconst targetSchedule = await CloudWatchManager.registerEvent(taskDefinitionArn);\n\t\treturn targetSchedule;\n\t}", "function runAndScheduleTask () {\n\t\ttask( scheduleNextExecution );\n\t}", "function actualizaReloj(){ \n \n/* Capturamos la Hora, los minutos y los segundos */\nmarcacion = new Date() \n \n/* Capturamos la Hora */\nHora = marcacion.getHours() \n \n/* Capturamos los Minutos */\nMinutos = marcacion.getMinutes() \n \n/* Capturamos los Segundos */\nSegundos = marcacion.getSeconds() \n \n/* Si la Hora, los Minutos o los Segundos\nSon Menores o igual a 9, le añadimos un 0 */\n \nif (Hora<=9)\nHora = \"0\" + Hora\n \nif (Minutos<=9)\nMinutos = \"0\" + Minutos\n \nif (Segundos<=9)\nSegundos = \"0\" + Segundos\n \n/* Termina el Script del Reloj */\n \n \n/* Coemienza eñ Script de la Fecha */\n \nvar Dia = new Array(\"Domingo\", \"Lunes\", \"Martes\", \"Miércoles\", \"Jueves\", \"Viernes\", \"Sábado\", \"Domingo\");\nvar Mes = new Array(\"Enero\",\"Febrero\",\"Marzo\",\"Abril\",\"Mayo\",\"Junio\",\"Julio\",\"Agosto\",\"Septiembre\",\"Octubre\",\"Noviembre\",\"Diciembre\");\nvar Hoy = new Date();\nvar Anio = Hoy.getFullYear();\nvar Fecha = \"\" + Dia[Hoy.getDay()] + \", \" + Hoy.getDate() + \" de \" + Mes[Hoy.getMonth()] + \" del \" + Anio + \"<br/> \";\n \n/* Termina el script de la Fecha */\n \n \n/* Creamos 4 variables para darle formato a nuestro Script */\nvar Inicio, Script, Final, Total\n \n/*En Inicio le indicamos un color de fuente y un tamaño */\nInicio = \"<font size=2 color=black>\"\n \n/* En Reloj le indicamos la Hora, los Minutos y los Segundos */\nScript = \"<div align=right>\" + Fecha + Hora + \":\" + Minutos + \":\" + Segundos + \"</div> \"\n \n/* En final cerramos el tag de la fuente */\nFinal = \"</font>\"\n \n/* En total Finalizamos el Reloj uniendo las variables */\nTotal = Inicio + Script + Final\n \n/* Capturamos una celda para mostrar el Reloj */\ndocument.getElementById('Fecha_Reloj').innerHTML = Total\n \n/* Indicamos que nos refresque el Reloj cada 1 segundo */\nsetTimeout(\"actualizaReloj()\",1000) \n}", "function temporizador1()\n{\n \n s = document.getElementById(\"segundos1\")\n m = document.getElementById(\"minutos1\")\n cronometro1 = setInterval(\n function(){\n if (contador1_s==60)\n {\n contador1_s = 0\n contador1_m ++\n //agrego un cero si los minutos son menores a 10\n if (contador1_m<10)\n {\n m.innerText = \"0\" + contador1_m\n } else\n {\n m.innerText = contador1_m\n }\n }\n //agrego un cero si los segundos son menores a 10\n if (contador1_s<10)\n {\n s.innerText = \"0\" + contador1_s\n } else\n {\n s.innerText = contador1_s\n }\n contador1_s ++\n \n }\n ,1000)\n}", "function processAlarms(){\n \n}", "_manageCronJob (evt, region) {\n let _this = this;\n\n _this.stage = evt.options.stage;\n _this._initAws(region);\n\n if (_this.S.cli.action != 'deploy' || (_this.S.cli.context != 'function' && _this.S.cli.context != 'dash'))\n return;\n\n _this.cronJobSettings = _this._getFunctionsCronJobSettings(evt, region);\n\n // no cron.json found\n if (_this.cronJobSettings.length == 0) {\n return;\n }\n\n for (var i in _this.cronJobSettings) { \n var params = {\n \"Name\": _this.cronJobSettings[i].cronjob.name,\n \"Description\": _this.cronJobSettings[i].cronjob.description,\n \"ScheduleExpression\": _this.cronJobSettings[i].cronjob.schedule,\n \"State\": (_this.cronJobSettings[i].cronjob.enabled == true ? \"ENABLED\" : \"DISABLED\")\n };\n\n _this.cloudWatchEvents.putRuleAsync(params)\n .then(function(result){\n return _this.lambda.addPermissionAsync({\n FunctionName: _this._getFunctionArn(_this.cronJobSettings[i]),\n StatementId: Date.now().toString(),\n Action: 'lambda:InvokeFunction',\n Principal: 'events.amazonaws.com',\n Qualifier: _this.stage\n })\n .then(function(){\n console.log('permissions added');\n })\n .catch(function(e) {\n console.log('error during adding permission to Lambda');\n console.log(e);\n });\n })\n .then(function(result){\n var _this = this;\n\n return _this.cloudWatchEvents.putTargetsAsync({\n Rule: _this.cronJobSettings[i].cronjob.name,\n Targets: [\n {\n Arn: _this.cronJobSettings[i].deployed.Arn,\n Id: _this._getTargetId(_this.cronJobSettings[i])\n }\n ]\n })\n .then(function(){\n console.log('cronjob created');\n })\n .catch(function(e) {\n console.log('error during creation of cronjob targets');\n console.log(e);\n });\n }.bind(_this))\n .catch(function(e) {\n console.log('error during creation of cronjob rules');\n console.log(e);\n });\n }\n }", "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function calculadora(){\n\tconsole.log(\"hola\");\n\tconsole.log(\"buenas\");\n\n\treturn \"hlar\";\n\n}", "function loadPeriodo(ra,curso,turma){\n\t\n\texecutaProcedure([ra,curso,turma], 'mysqlAdapter', 'retornaPeriodo', loadPeriodoSuccess, loadFailure);\n}", "function calculadora(){\n\tconsole.log(\"hola soy la calculadora\");\n\tconsole.log(\"si soy yo\");\n\t\n\treturn \"hola soy la calculadora!!\";\n}", "function morning() {\n // whole morning routine\n}", "function ecrire(){\nrl.question(welcomemessage, (answer) =>{\n\tif (answer == 'exit'){\n\t\tprocess.exit();\n\t}\n\telse if (answer== 'set'){\n\t\tset();\n\t}\n\telse if (answer == 'get'){\n\t\tget();\n\t}\n\telse if (answer == 'lastquery'){\n\t\tlastquery();\n\t}\n\n\telse if (answer == 'mysql') {\n\t\tsetEvent();\n\t}\n\telse if (answer== 'php'){\n\t\teventphp();\n\t}\n\telse {\n\t\tconsole.log(answer + ': command not found \\n' + listofcommand);\n\t\tsetTimeout(function(){ecrire()},120);\n\t}\n\t});\n}", "function temporizador2()\n{\n \n s = document.getElementById(\"segundos2\")\n m = document.getElementById(\"minutos2\")\n cronometro2 = setInterval(\n function(){\n if (contador2_s==60)\n {\n contador2_s = 0\n contador2_m ++\n //agrego un cero si los minutos son menores a 10\n if (contador2_m<10)\n {\n m.innerText = \"0\" + contador2_m\n } else\n {\n m.innerText = contador2_m\n }\n }\n //agrego un cero si los segundos son menores a 10\n if (contador2_s<10)\n {\n s.innerText = \"0\" + contador2_s\n } else\n {\n s.innerText = contador2_s\n }\n contador2_s ++\n }\n ,1000)\n}", "function executaFuncao(funcao) {\n console.log('Executa a funcao abaixo!');\n funcao();\n}", "function enviataxaaula(percent_aula, id_aula, id_projeto) {\n var envio = {}\n envio.id_contato = get_data('geral').id\n envio.id_aula = id_aula\n envio.percentual = percent_aula\n envio.email = get_data('geral').email \n envio.id_projeto = id_projeto \n\n set_tempo_ondemand(envio, (stst) => {\n //console.log('inserido - ' + id_aula + ' - ' + percent_aula + ' - ' + envio.id_contato)\n })\n}", "function Ejecutar() {\n\t//Elegimos una imagen\n\tCambiarImagen();\n\t//Iniciamos la transicion cada 3 segundos\n\tsetInterval(CambiarImagen,5000);\n}", "function executaFuncao (funcao){\n funcao();\n}", "function hideJqCron () {\n let cron = $('#cron')\n let cronSettings = cron.parent().find('.cron-settings-container')\n let currentCronText = cron.parent().find('.cron-info')\n let editButton = cron.parent().find('.edit-timer')\n cronSettings.hide()\n cron.hide()\n currentCronText.show()\n editButton.show()\n}", "function VideoGuidaImpostaEventoPrimoCaricamento(FunzioneAlTermineCaricamento) {\n\ttmrCaricamentoInizialeYT = window.setInterval(function () {VerificaCaricatoAbbastanza(FunzioneAlTermineCaricamento);}, 500);\n}", "function cronRuleFromSchedule( schedule ) {\n return [ schedule.second, schedule.minute, schedule.hour, schedule.dayOfMonth, schedule.month, schedule.dayOfWeek ].map( cronRule ).join(' ');\n}", "validateSchedule(task) {\n //TODO: ensure if within limits\n if (typeof task.schedule === 'number') return true;\n // for now we only support cron schedules :)\n let valid = cronValidate(task.schedule);\n return valid.isValid();\n }", "function NoAlertJob(name, schedule, jobFn) {\n\t\tif (typeof (schedule) !== \"object\") throw new Error(\"[NoAlarmTask] `schedule` is a required parameter\");\n\n\n\t\t/**\n\t\t * ### properties\n\t\t *\n\t\t * Contructor function exported by no-cron-task.js. Creates an object that represents a task that is scheduled to run at regular intervals(as opposed to a specific day/time).\n\t\t *\n\t\t * **Parameters**\n\t\t *\n\t\t * |Name|Type|Description|\n\t\t * |----|----|-----------|\n\t\t * |obj|Object|the object whose properties will be copied|\n\t\t *\n\t\t * **Returns**\n\t\t * Type: Object\n\t\t *\n\t\t * Returns an object with the same properties and values as the object passed in as a parameter\n\t\t *\n\t\t */\n\t\tfunction properties(obj) {\n\t\t\tvar out = {};\n\t\t\tObject.keys(obj).forEach(function (k) {\n\t\t\t\tout[k] = obj[k];\n\t\t\t});\n\n\t\t\treturn out;\n\t\t}\n\n\n\t\t/**\n\t\t * ### reset\n\t\t *\n\t\t * resets the NoCronJob's properties to defaults, creates them and sets their values to default if they don't already exist.\n\t\t *\n\t\t * **Parameters**\n\t\t * None\n\t\t *\n\t\t * **Returns**\n\t\t * None\n\t\t */\n\t\tthis.reset = function () {\n\t\t\tthis.promise = null;\n\t\t\tthis.skipped = true;\n\t\t\tthis.message = \"\";\n\n\t\t\tthis._name = name;\n\t\t\tthis._schedule = schedule;\n\t\t\tthis._jobFn = jobFn;\n\t\t\tthis._duration = moment.duration(schedule.duration, schedule.unit);\n\t\t\tthis._durationMilliseconds = this._duration.asMilliseconds();\n\t\t\tthis._lastRun = null;\n\t\t\tthis._running = false;\n\t\t}\n\n\n\t\tthis.reset();\n\n\n\t\t/**\n\t\t * ### run\n\t\t *\n\t\t * called by the task runner on each 'tick' - checks if it is time for this task to be run yet, if so it executes the jobFn. if not(or if it is a parallel task),\n\t\t * it sets skipped to true.\n\t\t *\n\t\t * **Parameters**\n\t\t * None\n\t\t *\n\t\t * **Returns**\n\t\t * None\n\t\t */\n\t\tthis.run = function () {\n\t\t\tvar _now = moment(),\n\t\t\t\t_target = moment(\"2017-01-01 \" + schedule.time),\n\t\t\t\t// Note: _lastRun can be a future date, e.g. when the user adjusted the clock of the device.\n\t\t\t\t_margin = (this._lastRun && this._lastRun < _now) ? _now - moment(this._lastRun) : 0,\n\t\t\t\t//_margin = _now - (this._lastRun ? moment(this._lastRun) : moment()),\n\t\t\t\t_isWeekday = schedule.weekday ? _now.format(\"dddd\").toLowerCase() === schedule.weekday.toLowerCase() : true,\n\t\t\t\t_alarm = _now.hour() === _target.hour() && _now.minute() === _target.minute() && _isWeekday;\n\n\t\t\tif (Math.abs(_margin) < 999) _margin = 0;\n\n\t\t\t//if (_alarm) console.log(\"Alarm Check: last run %s target %s margin: %s isAlarm: %s isRunning: %s\", this._lastRun, _target.toString(), _margin, _alarm, this._running);\n\n\t\t\tif (_alarm && !this._running && (_margin === 0 || _margin > 60000)) {\n\t\t\t\tthis.message = \"[NoAlarmTask] Starting \" + this._name + \", last run \" + (this._lastRun ? moment(this._lastRun).toString() : \"never\");\n\t\t\t\tconsole.log(_margin, _now, this._running, this.message);\n\n\t\t\t\tvar r = this._jobFn();\n\t\t\t\tthis._running = true;\n\n\t\t\t\tif (r && r.then) {\n\t\t\t\t\tthis.promise = r.then(function () {\n\t\t\t\t\t\t\tthis._lastRun = moment(new Date()); //move this to after successful run.\n\t\t\t\t\t\t\tthis._running = false;\n\t\t\t\t\t\t\tconsole.log(\"[NoAlarmTask] Ran %s %s\", this._name, this._lastRun.toString());\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t\t.catch(function (err) {\n\t\t\t\t\t\t\tthis._running = false;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}.bind(this));\n\n\t\t\t\t\tthis._skipped = !!this._schedule.parallel;\n\t\t\t\t} else {\n\t\t\t\t\tthis.promise = null;\n\t\t\t\t\tthis.skipped = true;\n\t\t\t\t\tthis.message = '[NoAlarmTask] ' + this._name + \" not run\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.promise = null;\n\t\t\t\tthis.skipped = true;\n\t\t\t}\n\n\t\t\t//return properties(this);\n\n\t\t}\n\t}", "function schedulePlan()\r\n{\r\n\tvar url = \"scheduled\";\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n\tsectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n\tif(objAjax && objHTMLData)\r\n\t{\r\n\t\tif(!isValidRecord(true))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tbShowMsg = true;\r\n\t Main.loadWorkArea(\"techspecevents.do\", url);\t \r\n\t}\r\n}", "function HoraFinTPChange() {\n realizarCambioHora();\n}", "function rescheduleIrrigation(dbUtils) {\n logger.info(\"Rescheduling irrigation...\");\n\n //cancello tutte le irrigazioni precedenti\n if (schedule.scheduledJobs.irrigate) {\n schedule.scheduledJobs.irrigate.cancel();\n }\n\n\n var schedulerEnable = dbUtils.getAppParameter(consts.PARAM_SCHEDULER_ENABLE) || \"N\";\n var scheulerTime = dbUtils.getAppParameter(consts.PARAM_SCHEDULER_TIME) || \"\";\n\n if (schedulerEnable == \"Y\") {\n\n var timeComponent = scheulerTime.split(\":\");\n if(timeComponent.length != 2){\n logger.error(\"Invalid scheduler time: \" + scheulerTime);\n return;\n }\n\n logger.info(\"Next irrigation at: \" + scheulerTime + \" now is: \" + new Date());\n\n var rule = new schedule.RecurrenceRule();\n //rule.dayOfWeek = [1, 2, 3, 4, 5];\n rule.hour = timeComponent[0];\n rule.minute = timeComponent[1];\n\n var j = schedule.scheduleJob(SCHEDULER_PROCCESS_NAME, rule, function () {\n \n\n //https://openweathermap.org/weather-conditions\n if(weatherUtils && weatherUtils.info.weather && weatherUtils.info.weather[0] && weatherUtils.info.weather[0].id < 622){\n logger.info(\"\\n**********************************************************************\");\n logger.info(\"Irrigation abborted at: \" + new Date());\n logger.info(\"Weather: \" + weatherUtils.info.weather[0].main);\n logger.info(\"\\n**********************************************************************\");\n }else{\n startIrrigation(dbUtils);\n }\n \n });\n }\n}", "function setTime() {\n\n\ttime = new Date();\n\ttime.setTime(time.getTime() + 60000);\n\tinterval = setInterval(cronos, 10);\n}", "cron(oncomplete) {\n\n const config = {\n headers: {\n 'Content-Type': 'application/json'\n }\n }\n\n cicService.select01().then(data => {\n // Get each object in array data\n if (validation.isEmptyJson(data)) {\n console.log('No request!');\n // return next();\n oncomplete(0, 0)\n // return;\n }\n\n var count = 0;\n var maxLength = data.length;\n console.log(\"maxLength11~~~\", maxLength);\n\n data.forEach(element => {\n // let fnData = data[i].child;\n console.log(\"element::::\", element);\n let inqDt1 = dateutil.getDate();\n let inqDt2 = dateutil.getDate();\n\n let defaultValue = defaultParams.defaultParams(inqDt1, inqDt2, '', '');\n\n //Convert data to format cic site\n //decrypt password\n var decryptPW = decrypt.decrypt(element.LOGIN_PW);\n var fnData = new cicB0002Req(element, defaultValue, decryptPW);\n\n cicService.updateScrpModCdPreRequestToScraping(element).then(() => {\n // \"?inJsonList=%5B\" + querystrings + \"%5D\"\n axios.post(URI.internal_cic, fnData, config)\n .then((body) => {\n console.log(\"body resultB0002~~~~~\", body.data);\n\n count++;\n // next process until data ending\n oncomplete(count, maxLength);\n // return res.status(200).json(body.data);\n\n }).catch((error) => {\n console.log(\"error call to internal_cic url B0002~~\",error);\n return;\n });\n });\n });\n }).catch((error) => {\n console.log(error)\n });\n }", "function HoraInicioTPChange() {\n realizarCambioHora();\n}", "async flowSetupHook(flow) {\n /*\n EDEN TRIGGERS\n */\n\n // do initial triggers\n flow.trigger('cron', {\n icon : 'fa fa-clock',\n title : 'Date/Time',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // set interval for query\n setInterval(async () => {\n // set query\n const q = query.lte('execute_at', new Date());\n\n // run with query\n await run({\n query : q,\n value : {},\n });\n }, 5000);\n }, (element, flowModel) => {\n // days\n const days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];\n\n // parse next date\n const previous = flowModel.get('executed_at') || new Date();\n let next = moment();\n\n // set time\n if (element.time) {\n // set time\n next.set({\n hour : parseInt(element.time.split(':')[0], 10),\n minute : parseInt(element.time.split(':')[1], 10),\n second : 0,\n });\n }\n\n // set day\n if (element.when === 'week') {\n // set next\n next = next.day(days.indexOf((element.day || 'monday').toLowerCase()) + 1);\n }\n\n // check last executed\n if (next.toDate() < new Date()) {\n // set day\n if (element.when === 'week') {\n // add one week\n next = next.add(7, 'days');\n } else if (element.when === 'month') {\n // add\n next = next.add(1, 'months');\n }\n }\n\n // set values\n flowModel.set('executed_at', previous);\n flowModel.set('execute_at', next.toDate());\n }, (data, flowModel) => {\n // check when\n if (flowModel.get('trigger.data.when') === 'week') {\n // set execute at\n flowModel.set('execute_at', moment(flowModel.get('execute_at')).add(7, 'days').toDate());\n } else if (flow.get('trigger.data.when') === 'month') {\n // set execute at\n flowModel.set('execute_at', moment(flowModel.get('execute_at')).add(1, 'month').toDate());\n }\n\n // set executed at\n flowModel.set('executed_at', new Date());\n });\n flow.trigger('hook', {\n icon : 'fa fa-play',\n title : 'Named Hook',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (...subArgs) => {\n // find hook/type\n const { hook, type } = subArgs.find(s => s.hook && s.type);\n\n // check\n if (!hook || !type) return;\n\n // create trigger object\n const data = {\n opts : { type, hook, when : type === 'pre' ? 'before' : 'after' },\n value : { args : subArgs },\n query : query.where({\n 'trigger.data.when' : type === 'pre' ? 'before' : 'after',\n 'trigger.data.hook' : hook,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.pre('*', execute);\n this.eden.post('*', execute);\n });\n flow.trigger('event', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Named Event',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (...subArgs) => {\n // find hook/type\n const { event } = subArgs.find(s => s.event);\n\n // check\n if (!event) return;\n\n // create trigger object\n const data = {\n opts : { event },\n value : { args : subArgs },\n query : query.where({\n 'trigger.data.event' : event,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.on('*', execute);\n });\n flow.trigger('model', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Model Change',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (model, a, b) => {\n // check model\n if (!(model instanceof Model)) return;\n\n // set vars\n let hook;\n let type;\n\n // chec vars\n if (!b) {\n hook = a.hook;\n type = a.type;\n } else {\n hook = b.hook;\n type = b.type;\n }\n\n // check\n if (!hook || !type) return;\n\n // get model type\n const modelName = hook.split('.')[0];\n const updateType = hook.split('.')[1];\n\n // create trigger object\n const data = {\n opts : { type : updateType, name : modelName, when : type === 'pre' ? 'before' : 'after' },\n value : { model },\n query : query.where({\n 'trigger.data.when' : type === 'pre' ? 'before' : 'after',\n 'trigger.data.model' : modelName,\n 'trigger.data.event' : updateType,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.pre('*.update', execute);\n this.eden.pre('*.remove', execute);\n this.eden.pre('*.create', execute);\n this.eden.post('*.update', execute);\n this.eden.post('*.remove', execute);\n this.eden.post('*.create', execute);\n });\n flow.trigger('value', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Model Value',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n\n });\n\n /*\n EDEN ACTIONS\n */\n // do initial actions\n flow.action('event.trigger', {\n tag : 'event',\n icon : 'fa fa-play',\n title : 'Trigger Event',\n }, (action, render) => {\n\n }, (opts, element, data) => {\n // trigger event\n if ((element.config || {}).event) {\n // trigger event\n this.eden.emit(`flow:event.${element.config.event}`, data);\n }\n\n // return true\n return true;\n });\n // do initial actions\n flow.action('email.send', {\n tag : 'email',\n icon : 'fa fa-envelope',\n title : 'Send Email',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // set config\n element.config = element.config || {};\n\n // clone data\n const newData = Object.assign({}, data);\n\n // send model\n if (newData.model instanceof Model) {\n // sanitise model\n newData.model = await newData.model.sanitise();\n }\n\n // send email\n await emailHelper.send((tmpl.tmpl(element.config.to || '', newData)).split(',').map(i => i.trim()), 'blank', {\n body : tmpl.tmpl(element.config.body || '', newData),\n subject : tmpl.tmpl(element.config.subject || '', newData),\n });\n\n // return true\n return true;\n });\n flow.action('hook.trigger', {\n tag : 'hook',\n icon : 'fa fa-calendar-exclamation',\n title : 'Trigger Hook',\n }, (action, render) => {\n\n }, async (opts, element, ...args) => {\n // trigger event\n if ((element.config || {}).hook) {\n // trigger event\n await this.eden.hook(`flow:hook.${element.config.hook}`, ...args);\n }\n\n // return true\n return true;\n });\n flow.action('model.query', {\n tag : 'model-query',\n icon : 'fa fa-plus',\n title : 'Find Model(s)',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // query for data\n const Model = model(element.config.model);\n\n // create query\n let query = Model;\n\n // sanitise model\n if (data.model) data.model = await data.model.sanitise();\n\n // loop queries\n element.config.queries.forEach((q) => {\n // get values\n const { method, type } = q;\n let { key, value } = q;\n\n // data\n key = tmpl.tmpl(key, data);\n value = tmpl.tmpl(value, data);\n\n // check type\n if (type === 'number') {\n // parse\n value = parseFloat(value);\n } else if (type === 'boolean') {\n // set value\n value = value.toLowerCase() === 'true';\n }\n\n // add to query\n if (method === 'eq' || !method) {\n // query\n query = query.where({\n [key] : value,\n });\n } else if (['gt', 'lt'].includes(method)) {\n // set gt/lt\n query = query[method](key, value);\n } else if (method === 'ne') {\n // not equal\n query = query.ne(key, value);\n }\n });\n\n // return true\n return (await query.limit(element.config.count || 1).find()).map((item) => {\n // clone data\n const cloneData = Object.assign({}, data, {\n model : item,\n }, {});\n\n // return clone data\n return cloneData;\n });\n });\n flow.action('model.set', {\n tag : 'model-set',\n icon : 'fa fa-plus',\n title : 'Set Value',\n }, (action, render) => {\n\n }, async (opts, element, { model }) => {\n // sets\n element.config.sets.forEach((set) => {\n // set values\n let { value } = set;\n const { key, type } = set;\n\n // check type\n if (type === 'number') {\n // parse\n value = parseFloat(value);\n } else if (type === 'boolean') {\n // set value\n value = value.toLowerCase() === 'true';\n }\n\n // set\n model.set(key, value);\n });\n\n // save toSet\n await model.save();\n\n // return true\n return true;\n });\n flow.action('model.clone', {\n tag : 'model-clone',\n icon : 'fa fa-copy',\n title : 'Clone Model',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // got\n const got = data.model.get();\n delete got._id;\n\n // new model\n const NewModel = model(data.model.constructor.name);\n const newModel = new NewModel(got);\n\n // set new model\n data.model = newModel;\n\n // return true\n return true;\n });\n flow.action('delay', {\n tag : 'delay',\n icon : 'fa fa-stopwatch',\n color : 'info',\n title : 'Time Delay',\n }, (action, render) => {\n\n }, (opts, element, data) => {\n return true;\n });\n\n // boolean check\n const filterCheck = async (opts, element, model) => {\n // set config\n element.config = element.config || {};\n\n // check model\n if ((element.config.type || 'value') === 'code') {\n // safe eval code\n return !!safeEval(element.config.code, model);\n }\n\n // get value\n let value = model[element.config.of];\n const is = element.config.is || 'eq';\n\n // check model\n if (model instanceof Model) {\n // get value from model\n value = await model.get(element.config.of);\n }\n\n // check\n if (is === 'eq' && value !== element.config.value) {\n // return false\n return false;\n }\n if (is === 'ne' && value === element.config.value) {\n // return false\n return false;\n }\n if (is === 'gt' && value < element.config.value) {\n // return false\n return false;\n }\n if (is === 'lt' && value > element.config.value) {\n // return false\n return false;\n }\n\n // return false at every opportunity\n return true;\n };\n\n // do initial logics\n flow.action('filter', {\n tag : 'filter',\n icon : 'fa fa-filter',\n color : 'warning',\n title : 'Conditional Filter',\n }, (action, render) => {\n\n }, filterCheck);\n flow.action('condition.split', {\n tag : 'split',\n icon : 'fa fa-code-merge',\n color : 'warning',\n title : 'Conditional Split',\n }, (action, render) => {\n\n }, async (opts, element, ...args) => {\n // set go\n const go = await filterCheck(opts, element, ...args);\n\n // get children\n const children = (element.children || [])[go ? 0 : 1] || [];\n\n // await trigger\n await FlowHelper.run(opts.flow, children, opts, ...args);\n\n // return true\n return true;\n });\n }", "async run_todo_list(params){\n this.todolist || await this.instancieTodoList()\n\n const justOpen = !params[1]\n params.shift() // on enlève la commande\n const line = params.join(' ')\n\n // Dans tous les cas, pour le moment, on ouvre la liste des tâches\n this.todolist.open(() => {\n justOpen || this.todolist.createNewTask.call(this.todolist, line)\n })\n}", "function execution_passe() {\r\n // ici le code\r\n}", "function Install(){\n ScriptApp.newTrigger(\"main\").timeBased().everyMinutes(howFrequent).create();\n}", "StartJobScheduleBackup(){\n this.GetDbConfig(\"BackupScheduler\").then((reponse)=>{\n let BackupScheduler = reponse\n if(BackupScheduler.JobScheduleStarted == true){\n if (this._JobSchedule == null){\n // Get GoogleKey\n this.GetDbConfig(\"BackupGoogle\").then((reponse)=>{\n if((reponse.GoogleKey != \"\") && (reponse.Folder != \"\")){\n let credentials = JSON.parse(reponse.GoogleKey)\n let folder = reponse.Folder\n console.log(\"Start JobScheduleBackup\")\n var schedule = require('node-schedule')\n let options = {minute: BackupScheduler.JobScheduleMinute, hour: BackupScheduler.JobScheduleHour}\n var me = this\n this._JobSchedule = schedule.scheduleJob(options, function(){\n let DbBackup = require('./DbBackup').DbBackup\n let MyDbBackup = new DbBackup(me._MongoVar.DbName,credentials,folder, me.LogAppliInfo.bind(me))\n MyDbBackup.Backup().then((reponse)=>{\n me.LogAppliInfo(reponse, \"Server\", \"Server\")\n },(erreur)=>{\n me.LogAppliError(\"StartJobScheduleBackup error : \" + erreur, \"Server\", \"Server\")\n console.log(\"Error during StartJobScheduleBackup: \"+ erreur + \" \" + now)\n })\n })\n } else {\n this.LogAppliError(\"StartJobScheduleBackup Google key or Google folder is empty\", \"Server\", \"Server\")\n }\n },(erreur)=>{\n this.LogAppliError(\"StartJobScheduleBackup, get Google key error : \" + erreur, \"Server\", \"Server\")\n })\n } else {\n this.LogAppliError(\"JobScheduler already exist\", \"Server\", \"Server\")\n }\n } else {\n console.log(\"JobScheduleBackup not started\")\n }\n },(erreur)=>{\n this.LogAppliError(\"StartJobScheduleBackup: \" + erreur, \"Server\", \"Server\")\n })\n }", "function startProcess () {\n\n\tvar currentdate = new Date();\n\n\tvar datetime = currentdate.getDate() + \"/\"\n\t\t+ (currentdate.getMonth()+1) + \"/\"\n\t\t+ currentdate.getFullYear() + \" @ \"\n\t\t+ currentdate.getHours() + \":\"\n\n\tconsole.log('Topdesk Maintenance Process for date: ', + currentdate.getDate() + \"/\" + currentdate.getMonth()+1 + \"/\" + currentdate.getFullYear() + \": \"+ currentdate.getHours());\n\n try {\n\n\t\tfs.appendFile(\"topdesk_process.log\", \"Topdesk Maintenance Process for date: \" + currentdate.getDate() + \"/\" + currentdate.getMonth() + \"/\" + currentdate.getFullYear() + \": \"+ currentdate.getHours() + \"\\n\", (err) => {});\n\n\t\t//data.getDataClosed();\n\t\tdata.routeNewTickets();\n\n\t\t//For getting TD objects and testing\n\t\t//data.getTicketsToInspect();\n\n\t} catch (e) {\n\t\tconsole.log(\"App crashed while managing connection \" + e.message);\n\t}\n}", "function chargerGantt(source){\n\n $(\".gantt\").gantt({\n source: source ,\n scale: \"days\",\n\tminScale: \"days\",\n\tmaxScale: \"months\",\n navigate: \"scroll\",\n months : \t[\"Janvier\", \"Février\", \"Mars\", \"Avril\", \"Mai\", \"Juin\", \"Juillet\", \"Août\", \"Septembre\", \"Octobre\", \"Novembre\", \"Decembre\"],\n dow : \t[\"D\", \"L\", \"Ma\", \"Me\", \"J\", \"V\", \"S\"],\n scrollToToday: true,\n itemsPerPage: 50,\n waitText: \"Mise à jour ...\",\n onItemClick: function(data) {\n var json = $.data(tanker,'data_1').obj_1;\n var id = json[data.id];\n if(searchRole(id.values[0].dataObj.access,role)|| searchRole('ROLE_ADMIN',role))\n {\n\n $('#formtitle').text('Modifier tâche');\n $('#submitData').text('Modifier');\n\n //console.log(data.id);\n\n\n var dateTo = new Date(parseInt(id.values[0].to));\n var dateFrom = new Date(parseInt(id.values[0].from));\n\n dateTo = nameMonth[dateTo.getMonth()]+ ' ' + dateTo.getDate() + ', ' + dateTo.getFullYear();\n dateFrom = nameMonth[dateFrom.getMonth()]+ ' ' + dateFrom.getDate() + ', ' + dateFrom.getFullYear();\n $('#name:input').val(id.name);\n $('#desc:input').val(id.desc);\n $('#to:input').val(dateTo);\n $('#from:input').val(dateFrom);\n $('#idNumber').val(id.values[0].dataObj.id);\n $('#flag:input').val('modify');\n $('#desc2:input').val(id.values[0].desc);\n $('#label:input').val(id.values[0].label);\n $('#customClass:input').val(id.values[0].customClass);\n $('#access:input').val(id.values[0].dataObj.access);\n\n if (id.values[0].dataObj.completed == 'true')\n {\n $('#radiotrue:input').prop(\"checked\",true);\n $('#radiofalse:input').prop(\"checked\",false);\n }\n else\n {\n $('#radiofalse:input').prop(\"checked\",true);\n }\n\n $('#modal1').modal('open');\n }\n else\n {\n $('#modal2').modal('open');\n }\n // end onItemClick\n\t},\n\tonAddClick: function(dt, rowId) {\n var json = $.data(tanker,'data_1').obj_1;\n var nbItem = json.length;\n console.log(nbItem + ' items dans le json')\n var dateFrom = new Date().getTime();\n console.log('Date départ :' + dateFrom);\n // ajout de 7 jours\n var dateTo = dateFrom + (7*86400000);\n dateTo = new Date(parseInt(dateTo));\n dateFrom = new Date(parseInt(dateFrom));\n console.log('Date fin :' + dateTo);\n dateFrom = nameMonth[dateFrom.getMonth()]+ ' ' + dateFrom.getDate() + ', ' + dateFrom.getFullYear();\n dateTo = nameMonth[dateTo.getMonth()]+ ' ' + dateTo.getDate() + ', ' + dateTo.getFullYear();\n\n\n\n $('#formtitle').text('Ajouter tâche');\n $('#submitData').html('Ajouter');\n // form purge\n $('#name:input').val('');\n $('#desc:input').val('');\n $('#to:input').val(dateTo);\n $('#from:input').val(dateFrom);\n $('#idNumber').val('');\n $('#desc2:input').val('');\n $('#label:input').val('');\n $('#customClass:input').val('');\n $('#access:input').val('');\n // set flag and idNumber\n $('#flag:input').val('add');\n $('#idNumber:input').val(nbItem);\n\n $('#modal1').modal('open');\n\n console.log(nbItem);\n\t}, // end onAddClick\n\tonRender: function() {\n\t}\n });\n}", "function handleRoutines() {\n\t\tconst today = moment().format('dddd');\n\t\tconst inAWeek = moment().add(6, 'days').format('dddd');\n\n\t\tstate.tasks.forEach((task) => {\n\t\t\tif (task.day === moment().subtract(1, 'days').format('dddd')) {\n\t\t\t\tlet taskId = task._id;\n\t\t\t\tlet day = '';\n\t\t\t\tlet isDone = false;\n\n\t\t\t\tswitch (task.repetition) {\n\t\t\t\t\tcase 'Every day':\n\t\t\t\t\t\tday = today;\n\t\t\t\t\t\tupdateTask({ taskId, day, isDone });\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Every week':\n\t\t\t\t\t\tday = inAWeek;\n\t\t\t\t\t\tupdateTask({ taskId, day, isDone });\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function main() {\n jQuery.noConflict();\n (function($){\n $(function() {\n\n // 出勤簿を開いた際に始業・就業時間をローカルストレージに保持させる\n if ($(\".main_header\").html() && $(\".main_header\").html().match(/\\s\\u51FA\\u52E4\\u7C3F/)) {\n if ($('#title_on1').length) {\n var workingTime = $('#title_on1').html().match(/[0-9]+/g);\n } else {\n var workingTime = $('#title_on0').html().match(/[0-9]+/g);\n }\n if (workingTime !== null && workingTime.length == 2) {\n // \"みなし(東京9-18)\"といった形で始業時間が記載されている場合\n for (i=0; i<workingTime.length; i++) {\n fetchTime = workingTime[i];\n\n if (fetchTime.length == 1) {\n fetchTime = \"0\" + fetchTime;\n } else if (fetchTime.length == 4) {\n fetchTime = fetchTime.substr(0,2);\n }\n\n if (i==0) {\n var defaultStartHour = fetchTime;\n } else {\n var defaultEndHour = fetchTime;\n }\n }\n } else {\n // 時間表記が無いので9:00-18:00を標準とする\n var defaultStartHour = 9;\n var defaultEndHour = 18;\n }\n\n // ローカルストレージに保管\n window.localStorage.setItem(\"startHour\", defaultStartHour);\n window.localStorage.setItem(\"endHour\", defaultEndHour);\n }\n\n // 残業開始時間セット\n var defaultStartHour = window.localStorage.getItem(\"startHour\");\n var defaultEndHour = window.localStorage.getItem(\"endHour\");\n\n if (defaultStartHour == null || defaultEndHour == null) {\n // ローカルストレージから取得できないため、地名のみで判定\n if ($('.user_name').html().match(/\\u6771\\u4eac|\\u4eac\\u90fd/)) {\n // 東京、京都タイム(10:00-19:00)\n var defaultStartHour = \"10\";\n var defaultEndHour = \"19\";\n } else {\n // 福岡タイム\n var defaultStartHour = \"09\";\n var defaultEndHour = \"18\";\n }\n }\n\n // 出勤簿\n if ($(\".main_header\").html() && $(\".main_header\").html().match(/\\s\\u51FA\\u52E4\\u7C3F/)) {\n var date = new Date();\n var nowYmd = date.getFullYear() + (\"0\" + (date.getMonth() + 1)).slice(-2) + (\"0\" + date.getDate()).slice(-2);\n var dispYear = document.submit_form0.Date_Year.value;\n var dispMonth = document.submit_form0.Date_Month.value; \n var KyukaId = 0;\n \n // 休暇申請のIDを取得し、設定する\n $(\"#main_header_area\").append('<div id=\"get_selecter\" style=\"display:none;\"></div>'); // 見えないdivを作成\n $(\"#get_selecter\").load(\"./ #slct_appformmasterid:first\", // IDが重複しているので先頭の1個だけ取る\n { module: \"application_form\", action: \"application_form\" },\n function(){\n $('#slct_appformmasterid option').each(function() {\n var value = jQuery(this).val();\n var text = jQuery(this).text();\n // 25は女性用、31は男性用\n if (value == 25 || value == 31) KyukaId=value;\n });\n // 仮でKyukaIdとnameつけた部分を書き換え\n $(\".link_custom[name='KyukaId']\").attr(\"name\",KyukaId);\n }\n );\n $('tr[id^=fix]').each(function(index) {\n \n var loopDay = $.trim($(\"td\", this).eq(0).html());\n var loopYmd = dispYear + (\"0\" + dispMonth).slice(-2) + (\"0\" + loopDay).slice(-2);\n \n // 当日に色付け\n if (loopYmd == nowYmd) {\n $(this).css(\"background-color\", \"#E2FAC1\");\n }\n\n // 平日以外は処理しない\n if (!$(\"td\", this).eq(2).html().match(/\\u5E73\\u65E5/)) {\n return true;\n }\n\n //休暇欠勤申請のリンクを表示\n var todokedeNy = $.trim($(\"td\", this).eq(4).html());\n\n if(todokedeNy==\"&nbsp;\"){\n $(\"td\", this).eq(4).append('<a href=\"javascript:void(0);\" class=\"link_custom\" name=\"KyukaId\">休暇申請</a>');\n }\n\n // 未来日付は処理しない\n if (loopYmd > nowYmd) {\n return true;\n }\n\n var jyokyoKbn = $.trim($(\"td\", this).eq(5).html());\n var startTime = $.trim($(\"td\", this).eq(6).html());\n var endTime = $.trim($(\"td\", this).eq(7).html());\n var zangyoStartTime = $.trim($(\"td\", this).eq(10).html());\n\n if (jyokyoKbn == \"&nbsp;\" && startTime > defaultStartHour + \":00\") {\n $(\"td\", this).eq(5).html('<a href=\"javascript:void(0);\" class=\"link_custom\" name=\"4\">遅延</a>');\n }\n if (startTime == \"&nbsp;\") {\n $(\"td\", this).eq(6).html('<a href=\"javascript:void(0);\" class=\"link_custom\" name=\"4\">出勤</a>');\n }\n if (endTime == \"&nbsp;\") {\n $(\"td\", this).eq(7).html('<a href=\"javascript:void(0);\" class=\"link_custom\" name=\"4\">退勤</a>');\n }\n if (zangyoStartTime == \"&nbsp;\") {\n $(\"td\", this).eq(10).html('<a href=\"javascript:void(0);\" class=\"link_custom\" name=\"1\">残業</a>');\n }\n })\n\n $(\".link_custom\").bind(\"click\", function(){\n var day = $.trim($(\"td\", $(this).parent().parent()).eq(0).html());\n \n // 年月日をクエリストリングに追加\n var action = \"./?year=\" + dispYear\n + \"&month=\" + dispMonth\n + \"&day=\" + day;\n \n if ($(this).attr(\"name\") == 1) {\n // 残業申請の場合、退社時間をクエリストリングに追加\n var endTime = $.trim($(\"td\", $(this).parent().parent()).eq(7).html());\n if (endTime.match(/\\d\\d:\\d\\d/)) {\n endTime = endTime.split(':');\n action += \"&end_hour=\" + endTime[0]\n + \"&end_min=\" + endTime[1];\n }\n }\n if ($(this).html().match(/\\u9000\\u52E4/)) {\n // 退勤申請の場合、フラグをクエリストリングに追加\n action += \"&taikin=1\";\n }\n $(\"#submit_form0\").attr(\"action\", action);\n addHidden(\"application_form_master_id\", $(this).attr(\"name\"), \"submit_form0\");\n addHidden(\"status\", \"default\", \"submit_form0\");\n addHidden(\"start_date_Year\", dispYear, \"submit_form0\");\n addHidden(\"start_date_Month\", dispMonth - 1, \"submit_form0\");\n addHidden(\"start_date_Day\", day, \"submit_form0\");\n addHidden(\"end_date_Year\", dispYear, \"submit_form0\");\n addHidden(\"end_date_Month\", dispMonth, \"submit_form0\");\n addHidden(\"end_date_Day\", day, \"submit_form0\");\n document.submit_form0.module.value = \"application_form\";\n document.submit_form0.action.value = \"editor\";\n // 申請画面へ移動\n document.submit_form0.submit();\n });\n\n function addHidden(name, value, formname) {\n var q = document.createElement('input');\n q.type = 'hidden';\n q.name = name;\n q.value = value;\n document.forms[formname].appendChild(q);\n }\n }\n\n var formId = $(\"input[name=application_form_master_id]\").val();\n\n // 申請画面\n if (formId) {\n\n // プルダウンの日付を一括変更\n function changeDate(y, m, d) {\n\n m = (\"0\" + m).slice(-2);\n d = (\"0\" + d).slice(-2);\n\n $('select').each(function(index) {\n if ($(this).attr(\"name\").match(/Year/)) {\n $(this).val(y);\n }\n if ($(this).attr(\"name\").match(/Month/)) {\n $(this).val(m);\n }\n if ($(this).attr(\"name\").match(/Day/)) {\n $(this).val(d);\n }\n });\n }\n\n // GETパラメータを配列で返す\n function getQueryString() {\n if (1 < document.location.search.length) {\n var query = document.location.search.substring(1);\n var parameters = query.split('&');\n var result = new Object();\n for (var i = 0; i < parameters.length; i++) {\n // パラメータ名とパラメータ値に分割する\n var element = parameters[i].split('=');\n var paramName = decodeURIComponent(element[0]);\n var paramValue = decodeURIComponent(element[1]);\n result[paramName] = decodeURIComponent(paramValue);\n }\n return result;\n }\n return \"\";\n }\n\n var customButtonHTML = '<div>\\\n <input class=\"btn_custom\" id=\"btn_custom_yesterday\" type=\"button\" value=\" 昨日 \">\\\n <input class=\"btn_custom\" id=\"btn_custom_today\" type=\"button\" value=\" 今日 \">\\\n </div>';\n $(\"#submit_form table\").eq(4).before(customButtonHTML);\n\n $(\".btn_custom\").bind(\"click\", function(){\n var date = new Date();\n if ($(this).attr(\"id\") == \"btn_custom_yesterday\") {\n changeDate(date.getFullYear(), date.getMonth() + 1, date.getDate() - 1);\n } else if ($(this).attr(\"id\") == \"btn_custom_today\") {\n changeDate(date.getFullYear(), date.getMonth() + 1, date.getDate());\n }\n });\n\n var get = getQueryString();\n if (get.year && get.month && get.day) {\n changeDate(get.year, get.month, get.day);\n }\n\n // 残業申請とタイムカード訂正の場合\n if (formId == \"1\" || formId == \"4\") {\n\n if (!$(\"#lbl_disp_reflect_date\").attr(\"checked\")) {\n // 計上日をデフォルト表示\n $(\"#lbl_disp_reflect_date\").trigger(\"click\");\n if (get.end_hour && get.end_min) {\n $(\"#submit_form\").attr({action:\"./?end_hour=\" + get.end_hour + \"&end_min=\" + get.end_min});\n }\n if (formId == \"1\") {\n // 残業終了時間を追加(初回遷移時のみ)\n $(\"#submit_form input[value=追加]\").trigger(\"click\");\n }\n }\n\n if (formId == \"4\") {\n if (get.taikin == \"1\") {\n // 退社を選択\n $('select[name=reflect_item_id_001] option:last').attr(\"selected\", \"selected\");\n // 退社時間をセット\n $('select[name=value_time_001_Hour]').val(defaultEndHour);\n } else {\n // 出社時間をセット\n $('select[name=value_time_001_Hour]').val(defaultStartHour);\n }\n }\n \n if (formId == \"1\") {\n // 残業終了を選択\n $('select[name=reflect_item_id_002] option:last').attr(\"selected\", \"selected\");\n // 残業開始時間をセット\n $('select[name=value_time_001_Hour]').val(defaultEndHour);\n if (get.end_hour && get.end_min) {\n // 退勤時刻を残業終了時間にセット\n $('select[name=value_time_002_Hour]').val(get.end_hour);\n $('select[name=value_time_002_Minute]').val(get.end_min);\n }\n }\n \n $('select[name=value_time_001_Minute]').val(\"00\");\n $('textarea[name=application_remarks]').focus();\n }\n }\n\n // 以下、管理者用機能\n\n // 共通\n function resetSect(res){\n var $res = $(res);\n var newSectagName = $res.find(\"input[name^=__sectag]\").first().attr(\"name\");\n var newSectagVal = $res.find(\"input[name^=__sectag]\").first().attr(\"value\");\n var newSectbiName = $res.find(\"input[name=__sectbi]\").first().attr(\"name\");\n var newSectbiVal = $res.find(\"input[name=__sectbi]\").first().attr(\"value\");\n $(\"input[name^=__sectag]\").attr(\"name\",newSectagName);\n $(\"input[name^=__sectag]\").attr(\"value\",newSectagVal);\n $(\"input[name=__sectbi]\").attr(\"name\",newSectbiName);\n $(\"input[name=__sectbi]\").attr(\"value\",newSectbiVal);\n }\n \n // 勤怠\n function setResultKintai(result, day){\n //console.log(\"setResultKintai:[\"+result+\"][\"+day+\"]\");\n var ended=false;\n $(\"#tab0 tr\").each(function(){\n if(!ended && $(this).children(\"td\").first().text() == day){\n $(this).children(\"td\").last().text(result);\n ended=true;\n }\n });\n }\n \n var lock=false;\n function acceptKintai(day){\n //console.log(day);\n if(lock){setTimeout(function(){acceptKintai(day);},200);return;}\n var data=\"\",\n dryrun=false;\n setResultKintai(\"処理中\",day);\n lock=true;\n setForm(day);\n // hiddenパラメータをAjaxで扱えるように変換\n data = $(\"form[name=submit_form0]\").find(\"input[type=hidden]\").map(function(){ return $(this).attr(\"name\")+\"=\"+$(this).val(); }).get().join(\"&\");\n if(dryrun){\n setResultKintai(\"OK\",day);\n lock=false;\n }else{\n //console.log(data);\n $.ajax({\n type:\"POST\",\n url:\".\",\n data:data,\n success:function(res){ resetSect(res); setResultKintai(\"OK\",day); lock=false;}, \n error: function(res){ setResultKintai(\"NG\",day);} \n });\n }\n }\n \n function acceptKintaiAll(){\n var days=selectDays();\n //console.log(\"selected\");console.log(days);\n \n // daysで渡された日付のハンコを全部押す\n $.each(days, function(i){\n //console.log(\"yobidashi:\"+days[i]);\n acceptKintai(days[i]);\n });\n }\n \n \n // \"退社\"が空でない日付の配列を返す\n function selectDays(){\n return $(\".edit_btn_inkan\").map(function(){\n if(jQuery.trim($(this).parent().parent().children().eq(7).text()) != \"\"){\n return $(this).parent().parent().children().first().text();\n }else{\n return;\n }\n }).get();\n }\n \n function setForm(day){\n $(\"form[name=submit_form0]\").find(\"input[name=action]\") .attr(\"value\",\"seal\");\n $(\"form[name=submit_form0]\").find(\"input[name=tab_num]\") .attr(\"value\",\"0\");\n $(\"form[name=submit_form0]\").find(\"input[name=Edit_Year]\") .attr(\"value\",$(\"select[name=Date_Year] option:selected\").val());\n $(\"form[name=submit_form0]\").find(\"input[name=Edit_Month]\") .attr(\"value\",$(\"select[name=Date_Month] option:selected\").val());\n $(\"form[name=submit_form0]\").find(\"input[name=Edit_Day]\") .attr(\"value\",day);\n $(\"form[name=submit_form0]\").find(\"input[name=next_action]\") .attr(\"value\",\"browse\");\n }\n \n // 申請\n function setResultShinsei(result, $form){\n var $td = $form.parents(\"td\").first();\n $td.empty().append(result);\n }\n \n function setFormShinsei($form){\n var applicationMasterId = $form.parents(\"tr\").first().prev().find(\"input[name=application_master_id]\").val();\n $form.find(\"input[name=application_master_id]\").val( applicationMasterId );\n $form.find(\"input[name=status]\").val(\"settlement\");\n }\n \n function acceptShinsei($form){\n if(lock){setTimeout(function(){acceptShinsei($form);},200);return;}\n $form.find(\".edit_btn_inkan\").remove();\n $form.append(\"処理中\");\n lock=true;\n var data = $form.find(\"input[type=hidden]\").map(function(){ return $(this).attr(\"name\")+\"=\"+$(this).val(); }).get().join(\"&\");\n $.ajax({\n type:\"POST\",\n url:\".\",\n data:data,\n success:function(res){ resetSect(res); setResultShinsei(\"OK\",$form); lock=false;}, \n error: function(res){ setResultShinsei(\"NG\",$form);} \n });\n }\n \n function acceptShinseiAll(){\n var forms=$(\".edit_btn_inkan\").parent();\n $.each(forms, function(i){\n acceptShinsei($(forms[i]));\n });\n }\n \n if($(\"td.main_header\").text().indexOf(\"出勤簿一覧\") > 0){\n console.log(\"natsuin change on 出勤簿一覧\");\n // 一括登録ボタンの配置\n $(\"<img/>\").attr(\"id\",\"click_inkan_all\").css(\"cursor\",\"pointer\")\n .attr(\"src\",\"common/img_icon/btn_mass_e.gif\").on(\"click\",acceptKintaiAll).appendTo(\"#disp_all\");\n \n // 出勤簿一覧で押印をajaxで処理する\n $(\"input[name=edit_btn_inkan]\").parent().each(function(){\n $(this).empty().append(\n $(\"<img/>\").attr(\"class\",\"edit_btn_inkan\").attr(\"src\",\"common/img_icon/btn_natsuin.gif\")\n .css(\"cursor\",\"pointer\").css({\"height\":\"18px\",\"width\":\"18px\"}).attr(\"align\",\"absmiddle\")\n .on(\"click\", function(){\n var day = jQuery.trim( $(this).parents(\"tr\").first().children().first().text() );\n acceptKintai(day);\n })\n );\n });\n }\n \n if($(\"td.main_header\").text().indexOf(\"申請承認\") > 0){\n console.log(\"natsuin change on 申請承認\");\n // 一括登録ボタンの配置\n $(\"<input/>\").attr(\"id\",\"click_inkan_all\").attr(\"type\",\"button\").val(\"一括登録\")\n .on(\"click\",acceptShinseiAll).appendTo($(\"form\").eq(2));\n \n // 画面遷移を抑制\n $(\"input[id^=accept_btn]\").parent().each(function(){\n setFormShinsei($(this));\n $(this).find(\"input[id^=accept_btn]\").remove();\n $(this).append(\n $(\"<img/>\").attr(\"class\",\"edit_btn_inkan\").attr(\"src\",\"common/img_icon/btn_natsuin.gif\")\n .css(\"cursor\",\"pointer\").css({\"height\":\"18px\",\"width\":\"18px\"}).attr(\"align\",\"absmiddle\")\n .on(\"click\", function(){\n acceptShinsei($(this).parents(\"form\").first());\n })\n );\n });\n \n // 個人名クリックで検索\n $(\"table.bgcolor_gray2\").find(\"tr.txt_12_none_color_border_3\").each(function(){\n var $nameCell = $(this).find(\"td\").eq(1);\n var aTag = $(\"<a>\").text($nameCell.text()).attr(\"href\",\"#\");\n aTag.on(\"click\", function(){\n $(\"select[name=search_acceptation_status]\").val(2);\n $(\"input[name=keyword]\").val(jQuery.trim(this.innerText.slice(0,2)));\n $(\"#search_form\").submit();\n });\n $nameCell.html(aTag);\n });\n \n // リセットしつつ検索\n var resetButton = $(\"<input>\").attr(\"type\",\"button\").attr(\"value\",\"未承認検索\");\n resetButton.on(\"click\", function(){\n $(\"select[name=search_acceptation_status]\").val(2);\n $(\"input[name=keyword]\").val(\"\");\n $(\"#search_form\").submit();\n });\n $(\"input[value=検索]\").after(resetButton);\n }\n \n if($(\"td.main_header\").text().indexOf(\"日別出勤簿\") > 0){\n console.log(\"natsuin change on 日別出勤簿\");\n // 名前をクリックで開く\n var $table = $(\"table.txt_12\").first(),\n $attendanceBooks = $table.find(\"input[type=image]\");\n \n $attendanceBooks.each(function(){\n $this = $(this);\n var $nameCell = $this.parents(\"tr\").first().find(\"td\").eq(2);\n var aTag = $(\"<a>\").text($nameCell.text()).attr(\"onclick\", $this.attr(\"onclick\")).attr(\"href\",\"#\");\n $nameCell.html(aTag);\n });\n\n // 翌日\n var yeasterdayButton = $(\"<input>\").attr(\"type\",\"button\").attr(\"value\",\"前日\");\n var tommorowButton = $(\"<input>\").attr(\"type\",\"button\").attr(\"value\",\"翌日\");\n var calcDate = function(days){\n var year = $(\"select[name=Date_Year] option:selected\").attr(\"value\");\n var month = $(\"select[name=Date_Month] option:selected\").attr(\"value\");\n var day = $(\"select[name=Date_Day] option:selected\").attr(\"value\");\n // 日付変更のコードを書く\n var calculated = moment(year+month+day, \"YYYYMMDD\").add(days,'days');\n $(\"select[name=Date_Year]\").val(calculated.format(\"YYYY\"));\n $(\"select[name=Date_Month]\").val(calculated.format(\"MM\"));\n $(\"select[name=Date_Day]\").val(calculated.format(\"DD\"));\n $(\"#search_form\").submit();\n };\n var yesterday = function(){calcDate(-1);};\n var tommorow = function(){calcDate(+1);};\n yeasterdayButton.on(\"click\", yesterday);\n tommorowButton.on(\"click\", tommorow);\n $(\"#Date_Day\").after(tommorowButton).after(yeasterdayButton);\n }\n\n });\n })(jQuery)\n}", "computeNextExecution(task) {\n /**\n * If schedule is a number it means we are executing\n * on a delay of `schedule` milliseconds\n */\n if (typeof task.schedule === 'number') return task.schedule;\n\n let options = extend({}, task.scheduleOptions);\n\n /**\n * For testing etc we can specify a current date\n */\n if (!options.currentDate) {\n options.currentDate = DateTime.utc().toJSDate();\n }\n\n const interval = cron.parseExpression(task.schedule, options);\n\n const next = options.iterator ? interval.next().value.toDate() : interval.next().toDate();\n\n let now;\n\n if (task.scheduleOptions.tz) {\n DateTime.now().setZone(task.scheduleOptions.tz)\n } else {\n now = DateTime.utc().toJSDate()\n }\n\n //TODO: we should check the TTL, it should always be positive!\n let ttl = next.getTime() - now.getTime()\n\n return {\n ttl,\n interval,\n time: next.toLocaleTimeString(),\n };\n }", "function next () {\n return crontime.schedule().next()\n }", "init(){\r\n document.querySelector(\".start\").addEventListener(\"click\",this.cronometrar);\r\n document.querySelector(\".stop\").addEventListener(\"click\",this.parar);\r\n document.querySelector(\".reiniciar\").addEventListener(\"click\",this.reiniciar);\r\n this.d = 0;\r\n this.h = 0;\r\n this.m = 0;\r\n this.s = 0;\r\n document.getElementById(\"control\").innerHTML=\"00:00:00:00\";\r\n }", "function nightly() {\n var now = new Date;\n if (now - (global.nightly.lastRun || -Infinity) < Date.ONEMINUTE) {\n return; // Avoid running twice when main scheduler runs more than once per minute\n }\n app.log('***** Running nightly scripts *****');\n Admin.purgeReferrers();\n Admin.dequeue();\n global.nightly.lastRun = now;\n return;\n}", "function acertou() {\n alert(\"Acertei de Novo!\");\n start(false);\n}", "function calculadora() {\n //COnjunto de instrucciones\n console.log(\"Hola soy la calculadora\");\n console.log(\"Si soy yo\");\n\n return \"HOLA SOY LA CALCULADORA...!!!\";\n}", "function activarHerramientaPerfil() {\n console.log(\"Activar herramienta perfil\");\n\n crearYCargarCapaLineaPerfil();\n activarControlDibujo();\n\n\n}", "function DailyStep()\n{\n // Perform a single step of daily\n try\n {\n\t// Execute SequenceCode if it exists, stored in task 0\n\tif (data.taskList[0])\n\t eval(data.taskList[0].taskfun);\n\n\t// Call the next function in the tasklist\n\teval(data.taskList[data.taskNum].taskfun);\n }\n catch(err)\n {\n\t// Report the error or message on the floating window\n\tfloatingDaily.showErr(err);\n }\n}", "async function sicronizar() {\n await tccpoo.sync();\n}", "function mainLoop( ) {\n\n\n let segundos = 5;\n let tiempo = segundos * 1000;\n\n\n console.log('Intervalo de '+ segundos );\n console.log('Perioodo: ');\n\n\n REALTIME.actualizarREALTIME( );\n\n setInterval((tiempo) => {\n console.log('-------------------------------------------------------');\n console.log('Intervalo de REALTIME '+ segundos );\n console.log('PERIODO');\n REALTIME.actualizarREALTIME( );\n }, tiempo )\n\n}", "function checkSingleSchedule(now, status, schedule) {\n if (now >= schedule.start && now <= schedule.end) {\n log.log(\"now is perfect for this schedule\");\n return schedule;\n } else if (schedule.repeat.indexOf(now.getDay()) > -1) {\n //comprobamos solo la hora porque estamos en un patron de repetición\n //y hoy es uno de los dias en los que deberia saltar este programa\n var time = new Date(now).setFullYear(2000,0,1);\n var start = new Date(schedule.start).setFullYear(2000,0,1);\n var end = new Date(schedule.end).setFullYear(2000,0,1);\n\n //ahora podemos comparar solo los tiempos\n if (time >= start && time <= end) {\n //encaja\n log.log(\"now is enought for this schedule, today \" + now.getDay() + \" start \" + (new Date(schedule.start)).getDay());\n return schedule;\n }\n }\n\n //ninguno encajaba\n return null;\n }", "function conteo1(tiempo){setTimeout(function(){\r\n tiempo-=1;\r\n segundos=tiempo%60;\r\n minutos=(tiempo-(tiempo%60))/60;\r\n if (segundos<10) {\r\n $(\"#timer\").html(\"0\"+minutos+\":0\"+segundos);\r\n }else {\r\n $(\"#timer\").html(\"0\"+minutos+\":\"+segundos);\r\n }\r\n if ($(\"#timer\").html()==\"00:00\") {\r\n fin_del_juego()\r\n return\r\n }\r\n conteo2(tiempo)\r\n },1000);\r\n }", "function init() {\n getBulkId();\n var j = schedule.scheduleJob('0,30 * * * *', function() {\n getBulkId();\n });\n}", "function contadorRegressivo(){\n\tsegundos--;\n\n\tif(segundos==-1){ // reinicia a contagem regressiva do segundos\n\t\tsegundos=59;\n\t\tif(minutos ==1){ // tratamento para os minutos ficarem com duas casas sempre\n\t\t\tminutos=\"0\" + 0;\n\n\t\t} else if (minutos == \"00\") { // verifica se o tempo esgotou!!\n\t\t\talert(\"Tempo Esgotado! :(\");\n\t\t\tavancar(true); // parametro de controle. Ele sendo true pode avancar mesmo q o botao esteja desabilitado\n\n\t\t}else { // se nada disse acontecer continua a contagem regressiva.\n\t\t\tminutos = \"0\" + --minutos;\n\t\t}\n\t}\n\n\tif(segundos<=9)segundos=\"0\"+segundos; // decrementa sempre os segundos\t\n\t\n\tatualizaTempoNaPagina();\n\tsetTimeout('contadorRegressivo()',1000); // chama a funcao a cada segundo\n\n}", "Schedule(){ren\n \tconsole.log(\"schedule\");\n \tif (this.flights.length == 0 )ren\n \t\treturn new Date();Charlie\n \tlet candidato = new Candidate();\n \tfor (let i = 0; i < this.flights.length; i++) {\n \t\tlet actualDate = newCharlie Date(this.flights[i].getTime() + 60000*10);\n \t\tif (this.CouldScheduleAt(actualDate)){\n \t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\treturn true;\n \t\t}\n \t\telse{\n \t\t\tactualDate = new Date(this.flights[i].getTime() - 60000*10);\n \t\t\tif (this.CouldScheduleAt(actualDate)){\n \t\t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\t\treturn true;\n \t\t\t}\n \t\t}\n \t\tif (i == this.flights.length - 1 ){\n \t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\treturn false;\n \t\t}ren\n \t}\n\n }", "async fetchLastProcessTime() {\n\t \tconst oThis = this;\n\t \treturn Promise.resolve(oThis.model.getLastCronRunTime());\n\t }", "function novoJogo() {\r\n // guarda valores do formulario\r\n var nJogadores = select1.value\r\n var nTabuleiro = select2.value\r\n if(nJogadores==\"\" || nTabuleiro==\"\") {\r\n mesa.innerHTML += \"<h1>Preencha todos os campos do formulário</h1>\"\r\n return\r\n }\r\n // configura pontuacao\r\n pontuacao1 = 0\r\n doisJogadores = false\r\n if (nJogadores == 2) {\r\n pontuacao2 = 0\r\n doisJogadores = true\r\n jogador1.removeAttribute(\"class\")\r\n btnNovo.removeAttribute(\"hidden\")\r\n jogador1.innerHTML = \"<span class='label'>P1</span><span>0</span>\"\r\n jogador2.innerHTML = \"<span class='label'>P2</span><span>0</span>\"\r\n } else {\r\n jogador2.innerHTML = \"\"\r\n btnNovo.setAttribute(\"hidden\",\"true\") // se o jogo recomecar sem terminar, o cronometro fica acelerado\r\n centesimas = 0; segundos = 0; minutos = 0;\r\n jogador1.setAttribute(\"class\",\"cronometro\")\r\n jogador1.innerHTML = \"<span id='minutos'>00</span><span id='segundos'>:00</span><span id='centesimas'>:00</span>\"\r\n control = setInterval(iniciarCronometro,10);\r\n }\r\n // monta html do tabuleiro\r\n configurarTabuleiro(nTabuleiro)\r\n // monta logica do tabuleiro\r\n var nPares = nTabuleiro*nTabuleiro/2\r\n mapearCartas(nPares)\r\n}", "function iniciaJogo() {\r\n\r\n var varUrl = window.location.search //busca o valor que esta depois de *.html no url, nesse caso vai trazer ? + a informação depois da interogação\r\n\r\n var varNivelJogo = varUrl.replace(\"?\", \"\"); //metodo repleace subtitui o valor de ? por nada\r\n\r\n var varTempoSegundos = 0\r\n\r\n // 1 facil > 120 segundos\r\n if (varNivelJogo == 1) {\r\n varTempoSegundos = 120\r\n }\r\n\r\n // 2 normal > 60 segundos\r\n if (varNivelJogo == 2) {\r\n varTempoSegundos = 60\r\n }\r\n\r\n //3 dificil > 30 segundos\r\n if (varNivelJogo == 3) {\r\n varTempoSegundos = 30\r\n }\r\n\r\n // inserir segundos no cronometro\r\n console.log(varTempoSegundos)\r\n document.getElementById(\"idCronometro1\").innerHTML = varTempoSegundos\r\n\r\n\r\n var varQtdBaloes = 80;\r\n\r\n criaBaloes(varQtdBaloes)\r\n\r\n document.getElementById(\"idBaloesInteiros\").innerHTML = varQtdBaloes\r\n document.getElementById(\"idBaloesEstourados\").innerHTML = 0\r\n\r\n contagemTempo(varTempoSegundos + 1)\r\n\r\n}", "function loadScheduler() {\n loadTheme();\n // week headers\n updateDays();\n // list of time stamps\n generateTimeList();\n}" ]
[ "0.7084632", "0.70063454", "0.6917214", "0.6824818", "0.67470676", "0.6412796", "0.6401061", "0.62434053", "0.6226063", "0.6205591", "0.6180736", "0.6180677", "0.6108131", "0.60960746", "0.6022762", "0.5978259", "0.59092844", "0.58879197", "0.583516", "0.5808286", "0.57941294", "0.57761276", "0.5773227", "0.57487965", "0.57392037", "0.5735254", "0.57133657", "0.56974876", "0.56575906", "0.5653487", "0.5626942", "0.5615142", "0.55699164", "0.5557523", "0.55102134", "0.5476079", "0.54593265", "0.5457499", "0.54330313", "0.54223007", "0.53898853", "0.5386753", "0.5370137", "0.53696", "0.53262395", "0.53209585", "0.5315378", "0.53121006", "0.528528", "0.5270422", "0.52466106", "0.5237737", "0.5218378", "0.5216715", "0.5214598", "0.52087975", "0.51930594", "0.5185275", "0.51771504", "0.5175967", "0.5172306", "0.51679707", "0.5166881", "0.5150106", "0.5134589", "0.51215386", "0.5113931", "0.50912476", "0.50760156", "0.507555", "0.50553536", "0.50490934", "0.50487", "0.50297993", "0.5021163", "0.50190103", "0.5016606", "0.5015516", "0.5015179", "0.5002456", "0.49950647", "0.49943334", "0.49938267", "0.49933782", "0.49847606", "0.49781463", "0.49768502", "0.49761626", "0.49667323", "0.49593866", "0.4958567", "0.49513125", "0.49496272", "0.4948595", "0.49444863", "0.49393275", "0.49338293", "0.49239826", "0.49225408", "0.4913937", "0.4907007" ]
0.0
-1
funcion que reinicia el cronometro desde 0
function reset(){ window.clearInterval(timer) count = 0; // reinicia desde 0 esta fuera del contador principal chronometre.innerHTML = count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inicializaCronometro() {\n\t\n\tcampo.one(\"focus\", function () { // a função one descarta eventos iguais seguintes\n//campo.on(\"focus\", function () { // a função on capta o 1º e todos os eventos posteriores\n\t\tvar tempoRestanteSPAN = $(\"#tempo-digitacao\");\n\t\tvar tempoRestante = tempoRestanteSPAN.text();\n\n\t\tdesabilitaIcon(\"#botao-reiniciar\");\n\t\t\t/*$(\"#botao-reiniciar\").attr(\"disabled\",true);\n\t\t\t$(\"#botao-reiniciar\").addClass(\"disabled\");*/\n\t\tvar cronometroID = setInterval(function () {\n\t\t\ttempoRestanteSPAN.text(--tempoRestante);\n\t\t\t// .attr(\"atributo da tag\", ?) devolve e define, como a .text(?).\n\t\t\tif( tempoRestante < 1 ) {\n\t\t\t\tclearInterval(cronometroID);\n\t\t\t\tfinalizaJogo();\n\t\t\t}\n\n\t\t}, 1000);\n\t});\n}", "function iniciarCronometro(){\n \n intervaloTempo = setInterval(function(){\n\n tempoJogo.segundos++;\n \n if(tempoJogo.segundos < 10){\n tempoJogo.segundos = '0'+tempoJogo.segundos;\n }\n if(tempoJogo.segundos < 60 && tempoJogo.minutos === 0){\n tempoJogo.minutos=0;\n tempoJogo.minutos = '0'+tempoJogo.minutos;\n }\n \n if(tempoJogo.segundos === 60){\n tempoJogo.minutos++;\n tempoJogo.segundos = '0'+0;\n if(tempoJogo.minutos < 10){\n tempoJogo.minutos = '0'+tempoJogo.minutos;\n }\n }\n\n if(tempoJogo.minutos === 60){\n tempoJogo.minutos = 0;\n tempoJogo.horas++;\n if(tempoJogo.horas < 10){\n tempoJogo.horas = '0'+tempoJogo.horas;\n }\n }\n\n if(tempoJogo.horas == 24){\n tempoJogo.horas = 0;\n tempoJogo.dias++\n }\n\n //Ganho de estamina por tempo\n if(tempoJogo.minutos % 5 == 0 && tempoJogo.segundos == 0 && jogador1.estamina < 100){\n jogador1.estamina++;\n gravarLS('estaminaJ', jogador1.estamina);\n mostraInfoJogador();\n }\n\n //Tempo referente ao rendimento no banco\n if(tempoJogo.horas % 1 == 0 && tempoJogo.minutos == 0 && tempoJogo.segundos == 0){\n jogador1.saldoConta += jogador1.rendimento;\n jogador1.saldoConta = parseInt(jogador1.saldoConta);\n console.log(`saldo: ${jogador1.saldoConta}`)\n gravarLS('saldo', jogador1.saldoConta);\n mostraInfoJogador(); \n }\n\n //Ganhos diários do cabaré\n if(tempoJogo.horas % 6 == 0 && tempoJogo.minutos == 0 && tempoJogo.segundos == 0){\n if(cabareG1.pagamentoDia == null){\n return\n }else{\n cabareG1.ganhos = parseInt(cabareG1.ganhos)\n cabareG1.ganhos += (cabareG1.pagamentoDia);\n localStorage.setItem('meuCabare', JSON.stringify(cabareG1))\n mostraMeuCabare()\n } \n }\n \n gravarLS('min', tempoJogo.minutos);\n gravarLS('horas', tempoJogo.horas);\n gravarLS('dias', tempoJogo.dias);\n \n $horas.innerHTML = `<i class=\"far fa-clock\"></i> ${tempoJogo.horas} : ${tempoJogo.minutos}`;\n $dias.innerHTML = `<i class=\"far fa-calendar-alt\"></i> Dia: ${tempoJogo.dias}` ;\n },100) \n}", "function continuar() {\n emp2=new Date(); //fecha actual\n emp2=emp2.getTime(); //pasar a tiempo Unix\n emp3=emp2-cro; //restar tiempo anterior\n emp=new Date(); //nueva fecha inicial para pasar al temporizador \n emp.setTime(emp3); //datos para nueva fecha inicial.\n elcrono=setInterval(tiempo,10); //activar temporizador\n marcha=1; //indicar que esta en marcha\n document.cron.boton2.value=\"parar\"; //Cambiar estado del botón\n document.cron.boton1.disabled=false; //activar boton 1 si estuviera desactivado\n }", "function timer(){\n cronometro = window.setInterval(Iniciar, 1000);\n}", "function cronometro () { \n timeActual = new Date();\n acumularTime = timeActual - timeInicial;\n acumularTime2 = new Date();\n acumularTime2.setTime(acumularTime);\n ss = acumularTime2.getSeconds();\n mm = acumularTime2.getMinutes();\n hh = acumularTime2.getHours()-21;\n if (ss < 10) {ss = \"0\"+ss;} \n if (mm < 10) {mm = \"0\"+mm;}\n if (hh < 10) {hh = \"0\"+hh;}\n timer.innerHTML = hh+\" : \"+mm+\" : \"+ss;\n}", "function cronJob() {\n\t\t//Schedule Synchronized Loop, so we dont get of sync \n\t\tnextMinute(function () {\n util.log(\"Exec loop\"); \n MomoInstance.execCronsNow(); \n cronJob();\n\t\t});\n\t}", "function startCron (){\n\n stopCron();\n if(CRON_STATUS =='START'){\n interval = setInterval(postInit,CRON_INTERVAL*60*1000 )\n }\n return pushData();\n\n}", "function cronCallbackTimer(arg, cron_id) {\n let hourNow = rtc.getTimeHours();\n let minNow = rtc.getTimeMinutes();\n\n print('[cronCallbackTimer] Hour: ' + JSON.stringify(hourNow));\n print('[cronCallbackTimer] Min: ' + JSON.stringify(minNow));\n\n if (hourOn !== hourOff) {\n if (yHour[hourNow]) {\n if (hourNow === JSON.parse(hourOn)) {\n if (minNow >= JSON.parse(minOn)) {\n print('On')\n applyBoardConfig();\n } else {\n print('Off');\n turnOffLed();\n }\n } else {\n print('On')\n applyBoardConfig();\n }\n } else {\n if (hourNow === JSON.parse(hourOff)) {\n if (minNow >= JSON.parse(minOff)) {\n print('Off');\n turnOffLed();\n } else {\n print('On')\n applyBoardConfig();\n }\n } else {\n print('Off');\n turnOffLed();\n }\n }\n }\n\n if (JSON.parse(hourOn) === JSON.parse(hourOff)){\n if (yHour[hourNow]) {\n if (hourNow === JSON.parse(hourOn)) {\n if(yMin[minNow]) {\n applyBoardConfig();\n } else {\n turnOffLed();\n }\n } else {\n applyBoardConfig();\n }\n } else {\n if (hourNow === JSON.parse(hourOff)) {\n if(yMin[minNow]) {\n applyBoardConfig();\n } else {\n turnOffLed();\n }\n } else {\n turnOffLed();\n }\n }\n }\n \n}", "function startTimer () {\n console.log(\"Start timer...\")\n if (isMarch == false) { \n timeInicial = new Date();\n control = setInterval(cronometro, 10);\n isMarch = true;\n }\n}", "function activaFuncionamientoReloj() {\n let tiempo = {\n hora: 0,\n minuto: 0,\n segundo: 0\n };\n\n tiempo_corriendo = null;\n\n\n tiempo_corriendo = setInterval(function () {\n // Segundos\n tiempo.segundo++;\n if (tiempo.segundo >= 60) {\n tiempo.segundo = 0;\n tiempo.minuto++;\n }\n\n // Minutos\n if (tiempo.minuto >= 60) {\n tiempo.minuto = 0;\n tiempo.hora++;\n }\n\n $horasDom.text(tiempo.hora < 10 ? '0' + tiempo.hora : tiempo.hora);\n $minutosDom.text(tiempo.minuto < 10 ? '0' + tiempo.minuto : tiempo.minuto);\n $segundosDom.text(tiempo.segundo < 10 ? '0' + tiempo.segundo : tiempo.segundo);\n }, 1000);\n corriendo = true;\n\n }", "function cron() {\n console.log(`Updating db - ${new Date()}`);\n updateDb(payload)()\n .then((res) => console.log('sucess!'))\n .catch((err) => console.error(err));\n }", "function init() {\n\n\t// Stop and delete cronjobs before restarting them\n\tfor (var i in cronjobs) {\n\t\tvar job = cronjobs[i];\n\t\tjob.stop();\n\t\tdelete(cronjobs[i]);\n\t}\n\n\n\tvar sites = storage.getItem('sites');\n\n\t// Start a cronjob for each site\n\t_.each(sites, function(site, k){\n\t\t\n\t\t// If the cron is set\n\t\tif (site.cron) {\n\n\t\t\t// Store it to be able to stop the jobs\n\t\t\tcronjobs.push( \n\t\t\t\tnew cronjob(\n\t\t\t\t\tsite.cron, \n\t\t\t\t\tfunction(){\n\t\t\t\t\t\tthis.k = k;\n\t\t\t\t\t\t// start the backup and the download\n\t\t\t\t\t\tvar backup = new akeeba(this.url, this.key);\n\t\t\t\t\t\tbad.backupAndDownload(backup, this);\n\t\t\t\t\t},\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\n\t\t\t\t\t}, \n\t\t\t\t\ttrue, // Start now\n \t\t\t\t\tnull,\n\t\t\t\t\tsite // Context\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t});\n}", "function contadorRegressivo(){\n\tsegundos--;\n\n\tif(segundos==-1){ // reinicia a contagem regressiva do segundos\n\t\tsegundos=59;\n\t\tif(minutos ==1){ // tratamento para os minutos ficarem com duas casas sempre\n\t\t\tminutos=\"0\" + 0;\n\n\t\t} else if (minutos == \"00\") { // verifica se o tempo esgotou!!\n\t\t\talert(\"Tempo Esgotado! :(\");\n\t\t\tavancar(true); // parametro de controle. Ele sendo true pode avancar mesmo q o botao esteja desabilitado\n\n\t\t}else { // se nada disse acontecer continua a contagem regressiva.\n\t\t\tminutos = \"0\" + --minutos;\n\t\t}\n\t}\n\n\tif(segundos<=9)segundos=\"0\"+segundos; // decrementa sempre os segundos\t\n\t\n\tatualizaTempoNaPagina();\n\tsetTimeout('contadorRegressivo()',1000); // chama a funcao a cada segundo\n\n}", "reiniciarConteo() {\n this.ultimo = 0;\n this.tickets = [];\n this.grabarArchivo();\n this.ultimos4 = []\n console.log('Se ha inicializado el sistema');\n \n }", "static get schedule() {\n // once every minute\n return '0 0 10 1/1 * ? *'\n }", "function temporizador1()\n{\n \n s = document.getElementById(\"segundos1\")\n m = document.getElementById(\"minutos1\")\n cronometro1 = setInterval(\n function(){\n if (contador1_s==60)\n {\n contador1_s = 0\n contador1_m ++\n //agrego un cero si los minutos son menores a 10\n if (contador1_m<10)\n {\n m.innerText = \"0\" + contador1_m\n } else\n {\n m.innerText = contador1_m\n }\n }\n //agrego un cero si los segundos son menores a 10\n if (contador1_s<10)\n {\n s.innerText = \"0\" + contador1_s\n } else\n {\n s.innerText = contador1_s\n }\n contador1_s ++\n \n }\n ,1000)\n}", "init(){\r\n document.querySelector(\".start\").addEventListener(\"click\",this.cronometrar);\r\n document.querySelector(\".stop\").addEventListener(\"click\",this.parar);\r\n document.querySelector(\".reiniciar\").addEventListener(\"click\",this.reiniciar);\r\n this.d = 0;\r\n this.h = 0;\r\n this.m = 0;\r\n this.s = 0;\r\n document.getElementById(\"control\").innerHTML=\"00:00:00:00\";\r\n }", "async function sendOrdersCron() {\n \n var rule = new schedule.RecurrenceRule();\n rule.hour = 8;\n rule.minute = 0;\n\n let cronCounter = 0\n\n schedule.scheduleJob(rule, async () => { \n console.log('Ran cron: ', new Date())\n if (process.env.NODE_ENV == 'test') return cronCounter++\n \n await sendOrdersForShops()\n })\n}", "static get schedule() {\n // once every hour\n return '* */1 * * *';\n }", "function create() {\n // cronJobs.push(createCron('RT Movies', '* 30 11 * * 0-6', movies.updateMovies.bind(movies))); // This cron runs every weekday at 11:30am\n cronJobs.push(createCron('RT Movies', '* 30 11 * * 0-6', movies.updateMovies.bind(movies))); // This cron runs every weekday at 11:30am\n log.info('Cron Jobs successfully created');\n}", "function stop(){\n clearInterval(cron);\n hh= 0;\n mm= 0;\n ss= 0;\n\n document.getElementById('counter').innerText = '00:00:00';\n}", "function update_time()\n{\n\t$('.cronos').each(function() {\n\t\tvar name = $(this).attr(\"name\");\n\t\tvar estado = parseInt($(this).attr(\"estado\"));\n\t\tvar time = $(this).val();\n\t\tvar ID = name.substring(6); // a partir de la 6 posicio\n\t\tvar capa = '#time_'+ID;\n\t\tvar capabotons = '#capabotons_'+ID;\n\t\t\n\t\t// color\n\t\tvar color = \"blue\";\n\t\tif (time<3600) color = \"orange\";\n\t\tif (time<300) color = \"red\";\n\t\t$(capa).html(strtotime(time));\n\t\t$(capa).css(\"color\", color);\n\t\t$(this).val(time-1);\n\t\tif (time<0 && estado < 5)\n\t\t\t$(capabotons).hide();\t\n\t});\t\n}", "function actualizaReloj(){ \n \n/* Capturamos la Hora, los minutos y los segundos */\nmarcacion = new Date() \n \n/* Capturamos la Hora */\nHora = marcacion.getHours() \n \n/* Capturamos los Minutos */\nMinutos = marcacion.getMinutes() \n \n/* Capturamos los Segundos */\nSegundos = marcacion.getSeconds() \n \n/* Si la Hora, los Minutos o los Segundos\nSon Menores o igual a 9, le añadimos un 0 */\n \nif (Hora<=9)\nHora = \"0\" + Hora\n \nif (Minutos<=9)\nMinutos = \"0\" + Minutos\n \nif (Segundos<=9)\nSegundos = \"0\" + Segundos\n \n/* Termina el Script del Reloj */\n \n \n/* Coemienza eñ Script de la Fecha */\n \nvar Dia = new Array(\"Domingo\", \"Lunes\", \"Martes\", \"Miércoles\", \"Jueves\", \"Viernes\", \"Sábado\", \"Domingo\");\nvar Mes = new Array(\"Enero\",\"Febrero\",\"Marzo\",\"Abril\",\"Mayo\",\"Junio\",\"Julio\",\"Agosto\",\"Septiembre\",\"Octubre\",\"Noviembre\",\"Diciembre\");\nvar Hoy = new Date();\nvar Anio = Hoy.getFullYear();\nvar Fecha = \"\" + Dia[Hoy.getDay()] + \", \" + Hoy.getDate() + \" de \" + Mes[Hoy.getMonth()] + \" del \" + Anio + \"<br/> \";\n \n/* Termina el script de la Fecha */\n \n \n/* Creamos 4 variables para darle formato a nuestro Script */\nvar Inicio, Script, Final, Total\n \n/*En Inicio le indicamos un color de fuente y un tamaño */\nInicio = \"<font size=2 color=black>\"\n \n/* En Reloj le indicamos la Hora, los Minutos y los Segundos */\nScript = \"<div align=right>\" + Fecha + Hora + \":\" + Minutos + \":\" + Segundos + \"</div> \"\n \n/* En final cerramos el tag de la fuente */\nFinal = \"</font>\"\n \n/* En total Finalizamos el Reloj uniendo las variables */\nTotal = Inicio + Script + Final\n \n/* Capturamos una celda para mostrar el Reloj */\ndocument.getElementById('Fecha_Reloj').innerHTML = Total\n \n/* Indicamos que nos refresque el Reloj cada 1 segundo */\nsetTimeout(\"actualizaReloj()\",1000) \n}", "function cronMaker(obj) {\n let hour = obj.hour;\n let min = obj.min;\n let weekDay = obj.weekDay;\n let monthdate = obj.monthdate;\n let delayInDays = obj.delayInDays;\n\n let expression = \"\";\n if (obj.type === 'Daily') {\n expression = min + \" \" + hour + \" */\" + delayInDays + \" * ?\";\n }\n else if (obj.type === 'Weekly') {\n expression = min + \" \" + hour + \" ? * \" + weekDay;\n }\n else if (obj.type === 'Monthly') {\n expression = min + \" \" + hour + \" \" + monthdate + \" * ?\";\n }\n \n return expression;\n}", "constructor() {\n const params = { cronProcessId: cronProcessId };\n\n super(params);\n\n const oThis = this;\n\n oThis.canExit = true;\n }", "function setTimers(){\r\n\t\t// Calcula cada cuantos segundos debe actualizar cada contador de recursos restantes para\r\n\t\t// aprovechar el temporizador del resto de relojes\r\n\t\tvar frecuencia = new Array(4);\r\n\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\tfrecuencia[i] = (1 / produccion[i]) * 1000;\r\n\t\t\tif (!isFinite(frecuencia[i]) || frecuencia[i] < 0) frecuencia[i] = Number.POSITIVE_INFINITY;\r\n\t\t\t\t\t\tif (total[i] - actual[i] == 0) frecuencia[i] = Number.POSITIVE_INFINITY;\r\n\t\t\tsetInterval(crearTemporizadorRecurso(i), Math.floor(frecuencia[i]));\r\n\t\t}\r\n\r\n\t\tsetInterval(function () {\r\n\t\t\t/*\r\n\t\t\t * Se distinguen dos tipos de temporizadores, timeout y timeouta. Solo los primeros\r\n\t\t\t * provocan que la pagina se actualice al llegar a 0.\r\n\t\t\t */\r\n\t\t\tvar relojes = find(\"//*[@id='timeout' or @id='timeouta']\", XPList);\r\n\t\t\tfor (var i = 0; i < relojes.snapshotLength; i++){\r\n\t\t\t\tvar tiempo = calcular_segundos(relojes.snapshotItem(i).innerHTML) - 1;\r\n\t\t\t\tif (tiempo >= 0) relojes.snapshotItem(i).innerHTML = formatear_tiempo(tiempo);\r\n//\t\t\t\telse if (relojes.snapshotItem(i).id == 'timeout') document.location.reload();\r\n\t\t\t\telse if (relojes.snapshotItem(i).id == 'timeout' && relojes.snapshotItem(i).getAttribute('noreload') != 1) document.location.reload();\r\n\t\t\t}\r\n\t\t},1000);\r\n\r\n\t}", "function temporizador2()\n{\n \n s = document.getElementById(\"segundos2\")\n m = document.getElementById(\"minutos2\")\n cronometro2 = setInterval(\n function(){\n if (contador2_s==60)\n {\n contador2_s = 0\n contador2_m ++\n //agrego un cero si los minutos son menores a 10\n if (contador2_m<10)\n {\n m.innerText = \"0\" + contador2_m\n } else\n {\n m.innerText = contador2_m\n }\n }\n //agrego un cero si los segundos son menores a 10\n if (contador2_s<10)\n {\n s.innerText = \"0\" + contador2_s\n } else\n {\n s.innerText = contador2_s\n }\n contador2_s ++\n }\n ,1000)\n}", "function Scheduler(guild_id) {\n\tlet timeRule, timeJob, midnightRule, midnightJob;\n\tfunction init(time = \"00:00\", timezone, timeCommand, midnightCommand) {\n\t\ttimeRule = new schedule.RecurrenceRule();\n\t\tmidnightRule = new schedule.RecurrenceRule();\n\t\tif (timezone) {\n\t\t\ttimeRule.tz = timezone;\n\t\t\tmidnightRule.tz = timezone;\n\t\t}\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob = schedule.scheduleJob(timeRule, (time) => {\n\t\t\ttry {\n\t\t\t\ttimeCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t\t[midnightRule.hour, midnightRule.minute] = [0, 0];\n\t\tmidnightJob = schedule.scheduleJob(midnightRule, (time) => {\n\t\t\ttry {\n\t\t\t\tmidnightCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t}\n\tfunction setTimezone(timezone) {\n\t\ttimeRule.tz = timezone;\n\t\ttimeJob.reschedule(timeRule);\n\t\tmidnightRule.tz = timezone;\n\t\tmidnightJob.reschedule(midnightRule);\n\t}\n\tfunction setTime(time = \"00:00\") {\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob.reschedule(timeRule);\n\t}\n\tfunction destroy() {\n\t\ttimeJob.cancel();\n\t\tmidnightJob.cancel();\n\t\tdelete schedulers[guild_id];\n\t}\n\treturn {\n\t\tinit,\n\t\tsetTimezone,\n\t\tsetTime,\n\t\tdestroy\n\t}\n}", "function setTimers(){\n\t\t// Calcula cada cuantos segundos debe actualizar cada contador de recursos restantes para \n\t\t// aprovechar el temporizador del resto de relojes\n\t\tvar frecuencia = new Array(4);\n\t\tfor (var i = 0; i < 4; i++){\n\t\t\tfrecuencia[i] = (1 / produccion[i]) * 1000;\n\t\t\tif (!isFinite(frecuencia[i]) || frecuencia[i] < 0) frecuencia[i] = Number.POSITIVE_INFINITY;\n if (total[i] - actual[i] == 0) frecuencia[i] = Number.POSITIVE_INFINITY;\n\t\t\tsetInterval(crearTemporizadorRecurso(i), Math.floor(frecuencia[i]));\n\t\t}\n\n\t\tsetInterval(function () {\n\t\t\t/*\n\t\t\t * Se distinguen dos tipos de temporizadores, timeout y timeouta. Solo los primeros \n\t\t\t * provocan que la pagina se actualice al llegar a 0.\n\t\t\t */\n\t\t\tvar relojes = find(\"//*[@id='timeout' or @id='timeouta']\", XPList);\n\t\t\tfor (var i = 0; i < relojes.snapshotLength; i++){\n\t\t\t\tvar tiempo = calcular_segundos(relojes.snapshotItem(i).innerHTML) - 1;\n\t\t\t\tif (tiempo >= 0) relojes.snapshotItem(i).innerHTML = formatear_tiempo(tiempo);\n\t\t\t\telse if (relojes.snapshotItem(i).id == 'timeout') document.location.reload();\n\t\t\t}\n\t\t},1000);\n\n\t}", "function rescheduleIrrigation(dbUtils) {\n logger.info(\"Rescheduling irrigation...\");\n\n //cancello tutte le irrigazioni precedenti\n if (schedule.scheduledJobs.irrigate) {\n schedule.scheduledJobs.irrigate.cancel();\n }\n\n\n var schedulerEnable = dbUtils.getAppParameter(consts.PARAM_SCHEDULER_ENABLE) || \"N\";\n var scheulerTime = dbUtils.getAppParameter(consts.PARAM_SCHEDULER_TIME) || \"\";\n\n if (schedulerEnable == \"Y\") {\n\n var timeComponent = scheulerTime.split(\":\");\n if(timeComponent.length != 2){\n logger.error(\"Invalid scheduler time: \" + scheulerTime);\n return;\n }\n\n logger.info(\"Next irrigation at: \" + scheulerTime + \" now is: \" + new Date());\n\n var rule = new schedule.RecurrenceRule();\n //rule.dayOfWeek = [1, 2, 3, 4, 5];\n rule.hour = timeComponent[0];\n rule.minute = timeComponent[1];\n\n var j = schedule.scheduleJob(SCHEDULER_PROCCESS_NAME, rule, function () {\n \n\n //https://openweathermap.org/weather-conditions\n if(weatherUtils && weatherUtils.info.weather && weatherUtils.info.weather[0] && weatherUtils.info.weather[0].id < 622){\n logger.info(\"\\n**********************************************************************\");\n logger.info(\"Irrigation abborted at: \" + new Date());\n logger.info(\"Weather: \" + weatherUtils.info.weather[0].main);\n logger.info(\"\\n**********************************************************************\");\n }else{\n startIrrigation(dbUtils);\n }\n \n });\n }\n}", "function funTimerAll() {\n try {\n // Increment Counter\n global.intCounter += 1;\n\n\n // Check Exit Program?\n if (global.bolGlobalError) {\n process.exit();\n }\n\n\n\n // First Time Read of all data from Redis\n if (global.intStep <= global.intStepToStart && !global.bolWorkingOnStep && !global.bolDoItOnce) {\n global.bolWorkingOnStep = true;\n // Read intStep from Redis, \n // First Time Read should be 1\n // After Main Program Clear Redis, should be 2\n // After Main Program Read from DB and save to Redis, should be 3\n mRU.redisHGetAll(\"AllProgram:Main\", true, function(err, res) {\n if (err == \"0000\") {\n // Got intStep of Main Program from Redis\n global.intStep = parseInt(res['intStep']);\n if (global.intStep >= 2) {\n // Main Program / Master Process Get Data from DB and save them to Redis for other processes\n if (global.bolMainProgram && global.bolMasterProcess && global.intStep == 2 && !global.bolDoItOnce_2) {\n // Set Do it Once\n global.bolDoItOnce_2 = true;\n\n // Get aryGameList from DB and save to Redis\n mGR.funGetGameListFromDB(function(err, result) {\n if (err.code == \"0000\") {\n // Set Do it Once\n global.bolDoItOnce_21 = true;\n global.bolDoItOnce_22 = true;\n\n // Check All Step 2 Finished\n if (global.bolDoItOnce_21 && global.bolDoItOnce_22) {\n // Set intStep = 3 to Redis\n mRU.redisHmSet('AllProgram:Main', [\"intProcessID\", process.pid, \"intLastHB\", Date.now(), \"intStep\", 3], true, function(err2, res2) {\n // Nothing to do\n // mUT.funUpdateConsole('Set intStep OK?', false);\n // mUT.funUpdateConsole(err2, false);\n // mUT.funUpdateConsole(res2, false);\n });\n }\n } else {\n // GlobalError already = 1, so exit!\n mUT.funUpdateConsole('err.code: ', err.code);\n }\n });\n\n // TODO: Get Others from DB and save them to Redis\n global.bolDoItOnce_22 = true;\n }\n\n\n\n // Get Data from Redis After Main Program store everying to Redis\n if (global.intStep >= 3 && !global.bolDoItOnce_3) {\n // Set bolDoItOnce\n global.bolDoItOnce_3 = true;\n\n // Get aryGameList\n mRU.redisGet('aryGameList', function(err2, res2) {\n // Check Exist\n if (res2 == null) {\n mUT.funUpdateConsole(\"aryGameList Not Found in Redis, but intStep = 2, Impossible! Quit\", false);\n global.bolGlobalError = true;\n } else {\n global.aryGameList = JSON.parse(res2);\n \n // Set global.intStep to start all programs\n global.bolDoItOnce_31 = true;\n\n // Check All Step3 Finished\n if (global.bolDoItOnce_31 && global.bolDoItOnce_32) {\n global.intStep = global.intStepToStart + 1;\n global.bolDoItOnce = true;\n }\n\n // for Each element, init Game Result Last Update Date & Time\n for (let i=0;i<global.aryGameList.length;i++) {\n global.aryGameResultLastUpdateDT.push(0);\n global.aryGameResultLastUpdateWorking.push(false);\n global.aryGameResultNotGetWaitSecond.push(config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].intNotGetWaitSecond);\n global.aryGameResultFirstLoad.push(false);\n }\n }\n });\n\n // Get Other\n global.bolDoItOnce_32 = true;\n }\n }\n }\n global.bolWorkingOnStep = false;\n })\n }\n\n\n\n // If Main Program and Master Process,\n if (global.bolMainProgram && global.bolMasterProcess && global.intStep >= global.intStepToStart) {\n // Loop for aryGameList, and Check if need to get New Game Results\n for (let i=0; i<global.aryGameList.length; i++) {\n if (global.aryGameList[i][\"gli_status\"] == \"E\") {\n // This Game is Enabled in mysql, should check to get new game result\n\n // Check Currect Time > (Last Record Real Open Time Time + Duration + intNotGetWaitSecond)\n // AND, Check Time within this game Day Start & End Time\n if ((Date.now() > global.aryGameResultLastUpdateDT[i] + (global.aryGameList[i][\"gli_duration\"] + global.aryGameResultNotGetWaitSecond[i]) * 1000 &&\n !global.aryGameResultLastUpdateWorking[i] && mGR.funIsGameWithinTime(i)) \n || !global.aryGameResultFirstLoad[i]) {\n // Must Load Once\n global.aryGameResultFirstLoad[i] = true;\n\n // Wait Long Enough, should get new Game Result\n // mUT.funUpdateConsole(\"i: \" + i + \" | Date.now: \" + Date.now() + \" | LastUpdate DT + (duration + WaitSecond) * 1000: \" + (global.aryGameResultLastUpdateDT[i] + (global.aryGameList[i][\"gli_duration\"] + global.aryGameResultNotGetWaitSecond[i]) * 1000), false);\n\n // Set Working Flag\n global.aryGameResultLastUpdateWorking[i] = true;\n\n // Set Host and Path\n let strPathTemp = \"\";\n if (config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].intType == 0) {\n // Type 0:\n strPathTemp = config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strPath +\n config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strGameIDVar +\n config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strGameID +\n config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strCountVar +\n \"1\"\n } else {\n // Type 1:\n strPathTemp = config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strPath +\n config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strGameIDVar +\n config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strGameID\n }\n let options = {\n host: config.caryGameResultApi[0][global.aryGameList[i][\"gli_id\"]][0].strHost, \n path: strPathTemp,\n // Without the headers, the api won't work in some urls\n headers: {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'}\n };\n mGR.funGetHtml(options, function(res) {\n try {\n // The Try here avoid problems in JSON.parse\n let objTempResult = JSON.parse(res)[\"result\"];\n mGR.funSaveGameResult(i, objTempResult, function(err) {\n global.aryGameResultLastUpdateWorking[i] = false;\n if (err.code == \"0000\") {\n mRU.funUpdateServerMonitor(\"Game Result Save to DB and Redis\");\n } else {\n mRU.funUpdateServerMonitor(\"Game Result Save to DB and Redis Error: \" + err.code);\n }\n });\n } catch (err) {\n global.aryGameResultLastUpdateWorking[i] = false;\n mUT.funUpdateConsole(\"Error Should Not Happen: \" + err, false);\n }\n });\n \n } else {\n // Do Nothing, Wait Another One Second\n }\n }\n }\n }\n\n\n\n // Global Counter Testing\n if (global.intCounter == 10) {\n mRU.funUpdateServerMonitor(\"Program Name: \" + global.strServerName + \n \" | Is Master: \" + global.bolMasterProcess + \n \" | Process ID: \" + process.pid, false);\n }\n } catch (err) {\n //\n }\n\n // Check Every 1 second\n setTimeout(funTimerAll, 1000);\n}", "static cron(options) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_applicationautoscaling_CronOptions(options);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.cron);\n }\n throw error;\n }\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const year = fallback(options.year, '*');\n // Weekday defaults to '?' if not supplied. If it is supplied, day must become '?'\n const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*');\n const weekDay = fallback(options.weekDay, '?');\n return new class extends Schedule {\n constructor() {\n super(...arguments);\n this.expressionString = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`;\n }\n _bind(scope) {\n if (!options.minute) {\n core_1.Annotations.of(scope).addWarning('cron: If you don\\'t pass \\'minute\\', by default the event runs every minute. Pass \\'minute: \\'*\\'\\' if that\\'s what you intend, or \\'minute: 0\\' to run once per hour instead.');\n }\n return new LiteralSchedule(this.expressionString);\n }\n };\n }", "function setTime() {\n\n\ttime = new Date();\n\ttime.setTime(time.getTime() + 60000);\n\tinterval = setInterval(cronos, 10);\n}", "ScheduleAt(time){\n \tconsole.log(\"scheduleprofecionales at\");\n }", "startRebootTimer() {\n var world = this;\n\n var reboot_timer = function () {\n if (world.getActiveServersCount() == 0) {\n world.kill('Inactivity reboot');\n return;\n }\n\n // if someone is using it it'll get here and we'll\n // check again in an hour to see if we can reboot it\n setTimeout(reboot_timer, 60 * 60 * 1000);\n };\n\n // kick off in 12 hours\n setTimeout(reboot_timer, 12 * 60 * 60 * 1000);\n }", "function runScheduler()\n{\n schedulerTick();\n setTimeout(runScheduler, scheduler_tick_interval);\n}", "function HoraFinTPChange() {\n realizarCambioHora();\n}", "UnscheduleAt(time){\n \tconsole.log(\"unschedule\");\n }", "scheduleWatchMessages() {\n this.cronJob = schedule(checkFrequency, this.checkNewMessages.bind(this), {});\n }", "function init() {\n getBulkId();\n var j = schedule.scheduleJob('0,30 * * * *', function() {\n getBulkId();\n });\n}", "initChronometer() {\n let self = this;\n\n setInterval(() => {\n self.allDuration();\n }, 1000);\n\n }", "function HoraInicioTPChange() {\n realizarCambioHora();\n}", "function rescheduleJob(internalId){\r\n\t\t var scheduledScriptTask = task.create({ taskType: task.TaskType.SCHEDULED_SCRIPT });\r\n\t\t scheduledScriptTask.scriptId = runtime.getCurrentScript().id;\r\n\t\t scheduledScriptTask.deploymentId = runtime.getCurrentScript().deploymentId;\r\n\t\t scheduledScriptTask.params = { custscript_flo_negative_sd_lastindex : internalId }; // set the last index\r\n\t\t var taskId = scheduledScriptTask.submit();\r\n\t\t\tlog.audit(\"Rescheduling... \"+internalId);\r\n\t\t}", "function iniciarJuego() {\n\n\n //se determina el tiempo en milisegundos para ir cambiando\n setInterval(function() {\n segTranscurridos += 1;\n document.getElementById('cronometro').innerHTML = \"Tiempo: \" + segTranscurridos;\n }, 1000);\n\n\n\n //mando llamar la funcion para dibujar solo las minas\n dibujarMinas(ancho, alto, 'bombas');\n campoJuego = crearCampoJuego(ancho, alto, numMinas);\n\n var botonsitos = document.getElementsByName('botonsitos');\n\n for (var i = 0; i < botonsitos.length; i++) {\n document.getElementById(botonsitos[i].id).onclick = posicionactual;\n }\n segTranscurridos = 0;\n}", "scheduleRefresh() {}", "scheduleRefresh() {}", "function setUpDailyReset(){\n\t$.getJSON('https://api.warframestat.us/xb1/sortie', function(data) {\n\t\t$('#Daily').empty();\n\t\tvar sortieEnd = new Date(data.expiry); //gives tomorrows date 9 am\n\t\tvar today = new Date();\n\n\t\t$('#Daily').append(\"<div id =\\\"wrap\\\"><p id =\\\"white\\\">Time till Daily Reset:</p><p class = \\\"dailyTimer\\\" id=\\\"dailyResetTimer\\\">...</p></div>\");\n\t\tvar timer = \"dailyResetTimer\"\n\t\t//before reset\n\t\tif(sortieEnd - today > 57600000){ //16hrs till next sortie reset then the math changes\n\t\t\tsetTimer(sortieEnd,timer, -57600000, \"active\")\n\t\t}else{ //after reset\n\t\t\tsetTimer(sortieEnd, timer, 28800000, \"active\");\n\t\t}\n\t});\t\n}", "function rechargeautonouvellemanche(){\n setTimeout( function(){\n $.ajax({\n url : \"index.php?page=refresh-nouvellemanche\",\n type : 'GET',\n success : affichrechargenouvellemanche\n });\n rechargeautonouvellemanche();\n }, 1000);\n }", "cron(oncomplete) {\n\n const config = {\n headers: {\n 'Content-Type': 'application/json'\n }\n }\n\n cicService.select01().then(data => {\n // Get each object in array data\n if (validation.isEmptyJson(data)) {\n console.log('No request!');\n // return next();\n oncomplete(0, 0)\n // return;\n }\n\n var count = 0;\n var maxLength = data.length;\n console.log(\"maxLength11~~~\", maxLength);\n\n data.forEach(element => {\n // let fnData = data[i].child;\n console.log(\"element::::\", element);\n let inqDt1 = dateutil.getDate();\n let inqDt2 = dateutil.getDate();\n\n let defaultValue = defaultParams.defaultParams(inqDt1, inqDt2, '', '');\n\n //Convert data to format cic site\n //decrypt password\n var decryptPW = decrypt.decrypt(element.LOGIN_PW);\n var fnData = new cicB0002Req(element, defaultValue, decryptPW);\n\n cicService.updateScrpModCdPreRequestToScraping(element).then(() => {\n // \"?inJsonList=%5B\" + querystrings + \"%5D\"\n axios.post(URI.internal_cic, fnData, config)\n .then((body) => {\n console.log(\"body resultB0002~~~~~\", body.data);\n\n count++;\n // next process until data ending\n oncomplete(count, maxLength);\n // return res.status(200).json(body.data);\n\n }).catch((error) => {\n console.log(\"error call to internal_cic url B0002~~\",error);\n return;\n });\n });\n });\n }).catch((error) => {\n console.log(error)\n });\n }", "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "function init() {\n\n\tupdate();\n\n\tif(alarm_loop) scriptRunning = true;\n\telse scriptRunning = false;\n\n\tpassedMinutes = 0;\n}", "function Timer(){\n\t\tvar segundos = (_segundos <= 9) ? '0'+_segundos : _segundos ;\n\t\tdocument.getElementById('relogio').innerHTML = '0'+_minutos+':'+segundos;\n\t\tif(_minutos==0 && _segundos==10){\n\t\t\tdocument.getElementById('relogio').style.color = '#cc3300';\n\t\t}\n\t\tif(_segundos==0){\n\t\t\tif(_minutos==0){\n\t\t\t\tFimJogo();\n\t\t\t}else{\n\t\t\t\t_minutos--;\n\t\t\t\t_segundos = 59;\n\t\t\t}\n\t\t}else{\n\t\t\t_segundos--;\n\t\t}\n\t}", "static cron(options) {\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const day = fallback(options.day, '*');\n const weekDay = fallback(options.weekDay, '*');\n return new LiteralSchedule(`${minute} ${hour} ${day} ${month} ${weekDay}`);\n }", "restartRechargeTimers(){\n this._units.forEach((unit) => {\n unit.restartRechargeTimer();\n });\n this._rechargedUnitsMap.clear();\n }", "function sched () {\n pub()\n .then(function() {\n return Useful.handyTimer(ns.settings.redisSyncFrequency);\n }) \n .then(function() {\n sched();\n });\n }", "function Install(){\n ScriptApp.newTrigger(\"main\").timeBased().everyMinutes(howFrequent).create();\n}", "function calculadora(){\n\tconsole.log(\"soy una calculadora\");\n}", "function RequestScheduler() {}", "function VideoGuidaImpostaEventoPrimoCaricamento(FunzioneAlTermineCaricamento) {\n\ttmrCaricamentoInizialeYT = window.setInterval(function () {VerificaCaricatoAbbastanza(FunzioneAlTermineCaricamento);}, 500);\n}", "resetSchedule() {\n this._scheduler.resetSchedule();\n }", "function loadPeriodo(ra,curso,turma){\n\t\n\texecutaProcedure([ra,curso,turma], 'mysqlAdapter', 'retornaPeriodo', loadPeriodoSuccess, loadFailure);\n}", "getSchedule(){\n // return CRON schedule format\n // this sample job runs every 15 seconds\n return '*/15 * * * * *';\n }", "function restart() {}", "async start() {\n try {\n this.job = new CronJob('00 00 22 * * *', async () => {\n logger.info(\n 'MIS-report generator running at ',\n moment().format('DD/MM/YYYY'), this.job.cronTime.source,\n );\n await this.generateReportData();\n }, null, true, 'Asia/Kolkata');\n this.job.start();\n } catch (e) {\n logger.info(e);\n throw new InstabikeError(e);\n }\n }", "function cronRule( rule ) { return ( typeof rule === \"undefined\" ) ? \"*\" : rule; }", "mostrarTiempo() {\n let tiempo = this.time.split(\":\");\n let horas = parseInt(tiempo[0]);\n let minutos = parseInt(tiempo[1]);\n let segundos = parseInt(tiempo[2]);\n\n segundos++;\n if (segundos === 60) {\n segundos = 0;\n minutos++;\n }\n if (minutos === 60) {\n minutos = 0;\n horas++;\n }\n\n let nuevoTiempo = `${(horas < 10) ? '0' + horas : horas}:${(minutos < 10) ? '0' + minutos : minutos}:${(segundos < 10) ? '0' + segundos : segundos }`;\n\n CRONOMETRO.innerHTML = nuevoTiempo;\n this.time = nuevoTiempo;\n }", "function C007_LunchBreak_Natalie_NatilieClothed() {\r\n C007_LunchBreak_Natalie_Clothes = 0;\r\n CurrentTime = CurrentTime + 60000;\r\n}", "function reschedule(key) {\n var index, time, date, task = document.getElementById(\"ongoing\").children[key];\n \n for (var i = 0; i < pings.length; i += 1) {\n index = key + \" \" + pings[i];\n time = new Date(task.children[2].firstChild.value + \"T\" + task.children[3].firstChild.value + \"Z\").getTime() - (pings[i] - today.getTimezoneOffset()) * 60 * 1000;\n \n if (time > today.getTime()) {\n chrome.alarms.create(index, {when: time});\n } else {\n chrome.alarms.clear(index);\n }\n }\n}", "function scheduleOne(fn) {\n if (!fn.scheduled) {\n fn.scheduled = 0;\n }\n else if (fn.scheduled > 0) {\n return\n }\n fn.scheduled += 1;\n rAF(function() {\n fn.scheduled -= 1;\n fn();\n });\n }", "function getCronFromTime(time){\n const d = new Date()\n const d1 = new Date()\n const timeStr = time.toString()\n const hours = timeStr.split(\":\")[0]\n const min = timeStr.split(\":\")[1]\n // convert UTC Time to local Time \n const utc_offeset = d.getTimezoneOffset()\n let utc_date = new Date( d.setMinutes(d.getMinutes() + utc_offeset)) \n \n const deff_hours = d1.getHours() - utc_date.getHours()\n const deff_min = d1.getMinutes() - utc_date.getMinutes()\n const actualHour = deff_hours + parseInt(hours)\n const actualMinutes = deff_min + parseInt(min)\n \n return `${actualMinutes} ${actualHour} * * *`\n}", "function reestablece(){\n colector = \"0\";\n operacion = \"\";\n operador0 = 0;\n operador1 = 0;\n resultado = 0;\n iteracion = 0;\n }", "function schedule(){\n console.log(Date());\n cron.schedule('0 9 * * *', function(){\n knex.select('users.first_name', 'users.phone_number', 'tasks.title', 'tasks.description', 'due_date').from('tasks').leftJoin('users', 'tasks.user_id', 'users.id').where('due_date', new Date().toISOString().slice(0,10)).andWhere('tasks.is_complete', 'false')\n .then(function(data){\n console.log('cron');\n var messages =[];\n for(var i = 0; i < data.length; i++){\n messages.push(sendMessage(data[i].phone_number, data[i].title));\n }\n\n Promise.all(messages).then(function(results){\n console.log(results);\n })\n .catch(function(err){\n console.log(err);\n });\n });\n });\n}", "function EsperaManager(){\n count = parseInt($('#countEspera').val());\n if(count>0){\n startEsperaTime();\n }else{\n stopEsperaTime();\n }\n }", "function enviataxaaula(percent_aula, id_aula, id_projeto) {\n var envio = {}\n envio.id_contato = get_data('geral').id\n envio.id_aula = id_aula\n envio.percentual = percent_aula\n envio.email = get_data('geral').email \n envio.id_projeto = id_projeto \n\n set_tempo_ondemand(envio, (stst) => {\n //console.log('inserido - ' + id_aula + ' - ' + percent_aula + ' - ' + envio.id_contato)\n })\n}", "function resetTimer(){\n\n time = 31;\n }", "function scheduleRestoreDefaults() {\n let d = new Date();\n let currentHour = d.getHours();\n console.log('currentHour = '+currentHour);\n if (currentHour == 3) {\n RestoreDefaultDataInMongoDB()\n .then(() => {\n console.log('RESTORED DEFAULTS 11122');\n }); \n }\n console.log('BEFORE TIMEOUT');\n setTimeout(scheduleRestoreDefaults, 60 * 60 * 1000); // for demo purposes updates every minute\n}", "function job() {\n exec(str)\n schedule.scheduleJob('* */30 * * * *', () => {\n exec(str)\n });\n}", "function startPomoTimer() {\n time = Date.now();\n timerEnd = time + WORK_DURATION;\n setTimeout(refreshPomoTimer, UPDATE_TIMER_EVERY);\n}", "function Ejecutar() {\n\t//Elegimos una imagen\n\tCambiarImagen();\n\t//Iniciamos la transicion cada 3 segundos\n\tsetInterval(CambiarImagen,5000);\n}", "function mainLoop( ) {\n\n\n let segundos = 5;\n let tiempo = segundos * 1000;\n\n\n console.log('Intervalo de '+ segundos );\n console.log('Perioodo: ');\n\n\n REALTIME.actualizarREALTIME( );\n\n setInterval((tiempo) => {\n console.log('-------------------------------------------------------');\n console.log('Intervalo de REALTIME '+ segundos );\n console.log('PERIODO');\n REALTIME.actualizarREALTIME( );\n }, tiempo )\n\n}", "function contadorAtualizacaoThreads(idContadorRemainUnique){\r\n //var segundosFaltando = GM_getValue(\"quikchan_tempo_autoupdate\") - 1;\r\n $(\"#contadorThreads\").html(\"<p><i>Esta página vai se auto atualizar em <span id=\\\"contadorexibitor\\\">\"+parseInt()+\"</span> segundos...</i></p>\");\r\n var segundosFaltando = parseInt($(\"#contadorexibitor\").html());\r\n\r\n if( segundosFaltando == 0){\r\n segundosFaltando = parseInt(GM_getValue(\"quikchan_tempo_autoupdate\"));\r\n }else{\r\n segundosFaltando = segundosFaltando--;\r\n }\r\n $(\"#contadorexibitor\").html(segundosFaltando);\r\n }", "function isJobTobeRescheduled(starttime,ctr){\r\n\t\t\tvar reschedule=false;\r\n\t\t\t// testing only\t\t\t\r\n\t\t\t/*if (ctr >0 && ctr % 25 == 0){\r\n\t\t\t\treschedule=true;\r\n\t\t\t \tlog.audit('isJobTobeRescheduled modulo 25');\r\n\t\t\t}else { */\r\n var runningTime = (new Date().getTime() - starttime);\r\n if (runtime.getCurrentScript().getRemainingUsage() < MIN_USAGE) {\r\n reschedule = true;\r\n log.audit('isJobTobeRescheduled RemainingUsage: ' + runtime.getCurrentScript().getRemainingUsage());\r\n } else if (runningTime > MAXTIME) {\r\n reschedule = true;\r\n log.audit('isJobTobeRescheduled runningTime: ' + runningTime);\r\n }\r\n //}\r\n\t\t\treturn reschedule;\r\n\t\t}", "function mueveReloj() {\n // Antes de iniciar, se debe poner la propiedad: onload=\"mueveReloj()\" en la etiqueta\n // <body> donde se va a poner el reloj\n\n // Como dice la variable, todo lo del momento actual de la fecha\n var momentoActual = new Date();\n\n // Se guarda en las variables la hora y fechas actuales con los metodos de\n // JQuery (Al mes se le suma una, porque empieza desde 0 como un arreglo y se debe mostrar\n // desde el mes número 1)\n // Para la fecha, tiene la estructura de MySQL (Año, mes, día)\n var horaImprimible = momentoActual.getHours() + \":\" + momentoActual.getMinutes() + \":\" + momentoActual.getSeconds();\n var fechaImprimible = momentoActual.getDate() + \"/\" + (momentoActual.getMonth()+1) + \"/\" + momentoActual.getFullYear();\n\n // Imprimo la hora y fecha en los INPUTS\n document.getElementById(\"horaRV\").value = horaImprimible;\n document.getElementById(\"fechaRV\").value = fechaImprimible;\n\n // Vuelvo a llamar este metodo cada segundo repetitivamente\n setTimeout(\"mueveReloj()\", 1000);\n}", "function pollAuctionContractCronJob() {\n // Run CronJob Every Minute\n new Cron.CronJob(\n '* * * * *',\n function () {\n cron.pollAuctionContract();\n },\n null,\n true,\n 'America/Los_Angeles',\n );\n}", "function updateGameSyncro(){\n\t\n\tvar hoy = new Date();\n\tvar day = actualDate.substring(8, 10);\n\tvar month = actualDate.substring(5, 7);\n\tvar year = actualDate.substring(0,4);\n\tvar flagDate = new Date(year,month,day);\n\t\n\t jsCron.finish();\n\t // Removing all children from an element\n\t if((hoy.getMonth() == flagDate.getMonth()) && (hoy.getDate() == flagDate.getDate()) && (stackActivity[indexStackActivity] == \"home\") && flagUpdateGame == false ){\n\t\t var element = document.getElementById(\"idGameTable\");\n\t\t while (element.firstChild) {\n\t\t element.removeChild(element.firstChild);\n\t\t }\n\t\t document.getElementById('date-game').innerHTML= \"\";\n\t\t document.getElementById('load-game').innerHTML = \"<img width='30' height='30' id='loading' alt='Cargando' src='images/loading.gif' />Cargando....\";\n\t\t getGames(flagDate);\n\t\t setTimeout(\"updateGameSyncro()\",updateTimer); //si es necesario\n\t } else {\n\t\t flagUpdateGame = true; \n\t }\n}", "function novoJogo() {\r\n // guarda valores do formulario\r\n var nJogadores = select1.value\r\n var nTabuleiro = select2.value\r\n if(nJogadores==\"\" || nTabuleiro==\"\") {\r\n mesa.innerHTML += \"<h1>Preencha todos os campos do formulário</h1>\"\r\n return\r\n }\r\n // configura pontuacao\r\n pontuacao1 = 0\r\n doisJogadores = false\r\n if (nJogadores == 2) {\r\n pontuacao2 = 0\r\n doisJogadores = true\r\n jogador1.removeAttribute(\"class\")\r\n btnNovo.removeAttribute(\"hidden\")\r\n jogador1.innerHTML = \"<span class='label'>P1</span><span>0</span>\"\r\n jogador2.innerHTML = \"<span class='label'>P2</span><span>0</span>\"\r\n } else {\r\n jogador2.innerHTML = \"\"\r\n btnNovo.setAttribute(\"hidden\",\"true\") // se o jogo recomecar sem terminar, o cronometro fica acelerado\r\n centesimas = 0; segundos = 0; minutos = 0;\r\n jogador1.setAttribute(\"class\",\"cronometro\")\r\n jogador1.innerHTML = \"<span id='minutos'>00</span><span id='segundos'>:00</span><span id='centesimas'>:00</span>\"\r\n control = setInterval(iniciarCronometro,10);\r\n }\r\n // monta html do tabuleiro\r\n configurarTabuleiro(nTabuleiro)\r\n // monta logica do tabuleiro\r\n var nPares = nTabuleiro*nTabuleiro/2\r\n mapearCartas(nPares)\r\n}", "function init() {\n\n// reset();\n lastTime = Date.now();\n main();\n }", "function MascaraPeriodo(data, event){\n if(mascaraInteiro(data)==false){\n event.returnValue = false;\n } \n return formataCampo(data, '00/0000', event);\n}", "function tiendaRefreshCartTotalAmountDue() {\r\n\tvar url = 'index.php?option=com_tienda&view=carts&task=totalAmountDue&format=raw';\r\n\ttiendaDoTask(url, 'totalAmountDue', document.adminForm, '', false, function() {\r\n\t});\r\n\r\n\t//url, container, form, msg, doModal, execFunc\r\n}", "function buscarFechaProximaCalibracion() {\r\n\t\r\n\tvar d = new Date();\r\n let month = String(d.getMonth() + 1);\r\n let day = String(d.getDate());\r\n const year = String(d.getFullYear());\r\n \r\n if (month.length < 2) month = '0' + month;\r\n if (day.length < 2) day = '0' + day;\r\n var anio = year.toString().substring(2);\r\n\r\n var fpcx = `${month}/${day}/${anio}`;\r\n\t\r\n\t $.ajax({\r\n\t url:baseURL + \"pages/VerificarProcesosVencidos/BuscarFechaProxCalibracion\",\r\n\t type:'post',\r\n\t async:false,\r\n\t data:{\r\n\t \tfechaProximaCalibracion: fpcx\r\n\t },\r\n\t beforeSend:muestraLoading,\r\n\t success:function(data){\r\n\t \t\r\n\t ocultaLoading();\r\n\t $.each(data.filas, function( index, value ) {\r\n\t \tvar idEquipo = value.idEquipoCertificado;\r\n\t \t\r\n\t \t//alert(\"EL EQUIPO CON EL ID \"+ idEquipo + \", HOY ES LA FECHA DE PROXIMA CALIBRACION\");\r\n\t \t\r\n\t \t$.ajax({\r\n\t url:baseURL + \"pages/VerificarProcesosVencidos/EditarEstadoEquipoCertificado\",\r\n\t type:'POST',\r\n\t async:false,\r\n\t data:{\r\n\r\n\t \tid: idEquipo,\r\n\t \testado:\t\t\t\t \"I\",\r\n\t \tidTipoMotivo:\t\t \"1491\",\r\n\t \tobservacion:\t\t \"Cambio automatico realizado por el sistema\"\r\n\t },\r\n\t beforeSend:muestraLoading,\r\n\t success:function(data){\r\n\t ocultaLoading();\r\n\t if(data.resultado==\"0\"){ \r\n\t \t$('#MensajeFinalCron1').html(\"EQUIPOS CON PROXIMA FECHA DE CALIBRACION, VERIFICADO CON EXITO...\");\r\n\t }\r\n\t },\r\n\t error:errorAjax\r\n\t \t});\t\r\n\t \t \r\n\t });\r\n\t },\r\n\t error:errorAjax\r\n\t });\r\n}", "restart() {}", "function modeReloj(idde){\n\tvar reloj = document.getElementById(\"cronometro\");\n\tif(idde == \"cronometro\"){\n\t\tcontrarreloj=true;\n\t\treloj.style.backgroundColor=\"#009920\";\n\t}\n}", "function rePPOne() {\n deletePayPeriod(1);\n}", "function conteo1(tiempo){setTimeout(function(){\r\n tiempo-=1;\r\n segundos=tiempo%60;\r\n minutos=(tiempo-(tiempo%60))/60;\r\n if (segundos<10) {\r\n $(\"#timer\").html(\"0\"+minutos+\":0\"+segundos);\r\n }else {\r\n $(\"#timer\").html(\"0\"+minutos+\":\"+segundos);\r\n }\r\n if ($(\"#timer\").html()==\"00:00\") {\r\n fin_del_juego()\r\n return\r\n }\r\n conteo2(tiempo)\r\n },1000);\r\n }", "function cronValidate(cronExpression) {\n if (!cronExpression) {\n return false;\n } // alert(\"校验函数的开始!\");\n\n\n let cronParams = cronExpression.split(' ');\n\n if (cronParams.length < 6 || cronParams.length > 7) {\n return false;\n } // CronTrigger cronTrigger = new CronTrigger();\n // cronTrigger.setCronExpression( cronExpression );\n\n\n if (cronParams[3] == '?' || cronParams[5] == '?') {\n // Check seconds param\n if (!checkSecondsField(cronParams[0])) {\n return false;\n } // Check minutes param\n\n\n if (!checkMinutesField(cronParams[1])) {\n return false;\n } // Check hours param\n\n\n if (!checkHoursField(cronParams[2])) {\n return false;\n } // Check day-of-month param\n\n\n if (!checkDayOfMonthField(cronParams[3])) {\n return false;\n } // Check months param\n\n\n if (!checkMonthsField(cronParams[4])) {\n return false;\n } // Check day-of-week param\n\n\n if (!checkDayOfWeekField(cronParams[5])) {\n return false;\n } // Check year param\n\n\n if (cronParams.length == 7) {\n if (!checkYearField(cronParams[6])) {\n return false;\n }\n }\n\n return true;\n }\n return false;\n\n}", "timeDue(timerModifier = null) {\n let seconds;\n if (timerModifier)\n seconds = timerModifier / 1000;\n else {\n if (this.duration) {\n //seconds = toSeconds((parse(this.duration)));\n seconds = Cron_1.Cron.timeDue(this.duration, null);\n }\n else if (this.timeCycle) {\n //seconds = toSeconds((parse(this.timeCycle)));\n seconds = Cron_1.Cron.timeDue(this.duration, null);\n }\n }\n let timeDue = new Date().getTime() / 1000;\n timeDue += seconds;\n return timeDue;\n }", "Restart() {\n\n }", "function calculadora(){\n\n // Conjunto de instrucciones a ejecutar\n console.log(\"Hola, soy la calculadora\" ) ;\n console.log(\"si soy yo\");\n console.log(\"cuantas veces quieras\")\n\n return \"Hola soy la programadora\"\n \n}", "function NoAlertJob(name, schedule, jobFn) {\n\t\tif (typeof (schedule) !== \"object\") throw new Error(\"[NoAlarmTask] `schedule` is a required parameter\");\n\n\n\t\t/**\n\t\t * ### properties\n\t\t *\n\t\t * Contructor function exported by no-cron-task.js. Creates an object that represents a task that is scheduled to run at regular intervals(as opposed to a specific day/time).\n\t\t *\n\t\t * **Parameters**\n\t\t *\n\t\t * |Name|Type|Description|\n\t\t * |----|----|-----------|\n\t\t * |obj|Object|the object whose properties will be copied|\n\t\t *\n\t\t * **Returns**\n\t\t * Type: Object\n\t\t *\n\t\t * Returns an object with the same properties and values as the object passed in as a parameter\n\t\t *\n\t\t */\n\t\tfunction properties(obj) {\n\t\t\tvar out = {};\n\t\t\tObject.keys(obj).forEach(function (k) {\n\t\t\t\tout[k] = obj[k];\n\t\t\t});\n\n\t\t\treturn out;\n\t\t}\n\n\n\t\t/**\n\t\t * ### reset\n\t\t *\n\t\t * resets the NoCronJob's properties to defaults, creates them and sets their values to default if they don't already exist.\n\t\t *\n\t\t * **Parameters**\n\t\t * None\n\t\t *\n\t\t * **Returns**\n\t\t * None\n\t\t */\n\t\tthis.reset = function () {\n\t\t\tthis.promise = null;\n\t\t\tthis.skipped = true;\n\t\t\tthis.message = \"\";\n\n\t\t\tthis._name = name;\n\t\t\tthis._schedule = schedule;\n\t\t\tthis._jobFn = jobFn;\n\t\t\tthis._duration = moment.duration(schedule.duration, schedule.unit);\n\t\t\tthis._durationMilliseconds = this._duration.asMilliseconds();\n\t\t\tthis._lastRun = null;\n\t\t\tthis._running = false;\n\t\t}\n\n\n\t\tthis.reset();\n\n\n\t\t/**\n\t\t * ### run\n\t\t *\n\t\t * called by the task runner on each 'tick' - checks if it is time for this task to be run yet, if so it executes the jobFn. if not(or if it is a parallel task),\n\t\t * it sets skipped to true.\n\t\t *\n\t\t * **Parameters**\n\t\t * None\n\t\t *\n\t\t * **Returns**\n\t\t * None\n\t\t */\n\t\tthis.run = function () {\n\t\t\tvar _now = moment(),\n\t\t\t\t_target = moment(\"2017-01-01 \" + schedule.time),\n\t\t\t\t// Note: _lastRun can be a future date, e.g. when the user adjusted the clock of the device.\n\t\t\t\t_margin = (this._lastRun && this._lastRun < _now) ? _now - moment(this._lastRun) : 0,\n\t\t\t\t//_margin = _now - (this._lastRun ? moment(this._lastRun) : moment()),\n\t\t\t\t_isWeekday = schedule.weekday ? _now.format(\"dddd\").toLowerCase() === schedule.weekday.toLowerCase() : true,\n\t\t\t\t_alarm = _now.hour() === _target.hour() && _now.minute() === _target.minute() && _isWeekday;\n\n\t\t\tif (Math.abs(_margin) < 999) _margin = 0;\n\n\t\t\t//if (_alarm) console.log(\"Alarm Check: last run %s target %s margin: %s isAlarm: %s isRunning: %s\", this._lastRun, _target.toString(), _margin, _alarm, this._running);\n\n\t\t\tif (_alarm && !this._running && (_margin === 0 || _margin > 60000)) {\n\t\t\t\tthis.message = \"[NoAlarmTask] Starting \" + this._name + \", last run \" + (this._lastRun ? moment(this._lastRun).toString() : \"never\");\n\t\t\t\tconsole.log(_margin, _now, this._running, this.message);\n\n\t\t\t\tvar r = this._jobFn();\n\t\t\t\tthis._running = true;\n\n\t\t\t\tif (r && r.then) {\n\t\t\t\t\tthis.promise = r.then(function () {\n\t\t\t\t\t\t\tthis._lastRun = moment(new Date()); //move this to after successful run.\n\t\t\t\t\t\t\tthis._running = false;\n\t\t\t\t\t\t\tconsole.log(\"[NoAlarmTask] Ran %s %s\", this._name, this._lastRun.toString());\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t\t.catch(function (err) {\n\t\t\t\t\t\t\tthis._running = false;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}.bind(this));\n\n\t\t\t\t\tthis._skipped = !!this._schedule.parallel;\n\t\t\t\t} else {\n\t\t\t\t\tthis.promise = null;\n\t\t\t\t\tthis.skipped = true;\n\t\t\t\t\tthis.message = '[NoAlarmTask] ' + this._name + \" not run\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.promise = null;\n\t\t\t\tthis.skipped = true;\n\t\t\t}\n\n\t\t\t//return properties(this);\n\n\t\t}\n\t}" ]
[ "0.7165427", "0.6921866", "0.69150525", "0.68493015", "0.663943", "0.640949", "0.6209638", "0.6057614", "0.59472287", "0.5833526", "0.57887197", "0.57860214", "0.57778484", "0.5658321", "0.5643356", "0.5616707", "0.56120735", "0.56055814", "0.5596092", "0.55855334", "0.55804896", "0.5577121", "0.55607235", "0.5536563", "0.5536383", "0.553178", "0.55313987", "0.55256784", "0.55229527", "0.5515851", "0.54591763", "0.54172647", "0.5400394", "0.5400074", "0.53778374", "0.5350596", "0.5334688", "0.5329963", "0.5313641", "0.5303871", "0.52866817", "0.5286507", "0.5282193", "0.52817726", "0.52756256", "0.52756256", "0.5255626", "0.5217986", "0.52177656", "0.5216824", "0.5216824", "0.5191543", "0.5179022", "0.5175461", "0.51676625", "0.5165512", "0.5165157", "0.51624215", "0.51587725", "0.515388", "0.51513034", "0.51446116", "0.5141502", "0.5135553", "0.51305014", "0.512408", "0.51169884", "0.51149976", "0.51079196", "0.5104511", "0.51028097", "0.5100939", "0.5093974", "0.508731", "0.5077675", "0.5075441", "0.5048109", "0.50439286", "0.5035348", "0.5026489", "0.5018591", "0.5005158", "0.49972945", "0.49933103", "0.49927896", "0.4992698", "0.4991269", "0.4989247", "0.49674866", "0.4958151", "0.4956266", "0.4954036", "0.4953843", "0.49504152", "0.49489295", "0.4945246", "0.49391532", "0.49350506", "0.49267146", "0.49256757" ]
0.49681208
88
toggles menu style from none to block and vice versa
function toggleMenu() { var menu = document.getElementById('menu'); if (menu) { if (menu.style.display === "none") { menu.style.display = "block"; } else { menu.style.display = "none"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function menuToggle() {\n var s_options = DOM.options.style;\n var s_obutton = DOM.optionsButton.style;\n var s_content = DOM.container.style;\n\n if (s_options.display == \"\" || s_options.display == \"none\") {\n s_obutton.background = \"#1D8EC2\";\n s_options.display = \"block\";\n s_content.display = \"none\";\n } else {\n s_obutton.background = \"inherit\";\n s_options.display = \"none\";\n s_content.display = \"block\";\n }\n}", "function switchMenu() {\n let menu = document.getElementById(\"menu\");\n\n if (menu.style.display === \"block\")\n {\n showSide();\n menu.style.display = \"none\";\n }\n else\n {\n hideSide();\n menu.style.display = \"block\";\n }\n}", "menuToggle(event) {\n var navItem = document.getElementsByTagName('nav')[0];\n if ('block' === navItem.style.display) {\n navItem.style.display = 'none';\n } else {\n navItem.style.display = 'block';\n navItem.className = navItem.className + ' menuhidden';\n }\n\n }", "function toggleMenuOff() {\n if ( menuState !== 0 ) {\n menuState = 0;\n menu.classList.remove( contextMenuActive );\n }\n }", "function togglemenu(){\n this.isopen = !this.isopen;\n }", "function toggleMenu() {\n if(!showmenu) {\n menubtn.classList.add('close');\n menu.classList.add('show');\n menunav.classList.add('show');\n menuitem.forEach(item => item.classList.add('show'));\n \n //set menu state\n showmenu = true;\n\n } else {\n menubtn.classList.remove('close');\n menu.classList.remove('show');\n menunav.classList.remove('show');\n menuitem.forEach(item => item.classList.remove('show'));\n \n //set menu state\n showmenu = false;\n \n }\n}", "function menuStuff() {\n if (toggle === 1) {\n menu.css('display', 'table');\n setTimeout(function() {\n // menu.css('opacity', 1);\n menu.stop().animate({opacity: 1}, 200);\n // menuLi.css('left', '0');\n menuLi.stop().animate({left: 0}, 200);\n toggle = 0;\n }, 100);\n }\n if (toggle === 0) {\n // menu.css('opacity', 0);\n menu.stop().animate({opacity: 0}, 200);\n // menuLi.css('left', '-40px');\n menuLi.stop().animate({left: '-40px'}, 200);\n setTimeout(function() {\n menu.css('display', 'none');\n }, 600);\n toggle = 1;\n }\n }", "function toggleMenu(){\n var state = document.getElementById('menu');\n if(state.classList.contains('visible'))\n {\n state.classList.remove('visible')\n state.style.opacity=0;\n state.style.transform='translateY(-20px)';\n setTimeout(function(){state.style.display='none';},\n 400);\n }\n else\n {\n \n state.style.display='flex';\n setTimeout(function(){\n state.style.opacity='1';\n state.style.transform='translateY(0px)';\n state.classList.add('visible');\n },\n 100);\n \n\n }\n\n \n }", "toggleMenu(evt) {\n evt.preventDefault()\n this.setState(st => ({\n display: !st.display,\n }))\n }", "function toogleAsideMenu(state) {\n\t\t\tstate = (state === undefined) ? 'toggle' : state;\n\t\t\tif (state === 'toggle') {\n\t\t\t\tstate = !header.states.showAsidemenu;\n\t\t\t}\n\t\t\theader.states.showAsidemenu = state;\n\t\t}", "function toggleMenuOff() {\n \n if (menuState !== 0) {\n menuState = 0;\n menu.classList.remove(contextMenuActive);\n }\n }", "function onClickMenu() {\n document.getElementById(\"menu\").classList.toggle(\"change\");\n \n document.getElementById(\"nav\").classList.toggle(\"change\");\n \n document.getElementById(\"menu-bg\").classList.toggle(\"change-bg\");\n }", "function menu_standard() {\n\t$('#menu').removeClass('menu_reverse');\n\t$('.ico_home').removeClass('ico_home_reverse');\n\t$('.menu_child:not(.ico_home)').css('visibility', 'visible');\n}", "function onClickMenu(){\n\tdocument.getElementById(\"menu\").classList.toggle(\"change\");\n\tdocument.getElementById(\"nav\").classList.toggle(\"change\");\n\tdocument.getElementById(\"menu-bg\").classList.toggle(\"change-bg\");\n}", "function toggle()\n {\n menuBtn.classList.toggle(\"open\");\n menuItems.classList.toggle(\"open\");\n }", "function toggleMenu(menu) {\n menu.toggleClass('show');\n}", "function menu() {\n if (myLinks.style.display === \"flex\") {\n myLinks.style.display = \"none\";\n } else {\n myLinks.style.display = \"flex\";\n } \n}", "function toggleMenu(){\n //e.preventDefault;//fixes safari ios bug\n document.querySelector('.leveltwo').classList.toggle('fold');\n //document.querySelector('.boxMinus').style.visibility = 'visible';\n document.querySelector('.boxMinus').classList.toggle('boxHide');\n document.querySelector('.boxPlus').classList.toggle('boxHide');\n }", "function my_toggle_menudropdown(){\n\n $('.js-toggle-menu-dropdown').off();\n $('.js-toggle-menu-dropdown').click(function(){\n $('.js-menu-dropdown').toggleClass('is-active');\n $('.js-header').toggleClass('is-active');\n });\n\n }", "function toggle() {\n const state = isActiveMenuState();\n const burgerMenuMarketingImage = document.querySelector('.js-burger-menu-marketing-widget__img');\n\n initLayeredMenuState();\n\n if (state) { // closing the menu\n switchClass(document.body, 'nav-is-closed-body', 'nav-is-open-body');\n switchClass(getContentWrapper(), 'nav-is-closed', 'nav-is-open');\n switchClass(getCurtain(), 'nav-is-closed-curtain', 'nav-is-open-curtain');\n switchClass(getButton(), INACTIVE_STATE_CLASS, ACTIVE_STATE_CLASS);\n } else { // opening the menu\n switchClass(document.body, 'nav-is-open-body', 'nav-is-closed-body');\n switchClass(getContentWrapper(), 'nav-is-open', 'nav-is-closed');\n switchClass(getCurtain(), 'nav-is-open-curtain', 'nav-is-closed-curtain');\n switchClass(getButton(), ACTIVE_STATE_CLASS, INACTIVE_STATE_CLASS);\n\n // lazyload the image for the burger-menu-marketing widget\n if (burgerMenuMarketingImage) {\n lazyLoading.lazyLoadImage(burgerMenuMarketingImage);\n }\n }\n\n triggerMenuStateEvent(state);\n}", "function toggleMenu() {\n document.querySelector('.main-nav').classList.toggle('display-menu');\n document.querySelector('.screen').toggleAttribute('hidden');\n}", "function toggleMenuOn() {\n if (menuState !== 1) {\n menuState = 1;\n menu.classList.add(contextMenuActive);\n }\n}", "function turnOffMenus() {\r\n\tif (edit_menu_visible) toggleMenu('edit-menu');\r\n\tif (element_menu_visible) toggleMenu('element-menu');\r\n\tif (pen_menu_visible) toggleMenu('pen-menu');\r\n\tif (shape_menu_visible) toggleMenu('shape-menu');\r\n\tif (text_menu_visible) toggleMenu('text-menu');\r\n\tif (profile_visible) toggleProfile();\r\n}", "function showMenu() {\n scope.menu = !scope.menu;\n $document.find('body').toggleClass('em-is-disabled-small', scope.menu);\n }", "function menuOpener() {\n let button = document.querySelector('.menu--action')\n if (button.style.display == 'flex') {\n button.style.display = 'none'\n } else {\n button.style.display = 'flex'\n }\n}", "function switchSideMenu() {\n\n var sideMenu = document.querySelector(\".side-menu\");\n\n if (sideMenu.style.display == \"block\") {\n\n sideMenu.style.display = \"none\";\n\n } else {\n\n sideMenu.style.display = \"block\";\n }\n}", "function toggleMobileMenu() {\n if (mobileMenuVisible) {\n //close menu\n nav.style.removeProperty(\"top\");\n burgerMenuSpan.forEach(span => {\n span.style.removeProperty(\"background\");\n });\n } else {\n //open menu\n nav.style.top = \"0px\";\n burgerMenuSpan.forEach(span => {\n span.style.background = \"#e9e9e9\";\n });\n }\n mobileMenuVisible = !mobileMenuVisible;\n}", "function menuHide() {\n ui.languageContainer.removeClass('open');\n ui.appbarElement.removeClass('open');\n ui.mainMenuContainer.removeClass('open');\n ui.darkbgElement.removeClass('open');\n}", "function toggleMenuOn() {\n if ( menuState !== 1 ) {\n menuState = 1;\n menu.classList.add( contextMenuActive );\n }\n }", "function menuToggle() {\r\n if(maxHeight === \"0px\") {\r\n setMaxHeight(\"200px\");\r\n } else {\r\n setMaxHeight(\"0px\");\r\n }\r\n }", "function toggleMenu() {\n var x = document.getElementById(\"nav-list\");\n console.log(\"style is \" + x.style.display);\n if (x.className == \"nav-list\") {\n x.className += \" toggle\";\n } else {\n x.className = \"nav-list\";\n }\n}", "function menu() {\n html.classList.toggle('menu-active');\n }", "function toggleMenu() {\n open = !open;\n let bars = this.children[0];\n if(open) {\n bars.style.color = '#ffffff';\n selectors.sideMenu.style.left = 0;\n } else {\n bars.style.color = '#000000';\n selectors.sideMenu.style.left = -400 + 'px';\n }\n}", "toggleMenuList(state) {\n this.setState({\n isMenuOpened: state || !this.state.isMenuOpened\n });\n\n if (!this.state.isMenuOpened) {\n this.menu.style.display = 'block';\n } else {\n this.menu.style.display = 'none';\n }\n }", "function showHideMenu() {\n if (nav.style.display === \"none\") {\n nav.style.display = \"block\";\n menuBtn.style.transform = \"rotate(45deg)\";\n menuBtn.style.backgroundColor = \"midnightblue\";\n menuBtnIcon.style.transform = \"scale(1.5)\";\n } else {\n hideMenu();\n }\n}", "function toggleMenu(event) {\n event.preventDefault();\n menu.classList.toggle('is-active');\n menu1.classList.toggle('is_active');\n}", "function myFunction() {\n\t document.getElementById(\"menu\").classList.toggle(\"show\");\n\t}", "function menuClick() {\r\n if (a == false) {\r\n document.getElementById(\"menu-container\").style.display = \"initial\";\r\n a = true;\r\n document.getElementById(\"body\").style.position = \"fixed\";\r\n } else {\r\n document.getElementById(\"menu-container\").style.display = \"none\";\r\n a = false;\r\n document.getElementById(\"body\").style.position = \"initial\";\r\n }\r\n}", "_toggleMenu() {\n const { isMenuVisible, isConciergeVisible } = this.state;\n const newIsMenuVisible = !isMenuVisible;\n const newIsConciergeVisible = newIsMenuVisible ? false : isConciergeVisible;\n this.setState({\n isMenuVisible: newIsMenuVisible,\n isConciergeVisible: newIsConciergeVisible,\n });\n }", "function toggleMenu(e) {\n if (menu.classList.contains('show')) {\n menu.classList.remove('show')\n } else {\n menu.classList.add('show')\n }\n}", "function toggleMenu() {\n if(!showMenu){\n // Add relevant classes to each of the components\n menuBtn.classList.add('close');\n menu.classList.add('show');\n menuPortrait.classList.add('show');\n menuList.classList.add('show');\n menuItems.forEach(item => item.classList.add('show'));\n // Set state of the Menu\n showMenu = true;\n\n } else{\n menuBtn.classList.remove('close');\n menu.classList.remove('show');\n menuPortrait.classList.remove('show');\n menuList.classList.remove('show');\n menuItems.forEach(item => item.classList.remove('show'));\n // Set the state of the Menu\n showMenu = false;\n }\n \n}", "function toggleMenu(menuToToggle) {\r\n\t/* If turning off the edit menu, turn off all other menus */\r\n\tif (menuToToggle == 'edit-menu') {\r\n\t\tif (edit_menu_visible) {\r\n\t\t\tif (pen_menu_visible) toggleMenu('pen-menu');\r\n\t\t\tif (shape_menu_visible) toggleMenu('shape-menu');\r\n\t\t\tif (element_menu_visible) toggleMenu('element-menu');\r\n\t\t\tif (text_menu_visible) toggleMenu('text-menu');\r\n\t\t}\r\n\t\tedit_menu_visible = !edit_menu_visible;\r\n\t\tfor (var item in edit_menu) {\r\n\t\t\t$(\"#\" + edit_menu[item]).fadeToggle();\r\n\t\t\tif (edit_menu_visible)\r\n\t\t\t\tdocument.getElementById(edit_menu[item]).style.display = \"flex\";\r\n\t\t}\r\n\t\tif (edit_menu_visible) {\r\n\t\t\t$(\"#edit-root\").css(\"display\", \"none\");\r\n\t\t\t$(\"#return\").css(\"display\", \"inline-block\");\r\n\t\t} else {\r\n\t\t\t$(\"#edit-root\").css(\"display\", \"inline-block\");\r\n\t\t\t$(\"#return\").css(\"display\", \"none\");\r\n\t\t}\r\n\t}\r\n\t/* If turning on the element menu, turn off pen, shape and text menus */\r\n\telse if(menuToToggle == 'element-menu') {\r\n\t\tif (!element_menu_visible) {\r\n\t\t\tif (pen_menu_visible) toggleMenu('pen-menu');\r\n\t\t\tif (shape_menu_visible) toggleMenu('shape-menu');\r\n\t\t\tif (text_menu_visible) toggleMenu('text-menu');\r\n\t\t}\r\n\t\telement_menu_visible = !element_menu_visible;\r\n\t\tfor (var item in element_menu) {\r\n\t\t\t$(\"#\" + element_menu[item]).fadeToggle();\r\n\t\t\tif (element_menu_visible)\r\n\t\t\t\tdocument.getElementById(element_menu[item]).style.display = \"flex\";\r\n\t\t}\r\n\t}\r\n\t/* If turning on the shape menu, turn off pen, element, and text menus */\r\n\telse if(menuToToggle == 'shape-menu') {\r\n\t\tif (!shape_menu_visible) {\r\n\t\t\tif (pen_menu_visible) toggleMenu('pen-menu');\r\n\t\t\tif (element_menu_visible) toggleMenu('element-menu');\r\n\t\t\tif (text_menu_visible) toggleMenu('text-menu');\r\n\t\t}\r\n\t\tshape_menu_visible = !shape_menu_visible;\r\n\t\tfor (var item in shape_menu) {\r\n\t\t\t$(\"#\" + shape_menu[item]).fadeToggle();\r\n\t\t\tif (shape_menu_visible)\r\n\t\t\t\tdocument.getElementById(shape_menu[item]).style.display = \"flex\";\r\n\t\t}\r\n\t}\r\n\t/* If turning on the text menu, turn off pen, shape, and element menus */\r\n\telse if(menuToToggle == 'text-menu') {\r\n\t\tif (!text_menu_visible) {\r\n\t\t\tif (pen_menu_visible) toggleMenu('pen-menu');\r\n\t\t\tif (shape_menu_visible) toggleMenu('shape-menu');\r\n\t\t\tif (element_menu_visible) toggleMenu('element-menu');\r\n\t\t}\r\n\t\ttext_menu_visible = !text_menu_visible;\r\n\t\tfor (var item in text_menu) {\r\n\t\t\t$(\"#\" + text_menu[item]).fadeToggle();\r\n\t\t\tif (text_menu_visible)\r\n\t\t\t\tdocument.getElementById(text_menu[item]).style.display = \"flex\";\r\n\t\t}\r\n\t}\r\n\t/* If turning on the pen menu, turn off element, shape, and text menus */\r\n\telse if(menuToToggle == 'pen-menu') {\r\n\t\tif (!pen_menu_visible) {\r\n\t\t\tif (element_menu_visible) toggleMenu('element-menu');\r\n\t\t\tif (shape_menu_visible) toggleMenu('shape-menu');\r\n\t\t\tif (text_menu_visible) toggleMenu('text-menu');\r\n\t\t}\r\n\t\tpen_menu_visible = !pen_menu_visible;\r\n\t\tfor (var item in pen_menu) {\r\n\t\t\t$(\"#\" + pen_menu[item]).fadeToggle();\r\n\t\t\tif (pen_menu_visible)\r\n\t\t\t\tdocument.getElementById(pen_menu[item]).style.display = \"flex\";\r\n\t\t}\r\n\t}\r\n}", "function toggleMenu(e) {\n e.preventDefault();\n $mainNav.slideToggle(function (){\n if ($mainNav.is(':hidden')) {\n $mainNav.removeAttr('style');\n }\n });\n $menuToggle.toggleClass('open');\n }", "function showNav() {\n \n if (this.wasClicked == false) {\n menuStyle.setAttribute(\"class\", \"responsive-style\");\n this.wasClicked = true;\n } else if (this.wasClicked == true) {\n menuStyle.removeAttribute(\"class\", \"responsive-style\");\n this.wasClicked = false;\n } \n}", "function toggleMenuOn() {\n if (menuState !== 1) {\n menuState = 1;\n menu.classList.add(contextMenuActive);\n }\n }", "function toggleSiteMenu() {\n if (document.getElementById('site_menu').style.display == 'flex') {\n document.getElementById('site_menu').style.display = 'none';\n } else {\n document.getElementById('site_menu').style.display = 'flex';\n }\n}", "function togglemenu(){\r\n\t\tvar menuToggle = document.querySelector('.toggle');\r\n\t\tvar menu = document.querySelector('.menu');\r\n\t\tmenuToggle.classList.toggle('active');\r\n\t\tmenu.classList.toggle('active');\r\n\t}", "function toggleMenu() {\n menuNav.classList.toggle('menu-toggle');\n }", "function toggleMenu() {\n\t// checks if menu is open or close\n\tif(!showMenu) { \n\t\t// adds close class to menu button and open clase to menu navigation\n\t\tmenuBtn.classList.add('close');\n\t\tmainNav.classList.add('open');\n\t\tmenuList.classList.add('open');\n\n\t\t// sets new menu state to be opened\n\t\tshowMenu = true;\n\t} else {\n\t\t// removes close class from menu button and open class from menu naigation\n\t\tmenuBtn.classList.remove('close');\n\t\tmainNav.classList.remove('open');\n\t\tmenuList.classList.remove('open');\n\n\t\t// sets menu state to be closed\n showMenu = false;\n }\n}", "function toggleMenu(menu) {\n\tmenu.classList.toggle(\"active\");\n}", "function menu() {\n if (nav.className === 'navigation') {\n toggle.style.transform = 'rotateZ(0deg)';\n // nav.style.display = 'none';\n nav.className = '';\n } else {\n toggle.style.transform = 'rotateZ(180deg)';\n // nav.style.display = 'block';\n nav.className = 'navigation';\n }\n \n}", "static toggleMenu() {\n var win = $(\"#window\")[0];\n\n if (win.classList.contains(MENU_ACTIVE)) {\n this.menuOff();\n }\n else {\n this.menuOn();\n }\n }", "function toggle(currentMenu) {\r\n if (currentMenu == \"menuHighlight\") {\r\n var checkIt = document.getElementById(currentMenu);\r\n if (checkIt) { var displayVal = document.getElementById(currentMenu).parentNode;\r\n } else { return false; };\r\n } else {\r\n var displayVal = document.getElementById(currentMenu);\r\n }\r\n if (displayVal.style.display == \"block\") { \r\n displayVal.style.display = \"none\"; \r\n var linkTitle = displayVal.parentNode.getElementsByTagName(\"a\")[0].title;\r\n displayVal.parentNode.getElementsByTagName(\"a\")[0].title = 'Expand ' + linkTitle.substring(linkTitle.indexOf(\" \")+1);\r\n displayVal.parentNode.getElementsByTagName(\"img\")[0].src = '/gifjpg/menu_closed.gif';\r\n displayVal.parentNode.getElementsByTagName(\"img\")[0].alt = 'Expand ' + linkTitle.substring(linkTitle.indexOf(\" \")+1);\r\n } else { \r\n displayVal.style.display = \"block\";\r\n var linkTitle = displayVal.parentNode.getElementsByTagName(\"a\")[0].title;\r\n displayVal.parentNode.getElementsByTagName(\"a\")[0].title = 'Collapse ' + linkTitle.substring(linkTitle.indexOf(\" \")+1);\r\n displayVal.parentNode.getElementsByTagName(\"img\")[0].src = '/gifjpg/menu_open.gif';\r\n displayVal.parentNode.getElementsByTagName(\"img\")[0].alt = 'Collapse ' + linkTitle.substring(linkTitle.indexOf(\" \")+1);\r\n }\r\n}", "function toggleMenu() {\n if (nav.classList.contains(\"show-menu\")) {\n nav.classList.remove(\"show-menu\")\n } else {\n nav.classList.add(\"show-menu\")\n }\n}", "function showMenu() {\n if (navList.style.display != \"\") {\n navList.style.display = \"\"; \n } else if (navList.style.display === \"\") {\n navList.style.display = \"block\"; \n } \n}", "function hamburgerMenuFunc() {\n var menu = document.getElementById(\"myLinks\");\n if (menu.style.display === \"block\") {\n menu.style.display = \"none\";\n } else {\n menu.style.display = \"block\";\n }\n} // end hamburgerMenuFunc", "toggleMenu(){\n this.setState({\n visibleMenu: !this.state.visibleMenu\n });\n }", "toggleMenuVisibility() {\n if (!this.disabled) {\n this.popoverVisible = !this.popoverVisible;\n\n if (this.popoverVisible) {\n this._boundingRect = this.getBoundingClientRect();\n this.pollBoundingRect();\n }\n\n this.classList.toggle('slds-is-open');\n }\n }", "function toggleMenu() {\n if (!showMenu) { // show the 'close' class if menu btn is in display or show the menu for other classes\n menuBtn.classList.add('close'); // add a close class to the class list\n menu.classList.add('show'); // show the class\n menuNav.classList.add('show');\n menuBranding.classList.add('show');\n // we need to loop thru the list items for navItems\n navItems.forEach(item => item.classList.add('show'));\n\n // set menu state to true as it should be open by now\n showMenu = true;\n } else {\n // do the opposite if the menu is shown\n menuBtn.classList.remove('close'); // add a close class to the class list\n menu.classList.remove('show'); // show the class\n menuNav.classList.remove('show');\n menuBranding.classList.remove('show');\n // we need to loop thru the list items for navItems\n navItems.forEach(item => item.classList.remove('show'));\n\n // set menu state to true as it should be open by now\n showMenu = false;\n\n }\n\n}", "function hideMenu()\n{\n\t\t\n\t\t//set a timeout and then kill all the menu's\n\t\t//we will check in menuHandler() to see if some stay lit.\n\t\tmenuTimeout= setTimeout(\"killMenu('all');\",800);\n\t\t\n\t\tflagMenuSwitch=\"off\";\n\t\t\n}//end hideMenu() function", "function toggleSiteMenu ( )\r\n{\r\n\tif ($('#menuControl').hasClass('menuVisible'))\r\n\t{\r\n\t\t$('#menuControl').removeClass('menuVisible');\r\n\t\t$('#siteMenu').css('display','none');\r\n\t\tviewContainer.onResize();\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$('#menuControl').addClass('menuVisible');\r\n\t\t$('#siteMenu').css('display','block');\r\n\t\tviewContainer.onResize();\r\n\t}\r\n}", "function menu(){\n menuNav.classList.toggle(\"show\");\n\n}", "function toggleMenu() {\n\t\t$('.header__burger').toggleClass('active');\n\t\t$('.header__menu').toggleClass('active');\n\t\t$('body').toggleClass('lock');\n\t}", "function hideMenu(){\n file_menu.style.display = \"none\"\n menuActive = false\n}", "function toggleMenu(){\n var isDisplay = $j('.menu').css('display');\n\n if (isDisplay == 'none'){\n $j('.menu').show(500);\n }else if (isDisplay == 'block'){\n $j('.menu').hide(500);\n }\n\n if ($j(window).width() <= 720) {\n $j('nav').width($j('header').width());\n } else {\n $j('nav').css('width','');\n }\n}", "function mobileMenu()\n{\n var menu = document.getElementById(\"mobile_nav\");\n if (menu.style.display == \"block\")\n {\n menu.style.display = \"none\";\n }\n else\n {\n menu.style.display = \"block\";\n }\n}", "function toggleMenu(){\n liensMenu.classList.toggle('visible');\n blcIcon.classList.toggle(\"active\");\n}", "function toggleMenu() {\n\tif (document.getElementsByClassName(\"animated\")[0].classList.contains('show'))\n hideMenu();\n else\n showMenu();\n}", "function toggleMenu() {\r\n //console.log('menu clicked');\r\n if ($menuList.hasClass('menu-active')) {\r\n $menuList.removeClass('menu-active');\r\n $areaCloseMenu.removeClass('menu-active');\r\n $buttonOpenMenu.removeClass('menu-not-active');\r\n $buttonCloseMenu.removeClass('menu-active');\r\n } else {\r\n $menuList.addClass('menu-active');\r\n $areaCloseMenu.addClass('menu-active');\r\n $buttonOpenMenu.addClass('menu-not-active');\r\n $buttonCloseMenu.addClass('menu-active');\r\n }\r\n}", "function mobileMenu() {\n var x = document.getElementById(\"myLinks\");\n if (x.style.display === \"block\") {\n x.style.display = \"none\";\n } else {\n x.style.display = \"block\";\n }\n }", "function open_close_menu(){\r\n body.classList.toggle(\"body_move\")\r\n side_menu.classList.toggle(\"menu_side_move\")\r\n}", "function openMenu() {\n vm.showMenu=!vm.showMenu;\n }", "function mainMenuSwitch(toState) {\r\n if (toState == \"hide\") {\r\n if (!$.browser.msie)\r\n $(\"#mainBigMenu ul, #loginBox:visible\").fadeTo(1000, 0.3); \r\n\r\n\r\n $(\"#mainBigMenu a, #loginBox:visible a\").each(function(){\r\n $(this).click(function(){return false;});\r\n $(this).css(\"cursor\", \"default\");\r\n });\r\n \r\n } else {\r\n \t\r\n if (!$.browser.msie6)\r\n $(\"#mainBigMenu ul, #loginBox:visible\").fadeTo(1000, 1.0); \r\n\r\n $(\"#mainBigMenu a, #loginBox:visible a\").each(function(){\r\n $(this).unbind(\"click\");\r\n $(this).css(\"cursor\", \"\");\r\n \r\n }); \r\n \r\n }\r\n}", "function toggleClamShellMenu(objectID) {\n\tif (isAll || isID) {\n\t\tdomStyle = findDOM(objectID,1);\n\t\ti=1\n\t\twhile (i<=2) { //change depending on number of submenus\n\t\t\tobjectReset = \"menu\"+i;\n\t\t\tdomStyleReset = findDOM(objectReset,1);\n\t\t\tdomStyleReset.display = 'none';\n\t\t\ti+=1;\n\t\t}\n\t\tif (domStyle.display =='block') domStyle.display='none';\n\t\telse domStyle.display='block';\n\t}\n\telse {\n\t\tdestination = objectID + '.html';\n\t\tself.location = destination;\n\t}\n\treturn;\n}", "function toggleHamMenu(){\n let navMenu = document.querySelector(\".header-bottom\")\n if(menuState===0 &&(getComputedStyle(navMenu).display===\"none\")){// if menu is closed -> open\n menuState = 1;\n navMenu.style.display = \"block\";\n }\n else {// if menu open -> close\n menuState = 0;\n navMenu.style.display = \"none\";\n }\n}", "function toggleMenu(x) {\r\n x.classList.toggle(\"change\");\r\n //if change class is present, show nav-item\r\n if(menu.className === \"menu change\") {\r\n for(let i=0; i<navItem.length; i+=1) {\r\n navItem[i].style.display = \"block\";\r\n mainHeader.style.height = \"46%\";\r\n box.style.marginTop = \"0\";\r\n }\r\n } else { //if not, return to initial by calling checkQuery\r\n checkQuery(query768);\r\n }\r\n\r\n}", "function toggleMenu() {\n if (!showMenu) {\n menuBtn.classList.add(\"close\"); // this adds a class value\n menu.classList.add(\"show\");\n menuBranding.classList.add(\"show\");\n menuNav.classList.add(\"show\");\n navItems.forEach(navItem => navItem.classList.add(\"show\"));\n showMenu = true;\n } else {\n menuBtn.classList.remove(\"close\"); // this removes a class value\n menu.classList.remove(\"show\");\n menuBranding.classList.remove(\"show\");\n menuNav.classList.remove(\"show\");\n navItems.forEach(navItem => navItem.classList.remove(\"show\"));\n showMenu = false;\n }\n}", "function toggle_sharing_menu(e){\n clickSound.play();\n\n if (sharing_menu_state == 1){\n $('#menu_partage').animate(\n {\n height: '0'\n },\n function(){\n $('#menu_partage').hide();\n }\n );\n \n sharing_menu_state = 0;\n }\n else if (sharing_menu_state == 0){\n $('#menu_partage').show(\n function(){\n $('#menu_partage').animate({\n height: $(window).height() - 44\n });\n }\n );\n\n sharing_menu_state = 1;\n }\n \n e.stopPropagation();\n}", "toggleMenu() {\n return this._menuOpen ? this.closeMenu() : this.openMenu();\n }", "function whySlackShow(){\n document.getElementById('menu-1').classList.add('show');\n document.getElementById('menu-2').classList.remove('show');\n document.getElementById('menu-3').classList.remove('show');\n }", "function openNav() {\n document.getElementById(\"menu\").style.width = \"250px\";\n document.getElementsByTagName(\"main\")[0].style.opacity = \"0.4\";\n\n if ((document.getElementById(\"menu\").style.width = \"250px\")) {\n var btn = document.getElementById(\"menubutton\");\n btn.style.display = \"none\";\n } else {\n btn.style.display = \"initial\";\n }\n}", "function removeInvisibility() {\r\n const menuElement = document.querySelector(\".main-menu\");\r\n menuElement.style.display = \"flex\";\r\n}", "function setMenu() {\n var menu = gId('menu');\n var menu_elements = menu.children;\n for (var i = 0; i < menu_elements.length; i++) {\n if (menu_elements[i].textContent != \"my stories\") {\n menu_elements[i].style.display = 'none';\n }\n }\n}", "function toggleMenu() {\n document.getElementById(\"nav-menu\").classList.toggle(\"show-menu\");\n}", "function showMenu() {\n document.getElementById('responsive-menu-click').classList.remove('hide-menu');\n document.getElementById('blackbendjava').classList.remove('d-none');\n}", "function toggleMenu(el) {\n if(screen.width <= 768) {\n var listView = document.querySelector('.list-view');\n var menuContainer = document.querySelector('.menu-container');\n\n menuContainer.classList.toggle('change');\n if(window.getComputedStyle(listView).display === 'none') {\n listView.style.display = 'block';\n } else if(window.getComputedStyle(listView).display === 'block') {\n listView.style.display = 'none';\n }\n }\n}", "function menuShow() {\n if (ul.classList.contains('open')){\n ul.classList.remove('open');\n }\n\n else{\n ul.classList.add('open');\n }\n}", "function mostrarMenu(){\n navLetra.classList.toggle(\"menu-visivel\")\n}", "function ymb_toggleYieldmoMenuOn() {\n if (document.getElementById('ymb_header-menu-bars')) {\n var menu = document.getElementById('ymb_header-menu-bars');\n menu.className = menu.className.replace('initial', 'active');\n }\n if (document.getElementById('ymb_header-bar')) {\n var header = document.getElementById('ymb_header-bar');\n header.className = header.className.replace('initial', 'active');\n }\n if (document.getElementById('ymb_sidenav')) {\n var sideNav = document.getElementById('ymb_sidenav');\n sideNav.className = sideNav.className.replace('initial', 'active');\n }\n if (document.getElementById('ymb_header-logo')) {\n var logo = document.getElementById('ymb_header-logo');\n logo.className = logo.className + ' ymb_header-logo-active';\n }\n if (document.getElementById('ymb_header-application-name')) {\n var appName = document.getElementById('ymb_header-application-name');\n appName.className = appName.className + ' ymb_header-application-name-active';\n }\n var links = document.getElementsByClassName('ymb_header-topnav-link');\n for (var i = 0; i < links.length; i++) {\n links[i].style.opacity = '0.0';\n }\n }", "toggleMenu(){\n const toggleButton = document.querySelector('.header-toggle-menu')\n const headerMenu = document.querySelector('.header-menu')\n\n toggleButton.classList.toggle('clicked-toggle')\n headerMenu.classList.toggle('display-menu')\n }", "function hideShow () {\n if (menu.classList.contains('is-active')) {\n menu.classList.remove('is-active');\n }\n else {\n menu.classList.add('is-active');\n }\n \n}", "toggle(params={}) {\n\t\tif (this.targetObj.action && !params.avoidCallAction) this.targetObj.action();\n\t\tif (this._$pwActive) {\n\t\t\t// Give menu a z-index to put it on top of any windows\n\t\t\tif (this.$pwMain.isBar) {\n\t\t\t\tif (this.$pwMain.order > 0) {\n\t\t\t\t\tthis.$pwMain.order = this.$pwMain.order - 1;\n\t\t\t\t\tif (this.$pwMain.order === 0) {\n\t\t\t\t\t\tthis.$pwMain.element.classList.remove('pw-order');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Give menu its normal z-index\n\t\t\tif (this.$pwMain.isBar) {\n\t\t\t\tif (this.$pwMain.order === 0) {\n\t\t\t\t\tthis.$pwMain.element.classList.add('pw-order');\n\t\t\t\t}\n\t\t\t\tthis.$pwMain.order = this.$pwMain.order + 1;\n\t\t\t}\n\t\t}\n\t\tsuper.toggle();\n\t}", "function myFunction(mMenu) {\r\n var x = document.getElementById(\"mMenu\");\r\n if (x.style.display === \"block\") {\r\n x.style.display = \"none\";\r\n } else {\r\n x.style.display = \"block\";\r\n }\r\n }", "function toggle_menu(){\n // In tabs mode there will be a hidden header that needs to follow what the main header does\n // (html hack for having a fixed header and correct vertical scrolling...)\n let h2 = document.getElementById('header2')\n\n \n let res = toggle_id('navbar')\n if (!res){\n // If the menu is turned off --> also close the theme selector\n disable_theme_popup()\n }\n\n if (h2){\n // Also toggle the mirror header (tabs mode only)\n let res = toggle_id('navbar2');\n }\n}", "function menu() {\n document.getElementById(\"menuStart\").classList.toggle(\"show\");\n}", "toggleMenu(){\n this.menuContent.toggleClass('site-nav--is-visible');\n this.siteHeader.toggleClass('site-header--is-expanded');\n this.menuIcon.toggleClass('site-header__menu-icon--close-x');\n this.siteHeaderLogo.toggleClass ('site-header__logo--transparent');\n }", "function menu_open(){\r\n document.getElementById(\"menupage\").style.display = \"inline-block\";\r\n document.getElementById(\"close_menu\").style.display = \"inline-block\";\r\n document.getElementById(\"menu\").style.display = \"none\";\r\n}", "function doToggle() {\n header.classList.toggle('menu--open');\n page.classList.toggle('noscroll');\n}", "function navBar() {\n console.log(\"it got clicked\")\n if (menu.style.display === \"none\") {\n menu.classList.toggle(\"close\")\n \n \n } else if (menu.style.display === \"\") {\n menu.classList.toggle(\"open\")\n \n }\n\n}", "removeDeactivatedStyleFromMenu() {\n this.menu.classList.add(\"deactivated\");\n }" ]
[ "0.6976563", "0.6837331", "0.6821743", "0.6732825", "0.6667165", "0.6592242", "0.6580228", "0.6570265", "0.65371704", "0.65312874", "0.6512953", "0.6505019", "0.6499225", "0.6489242", "0.64814955", "0.6471558", "0.6471105", "0.64474756", "0.64261067", "0.6418619", "0.6412249", "0.6400322", "0.6398746", "0.63976157", "0.6387738", "0.6385698", "0.638558", "0.6383556", "0.63834065", "0.6380654", "0.6377692", "0.6375278", "0.6370272", "0.63553107", "0.6349887", "0.63457245", "0.6345058", "0.63420385", "0.6338943", "0.6338174", "0.63343763", "0.633289", "0.63313687", "0.63265777", "0.6319274", "0.6317782", "0.6315216", "0.6314201", "0.630299", "0.6300922", "0.6298218", "0.6291672", "0.6285479", "0.6280922", "0.62784785", "0.62779117", "0.62778056", "0.6277587", "0.62773174", "0.62672025", "0.62658906", "0.62619954", "0.6257693", "0.6255036", "0.6249354", "0.62486935", "0.62442005", "0.62254924", "0.62212807", "0.62164706", "0.6213152", "0.6210554", "0.62075335", "0.6198746", "0.61881024", "0.6187125", "0.61848485", "0.61833245", "0.6176952", "0.6159811", "0.6149228", "0.61488163", "0.61448526", "0.6138357", "0.6137577", "0.6136807", "0.6135135", "0.6125342", "0.61224717", "0.61169595", "0.6113194", "0.6107032", "0.6097562", "0.609365", "0.60875744", "0.6085947", "0.6082558", "0.60810256", "0.6080773", "0.6080657" ]
0.65150553
10
deletes menu style if inner width is greater then 910px and adds style if it is less than 910px
function unresponsiveIt() { var w = window.innerWidth; var menu = document.getElementById('menu'); if(w > 910) { menu.removeAttribute('style'); } else { if(!menu.hasAttribute('style')) { menu.style.display = "none"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zoommerce_reduce_menu_width(target, maxval) {\n\t\tvar full_width = 0;\n\t\tjQuery(target).each(function( index ) { \n\t\t\tif((jQuery(this).width() + full_width) > maxval) {\n\t\t\t\tjQuery(this).remove();\n\t\t\t}\n\t\t\tfull_width = full_width + jQuery(this).width(); \n\t\t});\n\t}", "function fixSubMenu(){\n\nj$('nav > .sf-js-enabled > li:not(.rd_megamenu)').mouseover(function(){\n\nvar wapoMainWindowWidth = j$(window).width();\n // checks if third level menu exist\n var subMenuExist = j$(this).children('.sub-menu').length;\n if( subMenuExist > 0){\n var subMenuWidth = j$(this).children('.sub-menu').width();\n var subMenuOffset = j$(this).children('.sub-menu').parent().offset().left + subMenuWidth;\n\n // if sub menu is off screen, give new position\n if((subMenuOffset + subMenuWidth) > wapoMainWindowWidth){\n var newSubMenuPosition = subMenuWidth ;\n\t\t\t j$(this).addClass('left_side_menu');\n\n }else{\n\t\t\t var newSubMenuPosition = subMenuWidth ;\n\n\t\t\t j$(this).removeClass('left_side_menu');\n\t\t}\n }\n });\n}", "function adjustStyle(width){\n if(width<701){\n $('#screen-stylesheet').attr(\"href\",\"css/smallscreen.min.css\");\n $('#resize').addClass(\"animation-element\");\n }\n else{\n $('#screen-stylesheet').attr(\"href\",\"css/largescreen.min.css\");\n $('#resize').removeClass(\"animation-element\");\n if(content)\n $(right).css(\"width\",contentWidth);\n }\n }", "function fixSubMenu() {\r\n\r\n j$('nav > .sf-js-enabled > li:not(.rd_megamenu)').mouseover(function () {\r\n\r\n var wapoMainWindowWidth = j$(window).width();\r\n // checks if third level menu exist\r\n var subMenuExist = j$(this).find('.menu-item-has-children').length;\r\n if (subMenuExist > 0) {\r\n var subMenuWidth = j$(this).children('.sub-menu').width();\r\n var subMenuOffset = j$(this).children('.sub-menu').parent().offset().left + subMenuWidth;\r\n\r\n // if sub menu is off screen, give new position\r\n if ((subMenuOffset + subMenuWidth) > wapoMainWindowWidth) {\r\n var newSubMenuPosition = subMenuWidth;\r\n j$(this).addClass('left_side_menu');\r\n\r\n } else {\r\n var newSubMenuPosition = subMenuWidth;\r\n\r\n j$(this).removeClass('left_side_menu');\r\n }\r\n }\r\n });\r\n\r\n\r\n j$('.rd_megamenu a').on('mouseenter mouseleave', function () {\r\n\r\n j$('.rd_megamenu ul').each(function () {\r\n if (j$(this).find('.mm_widget_area').length > 1) {\r\n var maxHeight = 0;\r\n j$(this).children('.mm_widget_area').css('min-height', 'auto');\r\n j$('.mm_widget_area').css('min-height', '0');\r\n j$(this).children('.mm_widget_area').each(function () {\r\n if (j$(this).height() > maxHeight) {\r\n maxHeight = j$(this).height();\r\n }\r\n j$(this).css(\"min-height\", maxHeight);\r\n })\r\n j$(this).children('.mm_widget_area').css(\"min-height\", maxHeight);\r\n }\r\n\r\n });\r\n\r\n\r\n });\r\n\r\n}", "function abrirMenuIzquierdo(){\r\n document.getElementById(\"leftNav\").style.width =\"250px\";\r\n}", "function setSubmenuBoundries(li) { var bodyWidth = jQueryBuddha(\"body\").width(); var headerOffset = 1000; if (jQueryBuddha(li).find(\">ul.mm-submenu.simple\").length > 0 || jQueryBuddha(li).find(\">ul.mm-submenu.tabbed\").length > 0) { if (jQueryBuddha(li).closest(\".horizontal-mega-menu\").length > 0) { /* get header offset */ /* IF YOU REMOVE .parent(). IT WILL AFFECT THE MENU FROM alex-woo-jewelry.myshopify.com */ jQueryBuddha(li).parent().parents().each(function () { var offsetLeft = jQueryBuddha(this).offset().left + parseInt(jQueryBuddha(this).css(\"padding-left\")); if (offsetLeft < headerOffset && offsetLeft > 0) { headerOffset = offsetLeft; } }); if (headerOffset == 1000 || bodyWidth <= 768) { headerOffset = 0; } /* if (customHeaderOffset && customHeaderOffset<bodyWidth) { headerOffset = (bodyWidth-customHeaderOffset)/2; } MADE THE BELOW MODIFICATION FOR CLIENT https://www.mwfundraising.com/ */ if (customHeaderOffset) { if (customHeaderOffset < bodyWidth) { headerOffset = (bodyWidth - customHeaderOffset) / 2; } else { headerOffset = 0; } } /* set menu width */ if (jQueryBuddha(li).find(\">ul.mm-submenu.simple\").length > 0) { var submenu = jQueryBuddha(li).find(\">ul.mm-submenu.simple\"); } else { var submenu = jQueryBuddha(li).find(\">ul.mm-submenu.tabbed\"); } submenu.css({\"width\": \"auto\", \"left\": \"auto\", \"right\": \"auto\"}); /*submenu.removeAttr(\"style\"); submenu.find(\">li\").removeAttr(\"style\");*/ if (headerOffset * 2 > bodyWidth) { headerOffset = 0; } var headerWidth = bodyWidth - headerOffset * 2; var itemsPerRow = 5; if (headerWidth >= 1020) { /* submenu.attr(\"columns\",5).css(\"width\",headerWidth+\"px\"); */ var style = submenu.attr(\"columns\", 5).attr(\"style\"); style += \"width:\" + headerWidth + \"px !important;\"; submenu.attr(\"style\", style); itemsPerRow = 5; } else if (headerWidth >= 816) { var style = submenu.attr(\"columns\", 4).attr(\"style\"); style += \"width:\" + headerWidth + \"px !important;\"; submenu.attr(\"style\", style); itemsPerRow = 4; } else if (headerWidth >= 612) { var style = submenu.attr(\"columns\", 3).attr(\"style\"); style += \"width:\" + headerWidth + \"px !important;\"; submenu.attr(\"style\", style); itemsPerRow = 3; } else { var style = submenu.attr(\"columns\", 2).attr(\"style\"); style += \"width:\" + headerWidth + \"px !important;\"; submenu.attr(\"style\", style); itemsPerRow = 2; } if (jQueryBuddha(li).find(\">ul.mm-submenu.tabbed\").length > 0) { --itemsPerRow; } /* set simple submenu boundry */ var offsetLeft = jQueryBuddha(li).offset().left + jQueryBuddha(li).outerWidth() / 2; if (offsetLeft < (bodyWidth / 2)) { var left = bodyWidth - (bodyWidth - jQueryBuddha(li).offset().left) - headerOffset; submenu.css(\"left\", -left + \"px\"); } else { var right = bodyWidth - jQueryBuddha(li).offset().left - jQueryBuddha(li).outerWidth() - headerOffset; submenu.css(\"right\", -right + \"px\"); } /* set min height for each element */ jQueryBuddha(li).find(\"ul.mm-submenu.simple>li\").removeAttr(\"style\"); jQueryBuddha(li).find(\".mm-list-name\").removeAttr(\"style\"); /* if simple menu */ if (jQueryBuddha(li).find(\">ul.mm-submenu.simple\").length > 0) { var rowMinHeight = 0; var mmListNameHeight = 0; if (fontSize <= 14) { fontSize = 8; } else if (fontSize > 14 && fontSize <= 18) { fontSize += 6; } else if (fontSize > 18 && fontSize <= 20) { fontSize += 10; } jQueryBuddha(li).find(\"ul.mm-submenu.simple>li\").each(function (i, item) { if (i % itemsPerRow == 0) { rowMinHeight = 0; mmListNameHeight = 0; } if (jQueryBuddha(this).find(\".mm-list-name\").length > 0) { if (jQueryBuddha(this).find(\".mm-list-name\").height() > mmListNameHeight) { mmListNameHeight = jQueryBuddha(this).find(\".mm-list-name\").height(); jQueryBuddha(this).find(\".mm-list-name\").css(\"height\", mmListNameHeight); var previousItems = i; if (previousItems % itemsPerRow != 0) { while (previousItems % itemsPerRow != 0) { jQueryBuddha(li).find(\"ul.mm-submenu.simple\").find(\">li:nth-child(\" + previousItems + \")\").find(\".mm-list-name\").css(\"height\", mmListNameHeight); previousItems--; } } } else { jQueryBuddha(this).find(\".mm-list-name\").css(\"height\", mmListNameHeight); } } if (jQueryBuddha(this).outerHeight() > rowMinHeight) { rowMinHeight = jQueryBuddha(this).outerHeight(); jQueryBuddha(this).css(\"min-height\", rowMinHeight+fontSize); var previousItems = i; if (previousItems % itemsPerRow != 0) { while (previousItems % itemsPerRow != 0) { jQueryBuddha(li).find(\"ul.mm-submenu.simple\").find(\">li:nth-child(\" + previousItems + \")\").css(\"min-height\", rowMinHeight+fontSize); previousItems--; } } } else { jQueryBuddha(this).css(\"min-height\", rowMinHeight+fontSize); } }); /* if tabbed menu */ } else { jQueryBuddha(li).find(\"ul.mm-submenu.tabbed>li\").each(function (i, tab) { var rowMinHeight = 0; var mmListNameHeight = 0; if (fontSize <= 14) { fontSize = 6; } else if (fontSize > 14 && fontSize <= 18) { fontSize += 2; } else if (fontSize > 18 && fontSize <= 20) { fontSize += 6; } jQueryBuddha(tab).find(\"ul.mm-submenu.simple>li\").each(function (j, item) { if (j % itemsPerRow == 0) { rowMinHeight = 0; mmListNameHeight = 0; } if (jQueryBuddha(this).find(\".mm-list-name\").length > 0) { if (jQueryBuddha(this).find(\".mm-list-name\").height() > mmListNameHeight) { mmListNameHeight = jQueryBuddha(this).find(\".mm-list-name\").height(); jQueryBuddha(this).find(\".mm-list-name\").css(\"height\", mmListNameHeight); var previousItems = j; if (previousItems % itemsPerRow != 0) { while (previousItems % itemsPerRow != 0) { jQueryBuddha(this).parent().find(\">li:nth-child(\" + previousItems + \")\").find(\".mm-list-name\").css(\"height\", mmListNameHeight); previousItems--; } } } else { jQueryBuddha(this).find(\".mm-list-name\").css(\"height\", mmListNameHeight); } } if (jQueryBuddha(this).outerHeight() > rowMinHeight) { rowMinHeight = jQueryBuddha(this).outerHeight(); jQueryBuddha(this).css(\"min-height\", rowMinHeight+fontSize); var previousItems = j; if (previousItems % itemsPerRow != 0) { while (previousItems % itemsPerRow != 0) { jQueryBuddha(tab).find(\">ul.mm-submenu.simple\").find(\">li:nth-child(\" + previousItems + \")\").css(\"min-height\", rowMinHeight+fontSize); previousItems--; } } } else { jQueryBuddha(this).css(\"min-height\", rowMinHeight+fontSize); } }); }); /* add arrows */ jQueryBuddha(li).find(\"ul.mm-submenu.tabbed>li\").addClass(\"fa fa-angle-right\"); } } else { jQueryBuddha(li).find(\"ul.mm-submenu.tabbed\").css({\"left\": \"auto\", \"right\": \"auto\"}); var currentStyle = jQueryBuddha(li).find(\"ul.mm-submenu.tabbed\").attr(\"style\"); var newStyle = \"\"; if (currentStyle != undefined) { newStyle += currentStyle + \";height:auto !important;width:auto !important\"; } else { newStyle += \"height:auto !important;width:auto !important\"; } jQueryBuddha(li).find(\"ul.mm-submenu.tabbed\").attr(\"style\", newStyle); jQueryBuddha(li).find(\"ul.mm-submenu.simple\").css({\"left\": \"auto\", \"right\": \"auto\"}); var currentStyle = jQueryBuddha(li).find(\"ul.mm-submenu.simple\").attr(\"style\"); var newStyle = \"\"; if (currentStyle != undefined) { newStyle += currentStyle + \";width:auto !important\"; } else { newStyle += \";width:auto !important\"; } jQueryBuddha(li).find(\"ul.mm-submenu.simple\").attr(\"style\", newStyle); jQueryBuddha(li).find(\"ul.mm-submenu.simple>li\").removeAttr(\"style\"); if (jQueryBuddha(li).width() >= 700) { jQueryBuddha(li).find(\"ul.mm-submenu.simple\").attr(\"columns\", 3); jQueryBuddha(\".vertical-mega-menu ul.mm-submenu.mm-contact\").attr(\"columns\", 2); } else if (jQueryBuddha(li).width() >= 500) { jQueryBuddha(li).find(\"ul.mm-submenu.simple\").attr(\"columns\", 2); jQueryBuddha(\".vertical-mega-menu ul.mm-submenu.mm-contact\").attr(\"columns\", 2); } else { jQueryBuddha(li).find(\"ul.mm-submenu.simple\").removeAttr(\"columns\"); jQueryBuddha(\".vertical-mega-menu ul.mm-submenu.mm-contact\").removeAttr(\"columns\"); } } } else if (jQueryBuddha(li).find(\"ul.mm-submenu.tree\").length > 0) { jQueryBuddha(li).find(\"ul.mm-submenu\").removeAttr(\"style\"); /* tree direction var start if(setTreeDirection == \"set_tree_right\") { jQueryBuddha(li).find(\"ul.mm-submenu\").removeClass(\"tree-open-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").removeClass(\"fa fa-angle-right fa-angle-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").each(function(){ if (jQueryBuddha(this).find(\"ul.mm-submenu\").length>0) { jQueryBuddha(this).addClass(\"fa fa-angle-right\"); } }); } else if(setTreeDirection == \"set_tree_left\") { jQueryBuddha(li).find(\"ul.mm-submenu\").addClass(\"tree-open-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").removeClass(\"fa fa-angle-right fa-angle-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").each(function(){ if (jQueryBuddha(this).find(\"ul.mm-submenu\").length>0) { jQueryBuddha(this).addClass(\"fa fa-angle-left\"); } }); } else if(setTreeDirection == \"set_tree_auto\") { tree direction var end */ /* on touch devices refresh tree direction only on main menu item touch, not on children touch. avoids tree direction issues on 3 level menus. same behavior is on desktop hover. */ if (jQueryBuddha(li).parents(\".buddha-menu-item.mega-hover\").length == 0) { var offsetLeft = jQueryBuddha(li).offset().left + jQueryBuddha(li).outerWidth() / 2; if ((offsetLeft < (bodyWidth / 2) && (setTreeDirection == \"set_tree_auto\" || setTreeDirection == undefined)) || setTreeDirection == \"set_tree_right\") { jQueryBuddha(li).find(\"ul.mm-submenu\").removeClass(\"tree-open-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").removeClass(\"fa fa-angle-right fa-angle-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").each(function () { if (jQueryBuddha(this).find(\"ul.mm-submenu\").length > 0) { jQueryBuddha(this).addClass(\"fa fa-angle-right\"); } }); } else { jQueryBuddha(li).find(\"ul.mm-submenu\").addClass(\"tree-open-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").removeClass(\"fa fa-angle-right fa-angle-left\"); jQueryBuddha(li).find(\"ul.mm-submenu.tree li\").each(function () { if (jQueryBuddha(this).find(\"ul.mm-submenu\").length > 0) { jQueryBuddha(this).addClass(\"fa fa-angle-left\"); } }); } } } }", "function fixWidthInner(nodeclass){\n \"use strict\";\n var aselector, targetwidth;\n $('.' + nodeclass.split(' ')[0]).find('li').each(function (){\n aselector = $(this).find('a').first();\n targetwidth = $(this).width();\n if (targetwidth < (aselector.width() + 38)){\n fixWidth(aselector, targetwidth);\n }\n });\n}", "function fixWidthOuter(){\n \"use strict\";\n var aselector, targetwidth;\n\n $('.jstree-no-dots').children().each(function (){\n aselector = $(this).find('a').first();\n targetwidth = $(this).width();\n if (targetwidth < (aselector.width() + 38)){\n fixWidth(aselector, targetwidth);\n }\n });\n}", "function wideMenuPos() {\n\tjQuery('.nav-container li.level-top').each(function(){\n\t\tvar menuItem = jQuery(this);\n\t\tif(jQuery(document.body).width() > 977 ){\n\t\t\titemHeight = jQuery(this).position().top + jQuery(this).outerHeight();\n\t\t\tmenuItem.find('.menu-wrapper:not(.default-menu)').css('top', itemHeight + 4);\n\t\t}\n\t});\n }", "function updateDropdownWidth() {\n var inputWidth = $item.outerWidth();\n if (inputWidth >= dropdownMinWidth) {\n $menu.css('width', $item.outerWidth());\n } else {\n $menu.css('width', dropdownMinWidth);\n }\n tether.position();\n }", "setSmallWindowModeSize(keepWidth) {\n\t\tthis.removeStyles(keepWidth);\n\t\tif (this.barPosition === 'top') {\n\t\t\tthis.setTopColapsedMenuSize();\n\t\t} else if (this.barPosition === 'bottom') {\n\t\t\tthis.setBottomColapsedMenuSize();\n\t\t} else if (this.barPosition === 'left') {\n\t\t\tthis.setLeftColapsedMenuSize();\n\t\t} else if (this.barPosition === 'right') {\n\t\t\tthis.setRightColapsedMenuSize();\n\t\t}\n\t}", "function checkWidth(){\n\tif($(window).width()<980){\n\t // Display menu only in gear\n\t $(\"ul[class=dropdown-menu] li:lt(5)\").css(\"display\",\"inline\");\n\t $(\"ul[class=nav]\").css(\"display\",\"none\");\n\t}\n\telse{\n\t // Display menu, and remove it from gear\n\t $(\"ul[class=dropdown-menu] li:lt(4)\").css(\"display\",\"none\");\n\t $(\"ul[class=nav]\").css(\"display\",\"block\");\n\t}\n }", "function fixMenuBar(){\n\t\tvar scrolTop = $(window).scrollTop();\n\t\tvar width = $(window).width();\n\t\t\tif (width<1215){\n\t\t\t\tif(scrolTop>=123){\n\t\t\t\t\t$('body').addClass(\"scroll_padding-top\")\n\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t} else {\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\n\t\t\t\tif(window.location.pathname== host_pathname || window.location.pathname== '/index.html'){\n\t\t\t\t\t//show-hide menu\n\t\t\t\t\tif(scrolTop>=645 && scrolTop<=860){\n\t\t\t\t\t\t$('.main-menu .catalog-list').removeClass('open')\n\t\t\t\t\t}\n\t\t\t\t\telse if(scrolTop<645) {\n\t\t\t\t\t\t$('.main-menu .catalog-list').addClass('open')\n\t\t\t\t\t}\n\n\t\t\t\t\t//fix menu\n\t\t\t\t\tif(scrolTop>=645){\n\t\t\t\t\t\t$('body').addClass(\"scroll_padding-top\");\n\t\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t//if we are not on index.html\n\t\t\t\t}else{\n\t\t\t\t\tif(scrolTop>=136){\n\t\t\t\t\t\t$('body').addClass(\"scroll_padding-top\");\n\t\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t}\n\n\t}", "function toggle() {\n if (window.innerWidth < 751) {\n menuStyle.removeAttribute(\"class\", \"responsive-style\"); \n }\n}", "function fixWidthEvent(event) {\n var mainright = document.getElementById('mp-right');\n var mpmain = document.getElementById('mp-main');\n if (mainright && mpmain) {\n if (document.body.clientWidth<1340) {\n mpmain.setAttribute('style','margin-right:0px');\n mainright.setAttribute('style','float:none;margin-left:0px;width:auto;padding:0.5em;clear:both;');\n } else if (document.body.clientWidth>=1340) {\n mpmain.removeAttribute('style');\n mainright.removeAttribute('style');\n }\n }\n}", "function leftMenuWidth(){\n\tif($(window).width() > 960){\n\t\ta = $(\"#content-wrap\").height();\n\t\t$(\"#header-wrap .fixedMenuBar\").height(a);\n\t\t$(\"#header-wrap .fixedMenuBar\").find('ul').height(a);\n\t}\n\tif($(window).width() < 960){\n\t\t$(\"#content-wrap .fixedMenuBar\").height(450);\n\t}\n}", "function adjustNav() {\n\n\tif ($(document).width() < breakPoint) {\n\n\t\t$(\"nav.main-menu\").removeClass(\"full\").addClass(\"compact\");\n\t\t$(\"nav.main-menu ul\").hide();\n\t}\n\n\telse {\n\n\t\t$(\"nav.main-menu\").removeClass(\"compact\").addClass(\"full\");\n\t\t$(\"nav.main-menu ul\").show();\n\t}\n}", "function fixSubmenuRight(){\n\t\t\tvar submenus = $(menu).children(\"li\").children(\".dropdown, .megamenu\");\n\t\t\tif($(window).innerWidth() > mobileWidthBase){\n\t\t\t\tvar menu_width = $(menu_container).outerWidth(true);\n\t\t\t\tfor(var i = 0; i < submenus.length; i++){\n\t\t\t\t\tif($(submenus[i]).parent(\"li\").position().left + $(submenus[i]).outerWidth() > menu_width){\n\t\t\t\t\t\t$(submenus[i]).css(\"right\", 0);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(menu_width == $(submenus[i]).outerWidth() || (menu_width - $(submenus[i]).outerWidth()) < 20){\n\t\t\t\t\t\t\t$(submenus[i]).css(\"left\", 0);\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($(submenus[i]).parent(\"li\").position().left + $(submenus[i]).outerWidth() < menu_width){\n\t\t\t\t\t\t\t$(submenus[i]).css(\"right\", \"auto\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function fixSubmenuRight(){\n\t\t\tvar submenus = $(menu).children(\"li\").children(\".dropdown, .megamenu\");\n\t\t\tif($(window).innerWidth() > mobileWidthBase){\n\t\t\t\tvar menu_width = $(menu_container).outerWidth(true);\n\t\t\t\tfor(var i = 0; i < submenus.length; i++){\n\t\t\t\t\tif($(submenus[i]).parent(\"li\").position().left + $(submenus[i]).outerWidth() > menu_width){\n\t\t\t\t\t\t$(submenus[i]).css(\"right\", 0);\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(menu_width == $(submenus[i]).outerWidth() || (menu_width - $(submenus[i]).outerWidth()) < 20){\n\t\t\t\t\t\t\t$(submenus[i]).css(\"left\", 0);\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($(submenus[i]).parent(\"li\").position().left + $(submenus[i]).outerWidth() < menu_width){\n\t\t\t\t\t\t\t$(submenus[i]).css(\"right\", \"auto\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function apertura() {\r\n if (cerrado) {\r\n menu.style.width = \"88%\";\r\n cerrado = false;\r\n } else {\r\n menu.style.width = \"0%\";\r\n menu.style.overflow = \"hidden\";\r\n cerrado = true;\r\n }\r\n}", "function megamenuFullwidth() {\r\n\t\t\t\r\n\t\t\tvar $windowWidth = $window.width();\r\n\t\t\tvar $headerContainerWidth = $('header#top > .container').width();\r\n\t\t\t$('header#top nav > ul > li.megamenu > .sub-menu').css({\r\n\t\t\t\t'padding-left': ($windowWidth - $headerContainerWidth) / 2 + 'px',\r\n\t\t\t\t'padding-right': ($windowWidth + 2 - $headerContainerWidth) / 2 + 'px',\r\n\t\t\t\t'width': $headerContainerWidth,\r\n\t\t\t\t'left': '-' + ($windowWidth - $headerContainerWidth) / 2 + 'px'\r\n\t\t\t});\r\n\t\t}", "function resMenu() {\n if ($(window).width() < 1023) {\n $('.main-menu ul li a').on(\"click\", function() {\n $(\".navbar-collapse\").removeClass(\"in\");\n $(\".navbar-toggle\").addClass(\"collapsed\").removeClass(\"active\");\n $(\"#header\").removeClass(\"headClr\");\n });\n }\n }", "function abrirDerecho() {\r\n var anchoActual = document.getElementById(\"rightNav\").style.width;\r\n if (anchoActual === '350px') {\r\n document.getElementById(\"rightNav\").style.width = '0px';\r\n $('#btnMostrarTop span').addClass('glyphicon-chevron-left');\r\n $('#btnMostrarTop span').removeClass('glyphicon-chevron-right');\r\n } else {\r\n document.getElementById(\"rightNav\").style.width = '350px';\r\n $('#btnMostrarTop span').removeClass('glyphicon-chevron-left');\r\n $('#btnMostrarTop span').addClass('glyphicon-chevron-right');\r\n }\r\n}", "function win_resize() {\n var win_resized_width = getViewport()[0];\n var win_resized_height = getViewport()[1];\n\n if (win_resized_width < 810) {\n $('.nav-level-2-menu').css('width',win_resized_width);\n if ($('#nav-mask').length < 1 ){\n $('body').append('<div id=\"nav-mask\"/>')\n }\n }\n}", "function equalizeWidth() {\n document.getElementById(\"navPanel\").style.width = document.getElementById(\"menu\").clientWidth+\"px\";\n}", "function checkWidth() {\n if ($(window).width() < 514) {\n $('nav').removeClass('flex-column').addClass('d-flex').addClass('justify-content-between').addClass('align-items-top');\n } else {\n $('nav').removeClass('d-flex').removeClass('justify-content-between').removeClass('align-items-top').addClass('flex-column');\n }\n }", "function sizeDetect() {\n if (window.innerWidth < 1036) { // if current window width is less than 1036\n // set the body to full screen\n if (menu_open) {\n menu.style.width = '100%';\n }\n\n } else {\n // set the body to default size\n if (menu_open) {\n menu.style.width = '20%';\n }\n }\n}", "function setMenuSize (ms) {\n let menuSize = ms + \"px\"; \n MyRBkmkMenuStyle.width = menuSize;\n MyRShowBkmkMenuStyle.width = menuSize;\n MyRFldrMenuStyle.width = menuSize;\n MyBBkmkMenuStyle.width = menuSize;\n MyBResBkmkMenuStyle.width = menuSize;\n MyBFldrMenuStyle.width = menuSize;\n MyBResFldrMenuStyle.width = menuSize;\n MyBSepMenuStyle.width = menuSize;\n MyBProtMenuStyle.width = menuSize;\n MyBProtFMenuStyle.width = menuSize;\n}", "function correctHorizontalAlignment(){var dropdown=elements.scrollContainer.getBoundingClientRect(),styles={};if(dropdown.right>root.right-MENU_PADDING){styles.left=hrect.right-dropdown.width+'px';}elements.$.scrollContainer.css(styles);}", "function toggleNav() {\n var menu = document.getElementsByClassName('menu-button-container');\n var myWidth;\n if (menuOpen) {\n myWidth = \"0%\";\n menuOpen = false;\n }\n else {\n myWidth = \"50%\";\n menuOpen = true;\n }\n for (i = 0; i < 3; i++) {\n menu[i].style.width = myWidth;\n }\n}", "function closeNav() {\r\n document.getElementById(\"menu\").style.width = \"0\";\r\n}", "function default_categories_justify() {\n var menu = $j('.categories--justify');\n if (menu.length) {\n menu.each(function (i, menu) {\n\n var limit = $j('> .ul--0', menu).width(),\n menu_id = $j(menu).attr('id'),\n width = 0;\n\n $j('> .ul--0 > .li--0', menu).removeClass('removed').each(function (i, el) {\n width += $j(el).width();\n\n if (width > limit) {\n $j('#' + menu_id + ' > .ul--0 > .li--0').slice(i).addClass('removed');\n return false;\n }\n });\n\n });\n }\n}", "function showMenu() {\n menuBar.style.width = \"250px\";\n}", "function fullWidthMobileMenu(){\n\t\tif(jq(window).innerWidth() <= 768){\n\t\t\tjq(\"#mainMenu .container-fluid\").removeClass(\"container-fluid\");\n\t\t}\n\t\telse{\n\t\t\tjq(\"#mainMenu .container-fluid\").addClass(\"container-fluid\");\n\t\t}\n\t}", "function closeNav() {\n document.getElementById(\"right_user_menu_open\").style.width = \"0\";\n}", "setRightColapsedMenuSize() {\n\t\t// When counting position we need compensate a pixel\n\t\tconst fixOffsetPosition = 1;\n\t\tif (this.isWindowFixed && this._window) {\n\t\t\tconst height = this._window.bodyEl.offsetHeight - this._window.defaultBorderSize - fixOffsetPosition;\n\t\t\tconst diff = (this._window._dialog.offsetLeft + this._window.bodyEl.offsetLeft) - this.element.offsetLeft;\n\t\t\tlet width = this.element.offsetWidth - diff - this._window.defaultBorderSize - fixOffsetPosition;\n\t\t\tthis.element.style.height = height + 'px';\n\t\t\tthis.element.style['min-height'] = height + 'px';\n\t\t\tthis.element.style['max-width'] = width + 'px';\n\t\t}\n\t}", "function adaptMainMenu(){\n\t\t\n\t\tif(mainMenuStatus == 'closed'){\n\t\t\t\n\t\t\t$('.mainMenuWrapper').css('margin-top', -$('.mainMenuWrapper').height());\n\t\t\t\n\t\t};\n\t\t\n\t}", "function getWidth() {\n if ($(window).width() < 730) {\n var content_width = $(\".wrap\").width();\n $(\".location-filter .row\").width(content_width);\n $(\".header-profile .profile-menu\").width(content_width);\n $(\".search-form\").width(content_width);\n $(\".filter-content-wrap\").width(content_width);\n } else {\n $(\".location-filter .row\").removeAttr(\"style\");\n $(\".header-profile .profile-menu\").removeAttr(\"style\");\n $(\".search-form\").removeAttr(\"style\");\n }\n\n}", "function clearStyleAttribute() {\r\n closeAllMenus();\r\n $(\".common-mobile-menu\").removeAttr(\"style\");\r\n $(\".footer-list-menu\").removeAttr(\"style\");\r\n}", "function tree_sizing() {\n if ($(window).width() >= 1350) {\n $(\"#tree\").css(\"width\", \"1350px\");\n } else {\n var width = String($(window).width()) + \"px\";\n $(\"#tree\").css(\"width\", width);\n }\n\n\n}", "function openNav() {\r\n document.getElementById(\"menu\").style.width = \"300px\";\r\n}", "function setNavDivWidth(frameWidth){\n\t\tvar newWidth = frameWidth + parseInt($('#frame').css('padding-left')) +\n\t\t\t\t\t\t\tparseInt($('#frame').css('padding-right')) + \n\t\t\t\t\t\t\tparseInt($('body').css('padding-left')) +\n\t\t\t\t\t\t\tparseInt($('body').css('padding-right')) ;\n\n\n\n\t\tif(newWidth > $('#navDiv').width()){\n\t\t\t$('#navDiv').css('min-width' , newWidth+'px');\n\t\t}else{\n\t\t\t$('#navDiv').css('min-width', '760px');\n\t\t}\n\t}", "function nextOrPrevProductStock__InWidth_(children, width, childrenStatus) {\n if (width) {\n $productsFilter.children[children].style.display = childrenStatus;\n }\n }", "function DDLightbarMenu_SetWidth(pWidth)\n{\n\tif (typeof(pWidth) == \"number\")\n\t{\n\t\tif ((pWidth > 0) && (pWidth <= console.screen_columns))\n\t\t\tthis.size.width = pWidth;\n\t}\n}", "function fixWidth() {\r\n if (\r\n $(\".header-style-10\").length &&\r\n $(\".home-page-10\").length &&\r\n full_width > 768\r\n ) {\r\n var header_width = $(\".header-wrapper > .container\").width();\r\n $(\"#maincontent\").css({ width: header_width + 60, display: \"block\" });\r\n $(\".header-wrapper\").css({\r\n width: header_width + 60,\r\n display: \"block\",\r\n });\r\n }\r\n }", "function Gmenu(rOrder)\r\n{\r\n\twindow.Max = 0; \r\n\twindow.UlMax = 0;\r\n\twindow.LiMax = 0;\r\n\twindow.first = 0;\r\n\t$('.Gmenu ul li').hover(\r\n\tfunction()\r\n\t{\r\n\t\tflag = left = 1;\r\n\t\tif(!$(this).find('.main_item').length && $(this).attr('class')!='hr')\r\n\t\t\t$(this).addClass('menu_active');\r\n\t\tul = $(this).find('ul:first:has(li)');\r\n\t\tif($(ul).length)\r\n\t\t{\r\n\t\t\twindow.UlMax=0;\r\n\t\t\tif($(this).attr('view')=='topitem')\r\n\t\t\t{\r\n\t\t\t\tel = getAbsolutePosition(this,1);\r\n\t\t\t\twindow.LiMax = el.w;\r\n\t\t\t\twindow.first = 0;\r\n\t\t\t}\r\n\t\t\t$(ul).css('display','block');\r\n\t\t\t$(ul).find('li[@parent='+($(ul).attr('id'))+'] a').each(function()\r\n\t\t\t{\r\n\t\t\t\tif(window.UlMax < $(this)[0].offsetWidth)\r\n\t\t\t\t\twindow.UlMax = $(this)[0].offsetWidth\r\n\t\t\t});\r\n\t\t\tif(!window.first && window.UlMax < window.LiMax)\r\n\t\t\t\twindow.Max = window.LiMax;\r\n\t\t\telse\r\n\t\t\t\twindow.Max = window.UlMax;\r\n\t\t\twindow.Max = window.Max + 20;\t\r\n\t\t\t$(ul).css('width',''+window.Max+'px');\r\n\t\t\tif(!window.first)\r\n\t\t\t{\r\n\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t$(ul).css('left',''+(el.l + (el.w - $(ul)[0].offsetWidth))+'px');\r\n\t\t\t\telse\r\n\t\t\t\t\t$(ul).css('left',''+(el.l)+'px');\r\n\t\t\t\t$(ul).css('top',''+(el.t + el.h - 1)+'px');\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t$(ul).css('top',''+$(this)[0].offsetTop+'px');\r\n\t\t\t$(ul).find('li[@parent='+($(ul).attr('id'))+']').each(function()\r\n\t\t\t{\r\n\t\t\t\t$(this).css('width',''+window.Max+'px');\r\n\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t$(this).find('ul:first').css('right',''+window.Max+'px');\r\n\t\t\t\telse\r\n\t\t\t\t\t$(this).find('ul:first').css('left',''+window.Max+'px');\r\n\t\t\t});\r\n\t\t\tif(rOrder=='RTL')\r\n\t\t\t{\r\n\t\t\t\tif($.browser.msie && !window.first)\r\n\t\t\t\t\tleft = -21;\r\n\t\t\t\telse\r\n\t\t\t\t\tleft = -2;\r\n\t\t\t}\r\n\t\t\twindow.first = 1;\r\n\t\t\t$(ul).dropShadow({left: left, top: 2, blur: 2, opacity: 0.4});\r\n\t\t\tsetTimeout('if(flag) $(ul).redrawShadow()',150);\r\n\t\t\tif(IsIE6())\r\n\t\t\t\taddiframe($(this));\r\n\t\t}\t\r\n\t},\r\n\tfunction() \r\n\t{\r\n\t\tflag=0;\r\n\t\tif(!$(this).find('.main_item').length && $(this).attr('class')!='hr')\r\n\t\t\t$(this).removeClass('menu_active'); \r\n\t\t$(this).find('ul:first').css('display','none'); \r\n\t\t$(this).find('ul:first').removeShadow();\r\n\t\tvar id = $(this).attr('id');\r\n\t\tid = id.substr(2);\r\n\t\tif($('#ul'+id).length)\r\n\t\t\t$(\"#frame_menu\"+id).remove();\r\n\t});\t\r\n\t$('.Gmenu li:has(ul:has(li))').find('a:first').each(function()\r\n\t{\r\n\t\tif(!$('b',this).length)\r\n\t\t{\t\r\n\t\t\t$(this).after('<b class=\"bmenu bmenu_simple\">&nbsp;&raquo;</b>');\r\n\t\t\t$(\"b.bmenu_simple\").css(\"color\",$(this).css(\"color\"));\r\n\t\t}\r\n\t});\r\n\t$('.Gmenu li[@view=topitem]:has(ul:has(a.current))').find(\"b.bmenu:first\").append(\"&nbsp;<b class='bmenu_current'>\"+$(\"a.current\").attr('title')+\"</b>\");\r\n\t$(\"b.bmenu_current\").css(\"color\",$(\"a.current\").css(\"color\"));\r\n\tvar top=0;\r\n\tif($(\".Madrid\").length)\r\n\t{\r\n\t\tif(IsIE6())\r\n\t\t{\r\n\t\t\t$('.Madrid b.xtop').each(function()\r\n\t\t\t{\r\n\t\t\t\t$(this).attr(\"style\",\"height:1px;width:\"+($(this).parent()[0].offsetWidth)+\"px\");\r\n\t\t\t});\r\n\t\t\t$('.Gmenu').parent().append('&nbsp;');\r\n\t\t}\r\n\t}\r\n\telse if($(\".Paris\").length)\r\n\t{\r\n\t\t$('.Gmenu').parent().css('height','1px');\r\n\t\tif($.browser.msie)\r\n\t\t\t$('.Gmenu').parent().append('&nbsp;');\r\n\t}\r\n\telse if($('#menu_block>div.Gmenu').length)\r\n\t{\r\n\t\tvar h=0, w=0;\r\n\t\tvar mtW = $('div.Gmenu')[0].offsetWidth;\r\n\t\t$('div.Gmenu li[@view=topitem]').each(function()\r\n\t\t{\r\n\t\t\tw += $(this)[0].offsetWidth;\r\n\t\t\tif(w>mtW)\r\n\t\t\t{\r\n\t\t\t\th += $(this)[0].offsetHeight;\r\n\t\t\t\tw=$(this)[0].offsetWidth;\r\n\t\t\t}\r\n\t\t});\r\n\t\t$('#menu_block').css('height',''+(h+19)+'px');\r\n\t}\t\r\n\t$('.Gmenu ul li ul li ul').css('top','0px');\r\n}", "function fix_position()\n\t{\n\t\tvar uwidth = $('#user-nav > ul').width();\n\t\t$('#user-nav > ul').css({width:uwidth,'margin-left':'-' + uwidth / 2 + 'px'}); \n \n\t}", "function toogleMenus(){\r\n var dropdown = document.getElementById(\"menu\");\r\n if (dropdown.style.display === \"none\") {\r\n if(window.innerWidth > 853) {\r\n dropdown.style.display = \"flex\";\r\n dropDownMenuOpenStatus = false;\r\n } else {\r\n dropdown.style.display = \"block\";\r\n dropDownMenuOpenStatus = true;\r\n }\r\n } else {\r\n if(window.innerWidth < 853) {\r\n dropDownMenuOpenStatus = false;\r\n dropdown.style.display = \"none\";\r\n }\r\n }\r\n}", "function overrideWidth(node){ if(node){ node.style.maxWidth = node.offsetWidth+\"px\"; node.style.width = \"auto\"; } }", "function MenuLateralIzq(){\n //$('#map').css({'width':'766px'});\n $('.menuizquierdo').css({'width':'600px'});\n $('.boton').css({'display':'inline-block' });\n $('.botones').css({'margin':'0 auto'});\n $('.controles').css({'margin':'0 auto'});\n\n}", "function correctHorizontalAlignment() {\n let dropdown = ul[0].getBoundingClientRect();\n let styles = {};\n if (dropdown.right > root.right - MENU_PADDING) {\n styles.left = `${hrect.right - dropdown.width}px`;\n }\n ul.css(styles);\n }", "function checkWidth() {\n if (($(window).width() >= bp_med)) {\n // Show all li selectors\n $('.tabs-course_browser_list-tabs > li').css('display', 'inline-block');\n }\n else {\n // Display list-item for all li selectors\n $('.tabs-course_browser_list-tabs > li').css('display', 'list-item');\n // Hide all li selectors expect first one\n $('.tabs-course_browser_list-tabs > li:gt(0)').hide();\n }\n }", "function openNav() {\r\n\r\n if (x.matches) width = \"30%\";\r\n else width = \"50%\"; \r\n document.getElementById(\"mySidenav\").style.width = width;\r\n //document.getElementById(\"main\").style.marginLeft = width;\r\n}", "function setRightColumnBar(){\r\n\tvar thisCol = document.getElementById('framework-content-right').childNodes;\r\n\tfor(i=0;i < thisCol.length;i++){\r\n\t\tif(thisCol[i].nodeType == 1 || (thisCol[i].nodeType == 3 && (/\\S/.test(thisCol[i].nodeValue)))){\r\n\t\t\tdocument.getElementById('framework-base-main').className=\"framework-base-main-override\";\r\n\t\t\tdocument.getElementById('framework-content-right').style.width=\"189px\";\r\n\t\t}\r\n\t}\r\n}", "function openNav() {\n var windowWidth = $(window).width();\n console.log(windowWidth);\n if (windowWidth < 1000) {\n document.getElementById(\"mySidenav\").style.width = \"100%\";\n } else {\n document.getElementById(\"mySidenav\").style.width = \"500px\";\n document.getElementById(\"main\").style.paddingLeft = \"500px\";\n }\n}", "setLeftColapsedMenuSize() {\n\t\t// When counting position we need compensate a pixel\n\t\tconst fixOffsetPosition = 1;\n\t\tif (this.isWindowFixed && this._window) {\n\t\t\tconst height = this._window.bodyEl.offsetHeight - this._window.defaultBorderSize - fixOffsetPosition;\n\t\t\tconst diff = (this.element.offsetLeft - this._window._dialog.offsetLeft) - this._window.bodyEl.offsetLeft;\n\t\t\tlet width = this._window.bodyEl.offsetWidth - diff - this._window.defaultBorderSize - fixOffsetPosition;\n\t\t\tthis.element.style.height = height + 'px';\n\t\t\tthis.element.style['min-height'] = height + 'px';\n\t\t\tthis.element.style['max-width'] = width + 'px';\n\t\t} else {\n\t\t\tthis.element.style.height = '100%';\n\t\t\tthis.element.style['max-height'] = '100%';\n\t\t}\n\t}", "function spreadNavBar() {\n for (i = 0; i < userBar.children.length; i++) {\n userBar.children[i].style.width = \"\";\n }\n userBar.style.width = \"\";\n}", "function paddingMenu() {\n 'use strict';\n var paddingDis = ($(window).width()-1200)/2;\n if(paddingDis>0) {\n $('.navbar-nav .dropdown-menu').css('padding', '0px '+paddingDis+'px');\n } else {\n $('.navbar-nav .dropdown-menu').css('padding', '0px');\n }\n}", "function MessagesMenuWidth(){\n\tvar W = window.innerWidth;\n\tvar W_menu = $('#sidebar-left').outerWidth();\n\tvar w_messages = (W-W_menu)*16.666666666666664/100;\n\t$('#messages-menu').width(w_messages);\n}", "function MessagesMenuWidth() {\n var W = window.innerWidth;\n var W_menu = $('#sidebar-left').outerWidth();\n var w_messages = (W - W_menu) * 16.666666666666664 / 100;\n $('#messages-menu').width(w_messages);\n}", "function centerMenu() {\r\n navHeight = nav.offsetHeight;\r\n winHeight = window.innerHeight;\r\n contentHeight = winHeight - (navHeight + header.offsetHeight);\r\n // check window width\r\n if (window.innerWidth > 1205) {\r\n // check window height\r\n // change the layout .. decrease the space bettween elements.. padding and margin\r\n if (winHeight > 710) {\r\n num = (contentHeight * 0.5) - (sideMenu.offsetHeight * 0.3);\r\n sideMenu.querySelector('.data-container').style.marginBottom = '30px';\r\n sideMenu.querySelector('.title').style.marginBottom = '15px';\r\n sideMenu.querySelector('.title').style.paddingTop = '20px';\r\n sideMenu.querySelector('.title').style.paddingBottom = '20px';\r\n } else if (winHeight <= 710 && winHeight > 600) {\r\n num = (contentHeight * 0.5) - (sideMenu.offsetHeight * 0.2); \r\n } else if (winHeight <= 600 && winHeight >= 566) {\r\n sideMenu.querySelector('.data-container').style.marginBottom = '13px';\r\n sideMenu.querySelector('.title').style.marginBottom = '5px';\r\n sideMenu.querySelector('.title').style.paddingTop = '5px';\r\n sideMenu.querySelector('.title').style.paddingBottom = '5px';\r\n num = (contentHeight * 0.5) - (sideMenu.offsetHeight * 0.15);\r\n } else {\r\n num = 0;\r\n sideMenu.style.position = 'static';\r\n sideMenu.querySelector('.data-container').style.marginBottom = '20px';\r\n sideMenu.querySelector('.title').style.marginBottom = '15px';\r\n sideMenu.querySelector('.title').style.paddingTop = '15px';\r\n sideMenu.querySelector('.title').style.paddingBottom = '15px';\r\n }\r\n if (num < 161) {\r\n num = 161.4;\r\n }\r\n sideMenu.style.top = num + 'px';\r\n } else {\r\n // set side menu to static position\r\n sideMenu.style.position = 'static';\r\n sideMenu.style.zIndex = 0;\r\n }\r\n }", "function setMenu() {\n\n\t\tvar w = parseInt($(\"nav\").css(\"width\"), 10);\n\n\t\tif (w < 1200) {\n\n\t\t\tif ($(\"#navigator2\").is(':empty')) {\n\t\t\t\t$(\"#navigator2\").prepend($(\"#IndexNav\"), $(\"#productsNav\"),$(\"#contactNav\"),$(\"#accountNav\"), $(\"#cartNav\"));\n\t\t\t\t$(\"#productsNavUl\").attr(\"class\", \"subNav2\");\n\t\t\t\t$(\"#accountNavUl\").attr(\"class\", \"subNav2\");\n\t\t\t\t$(\"#miniNavigator\").show();\n\t\t\t\t$(\"#miniNavigator\").effect(\"highlight\", { color: 'green' }, 500);\n\t\t\t\t$(\"#navigator2\").hide();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$(\"#navigator\").prepend($(\"#IndexNav\"), $(\"#productsNav\"),$(\"#contactNav\"),$(\"#accountNav\"), $(\"#cartNav\"));\n\t\t\t$(\"#productsNavUl\").attr(\"class\", \"subNav\");\n\t\t\t$(\"#accountNavUl\").attr(\"class\", \"subNav\");\n\t\t\t$(\"#miniNavigator\").hide();\n\t\t\t}\n\t}", "function resizeResults()\n{\n var content, menu, menuWidth = 200;\n \n menu = document.getElementById(\"menuSide\");\n content = document.getElementById(\"contentSide\");\n \n windowSize = window.innerWidth - 60;\n \n document.getElementById(\"displayArea\").style.width = windowSize;\n \n if (menu != null)\n menu.style.width = menuWidth;\n if (content != null)\n content.style.width = windowSize - menuWidth;\n \n}", "function basicStyle() {\n $(\"div[id^=zz][id$=_V4QuickLaunchMenu]\").addClass(\"base\");\n $(\"div[id^=zz][id$=_V4QuickLaunchMenu] li\").addClass(\"baseBorder\");\n $(\"div[id^=zz][id$=_V4QuickLaunchMenu] span\").addClass(\"baseText\");\n $(\"div[id^=zz][id$=_V4QuickLaunchMenu] ul li\").has('ul').addClass('Office365Icon');\n $(\"[id^=zz][id$=_RootAspMenu] li\").children('ul').hide();\n }", "function openUserMenu() {\n document.getElementById(\"right_user_menu_open\").style.width = \"250px\";\n}", "function closeNav() {\n $(\"#swim-overlay-menu\").css({\"width\" : \"0%\"});\n}", "function secondaryNavigationView() {\n if (document.querySelector('.navigation-secondary') || document.querySelector('.nav-pills')) {\n var navWrapper = document.querySelector('.navigation-secondary').clientWidth;\n var allCategories = Array.from(document.querySelector('.nav-pills').children);\n }\n\n if (navWrapper < window.innerWidth) {\n allCategories.forEach(function (each) {\n putTogetherWidth += each.clientWidth + 25;\n })\n document.querySelector('.nav-pills').setAttribute('style', 'width:' + putTogetherWidth + 'px');\n }\n\n if (navWrapper < putTogetherWidth) {\n Array.from(document.querySelectorAll('.scroller')).forEach(function (each) {\n each.classList.toggle('hide');\n })\n }\n}", "function removeMenuChanges() {\n let menu = document.getElementById('resizable');\n\n if (menu.style.right) {\n menu.style.right = null;\n }\n if (menu.style.left) {\n menu.style.left = null;\n }\n\n $('.menu').removeClass('menu-left');\n $('.menu').removeClass('menu-right');\n $('.window').removeClass('window-menu-right');\n $('.menu-bottom').addClass('hidden');\n $('.menu').removeClass('hidden');\n }", "function fixPositionSubmenu() {\n var menu = $('#main-nav .navbar-nav .dropdown-menu > .dropdown-submenu > .dropdown-menu');\n\n menu.each(function (e) {\n\n var leftPos = $(this).parent().offset().left + $(this).parent().width();\n if (leftPos + $(this).width() > $(\"body\").width()) {\n $(this).addClass(\"left\");\n } else {\n $(this).removeClass(\"left\");\n }\n });\n }", "function addWidth() {\n if (window.innerWidth <= 767) {\n $('.about-graph').width(window.innerWidth - 100);\n } else {\n $('.about-graph').removeAttr('style');\n }\n }", "function addWidth() {\n if (window.innerWidth <= 767) {\n $('.about-graph').width(window.innerWidth - 100);\n } else {\n $('.about-graph').removeAttr('style');\n }\n }", "function adjustMenuTextWidth() {\r\n\tvar naviPosition = $(\".haupt-navi\").offset().left;\r\n\t$(\".menutext-container\").css(\"left\", naviPosition+20);\r\n}", "function openNav() {\n document.getElementById(\"mySidebar\").style.width = \"250px\";\n if (screen.width<=630) {\n document.getElementById(\"mySidebar\").style.width = \"100%\";\n document.getElementById(\"mySidebar\").style.Left = \"0px\";\n\n }\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n\n}", "function setMaxXSWidth(width){\n xs = width;\n }", "function menu_dropdown_open() {\r\n var width = $(window).width();\r\n if (width > 991) {\r\n if ($(\".ow-navigation .nav li.ddl-active\").length) {\r\n $(\".ow-navigation .nav > li\").removeClass(\"ddl-active\");\r\n $(\".ow-navigation .nav li .dropdown-menu\").removeAttr(\"style\");\r\n }\r\n } else {\r\n $(\".ow-navigation .nav li .dropdown-menu\").removeAttr(\"style\");\r\n }\r\n }", "function submenuLinksSetAttribute () {\n $('.js-submenu-visible > .js-select-current').each(function () {\n $(this).attr('data-width', $(this).outerWidth())\n })\n }", "function fixReviewsMenu() {\n fixMenu(reviewsSectionMenu);\n }", "function resizeMenuChecker(e) {\n if(e.relatedTarget === null) {\n document.getElementsByClassName('sidebar-open')[0].setAttribute('class', 'sidebar-closed');\n }\n if(window.innerWidth > 999) {\n if(document.getElementsByClassName('sidebar-closed')[0]) {\n document.getElementsByClassName('search-form-input')[0].removeEventListener('blur', resizeMenuChecker, false);\n document.getElementsByClassName('language-selector')[0].removeEventListener('blur', resizeMenuChecker, false);\n } else {\n document.getElementsByClassName('sidebar-open')[0].setAttribute('class', 'sidebar-closed');\n }\n }\n}", "function closeRightNav() {\n document.getElementById(\"myRightNav\").style.width = \"0\";\n}", "function fixNav() {\n\tif(width>900){\n\t\tif (window.pageYOffset > sticky) {\n\t\t fixedmenu.classList.add(\"fix-nav\");\n\t\t pagearea.classList.add(\"pad300\");\n\t\t} else {\n\t\t \tfixedmenu.classList.remove(\"fix-nav\");\n\t\t pagearea.classList.remove(\"pad300\");\n\t\t}\n\t}\n}", "function sideNavResize() {\n let navArray = getNavWidth(); //Get sideNav width and offset values\n let navWidth = navArray[0];\n let navOffset = navArray[1];\n\n if (sideNavState() === \"closed\") { //If the sideNav is closed, apply the calculated width and offset\n document.getElementById(\"sideNav\").style.width = navWidth;\n document.getElementById(\"sideNav\").style.left = navOffset;\n } else { //Otherwise, apply the width value to the sideNav element width and sideNavDocOverlay element left properties\n document.getElementById(\"sideNav\").style.width = navWidth;\n document.getElementById(\"sideNavDocOverlay\").style.left = navWidth;\n }\n}", "function checkWidth() {\r\n if ($window.width() < 992) {\r\n $('.navbar .navbar-collapse > ul > li.dropdown > a').removeAttr('class');\r\n }\r\n }", "function setContactSubmenuBoundries(li) { var bodyWidth = jQueryBuddha(\"body\").width(); var headerOffset = 1000; if (jQueryBuddha(li).find(\">ul.mm-submenu.mm-contact\").length > 0 && jQueryBuddha(li).closest(\".horizontal-mega-menu\").length > 0) { /* get header offset */ jQueryBuddha(li).parent().parents().each(function () { var offsetLeft = jQueryBuddha(this).offset().left + parseInt(jQueryBuddha(this).css(\"padding-left\")); if (offsetLeft < headerOffset && offsetLeft > 0) { headerOffset = offsetLeft; } }); if (headerOffset == 1000) { headerOffset = 0; } if (headerOffset * 2 > bodyWidth) { headerOffset = 0; } if (customHeaderOffset) { if (customHeaderOffset < bodyWidth) { headerOffset = (bodyWidth - customHeaderOffset) / 2; } else { headerOffset = 0; } } /* set menu width */ var submenu = jQueryBuddha(li).find(\">ul.mm-submenu.mm-contact\"); var headerWidth = bodyWidth - headerOffset * 2; submenu.css({\"width\": headerWidth + \"px\", \"left\": \"auto\", \"right\": \"auto\"}); /* set simple submenu boundry */ var offsetLeft = jQueryBuddha(li).offset().left + jQueryBuddha(li).outerWidth() / 2; if (offsetLeft < (bodyWidth / 2)) { var left = bodyWidth - (bodyWidth - jQueryBuddha(li).offset().left) - headerOffset; submenu.css(\"left\", -left + \"px\"); } else { var right = bodyWidth - jQueryBuddha(li).offset().left - jQueryBuddha(li).outerWidth() - headerOffset; submenu.css(\"right\", -right + \"px\"); } } else { jQueryBuddha(li).find(\"ul.mm-submenu.mm-contact\").css({ \"left\": \"auto\", \"right\": \"auto\", \"width\": \"auto\", \"height\": \"auto\" }); if (jQueryBuddha(li).find(\">ul.mm-submenu.mm-contact\").width() <= 480) { jQueryBuddha(li).find(\">ul.mm-submenu.mm-contact\").addClass(\"one-column\"); } } }", "function setMenuCSS() {\n\tGM_addStyle([\n\t\t\t\"#x_gmjct_gglrefanonym_menu {font-size: 0.9em; line-height; 0.9em; border: 0;}\",\n\t\t\t\"#x_gmjct_gglrefanonym_menu input {margin: 0 5px; vertical-align: bottom; padding: 0;}\",\n\t\t\t\".x_gmjct_gglrefanonym_style1 {text-align: right; width: 894px; margin: 0; padding: 0 287px 0 0;}\",\n\t\t\t\".x_gmjct_gglrefanonym_style2 {text-align: right; width: 841px; margin: 0 0 3px 0; padding: 0;}\"\n\t\t].join(\"\\n\"));\n}", "function height_menu(){\n\n\tvar length = $$('#newMenu > li').length;\n\tvar padding = 27;\n\n\tif(length == 2){\n\t\tvar height = 0;\n\t\t$$('#newMenu > li').each(function(elt){\n\t\t\tvar heightLi = elt.getHeight();\n\t\t\tif(height < heightLi){\n\t\t\t\theight = heightLi;\n\t\t\t}\n\t\t});\n\t\t$$('#newMenu > li').each(function(elt){\n\t\t\telt.setStyle({height: height-padding+'px'});\n\t\t});\n\t}\n}", "function FixStyles() {\n //for (var i=0; i < document.styleSheets.length; i++) {\n // if (document.styleSheets[i].href.indexOf('threecols') > 0) {\n // intPageFunctionsWidth = GetObjectWidth('Primary') + GetObjectWidth('Secondary');\n // document.getElementById('PageFunctions').style.width = intPageFunctionsWidth + 'px';\n // }\n //}\n}", "function mob_nav_width(){\r\n\r\n\t\t\tif(isSmall()){\r\n\t\t\t\tvar slide_amount = $('#header-nav').width();\r\n\t\t\t} else {\r\n\t\t\t\tvar slide_amount = '275';\r\n\t\t\t}\r\n\r\n\t\t\t$('#header-nav').css({'right': -slide_amount});\r\n\r\n\t\t\treturn(slide_amount);\r\n\r\n\t\t}", "function changeMarginBullet() {\n\t\t\t\t\t\t\tvar nw = $('#js-mobile-pagination').width()+60;\n\t\t\t\t\t\t\tvar oldwidth = $(window).width();\n\t\t\t\t\t\t\tif (oldwidth < nw && getMargin >= 25) {\n\t\t\t\t\t\t\t\t$('#js-mobile-pagination li:gt(0)').css('marginLeft', getMargin-=10);\n\t\t\t\t\t\t\t\treturn changeMarginBullet();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}", "updateInnerWidthDependingOnChilds(){}", "function openNav() {\n document.getElementById(\"menubar\").style.width = \"250px\";\n document.getElementById(\"main\").style.marginLeft = \"250px\";\n }", "function featured_products_nav_width() {\n jQuery( '.featured-products-nav li' ).each(function() {\n jQuery( this ).width( jQuery( this ).width() );\n });\n}", "function initHorizontal(){\n $(\".horizontalMenu\").each(function(){\n let id = makeid();\n $(this).attr(\"id\", id);\n let mainWidth = $(this).width();\n console.log(\"masud width: \"+mainWidth);\n let arrowWidth = $(this).children('i').outerWidth(true);\n let calculatedWidth = mainWidth - (arrowWidth*2);\n $(this).children('.menuContainer').css('width', calculatedWidth);\n });\n }", "_update_menu_min_size () {\n let work_area = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.findIndexForActor(this.menu.actor));\n let monitor = Main.layoutManager.findMonitorForActor(this.menu.actor);\n let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor;\n\n // @HACK\n // Some extensions enable autohiding of the panel and as a result the\n // height of the panel is not taken into account when computing the\n // work area. This is just a simple work around.\n let tweak = 0;\n if (monitor.height === work_area.height) tweak = Main.layoutManager.panelBox.height + tweak;\n\n let max_h = Math.floor((work_area.height - tweak) / scale_factor);\n let max_w = Math.floor((work_area.width - 16) / scale_factor);\n\n this.menu_max_w = max_w;\n this.menu_max_h = max_h;\n\n this.menu.actor.style = `max-height: ${max_h}px; max-width: ${max_w}px;`;\n }", "function closeNav() {\n document.getElementById(\"sidebar-menu\").style.width = \"0\";\n}", "function setMaxSMWidth(width){\n sm = width;\n }", "function showMenuBtn(){\n\t\tif($(window).width()<1199.98){\n\t\t\t$(\".open_menu\").addClass(\"d-block\");\n\t\t\t$(\"header nav\").addClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}else{\n\t\t\t$(\".open_menu\").removeClass(\"d-block\");\n\t\t\t$(\"header nav\").removeClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}\n\t}", "function showMenuBtn(){\n\t\tif($(window).width()<1199.98){\n\t\t\t$(\".open_menu\").addClass(\"d-block\");\n\t\t\t$(\"header nav\").addClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}else{\n\t\t\t$(\".open_menu\").removeClass(\"d-block\");\n\t\t\t$(\"header nav\").removeClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}\n\t}", "cleanMenu() {\n for (var i = 0; i < this.menuView.HTMLElementsMenu.length; i++) {\n this.menuView.HTMLElementsMenu[i].style.display = \"none\";\n }\n for (var i = 0; i < this.menuView.HTMLButtonsMenu.length; i++) {\n this.menuView.HTMLButtonsMenu[i].style.backgroundColor = this.menuView.menuColorDefault;\n this.menuView.HTMLButtonsMenu[i].style.zIndex = \"0\";\n }\n }", "function mob_nav_width(){\n\t\t\n\t\t\tif(isSmall()){\n\t\t\t\tvar slide_amount = $('#header-nav').width();\n\t\t\t} else {\n\t\t\t\tvar slide_amount = '275';\n\t\t\t}\n\t\t\t\n\t\t\t$('#header-nav').css({'right': -slide_amount});\n\n\t\t\treturn(slide_amount);\n\t\t\t\n\t\t}", "setTopColapsedMenuSize() {\n\t\t// When counting position we need compensate a pixel\n\t\tconst fixOffsetPosition = 1;\n\t\tif (this.isWindowFixed && this._window) {\n\t\t\tconst bodyHeight = this._window.bodyEl.offsetHeight;\n\t\t\tconst diff = this.element.offsetTop - this._window._dialog.offsetTop - this._window.defaultBorderSize - this._window.bodyEl.offsetTop + fixOffsetPosition;\n\t\t\tlet height = bodyHeight + diff + this._window.titleBarEl.offsetHeight + this.element.offsetHeight;\n\t\t\tif (this._window.isMaximized || this.$powerUi.componentsManager.smallWindowMode) {\n\t\t\t\theight = height - this._window.defaultBorderSize;\n\t\t\t}\n\t\t\tthis.element.style['max-height'] = height + 'px';\n\t\t\tthis.element.style['min-width'] = this._currentWidth + 'px';\n\t\t}\n\t}" ]
[ "0.6426955", "0.64262205", "0.61829597", "0.61654186", "0.6131967", "0.6058456", "0.6046958", "0.60201263", "0.6006105", "0.60042626", "0.5994593", "0.59876513", "0.5986602", "0.5921952", "0.59200716", "0.5906168", "0.5901126", "0.5884823", "0.5884823", "0.5884242", "0.5850556", "0.58340997", "0.57918453", "0.57915425", "0.5746192", "0.5730607", "0.5728262", "0.5704233", "0.5704194", "0.5692416", "0.5688413", "0.5676574", "0.5673739", "0.5661397", "0.5652663", "0.56427383", "0.5633001", "0.56311655", "0.5616773", "0.5585574", "0.5576541", "0.55603176", "0.55544776", "0.55523014", "0.5551095", "0.55460054", "0.5516463", "0.5513392", "0.5505802", "0.54950976", "0.5487734", "0.5481288", "0.5480378", "0.5474126", "0.5468638", "0.5467813", "0.5467595", "0.5466162", "0.54646957", "0.5459759", "0.54546815", "0.5452119", "0.5451992", "0.54424363", "0.54420036", "0.5437087", "0.54367083", "0.5431576", "0.54313713", "0.542389", "0.542389", "0.5422405", "0.54208565", "0.5414658", "0.5401658", "0.5397588", "0.539582", "0.53956693", "0.5394802", "0.5383883", "0.5378524", "0.5365726", "0.53627414", "0.53622884", "0.53622204", "0.5358597", "0.53574294", "0.53526217", "0.53525144", "0.53522706", "0.53513646", "0.53466886", "0.53360575", "0.5332916", "0.53281397", "0.53252554", "0.53252554", "0.53176683", "0.5315155", "0.53143984" ]
0.5836467
21
firebase authentications upload imege
function uploadImage(fileName){ // Create a root reference var ref = firebase.storage().ref(); const file = fileName.get(0).files[0] const name = (+new Date()) + '-' + file.name const metadata = { contentType: file.type } const task = ref.child(name).put(file, metadata) var image_url = ''; task .then(snapshot => snapshot.ref.getDownloadURL()) .then(url => { image_url = url ; console.log('image name : ' + name) console.log('image url : ' + image_url ); $('#showimg').attr('src',image_url) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "uploadPic(e){e.preventDefault();this.disableUploadUi(true);var imageCaption=this.imageCaptionInput.val();this.generateImages().then(pics=>{// Upload the File upload to Firebase Storage and create new post.\nfriendlyPix.firebase.uploadNewPic(pics.full,pics.thumb,this.currentFile.name,imageCaption).then(postId=>{page(`/user/${this.auth.currentUser.uid}`);var data={message:'New pic has been posted!',actionHandler:()=>page(`/post/${postId}`),actionText:'View',timeout:10000};this.toast[0].MaterialSnackbar.showSnackbar(data);this.disableUploadUi(false)},error=>{console.error(error);var data={message:`There was an error while posting your pic. Sorry!`,timeout:5000};this.toast[0].MaterialSnackbar.showSnackbar(data);this.disableUploadUi(false)})})}", "function uploadToFirebase(image, name){\n var storageRef = firebase.storage().ref('images/' + app.blgName + \"/\"+ name);\n storageRef.put(image).then(function(snapshot){\n storageRef.getDownloadURL().then(function(url) {\n var arg = {\n \"url\": url,\n \"filename\": name\n };\n firebaseUrls.push(arg);\n }).catch(function(error) {\n switch (error.code) {\n case 'storage/object-not-found':\n // File doesn't exist\n console.log(\"File doesn't exist\")\n return false;\n break;\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n console.log(\"User doesn't have permission to access the object\")\n return false;\n break;\n case 'storage/canceled':\n // User canceled the upload\n console.log(\"User canceled the upload\")\n return false;\n break;\n case 'storage/unknown':\n // Unknown error occurred, inspect the server response\n console.log(\"Unknown error occurred, inspect the server response\");\n return false;\n break;\n }\n });\n });\n}", "function uploadUserProfilePic() {\n // Let's assume my storage is only enabled for authenticated users \n // This is set in your firebase console storage \"rules\" tab\n firebase.auth().onAuthStateChanged(function (user) {\n // get Elements \n var uploader = document.getElementById('uploader-progress');\n var fileButton = document.getElementById(\"fileButton\");\n\n // listen for file selection\n fileButton.addEventListener('change', function (e) {\n var file = e.target.files[0]; // Get file with file browser\n var storageRef = firebase.storage().ref(\"images/\" + user.uid + \".jpg\"); // Get reference\n storageRef.put(file); // Upload file\n\n // storage bucket plus folder plus image name, which is the user's doc id\n //var picref = \"gs://mango-smoothie.appspot.com/images/\"+user.uid + \".jpg\";\n\n storageRef.getDownloadURL()\n .then(function(url){ // Get URL of the uploaded file\n console.log(url); // Save the URL into users collection\n db.collection(\"users\").doc(user.uid).update({\n \"profilePic\": url\n })\n })\n })\n })\n}", "function butcli() {\r\n\r\n \t//Finding reference of database\r\n \tvar ref=database.ref('User1');\r\n\t\r\n email = document.getElementById(\"email-header15-1o\").value;\r\n\tname = document.getElementById(\"name-header15-1o\").value;\r\n\tphoneno = document.getElementById(\"phone-header15-1o\").value;\r\n\r\n\t\t//If email is not provided , then dont store it in database\r\n\t\tif(email) {\r\n\t\t\t// Adding Pdf to firebase storage\r\n\t\t\tvar storageRef=firebase.storage().ref(email);\r\n\t\t\tvar task=storageRef.put(pdffile);\r\n\t\t\ttask.on('state_changed',function progress(snapshot)\r\n\t\t\t{\r\n\t\t\t\tvar percentage=snapshot.bytesTransferred/snapshot.totalBytes * 100;\r\n\t\t\t\tconsole.log(\"upload is:\"+percentage +\"Done\");\r\n\t\t\t\tswitch(snapshot.state)\r\n\t\t\t\t{\r\n\t\t\t\t\t\tcase firebase.storage.TaskState.PAUSED:\r\n\t\t\t\t\t\t\t\tconsole.log(\"upload is paused\");\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase firebase.storage.TaskState.RUNNING:\r\n\t\t\t\t\t\t\t\tconsole.log(\"upload is running\");\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t},function(error) {\r\n\t\t\t\t\tconsole.log(error);\r\n\t\t\t},function() { \r\n\t\t\t\t\ttask.snapshot.ref.getDownloadURL().then( \r\n\t\t\t\t\tfunction(downloadURL) { \r\n\t\t\t\t\t\tconsole.log('File available at', downloadURL); \r\n\t\t\t\t\t\tconsole.log(downloadURL); \r\n\t\t\t\t\t\tvar URL=downloadURL;\r\n\r\n\t\t\t\t\t\t//Adding to database\r\n\t\t\t\t\t\tfirebase.database().ref('candidate/'+ phoneno).set({\r\n \t\t\t\t\t\t\tname: name,\r\n\t\t\t\t\t\t\t email: email,\r\n\t\t\t\t\t\t\t phoneno : phoneno\r\n\t\t\t\t\t\t });\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//Redirect to another page\r\n\t\t\t\t\t\tlocation.replace(\"Registration_successful.html\");\r\n\t\t\t\t}); \r\n\t\t\t\tconsole.log(URL);\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\t\tconsole.log(\"Please provide Email id\");\r\n\t\t}\r\n}", "async function signUpNG(email, password, name, pic) {\n //add profile picture to firebase storage.\n const userImagePath = \"users/\" + email + \"/profile\";\n return storage.ref(userImagePath).put(pic).on(\n \"state_changed\",\n (snapshot) => {}, \n error => {console.log(\"Error adding image to storage\", error)},\n () => {\n storage.ref(userImagePath).getDownloadURL().then((url) => {\n // creates user\n const photo = pic? url : null;\n auth.createUserWithEmailAndPassword(email, password).then((user) => {\n db.doc(`users/${user.user.uid}`).set({\n email: email,\n challengeVotes: [],\n notification: [4],\n score: 0,\n level: 1,\n groupId: user.user.uid,\n userName: name,\n profilePic: photo,\n successChallenge: []\n });\n // creates group\n db.doc(`groups/${user.user.uid}`).set({\n usersInGroup: [user.user.uid],\n countGroup: 1,\n currentChallenge: \"\",\n approvedChallenges: [],\n pastChallenges: [],\n })\n }\n ).catch(err => {\n setError(err.message)\n })\n })}) \n }", "function uploadImage(event){\n console.log(event.target.files)\n const file = event.target.files[0];\n this.uploadImageForm.reset();\n\n // Check if the file is an image.\n if (!file.type.match(\"image.*\")) {\n var error = {\n message: \"You can only share images\",\n timeout: 2000,\n };\n alert(data.message);\n return;\n }\n if( checkSignedIn.bind(this)() ){\n let metadata ={\n contentType : file.type\n }\n let currentUser = this.auth.currentUser;\n let message = {\n userName: currentUser.displayName || currentUser.email,\n userId: currentUser.uid,\n imageUrl: LOADING_IMAGE,\n photoUrl: currentUser.photoURL || \"/img/profile_placeholder.png\",\n };\n this.messagesRef.push(message)\n .then(( messageSnapshot )=>{\n this.storageRef.child(`${currentUser.uid}/${Date.now()}/${file.name}`)\n .put(file,metadata)\n .then( ( imgSnapshot ) =>{\n \n let filePath = imgSnapshot.metadata.fullPath;\n messageSnapshot.update({\n imageUrl:this.storage.ref(filePath).toString()\n }) \n })\n .catch(function(error) {\n console.error('There was an error uploading a file to Firebase Storage:', error);\n });\n })\n }\n}", "function storeDataInFirebase() {\r\n var FirstName = $(\"#fname\").val();\r\n var Email = $(\"#email\").val();\r\n var Phone = $(\"#phone\").val();\r\n var Registration_Number = $(\"#reg\").val();\r\n var Age_Above_Sixteen = !document.getElementById(\"age1\").checked;\r\n\r\n\t\r\n\tvar image = document.getElementById(\"fileUpload\").files[0];\r\n\tconsole.log(image);\r\n\tvar imageName = image.name;\r\n\tvar storageRef = storage.ref(\"/images/\" + imageName);\r\n\tvar uploadTask = storageRef.put(pic);\r\n\r\n db.collection(\"users\")\r\n .doc()\r\n .set({\r\n FirstName: FirstName,\r\n Email: Email,\r\n Phone: Phone,\r\n Registration_Number: Registration_Number,\r\n Age_Above_Sixteen: Age_Above_Sixteen,\r\n })\r\n\r\n .then(() => {\r\n\t\tImageSelection();\r\n\t\tuploadTask.snapshot.ref.getDownloadURL().then(\r\n\t\t\tfunction(downloadURL) {\r\n\t\t console.log(downloadURL);\r\n\t\t}).catch(err => console.log(err));\r\n\r\n console.log(\"document written successfully\");\r\n\t\tdocument.cookie = \"name=\" + FirstName;\r\n\t\tdocument.cookie = \"email=\" + Email;\r\n\t var date = new Date();\r\n\t\tdate.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));\r\n\t\tdocument.cookie = \"expires=\" + date + \";\"\r\n $(\".loader\").hide();\r\n window.location.href = \"thankyouPage.html\";\r\n $(\"#memoForm\").trigger(\"reset\");\r\n })\r\n .catch((error) => {\r\n console.error(\"Error writing document: \", error);\r\n });\r\n }", "function storeImage(imageData,a,b){\n var max = 4;\n var name = a.toString().replace(/\\./g,'x')+\"and\"+ b.toString().replace(/\\./g,'y');\n console.log(\"in store image:\"+imageData)\n var storageRef = __WEBPACK_IMPORTED_MODULE_2__backend_js__[\"e\" /* firebase */].storage().ref(name+\"/\");\n // Create a root reference\n\n var imageName = Date.now()+\".image\";\n var uploadTask = storageRef.child(imageName).putString(imageData, 'data_url');\n uploadTask.on('state_changed', function(snapshot){\n // Observe state change events such as progress, pause, and resume\n // code snippet from firebase documentation adapted\n switch (snapshot.state) {\n case __WEBPACK_IMPORTED_MODULE_2__backend_js__[\"e\" /* firebase */].storage.TaskState.PAUSED: // or 'paused'\n console.log('Upload is paused');\n break;\n case __WEBPACK_IMPORTED_MODULE_2__backend_js__[\"e\" /* firebase */].storage.TaskState.RUNNING: // or 'running'\n console.log('Upload is running');\n break;\n }\n}, function(error) {\n // Handle unsuccessful uploads\n}, function() {\n console.log(\"sucess!\")\n var hash = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__backend_js__[\"c\" /* getHash */])(a,b);\n var firebaseRef = __WEBPACK_IMPORTED_MODULE_2__backend_js__[\"e\" /* firebase */].database().ref(\"info\"); //top level <info>\n var infoRef = firebaseRef.child(hash);\n var src = infoRef.child(\"url\");\n src.set(uploadTask.snapshot.downloadURL);\n\n});\n}", "function sendImage() {\n console.log(\"attempting upload\");\n console.log($('#imgInp'));\n\n if ($('#imgInp')[0].files[0]) {\n var file = $('#imgInp')[0].files[0];\n targetFileRef.put(file).then(function (snapshot) {\n console.log('Uploaded.');\n });\n } else {\n console.log(\"No new image to upload.\");\n }\n\n}", "async function signUpJG(email, password, groupId, name, pic) {\n //add profile picture to firebase storage.\n const userImagePath = \"users/\" + email + \"/profile\";\n return storage.ref(userImagePath).put(pic).on(\n \"state_changed\",\n (snapshot) => {}, \n error => {console.log(\"Error adding image to storage\", error)},\n () => {\n storage.ref(userImagePath).getDownloadURL().then((url) => {\n // creates user\n const photo = pic? url : null;\n auth.createUserWithEmailAndPassword(email, password).then( async (user) => {\n db.doc(`users/${user.user.uid}`).set({\n email: email,\n challengeVotes: [],\n notification: [4],\n score: 0,\n level: 1,\n groupId: groupId,\n userName: name,\n profilePic: photo,\n successChallenge: []\n });\n // update group\n const groupRef = db.collection(\"groups\").doc(groupId)\n groupRef.update({\n usersInGroup: firebase.firestore.FieldValue.arrayUnion(user.user.uid),\n countGroup: increment,\n })\n const data = await groupRef.get()\n console.log(\"check data: \", data)\n if (data.data().currentChallenge) {\n db.collection(\"challengeLog\").add({\n groupId: data.data().id,\n userId: user.user.uid,\n challengeId: data.data().currentChallenge,\n counterSuccess: 0,\n dateSuccess: null,\n }).then(() => forceRender());\n }\n \n }).catch(err => console.log(\"Error with join group: \", err));\n })\n }\n )\n }", "function uploadToStorage(file, location, userId) {\n // Create the file metadata\n var metadata = {\n contentType: 'image/jpeg'\n };\n // Upload file and metadata to the object 'images/mountains.jpg'\n var uploadTask = location.put(file, metadata);\n // Listen for state changes, errors, and completion of the upload.\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'\n function(snapshot) {\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED: // or 'paused'\n console.log('Upload is paused');\n break;\n case firebase.storage.TaskState.RUNNING: // or 'running'\n console.log('Upload is running');\n break;\n }\n }, function(error) {\n console.log('照片上傳失敗:', error.message);\n // A full list of error codes is available at\n // https://firebase.google.com/docs/storage/web/handle-errors\n switch (error.code) {\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n break;\n\n case 'storage/canceled':\n // User canceled the upload\n break;\n\n case 'storage/unknown':\n // Unknown error occurred, inspect error.serverResponse\n break;\n }\n }, function() {\n console.log('照片成功上傳');\n // Upload completed successfully, now we can get the download URL\n var downloadURL = uploadTask.snapshot.downloadURL;\n // add icURL to database\n firebase.database().ref('spPrivate/' + userId).update({\n icURL: downloadURL\n })\n .then (function() {\n console.log(\"icURL added to database: \", downloadURL);\n })\n .catch(function(error) {\n console.log(\"Error adding icURL to database: \", error);\n });\n });\n}", "function signUp() {\r\n console.log('you are right');\r\n let name = document.getElementById(\"name\").value;\r\n let email = document.getElementById(\"emails\").value;\r\n let password = document.getElementById(\"passwords\").value;\r\n let img = document.querySelector('#img').files[0];\r\n\r\n firebase.auth().createUserWithEmailAndPassword(email, password)\r\n .then(() => {\r\n var userObj = {\r\n name,\r\n password,\r\n email,\r\n createTime: firebase.database.ServerValue.TIMESTAMP\r\n }\r\n let userId = firebase.auth().currentUser.uid;\r\n let storageRef = firebase.storage().ref().child(`Userimages/${img.name}`)\r\n storageRef.put(img)\r\n .then((snapshot) => {\r\n snapshot.ref.getDownloadURL().then((sanpUrl) => {\r\n userObj.img = sanpUrl\r\n console.log(userObj)\r\n firebase.database().ref('Users/' + userId).set(userObj)\r\n .then((success) => {\r\n swal({\r\n title: \"Your SignUP is Successful Now SignIN\",\r\n text: \"You can use this account to proceed further features\",\r\n icon: \"success\",\r\n button: \"Done\",\r\n });\r\n // document.getElementById('profImg').src = sanpUrl;\r\n // document.getElementById('profName').innerHTML = userObj.name;\r\n document.getElementById('entryPage').style.display = 'none';\r\n document.getElementById('sUPage').style.display = 'none';\r\n document.getElementById('siPage').style.display = 'block';\r\n\r\n\r\n\r\n\r\n\r\n })\r\n .catch((error) => {\r\n\r\n swal({\r\n title: \"Plug In\", text: error.message, icon: \"warning\", button: \"OK\",\r\n });\r\n })\r\n })\r\n\r\n })\r\n .catch((error) => {\r\n\r\n var errorCode = error.code;\r\n var errorMessage = error.message;\r\n swal({\r\n title: \"Connection Error\", text: errorMessage, icon: \"warning\", button: \"OK\",\r\n });\r\n });\r\n\r\n })\r\n .catch((error) => {\r\n var errorCode = error.code;\r\n var errorMessage = error.message;\r\n swal({\r\n title: \"Connection Error\", text: errorMessage, icon: \"warning\", button: \"OK\",\r\n });\r\n });\r\n}", "function signin(){\n var form = new FormData(document.querySelector('form'));\n firebase.auth().signInWithEmailAndPassword(form.get('username'), form.get('password'))\n .then(async success => {\n var user_id = success.user.uid;\n localStorage.setItem('userID',user_id);\n var mob = firebase.database().ref(`users/${user_id}`);\n mob.on('value',function(contact){\n var cont = contact.val();\n localStorage.setItem('mobile',cont.contact);\n })\n window.location.href = \"index.html\"; \n await fetch(`https://function-2a0fa.firebaseio.com/users/${userID}/MyFav.json`);\n \n })\n .catch(function (error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // ...\n });\n return false;\n}", "function auth_Facebook()\n{\n authenticate(new firebase.auth.FacebookAuthProvider());\n}", "function uploadPortraitToStorage(file, location, userId) {\n // Create the file metadata\n var metadata = {\n contentType: 'image/jpeg'\n };\n // Upload file and metadata to the object 'images/mountains.jpg'\n var uploadTask = location.put(file, metadata);\n // Listen for state changes, errors, and completion of the upload.\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'\n function(snapshot) {\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED: // or 'paused'\n console.log('Upload is paused');\n break;\n case firebase.storage.TaskState.RUNNING: // or 'running'\n console.log('Upload is running');\n break;\n }\n }, function(error) {\n console.log('照片上傳失敗:', error.message);\n // A full list of error codes is available at\n // https://firebase.google.com/docs/storage/web/handle-errors\n switch (error.code) {\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n break;\n\n case 'storage/canceled':\n // User canceled the upload\n break;\n\n case 'storage/unknown':\n // Unknown error occurred, inspect error.serverResponse\n break;\n }\n }, function() {\n console.log('照片成功上傳');\n // Upload completed successfully, now we can get the download URL\n var downloadURL = uploadTask.snapshot.downloadURL;\n // add galleryPic1 url to database\n firebase.database().ref('spPublic/' + userId + '/gallery').update({\n galleryPic1: downloadURL\n })\n .then (function() {\n console.log(\"galleryPic1 added to database: \", downloadURL);\n })\n .catch(function(error) {\n console.log(\"Error adding galleryPic1 to database: \", error);\n });\n });\n}", "function uploadFile(){\n\t\nvar filename = selectedFile.name;\n\nvar storageRef = firebase.storage().ref('/images/' + filename);\n\nvar uploadTask = storageRef.put(selectedFile);\n\nuploadTask.on('state_changed',function(snapshot){\n\n},function(error){\n\n},function() {\n // Handle successful uploads on complete\n // For instance, get the download URL: https://firebasestorage.googleapis.com/...\n uploadTask.snapshot.ref.getDownloadURL().then(function(downloadURL) {\n console.log('File available at', downloadURL);\n \n });\n});\n}", "function uploadData(values) {\n var db = firebase.firestore();\n var path = values[\"valueHash\"];\n var newResourceRef = db.collection(\"resources\");\n console.log(values);\n }", "function handleSignUp() {\n var email = document.getElementById('new-login').value;\n var password = document.getElementById('new-senha').value;\n if (email.length < 4) {\n alert('Please enter an email address.');\n return;\n }\n if (password.length < 4) {\n alert('Please enter a password.');\n return;\n }\n // Sign in with email and pass.\n // [START createwithemail]\n firebase.auth().createUserWithEmailAndPassword(email, password).then(function(user) {\n var user = firebase.auth().currentUser;\n updateUserProfile();\n firebaseConnection.database().ref(user.uid).set(\n {\n 'familiars':{\n 1:{'email':user.email, 'uid':user.uid}\n }\n });\n }, function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == 'auth/weak-password') {\n alert('The password is too weak.');\n } else {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n });\n // [END createwithemail]\n}", "submit() {\n this.$q.loadingBar.start(); // uploading image here\n\n const storageRef = this.$storage.ref();\n const professorsRef = storageRef.child(`professors/${(0,uid/* default */.Z)()}`);\n\n if (this.pictureUpload === null) {\n console.log('Its null');\n this.disabledInput = true;\n const docRef = this.$db.collection('UsersData').doc(this.usersDataId);\n return docRef.update({\n Email: this.email,\n Telephone: this.telephone,\n Cabinet: this.cabinet,\n Consultations: this.consultations,\n Carrier: this.carrier\n }).then(() => {\n this.$q.loadingBar.stop();\n this.$q.notify({\n type: 'positive',\n message: 'Podaci uspješno spremljeni'\n });\n }).catch(error => {\n this.$q.loadingBar.stop(); // The document probably doesn't exist.\n\n console.error('Error updating document: ', error);\n this.$q.notify({\n type: 'negative',\n message: 'Podaci nisu uspješno spremljeni'\n });\n });\n } else {\n const uploadTask = professorsRef.put(this.pictureUpload); // upload task\n\n uploadTask.on('state_changed', snapshot => {\n // Observe state change events such as progress, pause, and resume\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n const progress = snapshot.bytesTransferred / snapshot.totalBytes * 100;\n console.log('Upload is ' + progress + '% done');\n\n switch (snapshot.state) {\n case this.$storage.TaskState.PAUSED:\n // or 'paused'\n console.log('Upload is paused');\n break;\n\n case this.$storage.TaskState.RUNNING:\n // or 'running'\n console.log('Upload is running');\n break;\n }\n }, error => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Handle successful uploads on complete\n // For instance, get the download URL: https://firebasestorage.googleapis.com/...\n uploadTask.snapshot.ref.getDownloadURL().then(downloadURL => {\n console.log('File available at', downloadURL);\n this.downloadURL = downloadURL;\n }).then(() => {\n this.disabledInput = true;\n const docRef = this.$db.collection('UsersData').doc(this.usersDataId);\n return docRef.update({\n Email: this.email,\n Telephone: this.telephone,\n Cabinet: this.cabinet,\n Consultations: this.consultations,\n Carrier: this.carrier,\n DownloadURL: this.downloadURL\n }).then(() => {\n this.$q.loadingBar.stop();\n this.$q.notify({\n type: 'positive',\n message: 'Podaci uspješno spremljeni'\n });\n }).catch(error => {\n this.$q.loadingBar.stop(); // The document probably doesn't exist.\n\n console.error('Error updating document: ', error);\n this.$q.notify({\n type: 'negative',\n message: 'Podaci nisu uspješno spremljeni'\n });\n });\n });\n });\n }\n }", "function uploadImage(imageName, image) {\n // Create a root reference\n var storageRef = firebase.storage().ref();\n\n // File or Blob named mountains.jpg\n var file = image;\n imageKeepName = file.name;\n\n // Create the file metadata\n var metadata = {\n contentType: 'image/jpeg'\n };\n\n // Upload file and metadata to the object 'images/mountains.jpg'\n var uploadTask = storageRef.child('images/' + file.name).put(file, metadata);\n\n // Listen for state changes, errors, and completion of the upload.\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, function (snapshot) {\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED: // or 'paused'\n console.log('Upload is paused');\n break;\n case firebase.storage.TaskState.RUNNING: // or 'running'\n console.log('Upload is running');\n break;\n }\n }, function (error) {\n // A full list of error codes is available at\n // https://firebase.google.com/docs/storage/web/handle-errors\n switch (error.code) {\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n break;\n\n case 'storage/canceled':\n // User canceled the upload\n break;\n\n case 'storage/unknown':\n // Unknown error occurred, inspect error.serverResponse\n break;\n }\n }, function () {\n // Upload completed successfully, now we can get the download URL\n downloadURL = uploadTask.snapshot.downloadURL;\n globals.uploaded = true;\n updateImage(downloadURL);\n firebase.database().ref('sessions/' + sessionName).update({\n image: downloadURL\n });\n });\n\n}", "submitChallenge() {\n var referThis = this, title = document.getElementById('titleInput').value,\n description = document.getElementById('descriptionInput').value;\n\n if (title === \"\" || description === \"\") {\n document.getElementById('file_upload_status').innerText = \"Please fill in all fields\";\n } else {\n //get the unique nickname\n var random_title = title + '_' + this.randomString();\n\n //set up the Ref to STORAGE for the video that is to be uploaded\n var videoRef = storageRef.child('users/' + this.props.activeNickname + '/uploaded_video/' + random_title);\n var uploadTask = videoRef.put(this.state.filesToBeSent[0]);\n\n uploadTask.on('state_changed', function (snapshot) {\n //measure the progress of the upload. \n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED:\n console.log('Upload is PAUSED');\n break;\n case firebase.storage.TaskState.RUNNING:\n //console.log('Upload is RUNNING');\n document.getElementById('submitButton').innerText = \"Uploading...: \" + Math.ceil((snapshot.bytesTransferred / snapshot.totalBytes) * 100) + \"%\";\n break;\n default:\n console.log('Uploading...');\n break;\n }\n }, function (error) {\n //There was an error uploading the file. \n document.getElementById('submitButton').innerText = 'Error Uploading File. Please try again later. ';\n referThis.emptyArray();\n }, function () {\n //Success uploading file. \n //Get the download url \n const downloadURL = uploadTask.snapshot.downloadURL;\n //Submit the info to Firestore\n var video_doc_ref = db.collection('videos').doc(referThis.props.activeNickname).collection(random_title).doc('video_info');\n var challenge_ref = db.collection('challenges').doc(referThis.props.uploaderNickname + '_' + referThis.props.activeNickname + '_' + referThis.randomString());\n //console.log('New Document ID: ' + video_doc_ref.id);\n video_doc_ref.set({\n title: title,\n videoURL: downloadURL,\n videoDesc: description,\n tagged: '',\n likes: 0,\n dislikes: 0,\n challenges: 0,\n nickname: referThis.props.activeNickname,\n email: referThis.props.activeUserEmail\n }, { merge: true }).then(function () {\n //This collection will be used to display all the videos on Homepage. \n var all_vid_ref = db.collection('all_videos').doc(random_title);\n all_vid_ref.set({\n title: title,\n videoURL: downloadURL,\n videoDesc: description,\n tagged: '',\n likes: 0,\n dislikes: 0,\n challenges: 0,\n nickname: referThis.props.activeNickname,\n email: referThis.props.activeUserEmail\n }, { merge: true }).then(function () {\n //Success uploading the data\n document.getElementById('submitButton').innerText = \"Upload Success!\";\n //window.location.replace('/check_user_status');\n }).then(function () {\n //Commit the Challngers Video. \n challenge_ref.set({\n challenger: referThis.props.activeNickname,\n challenged: referThis.props.uploaderNickname,\n challengerVotes: 0,\n challengedVotes: 0,\n challengerVideoTitle: title,\n challengedVideoTitle: referThis.props.videoTitle,\n challengedVideoURL: referThis.props.challengedVideoURL,\n challengerVideoURL: downloadURL\n }, { merge: true });\n\n let temp_ref = storageRef.child('users/' + referThis.state.activeNickname + '/temp_video/temp_video_file');\n temp_ref.delete();\n }).then(function () {\n //After challenge is uploaded, go to the challenge's page. \n window.location.replace('/challenge/' + referThis.props.uploaderNickname + '_' + referThis.props.activeNickname + '_' + referThis.randomString());\n });\n }).catch(function (error) {\n document.getElementById('submitButton').innerText = \"Error uploading\";\n });\n });\n }\n\n\n }", "function uploadToStorage(file, storageLocation, databaseLocation) {\n // Create the file metadata\n var metadata = {\n contentType: 'image/jpeg'\n };\n // Upload file and metadata to the object 'images/mountains.jpg'\n var uploadTask = storageLocation.put(file, metadata);\n // Listen for state changes, errors, and completion of the upload.\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'\n function (snapshot) {\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n switch (snapshot.state) {\n case firebase.storage.TaskState.PAUSED: // or 'paused'\n console.log('Upload is paused');\n break;\n case firebase.storage.TaskState.RUNNING: // or 'running'\n console.log('Upload is running');\n break;\n }\n },\n function (error) {\n console.log('照片上傳失敗:', error.message);\n // A full list of error codes is available at\n // https://firebase.google.com/docs/storage/web/handle-errors\n switch (error.code) {\n case 'storage/unauthorized':\n // User doesn't have permission to access the object\n break;\n\n case 'storage/canceled':\n // User canceled the upload\n break;\n\n case 'storage/unknown':\n // Unknown error occurred, inspect error.serverResponse\n break;\n }\n },\n function () {\n console.log('照片成功上傳');\n // Upload completed successfully, now we can get the download URL\n var downloadURL = uploadTask.snapshot.downloadURL;\n // add gallery URL to database\n databaseLocation.set(downloadURL)\n .then(function () {\n console.log(\"Picture added to database: \", downloadURL);\n })\n .catch(function (error) {\n console.log(\"Error adding picture to database: \", error);\n });\n });\n}", "function initializeFirebase(){\n var config = {\n apiKey: \"AIzaSyAg4AuCkuiw4VgVIYtFKU4JQgF0PzfzlTA\",\n authDomain: \"memoize-216516.firebaseapp.com\",\n databaseURL: \"https://memoize-216516.firebaseio.com\",\n projectId: \"memoize-216516\",\n storageBucket: \"memoize-216516.appspot.com\",\n messagingSenderId: \"889544015679\"\n };\n firebase.initializeApp(config);\n \n\n var db = firebase.firestore();\n var storage = firebase.storage();\n return [db,storage];\n\n}", "function uploadPhoto() {\n // event listener when the html file input is changed (to upload image/photo)\n document.getElementById('photo').addEventListener('change', event => {\n console.log('log event');\n\n // Selected File Image is the event target files\n let selectedImgFile = event.target.files[0]\n console.log(selectedImgFile);\n\n // Create a unique file name to pass the reference\n let fileName = 'mePlant' + Date.now() + '.png'\n\n // Assign a metadata (which will show as image/jpeg in storage)\n let metadata = { contentType: 'image/jpeg' }\n\n // Create reference to the firebase app storage\n let storage = getStorage(firebaseApp)\n // Create reference to storage images/ folder and add the unique file name for the images ref\n let imagesRef = ref(storage, 'images/' + fileName)\n // upload to the storage images folder the selected image file and show the metadata\n let uploadTask = uploadBytesResumable(imagesRef, selectedImgFile, metadata)\n\n // Register three observers:\n // 1. 'state_changed' observer, called any time the state changes\n // 2. Error observer, called on failure\n // 3. Completion observer, called on successful completion\n uploadTask.on('state_changed',\n (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n // Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded\n const progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n let uploader = document.getElementById('uploader')\n uploader.value = progress\n\n switch (snapshot.state) {\n case 'paused':\n console.log('Upload is paused');\n break;\n case 'running':\n console.log('Upload is running');\n break;\n }\n },\n (error) => {\n // Handle unsuccessful uploads\n console.log(err)\n },\n () => {\n // Handle successful uploads on complete\n // get the download URL: https://firebasestorage.googleapis.com/...\n getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {\n console.log('File available at', downloadURL);\n imgUrl = downloadURL\n });\n }\n );\n })\n}", "async uploadFile(file, createdId){ \n \n let fileName = file.name\n let ext = fileName.slice( fileName.lastIndexOf('.') ) \n \n // -- Add Original file in firebase storage -- //\n let storageRef = firebase.storage().ref()\n let imagesRef = storageRef.child('gallery/'+createdId+ext) \n\n let uploadState = await imagesRef.put(file).then( function(snapshot) { \n console.log('Uploaded !'); \n return true \n }).catch( (error) => {\n console.log(error)\n return false\n });\n \n return uploadState;\n\n // -- //\n \n }", "verifi({ commit, dispatch }, payload) {\n firebase.auth().createUserWithEmailAndPassword(payload.email, payload.password)\n .then(data => {\n firebase.database().ref('users').child(data.user.uid).set({\n uid: data.user.uid,\n name: payload.name,\n email: payload.email,\n emailverified: true,\n password: payload.password\n });\n let newuser = data.user;\n newuser.updateProfile({\n displayName: payload.name,\n img_url: payload.img_url\n }).then(() => {\n dispatch('verification')\n })\n }).catch(error => {\n console.log(commit('setAlertMessage', error));\n })\n }", "function signupFirebase() {\n\tvar emailValue = document.getElementById('email').value;\n\tvar passwordValue = document.getElementById('password').value;\n\t\n\tvar user = firebase.auth().currentUser;\n\t\n\t// Link user to another provider (Google, Facebook, etc)\n\tif (user) {\n\t\t\n\t\t// Get credential\n\t\tvar credential = firebase.auth.EmailAuthProvider.credential(emailValue, passwordValue);\n\t\t\n\t\t// Link\n\t\tuser.link(credential).then(function(user) {\n\t\t\t // console.log(\"Account linking success\", user);\n\t\t\t // Redirect to home\n\t\t\t window.location.href=\"/members/\"\n\t\t\t}, function(error) {\n\t\t\t console.log(\"Account linking error\", error);\t\t\n\t\t\t addHidden(form, 'error', error.code);\n\t\t\t // Redirect to home\n\t\t\t window.location.href=\"/members/\"\n\t\t});\n\n\t\t\t\n\t// Register User\n\t} else {\n\t\t// Create Account in Firebase\n\t\tfirebase.auth().createUserWithEmailAndPassword(emailValue, passwordValue)\n\t\t\t.then(function() {\n\t\t\t\t// Redirect to home\n\t\t\t\t// console.log(\"correct\");\n\t\t\t\twindow.location.href=\"/members/\"\n\t\t\t})\n\t\t\t.catch(function(error) {\n\t\t\t\t// console.log(error.code, error.message);\n\t\t\t\taddHidden(form, 'error', error.code);\n\t\t\t\twindow.location.href=\"/members/\"\n\t\t\t});\n\t}\n}", "initFirebase({ dispatch, state }) {\n if (!firebase.apps.length) {\n firebase.initializeApp(state.firebaseConfig);\n }\n\n firebase.auth().onAuthStateChanged(async (user) => {\n if (user) {\n // Create an entry for the user\n await firebase.database().ref(`/users/${user.uid}`).set({\n name: user.displayName,\n email: user.email,\n photo_url: user.photoURL,\n });\n\n dispatch('setUser', user);\n dispatch('firebaseFeedback');\n } else {\n dispatch('firebaseFeedback');\n }\n });\n }", "function uploadImage(values, Uri, Filename, userKey, mime = 'image/jpeg') {\n return new Promise((resolve, reject) => {\n const uploadUri = Uri;\n let uploadBlob = null;\n\n // Creates the reference to where the image will be stored in Firebase storage\n const imageRef = Firebase.storage()\n .ref('images/' + userKey)\n .child(Filename);\n\n // Converts the Uri of the image selected into file type that can\n // be uploaded to Firebase \n fs.readFile(uploadUri, 'base64')\n .then(data => {\n return Blob.build(data, {type: `${mime};BASE64`});\n })\n .then(blob => {\n uploadBlob = blob;\n return imageRef.put(blob, {contentType: mime});\n })\n .then(() => {\n uploadBlob.close();\n // Once image is uploaded, a download url is created\n return imageRef.getDownloadURL();\n })\n .then(function(downloadURL) {\n console.log('File available at', downloadURL);\n // download url captured in const so this info can be added to post table\n const url = downloadURL;\n\n AddPost({\n heading: values.heading,\n description: values.description,\n location: selectedValue,\n uri: Uri,\n filename: Filename,\n userkey: userKey,\n url: url,\n });\n })\n .then(url => {\n resolve(url);\n })\n .catch(error => {\n reject(error);\n });\n });\n }", "function signup(){\n var form = new FormData(document.querySelector('form'));\n var userlist = {\n date: (new Date()).toDateString(),\n address:form.get('address'),\n contact:form.get('contact'),\n password:form.get('password'),\n email:form.get('username'),\n lastname:form.get('lname'),\n firstname:form.get('fname')\n };\n firebase.auth().createUserWithEmailAndPassword(form.get('username'), form.get('password'))\n .then(success => {\n userlist = database.ref(`users/${success.user.uid}`).set(userlist);\n document.querySelector('form').reset();\n localStorage.setItem('userID',success.user.uid);\n alert(\"Your Account has been created!!!\");\n window.location.href = \"index.html\";\n return false;\n })\n .catch(error => {\n var err = error.code;\n // console.log(success.code);\n // console.log(success.message);\n });\n return false;\n\n}", "uploadImage(e, method) {\n let imageObj = {};\n\n\n if (method === \"firebase\") {\n\n // // ===========FIREBASE=================\n let currentImageName = \"firebase-image-\" + Date.now();\n\n let uploadImage = storage.ref(`images/${currentImageName}`).put(e.target.files[0]);\n\n uploadImage.on('state_changed',\n (snapshot) => { },\n (error) => {\n alert(error);\n },\n () => {\n storage.ref('images').child(currentImageName).getDownloadURL().then(url => {\n\n this.setState({\n firebaseImage: url\n });\n\n //store image object in the database\n imageObj = {\n imageName: currentImageName,\n imageData: url\n };\n console.log(\"TCL: MarketplaceModal -> uploadImage -> imageObj\", imageObj);\n\n\n // axios.post(`${API_URL}/image/uploadbase`, imageObj)\n // .then((data) => {\n // if (data.data.success) {\n // alert(\"Image has been successfully uploaded using firebase storage\");\n // this.setDefaultImage(\"firebase\");\n // }\n // })\n // .catch((err) => {\n // alert(\"Error while uploading image using firebase storage\")\n // this.setDefaultImage(\"firebase\");\n // });\n })\n })\n }\n\n\n\n //==========this works================\n let file = e.target.files[0];\n\n let storageRef = storage.ref('photos/' + file.name);\n this.setState({ imgUrl: storageRef.location.path }, () => {\n console.log(this.state.imgUrl);\n\n });\n\n\n let task = storageRef.put(file);\n\n // file.on('state_changed',\n // (snapshot) => { },\n // (error) => {\n // alert(error);\n // },\n // () => {\n // storage.ref('photos/').child(file.name).getDownloadURL().then(url => {\n // this.setState({\n // firebaseImage: url\n\n // });\n // })\n // }\n // )\n\n\n\n\n\n }", "function appConfigModule(app, firebase) {\n app.constant(\"Firebase\",firebase);\n app.constant(\"FirebaseUrl\", \"https://scakapo-2f1c6.firebaseio.com/\");\n app.constant(\"MainState\",\"main.profile\");\n app.constant(\"UploadStatus\",{\n error:\"error uploading\",\n success:\"upload successful\"\n });\n\n\n\n\n //initialize firebase\n require(\"../firebase/firebase.config\")(firebase);\n\n // function that will configure app\n function appConfigFunction($firebaseRefProvider, $stateProvider, $urlRouterProvider, FirebaseUrl) {\n\n //firebase default url\n $firebaseRefProvider.registerUrl({\n\n //profile\n default: FirebaseUrl,\n profiles: FirebaseUrl + \"profiles\",\n profilePhotos:FirebaseUrl+\"profile-photos\",\n connected:FirebaseUrl+\"connected\",\n\n //public room refs\n userRooms:FirebaseUrl+\"user-rooms\",\n rooms:FirebaseUrl+\"rooms\",\n roomUsers:FirebaseUrl+\"room-users\",\n roomMessages:FirebaseUrl+\"room-messages\",\n\n //private rooms ref\n userPrivateRooms:FirebaseUrl+\"user-privates\",\n privateRooms:FirebaseUrl+\"private-rooms\",\n privateRoomUsers:FirebaseUrl+\"private-room-users\",\n privateRoomMessages:FirebaseUrl+\"private-room-messages\",\n\n //queue to join user\n joinPrivateQueue:FirebaseUrl+\"join-private-room/tasks\"\n });\n\n\n //auth states\n $stateProvider\n\n // --- AUTH STATES --- //\n .state(\"auth\", {\n abstract: true,\n url: \"/auth\",\n template: \"<auth-main></auth-main>\"\n })\n .state(\"auth.login\", {\n url: \"/login\",\n template: \"<auth-login></auth-login>\"\n })\n .state(\"auth.register\", {\n url: \"/register\",\n template: \"<auth-register></auth-register>\"\n })\n\n // --- MAIN COMPONENT --- ///;\n .state(\"main\", {\n abstract:true,\n template: \"<main></main>\",\n resolve: {\n Authentication: [\"Auth\", function (Auth) {\n return Auth.$requireSignIn();\n }]\n }\n\n })\n // ---- profile route ---- //\n .state(\"main.profile\",{\n url:\"/profile\",\n template:\"<profile></profile>\",\n resolve:{\n Profile:[\"Auth\",function(Auth){\n return Auth.$requireSignIn();\n\n\n }]\n }\n })\n // ---- chat route ---- //\n .state(\"main.chat\",{\n url:\"/chat\",\n template:\"<chat-main></chat-main>\"\n })\n\n // ---- see others user profile page ---- //\n .state(\"main.user\",{\n url:\"/user/:id\",\n template:\"<user user='$resolve.User'></user>\",\n resolve:{\n Profile:[\"Auth\",function(Auth){\n return Auth.$requireSignIn();\n }],\n User:[\"UserService\",\"$stateParams\",function(UserService,$stateParams){\n console.log($stateParams.id);\n return UserService.GetProfile($stateParams.id);\n }]\n }\n\n });\n\n\n //if none of the states match\n $urlRouterProvider.otherwise(\"/profile\");\n }\n\n\n //inject firebase ref provider to make app testable\n appConfigFunction.$inject = [\"$firebaseRefProvider\", \"$stateProvider\", \"$urlRouterProvider\", \"FirebaseUrl\"];\n\n\n //app configuration\n app.config(appConfigFunction);\n\n\n app.run([\"$rootScope\", \"$state\",\"$firebaseRef\",\"Auth\",\"toastr\", function ($rootScope, $state,$firebaseRef,Auth,toastr) {\n\n //catch state change\n $rootScope.$on(\"$stateChangeStart\",function(event, toState, toParams, fromState, fromParams, options){\n\n\n if(toState.name == \"main.chat\"){ //if going to chat check if user set its username on profile\n\n const user = Auth.$getAuth();\n\n //if user logged\n if(user){\n $firebaseRef.profiles.child(user.uid).once(\"value\")\n .then(snap=>{\n if(snap.child(\"username\").exists()){ //username exists\n $state.go(\"main.chat\"); //go to chat\n }\n else{\n event.preventDefault();\n $state.go(\"main.profile\"); //username wasnt set, go to profile\n toastr.error(\"Set your username first.\",\"Error\");\n }\n });\n }\n\n }\n });\n //catch auth error\n // for ui-router\n $rootScope.$on(\"$stateChangeError\", function (event, toState, toParams, fromState, fromParams, error) {\n // We can catch the error thrown when the $requireSignIn promise is rejected\n // and redirect the user back to the home page\n event.preventDefault();\n if(error){\n console.log(\"error\",error);\n }\n if (error === \"AUTH_REQUIRED\") {\n console.log(\"Not Authorized\");\n $state.go(\"auth.login\");\n }\n });\n }]);\n\n}", "function signIN() {\n\tvar database = firebase.database();\n\tvar form = document.getElementsByClassName(\"short\");\n\tconsole.log(form[0].value);\n\tfirebase.auth().createUserWithEmailAndPassword(form[1].value, form[3].value).then(function () {\n\t\tconsole.log(\"OK\");\n\t\tvar user = firebase.auth().currentUser;\n\t\thideAndShow(\"tenth\");\n\t\t/*\tuser \t\n\t\t\t\t\tname:form[0].value,\n\t\t\t\t\tteam: form[2].value,\n\t\t\t\t\temail: form[1].value*/\n\t\tuser.updateProfile({\n\t\t\tdisplayName: form[0].value\n\n\t\t}).then(function () {\n\t\t\t// Update successful.\n\t\t}).catch(function (error) {\n\t\t\t// An error happened.\n\t\t});\n\n\t}).catch(function (error) {\n\t\t// Handle Errors here.\n\t\tvar errorCode = error.code;\n\t\tvar errorMessage = error.message;\n\t\tconsole.log(\"BAD\");\n\t\t// ...\n\t});\n}", "function uploadData(){\r\n getReadingSpeed();\r\n var r = localStorage.getItem('ReadingSpeed');\r\n var p = localStorage.getItem('Password');\r\n var e = localStorage.getItem('Email');\r\n var m = localStorage.getItem('Major');\r\n var u = localStorage.getItem('UserName');\r\n var l = localStorage.getItem('LastName');\r\n var f = localStorage.getItem('FirstName');\r\n database.ref(\"Users/\").push(\r\n {\r\n FirstName:f,\r\n LastName:l,\r\n FullName: u,\r\n Major:m,\r\n Email:e,\r\n Password:p,\r\n ReadingSpeed:r\r\n });\r\n}", "function handleSignUp() {\n var email = document.getElementById('email').value;\n var password = document.getElementById('password').value;\n\n // Sign in with email and pass.\n // [START createwithemail]\n firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == 'auth/weak-password') {\n alert('The password is too weak.');\n } else {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n });\n // [END createwithemail]\n\n function sendEmailVerification() {\n // [START sendemailverification]\n firebase.auth().currentUser.sendEmailVerification().then(function() {\n // Email Verification sent!\n // [START_EXCLUDE]\n alert('Email Verification Sent!');\n // [END_EXCLUDE]\n });\n // [END sendemailverification]\n }\n\n function sendPasswordReset() {\n var email = document.getElementById('email').value;\n // [START sendpasswordemail]\n firebase.auth().sendPasswordResetEmail(email).then(function() {\n // Password Reset Email Sent!\n // [START_EXCLUDE]\n alert('Password Reset Email Sent!');\n // [END_EXCLUDE]\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == 'auth/invalid-email') {\n alert(errorMessage);\n } else if (errorCode == 'auth/user-not-found') {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n });\n // [END sendpasswordemail];\n }\n}", "function onGit() {\n const provider = new firebase.auth.GithubAuthProvider();\n\n firebase.auth().signInWithPopup(provider)\n\n .then(result => {\n const user = result.user;\n createUser(user);\n })\n .catch(console.log)\n\n}", "uploadPDF(e) {\n if (e.target.files[0] !== null) {\n const uploadTask = storage\n .ref(`users/${e.target.files[0].name}`)\n .put(e.target.files[0]);\n uploadTask.on(\n \"state_changed\",\n snapshot => {},\n error => {\n //error function\n console.log(error);\n },\n () => {\n //complete function\n storage\n .ref(\"users\")\n .child(e.target.files[0].name)\n .getDownloadURL()\n .then(url => {\n this.setState({ notice_attachments: url });\n console.log(\"Hello \" + url);\n });\n }\n );\n } else {\n }\n }", "signUpUser({ commit }, payload) {\n commit('setLoading', true);\n commit('clearError');\n firebase.auth().createUserWithEmailAndPassword(payload.email, payload.password)\n .then((user) => {\n commit('setLoading', false);\n const newUser = {\n id: user.uid,\n bloks: [],\n };\n commit('setUser', newUser);\n db.collection('Users').add(ref.id)\n .then(() => {\n\n })\n .catch((err) => {\n console.log(err)\n })\n }).catch((error) => {\n commit('setLoading', false);\n commit('setError', e);\n });\n }", "async uploadArticle(payload, rootState) {\n try {\n this.updateBusyState(true);\n const facultyId = rootState.userProfile.facultyId;\n const data = {\n title: payload.title,\n description:\n payload.description !== undefined ? payload.description : \"\",\n timestamp: moment().valueOf(),\n studentId: rootState.userProfile.uid,\n isPublish: false,\n eventId: payload.eventId,\n facultyId: facultyId,\n status: \"Unpublish\"\n };\n const articleRef = firebase.firestore().collection(\"articles\");\n const resultRef = await articleRef.add(data);\n\n const pathsForDownload = new Array();\n const paths = { documents: new Array(), images: new Array() };\n\n for (const file of payload.files) {\n const t = await uploadFile(resultRef.id, file);\n const response = await t.json();\n console.log(response.file);\n pathsForDownload.push({\n path: response.file,\n name: file.name,\n uid: file.uid,\n type: file.type\n });\n if (\n file.name.split(\".\")[1] === \"doc\" ||\n file.name.split(\".\")[1] === \"docx\"\n ) {\n paths.documents.push(response.file);\n } else {\n paths.images.push(response.file);\n }\n }\n\n articleRef.doc(resultRef.id).set(\n {\n paths,\n pathsForDownload\n },\n { merge: true }\n );\n\n const facultyEmails = await firebase\n .firestore()\n .collection(\"users\")\n .where(\"facultyId\", \"==\", facultyId)\n .where(\"role\", \"==\", \"COORD\")\n .get();\n const mails = [];\n facultyEmails.forEach(doc => {\n mails.push(doc.data().email);\n });\n\n fetch(\"/api/articles/send_email\", {\n method: \"POST\",\n headers: new Headers({ \"Content-Type\": \"application/json\" }),\n credentials: \"same-origin\",\n body: JSON.stringify({\n mail: mails,\n subject: \"New uploaded articles\",\n html: `<p>There is new article updated with title: ${\n data.title\n } and by: ${\n rootState.userProfile.email\n }. Please make comment within 14 days</p>`\n })\n });\n\n const counterRef = firebase.firestore().collection(\"counter\");\n const counterResult = await counterRef.doc(payload.eventId).get();\n const counterData = {\n contributions: counterResult.data().contributions + 1,\n contributionsByFaculty: {\n [facultyId]:\n counterResult.data().contributionsByFaculty[facultyId] !==\n undefined\n ? counterResult.data().contributionsByFaculty[facultyId] + 1\n : 1\n },\n contributionsWithoutComment:\n counterResult.data().contributionsWithoutComment + 1,\n contributors:\n _.findIndex(\n rootState.article.all,\n i => i.eventId === payload.eventId\n ) === -1\n ? counterResult.data().contributors + 1\n : counterResult.data().contributors === 0\n ? 1\n : counterResult.data().contributors,\n contributorsByFaculty: {\n [facultyId]:\n counterResult.data().contributorsByFaculty[facultyId] !==\n undefined\n ? _.findIndex(\n rootState.article.all,\n i => i.eventId === payload.eventId\n ) === -1\n ? counterResult.data().contributors + 1\n : counterResult.data().contributors === 0\n ? 1\n : counterResult.data().contributors\n : 1\n }\n };\n counterRef.doc(payload.eventId).set(counterData, { merge: true });\n\n this.fetchArticles();\n message.success(\"Upload successfully\");\n } catch (er) {\n console.log(er);\n message.error(er.message);\n } finally {\n this.updateBusyState(false);\n }\n }", "function initApp() {\n // Result from Redirect auth flow.\n // [START getidptoken]\n firebase.auth().getRedirectResult().then(function(result) {\n if (result.credential) {\n // This gives you a GitHub Access Token. You can use it to access the GitHub API.\n var token = result.credential.accessToken;\n // [START_EXCLUDE]\n // document.getElementById('quickstart-oauthtoken').textContent = token;\n } else {\n // document.getElementById('quickstart-oauthtoken').textContent = 'null';\n // [END_EXCLUDE]\n }\n // The signed-in user info.\n var user = result.user;\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // The email of the user's account used.\n var email = error.email;\n // The firebase.auth.AuthCredential type that was used.\n var credential = error.credential;\n // [START_EXCLUDE]\n if (errorCode === 'auth/account-exists-with-different-credential') {\n alert('You have already signed up with a different auth provider for that email.');\n // If you are using multiple auth providers on your app you should handle linking\n // the user's accounts here.\n } else {\n console.error(error);\n }\n // [END_EXCLUDE]\n });\n // [END getidptoken]\n // Listening for auth state changes.\n // [START authstatelistener]\n firebase.auth().onAuthStateChanged(function(user) {\n if (user) {\n //document.getElementById('user-info').css(\"display\", \"block\");\n // User is signed in.\n var displayName = user.displayName;\n var email = user.email;\n var emailVerified = user.emailVerified;\n var photoURL = user.photoURL;\n var isAnonymous = user.isAnonymous;\n var uid = user.uid;\n var providerData = user.providerData;\n var currentUser = JSON.stringify(user, null, ' ');\n // user.getToken().then(function(idToken) {\n // getUser(idToken);\n // });\n // [START_EXCLUDE]\n // document.getElementById('quickstart-sign-in-status').textContent = 'Signed in';\n document.getElementById('quickstart-sign-in').textContent = 'Sign out';\n // document.getElementById('quickstart-account-details').textContent = currentUser;\n // document.getElementById('user-photo').attr('src', photoURL);\n // document.getElementById('user-name').textContent = displayName;\n // [END_EXCLUDE]\n } else {\n // User is signed out.\n // [START_EXCLUDE]\n //document.getElementById('quickstart-sign-in-status').textContent = 'Signed out';\n document.getElementById('quickstart-sign-in').textContent = 'Sign in with GitHub';\n //document.getElementById('quickstart-account-details').textContent = 'null';\n //document.getElementById('quickstart-oauthtoken').textContent = 'null';\n // [END_EXCLUDE]\n }\n // [START_EXCLUDE]\n document.getElementById('quickstart-sign-in').disabled = false;\n // [END_EXCLUDE]\n });\n // [END authstatelistener]\n document.getElementById('quickstart-sign-in').addEventListener('click', toggleSignIn, false);\n}", "function postCrumb() {\r\n if (document.getElementById('image-upload').files.length == 0) {\r\n worldViewAlert(\"Choose a picture to upload\", 'gold', 3000)\r\n }\r\n if (userMyPosition) {\r\n console.log(uploadCrumbImg);\r\n userMyLat = userMyPosition.lat();\r\n userMyLng = userMyPosition.lng();\r\n var selectedImg = uploadCrumbImg;\r\n console.log(selectedImg);\r\n var imageName = document.getElementById('image-upload').files[0].name;\r\n var storageRef = firebase.storage().ref('/crumbImages/' + imageName);\r\n var uploadTask = storageRef.put(selectedImg);\r\n uploadTask.on(\"state_changed\", (snapshot) => {\r\n //monitor the progress of the upload\r\n worldViewAlert('Uploading Crumb. Just a sec...', 'gold', 3000);\r\n }, (error) => {\r\n worldViewAlert(\"Error with pic upload: \" + error.code, 'red', 2000) //make this more sophsticated later\r\n }, () => { //successful upload\r\n uploadTask.snapshot.ref.getDownloadURL().then((downloadURL) => {\r\n let rightNow = Date.now();\r\n let data = {\r\n time: rightNow,\r\n coords: { lat: userMyLat, lng: userMyLng },\r\n user: uid, //not name because eventually I wanna link to that user's profile\r\n imgURL: downloadURL,\r\n caption: $(\"#caption\").val()\r\n }\r\n dbKey = dbRef.push(data, () => {\r\n firebase.database().ref('users/' + uid + '/crumbs/' + dbKey.key).set(\"true\");\r\n geoFire.set(dbKey.key, [userMyLat, userMyLng]).then(() => {\r\n $('#postCrumb').popup('close')\r\n worldViewAlert(`Your Crumb has been posted, ${firstname}. :)`, 'green');\r\n setTimeout(() => {\r\n $(\"#worldViewAlert\").empty();\r\n }, 3000)\r\n }, (error) => {\r\n console.log(\"Error: \" + error.message);\r\n })\r\n\r\n }); //push the crumb metaDat and then push key under user history and push geoFire ref\r\n\r\n })\r\n }\r\n\r\n )\r\n\r\n } else {\r\n $('#worldViewAlert').text(\"Sorry :( You can't post a crumb without geolocation\");\r\n }\r\n }", "function handleSignUp() {\n var handleSignUpResult = true;\n //\n checkSignUpForm();\n /*\n var email = document.getElementById('inputEmail').value;\n var password = document.getElementById('inputPassword').value;\n // Sign in with email and pass.\n firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {\n handleSignUpResult = false;\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n if (errorCode == 'auth/email-already-in-use') {\n showErrorModal(\"已經有相同帳號存在於資料庫中\");\n } else if (errorCode == 'auth/invalid-email') {\n showErrorModal(\"信箱位址不合法\");\n } else if (errorCode == 'auth/operation-not-allowed') {\n showErrorModal(\"帳號已經被停用\");\n } else if (errorCode == 'auth/weak-password') {\n showErrorModal(\"密碼強度太弱,請重新輸入\");\n }\n console.log(error);\n });\n */\n\n $('.ui.basic.modal.loadiinngg').modal('show');\n\n // 這邊要延遲一段時間之後再執行,要等到 firbase 那邊有回傳\n var delay = 2000; //1 second\n setTimeout(function() {\n if (handleSignUpResult == true) {\n registerSuccessful();\n }\n }, delay);\n}", "function setFacebookUserInfo() {\n // sets end point in current json\n var ref = new Firebase(\"https://learninganalytics.firebaseio.com\");\n // sets endpoint level in json\n var usersRef = ref.child(\"users\");\n // gets email value from text input field\n var emailValue = $('#email-text-input').val();\n\n FB.api(\"/me\", function(response) {\n // send json object to firebase\n usersRef.push({\n LRSHTTPPassword: $('#individualLRSPass').val(),\n LRSHTTPUsername: $('#individualLRSUser').val(),\n email: emailValue,\n fbID: response.id,\n name: response.name\n });\n alert('Registration complete.');\n });\n}", "async uploadImageToFirebase(imageData, imgTypeName, ID) {\n return new Promise(async (resolve) => {\n let date = moment(new Date()).format(\"YYYYMMDDHHmmss\");\n const storageRef = storage()\n .ref(imgTypeName + \"-\" + ID + \"-\" + date)\n .putFile(imageData);\n storageRef.on(\n `state_changed`,\n (snapshot) => {\n this.uploadValue =\n (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n },\n (error) => {\n console.log(error.message);\n },\n async () => {\n this.uploadValue = 100;\n storageRef.snapshot.ref.getDownloadURL().then((url) => {\n resolve(url);\n });\n }\n );\n });\n }", "function handleSignUp() {\n var newProvider = {};\n var email = $('#signUpPage-email').val();\n newProvider.email = $('#signUpPage-email').val();\n // var email = document.getElementById('email').value;\n var password = $('#signUpPage-password').val();\n // var password = document.getElementById('password').value;\n newProvider.displayName = $('#providerName').val();\n console.log(\"in handleSignUp - newProvider.displayName: \", newProvider.displayName);\n\n if (email.length < 4) {\n alert('Please enter an email address.');\n return;\n }\n if (password.length < 4) {\n alert('Please enter a password.');\n return;\n }\n // Sign in with email and pass.\n // [START createwithemail]\n firebase.auth().createUserWithEmailAndPassword(email, password).then(function(user) {\n provider = newProvider;\n /**here I can update the firebase user object.\n afire base user has the following properties:\n id (unique)\n email (unique)\n display name\n photo url\n **/\n var user = firebase.auth().currentUser;\n user.updateProfile({\n displayName: newProvider.displayName\n }).then(function() {\n // Update successful.\n }, function(error) {\n // An error happened.\n alert(error);\n console.log(\"FAILED did not updat user displayName\");\n });\n }, function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == 'auth/weak-password') {\n alert('The password is too weak.');\n } else {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n // Adding extra data on the user to my Users database\n var updates = {};\n updates[\"/providers/\"+newProvider.displayName] = newProvider;\n return dbProviderReference.ref().update(updates);\n });\n // [END createwithemail]\n}", "onSignIn(googleUser) {\n console.log('Google Auth Response', googleUser);\n // We need to register an Observer on Firebase Auth to make sure auth is initialized.\n const unsubscribe = firebase.auth().onAuthStateChanged(function(firebaseUser) {\n unsubscribe();\n // Check if we are already signed-in Firebase with the correct user.\n if (!this.isUserEqual(googleUser, firebaseUser)) {\n // Build Firebase credential with the Google ID token.\n const credential = firebase.auth.GoogleAuthProvider.credential(\n googleUser.idToken,\n googleUser.accessToken\n );\n // Sign in with credential from the Google user.\n firebase.auth().signInWithCredential(credential)\n .then(function(result) {\n console.log('user signed in!');\n console.log('result.user.uid is', result.user.uid);\n console.log('firebase.auth() is', firebase.auth().currentUser.uid)\n\n if (result.additionalUserInfo.isNewUser) {\n firebase.database().ref(`/users/${result.user.uid}`)\n .set({\n gmail: result.user.email,\n first_name: result.additionalUserInfo.profile.given_name,\n created_at: Date.now()\n })\n } else {\n firebase.database().ref(`/users/${result.user.uid}`)\n .update({\n last_logged_in: Date.now()\n })\n }\n })\n .catch(function(error) {\n // Handle Errors here.\n const errorCode = error.code;\n const errorMessage = error.message;\n // The email of the user's account used.\n const email = error.email;\n // The firebase.auth.AuthCredential type that was used.\n const credential = error.credential;\n // ...\n });\n } else {\n console.log('User already signed-in to Firebase.');\n }\n }.bind(this));\n }", "async authUser({ commit }, authData) {\n let authURl =\n \"https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=\" +\n process.env.firebaseKEY;\n if (!authData[1]) {\n authURl =\n \"https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=\" +\n process.env.firebaseKEY;\n }\n try {\n const res = await axios.post(authURl, { ...authData[0] });\n commit(\"SET_TOKEN\", res.data.idToken);\n localStorage.setItem('token', res.data.idToken);\n localStorage.setItem('tokenExpiration', new Date().getTime() + Number.parseInt(res.data.expiresIn) * 1000);\n cookie.set('jwt', res.data.idToken)\n cookie.set('expirationDate', new Date().getTime() + Number.parseInt(res.data.expiresIn) * 1000)\n return await axios.post('http://localhost:3000/api/track-data', {\n data: \"I have connected\"\n })\n } catch (e) {\n console.log(e.response);\n }\n }", "function initialize_firebase() {\n // Initialize Firebase\n\n firebase.initializeApp(firebase_configuration);\n firebase_ref = firebase;\n firebase_database = firebase.database();\n firebase_authentication = firebase.auth();\n firebase_storage = firebase.storage();\n console.log(\"Firebase Initialized\");\n\n // Setup authentiation state change action\n firebase_authentication.onAuthStateChanged(on_authentication_state_changed);\n\n // Setup sign-in Page\n setup_sign_in_controls();\n}", "function writeToDb( emailw,namew ,reg_now, uid,val){\nvar dataToPut = {\n email : emailw,\n name : namew,\n regno : reg_now,\n uid : uid\n };\n firebase.database().ref(val+'/' + uid).set(dataToPut).then(function() {\n window.location.href = \"login.html\";\n });;\n}", "function login(emailElement,passwordElement){let email=emailElement.value;let password = passwordElement.value;firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL).then(() => {return firebase.auth().signInWithEmailAndPassword(email, password);}).catch((error) => {var errorCode = error.code;var errorMessage = error.message;});}", "function signUpGoo() {\n\n const provider = new firebase.auth.GoogleAuthProvider();\n firebase.auth().signInWithPopup(provider)\n .then(function(result) {\n // This gives you a Google Access Token. You can use it to access the Google API.\n var token = result.credential.accessToken;\n // The signed-in user info.\n var user = result.user;\n // ...\n window.location.hash = \"#welcome\";\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // The email of the user's account used.\n var email = error.email;\n // The firebase.auth.AuthCredential type that was used.\n var credential = error.credential;\n // ...\n })}", "async function firebasedb(ann_title,ann_description,ann_imageurl,ann_date){\n\t\n\t\n\tawait db.collection(\"announcement\").add({\n\n title: ann_title,\n description: ann_description,\n\timageurl: ann_imageurl,\n\tdate: ann_date\n\t\t\n\t}).then(async function(docRef) {\n\t\tconsole.log(\"Document written with ID: \", docRef.id);\n\t\tconsole.log(blob);\n\t\tvar announceref = storage.ref().child(\"announcement/\"+url);\n\t\t\n\t\tannounceref.put(blob).then(function(snapshot) {\n\t\t\tconsole.log('Uploaded a blob or file!');\n\t\t\t\n\t\t\t\n\t\t\tsnapshot.ref.getDownloadURL().then(function(downloadURL) {\n\t\t\t\tconsole.log(\"File available at\", downloadURL);\n\t\t\t\tvar annc_form = document.getElementById(\"annc-form\");\n\t\t\t\t\n\t\t\t\tvar input = document.createElement(\"input\");\n\t\t\t\tinput.type = \"hidden\";\n\t\t\t\tinput.name = \"imageurl\";\n\t\t\t\tinput.value = downloadURL;\n\t\t\t\tannc_form.appendChild(input);\n\t\t\t\t\n\t\t\t\tannc_form.submit();\n\t\t\t});\n\t\t\t\n\t\t});\n\t\t\n\t}).catch(function(error) {\n\t\tconsole.error(\"Error adding document: \", error);\n\t});\n}", "function registrar(email ,password){\n\n firebase.auth().createUserWithEmailAndPassword(email,password).then((result)=> {\n firebase.auth().signInWithEmailAndPassword(email,password).then((result2)=> {\n window.location.hash = \"#welcome\";\n}) \n})\n.catch( function(error) {\nconst errorCode = error.code;\nconst errorMessage = error.message;\n});\n}", "async function firebasedb(ann_title,ann_description,ann_imageurl,ann_date){\n\t\n\tawait db.collection(\"announcement\").add({\n\n title: ann_title,\n description: ann_description,\n\timageurl: ann_imageurl,\n\tdate: ann_date\n\t\t\n\t}).then(function(docRef) {\n\t\tconsole.log(\"Document written with ID: \", docRef.id);\n\t\tconsole.log(blob);\n\t\tvar announceref = storage.ref().child(\"announcement/\"+url);\n\t\t\n\t\tannounceref.put(blob).then(function(snapshot) {\n\t\t\tconsole.log('Uploaded a blob or file!');\n\t\t});\n\t\t\n\t\t\n\t}).then(() =>{\n\t\t\n\t}).catch(function(error) {\n\t\tconsole.error(\"Error adding document: \", error);\n\t});\n}", "uploadFile(accessToken, file, todoId) {\n\n var upload = this.app.Upload();\n upload = upload.setFile(file.path);\n return upload\n .save()\n .then((result) => {\n\n fs.unlink(file.path);\n // fetch the uploaded object and then save the uid for the particular todo\n var uploadId = result.toJSON().uid;\n var updateObject = this.dbObject({\n 'uid': todoId\n })\n .pushValue('uploads', uploadId);\n updateObject = updateObject.setHeader('access_token', accessToken);\n return this.makePromise(updateObject.save());\n });\n }", "function startFirebase() {\n// Initialize Firebase\n var config = {\n apiKey: \"AIzaSyDAraVHUUUkR4L0yNE3P2n2jiF2jTNy6Kg\",\n authDomain: \"rps-multiplayer-e8125.firebaseapp.com\",\n databaseURL: \"https://rps-multiplayer-e8125.firebaseio.com\",\n projectId: \"rps-multiplayer-e8125\",\n storageBucket: \"rps-multiplayer-e8125.appspot.com\",\n messagingSenderId: \"763015821378\"\n };\n\n firebase.initializeApp(config);\n\n}", "function handleFileUploadSubmit4(e) {\n const uploadTask = storageRef.child(`${idPlace}/4`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_4').disabled = true\n document.querySelector('#file-submit_4').innerHTML = 'subiendo'\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_4').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_4').innerHTML = 'listo'\n document.querySelector('#file-submit_4').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }//end handleFileUploadSubmit2", "uploadUserData() {\n console.log('upload userData...')\n }", "async uploadImage(context, { file, name }) {\n const storage = firebase.storage().ref();\n const doc = storage.child(`uploads/${name}`);\n\n await doc.put(file);\n const downloadURL = await doc.getDownloadURL();\n return downloadURL;\n }", "function firebasePush() {\n\n\n //prevents from braking\n if (!firebase.apps.length) {\n firebase.initializeApp(config);\n }\n\n //push itself\n var mailsRef = firebase.database().ref('emails').push().set(\n {\n Name: Name.value,\n Email: Email.value,\n Message: Message.value\n }\n );\n success();\n}", "handleUpload (event) {\n const file = event.target.files[0];\n const storageRef = firebase.storage().ref(`photos/${file.name}`);\n const task = storageRef.put(file);\n\n task.on('state_changed', snapshot => {\n let percentage = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n this.setState({\n uploadValue: percentage\n })\n }, error => {\n console.error(error.message);\n }, () => {\n // Upload complete\n const record = {\n photoURL: this.state.user.photoURL,\n displayName: this.state.user.displayName,\n image: task.snapshot.downloadURL\n }\n const dbRef = firebase.database().ref('pictures');\n const newPicture = dbRef.push();\n newPicture.set(record);\n });\n }", "function phoneAuth() {\n //get the number\n var number=document.getElementById('number').value;\n //phone number authentication function of firebase\n\n //check invalid characters (space)\n if (number.includes(\" \")){\n valid = false\n document.getElementById(\"error\").innerHTML = \"<p>Phone number obtain contains invalid characters. Please avoid using spaces and try again</p>\";\n }\n //it takes two parameter first one is number,,,second one is recaptcha\n\n firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION).then(()=>\n //the Persistence of the authentication is 'SESSION'. If window closed, then no longer signed in.\n firebase.auth().signInWithPhoneNumber(number,window.recaptchaVerifier).then(function (confirmationResult) {\n //s is in lowercase\n window.confirmationResult=confirmationResult;\n coderesult=confirmationResult;\n document.getElementById(\"input-pin\").innerHTML = \"It might take a minute to send the SMS to your phone.\\n Once the SMS with the PIN has been sent to your phone. Please insert the pin below.\";\n document.getElementById(\"input-pin\").style.color = \"green\";\n\n // alert(\"Message sent\");\n }).catch(function (error) {\n alert(error.message);\n document.getElementById(\"input-pin\").innerHTML = \"\";\n\n })\n )\n}", "function Registrar() {\n var email = document.getElementById('email').value;\n var password = document.getElementById('password').value;\n if (email.length < 4) {\n alert('Porfavor ingresa un correo electronico.');\n return;\n }\n if (password.length < 4) {\n alert('Porfavor ingresa una contraseña.');\n return;\n }\n // Sign in with email and pass.\n // [START createwithemail]\n firebase.auth().createUserWithEmailAndPassword(email, password)\n .then(function(){\n toggleSignIn();\n sendEmailVerification();\n })\n .catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == 'auth/weak-password') {\n alert('La contraseña es demasiado débil.');\n } else {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n });\n // [END createwithemail]\n}", "handleSubmit(event) {\n event.preventDefault()\n\n this.setState({\n loading: true\n })\n const ipfs = new IPFS({\n host: 'ipfs.infura.io',\n port: 5001,\n protocol: 'https'\n })\n\n if (this.state.document !== '' & this.state.password !== '' & this.state.passwordhint !== '') {\n const encrypteddata = this.encryptthisfile(this.state.document,this.state.password) //password from input to be passed here\n ipfs.add(encrypteddata, async (err, _hash) => {\n if (err) {\n this.setState({\n failure: `Error occured: ${err.message}`\n })\n } else {\n this.setState({\n modalOpen: true,\n hash: _hash,\n password: '',\n success: `Success! Your hash: ${_hash}`\n })\n if (firebase.auth().currentUser !== null) {\n const useruidhere = firebase.auth().currentUser.uid\n this.setState({\n useruid : useruidhere\n })\n }\n db.CreateUserIPFSRecord(this.state.useruid,this.state.hash,this.state.passwordhint);\n }\n })\n } else {\n this.setState({\n modalOpen: true,\n failure: `Add Image and Corresponding Password and Hint`\n })\n }\n\n this.setState({\n loading: false\n })\n }", "function createAccount(e) {\n e = e || window.event;\n e.preventDefault();\n //console.log(\"creating...\");\n var emailIn = document.getElementById(\"emailInput\").value;\n var passwordIn = document.getElementById(\"passwordInput\").value;\n ////console.log(passwordIn)\n if (checkFormatting(emailIn)) {\n firebase.auth().createUserWithEmailAndPassword(emailIn, passwordIn).then(function(){\n var user = firebase.auth().currentUser;\n user.updateProfile({\n displayName: \"Student\"\n })\n sendVerification();\n ////console.log(\"here creating\");\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n //console.log(\"its not created\")\n window.alert(\"Error: \" + errorMessage);\n });\n\n }\n\n}", "async function fetchCredentials() {\n const response = await fetch(`${url}/uploadImage/addFeed`, {\n method: \"GET\",\n });\n const credentials = await response.json();\n if (response.ok) {\n firebaseConfig = credentials.firebaseConfig;\n firebase.initializeApp(firebaseConfig);\n } else {\n return Promise.reject(response);\n }\n}", "handleSubmit(e) {\n e.preventDefault();\n //fire.database().ref('samples') refers to the main title of the fire database.\n this.removeAuthListener = fire.auth().onAuthStateChanged(user=>{\n const samplesRef = fire.database().ref(`form2A/${user.uid}`);\n samplesRef.set({\n\n facilityName: this.state.facilityName\n })\n this.setState({\n\n facilityName: this.state.facilityName\n })\n\n\n });\n }", "function sUp() {\n var email = document.getElementById('email').value\n var password = document.getElementById('password').value\n firebase\n .auth()\n .createUserWithEmailAndPassword(email, password)\n .then(() => {\n $('#msg').html('You account was created. Please Sign In')\n })\n .catch(function (error) {\n console.log(error.code)\n console.log(error.message)\n $('#msg').html(error.message)\n })\n //console.log(email);\n}", "register(email, password){\n firebaseApp.auth().createUserWithEmailAndPassword(email, password)\n .catch(function (err) {\n console.log(err)\n });\n }", "async function signUp(name, email, phone, password, street, number, neighborhood, reference) {\n setLoadingAuth(true);\n await firebase.auth().createUserWithEmailAndPassword(email, password)\n .then( async (value) => {\n let uid = value.user.uid;\n await firebase.database().ref('users').child(uid).set({\n name: name,\n street: street,\n number: number,\n neighborhood: neighborhood,\n reference: reference,\n email: email,\n phone: phone\n })\n .then(() => {\n let data = {\n uid: uid,\n name: name,\n street: street,\n number: number,\n neighborhood: neighborhood,\n reference: reference,\n email: email,\n phone: phone\n };\n setUser(data);\n storageUser(data);\n setLoadingAuth(false);\n })\n .catch(() => {\n alert(error.code);\n setLoadingAuth(false);\n })\n })\n .catch(() => {\n alert(error.code);\n setLoadingAuth(false);\n })\n }", "function writeToFirebase(){\n //get fields\n let nameLocation = document.querySelector('#nameLocation').value; //input field\n let typeLocation = document.querySelector('#typeLocation').value; //select field\n let descLocation = document.querySelector('#descLocation').value; //input field\n let lngLocation = document.querySelector('#longitude').value; //input longitude\n let latLocation = document.querySelector('#latitude').value; //input latitude\n \n if(!utils.checkLongitude(lngLocation)){\n alert(\"Invalid longitude value.\");\n return;\n }\n if(!utils.checkLatitude(latLocation)){\n alert(\"Invalid latitude value.\");\n return;\n }\n \n //call write function of firebase\n fb.write('public', nameLocation, descLocation, typeLocation, lngLocation, latLocation); //params - auth, title, desc, type, long, lat\n}", "function registerUSer(){\n var myDataRef = new Firebase('https://userempowerlabs.firebaseio.com');\n var email = $('#emailInput').val().trim();\n var name = $('#nameInput').val().trim();\n var role = $('#roleInput').val().trim();\n var password = $('#passwordInput').val().trim();\n /*obtengo todos los valores*/\n\n if(validateEmail(email))\n {\n if(password.length>0)\n {\n if(name.length>0)\n {\n if(validateUseEmail(email))\n {\n $(\".error\").addClass(\"hide\");\n var id = idNuevo+1\n myDataRef.push({email: email, id:id, name: name, password: password, rol: role});\n $('#messageInput').val('');\n showMessage(\"Usuario registrado correctamente\");\n $('#emailInput').val(\"\");\n $('#nameInput').val(\"\");\n $('#roleInput').val(\"Seleccione Rol\");\n $('#passwordInput').val(\"\");\n }else{\n showMessage(\"El correo ya fue utilizado anteriormente\");\n }\n }else{\n showMessage(\"Necesita proporcionar el nombre del usuario\");\n }\n }else{\n showMessage(\"Necesita proporcionar una contraseña\");\n }\n }else {\n showMessage(\"Correo inválido\");\n }\n\n }", "function firebase_setup(){\n /*\n var firebaseConfig = {\n apiKey: \"AIzaSyB0ZY93KxJK4UIRVnyXWqNm2V1l1M-4j_4\",\n authDomain: \"office-inventory-12f99.firebaseapp.com\",\n databaseURL: \"https://office-inventory-12f99.firebaseio.com\",\n projectId: \"office-inventory-12f99\",\n storageBucket: \"office-inventory-12f99.appspot.com\",\n messagingSenderId: \"147848186588\",\n appId: \"1:147848186588:web:33dbc8d727af1de4\"\n };\n // Initialize Firebase\n firebase.initializeApp(firebaseConfig);\n db = firebase.firestore();\n */\n}", "function signupFirebaseManual(form, email, password) {\n\tvar emailValue = document.getElementById(email).value;\n\tvar passwordValue = document.getElementById(password).value;\n\t\n\t// Create Account in Firebase\n\tfirebase.auth().createUserWithEmailAndPassword(emailValue, passwordValue)\n\t\t.then(function() {\n\t\t\tform.unbind().submit();\n\t\t})\n\t\t.catch(function(error) {\n\t\t\taddHidden(form, 'error', error.code);\n\t\t\tform.unbind().submit();\n\t\t});\n}", "function Submit(){\n var database = firebase.database().ref('/users/' + usersId);\n \t//once the information is filled out on click of the submit button these varibales will..\n\tsubmit.addEventListener('click',e =>{\n \tconst name = txtName.value;\n \tconst user = txtUserName.value;\n \tconst phone = txtPhoneNumber.value;\n \tconst email = txtEmail.value;\n const password = txtPassword.value;\n const auth = firebase.auth();\n\n const promise = auth.createUserWithEmailAndPassword(email, password)\n window.alert(\"Account created, sign in!!!\")\n\n // ...then be submited and uploaded to the authentication and the database in case so i can call the variables later \n \tdatabase.push().set({ \n \tname: name,\n \tuserId: user,\n \tnumber: phone,\n \temail : email\n \t});\n\n \t//Sends user back to the sign up page ;\n\t $(\"#Login-Page\").show();\n $(\"#Survey-Page\").hide();\n $(\"#Account-Page\").hide(); \n\n \n\t});\n}", "async registerWithFirebase(ctx, payload) {\n // Payload includes e-mail, password password confirmation\n if (payload[1] == payload[2]) {\n fb.auth()\n .createUserWithEmailAndPassword(payload[0], payload[1])\n .then(response => {\n ctx.dispatch(\"createUserCollection\", response);\n ctx.dispatch('userSignIn', payload);\n })\n .catch(error => {\n console.log(error);\n ctx.commit('setLoginFailure', true);\n ctx.commit('setFailureMessage', error.message);\n });\n } else {\n ctx.commit('setLoginFailure', true);\n ctx.commit('setFailureMessage', \"Password doesn't match, please try again\");\n }\n }", "function authEmail(){\r\n let emailvalue=document.querySelector('#email').value;\r\n let passwordvalue=document.querySelector('#password').value;\r\n \r\n //here i set values of email and pass to make user always sign in\r\nif(emailvalue != \"\" && passwordvalue !=\"\"){\r\n window.localStorage.setItem('x',emailvalue); \r\n window.localStorage.setItem('y',passwordvalue);\r\n} \r\n var email=window.localStorage.getItem('x');\r\n var password=window.localStorage.getItem('y');\r\n \r\n firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {\r\n // Handle Errors here.\r\n var errorCode = error.code;\r\n var errorMessage = error.message;\r\n messerr.textContent=errorMessage;\r\n\r\n // ...\r\n })\r\n messerr.textContent='waiting...'\r\n}", "function new_book(){\r\n var book = $('#bookname').val();\r\n var auth = $('#author').val();\r\n var ed = $('#edition').val();\r\n var cor = $('#course').val();\r\n var pr = $('#price').val();\r\n // var img = $('#file').val();\r\n var con = $('input[name=radioName]:checked', '#booksForm').val()\r\n\r\n var user = firebase.auth().currentUser;\r\n var name, email, photoUrl, uid;\r\n\r\n if (user != null) {\r\n // name = user.displayName;\r\n email = user.email;\r\n uid = user.uid; // The user's ID, unique to the Firebase project. Do NOT use\r\n // this value to authenticate with your backend server, if\r\n // you have one. Use User.getToken() instead.\r\n }\r\n\r\n var newBooksKey = firebase.database().ref().child('Books').push().key;\r\n\r\n var metadata = {\r\n name: newBooksKey\r\n }\r\n\r\n // var reader = new FileReader();\r\n // var dlURL;\r\n var file = document.querySelector('input[type=file]').files[0];\r\n \r\n\r\n // var imgURL = reader.readAsDataURL(file);\r\n // alert(file);\r\n var uploadTask = firebase.storage().ref().child('Books_Images/').child(newBooksKey).put(file, metadata);\r\n\r\n uploadTask.on('state_changed', function(snapshot){\r\n var dlURL = uploadTask.snapshot.downloadURL;\r\n \r\n \r\n var booksData = {\r\n Book_Name: book,\r\n Posted_By: uid,\r\n Author: auth,\r\n Edition: ed,\r\n Course_Name: cor,\r\n Condition: con,\r\n Price: pr,\r\n ImageURL: dlURL\r\n };\r\n\r\n // Get a key for a new Post.\r\n\r\n\r\n // alert(newBooksKey);\r\n\r\n // Write the new post's data simultaneously in the posts list and the user's post list.\r\n var updates = {};\r\n updates['/Books/' + newBooksKey] = booksData;\r\n // updates['/user-books/' + uid + '/' + 'bookid'] = newBooksKey;\r\n\r\n firebase.database().ref().update(updates);\r\n });\r\n\r\n\r\n // alert(dlURL);\r\n\r\n \r\n}", "function signup (e) {\n e.preventDefault ();\n fire\n .auth ()\n .createUserWithEmailAndPassword (data.email, data.password)\n .then (data => {\n console.log (data);\n })\n .catch (err => {\n console.log (err);\n \n });\n\n var db = fire.firestore ();\n db.collection ('users')\n .add ({\n email: data.email,\n phoneNo: data.phoneNo,\n name: data.name,\n dob: data.dob,\n })\n .then (() => {\n setLoader (true);\n })\n .catch (e => {\n alert ('Error', e.message);\n setLoader (true);\n });\n }", "function login(){\r\n\r\n var user= $('#userid').val();\r\n var pass = $('#password').val();\r\n var dbRef = firebase.database().ref(\"users/\" + user);\r\n\r\n dbRef.once(\"value\").then(function(snapshot) {\r\n if (snapshot.exists()) {\r\n if(pass !== snapshot.child(\"Passwd\").val()){\r\n alert(\"Invalid password. Retry!\");\r\n return;\r\n }\r\n else{\r\n var datetime = Date();\r\n alert(\"Login Successful!\");\r\n window.localStorage.setItem('username',user);\r\n document.getElementById(\"coursereg\").innerHTML=\"Click here for Course Registration\";\r\n document.getElementById(\"fileupload\").innerHTML=\"Click here for uploading documents\";\r\n dbRef.push({logintime : datetime});\r\n return;\r\n }\r\n }\r\n else\r\n {\r\n alert(\"Invalid user id. Please signup.\");\r\n }\r\n });\r\n}", "function firebaseInit()\n{\n var firebaseConfig = {\n\tapiKey: \"AIzaSyDz4KVH1_aoVs0tcofy1cxHkI05AIP0PCY\",\n\tauthDomain: \"robox-3666f.firebaseapp.com\",\n\tdatabaseURL: \"https://robox-3666f.firebaseio.com\",\n\tprojectId: \"robox-3666f\",\n\tstorageBucket: \"robox-3666f.appspot.com\",\n\tmessagingSenderId: \"356472837055\",\n\tappId: \"1:356472837055:web:3491df60bef9212534470a\"\n };\n\n firebase.initializeApp(firebaseConfig);\n}", "function firebasePush() {\n\n\n //prevents from braking\n if (!firebase.apps.length) {\n firebase.initializeApp(config);\n }\n\n //push itself\n var mailsRef = firebase.database().ref('emails').push().set(\n {\n Name: Name.value,\n Email: Email.value,\n Message: Message.value\n\n }\n );\n}", "function logInSignUp(name, email, password, $scope, $firebaseObject, $firebaseAuth, $location, $http){\n\t// Create a variable 'ref' to reference your firebase storage\n var userRef = ref.child(\"users\");\n\n // Create a firebaseObject of your users, and store this as part of $scope\n $scope.users = $firebaseObject(userRef);\n\t\n // Create authorization object that referes to firebase\n $scope.authObj = $firebaseAuth(ref);\n\t\n // Test if already logged in\n var authData = $scope.authObj.$getAuth();\n if (authData) {\n $scope.userId = authData.uid;\n } \n\t$scope.newUserbadges = [\"powerbadge\"];\n // SignUp function\n\t$scope.signUp = function() {\n // Create user\n\t\t// Here, you set default values for users if there is any\n\t\t$scope.create = false;\n\n\t\t// Authenticate user\n $scope.authObj.$createUser({\n email: $scope.email,\n password: $scope.password\n })\n\n // Once the user is created, call the logIn function\n .then($scope.logIn)\n\n // Once logged in, set and save the user data\n .then(function(authData) {\n\t\t\tconsole.log($scope.newUserbadges);\n $scope.userId = authData.uid;\n $scope.users[authData.uid] = {\n name: $scope.name,\n\t\t\t\tbadges: $scope.newUserbadges,\n\t\t\t\tgoals: {\n\t\t\t\t\t0: {\n\t\t\t\t\t\tgoalname: $scope.goalTitle,\n\t\t\t\t\t\tschedule: {\n\t\t\t\t\t\t\t0: {hours: document.getElementById(\"Sunday\").value},\n\t\t\t\t\t\t\t1: {hours: document.getElementById(\"Monday\").value},\n\t\t\t\t\t\t\t2: {hours: document.getElementById(\"Tuesday\").value},\n\t\t\t\t\t\t\t3: {hours: document.getElementById(\"Wednesday\").value},\n\t\t\t\t\t\t\t4: {hours: document.getElementById(\"Thursday\").value},\n\t\t\t\t\t\t\t5: {hours: document.getElementById(\"Friday\").value},\n\t\t\t\t\t\t\t6: {hours: document.getElementById(\"Saturday\").value}\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttotaltime: 0\n\t\t\t\t\t}\n\t\t\t\t}\n }\n $scope.users.$save()\n })\n\t\t.then(function(){\n\t\t\tlocation.reload();\n\t\t})\n // Catch any errors\n .catch(function(error) {\n console.error(\"Error: \", error);\n\t\t\tconsole.log(error.code);\n\t\t\tif(error.code == \"INVALID_EMAIL\"){\n\t\t\t\talert(\"Email is invalid\")\n\t\t\t}\n\t\t\tif(error.code == \"EMAIL_TAKEN\"){\n\t\t\t\talert(\"Email already in use\")\n\t\t\t}\n });\n }\n\n // SignIn function, reads whatever set-up the user has\n $scope.signIn = function() {\n $scope.logIn().then(function(authData){\n $scope.userId = authData.uid\n\t\t\tconsole.log($scope.userId)\n\t\t\tvar id = $scope.userId;\n\t\t\t$scope.badges = $scope.users[id].badges\n\t\t\tlocation.reload();\n })\n }\n\t\n // LogIn function\n $scope.logIn = function() {\n return $scope.authObj.$authWithPassword({\n email: $scope.email,\n password: $scope.password\n })\n }\n\t\n // LogOut function\n $scope.logOut = function() {\n $scope.authObj.$unauth()\n $scope.userId = false\n\t\t$location.path('/')\n\t\t$scope.badges = []\n }\n}", "function firebaseTokenAdmin(req, res){\n User.update({'_id': req.user._id}, {firebase: req.body.token}, {upsert: true}, function(err){\n if(err) return res.json({success: false});\n else return res.json({success: true});\n });\n}", "function upload(localFile, remoteFile){\n\n let uuid = UUID();\n \n return bucket.upload( localFile, {\n destination:remoteFile,\n uploadType: \"media\",\n metadata: {\n contentType: 'image/png',\n metadata: {\n firebaseStorageDownloadTokens: 'hello token'\n }\n }\n })\n .then((data) => {\n \n let file = data[0];\n \n return Promise.resolve(\"https://firebasestorage.googleapis.com/v0/b/\" + bucket.name + \"/o/\" + encodeURIComponent(file.name) + \"?alt=media&token=\" + 'hell token');\n });\n }", "syncWithFirebase(){\n let userId = firebase.auth().currentUser.uid;\n firebase.database().ref('users/' + userId).update(JSON.parse(this.webStorage.getItem(userId)));\n }", "function editProfilePicture() {\r\n let nombreConfig = document.getElementById(\"nombreConfig\");\r\n let apellidosConfig = document.getElementById(\"apellidosConfig\");\r\n let biografiaConfig = document.getElementById(\"biografiaConfig\");\r\n\r\n const ref = firebase.storage().ref();\r\n const file = document.getElementById(\"inputFotoPerfil\").files[0];\r\n \r\n if (nombreConfig.value == ''|| apellidosConfig.value == '') {\r\n let titulo = document.getElementById(\"mensajeTitulo\");\r\n let mensaje = document.getElementById(\"mensaje\");\r\n titulo.innerHTML = `Error`;\r\n mensaje.innerHTML = `El nombre y los apellidos no pueden estar vacios`;\r\n $(\"#boxMesanjes\").modal('show');\r\n }\r\n else if (file == null) {\r\n var user = firebase.auth().currentUser;\r\n if (user) {\r\n db.collection(\"users\").where(\"userId\", \"==\", user.uid)\r\n .onSnapshot((querySnapshot) => {\r\n querySnapshot.forEach(function(doc) {\r\n \r\n db.collection(\"users\").doc(doc.id).update({\r\n userName: nombreConfig.value,\r\n userLastName: apellidosConfig.value,\r\n biography: biografiaConfig.value\r\n })\r\n .then(function() {\r\n \r\n });\r\n });\r\n });\r\n } else {\r\n // console.log(\"No hay usuario\");\r\n }\r\n let titulo = document.getElementById(\"mensajeTitulo\");\r\n let mensaje = document.getElementById(\"mensaje\");\r\n titulo.innerHTML = `Exito`;\r\n mensaje.innerHTML = `Perfil actualizado`;\r\n $(\"#boxMesanjes\").modal('show');\r\n }\r\n else {\r\n const name = file.name;\r\n\r\n const metadata = {\r\n contentType: file.type\r\n }\r\n const task = ref.child(\"profile/\"+ name).put(file, metadata);\r\n\r\n task.then(snapshot => snapshot.ref.getDownloadURL()).then( url => {\r\n\r\n var user = firebase.auth().currentUser;\r\n if (user) {\r\n db.collection(\"users\").where(\"userId\", \"==\", user.uid)\r\n .onSnapshot((querySnapshot) => {\r\n querySnapshot.forEach(function(doc) {\r\n \r\n db.collection(\"users\").doc(doc.id).update({\r\n userName: nombreConfig.value,\r\n userLastName: apellidosConfig.value,\r\n biography: biografiaConfig.value,\r\n photoProfile: url\r\n })\r\n .then(function() {\r\n console.log(\"Document successfully updated!\");\r\n });\r\n });\r\n });\r\n } else {\r\n // console.log(\"No hay usuario\");\r\n }\r\n });\r\n let titulo = document.getElementById(\"mensajeTitulo\");\r\n let mensaje = document.getElementById(\"mensaje\");\r\n titulo.innerHTML = `Exito`;\r\n mensaje.innerHTML = `Perfil actualizado`;\r\n $(\"#boxMesanjes\").modal('show');\r\n abrirPerfil();\r\n }\r\n}", "function setup() {\n /*\n The example here does register all the information needed to connect to a database (with api key etc), \n this is for the sake of showing what it looks like and \n having an example that works right out of the box \n But don't publish your credentials and api keys !\n */\n var firebaseConfig = {\n apiKey: \"AIzaSyCmzKLYROqpkua4-ibqbsrUsIgIYukUzH4\",\n authDomain: \"test-a1b52.firebaseapp.com\",\n databaseURL: \"https://test-a1b52.firebaseio.com\",\n projectId: \"test-a1b52\",\n storageBucket: \"test-a1b52.appspot.com\",\n messagingSenderId: \"761726826245\",\n appId: \"1:761726826245:web:9cf6c2d1b3aea915e9a96c\"\n };\n // Initialize Firebase\n firebase.initializeApp(firebaseConfig);\n db = firebase.database();\n\n createCanvas(windowWidth, windowHeight)\n background(255, 180, 180)\n\n createForm()\n\n}", "function initApp() {\n // Listening for auth state changes.\n // [START authstatelistener]\n firebase.auth().onAuthStateChanged(function(user) {\n // [START_EXCLUDE silent]\n // document.getElementById('quickstart-verify-email').disabled = true;\n console.log(user);\n // [END_EXCLUDE]\n if (user) {\n if(window.location.pathname.split(\"/\").pop() !== 'index.html'){\n location.assign('index.html');\n }\n console.log(user);\n // if (user) {\n // // sessionStorage.setItem(\"useremail2\", user.uid);\n // console.log(user.uid);\n // location.assign('index.html');\n // User is signed in.\n let displayName = user.displayName;\n let email = user.email;\n let emailVerified = user.emailVerified;\n let photoURL = user.photoURL;\n let isAnonymous = user.isAnonymous;\n let uid = user.uid;\n let providerData = user.providerData;\n // [START_EXCLUDE]\n // document.getElementById('quickstart-sign-in-status').textContent = 'Signed in';\n // document.getElementById('quickstart-sign-in').textContent = 'Sign out';\n // document.getElementById('quickstart-account-details').textContent = JSON.stringify(user, null, ' ');\n // if (!emailVerified) {\n // // document.getElementById('quickstart-verify-email').disabled = false;\n // }\n // [END_EXCLUDE]\n } else {\n // User is signed out.\n console.log(\"no hay sesion\");\n // if (window.location.pathname.split(\"/\").pop() !== \"registration.html\"){\n // location.assign('registration.html');\n // }\n // console.log(window.location.pathname.split(\"/\").pop());\n // if (location)\n // location.assign('registration.html');\n // [START_EXCLUDE]\n // document.getElementById('quickstart-sign-in-status').textContent = 'Signed out';\n // document.getElementById('quickstart-sign-in').textContent = 'Sign in';\n // document.getElementById('quickstart-account-details').textContent = 'null';\n // [END_EXCLUDE]\n }\n // [START_EXCLUDE silent]\n document.getElementById('loginbtn').disabled = false;\n // [END_EXCLUDE]\n });\n // [END authstatelistener]\n \n document.getElementById('loginbtn').addEventListener('click', toggleSignIn, false);\n document.getElementById('signupbtn').addEventListener('click', handleSignUp, false);\n // document.getElementById('quickstart-verify-email').addEventListener('click', sendEmailVerification, false);\n document.getElementById('buttonforgot').addEventListener('click', sendPasswordReset, false);\n }", "function update(){\n var user=firebase.auth().currentUser; \n console.log(user+\"2\");\n if (user) {\n // User is signed in.\n var userId=user.uid;\n \n // file url needed\n var storage = firebase.storage().ref('school/');\n var nam=document.getElementById(\"sphoto\").files[0].name;\n console.log(nam);\n // var url=storage.child(userId+'/'+nam).getDownloadURL();\n \n storage.child(userId+'/'+nam).getDownloadURL().then(function(url) {\n var userId=firebase.auth().currentUser.uid;\n var name=document.getElementById(\"sName\").value;\n var email=user.email;\n var sid=document.getElementById(\"sId\").value;\n var contactNo=document.getElementById(\"sContact\").value;\n var Lat=document.getElementById(\"lat\").value;\n var Long=document.getElementById(\"long\").value;\n var addr1=document.getElementById(\"address\").value;\n var addr2=document.getElementById(\"address2\").value;\n var state=document.getElementById(\"state\").value;\n var dist=document.getElementById(\"dist\").value;\n var country=document.getElementById(\"country\").value;\n var zip=document.getElementById(\"zip\").value;\n // `url` is the download URL for 'images/stars.jpg'\n \n // This can be downloaded directly:\n var xhr = new XMLHttpRequest();\n xhr.responseType = 'blob';\n xhr.onload = function(event) {\n var blob = xhr.response;\n };\n xhr.open('GET', url);\n xhr.send();\n \n // Or inserted into an <img> element:\n var img = document.getElementById('im');\n img.src = url;\n console.log(img.src);\n var image=document.getElementById('im').src;\n console.log(image);\n \n var desc=document.getElementById(\"sdesc\").value;\n var hostel=radiocheck(\"hostel\");\n var mess=radiocheck(\"mess\");\n var ground=radiocheck(\"ground\");\n var pskl=radiocheck(\"pschool\");\n var ss=radiocheck(\"sschool\");\n var tno=document.getElementById(\"tteachers\").value;\n var cno=document.getElementById(\"cr\").value;\n var nos=document.getElementById(\"ns\").value;\n var ten_stu=document.getElementById(\"tenclassstu\").value;\n var ebs=document.getElementById(\"ebs\").value;\n writeUserData(userId, email, name, sid, contactNo, Lat, Long, addr1, addr2, state, dist, country, zip, image, desc, hostel, mess, ground, pskl, ss, tno, cno, nos, ten_stu, ebs);\n $('#success').modal('show');\n }).catch(function(error) {\n // Handle any errors\n window.alert(\"failure\");\n });\n\n // console.log(url);\n // var image=url.i;\n \n \n } else {\n // No user is signed in.\n window.alert(\"no user signed in. Please sign in\");\n console.log(\"no user signed in yet\");\n }\n \n\n }", "function handleSignUp(event) {\n event.preventDefault();\n var email = document.getElementById(\"email\").value;\n var password = document.getElementById(\"password\").value;\n if (email.length < 4) {\n alert(\"Please enter an email address.\");\n return;\n }\n if (password.length < 6) {\n alert(\"Please enter a password.\");\n return;\n }\n // Create user with email and pass.\n // [START createwithemail]\n firebase\n .auth()\n .createUserWithEmailAndPassword(email, password)\n .catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // [START_EXCLUDE]\n if (errorCode == \"auth/weak-password\") {\n alert(\"The password is too weak.\");\n } else {\n alert(errorMessage);\n }\n console.log(error);\n // [END_EXCLUDE]\n })\n .then(() => {\n let newEmployer = formObject;\n firebase.auth().currentUser.sendEmailVerification();\n let id = firebase.auth().currentUser.uid.toString();\n newEmployer.firebase_id = id;\n setFormObject(newEmployer);\n console.log(formObject);\n handleFormSubmit();\n });\n // [END createwithemail]\n }", "function handleFileUploadSubmit2(e) {\n const uploadTask = storageRef.child(`${idPlace}/2`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_2').disabled = true;\n document.querySelector('#file-submit_2').innerHTML = 'subiendo';\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_2').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_2').innerHTML = 'listo';\n document.querySelector('#file-submit_2').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }", "storeUser (authData) {\n let stringifiedUser = JSON.stringify({ uid: authData.uid });\n\n return new Promise((resolve, reject) => {\n $http\n .post(`${firebaseURL}users.json`, stringifiedUser)\n .then(\n res => resolve(res),\n err => reject(err)\n );\n });\n }", "function handleSubmit(event){\nevent.preventDefault();\n\n // logIn the user\n fire.auth()\n .signInWithEmailAndPassword(email,password)\n .then(user => {})\n .catch((error)=>{\n console.log(error);\n });\n\n\n}", "static createConection() {\n try {\n //if (this._db && this._storageFirebase && this._auth) {\n if (this._auth) { \n return Firebase.getConection();\n }\n\n // initialize firebase\n// admin.initializeApp({\n// credential: admin.credential.cert(serviceAccount),\n// apiKey: SDK_Firebase.apiKey,\n// projectId: SDK_Firebase.projectId,\n// storageBucket: SDK_Firebase.storageBucket\n// });\n console.log(\"llamo a admin.initializeApp()\");\n admin.initializeApp({\n credential: admin.credential.cert(serviceAccount),\n });\n\n const settings = { timestampsInSnapshots: true };\n admin.firestore().settings(settings);\n\n // fireStore DB\n this._db = admin.firestore();\n\n // auth object\n this._auth = admin.auth();\n\n return {\n auth: this._auth\n };\n } catch (e) {\n throw customError(\"Error Firebase\", \"createConection\", 500, e);\n }\n }", "authenticate(email,password) {\n \n \n fire.auth().signInWithEmailAndPassword(email, password)\n .then(param => {\n //console.log(param.user.uid)\n \n \n alert('hello')\n \n })\n .catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // ...\n \n console.log(error)\n \n alert('na')\n });\n\n\n }", "function signUp() {\n let emailInput = document.getElementById(\"email\").value;\n let passwordInput = document.getElementById(\"password\").value;\n let checkboxVal = document.getElementById(\"doctor\");\n let isDoctor = false;\n firebase\n .auth()\n .createUserWithEmailAndPassword(emailInput, passwordInput)\n .then(userCredential => {\n // Signed in\n var user = userCredential.user;\n window.alert(\"User created Successfully!\");\n if (checkboxVal.checked == true) {\n isDoctor = true;\n registerDoc(isDoctor, user);\n //window.location.href = \"doctorDashboard.html\";\n } else {\n window.location.href = \"uploadPage.html\";\n }\n })\n .catch(error => {\n var errorCode = error.code;\n var errorMessage = error.message;\n window.alert(`${errorMessage} Please log into the account.`);\n // ..\n });\n}", "onSubmit() {\r\n console.log('picture: ' + this.state.Picture)\r\n let imageRef = storageRef.child('images/' + this.state.Picture)\r\n var metadata = {\r\n contentType : 'image/jpeg'\r\n }\r\n imageRef.put(this.state.imageFile[0], metadata).then((snapshot) => {\r\n fetch('/addProduct', {\r\n method : 'post',\r\n headers : {\r\n Accept : 'application/json',\r\n 'Content-type' : 'application/json'\r\n },\r\n body : JSON.stringify({\r\n Name : this.state.Name,\r\n Price : this.state.Price,\r\n Stock : this.state.Stock,\r\n Picture : this.state.Picture,\r\n Description : this.state.Description,\r\n Discount : this.state.Discount,\r\n Category : this.state.Category\r\n })\r\n }).then((res) => {\r\n if (res.status === 200) {\r\n alert('Tuote Lisätty')\r\n }\r\n })\r\n })\r\n }", "function signInWithEmailAndPassword(event) {\n event.preventDefault();\n var email = $('#email').val();\n var password = $('#pwd').val();\n\n firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {\n console.log('sign in error', error);\n });\n\n }", "function uploadPic() {\n document.getElementById(\"submit_btn\").disabled = true;\n pic = this.files[0];\n console.log(\"success\");\n var uploadTask = storage.ref().child(\"magary/\" + new Date()+'.jpg').put(pic);\n\n uploadTask.on('state_changed', function (snapshot) {\n var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;\n console.log('Upload is ' + progress + '% done');\n document.getElementById(\"bar\").style.width = progress + '%';\n }, function (error) {\n console.log(error.message);\n }, function () {\n uploadTask.snapshot.ref.getDownloadURL().then(function (downloadURL) {\n console.log('File available at', downloadURL);\n document.getElementById('url').value = downloadURL;\n\n var myimg = document.getElementById(\"myimg\");\n myimg.src = downloadURL;\n\n document.getElementById(\"submit_btn\").disabled = false;\n\n\n });\n });\n\n}", "authenticate (credentials) {\n return new Promise((resolve, reject) => {\n ref.authWithPassword({ //Changes if you use another firebase method for login\n \"email\": credentials.email,\n \"password\": credentials.password\n }, (error, authData) => {\n if (error) {\n reject(error);\n } else {\n currentUserData = authData;\n resolve(authData);\n }\n });\n });\n }" ]
[ "0.6560675", "0.6305817", "0.624269", "0.61011344", "0.6066942", "0.6059108", "0.600547", "0.5945225", "0.5942427", "0.5942397", "0.5903922", "0.58726823", "0.5871168", "0.58657265", "0.5861364", "0.58466053", "0.5845028", "0.58172005", "0.5794753", "0.5787748", "0.5767396", "0.5753971", "0.57480156", "0.57469213", "0.57419485", "0.5741675", "0.5739947", "0.5738535", "0.57013166", "0.5694688", "0.5688083", "0.5678479", "0.56662536", "0.566386", "0.5655495", "0.5590243", "0.5585143", "0.55827874", "0.5575676", "0.5570213", "0.5549885", "0.5547705", "0.5540096", "0.55394286", "0.55264664", "0.5520447", "0.5518976", "0.5510765", "0.5504702", "0.5501136", "0.54998946", "0.5496724", "0.54942656", "0.54920596", "0.5488235", "0.5488057", "0.54847056", "0.5472375", "0.54694605", "0.5468529", "0.5459194", "0.54467255", "0.54460496", "0.54453266", "0.54423726", "0.5438194", "0.5432169", "0.5423325", "0.54189897", "0.5413282", "0.541267", "0.540976", "0.5406246", "0.5397472", "0.5394534", "0.53912073", "0.5391004", "0.53891283", "0.5386738", "0.5386428", "0.5384111", "0.5373456", "0.5368591", "0.5368156", "0.5367309", "0.5365075", "0.5363659", "0.5363348", "0.5361553", "0.53586", "0.5356893", "0.53515464", "0.5344897", "0.5343136", "0.53423995", "0.53339356", "0.5329248", "0.5329045", "0.5328444", "0.5325", "0.53159595" ]
0.0
-1
This hooks provides an easy way to toggle a boolean flag for React components. The main use case for this will be toggling the visibility of something. All the provided actions are guaranteed to never change.
function useToggle(defaultToggled) { var _a = react_1.useState(defaultToggled), toggled = _a[0], setToggled = _a[1]; var previous = useRefCache_1.useRefCache(toggled); var enable = react_1.useCallback(function () { if (!previous.current) { setToggled(true); } // disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); var disable = react_1.useCallback(function () { if (previous.current) { setToggled(false); } // disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); var toggle = react_1.useCallback(function () { setToggled(function (prevVisible) { return !prevVisible; }); }, []); return [toggled, enable, disable, toggle, setToggled]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useToggle(initialValue = false) {\n return useReducer((state) => !state, initialValue);\n }", "function toggle() {\n setIsToggledOn(prev => !prev)\n }", "function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }", "function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }", "toggler() {\n const visibility = this.state.visibility;\n const expanded = this.state.expanded;\n if (visibility === \"hidden\" && !expanded) {\n this.setState({\n visibility: \"visible\",\n expanded: true\n })\n } else {\n this.setState({\n visibility: \"hidden\",\n expanded: false\n })\n }\n\n }", "toggle() {\n this.setState({\n visible: !this.state.visible,\n });\n }", "function useToggle(initialOn = false) {\n const [on, setOn] = useState(initialOn);\n const toggle = () => setOn(!on);\n return {\n on,\n toggle\n };\n}", "function useToggle(initialState) {\n const [value, setState] = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(initialState);\n return {\n value,\n toggle: Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useCallback\"])(() => setState(state => !state), []),\n setTrue: Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useCallback\"])(() => setState(true), []),\n setFalse: Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useCallback\"])(() => setState(false), [])\n };\n}", "toggleVisibility() {\n this.setState(state => {\n if (state.visibility === true) {\n return { visibility: false };\n } else {\n return { visibility: true };\n }\n });\n }", "function toggle() {\n setChecked((checked)=>!checked)\n }", "function useToggle(initialVal = false) {\n // call useState 'reserve piece of state'\n const [state, setState] = useState(initialVal);\n\n // turning into a generic toggle with use of state\n function toggle() {\n setState(!state);\n }\n\n // return piece of state and func to toggle it\n return [state, toggle];\n}", "toggleVisibility() {\n this.setState(state => {\n if (state.visibility === true) {\n return { visibility: false };\n } else {\n return { visibility: true };\n }\n });\n }", "onUntoggle() {\n const { onChangeToggle } = this.props;\n if (onChangeToggle) {\n onChangeToggle(null);\n }\n }", "function toggle() {\n setState(!state);\n }", "function toggleBool() {\n if(myFlag) \n myFlag = false;\n else\n myFlag = true;\n}", "function useBoolean(initialState) {\n var _a = react__WEBPACK_IMPORTED_MODULE_0__.useState(initialState), value = _a[0], setValue = _a[1];\n var setTrue = (0,_useConst__WEBPACK_IMPORTED_MODULE_1__.useConst)(function () { return function () {\n setValue(true);\n }; });\n var setFalse = (0,_useConst__WEBPACK_IMPORTED_MODULE_1__.useConst)(function () { return function () {\n setValue(false);\n }; });\n var toggle = (0,_useConst__WEBPACK_IMPORTED_MODULE_1__.useConst)(function () { return function () {\n setValue(function (currentValue) { return !currentValue; });\n }; });\n return [value, { setTrue: setTrue, setFalse: setFalse, toggle: toggle }];\n}", "handleOnToggle () {\n this.props.onToggle()\n }", "handleClick() {\n // When clicked flip between flagged/not flagged\n this.setState(prevState => ({\n flagged: !prevState.flagged\n }));\n }", "toggleTruth() {\n const truth = this.state.isTrue === true ? false : true;\n this.setState({\n isTrue : truth\n });\n }", "onClickLeftMenuToggle(flag){\n\n if(flag)\n this.props.dispatch(Action.getAction(sharedActionTypes.SET_LEFT_MENU_SMALL_SCREEN_TOGGLED,{})); \n else\n this.props.dispatch(Action.getAction(sharedActionTypes.SET_RIGHT_MENU_SMALL_SCREEN_TOGGLED,{})); \n\n }", "function TodoItem() {\n const [editMode, toggleEditMode] = useState('false');\n return <div></div>;\n}", "_toggleShowHidden() {\n this.props.toggleShowHidden();\n }", "onFabPress(status){\n this.props.toggle(status);\n }", "toggleFeedbackDialog(state, boolean) {\n state.feedbackDialog = boolean;\n }", "function useToggleState(initialVal = false) {\n const [isFormOn, setIsFormOn] = useState(initialVal);\n\n const toggleForm = () => {\n setIsFormOn(!isFormOn);\n };\n\n return [isFormOn, toggleForm];\n}", "function ToggleProvider(props) {\n const [on, setOn] = React.useState(false)\n\n //useCallback lets the setOn fn stay static, instead of re-rendering\n const toggleFn = React.useCallback(() => setOn(oldOn => !oldOn), [])\n \n /*\n\tstateObj returns \n\t{\n\t on : on,\n\t toggleFn: aboveToggleFn\n\t}\n */ \n const stateObj = React.useMemo(() => ({on, toggleFn}), [on])\n \n return (\n <ToggleContext.Provider value={stateObj}>\n {props.children}\n </ToggleContext.Provider>\n )\n}", "onToggle() {}", "function toggleButton(actions) {\n\treturn formIsValid() ? actions.enable() : actions.disable()\n}", "handleClick() {\n this.setState({ devModeOn : !this.state.devModeOn });\n }", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "action() {\n\t\tthis.toggle();\n\t}", "handleToggleClickA(){\n this.setState({\n toggleStateA: !this.state.toggleStateA\n })\n }", "handleToggleClickA(){\n this.setState({\n toggleStateA: !this.state.toggleStateA\n })\n }", "toggle(value = !this.onOff) {\r\n return this.operatePlug({ onOff: value });\r\n }", "function Toggle(props) {\n var size = props.size,\n children = props.children,\n value = props.value,\n onChange = props.onChange,\n defaultChecked = props.defaultChecked,\n controlledChecked = props.checked,\n disabled = props.disabled,\n className = props.className;\n var isControlled = !(0,_shared_helpers_js__WEBPACK_IMPORTED_MODULE_2__.isNil)(controlledChecked);\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultChecked),\n _useState2 = (0,_virtual_rollupPluginBabelHelpers_js__WEBPACK_IMPORTED_MODULE_4__.slicedToArray)(_useState, 2),\n checked = _useState2[0],\n setChecked = _useState2[1];\n\n var isChecked = isControlled ? controlledChecked : checked;\n\n var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),\n _useState4 = (0,_virtual_rollupPluginBabelHelpers_js__WEBPACK_IMPORTED_MODULE_4__.slicedToArray)(_useState3, 2),\n animatingPress = _useState4[0],\n setAnimatingPress = _useState4[1];\n\n var _usePress = (0,_hooks_js__WEBPACK_IMPORTED_MODULE_5__.usePress)({\n onPress: function onPress() {\n return setAnimatingPress(true);\n },\n disabled: disabled\n }),\n isPressed = _usePress.isPressed,\n pressProps = _usePress.pressProps;\n\n (0,_shared_hooks_useUpdateLayoutEffect_js__WEBPACK_IMPORTED_MODULE_6__.default)(function () {\n setAnimatingPress(true);\n }, [isChecked]);\n\n function handleChange(evt) {\n onChange(evt, evt.target.checked);\n\n if (!evt.defaultPrevented && !isControlled) {\n setChecked(evt.target.checked);\n }\n }\n\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"label\", (0,_virtual_rollupPluginBabelHelpers_js__WEBPACK_IMPORTED_MODULE_4__.extends)({\n className: (0,_node_modules_classnames_index_js__WEBPACK_IMPORTED_MODULE_7__.default)(className, cn({\n pointed: !disabled\n }))\n }, pressProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_VisuallyHidden_index_js__WEBPACK_IMPORTED_MODULE_8__.default, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", {\n type: \"checkbox\",\n value: value,\n disabled: disabled,\n checked: isChecked,\n onChange: handleChange\n })), children, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_components_Indicator_js__WEBPACK_IMPORTED_MODULE_9__.default, {\n setAnimatingPress: setAnimatingPress,\n animatingPress: animatingPress || isPressed,\n disabled: disabled,\n isChecked: isChecked,\n size: size\n }))\n );\n}", "_toggleMenu() {\n const { isMenuVisible, isConciergeVisible } = this.state;\n const newIsMenuVisible = !isMenuVisible;\n const newIsConciergeVisible = newIsMenuVisible ? false : isConciergeVisible;\n this.setState({\n isMenuVisible: newIsMenuVisible,\n isConciergeVisible: newIsConciergeVisible,\n });\n }", "render() {\n if (this.state.visibility) {\n return (\n <div>\n <button onClick={this.toggleVisibility}>Click Me</button>\n <h1>Now you see me!</h1>\n </div>\n );\n } else {\n return (\n <div>\n <button onClick={this.toggleVisibility}>Click Me</button>\n </div>\n );\n }\n }", "function Switch() {\n let on = false;\n let setOn = () => { };\n\n function enableSwitch() {\n // Bad\n [on, setOn] = useState(false);\n }\n\n return (\n <button onClick={enableSwitch}>\n Enable light switch state\n </button>\n );\n}", "function toggleTrueFalse(passedIndex, subject) {\n setToggle(prev => {\n const updatedArray = prev.map((x, index) =>\n index === passedIndex ? !prev[index] : prev[index]\n );\n return updatedArray;\n });\n if(toggle[passedIndex]){\n setDisplayArray(prev=>[...prev])\n }else{\n setDisplayArray(prev => [...prev, subject]); \n }\n }", "_toggle() {\n if (this._isVisible) {\n this._hide();\n } else {\n this._show();\n }\n }", "switchOff() {\n this.setState({\n color : \"grey\",\n toggler : null,\n active : false,\n iAmWinner : this.iAmWinner\n })\n //this.toggle_flag = false;\n }", "toggleFlagVisible() {\n var showFlagsOnly = localStorage.getItem('reactFactorialTest_flagsOnly'+this.id)||'';\n var flagsOnly = ('' === showFlagsOnly) ? 'T' : ''; // rigmaroll so I can store in local storage.\n localStorage.setItem('reactFactorialTest_flagsOnly'+this.id,flagsOnly);\n this.setState({ showFlagsOnly: flagsOnly });\n }", "notificationsToggle(state) {\n // console.log(\"toggle\")\n if (state.notificationsShow == \"show\") {\n state.notificationsShow = \"\"\n } else {\n state.notificationsShow = \"show\"\n }\n }", "toggleEnabled() {\n this.setState({ enabled: !this.state.enabled });\n }", "function toggleFavoriteButton(){\n // if toggle is true set it to false\n if(toggled){\n toggled = false;\n // if toggle is false set it to true\n }else{\n toggled = true;\n }\n}", "toggleState() {\n\n // Update the state to the opposite of what it is currently\n this.state = !this.state;\n }", "toggleDarkness() {\r\n if (this.state.darkness) {\r\n this.setAllVisible();\r\n this.setState({\r\n darkness: false\r\n })\r\n }\r\n else {\r\n this.checkVisible();\r\n this.setState({\r\n darkness: true\r\n })\r\n }\r\n }", "toggleHelp() {\n this.setState({ showingHelp: !this.state.showingHelp });\n }", "toggleStatus(value){\n LayoutAnimation.spring();\n this.setState({status: value, switchOnOff: value});\n if (value === false){\n this.deleteAlert();\n }else{\n this.currentPos();\n this.updateLocations();\n }\n }", "function App() {\n const [flag,setFlag] = useState(true);\n const [id,setId] = useState(1);\n \n return (\n <div className=\"App\">\n {/* <button onClick={()=>{setFlag(false)}}>显示/隐藏</button> */}\n {/* <DragDemo></DragDemo> */}\n {/* <DragOrder></DragOrder> */}\n {/* <CrossArea /> */}\n {/* 拖拽排序 */}\n {/* <CanvasSignature /> */}\n\n {/* 企业签章 */}\n {/* <Signature /> */}\n {/* redux demo */}\n {/* <ReduxDemo></ReduxDemo> */}\n {/* <AsyncRedux></AsyncRedux> */}\n {/* <ClickCount></ClickCount> */}\n {\n // flag && <LifeCycles />\n }\n {/* <FriendStatusClass /> */}\n\n\n {/* <div>\n <button onClick={()=>{setFlag(false)}}>flag = false</button>\n <button onClick={()=>{setId(id+1)}}>id++</button>\n </div> */}\n {/* {\n flag && <FriendStatusFn friendId={id} />\n }\n <FriendStatusFn /> */}\n\n {/* <UseRefDemo /> */}\n {/* <UseContextDemo /> */}\n {/* <UseReducerDemo /> */}\n {/* <UseMemoDemo /> */}\n <CustomHookUse />\n {/* <UseStateTrap /> */}\n {/* <UseEffectChangeState /> */}\n </div>\n );\n}", "toggleVisibility() {\n return this.stateIsOpen ? this.close() : this.open();\n }", "handleSideMenu() {\n this.setState({toggle: !this.state.toggle})\n }", "render() {\n const {visible} = this.state;\n this.target.setAttribute('aria-hidden', !visible);\n this.toggler.setAttribute('aria-expanded', visible);\n const action = visible ? '_show' : '_hide';\n this[action]();\n }", "function toggleEdit() {\n setEdit(prevStatus => {\n return !prevStatus\n })\n }", "onToggle() {\r\n this.toggle = !this.toggle;\r\n }", "toggle() {\n this.setState({ isOpen: (!this.state.isOpen) });\n }", "toggleFilter() {\n const status = this.state.showFilter;\n this.setState({\n showFilter: !status\n });\n }", "toggleMissing() {\n this.setState({\n missing_info: !this.state.missing_info\n });\n }", "toggle() {\n this.enabled = !this.enabled;\n }", "handleChangeToggle(e)\n { \n let togglelocal=\"false\";\n if(e)\n {\n \n togglelocal=\"true\";\n\n }\n this.setState({status: togglelocal});\n }", "toggleFilters(event) {\r\n this.setState({\r\n filtersVisible: !this.state.filtersVisible,\r\n isRotated: !this.state.isRotated\r\n });\r\n }", "toggleBonusTooltip() {\n this.setState({ shouldTooltipDisplay: !this.state.shouldTooltipDisplay })\n }", "function toggle() {\n setIsActive(!isActive);\n }", "toggle(){this.off=!this.off}", "function App() {\n const [visible, setVisible] = useState(true);\n\n return (\n <div>\n <button onClick={() => setVisible(!visible)}>Toggle Visible!!</button>\n {visible ? <Clock /> : \"\"}\n </div>\n );\n}", "toggleFeedSettingControls() {\n this.setState({\n displayFeedSettingControls: !this.state.displayFeedSettingControls\n });\n }", "toggle() {\n this.setFavorite(!this.restaurant.is_favorite);\n }", "_handleClick(){\n // need to toggle the boolean value\n // not a preferred way (now deprecated as well)\n // if any state value is changed directly \n // it also updates the complete object\n // this.state.showComment = !this.state.showComment;\n\n // special method to update the state value:\n this.setState(\n {\n showComment : !this.state.showComment\n }\n );\n\n // change in instance variable\n // this._show = !this._show;\n }", "toggle() {\n this.setState({\n open: !this.state.open\n });\n }", "function _toggle() {\n var _editor = EditorManager.getCurrentFullEditor();\n _enabled = !_enabled;\n // Set the new state for the menu item.\n CommandManager.get(AUTOMATCH).setChecked(_enabled);\n \n // Register or remove listener depending on _enabled.\n if (_enabled) {\n _registerHandlers(_editor);\n } else {\n _deregisterHandlers(_editor);\n }\n }", "toggle() {\n this.setState({\n isOpened: !this.state.isOpened,\n chevronState: !this.state.isOpened ? \"opened\" : \"\"\n })\n }", "toggleAllowance () {\n this.setState({remember: !this.state.remember});\n }", "toggleSearchBox(flag) {\n\n if (flag != undefined) {\n this.setState({searchVisibility: flag});\n return;\n }\n this.setState({searchVisibility: !this.state.searchVisibility});\n }", "render() {\n if (this.state.visibility) {\n return (\n <div>\n <button onClick={this.toggleVisibility}>Click Me</button>\n <h1>Now you see me!</h1>\n </div>\n );\n } else {\n return (\n <div>\n <button onClick={this.toggleVisibility}>Click Me</button>\n </div>\n );\n }\n }", "toggle() {\n const v = this.getSetting(\"visible\");\n this.visible = !v;\n this.setSetting(\"visible\", !v);\n\n //If first time, set autofog to opposite so it doesn't reapply it.\n let history = canvas.scene.getFlag(this.layername, \"history\");\n\n if (history === undefined) {\n this.setSetting(\"autoFog\", !v);\n return;\n }\n }", "toggle() {\n this.setState(({ isOpen }) => ({\n isOpen: !isOpen\n }));\n }", "render(){\n return (\n <div>\n <h1>Visibility Toggle</h1>\n \n <button onClick={this.handleToggleVisibility}>\n {this.state.visibility ? 'Hide Details' : 'Show Details'}\n </button>\n \n {this.state.visibility && (<div><p>You can see this now...</p></div>)}\n </div>\n );\n }", "function Hooks(){\n //const [alert, setAlert] = useState(false)\n\n //const toggleAlert = () => {setAlert(prev => !prev)}\n\n return(\n <AlertProvider>\n <div> \n <Alert></Alert>\n <Main toggle={()=>{}}></Main>\n </div>\n </AlertProvider>\n )\n}", "_DrawingToolsToggle() {\n if(!this.state.toolsOpen) { // if the drawing toolBar is closed \n styles.DrawingButtons = { // Spand the toolBar\n height: 210,\n marginTop: 0,\n display : \"flex\",\n flexDirection : \"column\",\n justifyContent : \"space-around\",\n alignItems : \"center\",\n }\n this.setState({ toolsOpen : true }); // use it to change to change the button image and detect toolBar state\n } else if(this.state.toolsOpen) {\n styles.DrawingButtons = { // Shrink the toolBar\n height: 0,\n marginTop: 30,\n display : \"flex\",\n flexDirection : \"column\",\n justifyContent : \"space-around\",\n alignItems : \"center\",\n }\n let action = { type: \"disabled\", value: \"\" } // reset the globale state to disable drawing\n this.props.dispatch(action)\n\n this.setState({ toolsOpen : false });\n } \n }", "toggle() {\n this.setState({\n isOpen: !this.state.isOpen,\n });\n }", "toggleInstructions() {\n this.setState({\n showInstructions: !this.state.showInstructions\n })\n }", "render_toggle() {\n if (this.visible) {\n this.render_hide();\n\n } else {\n this.render_display();\n\n }\n }", "toggleVisibility() {\n this.setVisible(!this.visible);\n }", "toggle() {\n this.setState({ isOpen: !this.state.isOpen });\n }", "togglePreferences(){\n this.setState({preference: !this.state.preference});\n }", "onToggle(d) {\n const { onChangeToggle, identifier } = this.props;\n if (onChangeToggle) {\n onChangeToggle(d[identifier]);\n }\n }", "function toggleInteractions() {\n scObj.interactions.enable(document.getElementById(\"enableInteractions\").checked);\n}", "toggleChecklistVisibility() {\n this.state.checklist.isVisible = !this.state.checklist.isVisible;\n this.save();\n }", "function toggleHidden() {\n setIsHidden(!isHidden);\n }", "toggle() {\n this.setState({ showModal : !this.state.showModal });\n }", "function GalleryItem({\n photo, handleLikes\n}) {\n //provides logic for the display switch with conditional states \n const [isHidden, setIsHidden] = useState(false);\n const handleFlip = () => {\n if (isHidden) {\n setIsHidden(false);\n } else {\n setIsHidden(true);\n }\n };\n//quick method is setIsHidden(!isHidden) \n// if it's true, make it false is the nature of toggling\n//or to making one thing into something else\n \n//details button click actions and DOM info\n\n return (\n <>\n <div className=\"switcheroo\">\n {isHidden ? \n <p className=\"description\" onClick={handleFlip}>{photo.description}</p>\n : \n <img className=\"image\" onClick={handleFlip} src={photo.path}></img>\n \n } \n </div> \n \n <br></br>\n \n <button className=\"button\" onClick={() => handleLikes(photo.id)}>❤️</button>\n \n \n <p>Hey! {photo.likes} People Like This</p>\n \n \n \n </> \n\n\n\n \n\n );\n\n\n}", "toggleFaqVisibility() {\n this.state.faq.isVisible = !this.state.faq.isVisible;\n this.save();\n }", "toggle() {\n this.setState({\n modal: !this.state.modal\n });\n }", "toggle() {\n this.setState({\n modal: !this.state.modal\n });\n }", "function Usage({\n onToggle = (...args) => console.log('onToggle', ...args),\n onButtonClick = () => console.log('onButtonClick'),\n}) {\n return (\n <Toggle onToggle={onToggle}>\n {({on, getTogglerProps}) => (\n <div>\n <Switch on={on} {...getTogglerProps({on})} />\n <hr />\n <button\n {...getTogglerProps({\n 'aria-label': 'custom-button',\n 'aria-pressed': on,\n onClick: onButtonClick,\n })}\n >\n {on ? 'on' : 'off'}\n </button>\n </div>\n )}\n </Toggle>\n )\n}", "toggleButton(event, id) {\n if ((id === \"chloro\" && this.state.chloroHidden) ||\n (id === \"bubble\" && this.state.bubbleHidden)) {\n this.setState({\n chloroHidden: !this.state.chloroHidden,\n bubbleHidden: !this.state.bubbleHidden\n })\n }\n }", "function toggleFab() {\n\t\t\tshowChatBoolean.set(!$showChatBoolean);\n\t\t}", "handleRed(){\n this.setState(state => ({\n isToggleOn: !state.isToggleOn\n }))\n }", "function toggle(x){\n switch(x){\n case \"on\":\n $('newBook').style.display = \"none\";\n $('displayData').style.display = \"none\";\n $('clearForm').style.display = \"inline\";\n $('anotherOne').style.display = \"inline\";\n break;\n\n case \"off\":\n $('newBook').style.display = \"block\";\n $('displayData').style.display = \"inline\";\n $('clearForm').style.display = \"inline\";\n $('anotherOne').style.display = \"none\";\n $('books').style.display = \"none\";\n break;\n default:\n return false;\n };\n }" ]
[ "0.6426882", "0.6402232", "0.6319086", "0.6319086", "0.63146967", "0.63133144", "0.62943745", "0.62693316", "0.62507075", "0.62469745", "0.62299156", "0.622156", "0.6218546", "0.61967343", "0.61577326", "0.61526763", "0.6147466", "0.60926026", "0.6073071", "0.6019223", "0.60171527", "0.6006726", "0.6005956", "0.59600794", "0.59135646", "0.58935654", "0.5886818", "0.587894", "0.5842057", "0.58344775", "0.58344775", "0.58344775", "0.58202434", "0.58202434", "0.58163685", "0.58139896", "0.57992154", "0.57752776", "0.5749681", "0.5749616", "0.57402086", "0.57378286", "0.57291764", "0.5728762", "0.5722747", "0.57087874", "0.56979364", "0.567079", "0.56698114", "0.56683177", "0.56666505", "0.5665478", "0.5662321", "0.56564045", "0.56550187", "0.56472063", "0.564316", "0.56386876", "0.5630749", "0.56271005", "0.56103486", "0.5607918", "0.5605045", "0.56023425", "0.56011313", "0.5599367", "0.5598782", "0.5597539", "0.55916965", "0.5590855", "0.55874246", "0.55856615", "0.5584436", "0.55831605", "0.55811703", "0.55770373", "0.5562695", "0.5560473", "0.5560143", "0.55592877", "0.5550482", "0.5547403", "0.55342656", "0.5530236", "0.5525143", "0.55250156", "0.55174404", "0.5504684", "0.550113", "0.54949516", "0.5490948", "0.5484149", "0.5481252", "0.54723066", "0.54723066", "0.54708165", "0.54658955", "0.54642016", "0.54640234", "0.5462904" ]
0.62812465
7
This Component is currently a WIP
function QUERY_POLL_RESULTS(pollId){ return gql` { poll(id:${pollId}){ title responses{ selection } } }` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Component() { }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "private public function m246() {}", "function PratoDoDiaComponent() {\n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor() {\n \n \n \n }", "constructor () { super() }", "constructor() {\n super();\n \n }", "constructor () {\r\n\t\t\r\n\t}", "function Component() {\n return this; // this is needed in Edge !!!\n } // Component is lazily setup because it needs", "constructor(props) { super(props); autoBind(this); }", "constructor() {\n\n\t}", "static rendered () {}", "static rendered () {}", "GetComponents() {}", "GetComponents() {}", "GetComponents() {}", "GetComponents() {}", "constructor() {\n\n\t\tsuper();\n\n\t}", "constructor() {\n }", "update() {\n // Subclasses should override\n }", "componenetDidMount() { }", "constructor() {\r\n // ohne Inhalt\r\n }", "private internal function m248() {}", "obtain(){}", "constructor() {\n super();\n }", "constructor() {\n super();\n }", "constructor() {\n super();\n }", "constructor () {\n super();\n }", "onComponentConstructed() {}", "onComponentConstructed() {}", "constructor() {\n\t}", "constructor() {\n\t}", "configure () {\n // this can be extended in children classes to avoid using the constructor\n }", "onComponentMount() {\n\n }", "constructor() {\n super();\n }", "constructor() {\n\t\t// ...\n\t}", "function FunctionalComponent() {}", "constructor() {\n super()\n }", "transient private protected internal function m182() {}", "constructor() { super() }", "protected internal function m252() {}" ]
[ "0.6411473", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6288251", "0.6256472", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.62089807", "0.6141836", "0.6103968", "0.60781956", "0.6076352", "0.60580635", "0.60436654", "0.60409904", "0.60409904", "0.59813637", "0.59813637", "0.59813637", "0.59813637", "0.5965534", "0.59195656", "0.5905856", "0.5903964", "0.5857551", "0.5853067", "0.5848475", "0.5845178", "0.5845178", "0.5845178", "0.5844315", "0.58278906", "0.58278906", "0.582104", "0.582104", "0.5818101", "0.58156544", "0.5804518", "0.57974195", "0.5788699", "0.57852995", "0.57738835", "0.576859", "0.57668775" ]
0.0
-1
Need to Aggregate Results, Transfering Load to Server May be better
function aggregate(arr) { var a = [], b = [], prev; for ( var i = 0; i < arr.length; i++ ) { if ( arr[i] !== prev ) { a.push(arr[i]); b.push(1); } else { b[b.length-1]++; } prev = arr[i]; } return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "aggregate(aggregateSteps) {\n return new Promise((res, rej) => {\n this.model.aggregate(aggregateSteps, (err, result) => {\n if (err) {\n return rej(err);\n }\n else {\n return res(result);\n }\n });\n });\n }", "function Aggregate() {}", "collectResults() {\n // Collect groups\n let rows = Array.from(this.groups, ([_, group]) => {\n const { bindings: groupBindings, aggregators } = group;\n // Collect aggregator bindings\n // If the aggregate errorred, the result will be undefined\n const aggBindings = {};\n for (const variable in aggregators) {\n const value = aggregators[variable].result();\n if (value !== undefined) { // Filter undefined\n aggBindings[variable] = value;\n }\n }\n // Merge grouping bindings and aggregator bindings\n return groupBindings.merge(aggBindings);\n });\n // Case: No Input\n // Some aggregators still define an output on the empty input\n // Result is a single Bindings\n if (rows.length === 0) {\n const single = {};\n for (const i in this.pattern.aggregates) {\n const aggregate = this.pattern.aggregates[i];\n const key = rdf_string_1.termToString(aggregate.variable);\n const value = sparqlee_1.AggregateEvaluator.emptyValue(aggregate);\n if (value !== undefined) {\n single[key] = value;\n }\n }\n rows = [bus_query_operation_1.Bindings(single)];\n }\n return rows;\n }", "function groupPerformance(row){\n const groupHeader=['timestamp','php_duration','CacheDate','CacheAge','supercache','cloudflare','uid','domain','url','Network','Interactive','Total','Server','Browser1','Browser2','duration','gaClientID','queryCount','errorCount'];\n\n\tinput_header=Object.keys(row);\t//these are input headers, not output headers!!\n\n\tlet output = {};\n\tlet lastgroup='';\n\tlet total=0;\n\tlet interactive=0;\n\n\tfor(key of input_header){\n\t group='';\n\t group_interactive=false;\n\t group_total=false;\n\t switch(key){\n\t\tcase \"fetchStart\":\n\t\tcase \"domainLookupStart\":\n\t\tcase \"domainLookupEnd\":\n\t\tcase \"connectStart\":\n\t\tcase \"secureConnectionStart\":\n\t\tcase \"connectEnd\":\n\t\t group='Network';\n group_interactive=true;\n group_total=true;\n\t\tbreak;\n\n\t\tcase \"requestStart\":\n\t\tcase \"responseStart\":\n\t\tcase \"responseEnd\":\n\t\t group='Server'; // Time to download from server, basically.\n group_interactive=true;\n group_total=true;\n\t\tbreak;\n\n\t\tcase \"domLoading\":\n\t\tcase \"domInteractive\":\n\t\t group='Browser1';\n group_interactive=true;\n group_total=true;\n\t\tbreak;\n\n\t\tcase \"domContentLoadedEventStart\":\n\t\tcase \"domContentLoadedEventEnd\":\n\t\tcase \"loadEventStart\":\n\t\tcase \"loadEventEnd\":\n\t\tcase \"domComplete\":\n\t\t group='Browser2';\n group_total=true;\n\t\tbreak;\n\t\tcase \"navigationStart\":\n\t\tcase \"unloadEventStart\":\n\t\tcase \"unloadEventEnd\":\n\t\tcase \"redirectStart\":\n\t\tcase \"redirectEnd\":\n\t\t group='ignore';\n\t\tbreak;\n\t\tdefault:\n\t\t group='';\n\n\t }//switch\n\n // Non-Timing key. @context: domain,url,uid, etc\n if(group==''){\n output[key]=row[key];\n }\n\n //Default Timing: Sum to the Group\n if(group!=='' && group!=='ignore'){\n if(typeof output[group] =='undefined') output[group]=0;\n output[group]+=parseInt(row[key]);\n }\n\n //Extra: Add up Time-toInteractive/Total\n if(group_interactive){\n if(typeof output[\"Interactive\"] =='undefined') output[\"Interactive\"]=0;\n output[\"Interactive\"] += parseInt(row[key]);\n }\n if(group_total){\n if(typeof output[\"Total\"] =='undefined') output[\"Total\"]=0;\n output[\"Total\"]+= parseInt(row[key]);\n }\n\n }//fe\n\n return output;\n\n} // fx", "function _aggregateCurrentSession() {\n if (!_firstAggregationComplete) {\n _firstAggregationComplete = true;\n }\n for (var cdnLocationId in sessionBandwidthMeasurements) {\n sessionBandwidthMeasurements[cdnLocationId] = _aggregateBandwidthMeasurements(sessionBandwidthMeasurements[cdnLocationId], config.histAggregationTimeSpanInSeconds);\n }\n _saveHistoricalData();\n }", "aggregateHistoryDataSegment(processedTransactions) {\n // Separate transaactions to aggregate\n let aggregated = [];\n let toAggregate = [];\n for (const transaction of processedTransactions) {\n if (Blockchain.transactionsToAggregate.includes(transaction.type)) {\n toAggregate.push(transaction); // For aggregation\n } else {\n aggregated.push(transaction); // No aggregation - straight to processed\n }\n }\n\n // Aggregate\n for (const type of Blockchain.transactionsToAggregate) {\n let individualTransactions = toAggregate.filter(x => x.type === type);\n if (individualTransactions.length > 0) {\n aggregated = aggregated.concat(this.aggregateTransactionsByDate(individualTransactions));\n }\n }\n return aggregated;\n }", "function generateRawStatistics() {\n console.log(self.selectDatasource);\n if(self.selectDatasource !== \"Select\" || self.selectDatasource !== null){\n homeService.getRawDataStatistics(self.selectDatasource).then(function(response){\n if(!response.data.isError && response.status == 200){\n //angular.copy(response.data.data, self.rawStatistics);\n //prepend newly created task to the task history array\n self.taskHistory.data.push(response.data);\n }\n else{\n console.log(\"Error: \" + response.data);\n }\n });\n }\n }", "async collect(aCount) {\n let response = await this.kojac.performRequest(this);\n\t\tlet result = response.result();\n\t\tif (!_.isArray(result) || result.length===0)\n\t\t\treturn result;\n\t\tvar resource = response.request.ops[0].key;\n\t\treturn this.kojac.collectIds(resource,result,null,aCount);\n\t}", "aggregate() {\n let allRecords = this.props.allRecords;\n let startDate = this.getDateFromMonth(this.state.selectedMonth, \"\")\n let endDate = this.getDateFromMonth(this.state.selectedMonth, \"end\")\n let table = {}\n let data = []\n let type = this.state.type === \"expense\" ? 0 : 1;\n\n if (allRecords.length !== 0) {\n allRecords.map(element => {\n if (element.date >= startDate && element.date < endDate && element.type === type) {\n table[element.category.name] = table[element.category.name] + element.amount ||\n element.amount \n }\n })\n Object.keys(table).map(element => data.push({ name: element, value: table[element]}));\n data.sort((a, b) => (b.value - a.value));\n data.forEach((obj, index) => obj.fill = COLORS[index % COLORS.length]);\n }\n return data;\n }", "function perform5minAggregatBC2(siteId, startEpoch, endEpoch) {\n // create temp collection as placeholder for aggreagation results\n const aggrResultsName = `aggr${moment().valueOf()}`;\n const AggrResults = new Meteor.Collection(aggrResultsName);\n\n // gather all data, group by 5min epoch\n const pipeline = [\n {\n $match: {\n $and: [\n {\n epoch: {\n $gt: parseInt(startEpoch, 10),\n $lt: parseInt(endEpoch, 10)\n }\n }, {\n site: siteId\n }\n ]\n }\n }, {\n $sort: {\n epoch: 1\n }\n }, {\n $project: {\n epoch5min: 1,\n epoch: 1,\n site: 1,\n subTypes: 1\n }\n }, {\n $group: {\n _id: '$epoch5min',\n site: {\n $last: '$site'\n },\n subTypes: {\n $push: '$subTypes'\n }\n }\n }, {\n $out: aggrResultsName\n }\n ];\n\n Promise.await(LiveData.rawCollection().aggregate(pipeline, { allowDiskUse: true }).toArray());\n\n /*\n * Only aggregate data if a certain percentage (defined by thresholdPercent) of the required data is in the 5minepoch.\n * There is supposed to be 630 database documents per 5minepoch.\n *\n * 30 documents for DAQFactory, 300 documents for TAP01, and 300 documents for TAP02.\n * Eventually we'll just pull how many datapoints are expected from the database. This will work for now\n *\n * Take for example if thresholdPercent were .75.\n *\n * There would need to be:\n * 30 * .75 = 22.5 \n * round(22.5) = 23 documents for DAQFactory required\n *\n * 300 * .75 = 225\n * 225 documents for TAP01 and TAP02 are required\n *\n * ONE EXCEPTION:\n * aggregate regardless of missing data if it is 55 min from the startEpoch\n *\n * Also, left these outside the loop because unnecessary calculations slow the loop down. \n * Additionally, we will be querying for this data rather than relying on hardcoded numbers later on.\n * Querying a database is slow. The less of those we do, the better.\n */\n\n const thresholdPercent = .75;\n // Hard coded numbers. Should not be hardcoded but oh well. Should be changed in the future.\n const maxDAQFactoryCount = 30, maxTAPCount = 300;\n const minDAQFactoryCount = Math.round(thresholdPercent * maxDAQFactoryCount);\n const minTAPcount = Math.round(thresholdPercent * maxTAPCount);\n\n // tap switch variables ***MUST*** be viable over iterations of the foreach loop\n // 8 is offline. Assume offline unless specified otherwise in TAP switch implementation\n var TAP01Flag = 8, TAP02Flag = 8;\n var TAP01Epoch = 0, TAP02Epoch = 0;\n\n // For some god aweful reason, some sites don't have neph flags. Need to check for neph flag before assigning whatever\n let hasNephFlag = false;\n\n // Tap data filtration is required. These variables are simply placeholders for where the rgb abs coef indeces and sampleFlow index is at.\n // ***MUST*** be viable over for loop\n let hasCheckedTAPdataSchema = false;\n let tapDataSchemaIndex = {};\n tapDataSchemaIndex.RedAbsCoef = undefined, tapDataSchemaIndex.GreenAbsCoef = undefined, tapDataSchemaIndex.BlueAbsCoef = undefined, tapDataSchemaIndex.SampleFlow = undefined;\n let TAP01Name = undefined;\n let TAP02Name = undefined;\n const allElementsEqual = arr => arr.every(v => v === arr[0]);\n\n AggrResults.find({}).forEach((e) => {\n const subObj = {};\n subObj._id = `${e.site}_${e._id}`;\n subObj.site = e.site;\n subObj.epoch = e._id;\n const subTypes = e.subTypes;\n const aggrSubTypes = {}; // hold aggregated data\n let newData = (endEpoch - 3300 - subObj.epoch) < 0;\n\n let subTypesLength = subTypes.length\n for (let i = 0; i < subTypesLength; i++) {\n for (const subType in subTypes[i]) {\n if (subTypes[i].hasOwnProperty(subType)) {\n const data = subTypes[i][subType];\n let numValid = 1;\n var newkey;\n\n // if Neph flag is undefined, flag it 1, otherwise ignore\n if (subType.includes(\"Neph\")) {\n if (data[0].metric === 'Flag') {\n hasNephFlag = true;\n }\n if (!hasNephFlag) {\n data.unshift({ metric: 'Flag', val: 1, unit: 'NA' });\n }\n }\n\n\n /** Tap flag implementation **/\n // Get flag from DAQ data and save it\n if (subType.includes('TAP01')) {\n TAP01Flag = data[0].val === 10 ? 1 : data[0].val;\n TAP01Epoch = subObj.epoch;\n } else if (subType.includes('TAP02')) {\n TAP02Flag = data[0].val === 10 ? 8 : data[0].val\n TAP02Epoch = subObj.epoch;\n }\n\n // Get flag from TAP0(1|2)Flag and give it to the appropriate instrument\n if (subType.includes('tap_')) {\n\n // TAP01 = even\n // TAP02 = odd\n // confusing amirite!?\n // EXAMPLE:\n // tap_SN36 <- even goes to TAP01\n // tap_SN37 <- odd goes to TAP02\n // This is parsing tap_* string for integer id\n var subTypeName = subType;\n let epochDiff;\n do {\n subTypeName = subTypeName.slice(1);\n } while (isNaN(subTypeName));\n let subTypeNum = subTypeName;\n if (parseInt(subTypeNum) % 2 === 0) {\n // Even - Needs flag from TAP01\n // Make sure that tap data has a corresponding timestamp in DaqFactory file\n // If not, break and do not aggregate datapoint\n epochDiff = subObj.epoch - TAP01Epoch;\n\n if (epochDiff >= 0 && epochDiff < 10) {\n data[0].val = TAP01Flag;\n } else {\n data[0].val = 20;\n }\n } else {\n // Odd - Needs flag from TAP02\n // Make sure that tap data has a corresponding timestamp in DaqFactory file\n // If not, break and do not aggregate datapoint\n epochDiff = subObj.epoch - TAP02Epoch;\n if (epochDiff >= 0 && epochDiff < 10) {\n data[0].val = TAP02Flag;\n } else {\n data[0].val = 20;\n }\n }\n\n /** Data filtration start **/\n\n /* Reason for data filtration to be inside this subType.includes is for performance reasons. The less if statements ran, the faster.\n */\n\n /* Matlab code\n * Some data filtration is required. We will not aggregate datapoints (not records) that do not fit our standards.\n * To Note: Comments in matlab are my own comments\n\n % Do not aggregate data point if r, g, b is < 0 or > 100 \n r1=numa(:,7);\n g1=numa(:,8);\n b1=numa(:,9);\n r2(r2 < 0 | r2 > 100) = NaN;\n g2(g2 < 0 | g2 > 100) = NaN;\n b2(b2 < 0 | b2 > 100) = NaN;\n\n\n %TAP_02data defined here\n TAP_02data = [JD2 time2 A_spot2 R_spot2 flow2 r2 g2 b2 Tr2 Tg2 Tb2];\n\n % Don't aggregate data point if SampleFlow / Flow(L/min) is off 5% from 1.7 Min: 1.615, Max: 1.785\n idx = find(TAP_02data (:,5) <1.63 | TAP_02data (:,5) >1.05*1.7); %condition if flow is 5% off 1.7lpm\n TAP_02data(idx,5:8) = NaN; clear idx time2 A_spot2 R_spot2 flow2 r2 g2 b2 Tr2 Tg2 Tb2\n\n\n % This is for the TAP switching. It was a way to get the TAP switching working in the matlab script.\n % Don't aggregate the first 100s after a switch has occured. Let instrument recalibrate. \n R01 = strfind(isnan(TAP_02data(:,5)).', [1 0]); % Find Indices Of [0 1] Transitions\n for i=1:100\n TAP_02data(R01+i,6:8) = NaN; % Replace Appropriate Values With 'NaN '\n end\n\n\n 20 = potentially invalid data\n 1 = valid data\n */\n\n // Reason for if statement is to speed the code up alot. \n // Having to check for the schema every run is VERY significant.\n // Only having to do it once and assuming the rest will be the same is a very safe assumption.\n // If this isn't true, then lord help us all\n if (!hasCheckedTAPdataSchema) {\n let dataLength = data.length;\n for (let k = 0; k < dataLength; k++) {\n if (data[k].metric === 'RedAbsCoef') {\n tapDataSchemaIndex.RedAbsCoef = k;\n }\n if (data[k].metric === 'GreenAbsCoef') {\n tapDataSchemaIndex.GreenAbsCoef = k;\n }\n if (data[k].metric === 'BlueAbsCoef') {\n tapDataSchemaIndex.BlueAbsCoef = k;\n }\n if (data[k].metric === 'SampleFlow') {\n tapDataSchemaIndex.SampleFlow = k;\n }\n }\n hasCheckedTAPdataSchema = true;\n }\n\n // We flag the faulty data with flag 20.\n if (data[tapDataSchemaIndex.RedAbsCoef].val < 0 || data[tapDataSchemaIndex.RedAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.RedAbsCoef].val)) {\n data[tapDataSchemaIndex.RedAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.GreenAbsCoef].val < 0 || data[tapDataSchemaIndex.GreenAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.GreenAbsCoef].val)) {\n data[tapDataSchemaIndex.GreenAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.BlueAbsCoef].val < 0 || data[tapDataSchemaIndex.BlueAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.BlueAbsCoef].val)) {\n data[tapDataSchemaIndex.BlueAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.SampleFlow].val < 1.615 || data[tapDataSchemaIndex.SampleFlow].val > 1.785 || isNaN(data[tapDataSchemaIndex.SampleFlow].val)) {\n data[tapDataSchemaIndex.SampleFlow].Flag = 20;\n }\n\n\n /** Data filtration finished **/ \n }\n\n /** End of TAP switch implementation **/\n\n // Don't aggregate TAP01 and TAP02 subtype. They are only useful for giving TAP_SNXX flags\n if (subTypes.includes(\"TAP01\") || subTypes.includes(\"TAP02\")) {\n continue;\n }\n\n\n // if flag is not existing, put 9 as default, need to ask Jim?\n if (data[0].val === '') {\n data[0].val = 9;\n }\n if (data[0].val !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n for (let j = 1; j < data.length; j++) {\n newkey = subType + '_' + data[j].metric;\n\n // TAP data requires data filtration. Setting flag to 20 if such for specified values. \n // Otherwise, use suggested flag value from file\n const flag = data[j].Flag !== undefined ? data[j].Flag : data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (!aggrSubTypes[newkey]) {\n if (numValid === 0) {\n data[j].val = 0;\n }\n\n aggrSubTypes[newkey] = {\n sum: Number(data[j].val),\n 'avg': Number(data[j].val),\n 'numValid': numValid,\n 'totalCounter': 1, // initial total counter\n 'flagstore': [flag], // store all incoming flags in case we need to evaluate\n unit: data[j].unit // use unit from first data point in aggregation\n };\n } else {\n if (numValid !== 0) { // keep aggregating only if numValid\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sum += Number(data[j].val); // holds sum until end\n if (aggrSubTypes[newkey].numValid !== 0) {\n aggrSubTypes[newkey].avg = aggrSubTypes[newkey].sum / aggrSubTypes[newkey].numValid;\n }\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // /store incoming flag\n }\n numValid = 1; // reset numvalid\n }\n }\n }\n }\n\n // This is prep for calculations. Need ensure that we are working with data that has the data necessary to do calculations.\n // The for loop for transforming aggregated data to a generic data format is more useful for calculations than raw aggrSubTypes.\n // All I'm doing here is collecting a little bit of information of what we are working with before I do calculations.\n let hasTap = false;\n let hasNeph = false;\n // Don't have to do this with neph. Neph will always have the same name. Tap will always have different numbers\n let tapNames = [];\n\n // transform aggregated data to generic data format using subtypes etc.\n const newaggr = {};\n for (const aggr in aggrSubTypes) {\n if (aggrSubTypes.hasOwnProperty(aggr)) {\n const split = aggr.lastIndexOf('_');\n const instrument = aggr.substr(0, split);\n const measurement = aggr.substr(split + 1);\n\n if (!newaggr[instrument]) {\n newaggr[instrument] = {};\n }\n\n const obj = aggrSubTypes[aggr]; // makes it a little bit easier\n\n // dealing with flags\n if ((obj.numValid / obj.totalCounter) >= 0.75) {\n obj.Flag = 1; // valid\n } else {\n // find out which flag was majority\n const counts = {};\n for (let k = 0; k < obj.flagstore.length; k++) {\n counts[obj.flagstore[k]] = 1 + (counts[obj.flagstore[k]] || 0);\n }\n const maxObj = _.max(counts, function(obj) {\n return obj;\n });\n const majorityFlag = (_.invert(counts))[maxObj];\n obj.Flag = majorityFlag;\n }\n\n // Some specific setting up for tap calculations and skipping\n if (instrument.includes(\"Neph\")) {\n hasNeph = true;\n\n // If obj.totalCounter (which is documentation for the amount of datapoints in our 5minepoch) is < minTAPcount\n // And what we are aggregating is greater than 55 minutes from endEpoch: \n // SKIP \n if (obj.totalCounter < minDAQFactoryCount && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return;\n }\n }\n\n if (instrument.includes(\"tap_\")) {\n hasTap = true;\n if (!tapNames.includes(instrument)) {\n tapNames.push(instrument);\n }\n\n if (obj.totalCounter < 300)\n // If obj.totalCounter (which is documentation for the amount of datapoints in our 5minepoch) is < minTAPcount\n // And what we are aggregating is greater than 55 minutes from endEpoch: \n // SKIP \n if (obj.totalCounter < minTAPcount && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return;\n }\n }\n\n if (!newaggr[instrument][measurement]) { newaggr[instrument][measurement] = [];\n }\n\n // automatic flagging of aggregated values that are out of range for NO2 to be flagged with 9(N)\n if (instrument === '42i') {\n if (obj.avg < -0.5) {\n obj.Flag = 9;\n }\n }\n\n newaggr[instrument][measurement].push({ metric: 'sum', val: obj.sum });\n newaggr[instrument][measurement].push({ metric: 'avg', val: obj.avg });\n newaggr[instrument][measurement].push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument][measurement].push({ metric: 'unit', val: obj.unit });\n newaggr[instrument][measurement].push({ metric: 'Flag', val: obj.Flag });\n }\n }\n\n // If TAP or NEPH is missing AND what we are aggregating is greater than 55 minutes from endEpoch:\n // SKIP\n if ((tapNames.length < 2 || !hasNeph) && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return; \n }\n\n /** Helpful functions for calculations **/\n\n // flips sign for all elements in array\n function flipSignForAll1D(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] *= -1;\n }\n }\n\n // flips sign for all elements in 2D array\n function flipSignForAll2D(M) {\n for (let i = 0; i < M.length; i++) {\n flipSignForAll1D(M[i]);\n }\n }\n\n // returns row reduced echelon form of given matrix\n // if vector, return rref vector\n // if invalid, do nothing\n function rref(M) {\n let rows = M.length;\n let columns = M[0].length;\n if (((rows === 1 || rows === undefined) && columns > 0) || ((columns === 1 || columns === undefined) && rows > 0)) {\n M = [];\n let vectorSize = Math.max(isNaN(columns) ? 0 : columns, isNaN(rows) ? 0 : rows);\n for (let i = 0; i < vectorSize; i++) {\n M.push(0);\n }\n M[0] = 1;\n return M;\n } else if (rows < 0 || columns < 0) {\n return;\n }\n\n let lead = 0;\n for (let k = 0; k < rows; k++) {\n if (columns <= lead) {\n return;\n }\n\n let i = k;\n while (M[i][lead] === 0) {\n i++;\n if (rows === i) {\n i = k;\n lead++;\n if (columns === lead) { \n return;\n }\n }\n }\n let p = M[i]\n let s = M[k];\n M[i] = s, M[k] = p;\n\n let scalar = M[k][lead];\n for (let j = 0; j < columns; j++) {\n M[k][j] /= scalar;\n }\n\n for (let i = 0; i < rows; i++) {\n if (i === k) continue;\n scalar = M[i][lead];\n for (let j = 0; j < columns; j++) {\n M[i][j] -= scalar * M[k][j];\n }\n }\n lead++;\n }\n return M;\n }\n /** END of Helpful functions for calculations **/\n\n // Calculations for Nepholometer is done here\n if (hasNeph) {\n newaggr['Neph']['SAE'] = [];\n\n if (newaggr['Neph']['RedScattering'] === undefined || newaggr['Neph']['GreenScattering'] === undefined || newaggr['Neph']['BlueScattering'] === undefined) {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20});\n } else {\n\n let RedScatteringFlagIndex = 0;\n let RedScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['RedScattering'].length; index++) {\n if (newaggr['Neph']['RedScattering'][index].metric === 'Flag') {\n RedScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['RedScattering'][index].metric === 'avg') {\n RedScatteringAvgIndex = index;\n }\n }\n\n let GreenScatteringFlagIndex = 0;\n let GreenScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['GreenScattering'].length; index++) {\n if (newaggr['Neph']['GreenScattering'][index].metric === 'Flag') {\n GreenScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['GreenScattering'][index].metric === 'avg') {\n GreenScatteringAvgIndex = index;\n }\n }\n\n let BlueScatteringFlagIndex = 0;\n let BlueScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['BlueScattering'].length; index++) {\n if (newaggr['Neph']['BlueScattering'][index].metric === 'Flag') {\n BlueScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['BlueScattering'][index].metric === 'avg') {\n BlueScatteringAvgIndex = index;\n }\n }\n\n\n // SAE calculations begin here \n // Need to make sure that Neph has valid data before calculations can begin\n if (newaggr['Neph']['RedScattering'][RedScatteringFlagIndex].val === 1 && newaggr['Neph']['GreenScattering'][GreenScatteringFlagIndex].val === 1 && newaggr['Neph']['BlueScattering'][BlueScatteringFlagIndex].val === 1) {\n let x = [635, 525, 450]; // Matlab code: x=[635,525,450]; %Wavelength values for Nephelometer \n let y_Neph = [\n newaggr['Neph']['RedScattering'][RedScatteringAvgIndex].val,\n newaggr['Neph']['GreenScattering'][GreenScatteringAvgIndex].val,\n newaggr['Neph']['BlueScattering'][BlueScatteringAvgIndex].val\n ]; // Matlab code: y_Neph = outdata_Neph(:,2:4); %Scattering coefficient values from Daqfactory for Neph\n\n let lx = mathjs.log(x); // Matlab code: lx = log(x); %Taking log of wavelength\n let ly_Neph = mathjs.log(y_Neph); // Matlab code: ly_Neph = log(y_Neph); %Taking log of scattering coefficient values\n\n // Matlab code: log_Neph = -[lx(:) ones(size(x(:)))] \\ ly_Neph(:,:)'; %Step 1- SAE calulation\n // going to have to break this down a little bit\n let log_Neph = [ // [lx(:) ones(size(x(:)))]\n lx, \n mathjs.ones(mathjs.size(x))\n ];\n log_Neph = mathjs.transpose(log_Neph); // Needed to make matrix 3 x 2\n\n // - operator just negates everything in the matrix\n flipSignForAll2D(log_Neph);\n /*\n * if A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with m rows, then A\\B returns a least-squares solution to the system of equations A*x= B.\n * Least squares solution approximation is needed.\n * Links to calculating least squares solution:\n * https://textbooks.math.gatech.edu/ila/least-squares.html\n * https://www.youtube.com/watch?v=9UE8-6Jlezw\n */\n\n // A^T*A\n let ATA = mathjs.multiply(mathjs.transpose(log_Neph), log_Neph);\n // A^T*b\n let ATb = mathjs.multiply(mathjs.transpose(log_Neph), ly_Neph);\n\n // Create augmented matrix to solve for least squares solution\n ATA[0].push(ATb[0]);\n ATA[1].push(ATb[1]);\n\n log_Neph = rref(ATA);\n // Reason for index 0,2 is because I am skipping a step in the least squares approximation.\n // It is supposed to return a vector with 2 values, but I just shortcut it straight to the correct answer from the 3x2 rref matrix\n let SAE_Neph = log_Neph[0][2]; // SAE_Neph = log_Neph(1,:)'; %Step 2- SAE calulation\n\n // SAE ranges should be: -1 - 5\n // Matlab code: SAE_Neph(SAE_Neph > 5)= NaN;\n // Sujan said this ^^^\n // Unsure If I want to check for zero value\n if (SAE_Neph === undefined || SAE_Neph < -1 || SAE_Neph > 5) { \n newaggr['Neph']['SAE'].push({ metric: 'calc', val: ((SAE_Neph === undefined) ? 'NaN' : SAE_Neph) });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20 });\n } else {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: SAE_Neph });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n // Must be valid data if it it came this far\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 1 });\n }\n } else {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n // It's just easier to assign flag 20 when if fails\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20 });\n }\n }\n }\n\n // Unfortunately, Neph doesn't really have a flag. It's just trusted that if there is data, it is valid. \n // I'll ensure data exists before a calculation for safety reasons.\n // Calculations for tap instruments done here\n tapNames.forEach((instrument) => {\n newaggr[instrument]['SSA_Red'] = [];\n newaggr[instrument]['SSA_Green'] = [];\n newaggr[instrument]['SSA_Blue'] = [];\n newaggr[instrument]['AAE'] = [];\n if (newaggr['Neph'] !== undefined && newaggr['Neph']['RedScattering'] !== undefined && newaggr['Neph']['GreenScattering'] !== undefined && newaggr['Neph']['BlueScattering'] !== undefined) {\n let RedScatteringFlagIndex = 0;\n let RedScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['RedScattering'].length; index++) {\n if (newaggr['Neph']['RedScattering'][index].metric === 'Flag') {\n RedScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['RedScattering'][index].metric === 'avg') {\n RedScatteringAvgIndex = index;\n }\n }\n\n let GreenScatteringFlagIndex = 0;\n let GreenScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['GreenScattering'].length; index++) {\n if (newaggr['Neph']['GreenScattering'][index].metric === 'Flag') {\n GreenScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['GreenScattering'][index].metric === 'avg') {\n GreenScatteringAvgIndex = index;\n }\n }\n\n let BlueScatteringFlagIndex = 0;\n let BlueScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['BlueScattering'].length; index++) {\n if (newaggr['Neph']['BlueScattering'][index].metric === 'Flag') {\n BlueScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['BlueScattering'][index].metric === 'avg') {\n BlueScatteringAvgIndex = index;\n }\n }\n\n let RedAbsCoefFlagIndex = 0;\n let RedAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['RedAbsCoef'].length; index++) {\n if (newaggr[instrument]['RedAbsCoef'][index].metric === 'Flag') {\n RedAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['RedAbsCoef'][index].metric === 'avg') {\n RedAbsCoefAvgIndex = index;\n }\n }\n\n let GreenAbsCoefFlagIndex = 0;\n let GreenAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['GreenAbsCoef'].length; index++) {\n if (newaggr[instrument]['GreenAbsCoef'][index].metric === 'Flag') {\n GreenAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['GreenAbsCoef'][index].metric === 'avg') {\n GreenAbsCoefAvgIndex = index;\n }\n }\n\n let BlueAbsCoefFlagIndex = 0;\n let BlueAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['BlueAbsCoef'].length; index++) {\n if (newaggr[instrument]['BlueAbsCoef'][index].metric === 'Flag') {\n BlueAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['BlueAbsCoef'][index].metric === 'avg') {\n BlueAbsCoefAvgIndex = index;\n }\n }\n\n // If any of the SSA calculations fail, AAE calculations will fail.\n // Allows Different SSA colors to still do calculations whilst preventing AAE from failing\n let SSAFailed = false;\n\n //SSA calculations begin here:\n let obj = {\n Flag:newaggr[instrument]['RedAbsCoef'][RedAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['RedAbsCoef'][RedAbsCoefAvgIndex].val\n };\n if (parseInt(newaggr['Neph']['RedScattering'][RedScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let redScatteringAvg = parseFloat(newaggr['Neph']['RedScattering'][RedScatteringAvgIndex].val);\n let TotalExtinction_R = redScatteringAvg + obj.avg; // Matlab code: TotalExtinction_R = AC_R_Combined + outdata_Neph(:,2); %Total Extinction calculation for Red wavelength\n let SSA_R = redScatteringAvg / TotalExtinction_R; // Matlab code: SSA_R = outdata_Neph(:,2)./TotalExtinction_R; % SSA calculation for Red Wavelength\n\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: SSA_R });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_R (SSA_R < 0 | SSA_R ==1)=NaN;\n // decided > 1 because I have no idea why he used == and not >\n // I decided to make it SSA_R <= 0 to because javascript sends error values to zero by default\n if (SSA_R === undefined || SSA_R <= 0 || SSA_R > 1) {\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: ((SSA_R === undefined) ? 'NaN' : SSA_R) });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: 20});\n }\n } else {\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n\n obj = {\n Flag:newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefAvgIndex].val \n };\n if (parseInt(newaggr['Neph']['GreenScattering'][GreenScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let greenScatteringAvg = parseFloat(newaggr['Neph']['GreenScattering'][GreenScatteringAvgIndex].val);\n let TotalExtinction_G = greenScatteringAvg + obj.avg; // Matlab code: TotalExtinction_G = AC_G_Combined + outdata_Neph(:,3); %Total Extinction calculation for Green wavelength\n let SSA_G = greenScatteringAvg / TotalExtinction_G; // Matlab code: SSA_G = outdata_Neph(:,3)./TotalExtinction_G; % SSA calculation for Green Wavelength\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: SSA_G });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_G (SSA_G < 0 | SSA_G ==1)=NaN;\n // decided > 1 because I have no idea why he used == and not >\n // I decided to make it SSA_G <= 0 to because javascript sends error values to zero by default\n if (SSA_G === undefined || SSA_G <= 0 || SSA_G > 1) {\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: ((SSA_G === undefined) ? 'NaN' : SSA_G) });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: 20 });\n }\n } else {\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n\n obj = {\n Flag:newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefAvgIndex].val\n };\n if (parseInt(newaggr['Neph']['BlueScattering'][BlueScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let blueScatteringAvg = parseFloat(newaggr['Neph']['BlueScattering'][BlueScatteringAvgIndex].val);\n let TotalExtinction_B = blueScatteringAvg + obj.avg; // Matlab code: TotalExtinction_B = AC_B_Combined + outdata_Neph(:,4); %Total Extinction calculation for Blue wavelength\n let SSA_B = blueScatteringAvg / TotalExtinction_B; // Matlab code: SSA_B = outdata_Neph(:,4)./TotalExtinction_B; % SSA calculation for Blue Wavelength\n\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: SSA_B });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_B (SSA_B < 0 | SSA_B ==1)=NaN; \n // I decided to make it SSA_B <= 0 to because javascript sends error values to zero by default\n if (SSA_B === undefined || (SSA_B <= 0 || SSA_B == 1)) {\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: ((SSA_B === undefined) ? 'NaN' : SSA_B) });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: 20});\n }\n } else {\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n if (!SSAFailed) {\n // AAE calculations begin here:\n // Make sure tap instrument is valid\n let x = [640, 520, 365]; // Matlab code: x=[640,520,365]; % Wavelengths values\n let y_TAP = [ // Matlab code: y_TAP_01 = outdata1_TAP_01(:,6:8); %Absorption coefficients from TAP01\n parseFloat(newaggr[instrument]['RedAbsCoef'][RedAbsCoefAvgIndex].val), \n parseFloat(newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefAvgIndex].val), \n parseFloat(newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefAvgIndex].val)\n ];\n\n let lx = mathjs.log(x); // Matlab code: lx = log(x); %Taking log of the wavelengths\n let ly_TAP = mathjs.log(y_TAP);// Matlab code: ly_TAP_01 = log(y_TAP_01); %Taking log of the absorption coefficients for TAP01\n for (let i = 0; i < ly_TAP.length; i++) {\n if (isNaN(ly_TAP[i]) || ly_TAP[i] < 0) {\n ly_TAP[i] = 0;\n }\n }\n\n // Going to have to break this matlab code down a bit, again:\n // Matlab code: log_TAP_01 = -[lx(:) ones(size(x(:)))] \\ ly_TAP_01(:,:)'; %Step 1 -AAE from TAP 01 data\n let log_TAP = [ // Matlab code: [lx(:) ones(size(x(:)))] \n lx,\n mathjs.ones(mathjs.size(x))\n ];\n log_TAP = mathjs.transpose(log_TAP); // Needs to be transposed into 3x2 matrix\n // - operator just negates everything in the matrix\n flipSignForAll2D(log_TAP);\n\n\n /* More information on how I came to the lines below is in the SAE calculations. \n * Essentially, we are finding the least squares solution to the system of equations:\n * A*x=b\n */\n\n // A \\ b\n let ATA = mathjs.multiply(mathjs.transpose(log_TAP), log_TAP);\n let ATb = mathjs.multiply(mathjs.transpose(log_TAP), ly_TAP);\n\n // Create augmented matrix to solve for least squares solution\n ATA[0].push(ATb[0]);\n ATA[1].push(ATb[1]);\n\n log_TAP = rref(ATA);\n // Reason for index 0,2 is because I am skipping a step in the least squares approximation.\n // It is supposed to return a vector with 2 values, but I just shortcut it straight to the correct answer from the 3x2 rref matrix\n let AAE_TAP = log_TAP[0][2]; // Matlab code: SAE_Neph = log_Neph(1,:)'; %Step 2- SAE calulation\n\n // AAE normal ranges: .5 - 3.5\n // Sujan said this ^^^\n // matlab comment: % AAE__TAP_A(AAE__TAP_A < 0)= NaN;\n // I decided to make it AAE_TAP <= 0 to because javascript sends error values to zero by default\n if (AAE_TAP === undefined || AAE_TAP <= 0 || AAE_TAP > 3.5) {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: ((AAE_TAP === undefined) ? 'NaN' : AAE_TAP) });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\"});\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: 20 });\n } else {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: AAE_TAP });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\"});\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: obj.Flag});\n }\n } else {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: 20 });\n }\n }\n });\n\n subObj.subTypes = newaggr;\n AggrData.insert(subObj, function(error, result) {\n if (result === false) {\n Object.keys(newaggr).forEach(function(newInstrument) {\n Object.keys(newaggr[newInstrument]).forEach(function(newMeasurement) {\n // test whether aggregates for this instrument/measurement already exists\n const qry = {};\n qry._id = subObj._id;\n qry[`subTypes.${newInstrument}.${newMeasurement}`] = { $exists: true };\n\n if (AggrData.findOne(qry) === undefined) {\n const newQuery = {};\n newQuery.epoch = subObj.epoch;\n newQuery.site = subObj.site;\n const $set = {};\n const newSet = [];\n newSet[0] = newaggr[newInstrument][newMeasurement][0];\n newSet[1] = newaggr[newInstrument][newMeasurement][1];\n newSet[2] = newaggr[newInstrument][newMeasurement][2];\n newSet[3] = newaggr[newInstrument][newMeasurement][3];\n newSet[4] = newaggr[newInstrument][newMeasurement][4];\n $set['subTypes.' + newInstrument + '.' + newMeasurement] = newSet;\n\n // add aggregates for new instrument/mesaurements\n AggrData.findAndModify({\n query: newQuery,\n update: {\n $set: $set\n },\n upsert: false,\n new: true\n });\n } else {\n // Some aggregations will have less than 5 parts to it. \n // Need if statements to make sure it doesn't generate errors.\n // I really think that this whole thing should change, but I have no idea how it works.\n // So just leave this be and it will keep working.\n let newaggrLength = newaggr[newInstrument][newMeasurement].length;\n if (newaggrLength > 1) {\n const query0 = {};\n query0._id = subObj._id;\n query0[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'sum';\n const $set0 = {};\n $set0[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][0].val;\n AggrData.update(query0, { $set: $set0 });\n }\n if (newaggrLength > 1) {\n const query1 = {};\n query1._id = subObj._id;\n query1[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'avg';\n const $set1 = {};\n $set1[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][1].val;\n AggrData.update(query1, { $set: $set1 });\n }\n if (newaggrLength > 2) {\n const query2 = {};\n query2._id = subObj._id;\n query2[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'numValid';\n const $set2 = {};\n $set2[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][2].val;\n AggrData.update(query2, { $set: $set2 });\n }\n if (newaggrLength > 3) {\n const query3 = {};\n query3._id = subObj._id;\n query3[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'unit';\n const $set3 = {};\n $set3[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][3].val;\n AggrData.update(query3, { $set: $set3 });\n }\n if (newaggrLength > 4) {\n const query4 = {};\n query4._id = subObj._id;\n query4[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'Flag';\n const $set4 = {};\n $set4[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][4].val;\n AggrData.update(query4, { $set: $set4 });\n }\n }\n });\n });\n }\n });\n });\n // drop temp collection that was placeholder for aggreagation results\n AggrResults.rawCollection().drop();\n}", "function perform5minAggregat(siteId, startEpoch, endEpoch) {\n // create temp collection as placeholder for aggreagation results\n const aggrResultsName = `aggr${moment().valueOf()}`;\n const AggrResults = new Meteor.Collection(aggrResultsName);\n\n // gather all data, group by 5min epoch\n const pipeline = [\n {\n $match: {\n $and: [\n {\n epoch: {\n $gt: parseInt(startEpoch, 10),\n $lt: parseInt(endEpoch, 10)\n }\n }, {\n site: siteId\n }\n ]\n }\n }, {\n $project: {\n epoch5min: 1,\n epoch: 1,\n site: 1,\n subTypes: 1\n }\n }, {\n $group: {\n _id: '$epoch5min',\n site: {\n $last: '$site'\n },\n subTypes: {\n $push: '$subTypes'\n }\n }\n }, {\n $out: aggrResultsName\n }\n ];\n\n Promise.await(LiveData.rawCollection().aggregate(pipeline, { allowDiskUse: true }).toArray());\n\n // create new structure for data series to be used for charts\n AggrResults.find({}).forEach((e) => {\n const subObj = {};\n subObj._id = `${e.site}_${e._id}`;\n subObj.site = e.site;\n subObj.epoch = e._id;\n const subTypes = e.subTypes;\n const aggrSubTypes = {}; // hold aggregated data\n\n for (let i = 0; i < subTypes.length; i++) {\n for (const subType in subTypes[i]) {\n if (subTypes[i].hasOwnProperty(subType)) {\n const data = subTypes[i][subType];\n let numValid = 1;\n var newkey;\n\n // if flag is not existing, put 9 as default, need to ask Jim?\n if (data[0].val === '') {\n data[0].val = 9;\n }\n if (data[0].val !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (subType.indexOf('RMY') >= 0) { // HNET special calculation for wind data\n // get windDir and windSpd\n let windDir;\n let windSpd;\n let windDirUnit;\n let windSpdUnit;\n for (let j = 1; j < data.length; j++) {\n if (data[j].val === '' || isNaN(data[j].val)) { // taking care of empty or NaN data values\n numValid = 0;\n }\n if (data[j].metric === 'WD') {\n windDir = data[j].val;\n windDirUnit = data[j].unit;\n }\n if (data[j].metric === 'WS') {\n windSpd = data[j].val;\n windSpdUnit = data[j].unit;\n }\n }\n\n // Convert wind speed and wind direction waves into wind north and east component vectors\n const windNord = Math.cos(windDir / 180 * Math.PI) * windSpd;\n const windEast = Math.sin(windDir / 180 * Math.PI) * windSpd;\n\n let flag = data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n // automatic flagging of high wind speed values/flag with 9(N)\n if (windSpd >= 35) {\n numValid = 0;\n flag = 9;\n }\n\n // Aggregate data points\n newkey = subType + '_' + 'RMY';\n if (!aggrSubTypes[newkey]) {\n aggrSubTypes[newkey] = {\n sumWindNord: windNord,\n sumWindEast: windEast,\n avgWindNord: windNord,\n avgWindEast: windEast,\n numValid: numValid,\n totalCounter: 1, // initial total counter\n flagstore: [flag], // store all incoming flags in case we need to evaluate\n WDunit: windDirUnit, // use units from last data point in the aggregation\n WSunit: windSpdUnit // use units from last data point in the aggregation\n };\n } else {\n if (numValid !== 0) { // taking care of empty data values\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sumWindNord += windNord; // holds sum until end\n aggrSubTypes[newkey].sumWindEast += windEast;\n aggrSubTypes[newkey].avgWindNord = aggrSubTypes[newkey].sumWindNord / aggrSubTypes[newkey].numValid;\n aggrSubTypes[newkey].avgWindEast = aggrSubTypes[newkey].sumWindEast / aggrSubTypes[newkey].numValid;\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // store incoming flag\n }\n } else { // normal aggreagation for all other subTypes\n for (let j = 1; j < data.length; j++) {\n newkey = subType + '_' + data[j].metric;\n\n if (data[j].val === '' || isNaN(data[j].val)) { // taking care of empty or NaN data values\n numValid = 0;\n }\n\n const flag = data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (!aggrSubTypes[newkey]) {\n if (numValid === 0) {\n data[j].val = 0;\n }\n\n aggrSubTypes[newkey] = {\n sum: Number(data[j].val),\n 'avg': Number(data[j].val),\n 'numValid': numValid,\n 'totalCounter': 1, // initial total counter\n 'flagstore': [flag], // store all incoming flags in case we need to evaluate\n unit: data[j].unit // use unit from first data point in aggregation\n };\n } else {\n if (numValid !== 0) { // keep aggregating only if numValid\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sum += Number(data[j].val); // holds sum until end\n if (aggrSubTypes[newkey].numValid !== 0) {\n aggrSubTypes[newkey].avg = aggrSubTypes[newkey].sum / aggrSubTypes[newkey].numValid;\n }\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // /store incoming flag\n }\n numValid = 1; // reset numvalid\n }\n }\n }\n }\n }\n\n // transform aggregated data to generic data format using subtypes etc.\n const newaggr = {};\n for (const aggr in aggrSubTypes) {\n if (aggrSubTypes.hasOwnProperty(aggr)) {\n const split = aggr.lastIndexOf('_');\n const instrument = aggr.substr(0, split);\n const measurement = aggr.substr(split + 1);\n if (!newaggr[instrument]) {\n newaggr[instrument] = {};\n }\n\n const obj = aggrSubTypes[aggr]; // makes it a little bit easier\n\n // dealing with flags\n if ((obj.numValid / obj.totalCounter) >= 0.75) {\n obj.Flag = 1; // valid\n } else {\n // find out which flag was majority\n const counts = {};\n for (let k = 0; k < obj.flagstore.length; k++) {\n counts[obj.flagstore[k]] = 1 + (counts[obj.flagstore[k]] || 0);\n }\n const maxObj = _.max(counts, function(obj) {\n return obj;\n });\n const majorityFlag = (_.invert(counts))[maxObj];\n obj.Flag = majorityFlag;\n }\n\n if (measurement === 'RMY') { // special treatment for wind measurements\n if (!newaggr[instrument].WD) {\n newaggr[instrument].WD = [];\n }\n if (!newaggr[instrument].WS) {\n newaggr[instrument].WS = [];\n }\n const windDirAvg = (Math.atan2(obj.avgWindEast, obj.avgWindNord) / Math.PI * 180 + 360) % 360;\n const windSpdAvg = Math.sqrt((obj.avgWindNord * obj.avgWindNord) + (obj.avgWindEast * obj.avgWindEast));\n\n newaggr[instrument].WD.push({ metric: 'sum', val: 'Nan' });\n newaggr[instrument].WD.push({ metric: 'avg', val: windDirAvg });\n newaggr[instrument].WD.push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument].WD.push({ metric: 'unit', val: obj.WDunit });\n newaggr[instrument].WD.push({ metric: 'Flag', val: obj.Flag });\n\n newaggr[instrument].WS.push({ metric: 'sum', val: 'Nan' });\n newaggr[instrument].WS.push({ metric: 'avg', val: windSpdAvg });\n newaggr[instrument].WS.push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument].WS.push({ metric: 'unit', val: obj.WSunit });\n newaggr[instrument].WS.push({ metric: 'Flag', val: obj.Flag });\n } else { // all other measurements\n if (!newaggr[instrument][measurement]) {\n newaggr[instrument][measurement] = [];\n }\n\n // automatic flagging of aggregated values that are out of range for NO2 to be flagged with 9(N)\n if (instrument === '42i') {\n if (obj.avg < -0.5) {\n obj.Flag = 9;\n }\n }\n\n newaggr[instrument][measurement].push({ metric: 'sum', val: obj.sum });\n newaggr[instrument][measurement].push({ metric: 'avg', val: obj.avg });\n newaggr[instrument][measurement].push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument][measurement].push({ metric: 'unit', val: obj.unit });\n newaggr[instrument][measurement].push({ metric: 'Flag', val: obj.Flag });\n }\n }\n }\n\n subObj.subTypes = newaggr;\n\n AggrData.insert(subObj, function(error, result) {\n // only update aggregated values if object already exists to avoid loosing edited data flags\n if (result === false) {\n Object.keys(newaggr).forEach(function(newInstrument) {\n Object.keys(newaggr[newInstrument]).forEach(function(newMeasurement) {\n // test whether aggregates for this instrument/measurement already exists\n const qry = {};\n qry._id = subObj._id;\n qry[`subTypes.${newInstrument}.${newMeasurement}`] = { $exists: true };\n\n if (AggrData.findOne(qry) === undefined) {\n const newQuery = {};\n newQuery.epoch = subObj.epoch;\n newQuery.site = subObj.site;\n const $set = {};\n const newSet = [];\n newSet[0] = newaggr[newInstrument][newMeasurement][0];\n newSet[1] = newaggr[newInstrument][newMeasurement][1];\n newSet[2] = newaggr[newInstrument][newMeasurement][2];\n newSet[3] = newaggr[newInstrument][newMeasurement][3];\n newSet[4] = newaggr[newInstrument][newMeasurement][4];\n $set['subTypes.' + newInstrument + '.' + newMeasurement] = newSet;\n\n // add aggregates for new instrument/mesaurements\n AggrData.findAndModify({\n query: newQuery,\n update: {\n $set: $set\n },\n upsert: false,\n new: true\n });\n } else {\n const query0 = {};\n query0._id = subObj._id;\n query0[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'sum';\n const $set0 = {};\n $set0[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][0].val;\n AggrData.update(query0, { $set: $set0 });\n const query1 = {};\n query1._id = subObj._id;\n query1[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'avg';\n const $set1 = {};\n $set1[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][1].val;\n AggrData.update(query1, { $set: $set1 });\n const query2 = {};\n query2._id = subObj._id;\n query2[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'numValid';\n const $set2 = {};\n $set2[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][2].val;\n AggrData.update(query2, { $set: $set2 });\n const query3 = {};\n query3._id = subObj._id;\n query3[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'unit';\n const $set3 = {};\n $set3[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][3].val;\n AggrData.update(query3, { $set: $set3 });\n const query4 = {};\n query4._id = subObj._id;\n query4[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'Flag';\n const $set4 = {};\n $set4[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][4].val;\n AggrData.update(query4, { $set: $set4 });\n }\n });\n });\n }\n });\n });\n // drop temp collection that was placeholder for aggreagation results\n AggrResults.rawCollection().drop();\n}", "function getAllResult(){\r\n\t\r\n\tif (processDone) {\r\n for(var key in Obj_Fetch)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tvar temp_var={};\r\n\t\t\t\t\t\ttemp_var.cancertype=key;\r\n\t\t\t\t\t\ttemp_var.male=Obj_Fetch[key].MALE;\r\n\t\t\t\t\t\ttemp_var.female=Obj_Fetch[key].FEMALE;\r\n\t\t\t\t\t\tfetch_data_array.push(temp_var);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\taddAllScatterPlot(fetch_data_array);\r\n\t\t\t\t\t\t\r\n } else {\r\n setTimeout(getResult, 250);\r\n }\r\n }", "static processResults({ query, apiResponse, actions, submitFunc }) {\n const { input_ROIs: inputROIs = [], output_ROIs: outputROIs = [] } = query.pm;\n\n const colHeaders = this.getColumnHeaders(query);\n\n const data = apiResponse.data.map(row => {\n // if we get everything back as a JSON object, then we should be able to sort\n // and modify the response based on the colHeaders array\n\n const entry = row[0];\n const roiList = row[1];\n // make sure none is added to the rois list.\n roiList.push('None');\n const roiInfoObject = JSON.parse(entry.roiInfo);\n // for each row check to see if the row should be rejected\n if (rejectRowCheck('post', roiInfoObject, inputROIs)) {\n return null;\n }\n if (rejectRowCheck('pre', roiInfoObject, outputROIs)) {\n return null;\n }\n\n const { heatMap, barGraph } = generateRoiHeatMapAndBarGraph(\n roiInfoObject,\n roiList,\n entry.pre,\n entry.post\n );\n\n const filteredROIs = {};\n Object.keys(roiInfoObject).forEach(roi => {\n if (roiList.find(element => element === roi)) {\n filteredROIs[roi] = roiInfoObject[roi];\n }\n });\n const mitoTotal = Object.values(filteredROIs).reduce((i, info) => {\n if (info.mito) {\n return info.mito + i;\n }\n return i;\n }, 0);\n\n\n const converted = [];\n // loop over the colHeaders and look for the id/key in the JSON.\n colHeaders.forEach(header => {\n let colValue = entry[header.id] || '';\n // for certain headers we need to modify the returned results\n if (header.id === 'bodyId') {\n colValue = getBodyIdForTable(query.ds, entry[header.id], actions, {skeleton: true});\n }\n if (header.id === 'post') {\n const postQuery = createSimpleConnectionQueryObject({\n dataSet: query.ds,\n isPost: true,\n queryId: entry.bodyId\n });\n colValue = {\n value: entry.post,\n action: () => submitFunc(postQuery)\n };\n }\n if (header.id === 'pre') {\n const preQuery = createSimpleConnectionQueryObject({\n dataSet: query.ds,\n queryId: entry.bodyId\n });\n colValue = {\n value: entry.pre,\n action: () => submitFunc(preQuery)\n };\n }\n if (header.id === 'roiHeatMap') {\n colValue = heatMap;\n }\n if (header.id === 'roiBarGraph') {\n colValue = barGraph;\n }\n if (header.id === 'mitoTotal') {\n // TODO: this query object should be generated by the CellObjects plugin, so that\n // we aren't duplicating code here.\n const cypher = `MATCH(n :Cell {bodyId: ${entry.bodyId}}) -[]-> () -[]-> (m:Element) WHERE m.type=\"mitochondrion\" RETURN ID(m), m.type, m`;\n const mitoQuery = {\n dataSet: query.ds,\n pluginCode: 'cos',\n pluginName: 'CellObjects',\n parameters: {\n dataset: query.ds,\n bodyId: entry.bodyId,\n cypherQuery: cypher\n }\n };\n colValue = {\n value: mitoTotal,\n action: () => submitFunc(mitoQuery)\n };\n }\n if (header.id === 'mitoByType') {\n colValue = generateMitoByTypeBarGraph(filteredROIs, mitoTotal);\n }\n if (header.id === 'mitoByRegion') {\n colValue = generateMitoBarGraph(filteredROIs, mitoTotal);\n }\n const postMatch = header.id.match(/^roiPost(.*)$/);\n if (postMatch) {\n colValue = '0';\n if (roiInfoObject[postMatch[1]]) {\n colValue = roiInfoObject[postMatch[1]].post || '0';\n }\n }\n const preMatch = header.id.match(/^roiPre(.*)$/);\n if (preMatch) {\n colValue = '0';\n if (roiInfoObject[preMatch[1]]) {\n colValue = roiInfoObject[preMatch[1]].pre || '0';\n }\n }\n\n converted.push(colValue);\n });\n return converted;\n })\n .filter(row => row !== null);\n\n // replace headers that need to have JSX and not just text.\n const columns = colHeaders.map(header => {\n if (header.id === 'roiHeatMap') {\n return (\n <div>\n roi heatmap <ColorLegend />\n </div>\n );\n }\n return header.name;\n });\n\n\n return {\n columns,\n data,\n debug: apiResponse.debug,\n title: `Neurons with inputs in [${inputROIs}] and outputs in [${outputROIs}]`\n };\n }", "function aggregation(req, res, Output, Aggretation, Functions) {\n\n\tthis.aggregate = aggregate;\t\n\n\tfunction aggregate(){\n\t var cur_uri='';\n\t\tvar cur_end = -1;\n\t var grp=-1;\n \tvar groups = new Array();\n\t\tvar group_names = new Array();\n\t\tvar group_ends = new Array();\n\t Output.find({},function (err, C) {\n \t if (err) return console.error(err);\n\n\t\t\t//Group\n \tfor(var i=0; i < C.length; i++){\n if( C[i].uri != cur_uri ){\n grp++;\n cur_uri = C[i].uri;\n cur_end = C[i].end;\n groups[grp] = new Array();\n\t\t\t\t\tgroup_names.push(cur_uri);\n\t\t\t\t\tgroup_ends.push(cur_end);\n }\n if(groups[grp]){\n\t\t\t\t\tvar marks = C[i].marks.split(',').map(Number);\n\t\t\t\t\tfor(var j=0; j < marks.length; j++){\n\t\t\t\t\t\tif(marks[j] > 0){\n\t\t\t\t\t\t\tgroups[grp].push(marks[j]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n \t}\n\n\t\t\tvar videos = new Array;\n\t\t\tfor(var i=0; i < groups.length; i++){\n\t\t\t\tvar group = groups[i];\n\t\t\t\tgroup.sort(function(a,b){return a - b;});\n\t\t\t\tconsole.log('#'+group_names[i]);\n\t\t\t\tvar ranges = new Array;\n\t\t\t\tvar cur_range = -1;\n\t\t\t\tvar cur_value = -1;\n\t\t\t\tvar cont = 0;\n\t\t\t\tvar total = 0;\n\t\t\t\tfor(var j=0; j < group.length; j++){\n\t\t\t\t\tif(parseFloat(group[j]) > (cur_value + 0)){\n\t\t\t\t\t\tif(cur_range >= 0 && cont > 0){\n\t\t\t\t\t\t\tranges.push(parseFloat(total/cont));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcur_range++;\n\t\t\t\t\t\tcur_value = parseFloat(group[j]);\n\t\t\t\t\t\tcont = 0;\n\t\t\t\t\t\ttotal = 0;\n\t\t\t\t\t}\n\t\t\t\t\tcont++;\n\t\t\t\t\ttotal += parseFloat(group[j]);\n\t\t\t\t}\n\t\t\t\tvideos.push({'uri':group_names[i], 'starts':ranges, 'end':group_ends[i]});\n\t\t\t\tfor(var j=0; j < ranges.length; j++){\n\t\t\t\t\tconsole.log(ranges[j]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//Store\n\t\t\tfor(i=0; i < videos.length; i++){\n\t\t\t\t//console.log(videos[i]);\n\t\t\t\tvar starts = videos[i].starts;\n\t\t\t\tvar uri = videos[i].uri;\n\t\t\t\tvar end = videos[i].end;\n\t\t\t\tfor(var j=0; j < starts.length -1; j++){\n\t\t\t\t \tvar data ={'uri': uri,'start': starts[j],'end': starts[j+1]}\n \tvar a = new Aggregation(data);\n \ta.save(function (err, m0) {if (err) return console.error(err);});\t\n\t\t\t\t}\n \tvar data ={'uri': uri,'start': starts[starts.length-1],'end': end}\n var a = new Aggregation(data);\n a.save(function (err, m0) {if (err) return console.error(err);});\n\t\t\t}\n\n \t res.end();\n\t }).sort({'uri' : 1});\n\t}\n}", "function initialize_aggregate_data() {\n var aggregate_data = {};\n\n //When was this created?\n aggregate_data.initialized_time = new Date();\n //Is user aware? How many times is he reviewing his own data?\n //This could be used as a feedback to the system about user's awareness\n //(hence an indirect metric about users' savviness) and\n //also to warn user.\n aggregate_data.num_viewed = 0;\n aggregate_data.total_time_spent = 0;\n\n //Stats about general sites access\n aggregate_data.num_total_sites = 0;\n aggregate_data.all_sites_total_time_spent = 0;\n aggregate_data.all_sites_stats_start = new Date();\n\n //Stats and data about sites with user accounts (i.e. where user logs in)\n //user_account_sites[] is an associative array with key: site_name\n\n //Value corresponding to that is an object with following dictionary:\n //Each site is a record such as\n // site_name --> Primary Key\n // tts = Total Time Spent\n // tts_login = Total Time Spent Logged In\n // tts_logout = Total Time Spent Logged out\n // num_logins = Number of times logged in to a site\n // num_logouts = Number of times logged out of a site explicitly\n // latest_login = Last login time in the account\n // pwd_group = To group by sites using same password\n // site_category = Type of the site\n aggregate_data.num_user_account_sites = 0;\n aggregate_data.user_account_sites = {};\n\n //Stats and data about sites where user browses but never logs in\n //IMPORTANT: This detailed list of sites is only maintained in aggregate stats.\n // Its never reported to the server.\n //non_user_account_sites[] is an associative array with key: site_name\n //Value corresponding to that is an object with following dictionary:\n //site_name, last_access_time, total_time_spent, site_category\n aggregate_data.num_non_user_account_sites = 0;\n aggregate_data.non_user_account_sites = {};\n \n //Passwords data\n //pwd_groups is an associative array. Key is group name and values are list of sites\n //sharing that password\n aggregate_data.num_pwds = 0;\n\n // Password group name, sites in each group and password strength\n // Key: \"Grp A\" etc\n // Value: {\n // 'sites' : Array of domains,\n // 'strength' : Array of pwd strength,\n // 'full_hash' : A million times rotated hash value of salted passwd,\n // }\n aggregate_data.pwd_groups = {};\n aggregate_data.pwd_similarity = {};\n\n //Per site PI downloaded\n //Key: site name\n //Values: time downloaded\n // field_name --> field value\n aggregate_data.per_site_pi = {};\n \n //This is used to assign a unique identifier to\n //each possible value of PI.\n //For eg. an address like \"122, 5th ST SE, ATLANTA 30318, GA, USA\" will\n //get an identifier like \"address1\"\n //Or a name like \"Appu Singh\" will get an identifier like \"name3\"\n //This is useful to show in reports page (so that the real values are\n // shown in the tooltip). Also it helps to always assign a unique \n //identifier even if that thing is downloaded multiple times over the\n //time.\n aggregate_data.pi_field_value_identifiers = {};\n\n return aggregate_data;\n}", "function getProcessResults() {\n StatusService.stopWaiting();\n getFlowRows();\n if ( $scope.paramGrid.dissipation) {\n $scope.compositionFlow = CompositionFlowService.get($scope.process.compositionFlowID);\n $scope.paramGrid.dissipation.extractData();\n }\n getLciaResults();\n }", "function aggregateData(region_id) {\n let sales = 0\n let numAccounts = 0\n let salesAg = []\n let agSales = 0\n\n for (var key in region_lookup) {\n if (region_lookup[key] == region_id) {\n salesAg.push(key)\n }\n }\n if(salesAg.length > 0) {\n salesAg.forEach(zip => {\n sales = ((sales + postal4_lookup[zip]))\n agSales = (sales / 1000000).toFixed(2)\n numAccounts = parseInt(numAccounts + postal4_count[zip])\n })\n }\n document.getElementById('totalsales').innerHTML = `$${agSales} M`\n document.getElementById('totalaccounts').innerHTML = numAccounts.toLocaleString()\n }", "fetchAllStats(req, res) {\n const { user, query } = req;\n const { id: userId } = user;\n const { startDate, endDate } = query;\n const dates = {\n startDate: isValidDateFormat(startDate) ? startDate : -Infinity,\n endDate: isValidDateFormat(endDate) ? endDate : Infinity\n };\n\n // TODO: benchmark all these queries\n return Promise.all([\n // Checklists\n Checklist.fetchStats(userId, dates),\n // Scorecards\n ScoreCard.fetchStats(userId, dates),\n ScoreCard.fetchCompletedDays(userId, dates),\n ScoreCard.fetchScoresByDayOfWeek(userId, dates),\n ScoreCard.fetchTotalScoreOverTime(userId, dates),\n ScoreCard.fetchAbilityStats(userId, dates),\n // Tasks\n Task.fetchTopSelected(userId, dates),\n // Assessments\n Assessment.fetchStats(userId, dates),\n // Assessments - Depression\n Assessment.fetchCompletedDaysByType(DEPRESSION, userId, dates),\n Assessment.fetchScoresByDayOfWeek(DEPRESSION, userId, dates),\n Assessment.fetchScoreRangeFrequency(DEPRESSION, userId, dates),\n Assessment.fetchQuestionStats(DEPRESSION, userId, dates),\n Assessment.fetchScoresByTask(DEPRESSION, userId, dates),\n // Assessments - Anxiety\n Assessment.fetchCompletedDaysByType(ANXIETY, userId, dates),\n Assessment.fetchScoresByDayOfWeek(ANXIETY, userId, dates),\n Assessment.fetchScoreRangeFrequency(ANXIETY, userId, dates),\n Assessment.fetchQuestionStats(ANXIETY, userId, dates),\n Assessment.fetchScoresByTask(ANXIETY, userId, dates),\n // Assessments - Wellness\n Assessment.fetchCompletedDaysByType(WELL_BEING, userId, dates),\n Assessment.fetchScoresByDayOfWeek(WELL_BEING, userId, dates),\n Assessment.fetchScoreRangeFrequency(WELL_BEING, userId, dates),\n Assessment.fetchQuestionStats(WELL_BEING, userId, dates),\n Assessment.fetchScoresByTask(WELL_BEING, userId, dates)\n ])\n .then(result => {\n const [\n // Checklist stats // TODO: deprecate!\n checklistStats,\n // Scorecard stats\n scorecardStats,\n completedScorecards,\n scorecardScoresByDay,\n totalScoreOverTime,\n taskAbilityStats,\n // Task stats\n topTasks,\n // Assessment stats\n assessmentStats,\n // Assessments - Depression\n completedDepressionAssessments,\n depressionScoresByDay,\n depressionLevelFrequency,\n depressionQuestionStats,\n depressionScoresByTask,\n // Assessments - Anxiety\n completedAnxietyAssessments,\n anxietyScoresByDay,\n anxietyLevelFrequency,\n anxietyQuestionStats,\n anxietyScoresByTask,\n // Assessments - Wellness\n completedWellnessAssessments,\n wellnessScoresByDay,\n wellnessLevelFrequency,\n wellnessQuestionStats,\n wellnessScoresByTask\n ] = result;\n\n const {\n anxiety: anxietyStats = [],\n depression: depressionStats = [],\n wellbeing: wellBeingStats = []\n } = assessmentStats;\n\n const correlationStats = Reporting.calculateCoefficientStats({\n scorecardStats,\n anxietyStats,\n depressionStats,\n wellBeingStats\n });\n\n const stats = {\n // Checklist stats // TODO: deprecate!\n checklistStats,\n // Scorecard stats\n scorecardStats,\n completedScorecards,\n scorecardScoresByDay,\n totalScoreOverTime,\n taskAbilityStats,\n // Task stats\n topTasks,\n // Assessment stats\n assessmentStats,\n // Aliases for backwards compatibility\n completedChecklists: completedDepressionAssessments,\n checklistScoresByDay: depressionScoresByDay,\n checklistQuestionStats: depressionQuestionStats,\n checklistScoresByTask: depressionScoresByTask,\n depressionLevelFrequency,\n // Assessments - Depression\n completedDepressionAssessments,\n depressionScoresByDay,\n depressionQuestionStats,\n depressionScoresByTask,\n // Assessments - Anxiety\n completedAnxietyAssessments,\n anxietyScoresByDay,\n anxietyLevelFrequency,\n anxietyQuestionStats,\n anxietyScoresByTask,\n // Assessments - Wellness\n completedWellnessAssessments,\n wellnessScoresByDay,\n wellnessLevelFrequency,\n wellnessQuestionStats,\n wellnessScoresByTask,\n // Correlation Coefficients\n correlationStats\n };\n\n return res.json({ stats });\n })\n .catch(err => handleError(res, err));\n }", "function totalRows(err, rows, fields, req, res, names, searchquery) {\n\tif (err) throw err;\n\trecordsTotal = rows[0].total;\n\n\tconnection.query(\n\t\"SELECT COUNT(*) AS total FROM benchmark\"+searchquery,\n\t(err, rows, fields) => {filteredRows(err, rows, fields, req, res, recordsTotal, searchquery, names)});\n}", "getAggregatedData(variable, options, success, error) {\n const deployedURL = appManager.getDeployedURL();\n if (deployedURL) {\n return this.aggregateData(deployedURL, variable, options, success, error);\n }\n }", "getRelatedRecords(results, dataStore){\n const relationships = this.relationships;\n let cnt = 0, finalCnt = 0; \n if(relationships && relationships.length > 0 ){\n results.map(result => { \n relationships.map(relation=>{\n cnt = 0;\n let relatedStore = dataStore[relation.model];\n let key = (relation.in_current === true) ? relation.primary_key : relation.foreign_key;\n let val = (relation.in_current === true) ? result[relation.foreign_key] : result[relation.primary_key];\n let items = this.getRelatedValue(relatedStore,key,val);\n items.map(item => {\n cnt++;\n let k = `${[relation.model]}_${cnt}`;\n if(k in result){\n cnt = finalCnt+1;\n }\n k = `${[relation.model]}_${cnt}`;\n //result[[relation.model]] = item[relation.return_value];\n result[k] = item[relation.return_value];\n finalCnt = cnt;\n }); \n }); \n });\n }\n return results;\n }", "queryAllSuccess(collection, action) {\n const data = this.extractData(action);\n const mergeStrategy = this.extractMergeStrategy(action);\n return {\n ...this.entityChangeTracker.mergeQueryResults(data, collection, mergeStrategy),\n loaded: true,\n loading: false,\n };\n }", "function assembleDatums(_result) {\n // *** //\n var obj = {};\n\n _result.forEach(function (d) {\n var id = Object.keys(d)[0];\n\n obj[id] = d[id];\n });\n\n _result = obj;\n\n var _totalNum = 0;\n //Get event and time\n for (var caseId in _result) {\n if (_result.hasOwnProperty(caseId) && _result[caseId] !== \"\" && caseList.indexOf(caseId) !== -1) {\n var _datum = jQuery.extend(true, {}, datum);\n _datum.case_id = _result[caseId].case_id;\n _datum.time = _result[caseId].months;\n _datum.status = _result[caseId].status;\n if (_datum.time !== \"NA\" && (_datum.status !== \"NA\" && typeof _datum.status !== \"undefined\" && _datum.status !== undefined)) {\n datumArr.push(_datum);\n _totalNum += 1;\n }\n }\n }\n // *** //\n //Sort by time\n cbio.util.sortByAttribute(datumArr, \"time\");\n //Set num at risk\n for (var i in datumArr) {\n datumArr[i].num_at_risk = _totalNum;\n _totalNum += -1;\n }\n }", "function rghResult(result) {\n // send result back to app\n if (isEmptyObject(resultObject)) {\n resultObject = result;\n }\n else {\n resultObject = _.concat(resultObject, result); // concat/merge with existing group results\n }\n getGroupFiles(++groupIndex); // get next group template to merge\n }", "async myTask(data, msg, conn, ch, db) {\n\n\t\ttry {\n\n\t\t\tlet query = {};\n\n\t\t\tdata.filters = data.filters || {};\n\n\t\t\tif (data.filters.minDate) {\n\t\t\t\tquery['$gte'] = new Date(data.filters.minDate);\n\t\t\t}\n\n\t\t\tif (data.filters.maxDate) {\n\t\t\t\tquery['$lte'] = new Date(data.filters.maxDate);\n\t\t\t}\n\n\t\t\tlet rows = await db.collection('test_usage').aggregate([{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: {\n\t\t\t\t\t\t'id_submission': '$id_submission',\n\t\t\t\t\t\t'source_etl': '$source_etl',\n\t\t\t\t\t\t'team': '$team',\n\t\t\t\t\t\t'app': '$app',\n\t\t\t\t\t\t'player_id': '$player_id',\n\t\t\t\t\t\t'device': '$device',\n\t\t\t\t\t},\n\t\t\t\t\ttest_date: {$first: '$time_video_started'},\n\t\t\t\t\tnumber_of_responses: {$sum: 1},\n\t\t\t\t\ttype_scores: {$push: '$type_score'},\n\t\t\t\t\tlocation_scores: {$push: '$location_score'},\n\t\t\t\t\tcompletely_correct_scores: {$push: '$completely_correct_score'},\n\t\t\t\t\ttotal_completely_correct_scores: {$push: '$total_completely_correct_score'}\n\t\t\t\t},\n\t\t\t}, {$match: {'test_date': query}},\n\t\t\t\t{$sort: {\"test_date\": -1}}], { allowDiskUse: true }).toArray();\n\n\t\t\tconsole.log(` [x] Wrote ${JSON.stringify(rows)} to ${this.DbName + '.' + c}`);\n\n\t\t\tch.ack(msg);\n\n\t\t\treturn rows.map(x => Object.assign({\n\t\t\t\tdevice: (x.device || \"\"),\n\t\t\t\tid_submission: (x.id_submission || \"\"),\n\t\t\t\tteam: (x.team || \"\"),\n\t\t\t\tplayer_id: (x.player_id || \"\"),\n\t\t\t\tsource_etl: (x.source_etl || \"\"),\n\t\t\t\tapp: (x.app || \"\"),\n\t\t\t\tnumber_of_responses: (x.number_of_responses || 0),\n\t\t\t\ttype_scores: (x.type_scores || []).length,\n\t\t\t\tlocation_scores: (x.location_scores || []).length,\n\t\t\t\tcompletely_correct_scores: (x.completely_correct_scores || []).length,\n\t\t\t\ttotal_completely_correct_scores: (x.total_completely_correct_scores || []).length,\n\t\t\t\ttest_date: (x.test_date ? moment(x.test_date).utcOffset(-6).format('MMMM Do YYYY') : null)\n\t\t\t}, x._id));\n\t\t} catch (ex) {\n\t\t\tthis.logError(data, msg, ex);\n\t\t}\n\t}", "async leaderBoardAllTime(req, res){\n\t\ttry {\n\t\t\tvar leaderBoard = await UserModel.aggregate([\n\t\t\t\t{$unwind: '$performance'},\n\t\t\t\t{$group: {\n\t\t\t\t\t\t_id: '$_id',\n\t\t\t\t\t\tamount: {$sum: '$performance.prizeMoney.amount'},\n\t\t\t\t\t\tcorrectCount: {$sum: '$performance.correctCount'},\n\t\t\t\t\t\tincorrectCount: {$sum: '$performance.incorrectCount'}\n\t\t\t\t}},\n\t\t\t\t{$sort: {amount: -1}}\n\t\t\t])\n\t\t} catch(err) {\n\t\t\tHelper.notifyError(err, `Error in fetching leaderBoard in user controller`)\n\t\t\treturn res.status(510).send({\n\t\t\t\tmessage: `Something went wrong. Please try again`,\n\t\t\t\terr: err.message\n\t\t\t})\n\t\t}\n\t\treturn res.status(200).send({\n\t\t\tleaderBoard: leaderBoard,\n\t\t\tmessage: 'Operation successful.'\n\t\t})\n\t}", "function utilityPointCompleted(grandTotal) {\n var total_number_utilPoint = {\n onStatisticField: \"LAYER\",\n outStatisticFieldName: \"total_number_utilPoint\",\n statisticType: \"count\"\n };\n\nvar total_completed_utilPoint = {\nonStatisticField: \"CASE WHEN Status = 1 THEN 1 ELSE 0 END\",\noutStatisticFieldName: \"total_completed_utilPoint\",\nstatisticType: \"sum\"\n};\n\nvar query = utilPointLayer.createQuery();\nquery.outStatistics = [total_number_utilPoint, total_completed_utilPoint];\nquery.groupByFieldsForStatistics = [\"CP\"];\n\nvar point_cpN01 = [];\nvar point_cpN01_a = [];\n\nvar point_cpN02 = [];\nvar point_cpN02_a = [];\n\nvar point_cpN03 = [];\nvar point_cpN03_a = [];\n\nvar point_cpN04 = [];\nvar point_cpN04_a = [];\n\nvar point_cpN05 = [];\nvar point_cpN05_a = [];\n\nreturn utilPointLayer.queryFeatures(query).then(function(response) {\nstats = response.features;\n\nstats.forEach((result, index) => {\nconst attributes = result.attributes;\nconst cpPackage = result.attributes.CP;\nconst completed = attributes.total_completed_utilPoint;\nconst totalUtilPoint = attributes.total_number_utilPoint;\n\nif (cpPackage === 'N-01') {\n point_cpN01.push(completed);\n point_cpN01_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-02') {\n point_cpN02.push(completed);\n point_cpN02_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-03') {\n point_cpN03.push(completed);\n point_cpN03_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-04') {\n point_cpN04.push(completed);\n point_cpN04_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-05') {\n point_cpN05.push(completed);\n point_cpN05_a.push(totalUtilPoint);\n}\n});\nreturn [point_cpN01, point_cpN02, point_cpN03, point_cpN04, point_cpN05, point_cpN01_a, point_cpN02_a, point_cpN03_a, point_cpN04_a, point_cpN05_a, grandTotal];\n});\n}", "async function getStatisticalAverage(type, start, number) {\n\n for (let i = 0; i < number; i++) {\n let query = createQueryString(start, type, i);\n let data = await executeRequest('http://server-cache/StatisticalAverage/fragment' + query);\n\n let result = await new Promise(resolve => {\n let parser = new n3.Parser();\n let result = [];\n\n parser.parse(data, (err, triple, prefixes) => {\n if (triple) {\n if (triple.predicate.value === 'http://datapiloten.be/vocab/timeseries#mean') {\n result.push({sensor: triple.subject.value, value: triple.object.value});\n }\n } else {\n resolve(result);\n }\n });\n });\n\n for (let j = 0; j < result.length; j++) {\n let tmp = result[j];\n let sensor = tmp.sensor.substring(0, tmp.sensor.lastIndexOf('/'));\n let property = tmp.sensor.substring(tmp.sensor.lastIndexOf('/') + 1, tmp.sensor.length);\n\n // console.log(\"SENSOR: \" + sensor);\n // console.log('\\tProperty: ' + property);\n // console.log('\\tValue: ' + tmp.value)\n }\n }\n\n}", "function SupplierTotalOrderRevenueAccDate(dbName, start_date, end_date, supplierId) {\n return new Promise(async (resolve, reject) => {\n let final_result=[],result=[],count = 0,temp;\n var sql1 = \" select id from supplier_branch where supplier_id = ? \"\n let get_branch = await ExecuteQ.Query(dbName,sql1,[supplierId])\n let total=0,commision_given_to_admin=0,order_ids,order_data,reveneu_data,agentConnection={},ary,agent_order_data;\n\n for(const [index1,j] of get_branch.entries()){\n order_data=await supplierProfitAfterTaxCommissionAccDate(dbName,j.id,start_date,end_date);\n order_ids=order_data.order_ids;\n reveneu_data=order_data.revenue_data\n logger.debug(\"=====order==Data==>>\",reveneu_data)\n if(order_ids && order_ids.length>0){\n let getAgentDbData=await common.GetAgentDbInformation(dbName); \n // logger.debug(\"===AGENT==CONNECTION==>>==2=\",Object.entries(agentConnection).length);\n if(Object.entries(agentConnection).length===0){\n agentConnection=await common.RunTimeAgentConnection(getAgentDbData);\n }\n let a_sql=\"select IFNULL(DAYOFWEEK(`co`.`created_on`),0) as week_day,IFNULL(DATE(`co`.`created_on`),0) as created_at,\"+\n \" IFNULL(sum(co.commission_ammount),0) AS total_revenue\"+\n \" from cbl_user_orders co join cbl_user cu on cu.id=co.user_id where DATE(created_on) >='\"+start_date+\"'\"+\n \" and DATE(co.created_on) <= '\"+end_date+\"' and co.order_id IN(\"+order_ids+\") and cu.supplier_id=0 group by DATE(co.created_on) \"\n agent_order_data=await ExecuteQ.QueryAgent(agentConnection,a_sql,[]);\n logger.debug(\"======AGENT==ORDER==>>\",agent_order_data)\n if(reveneu_data && reveneu_data.length>0){\n for(const [rindex,j] of reveneu_data.entries()){\n temp = {\n week_day : j.week_day,\n created_at : j.created_at,\n total_revenue : j.total_revenue\n }\n if(agent_order_data && agent_order_data.length>0){\n for(const [aindex,k] of agent_order_data.entries()){\n if(k.created_at==j.created_at){\n // logger.debug(\"====MATCH===\",k.total_revenue)\n temp.total_revenue= temp.total_revenue-k.total_revenue\n }\n }\n }\n final_result.push(temp)\n }\n }\n }\n \n } \n resolve(final_result)\n \n \n // multiConnection[dbName].query(sql1, [supplierId], function (err, result1) {\n // var sql = \"SELECT IFNULL(DAYOFWEEK(`created_on`),0) as week_day,IFNULL(DATE(`created_on`),0) as created_at,IFNULL(SUM(supplier_commision),0) as total_revenue from orders where created_on >='\" + start_date + \"' and created_on <= '\" + end_date + \"' and supplier_branch_id = ? and status = 5 \"\n // if (result1.length) {\n // for (var i = 0; i < result1.length; i++) {\n // (function (i) {\n // multiConnection[dbName].query(sql, [result1[i].id], function (err, result) {\n // if (err) {\n // reject(err)\n // }\n // let temp;\n // if(result[0].total_revenue){\n // temp = {\n // week_day : result[0].week_day,\n // created_at : result[0].created_at,\n // total_revenue : result[0].total_revenue\n // }\n // final_result.push(temp)\n // }\n // if (i == result1.length - 1) {\n // resolve(final_result);\n // }\n // });\n // })(i);\n // }\n // }\n // else {\n // resolve(final_result)\n // }\n // });\n\n })\n}", "function aggregateQuery(){\n if (rectangleIsDragged)\n return;\n if (processingRequest)\n return; // Another request already in progress\n if ($(\"#fromDatePicker\").val().length == 0 || $(\"#toDatePicker\").val().length == 0) {\n alert('Please specify start and end date');\n return;\n }\n if (rectangle == null) {\n alert(\"Please specify a rectangle\");\n return;\n }\n processingRequest = true;\n var fromDate = document.getElementById(\"fromDatePicker\").value;\n var toDate = document.getElementById(\"toDatePicker\").value;\n var ne = rectangle.getBounds().getNorthEast();\n var sw = rectangle.getBounds().getSouthWest();\n requestURL = \"cgi-bin/aggregate_query.cgi?\"\n + \"min_lat=\" + sw.lat() + \"&min_lon=\" + sw.lng()\n + \"&max_lat=\" + ne.lat() + \"&max_lon=\" + ne.lng()\n + \"&fromDate=\" + fromDate\n + \"&toDate=\" + toDate;\n jQuery.ajax(requestURL, {success : function(data) {\n min = ((parseInt(data.results.min)/50) - 273.15) * 1.8000 + 32.00;\n $(\"#min\").val(min);\n max = ((parseInt(data.results.max)/50) - 273.15) * 1.8000 + 32.00;\n $(\"#max\").val(max);\n sum = data.results.sum;\n count = parseInt(data.results.count);\n average = ((sum/count / 50.0)-273.15)*1.8+32;\n $(\"#avg\").val(average);\n timeInMillis = parseInt(data.stats.totaltime);\n $(\"#time\").val(timeInMillis);\n $(\"#partitions\").val(data.stats[\"num-of-temporal-partitions\"]);\n $(\"#files\").val(data.stats[\"num-of-trees\"]);\n }, complete: function() {\n processingRequest = false;\n }});\n}", "function loadData(result) {\n var grouped = _.groupBy(JSON.parse(result), 'Week');\n var groupedData = _.map(grouped, function (current) {\n return {\n week: current[0].Week,\n values: current\n };\n });\n var computedResult = _.map(groupedData, function (current) {\n var counted = _.countBy(current.values, function (object) {\n return object['BILLABLE'] == 'Billable' ? 'Billable' : 'NonBillable'\n });\n return {\n date: new Date(Date.parse(current.week)),\n week: current.week,\n values: counted\n };\n }); \n loadDataToMongo(computedResult);\n}", "mergeQueryResults(entities, collection, mergeStrategy) {\n return this.mergeServerUpserts(entities, collection, MergeStrategy.PreserveChanges, mergeStrategy);\n }", "function aggregated(data) {\n if (!data) {\n return;\n }\n\n return data.reduce(function (previousValue, obj) {\n if (!obj.net_total) {\n return previousValue + 0;\n }\n return previousValue + obj.net_total.value;\n }, 0)\n\n }", "get aggregatedByLink() {\n const df = this.filteredDataFrame;\n if (df === null || df.shape[0] === 0) {\n return null;\n }\n let dfAggregated = df.groupby(['source', 'sourceName', 'target', 'targetName']).col([COLUMN_WEIGHT]).sum();\n dfAggregated.rename({ [`${COLUMN_WEIGHT}_sum`]: COLUMN_WEIGHT }, { inplace: true });\n\n // Sort\n dfAggregated = dfAggregated.sortValues(COLUMN_WEIGHT, { ascending: false });\n dfAggregated.resetIndex({ inplace: true });\n\n runInAction(() => {\n // Min/max weights\n this.minLinkWeight = dfAggregated[COLUMN_WEIGHT].min();\n this.maxLinkWeight = dfAggregated[COLUMN_WEIGHT].max();\n \n this.dfLinkTotals = dfAggregated;\n });\n const links = dfd.toJSON(dfAggregated);\n return links.slice(0, this.topN);\n }", "async postParsingAnalysis () {\n var mapped = Object.keys(this.results).map(addr => {return { addr: addr, count: this.results[addr] }})\n var sortedByCount = this.sortEntriesByCount(mapped)\n var topNentries = this.getTopN(sortedByCount, N)\n\n var fileName = `${this.baseOutPath}-${analysisName}.json`\n var fileContent = {\n // Signal and format to visualize as piechart\n piechart: {\n datasets: [{\n backgroundColor: ['#D33F49', '#77BA99', '#23FFD9', '#27B299', '#831A49'],\n data: this.formatData(topNentries)\n }],\n labels: await this.formatLabelsForPieChart(topNentries)\n },\n hint: 'The labels of this chart have been computed using temporally sensitive data'\n }\n var summary = {\n fileName: fileName,\n attackCategory: 'Network State',\n analysisName: `Top ${N} sources by traffic`,\n supportedDiagrams: ['PieChart']\n }\n return await this.storeAndReturnResult(fileName, fileContent, summary)\n }", "function loadData() {\n consolidatedresults.loaded = false;\n dataService.getConsolidatedResults()\n .then(function(response) {\n //handle the success condition here\n var data = response.data;\n consolidatedresults.realdata = data[0];\n consolidatedresults.col_names = data[1];\n consolidatedresults.loaded = true;\n // console.log(consolidatedresults.realdata);\n // console.log(consolidatedresults.col_names);\n });\n }", "function getAverageLoadTime(data, key, count, endField, startField) {\n var sum = 0;\n\n for (var i = 1; i <= count; i++) {\n var index = key + \"_\" + i;\n\n //console.log(\"attempting to parse? \" + index )\n if (index in data) {\n var temp = JSON.parse(data[index]);\n var end = parseInt(temp[endField])\n var start = parseInt(temp[startField])\n sum += end - start;\n }\n }\n console.log(\"sum is \" + sum + \" avg is \" + (sum / count))\n return sum / count;\n}", "async function getAvgStats() {\n\n await dbConnection.collection(collection.log).aggregate([\n {\n $group :\n {\n _id : \"$conversation_id\",\n conversations: { $push: \"$$ROOT\" }\n }\n },\n {$unwind: \"$conversations\"},\n {$group: {\n _id: \"$_id\",\n firstItem: { $first: \"$conversations\"},\n lastItem: { $last: \"$conversations\"},\n countItem: { \"$sum\": 1 }\n }},\n\n { \"$project\": {\n \"minutes\": {\n \"$divide\": [{ \"$subtract\": [ \"$lastItem.date\", \"$firstItem.date\" ] }, 1000*60]\n },\n \"counter\": \"$lastItem.context.system.dialog_request_counter\"\n },\n },\n\n {\n \"$match\": { \"counter\": {$gt: 2} , \"minutes\": {$lt: 120} }\n },\n // then group as normal for the averaging\n {$group: {\n _id: 0,\n minutes: {$avg: \"$minutes\"},\n counter: {$avg: \"$counter\"},\n }}\n ],\n {\n cursor: {\n batchSize: 10000\n },\n allowDiskUse: true,\n explain: false\n }, null\n ).toArray()\n .then(stats => {\n return {minutes: stats.minutes, counter: stats.counter}\n })\n}", "async function processResults(poolQuery, results) {\n for (let i = 0; i < results.length; i += rowSplit) {\n const insert = await createInsert(results, i, rowSplit, table, staticParam, poolQuery, existsAttr);\n console.log(insert);\n try {\n const records = await poolQuery(insert);\n console.dir(records);\n } catch (e) { console.log(e); }\n }\n }", "loadAll(filterQuery) {\r\n var esQuery = '';\r\n if( filterQuery != \"\" ){\r\n esQuery = filterQuery;\r\n }\r\n var defer = this.$q.defer();\r\n var vm = this;\r\n this.esClient.msearch({\r\n body: [\r\n {\r\n index: ES_Details.NaprawaSpawarekIndex,\r\n type: 'main',\r\n size: 10000\r\n },\r\n { query: { match_all: {} } },\r\n {\r\n index: ES_Details.ManufacturerIndex,\r\n type: 'main',\r\n size: 10000\r\n },\r\n { query: { match_all: {} } },\r\n {\r\n index: ES_Details.MachineryIndex,\r\n type: 'main',\r\n size: 10000\r\n },\r\n { query: { match_all: {} } },\r\n {\r\n index: ES_Details.CustomersIndex,\r\n type: 'main',\r\n size: 10000\r\n },\r\n { query: { match_all: {} } }\r\n ]\r\n })\r\n .then(function(result) {\r\n console.log(\"Result:\",result);\r\n // wszystko oprocz stanow idzie do jednego wora\r\n for (var i = 1; i < result.responses.length; i++) {\r\n var response = result.responses[i];\r\n response.hits.hits.forEach(hit => {\r\n vm.dataStore[hit._id] = hit._source;\r\n });\r\n }\r\n // stany ida do osobnego wora\r\n result.responses[0].hits.hits.forEach(hit => {\r\n var hitData = hit._source;\r\n hitData.id = hit._id;\r\n hitData.Klient = vm.dataStore[hitData.idKlienta];\r\n hitData.Urzadzenie = vm.dataStore[hitData.idModelu];\r\n hitData.Urzadzenie.Producent = vm.dataStore[hitData.Urzadzenie.idProducenta];\r\n vm.inWarehouse.push(hitData);\r\n });\r\n\r\n console.log(\"Processed Result:\",vm.dataStore);\r\n console.log(\"Processed Result:\",vm.inWarehouse);\r\n defer.resolve(vm.inWarehouse);\r\n });\r\n return defer.promise;\r\n }", "async function GetDocumentAnalysisResults() {\n let maxResults = 1000;\n let paginationToken = null;\n let finished = false;\n\n let keyMap = {};\n let valueMap = {};\n let blockMap = {};\n\n let blockMapTable = {};\n let table_blocks = [];\n\n\n while (finished == false) {\n let response = null;\n let documentAnalysisRequest = {\n JobId: startJobId,\n MaxResults: maxResults,\n NextToken: paginationToken\n };\n\n response = await new Promise((resolve, reject) => {\n textract.getDocumentAnalysis(documentAnalysisRequest, (err, data) => {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n });\n });\n\n let blocks = response.Blocks;\n console.log(\"Analyzed Document Text\");\n console.log(\"Pages:\" + response.DocumentMetadata.Pages);\n\n \n blocks.forEach(block => {\n \n blockId = block.Id;\n blockMapTable[blockId] = block;\n blockMap[blockId] = block;\n\n if (block.BlockType == \"KEY_VALUE_SET\") {\n if(_.includes(block.EntityTypes,\"KEY\")){\n keyMap[blockId] = block\n }else{\n valueMap[blockId] = block\n }\n }\n\n if(block.BlockType==\"TABLE\"){\n table_blocks.push(block)\n }\n\n //DisplayBlockInfo(block);\n if (response.NextToken) {\n paginationToken = response.NextToken\n } else {\n finished = true;\n }\n\n });\n\n }\n\n //Form data processing \n let result\n if(keyMap.length <= 0){\n console.log(\"No Form Data\")\n }else{\n const keyValues = getKeyValueRelationship(keyMap, valueMap, blockMap);\n result = keyValues\n }\n \n //Table data processing\n let csv = {}\n if (table_blocks.length <= 0){\n console.log(\"No tables found\")\n }else{\n for(const [index,table] of table_blocks.entries()){\n let [rows,tableId] = generateTableCsv(table,blockMapTable,index+1)\n csv[tableId] = rows\n }\n }\n\n console.log(\"Operation Complete\")\n return [result,csv]\n \n}", "function getDataFromHarvest(){\n if (count >= ids.length){\n saveReportData();\n }else{\n harvest_options.url = harvestURL_pt1+ ids[count]+harvestURL_pt2;\n count++;\n request(harvest_options, addDataToArray);\n } \n }", "async getSummaryMetricsCsv(req, res) {\n const { initTrim, endTrim, labFilter } = req.query\n const { start: initDate } = await trimestersService.getSpecificTrim(initTrim);\n const { finish: endDate } = await trimestersService.getSpecificTrim(endTrim);\n const reservationsRequests = await metricsService.getReservationsRequests({ endDate, initDate, labFilter });\n if (reservationsRequests.length) {\n const formattedMetrics = await metricsService.getFormattedMetrics(reservationsRequests);\n\n await Promise.all([\n getSummaryReport(formattedMetrics),\n getLabsReport(formattedMetrics),\n getCareersReport(formattedMetrics),\n getSubjectsReport(formattedMetrics),\n ])\n\n await compressFiles(filePath)\n .then(downloadFile(res))\n }\n return res.status(204).end();\n }", "function addResults(transport, next) {\n\t queryTransport(transport, function (err, result) {\n\t //\n\t // queryTransport could potentially invoke the callback\n\t // multiple times since Transport code can be unpredictable.\n\t //\n\t if (next) {\n\t result = err || result;\n\t if (result) {\n\t results[transport.name] = result;\n\t }\n\n\t next();\n\t }\n\n\t next = null;\n\t });\n\t }", "async function getConversationDataSet(){\n\n let cursor = dbConnection.collection(collection.log).aggregate(\n [\n {\n $group :\n {\n _id : \"$conversation_id\",\n conversations: { $push: \"$$ROOT\" }\n }\n },\n {$unwind: \"$conversations\"},\n {$group: {\n _id: \"$_id\",\n firstItem: { $first: \"$conversations\"},\n lastItem: { $last: \"$conversations\"},\n countItem: { \"$sum\": 1 }\n }},\n\n { \"$project\": {\n\n \"conversation_id\": \"$_id\",\n \"minutes\": {\"$divide\": [{ \"$subtract\": [ \"$lastItem.date\", \"$firstItem.date\" ] }, 1000*60]},\n \"seconds\": {\"$divide\": [{ \"$subtract\": [ \"$lastItem.date\", \"$firstItem.date\" ] }, 1000]},\n \"counter\": \"$lastItem.context.system.dialog_request_counter\"\n },\n\n },\n {\n \"$match\": { \"counter\": {$gt: 3 } , \"minutes\": {$lt: 60} }\n }\n ],\n {\n cursor: {\n batchSize: 10000\n },\n allowDiskUse: true,\n explain: false\n }, null).toArray()\n .then((dataset) => dataset)\n return cursor;\n}", "getStats(data) {\n const totalEvents = data.length;\n let totalWeight = 0;\n let totalVolume = 0;\n let totalBags = 0;\n let ret = [];\n\n for (let i = 0; i < data.length; i++) {\n totalBags += data[i].bags.length;\n totalWeight += _.reduce((_.pluck(data[i].bags, 'weight')), function (memo, num) {\n return memo + num;\n }, 0);\n totalVolume += _.reduce((_.pluck(data[i].bags, 'volume')), function (memo, num) {\n return memo + num;\n }, 0);\n }\n\n ret = {\n totalEvents: totalEvents,\n totalWeight: this.numFormatter(Math.round(totalWeight)),\n totalVolume: this.numFormatter(Math.round(totalVolume)),\n totalBags: totalBags,\n };\n return ret;\n }", "static async getTotalRakeByDate(req, res) {\n const query = 'SELECT game_date, SUM(rakeamount) AS TotalRake FROM game GROUP BY game_date;'\n connection.query(query, { type: connection.QueryTypes.SELECT })\n .then(rows => {\n console.log(rows)\n res.json(rows)\n })\n }", "function populateResults() {\r\n if (!routeGroupsList.length) return;\r\n let count = 0;\r\n // Create a new CSV data file\r\n csvData = [];\r\n var output = `\r\n <table class=\"data-table\">\r\n <tr>\r\n <th>#</th>\r\n <th>Carrier</th>\r\n <th>Departure</th>\r\n <th>Arrival</th>\r\n <th>Service/Vessel</th>\r\n <th>Transit Time</th>\r\n </tr> \r\n `;\r\n // Run through each of the groups\r\n routeGroupsList.forEach((group, index) => {\r\n // Now run through each of the items in the group\r\n\r\n group.route.forEach((item) => {\r\n count++;\r\n\r\n let carrier = group.carrier.name;\r\n let { transitTime } = item;\r\n let departure = item.por.location.name;\r\n let depDate = item.por.etd;\r\n let arrival = item.fnd.location.name;\r\n let arvDate = item.fnd.eta;\r\n let code, name;\r\n\r\n if (item.leg[0].service) {\r\n code = item.leg[0].service.code;\r\n name = item.leg[0].service.name;\r\n }\r\n\r\n output += `\r\n <tr>\r\n <td>${count}</td>\r\n <td>${carrier}</td>\r\n <td>\r\n <div>${departure}</div>\r\n <small>${moment(depDate).format('D MMM, YYYY (ddd)')}</small>\r\n </td>\r\n <td>\r\n <div>${arrival}</div>\r\n <small>${moment(arvDate).format('D MMM, YYYY (ddd)')}</small>\r\n </td>\r\n <td>\r\n <div>${code ? code : ''}</div>\r\n <small>${name ? name : ''}</small></td>\r\n <td>${transitTime} days</td>\r\n </tr>\r\n `;\r\n\r\n transitTime += ' days';\r\n\r\n csvData.push([carrier, departure, arrival, code, transitTime]);\r\n });\r\n });\r\n\r\n output += `</table>`;\r\n\r\n document.querySelector('.count').innerText = `Total ${count} results`;\r\n document.querySelector('.results').innerHTML = output;\r\n downloadCSV(csvData);\r\n}", "updateResults() {\n if (this.reindexFlag_) {\n this.reindex();\n }\n\n var results = [];\n if (this.timeModel_ && this.binMethod) {\n // make sure the source time model is filtered on the correct range\n if (this.source) {\n this.source.getFilteredFeatures();\n }\n\n var tempFilters = {};\n var filters = this.getParentFilters();\n if (filters) {\n for (var id in filters) {\n if (filters[id] != null) {\n this.timeModel_.filterDimension(id, filters[id]);\n } else {\n // there's a disturbance in the force - don't return any bins! see getParentFilters for details.\n this.results = [];\n return;\n }\n }\n }\n\n // clear the filters to get all of the data, reapply them a little farther down\n if (this.forceAllData_ == true) {\n tempFilters = this.timeModel_.clearAllFilters();\n }\n\n if (this.secondaryBinMethod) {\n results = /** @type {!Array<!os.histo.Result<!ol.Feature>>} */ (this.timeModel_.groupData(this.multiId_,\n this.combinedKeyMethod.bind(this), this.reduceAdd.bind(this),\n this.reduceRemove.bind(this), this.reduceInit.bind(this)));\n } else {\n results = /** @type {!Array<!os.histo.Result<!ol.Feature>>} */ (this.timeModel_.groupData(this.id_,\n this.binMethod.getBinKey.bind(this.binMethod), this.reduceAdd.bind(this),\n this.reduceRemove.bind(this), this.reduceInit.bind(this)));\n }\n\n // reapply the filters\n if (this.source && this.forceAllData_ == true) {\n this.timeModel_.applyFilters(tempFilters);\n }\n\n if (filters) {\n for (var id in filters) {\n this.timeModel_.filterDimension(id, undefined);\n }\n }\n\n\n results = /** @type {!Array<!ColorBin>} */ (results.map(this.map, this).filter(function(item) {\n return item != undefined;\n }));\n\n if (this.sortFn) {\n googArray.sort(results, this.sortFn);\n }\n }\n\n this.results = results;\n }", "timesheets() {\n var from = FlowRouter.getParam(\"from\");\n var to = FlowRouter.getParam(\"to\");\n var projectId = FlowRouter.getParam(\"projectId\");\n var timesheets = [];\n var result = null;\n\n //if it's date range, making sure query reflects the range\n if (from == null || to == null) {\n result = Timesheets.find();\n } else {\n result = Timesheets.find({\n $and:[\n {'date': {$gte: from}}, \n {'date': {$lte: to}}\n ]});\n }//end of date range if-else statement\n \n \n var fectchResult = result.fetch();\n var dateString = '';\n \n //consolidatedArray.push.apply(fectchResult);\n fectchResult.forEach(function (entry) {\n var timechunks = Timechunks.find({$and:[{'timesheet': entry._id}, {'project': projectId}]}).fetch();\n if(FlowRouter.getParam(\"reportType\") == \"daily\") {\n dateString = getStringDate(entry.date, 'dddd, MMMM Do YYYY');\n\n } else if (FlowRouter.getParam(\"reportType\") == \"weekly\" || FlowRouter.getParam(\"reportType\") == \"date_range\") {\n var curr = new Date(entry.date);\n var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week\n var last = first + 6; // last day is the first day + 6\n var dateString = getStringDate(new Date(curr.setDate(first)), 'MMMM Do YYYY') + \" - \" + getStringDate(new Date(curr.setDate(last)), 'MMMM Do YYYY');\n\n } else if(FlowRouter.getParam(\"reportType\") == \"monthly\") {//Check if monthly\n var dateString = getStringDate(entry.date, 'MMMM YYYY');\n }\n \n timechunks.forEach(function (timechunck) {\n var key = dateString;\n var userId = timechunck.userInfo[\"userId\"];\n console.log(\"Printng userId----*****\", userId);\n if(timeChunkObject[key] == null) {\n \n var timeChunkData = {};\n timeChunkData[\"name\"] = (timechunck.userInfo.firstName + \" \" + timechunck.userInfo.lastName);\n timeChunkData[\"totalHours\"] = getTotalHoursForTimeChunk(timechunck);\n timeChunkData[\"date\"] = dateString;\n\n var userObj = {};\n userObj[userId] = timeChunkData;\n\n /*\n monday: {\n userId: {}\n userId2: {}\n userId3 : {}\n }\n\n */\n timeChunkObject[key] = userObj;\n timeChunkKeyArray.push(key);\n //console.log(\"Adding to array key\", timeChunkObject);\n \n } else {\n /*\n we have a json that looks like this. \n {\n \"userId\": {\n \"name\": nameOfUserInTimeChunk,\n \"totalHours\": total hours for a user in time chunk\n }\n }\n */\n \n if(timeChunkObject[dateString][userId] == null) {\n \n console.log(\"printing else oj\",timeChunkObject[dateString]);\n \n\n console.log(\"tcObj before\", timeChunkObject);\n var timeChunkData = {};\n timeChunkData[\"name\"] = (timechunck.userInfo.firstName + \" \" + timechunck.userInfo.lastName);\n timeChunkData[\"totalHours\"] = getTotalHoursForTimeChunk(timechunck);\n timeChunkData[\"date\"] = dateString;\n\n var data = timeChunkObject[dateString];\n data[userId] = timeChunkData;\n timeChunkObject[dateString] = data;\n \n\n } else {\n console.log(\"tcObj\", timeChunkObject);\n\n //get the value from timeChunkObject\n var data = timeChunkObject[key][userId]; \n \n // if(data[\"userId\"] === userId) {\n\n // } else {\n\n // }\n //get the totalhour from the value(data)\n var totalHours = data[\"totalHours\"];\n \n //aggregate the existing hour with the new time chunk hour\n var concatHours = totalHours + getTotalHoursForTimeChunk(timechunck);\n \n // update the value object totalhours with aggreagated value\n data[\"totalHours\"] = concatHours;\n\n //Set the upated value object back to timechunkObject\n timeChunkObject[key][userId] = data;\n }\n\n console.log(\"PRINTING DATA\", timeChunkObject);\n \n }\n });\n\n });//end of fetchResult forEach loop\n \n var showNodataValue = timeChunkKeyArray.length === 0;\n Session.set(\"showNoData\", showNodataValue);\n\n\n return timeChunkKeyArray;\n\n }", "preProcessByDayResult(queryResult, groupBy) {\n switch (groupBy) {\n case \"day\":\n queryResult = this.fillEmptyDayPoints(queryResult);\n // replace key name \"day\" with \"x\" and value name \"count\" with \"y\"\n let resultByDay = [];\n queryResult.forEach(function (element) {\n resultByDay.push({x: new Date(element.day), y: element.count});\n });\n // sort the date\n resultByDay.sort(function (previousVal, currentVal) {\n return previousVal.x - currentVal.x;\n });\n return resultByDay;\n case \"week\":\n // TODO\n case \"month\":\n default:\n // group by year\n var groupsByYear = queryResult.reduce(function (previousVal, currentVal) {\n var yearNum = currentVal.day.split((\"-\"))[0];\n (previousVal[yearNum]) ? previousVal[yearNum].data.push(currentVal) : previousVal[yearNum] = {\n year: yearNum,\n data: [currentVal]\n };\n return previousVal;\n }, {});\n var resultByYear = Object.keys(groupsByYear).map(function (k) {\n return groupsByYear[k];\n });\n\n // sum up the result for every month\n var resultByMonth = [];\n var hasCountMonth = [];\n for (var i = 0; i < resultByYear.length; i++) {\n var groupsByMonthOneYear = resultByYear[i].data.reduce(function (previousVal, currentVal) {\n var monthNum = currentVal.day.split((\"-\"))[1];\n if (previousVal[monthNum]) {\n previousVal[monthNum].y += currentVal.count;\n } else {\n var thisMonth = new Date(resultByYear[i].year, monthNum - 1);\n previousVal[monthNum] = {y: currentVal.count, x: thisMonth};\n hasCountMonth.push(thisMonth);\n }\n return previousVal;\n }, {});\n var resultByMonthOneYear = Object.keys(groupsByMonthOneYear).map(function (key) {\n return groupsByMonthOneYear[key];\n });\n resultByMonth = resultByMonth.concat(resultByMonthOneYear);\n }\n return this.complementData(resultByMonth, hasCountMonth);\n }\n }", "function handleResponse (rows) {\n \n if (params.format === 'json') {\n \n // send as an array of json objects\n var apiRes = {};\n apiRes.account = account;\n apiRes.startTime = range.start.format();\n apiRes.endTime = range.end.format();\n apiRes.timeIncrement = params.timeIncrement;\n apiRes.results = [];\n \n if (viewOpts.reduce === false) {\n \n rows.forEach(function(d){\n apiRes.results.push({\n time : moment.utc(d.value[1]).format(),\n type : d.value[0],\n txHash : d.value[2],\n ledgerIndex : parseInt(d.id, 10)\n });\n });\n \n } else if (params.timeIncrement) {\n rows.forEach(function(d){\n d.value.time = moment.utc(d.key.slice(1)).format();\n apiRes.results.push(d.value); \n }); \n \n } else {\n apiRes.results = rows[0] ? rows[0].value : {};\n }\n \n return callback(null, apiRes);\n \n } else {\n var data = [], keys = {}, nKeys = 0;\n \n if (viewOpts.reduce === false) {\n data.push([\"time\",\"type\",\"txHash\",\"ledgerIndex\"]);\n \n for (var i=0; i<rows.length; i++) {\n data.push([\n moment.utc(rows[i].value[1]).format(), \n rows[i].value[0], //type\n rows[i].value[2], //tx_hash\n parseInt(rows[i].id, 10) //ledger_index\n ]);\n }\n \n } else {\n \n rows.forEach(function(row){\n\n for (var key in row.value) {\n if (typeof keys[key] === 'undefined') keys[key] = nKeys++;\n }\n });\n \n rows.forEach(function(row) {\n var r = [];\n \n for (var j in keys) {\n r[keys[j]] = row.value[j] || 0;\n }\n \n r.unshift(row.key ? moment.utc(row.key.slice(1)).format() : range.start.format());\n data.push(r);\n });\n \n data.unshift([\"time\"].concat(_.keys(keys)));\n }\n \n \n if (params.format === 'csv') {\n\n var csvStr = _.map(data, function(row){\n return row.join(', ');\n }).join('\\n');\n \n // provide output as CSV\n return callback(null, csvStr);\n\n\n } else {\n //no format or incorrect format specified\n return callback(null, data); \n } \n } \n }", "AggregateGetTotalEarning(filter) {\n return new Promise((resolve, reject) => {\n this.collection.aggregate([\n {\n $match: filter\n },\n {\n $unwind: '$restaurantInfo'\n },\n {\n $group: {\n _id: {\n resId: '$restaurantInfo.restaurantId',\n name: '$restaurantInfo.name'\n },\n price: {\n $sum: '$restaurantInfo.totalPrice'\n }\n }\n },\n {\n $project: {\n _id: 0,\n resId: '$_id.resId',\n name: '$_id.name',\n price: 1\n }\n }\n ], (err, data) => {\n if (err) return reject({ message: err, status: 0 });\n\n return resolve(data);\n })\n })\n }", "function Fetch_All_from_Data_Set()\r\n{\r\n\tfor (var p=0;p<profileIds.length;p++){ \r\n \t\t\t\tfor (var i=0;i<studyIds.length;i++){ \r\n\t\t\t\tvar strServer = \"http://www.cbioportal.org/webservice.do?\";\t\r\n\t\t\t\tvar study = studyIds[i];\r\n\t\t\t\tvar profile = profileIds[p];\r\n\t\t\t\tvar request = \"cmd=getClinicalData&case_set_id=\"+study+\"_all\"\r\n\t\t\t\t \r\n\t\t\t\tvar str2 = strServer+request;\r\n\t\t\t\t(function(request,i,p) { \t\r\n\t\t\t\t\td3.csv(str2, function(error, json) {\r\n\t\t\t\t\t\ttemp_counter++\r\n\t\t\t\t\t\tprocessDone=true\r\n\t\t\t\t\t\tif (error) {\r\n\t\t\t\t\t\t\tconsole.warn(\"warn: \"+error);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.get()\r\n\t\t\t\t\t.on('load', function(d) {\t\t\t\t\t\r\n\t\t\t\t\t\tfor(var i=0;i<d.length;i++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfor( key in d[i])\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar days_to_death=key.split(\"\t\").indexOf(\"DAYS_TO_DEATH\")\r\n\t\t\t\t\t\t\t\tvar gender=key.split(\"\t\").indexOf(\"GENDER\")\r\n\t\t\t\t\t\t\t\tvar sex=key.split(\"\t\").indexOf(\"SEX\")\r\n\t\t\t\t\t\t\t\tvar final_obj={cancer_type : \"\",MALE : \"\",Female : \"\"}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif(gender>=0)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tvar column_value=d[i][key].split(\"\t\")[\"\"||gender];\r\n\t\t\t\t\t\t\t\t\tcur_row_value=d[i][key].split(\"\t\")[key.split(\"\t\").indexOf(\"CANCER_TYPE\")];\r\n\t\t\t\t\t\t\t\t\tif(column_value==\"M\" || column_value==\"MALE\")\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tvar cur_row_value=d[i][key].split(\"\t\")[key.split(\"\t\").indexOf(\"CANCER_TYPE\")];\r\n\t\t\t\t\t\t\t\t\t\tif(Obj_Fetch[cur_row_value]== undefined)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value]=[];\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=0;\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=0;\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=parseInt(Obj_Fetch[cur_row_value][\"MALE\"])+1;\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse if(column_value==\"F\" || column_value==\"FEMALE\")\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tvar cur_row_value=d[i][key].split(\"\t\")[key.split(\"\t\").indexOf(\"CANCER_TYPE\")];\r\n\t\t\t\t\t\t\t\t\t\tif(Obj_Fetch[cur_row_value]== undefined)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value]=[];\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=0;\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=0;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=parseInt(Obj_Fetch[cur_row_value][\"FEMALE\"])+1;\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if(sex>=0)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tvar cur_row_value=d[i][key].split(\"\t\")[key.split(\"\t\").indexOf(\"CANCER_TYPE\")];\r\n\t\t\t\t\t\t\t\t\tvar column_value=d[i][key].split(\"\t\")[sex];\r\n\t\t\t\t\t\t\t\t\tif(column_value==\"M\" || column_value==\"MALE\")\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tif(Obj_Fetch[cur_row_value]== undefined)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value]=[];\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=0;\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=0;\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=parseInt(Obj_Fetch[cur_row_value][\"MALE\"])+1;\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse if(column_value==\"F\" || column_value==\"FEMALE\")\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tvar cur_row_value=d[i][key].split(\"\t\")[key.split(\"\t\").indexOf(\"CANCER_TYPE\")];\r\n\t\t\t\t\t\t\t\t\t\tif(Obj_Fetch[cur_row_value]== undefined)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value]=[];\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=0;\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"MALE\"]=0;\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\tObj_Fetch[cur_row_value][\"FEMALE\"]=parseInt(Obj_Fetch[cur_row_value][\"FEMALE\"])+1;\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttemp_counter++\r\n\t\t\t\t\t\tif(temp_counter==(studyIds.length*2)){\r\n\t\t\t\t\t\tprocessDone=true\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvar i=0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t); \r\n\t\t\t\t\t})(request,i,p);\r\n\t\t\t} \r\n\t\t\tif(p==profileIds.length-1){\r\n\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t\r\n\t}", "function dataStatus() {\n Promise.props({\n etutor_org: mongoose.model('LogExt').count().execAsync(),\n etutor: mongoose.model('LogExt2').count().execAsync(),\n markov: mongoose.model('LogMarkov2').count().execAsync(),\n iwrm: mongoose.model('LogIWRM').count().execAsync()\n }).then(function(results) {\n console.log('***********************');\n console.log(results);\n console.log('***********************');\n }).catch(function(err) {\n console.log(err)\n res.send(500); // oops - we're even handling errors!\n });\n }", "function GetTimeandTimeSpent(cb) {\n var TimeReviwed = [];\n db.query(\n 'SELECT Article.TimesViewd,Article.TimeSpendOnArticle,Topics.TopicID,MODELS.ModelID,Article.ArticleID,Article.Title AS Article, Topics.Title AS Topic ,MODELS.Title AS MODEL FROM `Article` INNER JOIN Topics ON Topics.TopicID = Article.TopicID INNER JOIN MODELS ON Topics.ModelID = MODELS.ModelID',\n (error, result) => {\n if (error) {\n cb();\n } else {\n console.log(result, 'result');\n //-------------------------------------------- Arrange the result Here -----------------------------------------------------//\n for (var i = 0; i < result.length; i++) {\n var ob = {\n ModelID: result[i]['ModelID'],\n ModelTitle: result[i]['MODEL'],\n TopicID: result[i]['TopicID'],\n TopicTiele: result[i]['Topic'],\n };\n\n var artObjeect = {\n ArticleID: result[i]['ArticleID'],\n ArticlTitle: result[i]['Article'],\n TimeViewed: result[i]['TimesViewd'],\n TimeSpendOnArticle: result[i]['TimeSpendOnArticle'],\n };\n serchObject(ob, artObjeect, TimeReviwed);\n }\n }\n cb(TimeReviwed);\n }\n );\n}", "function groupEstablishments(response){\n // response = response.sort();\n $('.listing').empty();\n console.log(response.length + \"length of response\");\n var names = [];\n \n for (var i = 0; i < response.length; i++ ){\n names[i] = response[i].businessname;\n }\n names = createIndex(names);\n createRecords(response, names);\n \n}", "function processURLs(urls){\n\tif(DEBUG) console.log('in processURLs');\n\tvar aggregate = null;\n\tfor(var index in urls){\n\t\tvar url = urls[index];\t\t\n\t\tvar dem = normalize(getDemographicsFromLocalStore(url));\n\t\t//console.log('normalized ' + JSON.stringify(dem));\n\t\t\n\t\tif (aggregate) {\n\t\t\tfor(index in aggregate){\n\t\t\t\tvar aggBlob = aggregate[index];\n\t\t\t\tvar demBlob = dem[index];\n\t\t\t\tif($.isPlainObject(aggBlob) ) {\n\t\t\t\t\taggregate[index] = product(aggBlob, demBlob);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\taggregate = dem;\n\t\t}\n\t\taggregate.support.push(url);\n\t}\n\tif(DEBUG) console.log('Support: ' + aggregate.support.length);\t//JSON.stringify(aggregate)\n\treturn aggregate;\n}", "function getMedia(req, result) {\n // JSON, \"instagram\": [ig media], \"yelp\": [yelp media], etc.\n var json_out = {};\n var num_services = 3;\n var gaia_id = req.params.gaia_id;\n console.log(\"getting media from services\");\n\n // here i need: service ids, gaia id. (so just whole location object?)\n\n if (req.query.instagram && req.query.instagram.length) {\n var ig_place_id = req.query.instagram[0].location_id;\n json_out.instagram = [];\n ig.location_media_recent(ig_place_id,\n function(err, ig_media_res, pagination, remaining, limit) {\n if (err) {\n result.send(err);\n } else {\n for (var j in ig_media_res) {\n var thisRes = ig_media_res[j];\n if (thisRes.location) {\n // console.log(thisRes);\n var post = {\n location_id: thisRes.location.id,\n post_id: thisRes.id,\n text: (thisRes.caption ? thisRes.caption.text : \"\"),\n image_url: thisRes.images.standard_resolution.url,\n link: thisRes.link,\n rating: thisRes.likes.count,\n date: (new Date(thisRes.created_time * 1000)).toString()\n };\n json_out.instagram.push(post);\n }\n }\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n return;\n }\n });\n } else {\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n }\n\n // other services here. make call to find media based on location,\n // increment num_services, add posts to json_out.servicename\n\n\n if (req.query.yelp && req.query.yelp.length) {\n var yelp_id = req.query.yelp[0].location_id;\n json_out.yelp = [];\n yelp.business(yelp_id,\n function(err, data) {\n if (err) {\n result.send(err);\n } else {\n // for (var j in ig_media_res) {\n // var thisRes = ig_media_res[j];\n\n // var post = {\n // location_id: thisRes.location.id,\n // post_id: thisRes.id,\n // text: (thisRes.caption ? thisRes.caption.text : \"\"),\n // image_url: thisRes.images.standard_resolution.url,\n // link: thisRes.link,\n // rating: thisRes.likes.count,\n // date: (new Date(thisRes.created_time * 1000)).toString()\n // };\n \n json_out.yelp.push(data);\n // }\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n return;\n }\n });\n } else {\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n }\n\n if (req.query.google && req.query.google.length) {\n var google_id = req.query.google[0].location_id;\n json_out.google = [];\n googlePlaces.placeDetailsRequest({reference: google_id},\n function(error, response) {\n if (error) {\n result.send(error);\n } else {\n // console.log(response);\n if (response.result) {\n var post = response.result;\n json_out.google.push(post);\n }\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n return;\n }\n });\n } else {\n num_services = finishIfAllDoneMed(num_services, result, json_out, gaia_id);\n }\n\n}", "async processRequest(id, caller, apis, response_type, aggregation_type, context, prefered_api, string_to_count, options, assigned_oracle, standby_oracle) {\n\n\t\t\n\t\tvar results = [];\n\t\tvar api_response_set = [];\n\t\tfor (var api of apis) {\n\t\t\tvar result = null;\n\t\t\tif (api.endpoint.match(/^(https:\\/\\/)?(localhost|127\\.0\\.0\\.1)/) === null) {\n\t\t\t\ttry {\n\t\t\t\t\tresult = await this.getResult(api, api.endpoint, api.json_field, response_type);\n\t\t\t\t\tconsole.log(\"request processor, inside processReq result :\", result)\n\t\t\t\t\t\n\t\t\t\t\tif (result !== null) {\n\t\t\t\t\t\tapi[\"response\"] = result;\n\t\t\t\t\t\tapi[\"api\"] = api['endpoint'];\n\t\t\t\t\t\tdelete api['endpoint'];\n\t\t\t\t\t\tapi_response_set.push(api);\n\t\t\t\t\t\tresults.push(result);\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tconsole.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('Skipping request to localhost.');\n\t\t\t}\n\t\t}\n\n\n\t\tvar confirmed_response = results.filter((value,index,arr)=>{\n\t\t\treturn value!=undefined\n\t\t})\n\t\n\t\t\n\t\tconsole.log(\"request processor, inside processReq confirmed_response.length :\", confirmed_response.length)\n\t\tconsole.log(\"request processor, inside processReq apis.length/2 :\", apis.length/2)\n\t\tconsole.log(\"request processor, inside processReq confirmed_response.length>=apis.length/2 :\", (confirmed_response.length>=apis.length/2) )\n\t\tconsole.log(\"request processor, inside processReq results[prefered_api] :\", results[prefered_api])\n\n\n\t\tif(confirmed_response.length>=apis.length/2 )\n\t\t{\n\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t}\n\t\telse if(prefered_api)\n\t\t{\n\t\t\tconsole.log(\"prefered_api: ~~~~~~~~~~\",prefered_api);\n\t\t\tif(results[prefered_api])\n\t\t\t{\n\t\t\t\tresult = results[prefered_api];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult = aggregate (confirmed_response, aggregation_type, string_to_count)\n\t\t}\n\t\t\n\t\tvar encoded = \"\";\n\t\ttry {\n\t\t\tconsole.log(\"request processor, inside processReq before encodeing aggregation :\", result)\n\t\t\tencoded = encode(result, response_type);\n\t\t}\n\t\tcatch (e) {\n\t\t\tconsole.error(e);\n\t\t}\n\t\n\t\tconsole.log(\"request processor, inside processReq encoded :\", encoded)\n\t\tconsole.log(\"apaiaapapiapiaiapaipapapia\", api_response_set)\n\t\tconsole.log(\"apaiaapapiapiaiapaipapapia\", result)\n\n\t\tawait this.audit_trail(id, caller, api_response_set, response_type, aggregation_type, result, context, options, assigned_oracle, standby_oracle );\n\n\n\t\treturn encoded;\n\t}", "function storeFinalData(results, callback) {\n var updatedFinalData = results.merge_all_final_data;\n var bulk = Data.collection.initializeOrderedBulkOp();\n var bulkExecute;\n var now = new Date();\n\n //set the update parameters for query\n bulkExecute = false;\n for (var i = 0; i < updatedFinalData.length; i++) {\n\n //next(null,{'error':{'metricId':dataFromDb[j].data.metricId,'objectId':dataFromDb[j].data.objectId}})\n if (results.merge_all_final_data[i].error) {\n console.log('results.merge_all_final_data[i].error', results.merge_all_final_data[i].error)\n //bulkExecute = false;\n var mailOptions = {\n from: 'Datapoolt Team <rajalakshmi.c@habile.in>',\n to: 'rajalakshmi.c@habile.in',\n subject: 'Error alert for the metric' + results.merge_all_final_data[i].error.metricId + 'and object id' + results.merge_all_final_data[i].error.objectId,\n\n // HTML Version\n // html: '<span>The data has crossed the limit of <b>' + thresholdValue + '</b></span>' + '<span> for the metric <b>' + metric.name + '</b></span>' + '<span> in <b>' + object.name + '</b></span>'\n\n };\n utility.sendEmail(mailOptions, '', function (err, response) {\n //callback(null, 'success');\n console.log('errormail', response)\n });\n errorDataList.push(results.merge_all_final_data[i].error)\n }\n else if (results.merge_all_final_data[i] != 'DataFromDb' && !results.merge_all_final_data[i].error) {\n bulkExecute = true;\n\n //set query condition\n var query = {\n 'objectId': results.data[i].objectId,\n 'metricId': results.data[i].metricId\n };\n\n //set the values\n var update = {\n $setOnInsert: {created: now},\n $set: {\n data: results.merge_all_final_data[i],\n updated: now\n }\n };\n\n //form the query\n bulk.find(query).upsert().update(update);\n }\n }\n if (bulkExecute === true) {\n\n //Doing the bulk update\n bulk.execute(function (err, response) {\n callback(err, 'success');\n });\n }\n }", "function loadTotals( collection, loadData ){\n\t\t\t\tangular.forEach( loadData, function(loadItem, key){\n\t\t\t\t\tif( typeof loadItem.total != 'undefined' ){\n\t\t\t\t\t\tcollection[key].total = loadItem.total;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}", "function refreshResults() {\n\tif (_dataSource) {\n\t\t_pager.page(0);\n\t\t_dataSource.fetch(function(){\n\t\t // if callback is needed, place it here\n\t\t});\n\t}\t\n}", "function aggregateData(query, data) {\r\n var aggregate = create2DArray(7);\r\n var max = 0;\r\n var colors = {};\r\n for (var usageIx = 0; usageIx < query.usageTypes.length; usageIx++) {\r\n var usageType = query.usageTypes[usageIx];\r\n colors[usageType.name] = usageType.color;\r\n var toInclude = [];\r\n if (usageType.usageType == \"All\") {\r\n var allUsageTypes = getUsageTypes(usageType.cdrType);\r\n for (var i = 0; i < allUsageTypes.length; i++) {\r\n if (data.usageData[allUsageTypes[i]] !== undefined) {\r\n toInclude.push(data.usageData[allUsageTypes[i]]);\r\n }\r\n }\r\n } else {\r\n if (data.usageData[usageType.usageType] !== undefined) {\r\n toInclude.push(data.usageData[usageType.usageType]);\r\n }\r\n }\r\n // sum up the relevant data\r\n\t\tif(toInclude.length == 0) {\r\n\t\t\tcontinue; // no data for this uT, don't put in aggregation\r\n\t\t}\r\n var tmpAggregate = toInclude.reduce(function (ut1, ut2) {\r\n var res = {};\r\n for (var prop in ut1) {\r\n res[prop] = sum2DArray(ut1[prop], ut2[prop]);\r\n }\r\n return res;\r\n });\r\n\r\n var measureData = tmpAggregate[query.measureType];\r\n for (var x = 0; x < measureData.length; x++) {\r\n for (var y = 0; y < measureData[x].length; y++) {\r\n if (aggregate[x][y] === undefined) {\r\n aggregate[x][y] = {};\r\n }\r\n aggregate[x][y][usageType.name] = measureData[x][y];\r\n if (measureData[x][y] > max) {\r\n max = measureData[x][y];\r\n }\r\n }\r\n }\r\n }\r\n\r\n\tif(max == 0) {\r\n\t\t// no data at all for this query\r\n\t\treturn null;\r\n\t}\r\n\r\n return {\r\n aggregate: aggregate,\r\n maxUsage: max,\r\n colors: colors\r\n };\r\n}", "function monitorDatabasePerformance(requests) \n{\n\tvar mongodb = require('mongodb');\n\t\n\t//Create mongoDB client\n\tvar MongoClient = mongodb.MongoClient\n\t\n\tfor(var i in requests)\n\t{\n\t\tvar request = requests[i];\n\t\t\n\t\t//try connection\n\t\tMongoClient.connect(request.connectionURI, function(err, db) {\n\n\t\t\tif (err && err.message === \"auth failed\") \n\t\t\t{\n\t\t\t\terrorHandler(new InvalidAuthenticationError());\n\t\t\t}\n\t\t\telse if(err)\n\t\t\t{\n\t\t\t\tvar e = new DatabaseConnectionError();\n\t\t\t\te.message = err.message;\n\t\t\t\terrorHandler(e);\n\t\t\t}\n\t\t\t\n\t\t\t//get data\n\t\t\tdb.command({ serverStatus: 1 }, function(err, result) {\n\t\t\t\t\n\t\t\t\tif(err)\n\t\t\t\t{\n\t\t\t\t\tvar e = new DatabaseConnectionError();\n\t\t\t\t\te.message = err.message;\n\t\t\t\t\terrorHandler(e);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tvar metricsName = Object.keys(metrics);\n\t\t\t\t\n\t\t\t\tvar jsonString = \"[\";\n\t\t\t\t\n\t\t\t\tvar dateTime = new Date().toISOString();\n\t\t\t\t\n\t\t\t\tfor(var i in metricsName)\n\t\t\t\t{\n\t\t\t\t\tif(request.metricsExecution[i])\n\t\t\t\t\t{\t\n\t\t\t\t\t\t//split to find metric in result\n\t\t\t\t\t\tvar path = metricsName[i].split(\"\\.\")\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (path.length > 2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (typeof result[path[0]][path[1]][path[2]] != 'undefined')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tjsonString += \"{\";\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjsonString += \"\\\"variableName\\\":\\\"\"+metricsName[i]+\"\\\",\";\n\t\t\t\t\t\t\t\tjsonString += \"\\\"metricUUID\\\":\\\"\"+metrics[metricsName[i]].id+\"\\\",\";\n\t\t\t\t\t\t\t\tjsonString += \"\\\"timestamp\\\":\\\"\"+ dateTime +\"\\\",\";\n\t\t\t\t\t\t\t\tjsonString += \"\\\"value\\\":\\\"\"+ result[path[0]][path[1]][path[2]] +\"\\\"\";\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjsonString += \"},\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar newError = new MetricNotFoundError();\n\t\t\t\t\t\t\t\tnewError.message = \"Unable to collect metric \" + metrics[metricsName[i]].id;\n\t\t\t\t\t\t\t\terrorHandler(newError);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(path.length > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (result[path[0]] !== undefined)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (typeof result[path[0]][path[1]] != 'undefined')\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tjsonString += \"{\";\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tjsonString += \"\\\"variableName\\\":\\\"\"+metricsName[i]+\"\\\",\";\n\t\t\t\t\t\t\t\t\tjsonString += \"\\\"metricUUID\\\":\\\"\"+metrics[metricsName[i]].id+\"\\\",\";\n\t\t\t\t\t\t\t\t\tjsonString += \"\\\"timestamp\\\":\\\"\"+ dateTime +\"\\\",\";\n\t\t\t\t\t\t\t\t\tjsonString += \"\\\"value\\\":\\\"\"+ result[path[0]][path[1]] +\"\\\"\";\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tjsonString += \"},\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar newError = new MetricNotFoundError()\n\t\t\t\t\t\t\t\t\tnewError.message = \"Unable to collect metric \" + metrics[metricsName[i]].id;\n\t\t\t\t\t\t\t\t\terrorHandler(newError);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar value = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(metricsName[i] === \"GLOBAL_LOCK_RATIO_UUID\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar locktime = result.globalLock.lockTime;\n\t\t\t\t\t\t\t\tvar totaltime = result.globalLock.totalTime;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (locktime === undefined)\n\t\t\t\t\t\t\t\t\tlocktime = 0;\n\n\t\t\t\t\t\t\t\tif(typeof locktime != 'undefined' && typeof totaltime != 'undefined')\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(totaltime != 0)\n\t\t\t\t\t\t\t\t\t\tvalue = (locktime / totaltime).toFixed(2);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar newError = new MetricNotFoundError()\n\t\t\t\t\t\t\t\t\tnewError.message = \"Unable to collect metric \" + metrics[metricsName[i]].id;\n\t\t\t\t\t\t\t\t\terrorHandler(newError);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(metricsName[i] === \"BTREE_MISS_PAGE_RATIO_UUID\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (result.indexCounters !== undefined)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvar missRatio = result.indexCounters.missRatio;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(typeof missRatio != 'undefined')\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvalue = missRatio.toFixed(2);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar newError = new MetricNotFoundError()\n\t\t\t\t\t\t\t\t\t\tnewError.message = \"Unable to collect metric \" + metrics[metricsName[i]].id;\n\t\t\t\t\t\t\t\t\t\terrorHandler(newError);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tjsonString += \"{\";\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tjsonString += \"\\\"variableName\\\":\\\"\"+metricsName[i]+\"\\\",\";\n\t\t\t\t\t\t\tjsonString += \"\\\"metricUUID\\\":\\\"\"+metrics[metricsName[i]].id+\"\\\",\";\n\t\t\t\t\t\t\tjsonString += \"\\\"timestamp\\\":\\\"\"+ dateTime +\"\\\",\";\n\t\t\t\t\t\t\tjsonString += \"\\\"value\\\":\\\"\"+ value +\"\\\"\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tjsonString += \"},\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(jsonString.length > 1)\n\t\t\t\t\tjsonString = jsonString.slice(0, jsonString.length-1);\n\t\t\t\t\n\t\t\t\tjsonString += \"]\";\n\t\t\t\t\n\t\t\t\t//send to process ratio values and save result in file\n\t\t\t\tprocessDeltas(request, jsonString);\n\t\t\t\t\n\t\t\t\tdb.close();\n\n\t\t\t});\n\t\t});\n\t}\n}", "function aggregate(data, aggregation_type, string_to_count) {\n console.log(\"data in aggregation\", data)\n console.log(\"aggregation_type \", aggregation_type)\n var sum = 0;\n var normal_data = 0;\n var sum_of_squares = 0.0;\n var len = data.length;\n var new_mean, counter = 0;\n\n if (aggregation_type == 0 ) {\n for (i = 0; i<len; i++) {\n sum += data[i];\n }\n return (sum/data.length)\n }\n\n else if(aggregation_type == 1){\n\n for (i = 0; i<len; i++) {\n\n if(typeof data[i] === 'number'){\n \n sum += data[i];\n console.log(\"Math.pow(data[i],2)\", Math.pow(data[i],2))\n var square = Math.pow(data[i],2);\n sum_of_squares += square;\n console.log(\"sum of squares\", sum_of_squares)\n\n }\n \n } \n console.log(\"sum \", sum, \"len \", len)\n var mean = sum/len;\n console.log(\"mean\", mean)\n variance = stats.variance(data)\n console.log(\"variance\", variance)\n var sd = stats.stdev(data)\n console.log(\"sd\", sd)\n console.log(\"normal values are between :\", mean+sd, \"and \",mean-sd)\n for (i = 0; i<len; i++) {\n if(typeof data[i] === 'number'){\n if((data[i] <= (mean + sd)) && (data[i] >= (mean - sd))){\n console.log(\"normal data : \", data[i])\n normal_data += data[i];\n counter += 1;\n }\n else continue;\n }\n else continue;\n } \n return new_mean = normal_data / counter;\n }\n\n else if (aggregation_type == 2 ){\n var positive_responses = [\"success\",\"yes\",\"1\",\"positive\",\"true\"];\n var negetive_responses = [\"failure\",\"no\",\"0\",\"negetive\",\"unsuccessfull\",\"false\"];\n bool_data = [];\n for(var i=0;i<data.length;i++)\n {\n if(positive_responses.indexOf(data[i]) !== -1)\n {\n bool_data.push(true);\n }\n if(negetive_responses.indexOf(data[i]) !== -1)\n {\n bool_data.push(false);\n }\n }\n console.log(bool_data);\n var set = new Set(bool_data);\n var arr = Array.from(set);\n count_a = 0;\n count_b = 0;\n for(var i=0;i<bool_data.length;i++)\n {\n if(bool_data[i]==arr[0])\n {\n count_a+=1; // 0\n }else{\n count_b+=1; // 1\n }\n }\n if(count_a===count_b)\n {\n console.log(\"Equal Positive and Negative responses, returning :\", arr[1])\n return 2;\n }else if(count_a>count_b)\n {\n console.log(\"Unequal Positive and Negative responses\")\n return arr[0];\n }else{\n console.log(\"Unequal Positive and Negative Responses\")\n return arr[1];\n }\n\n }\n else if (aggregation_type == 3 ){\n return Math.max(...data);\n }\n else if (aggregation_type == 4 ){\n return Math.min(...data);\n }\n else if (aggregation_type == 5 ){\n for (i = 0; i<len; i++) {\n sum += data[i];\n }\n return sum;\n }\n else if (aggregation_type == 6 ){\n return data[0];\n }\n else if (aggregation_type == 7 ){\n return data[len-1];\n }\n else if (aggregation_type == 8 ){\n\n return stats.median(data);\n \n }\n else if (aggregation_type == 9 ){\n console.log(\"handata \",data);\n var modes = [], count = [], i, number, maxIndex = 0;\n \n for (i = 0; i < data.length; i += 1) {\n number = data[i];\n count[number] = (count[number] || 0) + 1;\n if (count[number] > maxIndex) {\n maxIndex = count[number];\n }\n }\n \n for (i in count)\n if (count.hasOwnProperty(i)) {\n if (count[i] === maxIndex) {\n modes.push(Number(i));\n }\n }\n console.log(\"mode arr: \",modes);\n modes.sort();\n console.log(\"modessssssssssss\", modes);\n return modes[(modes.length-1)];\n }\n else if (aggregation_type == 10 ){\n console.log(\"string data: \",data);\n var count = 0;\n for(var i=0;i<data.length;i++)\n {\n if(data[i]==string_to_count)\n {\n count+=1;\n }\n }\n console.log(\"string count is: \",count);\n return count;\n }\n\n else return null\n}", "function getResultDetailed(){\r\n\t\r\n\tif (processDone) {\r\n \r\n\t\t for(var key in Obj_Fetch)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tvar temp_var={};\r\n\t\t\t\t\t\ttemp_var.cancertypedetailed=key;\r\n\t\t\t\t\t\ttemp_var.male=Obj_Fetch[key].MALE;\r\n\t\t\t\t\t\ttemp_var.female=Obj_Fetch[key].FEMALE;\r\n\t\t\t\t\t\tfetch_data_array.push(temp_var);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\taddScatterPlotDetailed(fetch_data_array);\r\n\t\t\t\t\t\tconsole.log(fetch_data_array);\r\n\r\n } else {\r\n setTimeout(getResult, 250);\r\n }\r\n }", "async gatherAllFeeData() {\n let feePromises = [];\n let numberOfSends = 0;\n let feeData = new Map();\n\n this.props.walletitems.forEach(element => {\n if (element.category == 'debit' || element.category == 'send') {\n feePromises.push(\n rpc('gettransaction', [element.txid]).then(payload => {\n feeData.set(payload.time, payload.fee);\n numberOfSends++;\n this.setState(\n {\n CSVProgress: numberOfSends / feePromises.length,\n },\n () => {\n this.updateProgress();\n }\n );\n })\n );\n }\n });\n await Promise.all(feePromises);\n this.setFeeValuesOnTransaction(feeData);\n this.finishCSVProcessing();\n }", "function getSQLData(sqls, cb) { \n //console.log(\"sqls :\"+sqls);\n var resultsets;\n dbconnection.getConnection(function(err, connection) {\n connection.query(sqls, function(err, res1){\n connection.release(); \n if(res1.length >0){\n resultsets=res1;\n }else{\n resultsets={};\n }\n cb(resultsets); //callback if all queries are processed\n });\n }); \n \n }", "function getOverviewData(map, sumLevel, sourceID) {\n\tvar activePCs = getSelections(\"activePCs\");\n\tvar activeSources = getSelections(\"activeSources\");\n\n\tvar datasetNames = {}; // keyset of all datasets (not array to make\n\t// datasets uinique)\n\tvar sum = {};\n\tvar sumKey = \"\";\n\n\tif (sumLevel == 3) {\n\t\tvar datasetName = \"ReceivedSubIDs\";\n\t\tdatasetNames[datasetName] = 1;\n\t\tfor ( var host in map) {\n\t\t\tvar subDetectorData = map[host][sourceID]\n\t\t\tif (subDetectorData) {\n\t\t\t\tfor ( var subID in subDetectorData) {\n\t\t\t\t\tif (!sum[subID]) {\n\t\t\t\t\t\tsum[subID] = {};\n\t\t\t\t\t\tsum[subID][datasetName] = subDetectorData[subID];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsum[subID][datasetName] += subDetectorData[subID];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( var host in map) {\n\t\t\tif (!activePCs[host]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (sumLevel == 1 && !sum[host]) {\n\t\t\t\tsum[host] = {};\n\t\t\t\tsumKey = host;\n\t\t\t}\n\t\t\tfor ( var source in map[host]) {\n\t\t\t\tif (!activeSources[source]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif ((sumLevel == 2)) {\n\t\t\t\t\tif(!sum[source]){\n\t\t\t\t\t\tsum[source] = {};\n\t\t\t\t\t}\n\t\t\t\t\tsumKey = source;\n\t\t\t\t}\n\t\t\t\tfor ( var key in map[host][source]) {\n\t\t\t\t\tif (!sum[sumKey][key]) {\n\t\t\t\t\t\tsum[sumKey][key] = map[host][source][key];\n\t\t\t\t\t\tdatasetNames[key] = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsum[sumKey][key] += map[host][source][key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tvar chartData = {};\n\tchartData.labels = [];\n\tchartData.datasets = [];\n\n\t/*\n\t * Find maximum values\n\t */\n\tvar scaleFactors = {};\n\tfor ( var dataset in datasetNames) {\n\t\tscaleFactors[dataset] = 0;\n\t\tfor ( var label in sum) {\n\t\t\tif (sum[label][dataset] > scaleFactors[dataset]) {\n\t\t\t\tscaleFactors[dataset] = sum[label][dataset];\n\t\t\t}\n\t\t}\n\t}\n\t/*\n\t * Calculate scale factors for every dataset and store labels\n\t */\n\tfor ( var dataset in datasetNames) {\n\t\tscaleFactors[dataset] = scaleValue(scaleFactors[dataset]);\n\t}\n\n\tfor ( var label in sum) {\n\t\tchartData.labels.push(label);\n\t}\n\n\tvar datasetNum = 0;\n\tfor ( var dataset in datasetNames) {\n\t\tvar data = [];\n\t\tvar scale = scaleFactors[dataset];\n\t\tfor ( var label in sum) {\n\t\t\tdata.push(sum[label][dataset] / scale['factor']);\n\t\t}\n\n\t\tchartData.datasets.push({\n\t\t\t'label' : dataset\n\t\t\t\t\t+ (scale['prefix'] ? ' [' + scale['prefix'] + ']' : ''),\n\t\t\t'data' : data,\n\t\t\tfillColor : \"rgba(\" + barCollors[datasetNum] + \",0.5)\",\n\t\t\tstrokeColor : \"rgba(\" + barCollors[datasetNum] + \",1)\",\n\t\t\tpointColor : \"rgba(\" + barCollors[datasetNum] + \",1)\",\n\t\t\tpointStrokeColor : \"#fff\",\n\t\t\tpointHighlightFill : \"#fff\",\n\t\t\tpointHighlightStroke : \"rgba(\" + barCollors[datasetNum++] + \",1)\",\n\t\t});\n\t}\n\n//\tconsole.log(scaleFactors);\n//\tconsole.log(sum);\n//\tconsole.log(chartData);\n//\tconsole.log(\"########\");\n\treturn chartData;\n}", "function auctionStats(callback) {\n\tLicense.aggregate([\n\t{$match: { 'bid.auction.id': { $gt: 0}}},\n\t{$project: { _id:0, 'bid.auction.id':1, channel:1, MHz:1, \n\t\t'channelBlock.lowerBand':1, 'channelBlock.upperBand':1, \n\t\t'bid.amount.gross': 1, population:1}},\n\t{$group: { _id: {auction: '$bid.auction.id', channel: '$channel', MHz: '$MHz',\n\t\tstart: '$channelBlock.lowerBand', end: '$channelBlock.upperBand'}, \n\t\ttotalPrice: {$sum: '$bid.amount.gross'}, \n\t\ttotalPops: {$sum: '$population'} }},\n\t{$sort: { _id: 1}}\n\t], function (err, result) {\n\t\tcallback(err, result)\n\t})\n}", "function exportDataAsCSV(aqsid, startEpoch, endEpoch, fileFormat) {\n const dataObject = {};\n let aggregatData;\n\n if (endEpoch === null) {\n aggregatData = AggrData.find({\n $and: [\n {\n epoch: {\n $in: startEpoch\n }\n }, {\n site: `${aqsid}`\n }\n ]\n }, {\n sort: {\n epoch: 1\n }\n }).fetch();\n } else {\n aggregatData = AggrData.find({\n site: `${aqsid}`,\n $and: [\n {\n epoch: {\n $gte: parseInt(startEpoch, 10)\n }\n },\n {\n $and: [\n {\n epoch: {\n $lte: parseInt(endEpoch, 10)\n }\n }\n ]\n }\n ] }, {\n sort: {\n epoch: 1\n }\n }).fetch();\n }\n\n switch (fileFormat) {\n case 'raw':\n if (aggregatData.length !== 0) {\n dataObject.data = [];\n dataObject.fields = ['siteID', 'dateGMT', 'timeGMT']; // create fields for unparse\n }\n _.each(aggregatData, (e) => {\n const obj = {};\n const siteID = e.site.substring(e.site.length - 4, e.site.length);\n if (siteID.startsWith('0')) {\n obj.siteID = e.site.substring(e.site.length - 3, e.site.length);\n } else if (siteID.startsWith('9')) {\n obj.siteID = e.site;\n } else {\n obj.siteID = e.site.substring(e.site.length - 4, e.site.length);\n }\n obj.dateGMT = moment.utc(moment.unix(e.epoch)).format('YY/MM/DD');\n obj.timeGMT = moment.utc(moment.unix(e.epoch)).format('HH:mm:ss');\n\n Object.keys(e.subTypes).forEach((instrument) => {\n if (Object.prototype.hasOwnProperty.call(e.subTypes, instrument)) {\n const measurements = e.subTypes[instrument];\n Object.keys(measurements).forEach((measurement) => {\n if (Object.prototype.hasOwnProperty.call(measurements, measurement)) {\n const data = measurements[measurement];\n\n let label = `${instrument}_${measurement}_flag`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n obj[label] = flagsHash[_.last(data).val].label; // Flag\n label = `${instrument}_${measurement}_value`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n\n let outputValue;\n if (data.length < 5) {\n outputValue = data[0].val; // calc\n } else {\n outputValue = data[1].val; // avg\n }\n\n // HNET Unit conversion for Temp from C to F\n if (measurement === 'Temp' || measurement === 'AmbTemp') {\n outputValue = (outputValue * 9 / 5) + 32;\n } else if (measurement === 'WS') {\n outputValue = Math.round(outputValue * 3600 / 1610.3 * 1000) / 1000;\n }\n if (outputValue !== 'undefined' && !isNaN(outputValue)) {\n // if (!isNaN(outputValue)) {\n obj[label] = outputValue.toFixed(3);\n }\n }\n });\n }\n });\n dataObject.data.push(obj);\n });\n break;\n case 'tceq_allchannels':\n if (aggregatData.length !== 0) {\n dataObject.data = [];\n dataObject.fields = ['siteID', 'dateGMT', 'timeGMT', 'status']; // create fields for unparse\n }\n _.each(aggregatData, (e) => {\n const obj = {};\n const siteID = e.site.substring(e.site.length - 4, e.site.length);\n if (siteID.startsWith('0')) {\n obj.siteID = e.site.substring(e.site.length - 3, e.site.length);\n } else {\n obj.siteID = e.site.substring(e.site.length - 4, e.site.length);\n }\n obj.dateGMT = moment.utc(moment.unix(e.epoch)).format('YY/MM/DD');\n obj.timeGMT = moment.utc(moment.unix(e.epoch)).format('HH:mm:ss');\n obj.status = 0;\n\n Object.keys(e.subTypes).forEach((instrument) => {\n if (Object.prototype.hasOwnProperty.call(e.subTypes, instrument)) {\n const measurements = e.subTypes[instrument];\n Object.keys(measurements).forEach((measurement) => {\n if (Object.prototype.hasOwnProperty.call(measurements, measurement)) {\n let label = `${instrument}_${measurement}_channel`;\n obj[label] = channelHash[`${instrument}_${measurement}`]; // channel\n\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n const data = measurements[measurement];\n\n label = `${instrument}_${measurement}_flag`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n obj[label] = flagsHash[_.last(data).val].label; // Flag\n label = `${instrument}_${measurement}_value`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n // taking care of flag Q (span)\n if (flagsHash[_.last(data).val].label === 'Q') {\n obj[label] = 0; // set value to 0\n } else {\n let outputValue = data[1].val; // avg\n // HNET Unit conversion for Temp from C to F\n if (measurement === 'Temp' || measurement === 'AmbTemp') {\n outputValue = (outputValue * 9 / 5) + 32;\n } else if (measurement === 'WS') {\n outputValue = Math.round(outputValue * 3600 / 1610.3 * 1000) / 1000;\n }\n obj[label] = outputValue.toFixed(3);\n }\n }\n });\n }\n });\n\n obj.QCref_channel = 50;\n obj.QCref_flag = 'K';\n obj.QCref_value = 0;\n obj.QCstatus_channel = 51;\n obj.QCstatus_flag = 'K';\n obj.QCstatus_value = 99000;\n dataObject.data.push(obj);\n });\n if (dataObject.fields !== undefined) {\n dataObject.fields.push('QCref_channel', 'QCref_flag', 'QCref_value', 'QCstatus_channel', 'QCstatus_flag', 'QCstatus_value');\n }\n break;\n case 'tceq': {\n const site = LiveSites.findOne({ AQSID: `${aqsid}` });\n if (site === undefined) {\n throw new Error(`Could not find AQSID: ${aqsid} in LiveSites.`);\n }\n const channels = site.Channels;\n const activeChannels = [];\n _.each(channels, (channel) => {\n if (channel.Status === 'Active') {\n activeChannels.push(channel.Name);\n }\n });\n if (aggregatData.length !== 0) {\n dataObject.data = [];\n dataObject.fields = ['siteID', 'dateGMT', 'timeGMT', 'status']; // create fields for unparse\n }\n _.each(aggregatData, (e) => {\n const obj = {};\n const siteID = e.site.substring(e.site.length - 4, e.site.length);\n if (siteID.startsWith('0')) {\n obj.siteID = e.site.substring(e.site.length - 3, e.site.length);\n } else {\n obj.siteID = e.site.substring(e.site.length - 4, e.site.length);\n }\n obj.dateGMT = moment.utc(moment.unix(e.epoch)).format('YY/MM/DD');\n obj.timeGMT = moment.utc(moment.unix(e.epoch)).format('HH:mm:ss');\n obj.status = 0;\n\n Object.keys(e.subTypes).forEach((instrument) => {\n if (Object.prototype.hasOwnProperty.call(e.subTypes, instrument)) {\n const measurements = e.subTypes[instrument];\n Object.keys(measurements).forEach((measurement) => {\n if (Object.prototype.hasOwnProperty.call(measurements, measurement)) {\n if (activeChannels.includes(measurement)) { // check wheather measurement is an active channel\n let label = `${instrument}_${measurement}_channel`;\n obj[label] = channelHash[`${instrument}_${measurement}`]; // channel\n\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n const data = measurements[measurement];\n\n label = `${instrument}_${measurement}_flag`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n obj[label] = flagsHash[_.last(data).val].label; // Flag\n label = `${instrument}_${measurement}_value`;\n if (dataObject.fields.indexOf(label) === -1) { // add to fields?\n dataObject.fields.push(label);\n }\n // taking care of flag Q (span)\n if (flagsHash[_.last(data).val].label === 'Q') {\n obj[label] = 0; // set value to 0\n } else {\n let outputValue = data[1].val; // avg\n // HNET Unit conversion for Temp from C to F\n if (measurement === 'Temp' || measurement === 'AmbTemp') {\n outputValue = (outputValue * 9 / 5) + 32;\n } else if (measurement === 'WS') {\n outputValue = Math.round(outputValue * 3600 / 1610.3 * 1000) / 1000;\n }\n obj[label] = outputValue.toFixed(3);\n }\n }\n }\n });\n }\n });\n\n obj.QCref_channel = 50;\n obj.QCref_flag = 'K';\n obj.QCref_value = 0;\n obj.QCstatus_channel = 51;\n obj.QCstatus_flag = 'K';\n obj.QCstatus_value = 99000;\n dataObject.data.push(obj);\n });\n if (dataObject.fields !== undefined) {\n dataObject.fields.push('QCref_channel', 'QCref_flag', 'QCref_value', 'QCstatus_channel', 'QCstatus_flag', 'QCstatus_value');\n }\n break;\n }\n default:\n throw new Meteor.Error('Unexpected switch clause', 'exception in switch statement for export file format');\n }\n return dataObject;\n}", "aggregate( field = '' ) {\n\n // Execute the request without loading.\n return this.request('GET', `index/${field}`, true, {}, false);\n\n }", "function GetSummary() {\n var YearQuery = '';\n if (FilterList.DashboardFilterYear === '') {\n YearQuery =\n ' business_year = ' +\n \"'\" +\n moment().utcOffset('+08:00').format('YYYY') +\n \"'\";\n } else {\n YearQuery =\n ' business_year = ' + \"'\" + FilterList.DashboardFilterYear + \"'\";\n }\n\n var MonthQuery = '';\n if (FilterList.DashboardFilterMonth === '') {\n MonthQuery =\n ' and business_month = ' +\n \"'\" +\n moment().utcOffset('+08:00').format('MMMM') +\n \"'\";\n } else {\n MonthQuery =\n ' and business_month = ' + \"'\" + FilterList.DashboardFilterMonth + \"'\";\n }\n\n var TeamQuery = '';\n if (\n FilterList.DashboardFilterTeam === '' ||\n FilterList.DashboardFilterTeam === 'ALL'\n ) {\n TeamQuery = ' and team IN ' + global.TeamAccessList;\n } else {\n TeamQuery = ' and team = ' + \"'\" + FilterList.DashboardFilterTeam + \"'\";\n }\n\n var VendorQuery = '';\n if (\n FilterList.DashboardFilterVendor === '' ||\n FilterList.DashboardFilterVendor === 'ALL'\n ) {\n VendorQuery = ' and principal_name like ' + \"'%%' \";\n } else {\n VendorQuery =\n ' and principal_name = ' + \"'\" + FilterList.DashboardFilterVendor + \"'\";\n }\n\n dbperymtsat.transaction((tx) => {\n tx.executeSql(\n 'SELECT SUM(amount) as amount , SUM(target) as target FROM perymtsat_tbl where ' +\n YearQuery +\n MonthQuery +\n TeamQuery +\n VendorQuery +\n ' order by invoice_date asc ',\n [],\n (tx, results) => {\n var len = results.rows.length;\n if (len > 0) {\n // console.log(results.rows.item(0).target);\n //console.log(results.rows.item(0).amount);\n //setTotalSales();\n setTotalTarget(parseInt(results.rows.item(0).target));\n setTotalSales(parseInt(results.rows.item(0).amount));\n settotalSalesAnimation(true);\n // numbro(parseInt(results.rows.item(0).amount)).format({\n // thousandSeparated: true,\n // mantissa: 2,\n // }),\n\n // console.log(\n // 'Successfully got summary of ' +\n // FilterList.DashboardFilterMonth +\n // numbro(parseInt(results.rows.item(0).amount)).format({\n // thousandSeparated: true,\n // mantissa: 2,\n // }),\n // );\n }\n },\n SQLerror,\n );\n });\n }", "function data_consolidator(attendance_data){\n let aggregate_att_arr = [],\n mod_att_data = attendance_data.map( obj => {\n return {...obj, counter:1};\n }),\n code = ['الكود'];\n mod_att_data.forEach(obj => {\n let object_exists = arr_comparator(aggregate_att_arr, obj, code);\n if(object_exists){\n agg_obj = aggregate_att_arr[object_exists];\n agg_obj.counter++;\n }\n else{\n aggregate_att_arr.push(obj);\n }\n })\n return aggregate_att_arr;\n}", "function dataCallback(err, db)\n{\n\n if (err)\n {\n db.close();\n\n throw err;\n }\n \n\n var myCollection = db.collection(collectionName); // the name of the table or collection\n \n myCollection.aggregate([{$match:{size:Size}}, {$group:{_id:'AVERAGE', AVG:{$avg:'$price'}}}])\n .toArray( function(err, result){\n if (err)\n throw err;\n else if (!result.length)\n throw new Error('Perhaps no records found!')\n \n else\n console.log(result[0].AVG.toFixed(2)); //NOTE: result = [{_id: 'AVERAGE', AVG: 10.5 }]\n \n });\n \n db.close();\n \n \n}", "async function rawmaterialDataFetching(doc, result, moldType, meltWeight, meltNo, req, res) {\n RawMaterialController.findRawMaterial_meltNo(meltNo)\n .then(rawResult => {\n console.log('rawResult', rawResult);\n rawResult.forEach(result => {\n var itemName = result.itemName;\n var itemType = result.itemType;\n var itemWeight = result.itemWeight;\n var perKgCost = result.perKGCost;\n var TotalWeightRawmaterial = 0.0;\n var TotalWeightConsumable = 0.0;\n RawMaterialPreData.findOne({ $and: [{ itemName: itemName }, { moldType: moldType }] })\n .exec()\n .then(preResult => {\n console.log('preResult', preResult);\n if (preResult) {\n var itemPercentage = preResult.itemPercentage;\n TotalWeightRawmaterial = Number(meltWeight) * (Number(itemPercentage) / 100);\n ConsumableReportController.report_Save(doc, meltNo, itemName, itemType, itemWeight, TotalWeightRawmaterial, perKgCost);\n }\n })\n .catch(err => {\n res.status(500).json(err);\n });\n\n });\n })\n\n\n}", "function fetchTotals(fields) {\n var tots = 0;\n var commands = \"\";\n var ctrl = true;\n for (var c = 0; c < fields.length; c++) {\n commands = commands + '&' + fields[c][0] + '=' + fields[c][1];\n }\n $.when(\n $.ajax({\n url:'http://safetrails.herokuapp.com/index.php/cases?count=true' + commands,\n dataType:'string',\n xhrFields: {\n withCredentials: false\n },\n type:'GET',\n success:function(data) {\n // Extract info\n tots = data;\n }\n })\n ).done( function (x) {\n ctrl = false;\n });\n while (ctrl) {\n // Do nothing\n }\n return tots;\n}", "function aggRecords (records) {\n // records.reverse();\n var types = distinct(records, 'type') // .reverse();\n var users = distinct(records, 'user') // these are sorted\n var hosts = distinct(records, 'host') // these are sorted\n\n function emptyHostMap () { // function bound to hosts, which is an array\n return _.reduce(hosts, function (result, value /* , key */) {\n result[value] = '-no value-'\n return result\n }, {})\n }\n\n // map [{stamp, host, user, type, md5}] - array of obj\n // to [[ stamp, host1-md5,.. hostn-md5]] - array of arrays\n // first filtering for a specific user and type\n function makeTableStampByHost (u, t) { // function is bound to records\n var md5byStampByHost = {}\n _(records).filter({\n user: u,\n type: t\n }).each(function (r) {\n var stamp = r.stamp\n // stamp is rounded to 10min so we can match entries.\n stamp = stamp.replace(/[0-9]:[0-9]{2}(\\.[0-9]*)?Z$/, '0:00Z') // round down to 10:00\n\n md5byStampByHost[stamp] = md5byStampByHost[stamp] || emptyHostMap()\n // TODO(daneroo) prevent overwrite - if we assume descending order.\n md5byStampByHost[stamp][r.host] = r.md5\n })\n\n var rows = []\n // keep the table in reverse chronological order\n _.keys(md5byStampByHost).sort().reverse().forEach(function (stamp) {\n var row = [stamp]\n _.keys(md5byStampByHost[stamp]).sort().forEach(function (host) {\n var md5 = md5byStampByHost[stamp][host]\n row.push(md5)\n })\n rows.push(row)\n })\n return rows\n }\n\n types.forEach(function (t) {\n users.forEach(function (u) {\n var rows = makeTableStampByHost(u, t)\n\n // reformat\n rows = rows.map(row => {\n // adjust the output each row in stamp, md5,md5,..\n return row.map((v, idx) => {\n if (idx === 0) { // this is the stamp\n return shortDate(v)\n }\n return v.substr(0, 7) // a la github\n })\n })\n\n // keep only until first match\n var foundIdentical = false\n rows = rows.filter((row) => {\n // is all md5's are equal (1 distinct vale)\n if (!foundIdentical && _.uniq(row.slice(1)).length === 1) {\n foundIdentical = true\n row[0] = colors.green(row[0])\n return true\n }\n return !foundIdentical\n })\n\n // now the ouput - as table\n var shortHosts = hosts.map(host => {\n return host.split('.')[0]\n })\n var header = [u + '-' + t].concat(shortHosts)\n var table = newTable(header)\n rows.forEach(row => {\n table.push(row)\n })\n console.log(table.toString())\n })\n })\n\n return records\n}", "function formatDataForTableBuilding(data) {\n var collectionToAppend = data.results.map((valueSet, idx) => [formatDate(valueSet.date.local), valueSet.location, valueSet.parameter, valueSet.value, valueSet.unit ])\n\n //console.log(collectionToAppend);\n return collectionToAppend;\n}", "_storeApiData(result) {\n for (var i = 0; i < result.length; i++) {\n var data = result[i];\n this._addItemsToData(data.data, data.league, data.api);\n this._updateCurrencyDetails(data.data);\n }\n }", "function processRows(rows, mode) {\n\n\t\t// Cast Postgres SUMs as ints, and calculate score-adjusted corsi\n\t\t// Separate team and skater rows\n\t\tvar teamRows = [];\n\t\tvar skaterRows = [];\n\t\trows.forEach(function(r) {\n\t\t\t[\"toi\", \"ig\", \"is\", \"ic\", \"ia1\", \"ia2\", \"gf\", \"ga\", \"sf\", \"sa\", \"cf\", \"ca\", \"cf_off\", \"ca_off\"].forEach(function(col) {\n\t\t\t\tr[col] = +r[col];\n\t\t\t});\n\t\t\tr.cf_adj = constants.cfWeights[r.score_sit] * r.cf;\n\t\t\tr.ca_adj = constants.cfWeights[-1 * r.score_sit] * r.ca;\n\t\t\tif (r.player_id < 2) {\n\t\t\t\tteamRows.push(r);\n\t\t\t} else if (r.positions) {\n\t\t\t\tskaterRows.push(r);\n\t\t\t}\n\t\t});\n\n\t\t// Apply standard structure to skater and team rows\n\t\tvar skaters = ah.structureSkaterStatRows(skaterRows);\n\t\tvar teams = ah.structureTeamStatRows(teamRows);\n\n\t\t// Add results to response\n\t\tresult[mode] = {\n\t\t\tig: getLeaders(skaters, \"all\", \"ig\", 5),\n\t\t\tip: getLeaders(skaters, \"all\", \"ip\", 5),\n\t\t\tev5_ic: getLeaders(skaters, \"ev5\", \"ic\", 5),\n\t\t\ti_ev5_c_diff_adj: getLeaders(skaters, \"ev5\", \"c_diff_adj\", 5),\n\t\t\ti_sh_pct: getLeaders(skaters, \"all\", \"i_sh_pct\", 5),\n\t\t\ttm_g_diff: getLeaders(teams, \"all\", \"g_diff\", 5),\n\t\t\ttm_ev5_c_diff_adj: getLeaders(teams, \"ev5\", \"c_diff_adj\", 5),\n\t\t\ttm_sh_pct: getLeaders(teams, \"all\", \"sh_pct\", 5),\n\t\t\ttm_sv_pct: getLeaders(teams, \"all\", \"sv_pct\", 5)\n\t\t};\n\n\t\t// Get the top X players\n\t\t// 'objects' is an array of skater or teamobjects\n\t\t// 'sit' is the strength situation: all, ev5, pp, sh\n\t\t// 'stat' is the property name by which to rank players\n\t\t// 'limit' is the number of players to return (if there are ties, more players will be returned)\n\t\tfunction getLeaders(objects, sit, stat, limit) {\n\t\t\t// Return an empty array if 'objects' is empty after filtering\n\t\t\tif (objects.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tvar leaders = [];\n\t\t\t// Store the sort value\n\t\t\tobjects.forEach(function(s) {\n\t\t\t\tif (stat === \"i_sh_pct\") {\n\t\t\t\t\ts.sort_val = s.stats[sit].is < 10 ? 0 : s.stats[sit].ig / s.stats[sit].is; // Make sure shots > 0 (or use a higher threshold)\n\t\t\t\t} else if (stat === \"ip\") {\n\t\t\t\t\ts.sort_val = s.stats[sit].ig + s.stats[sit].ia1 + s.stats[sit].ia2;\n\t\t\t\t} else if (stat === \"c_diff_adj\") {\n\t\t\t\t\ts.sort_val = s.stats[sit].cf_adj - s.stats[sit].ca_adj;\n\t\t\t\t} else if (stat === \"g_diff\") {\n\t\t\t\t\ts.sort_val = s.stats[sit].gf - s.stats[sit].ga;\n\t\t\t\t} else if (stat === \"sh_pct\") {\n\t\t\t\t\ts.sort_val = s.stats[sit].sf <= 0 ? 0 : s.stats[sit].gf / s.stats[sit].sf;\n\t\t\t\t} else {\n\t\t\t\t\ts.sort_val = s.stats[sit][stat];\n\t\t\t\t}\n\t\t\t\ts[\"sorted_\" + stat] = s.sort_val;\n\t\t\t});\n\t\t\t// For cf_pct_rel, apply a minimum toi\n\t\t\tif (stat === \"cf_pct_rel\") {\n\t\t\t\tobjects = objects.filter(function(d) { return d.stats[sit].toi >= 60 * 60; });\n\t\t\t}\n\t\t\t// Get the 5th ranked player's stat value - if there are fewer than 5 players, then get the last player's value\n\t\t\tobjects = objects.sort(function(a, b) { return b.sort_val - a.sort_val; });\n\t\t\tvar cutoff = objects[limit - 1] ? objects[limit - 1].sort_val : objects[objects.length - 1].sort_val;\n\t\t\t// Add players to leader results until the cutoff value is passed\n\t\t\tvar i = 0;\n\t\t\tvar isCutoffExceeded = false;\n\t\t\twhile (i < objects.length && !isCutoffExceeded) {\n\t\t\t\tif (objects[i].sort_val >= cutoff) {\n\t\t\t\t\tleaders.push(objects[i]);\n\t\t\t\t} else {\n\t\t\t\t\tisCutoffExceeded = true;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tobjects.forEach(function(p) {\n\t\t\t\tp.sort_val = undefined;\n\t\t\t});\n\t\t\treturn leaders;\n\t\t}\n\n\t\t// Send response when recent and season results are ready\n\t\tif (result.recent && result.season) {\n\t\t\treturn response.status(200).send(result);\n\t\t}\n\t}", "function getAssetType() {\n var deferred = Q.defer();\n /*console.log('HI');\n \n db.collection('assets').aggregate([{$group : {\"_id\":\"$type\", \"count\":{ $sum : 1 }}}]).toArray(function(err, types){\n console.log(types);\n if(err) deferred.reject(err);\n deferred.resolve(types);\n }); */\n return deferred.promise;\n}", "function getProductStatistic(req, res) {\n let pool = engine.getPool();\n let jsonResult = {};\n\n let getTotal = `SELECT COUNT(*) AS r FROM ${TABLE.PRODUCT}`;\n let getOutOfStock = `SELECT COUNT(*) AS r \n FROM ${TABLE.BATCH} AS b\n INNER JOIN ${TABLE.STOCK} AS s ON b.id = s.batch_id`;\n\n pool.getConnection(function (error, con) {\n // Handle error if there is any\n handleErr(error, res, con);\n // Start the process\n async.waterfall([\n // Getting total products\n function (callback) {\n con.query(getTotal, (err, total) => {\n if (err) callback(err);\n else callback(null, total)\n });\n },\n // Get total out-of-stock product\n function (total, callback){\n con.query(getOutOfStock, (err, out) => {\n if (err) callback(err);\n else callback(null, total, out)\n });\n },\n ], function () {\n\n });\n });\n}", "finalData(hrData) {\r\n const scope = this;\r\n let totalOccupancy, counter;\r\n scope.tempData.occupancy = [];\r\n\r\n scope.tempData.forEach(v => {\r\n totalOccupancy = 0;\r\n counter = 0;\r\n hrData.forEach(d => {\r\n if((new Date(d.Time)).getHours() === v.time){\r\n v.occupancy.push(d.mean);\r\n totalOccupancy = totalOccupancy + d.mean;\r\n counter++;\r\n }\r\n });\r\n\r\n if(counter > 0)\r\n v.average = totalOccupancy / counter;\r\n else\r\n v.average = 0;\r\n });\r\n\r\n return scope.tempData;\r\n }", "async getAll(params) {\n\t\tlet selectFrom;\n\t\tlet selectTo;\n\t\tif (params.from && params.to) {\n\t\t\tselectFrom = params.from.date();\n\t\t\tselectTo = params.to.date();\n\t\t}\n\n\t\tconst entriesToLoad = [];\n\t\tfor (let i in this._datastore) {\n\t\t\tconst event = this._datastore[i];\n\t\t\tif (selectFrom && selectTo) {\n\t\t\t\tif (event.end_date >= selectFrom && event.start_date < selectTo) {\n\t\t\t\t\tentriesToLoad.push(event);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tentriesToLoad.push(event);\n\t\t\t}\n\t\t}\n\n\t\tconst result = entriesToLoad.map((entry) => {\n\t\t\tvar serialized = Object.assign({}, entry);\n\t\t\tfor (let i in serialized) {\n\t\t\t\tif (Object.prototype.toString.call(serialized[i]) === \"[object Date]\") {\n\t\t\t\t\tserialized[i] = serialized[i].format(\"YYYY-MM-DD hh:mm\");\n\t\t\t\t} else if (typeof serialized[i] === \"string\") {\n\t\t\t\t\tserialized[i] = xssFilters.inHTMLData(serialized[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn serialized;\n\t\t});\n\n\t\tif(this._params.objectResult || this._params.collections){\n\t\t\tvar res = {\n\t\t\t\tdata: result\n\t\t\t};\n\t\t\tif(this._params.collections){\n\t\t\t\tres.collections = this._params.collections\n\t\t\t};\n\t\t\treturn res;\n\t\t}else{\n\t\t\treturn result;\n\t\t}\n\t}", "function getResourcesData(data) {\n var indexName = data.company;\n var startdate = data.strdate + ' 00:00:00';\n var enddate = data.enddate + ' 23:59:59';\n var from = 0;\n var size = 10;\n var filter = {};\n var regionfilter = {};\n var productfilter = {};\n var sorting_order = data.shortingorder;\n var sorting_field = data.sortingfield;\n\n if (data.size) {\n size = data.size;\n }\n\n if (data.currentpage) {\n from = ((data.currentpage - 1) * size);\n }\n\n if (data.filter != \"\") {\n filter = {\n \"multi_match\": {\n \"query\": data.filter,\n \"fields\": [\"ResourceId\", \"aws:*\", \"user:*\"],\n \"type\": \"phrase_prefix\"\n }\n };\n }\n\n if (data.region != \"\") {\n regionfilter = { \"match\": { \"__AvailabilityRegion\": data.region } };\n }\n\n if (data.product != \"\") {\n productfilter = { \"match\": { \"ProductName\": data.product } };\n }\n var sort = {};\n sort[sorting_field] = { \"order\": sorting_order };\n\n var query = {\n \"from\": from,\n \"size\": size,\n \"sort\": [sort],\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"range\": {\n \"UsageStartDate\": {\n \"gte\": startdate,\n \"format\": \"yyyy-MM-dd HH:mm:ss\"\n }\n }\n },\n {\n \"range\": {\n \"UsageEndDate\": {\n \"lte\": enddate,\n \"format\": \"yyyy-MM-dd HH:mm:ss\"\n }\n }\n },\n filter,\n productfilter,\n regionfilter\n\n ]\n\n }\n\n },\n \"aggs\": {\n \"total_cost\": {\n \"sum\": {\n \"field\": \"BlendedCost\"\n }\n },\n \"total_quantity\": {\n \"sum\": {\n \"field\": \"UsageQuantity\"\n }\n }\n },\n \"_source\": [\n \"ProductName\",\n \"UsageType\",\n \"__AvailabilityRegion\",\n \"ItemDescription\",\n \"UsageStartDate\",\n \"UsageEndDate\",\n \"UsageQuantity\",\n \"BlendedRate\",\n \"BlendedCost\",\n \"Operation\",\n \"aws:*\",\n \"user:*\",\n \"ResourceId\"\n ]\n };\n\n //debugQuery(query);\n\n return elasticClient.search({\n index: indexName,\n body: query\n })\n\n}", "async getView() {\n const findAll = _promisify((...args) => {\n this.collection.aggregate(...args);\n });\n const result = await findAll([\n { $sort: { _id: -1 } },\n { $group: { _id: `$${this.keyName}`, data: { $first: '$$ROOT' } } },\n { $project: { _id: 0, 'data.nodes': 0 } },\n ])\n .then((a) => a)\n .catch((e) => {\n throw ServerError('Failed to get View', e);\n });\n const all = await result.toArray();\n const flatAll = all.map((d) => {\n return { ...d.data };\n });\n return flatAll;\n }", "function lotTotalArea() {\nvar total_affected_area = {\nonStatisticField: \"AffectedArea\",\noutStatisticFieldName: \"total_affected_area\",\nstatisticType: \"sum\"\n}\n\nvar total_handover_area = {\nonStatisticField: \"HandOverArea\",\noutStatisticFieldName: \"total_handover_area\",\nstatisticType: \"sum\"\n};\n\nvar query = lotLayer.createQuery();\nquery.outStatistics = [total_affected_area, total_handover_area];\n\nreturn lotLayer.queryFeatures(query).then(function(response) {\nvar stats = response.features[0].attributes;\n\nconst totalAffected = stats.total_affected_area;\nconst totalHandedOver = stats.total_handover_area;\n//const LOT_HANDOVER_PERC = (handedOver/affected)*100;\nreturn totalAffected;\n});\n}", "function loadResults(){\n //console.log(\"loadQuantity\");\n var $results = $('.' + _results);\n for(var i = 0; i < $results.length; i++){\n var $result = $($results[i]);\n var datas = $result.data();\n if (!datas[_resController]\n || !datas[_resTempHeader]\n || !datas[_resTempHeaderId]\n || !datas[_resTempItem]\n || !datas[_resTempItemId]\n || !datas[_resTempPagination]\n || !datas[_resTempPaginationId]) {\n throw Error(\"Resuts \" + _results + \" do not define datas correctly\");\n }\n\n var ctxt = {\n \"_resTempHeaderId\": _resTempHeaderId,\n \"_resTempItemId\": _resTempItemId,\n \"_resTempPaginationId\": _resTempPaginationId\n };\n var jCookie = getJCookie(_cookieName);\n var jResources = jCookie[_jResources];\n if (jResources) {\n var ids = Object.keys(jResources).join(\"|\");\n ctxt[\"ids\"] = ids;\n $.get(datas[_resController], ctxt)\n .done(function(data){\n $('#' + ctxt[_resTempHeaderId]).empty().append(data);\n $('#' + ctxt[_resTempItemId]).append(data);\n $('#' + ctxt[_resTempPaginationId]).empty().append(data);\n })\n .fail(function(err){\n console.error(\"loading resources\", ctxt, err);\n })\n }\n }\n }", "async getAllResults(req, res, next) {\n try {\n const results = await resultsService.getAllResults()\n res.send(results)\n } catch (error) {\n next(error)\n }\n }", "function getGoing(aggrType){\n\tconsole.log(aggrType);\n\tif(aggrType == null) attrType = 'count';\n\t//var plotType = $(\"input:radio[name=plotType]:checked\").val();\n\t//var aggregate = $(\"input:radio[name=aggregate_by]:checked\").val();\n\t//console.log (plotType + \", \" + aggregate);\n\n\t//if(plotType == \"full_year\"){\t//time and resource consuming animation. make animation smooth\n\t\tvar jsonpipe = [];\n\t\t\t//console.log(tick + \": Size of jsonpipe \" + jsonpipe.length);\n\t $.ajax({\n\t\t\t type: 'GET',\n\t\t\t url: '/koding/mapapp/index.php/sale/query',\t// following the pattern of (controller/action)\n\t\t\t data: {aggr: aggrType},\n\t\t\t dataType: 'json',\n\t\t\t success: function (result) {\n\t\t\t\t for(var i=0; i<result.length; i++){\n\t\t\t\t\t if(jsonpipe.length > 100) jsonpipe.shift();\n\t\t\t\t\t jsonpipe.push(result[i]);\n\t\t\t\t }\n\t\t\t console.log(JSON.stringify(jsonpipe));\n\t\t\t },\n\t\t\t complete: function (result) {\n\t\t\t\t overlayCountOfSale();\n\t\t\t }\n\t });\n//\t} else if(plotType == \"one_month\"){\n//\t\tjsonpipe = [];\n//\t\tvar temp = $(\"#pmonth\").val();\n////\t\tvar month = parseInt(temp.substring(5, 7));\n////\t\tvar year = parseInt(temp.substring(0, 4));\n//\t\t$.ajax({\n//\t\t\ttype: 'GET',\n//\t\t\turl: 'duration.php',\n//\t\t\tdata: {\"pmonth\": temp, \"aggregate\": aggregate},\t//temp format - YYYY-DD; the webservice will suffix 01 and 30/31\n//\t\t\tdataType: 'json',\n//\t\t\tsuccess: function (result) {\n//\t\t\t\tfor(var i=0; i<result.length; i++){\n//\t\t\t\t//if(jsonpipe.length > 100) jsonpipe.shift();\n//\t\t\t\t\tconsole.log(result[i]);\n//\t\t\t\t\tjsonpipe.push(result[i]);\n//\t\t\t\t}\n//\t\t\t\t//console.log(\"reading data \"+tick);\n//\t\t\t},\n//\t\t\tcomplete: function (result) {\n//\t\t\t\tshowPlots(jsonpipe);\n//\t\t\t}\n//\t\t});\t\t\t\n//\t} else if(plotType == \"month_range\") {\n//\t\tjsonpipe = [];\n//\t\tvar temp1 = $(\"#pmonth1\").val();\n//\t\tvar temp2 = $(\"#pmonth2\").val();\n//\t\t$.ajax({\n//\t\t\ttype: 'GET',\n//\t\t\turl: 'duration.php',\n//\t\t\tdata: {pmonth1: temp1, pmonth2: temp2, aggregate: aggregate},\t//temp format - YYYY-DD; the webservice will suffix 01 and 30/31\n//\t\t\tdataType: 'json',\n//\t\t\tsuccess: function (result) {\n//\t\t\t\tfor(var i=0; i<result.length; i++){\n//\t\t\t\t//if(jsonpipe.length > 100) jsonpipe.shift();\n//\t\t\t\t\tjsonpipe.push(result[i]);\n//\t\t\t\t}\n//\t\t\t\t//console.log(\"reading data \"+tick);\n//\t\t\t},\n//\t\t\tcomplete: function (result) {\n//\t\t\t\t// overlayPostcodes();\n//\t\t\t\tdocument.write(JSON.stringify(result));\n//\t\t\t}\n//\t\t});\n//\t} else if(plotType == \"price_range\") {\n//\t} else {\t//area_codes\n//\t}\n}", "async function get_loads(pageCursor){\n var q_full = datastore.createQuery(LOAD);\n var total_num = await datastore.runQuery(q_full).then( (results) => {\n return results[0].length;\n });\n\n var q = datastore.createQuery(LOAD).limit(PAGE_SIZE);\n if(pageCursor){\n q = q.start(pageCursor);\n }\n\treturn datastore.runQuery(q).then( (results) => {\n const entities = results[0].map(fromDatastore);\n const info = [results[1], total_num];\n\t\treturn [entities, info];\n\t});\n}", "async getTopAccessedServers(ts, te) {\n let token = localStorage.getItem(\"interset_token\");\n axios.defaults.headers.common['Authorization'] = token;\n // console.log(ts);\n let url = `${API_URL}/api/search/0/servers/topAccessed?sort=maximum&markup=false&tz=UTC%2B8&count=10&keepAlive=300000`\n if((ts!==0) && (te!==0)){\n url = url + '&ts=' + ts + '&te=' + te;\n }\n const response = await axios.get(url);\n // console.log(Object.keys(response.data.data));\n let rData = [];\n let data = response.data.data;\n let keys = Object.keys(data);\n // console.log(keys);\n \n for(let i=0; i<keys.length; i++){\n let key = keys[i];\n let kData = data[key]\n for(let j=0; j<kData.length; j++){\n kData[j]['accessed'] = key; \n rData.push(kData[j]);\n }\n }\n return rData;\n }", "function addResults(transport, next) {\r\n queryTransport(transport, (err, result) => {\r\n // queryTransport could potentially invoke the callback multiple times\r\n // since Transport code can be unpredictable.\r\n if (next) {\r\n result = err || result;\r\n if (result) {\r\n results[transport.name] = result;\r\n }\r\n\r\n // eslint-disable-next-line callback-return\r\n next();\r\n }\r\n\r\n next = null;\r\n });\r\n }", "function processResult(json) {\n\n var ret = {};\n\n ret.id = json.uuid;\n ret.name = json.name;\n ret.handle = json.handle;\n ret.type = json.type;\n ret.copyrightText = json.copyrightText;\n ret.introductoryText = json.introductoryText;\n ret.shortDescription = json.shortDescription;\n if (typeof json.permission !== 'undefined') {\n ret.canAdminister = json.permission.canAdminister;\n }\n ret.countItems = json.countItems;\n var logo = {};\n if (json.logo !== null) {\n logo.id = json.logo.uuid;\n logo.retrieveLink = json.logo.retrieveLink;\n logo.sizeBytes = json.logo.sizeBytes;\n logo.mimeType = json.logo.mimeType;\n\n }\n ret.logo = logo;\n\n var collections = [];\n var itemTotal = 0;\n for (var i = 0; i < json.collections.length; i++) {\n\n var tmp = {};\n tmp.id = json.collections[i].id;\n tmp.name = json.collections[i].name;\n tmp.handle = json.collections[i].handle;\n tmp.type = json.collections[i].type;\n tmp.copyrightText = json.collections[i].copyrightText;\n tmp.introductoryText = json.collections[i].introductoryText;\n tmp.shortDescription = json.collections[i].shortDescription;\n tmp.numberItems = json.collections[i].numberItems;\n collections[i] = tmp;\n\n // increment total item count\n itemTotal += tmp.numberItems;\n\n }\n ret.items = collections;\n ret.itemTotal = itemTotal;\n\n return ret;\n }", "async fetchAllBricolOfOneBricoler(req, res, next) {\n try {\n console.log('s')\n const limit = parseInt(req.query.limit) || 20;\n const page = req.query.page || 1;\n\n let bricolerId = req.params.bricolerId;\n\n let userDetails = await User.findById(bricolerId);\n if (!userDetails)\n return res.status(404).end();\n\n let query = {}\n if (req.query.status)\n query.status = req.query.status\n query.bricoler = bricolerId\n let allBricols = await Bricol.find(query)\n .populate('user')\n .populate('job')\n .populate('bricoler')\n .skip((page - 1) * limit)\n .limit(limit).sort({ creationDate: -1 })\n\n let result = []\n for (let x = 0; x < allBricols.length; x++) {\n let query = {}\n query.bricol = allBricols[x].id;\n query.bidType = 'inCity'\n let countBids = await Bid.count(query);\n result.push({ bricol: allBricols[x], countBids: countBids })\n }\n\n let count = await Bricol.count(query);\n return res.send(new ApiResponse(\n result,\n page,\n Math.ceil(count / limit),\n limit,\n count,\n req\n ))\n\n } catch (err) {\n next(err)\n }\n }", "function joinResults(req, res, next) {\n\t\tconst joinedResults = [];\n\n\t\tfor (const resultArray of req.results) {\n\t\t\tfor (const result of resultArray) {\n\t\t\t\tconst post = result.post;\n\t\t\t\t// temp fix for comments without parents -> see Trello for relevant card\n\t\t\t\tif (!post || Object.keys(post) === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tpost.id = post._id;\n\t\t\t\tdelete post._id;\n\n\t\t\t\t// Both aggregation pipelines may have returned the same post\n\t\t\t\tconst isDuplicate = joinedResults.some(function(joinedPost) {\n\t\t\t\t\treturn joinedPost.id.toString() === post.id.toString();\n\t\t\t\t});\n\n\t\t\t\tif (isDuplicate === false) {\n\t\t\t\t\tjoinedResults.push(post);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treq.results = joinedResults;\n\n\t\tnext();\n\t}", "async function ordersService(){\n let query = `SELECT orders.*, GROUP_CONCAT(item_to_order.ItemId) as 'items' \n FROM item_to_order inner join orders on item_to_order.OrderId = orders.OrderId\n GROUP BY item_to_order.OrderId`;\n\n // execute query that fetch data from my sql database\n db.query(query, function(err, rows, fields) {\n if (err){\n throw new Error(err);\n } \n //trasform OrderItems to numbers array form items String recived from the mysql db\n for(let i in rows){\n rows[i].OrderItems = rows[i].items.split(',');\n }\n // insert the given results to mongo db\n ordersModel.insertMany(rows, function (err, orders) {\n if (err) {\n throw new Error(err);\n };\n return\n });\n });\n}", "function logResult(result) {\n for (let i = 0; i <result[0].DataTable.length ; i++) {\n products.push(result[0].DataTable[i]);\n products[i].inCart = 0;\n }\n for (let i = 0; i < result[1].DataTable.length; i++) {\n images.push(result[1].DataTable[i]);\n }\n for (let i = 0; i < result[2].DataTable.length; i++) {\n productCategorie.push(result[2].DataTable[i])\n }\n}", "function loadSingleData (results) {\n\t\t\tself.isWaiting = false;\n\t\t\tself.error = null;\n\n\t\t\tself.totalRecordCount = 1;\n\t\t\tself.dataResolvingParams.total(1);\n\n\t\t\tself.data = [];\n\t\t\tself.data.push(results);\n\t\t\tself.defer.resolve(results.data);\n\t\t}" ]
[ "0.62260324", "0.6206334", "0.6167573", "0.59330964", "0.5926676", "0.5911214", "0.5895202", "0.58774596", "0.5843023", "0.5825346", "0.5808714", "0.57756174", "0.5750155", "0.5666822", "0.5640852", "0.56233287", "0.56208974", "0.5620738", "0.55973715", "0.55828196", "0.5578383", "0.55726695", "0.55520636", "0.55294406", "0.5528739", "0.55147743", "0.5501328", "0.5474537", "0.54728484", "0.5470221", "0.54522604", "0.54496706", "0.5443826", "0.5435116", "0.54331356", "0.5424163", "0.54126537", "0.53989154", "0.5392326", "0.53857607", "0.53586614", "0.5355361", "0.53545403", "0.535368", "0.5337827", "0.5318575", "0.5312857", "0.5311305", "0.53021103", "0.52985734", "0.5285421", "0.52827615", "0.5279751", "0.5273667", "0.52734214", "0.5235331", "0.5231309", "0.522824", "0.5221152", "0.5218774", "0.52150327", "0.52146107", "0.52094847", "0.52068263", "0.5206136", "0.5205118", "0.52005154", "0.5198549", "0.51981455", "0.5195855", "0.51926833", "0.51877844", "0.5181767", "0.5177868", "0.5177865", "0.5176196", "0.51757646", "0.51756644", "0.5171441", "0.5170873", "0.51701903", "0.5157727", "0.51571274", "0.51488525", "0.51485", "0.5146704", "0.5144702", "0.51421994", "0.5141926", "0.5130937", "0.5129676", "0.51275873", "0.51258206", "0.512468", "0.51189095", "0.51160824", "0.5112692", "0.5102261", "0.5101344", "0.50968117", "0.5095503" ]
0.0
-1
Constructs a new event emitter instance.
function EventEmitter() { /** * Registered listeners. * @type {Object.<string,*>} * @private */ this._listeners = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n\t\t this._events = new Events();\n\t\t this._eventsCount = 0;\n\t\t}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n\t this._events = new Events();\n\t this._eventsCount = 0;\n\t}", "function EventEmitter() {\n \t this._events = new Events();\n \t this._eventsCount = 0;\n \t}", "function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this.registry_ = {};\n }", "function Emitter() {\n this.events = {};\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}", "function EventEmitter(){this._events=new Events();this._eventsCount=0;}", "function EventEmitter(){this._events=new Events();this._eventsCount=0;}", "function EventEmitter() {\n _classCallCheck(this, EventEmitter);\n\n this.registry_ = {};\n }", "function Emitter() {\r\n this.events = {};\r\n}", "constructor() {\n this.eventEmitter = new Emitter();\n }", "function EventEmitter() {\n // Initialise required storage variables\n this._events = {};\n}", "function EventEmitter() {\n // Initialise required storage variables\n this._events = {};\n}", "function Emitter() {\n\n this.events = {};\n\n\n}", "function EventEmitter() {}", "function EventEmitter() {}", "function EventEmitter() {}", "function EventEmitter() {}", "function EventEmitter() {}", "function EventEmitter() {}", "function EventEmitter() {}" ]
[ "0.7668809", "0.7668809", "0.7648649", "0.7648649", "0.7648649", "0.7648649", "0.76392597", "0.76034755", "0.75937414", "0.7593319", "0.75529844", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.74682486", "0.74186385", "0.7392862", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.73783207", "0.7371742", "0.7371742", "0.7371665", "0.7340519", "0.7332449", "0.7327447", "0.7327447", "0.731746", "0.7247464", "0.7247464", "0.7247464", "0.7247464", "0.7247464", "0.7247464", "0.7247464" ]
0.0
-1
Throws a `Cancel` if cancellation has been requested.
function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async cancel() {\n throw new Error(this.cancelMessage);\n }", "cancel() {\n throw new Error(\"Not implemented.\")\n }", "isCanceled(cancelled) {\n if (cancelled) {\n throw new Error(\"Cancelled request\");\n }\n }", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) config.cancelToken.throwIfRequested();\n if (config.signal && config.signal.aborted) throw new Cancel('canceled');\n}", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new Cancel('canceled');\n }\n}", "function throwIfCancellationRequested(config){if(config.cancelToken){config.cancelToken.throwIfRequested();}}", "function throwIfCancellationRequested(config){if(config.cancelToken){config.cancelToken.throwIfRequested();}}", "function throwIfCancellationRequested(config){if(config.cancelToken){config.cancelToken.throwIfRequested();}}", "function throwIfCancellationRequested(config){if(config.cancelToken){config.cancelToken.throwIfRequested();}}", "function throwIfCancellationRequested(config){if(config.cancelToken){config.cancelToken.throwIfRequested();}}", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n }", "function throwIfCancellationRequested(config){\nif(config.cancelToken){\nconfig.cancelToken.throwIfRequested();\n}\n}", "function cancel () {\n const e = new Error('Coroutine canceled.');\n e.cause = 'canceled';\n this.resume(e);\n}", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n }", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n }", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n\t if (config.cancelToken) {\n\t config.cancelToken.throwIfRequested();\n\t }\n\t}", "function throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n }", "actionCancel() {\n this.source && this.source.cancel('Operation canceled by the user.');\n }", "cancel() {\n cancel();\n }", "function throwIfCancellationRequested(config) {\r\n if (config.cancelToken) {\r\n config.cancelToken.throwIfRequested();\r\n }\r\n}", "cancel() {\n if (this.isCloseable_) {\n this.userActed('cancel');\n }\n }", "cancel() {}" ]
[ "0.79484594", "0.7737491", "0.75342494", "0.7447438", "0.7424596", "0.7386911", "0.7386911", "0.7386911", "0.7386911", "0.7386911", "0.7206988", "0.7168578", "0.71630925", "0.7162724", "0.7143389", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.7080394", "0.7068254", "0.7049706", "0.7024931", "0.7013523", "0.7005552" ]
0.0
-1
Determine if we're running in a standard browser environment This allows axios to run in a web worker, and reactnative. Both environments support XMLHttpRequest, but not fully standard globals. web workers: typeof window > undefined typeof document > undefined reactnative: navigator.product > 'ReactNative' nativescript navigator.product > 'NativeScript' or 'NS'
function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n }", "function isStandardBrowserEnv() {\n if (\n typeof navigator !== 'undefined' &&\n (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')\n ) {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n }", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n }", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n }" ]
[ "0.80759513", "0.80718875", "0.8061416", "0.8040616", "0.80331844", "0.80331844", "0.8031049", "0.8020131" ]
0.0
-1
base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBase64() {\n var s = this.getDump();\n\n var ch =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var c1, c2, c3, e1, e2, e3, e4;\n var l = s.length;\n var i = 0;\n var r = \"\";\n\n do {\n c1 = s.charCodeAt(i);\n e1 = c1 >> 2;\n c2 = s.charCodeAt(i + 1);\n e2 = ((c1 & 3) << 4) | (c2 >> 4);\n c3 = s.charCodeAt(i + 2);\n if (l < i + 2) {\n e3 = 64;\n } else {\n e3 = ((c2 & 0xf) << 2) | (c3 >> 6);\n }\n if (l < i + 3) {\n e4 = 64;\n } else {\n e4 = c3 & 0x3f;\n }\n r += ch.charAt(e1) + ch.charAt(e2) + ch.charAt(e3) + ch.charAt(e4);\n } while ((i += 3) < l);\n return r;\n }", "function base64_encode_data(data, len, b64x) {\n var dst = \"\"\n var i\n\n for (i = 0; i <= len - 3; i += 3)\n {\n dst += b64x.charAt(data.charCodeAt(i) >>> 2)\n dst += b64x.charAt(((data.charCodeAt(i) & 3) << 4) | (data.charCodeAt(i+1) >>> 4))\n dst += b64x.charAt(((data.charCodeAt(i+1) & 15) << 2) | (data.charCodeAt(i+2) >>> 6))\n dst += b64x.charAt(data.charCodeAt(i+2) & 63)\n }\n\n if (len % 3 == 2)\n {\n dst += b64x.charAt(data.charCodeAt(i) >>> 2)\n dst += b64x.charAt(((data.charCodeAt(i) & 3) << 4) | (data.charCodeAt(i+1) >>> 4))\n dst += b64x.charAt(((data.charCodeAt(i+1) & 15) << 2))\n dst += b64pad\n }\n else if (len % 3 == 1)\n {\n dst += b64x.charAt(data.charCodeAt(i) >>> 2)\n dst += b64x.charAt(((data.charCodeAt(i) & 3) << 4))\n dst += b64pad\n dst += b64pad\n }\n\n return dst\n }", "toString(buf) {\n if (buf.length % 4 > 0) {\n throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${buf.length}`);\n }\n let str = '';\n let lineLen = 0;\n function buildLine(c1, c2, c3, c4) {\n switch (lineLen) {\n case 76:\n str += `\\r\\n${c1}${c2}${c3}${c4}`;\n lineLen = 4;\n break;\n case 75:\n str += `${c1}\\r\\n${c2}${c3}${c4}`;\n lineLen = 3;\n break;\n case 74:\n str += `${c1 + c2}\\r\\n${c3}${c4}`;\n lineLen = 2;\n break;\n case 73:\n str += `${c1 + c2 + c3}\\r\\n${c4}`;\n lineLen = 1;\n break;\n default:\n str += c1 + c2 + c3 + c4;\n lineLen += 4;\n break;\n }\n }\n function validate(c) {\n if (c >= 65 && c <= 90) {\n return true;\n }\n if (c >= 97 && c <= 122) {\n return true;\n }\n if (c >= 48 && c <= 57) {\n return true;\n }\n if (c === 43) {\n return true;\n }\n if (c === 47) {\n return true;\n }\n if (c === 61) {\n return true;\n }\n return false;\n }\n for (let i = 0; i < buf.length; i += 4) {\n for (let j = i; j < i + 4; j += 1) {\n if (!validate(buf[j])) {\n throw new RangeError(`base64.toString: buf[${j}]: ${buf[j]} : not valid base64 character code`);\n }\n }\n buildLine(\n String.fromCharCode(buf[i]),\n String.fromCharCode(buf[i + 1]),\n String.fromCharCode(buf[i + 2]),\n String.fromCharCode(buf[i + 3])\n );\n }\n return str;\n }", "function Magic(r){if(!/^[a-z0-9+/]+={0,2}$/i.test(r)||r.length%4!=0)throw Error(\"Not base64 string\");for(var t,e,n,o,i,a,f=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",h=[],d=0;d<r.length;d+=4)t=(a=f.indexOf(r.charAt(d))<<18|f.indexOf(r.charAt(d+1))<<12|(o=f.indexOf(r.charAt(d+2)))<<6|(i=f.indexOf(r.charAt(d+3))))>>>16&255,e=a>>>8&255,n=255&a,h[d/4]=String.fromCharCode(t,e,n),64==i&&(h[d/4]=String.fromCharCode(t,e)),64==o&&(h[d/4]=String.fromCharCode(t));return r=h.join(\"\")}", "function base64(s)\n\t{\n\t\tvar ch =\n\t\t\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\t\tvar c1\n\t\t , c2\n\t\t , c3\n\t\t , e1\n\t\t , e2\n\t\t , e3\n\t\t , e4;\n\t\tvar l = s.length;\n\t\tvar i = 0;\n\t\tvar r = \"\";\n\n\t\tdo\n\t\t\t{\n\t\t\t\tc1 = s.charCodeAt(i);\n\t\t\t\te1 = c1 >> 2;\n\t\t\t\tc2 = s.charCodeAt(i + 1);\n\t\t\t\te2 = ((c1 & 3) << 4) | (c2 >> 4);\n\t\t\t\tc3 = s.charCodeAt(i + 2);\n\t\t\t\tif (l < i + 2) e3 = 64;\n\t\t\t\telse e3 = ((c2 & 0xf) << 2) | (c3 >> 6);\n\t\t\t\tif (l < i + 3) e4 = 64;\n\t\t\t\telse e4 = c3 & 0x3f;\n\t\t\t\tr += ch.charAt(e1) + ch.charAt(e2) + ch.charAt(e3) + ch.charAt(e4);\n\t\t\t}\n\t\twhile ((i += 3) < l);\n\n\t\treturn r;\n\t}", "function b64(str) {\n return new Buffer(str).toString('base64')\n .replace(/=/g, '')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\n} // This is the encyrption algorithm, don't ask me why it is that way", "function base64_encode(data) {\n\n var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,\n ac = 0,\n enc = '',\n tmp_arr = [];\n\n if (!data) {\n return data;\n }\n\n data = unescape(encodeURIComponent(data));\n\n do {\n // pack three octets into four hexets\n o1 = data.charCodeAt(i++);\n o2 = data.charCodeAt(i++);\n o3 = data.charCodeAt(i++);\n\n bits = o1 << 16 | o2 << 8 | o3;\n\n h1 = bits >> 18 & 0x3f;\n h2 = bits >> 12 & 0x3f;\n h3 = bits >> 6 & 0x3f;\n h4 = bits & 0x3f;\n\n // use hexets to index into b64, and append result to encoded string\n tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);\n } while (i < data.length);\n\n enc = tmp_arr.join('');\n\n var r = data.length % 3;\n\n return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);\n}", "function base64_encode(data) {\r\n var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\r\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,\r\n ac = 0,\r\n enc = '',\r\n tmp_arr = [];\r\n\r\n if (!data) {\r\n return data;\r\n }\r\n\r\n do { // pack three octets into four hexets\r\n o1 = data.charCodeAt(i++);\r\n o2 = data.charCodeAt(i++);\r\n o3 = data.charCodeAt(i++);\r\n\r\n bits = o1 << 16 | o2 << 8 | o3;\r\n\r\n h1 = bits >> 18 & 0x3f;\r\n h2 = bits >> 12 & 0x3f;\r\n h3 = bits >> 6 & 0x3f;\r\n h4 = bits & 0x3f;\r\n\r\n // use hexets to index into b64, and append result to encoded string\r\n tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);\r\n } while (i < data.length);\r\n\r\n enc = tmp_arr.join('');\r\n\r\n var r = data.length % 3;\r\n\r\n return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);\r\n}", "function base64ArrayBuffer(bytes) {\n var base64 = ''\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\n var byteLength = bytes.byteLength\n var byteRemainder = byteLength % 3\n var mainLength = byteLength - byteRemainder\n\n var a, b, c, d\n var chunk\n\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]\n\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18 // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12 // 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6 // 4032 = (2^6 - 1) << 6\n d = chunk & 63 // 63 = 2^6 - 1\n\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]\n }\n\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength]\n\n a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2\n\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4 // 3 = 2^2 - 1\n\n base64 += encodings[a] + encodings[b] + '=='\n } else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]\n\n a = (chunk & 64512) >> 10 // 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4 // 1008 = (2^6 - 1) << 4\n\n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2 // 15 = 2^4 - 1\n\n base64 += encodings[a] + encodings[b] + encodings[c] + '='\n }\n\n return base64\n }", "function getBase64(entry) {\n return btoa(entry);\n}", "function toBase64(a){return CryptoJS&&CryptoJS.enc.Base64?CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(a)):Base64.encode(a)}", "function base64ToBuffer(s) {\n var l = s.length * 6 / 8\n if(s[s.length - 2] == '=')\n l = l - 2\n else\n if(s[s.length - 1] == '=')\n l = l - 1\n\n var b = new Buffer(l)\n b.write(s, 'base64')\n return b\n}", "function base64_decode(data) {\n // console.log(\"data\"+data);\n var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,\n ac = 0,\n dec = '',\n tmp_arr = [];\n if (!data) {\n return data;\n }\n\n data += '';\n do { // unpack four hexets into three octets using index points in b64\n h1 = b64.indexOf(data.charAt(i++));\n h2 = b64.indexOf(data.charAt(i++));\n h3 = b64.indexOf(data.charAt(i++));\n h4 = b64.indexOf(data.charAt(i++));\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\n o1 = bits >> 16 & 0xff;\n o2 = bits >> 8 & 0xff;\n o3 = bits & 0xff;\n if (h3 == 64) {\n tmp_arr[ac++] = String.fromCharCode(o1);\n } else if (h4 == 64) {\n tmp_arr[ac++] = String.fromCharCode(o1, o2);\n } else {\n tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);\n }\n } while (i < data.length);\n dec = tmp_arr.join('');\n return dec.replace(/\\0+$/, '');\n }", "function base64_decode(data) {\n // console.log(\"data\"+data);\n var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,\n ac = 0,\n dec = '',\n tmp_arr = [];\n if (!data) {\n return data;\n }\n\n data += '';\n do { // unpack four hexets into three octets using index points in b64\n h1 = b64.indexOf(data.charAt(i++));\n h2 = b64.indexOf(data.charAt(i++));\n h3 = b64.indexOf(data.charAt(i++));\n h4 = b64.indexOf(data.charAt(i++));\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\n o1 = bits >> 16 & 0xff;\n o2 = bits >> 8 & 0xff;\n o3 = bits & 0xff;\n if (h3 == 64) {\n tmp_arr[ac++] = String.fromCharCode(o1);\n } else if (h4 == 64) {\n tmp_arr[ac++] = String.fromCharCode(o1, o2);\n } else {\n tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);\n }\n } while (i < data.length);\n dec = tmp_arr.join('');\n return dec.replace(/\\0+$/, '');\n }", "function getBase64(file) {\n var reader = new FileReader();\n var algo = '';\n reader.readAsDataURL(file);\n reader.onloadend = function () {\n algo = reader.result;\n };\n}", "function encoderBase64() {\n return {\n write: encodeBase64Write,\n end: encodeBase64End,\n\n prevStr: '',\n };\n}", "function rawToBase64(raw) {\n var res = '';\n for (var i = 0; i < raw.length; i++) {\n res += intToString(raw[i]);\n }\n return btoa(res);\n}", "function rawToBase64(raw) {\n var res = '';\n for (var i = 0; i < raw.length; i++) {\n res += intToString(raw[i]);\n }\n return btoa(res);\n}", "function base64_decode(data) {\r\n var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\r\n var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,\r\n ac = 0,\r\n dec = '',\r\n tmp_arr = [];\r\n\r\n if (!data) {\r\n return data;\r\n }\r\n\r\n data += '';\r\n\r\n do { // unpack four hexets into three octets using index points in b64\r\n h1 = b64.indexOf(data.charAt(i++));\r\n h2 = b64.indexOf(data.charAt(i++));\r\n h3 = b64.indexOf(data.charAt(i++));\r\n h4 = b64.indexOf(data.charAt(i++));\r\n\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n\r\n o1 = bits >> 16 & 0xff;\r\n o2 = bits >> 8 & 0xff;\r\n o3 = bits & 0xff;\r\n\r\n if (h3 == 64) {\r\n tmp_arr[ac++] = String.fromCharCode(o1);\r\n } else if (h4 == 64) {\r\n tmp_arr[ac++] = String.fromCharCode(o1, o2);\r\n } else {\r\n tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);\r\n }\r\n } while (i < data.length);\r\n\r\n dec = tmp_arr.join('');\r\n\r\n return dec.replace(/\\0+$/, '');\r\n}", "toBase64() {\n return btoa(String.fromCharCode.apply(null, this._byteArray));\n }", "function bytesToBase64( bytes, base, bound, digits ) {\n if (bound == null || bound > bytes.length) bound = bytes.length;\n if (!base || base < 0) base = 0;\n\n var str = \"\";\n for (var i=base; i<=bound-3; i+=3) {\n str += _emit3base64(digits, bytes[i], bytes[i+1], bytes[i+2]);\n }\n if (i >= bound) return str;\n return ((bound - i) == 2) ? str + _emit2base64(digits, bytes[i], bytes[i+1])\n : str + _emit1base64(digits, bytes[i]);\n}", "_Uint8ArrayToBase64(bytes, urlCharset) {\r\n if (!bytes) {\r\n bytes = window.crypto.getRandomValues(new Uint8Array(8));\r\n }\r\n\r\n let base64 = '';\r\n let encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n encodings += urlCharset ? '-_' : '+/';\r\n\r\n let byteLength = bytes.byteLength;\r\n let byteRemainder = byteLength % 3;\r\n let mainLength = byteLength - byteRemainder;\r\n\r\n let a, b, c, d;\r\n let chunk = null;\r\n\r\n // Main loop deals with bytes in chunks of 3\r\n for (let i = 0; i < mainLength; i = i + 3) {\r\n // Combine the three bytes into a single integer\r\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\r\n // Use bitmasks to extract 6-bit segments from the triplet\r\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\r\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\r\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\r\n d = chunk & 63; // 63 = 2^6 - 1\r\n // Convert the raw binary segments to the appropriate ASCII encoding\r\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\r\n }\r\n\r\n // Deal with the remaining bytes and padding\r\n if (byteRemainder == 1) {\r\n chunk = bytes[mainLength];\r\n a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2;\r\n // Set the 4 least significant bits to zero\r\n b = (chunk & 3) << 4 // 3 = 2^2 - 1;\r\n base64 += encodings[a] + encodings[b] + '=='\r\n } else if (byteRemainder == 2) {\r\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\r\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\r\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\r\n // Set the 2 least significant bits to zero\r\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\r\n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\r\n }\r\n return base64;\r\n }", "function convertBytesToBase64 ( bytes ) {\n\n var base64 = '',\n bytesLength = bytes.length,\n bytesRemainder = ( bytesLength % 3 );\n\n for (\n var i = 0;\n i < bytesLength;\n i += 3\n ) {\n base64 += Base64Encodings[( bytes[i] >> 2 )];\n base64 += Base64Encodings[( ( ( bytes[i] & 3 ) << 4 ) | ( bytes[( i + 1 )] >> 4 ) )];\n base64 += Base64Encodings[( ( ( bytes[( i + 1 )] & 15 ) << 2 ) | ( bytes[( i + 2 )] >> 6 ) )];\n base64 += Base64Encodings[( bytes[( i + 2 )] & 63 )];\n };\n\n if (\n bytesRemainder == 2\n ) {\n base64 = base64.substring(0, ( base64.length - 1 )) + '=';\n } else if (\n bytesRemainder == 1\n ) {\n base64 = base64.substring(0, ( base64.length - 2 )) + '==';\n };\n\n return(base64);\n\n}", "function encode_base64( what )\n{\n var base64_encodetable = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var result = \"\";\n var len = what.length;\n var x, y;\n var ptr = 0;\n\n while( len-- > 0 )\n {\n x = what.charCodeAt( ptr++ );\n result += base64_encodetable.charAt( ( x >> 2 ) & 63 );\n\n if( len-- <= 0 )\n {\n result += base64_encodetable.charAt( ( x << 4 ) & 63 );\n result += \"==\";\n break;\n }\n\n y = what.charCodeAt( ptr++ );\n result += base64_encodetable.charAt( ( ( x << 4 ) | ( ( y >> 4 ) & 15 ) ) & 63 );\n\n if ( len-- <= 0 )\n {\n result += base64_encodetable.charAt( ( y << 2 ) & 63 );\n result += \"=\";\n break;\n }\n\n x = what.charCodeAt( ptr++ );\n result += base64_encodetable.charAt( ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 63 );\n result += base64_encodetable.charAt( x & 63 );\n\n }\n\n return result;\n}", "function base64Decode(data) {\n data = data.replace(/[^a-z0-9\\+\\/=]/gi, \"\"); // strip none base64 characters\n if (typeof atob == \"function\") return atob(data); //use internal base64 functions if available (gecko only)\n var b64_map =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var byte1, byte2, byte3;\n var ch1, ch2, ch3, ch4;\n var result = new Array(); //array is used instead of string because in most of browsers working with large arrays is faster than working with large strings\n var j = 0;\n while (data.length % 4 != 0) {\n data += \"=\";\n }\n\n for (var i = 0; i < data.length; i += 4) {\n ch1 = b64_map.indexOf(data.charAt(i));\n ch2 = b64_map.indexOf(data.charAt(i + 1));\n ch3 = b64_map.indexOf(data.charAt(i + 2));\n ch4 = b64_map.indexOf(data.charAt(i + 3));\n\n byte1 = (ch1 << 2) | (ch2 >> 4);\n byte2 = ((ch2 & 15) << 4) | (ch3 >> 2);\n byte3 = ((ch3 & 3) << 6) | ch4;\n\n result[j++] = String.fromCharCode(byte1);\n if (ch3 != 64) result[j++] = String.fromCharCode(byte2);\n if (ch4 != 64) result[j++] = String.fromCharCode(byte3);\n }\n\n return result.join(\"\");\n}", "function base64ArrayBuffer(arrayBuffer) {\n var base64 = ''\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\n var bytes = new Uint8Array(arrayBuffer)\n var byteLength = bytes.byteLength\n var byteRemainder = byteLength % 3\n var mainLength = byteLength - byteRemainder\n\n var a, b, c, d\n var chunk\n\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]\n\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18 // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12 // 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6 // 4032 = (2^6 - 1) << 6\n d = chunk & 63 // 63 = 2^6 - 1\n\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]\n }\n\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength]\n\n a = (chunk & 252) >> 2 // 252 = (2^6 - 1) << 2\n\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4 // 3 = 2^2 - 1\n\n base64 += encodings[a] + encodings[b] + '=='\n } else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]\n\n a = (chunk & 64512) >> 10 // 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4 // 1008 = (2^6 - 1) << 4\n\n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2 // 15 = 2^4 - 1\n\n base64 += encodings[a] + encodings[b] + encodings[c] + '='\n }\n\n return base64\n}", "function encodeBase64String(data, w, h) {\n var str = \"\";\n for (var i = 0; i < data.length; i++) {\n str = str.concat(btoa(data[i]));\n }\n return str;\n}", "function fromBase64(base64) {\n return base64\n .replace(/=/g, \"\")\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\");\n}", "function fromBase64(input) {\n var totalByteLength = (input.length / 4) * 3;\n if (input.substr(-2) === \"==\") {\n totalByteLength -= 2;\n }\n else if (input.substr(-1) === \"=\") {\n totalByteLength--;\n }\n var out = new ArrayBuffer(totalByteLength);\n var dataView = new DataView(out);\n for (var i = 0; i < input.length; i += 4) {\n var bits = 0;\n var bitLength = 0;\n for (var j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);\n bitLength += bitsPerLetter;\n }\n else {\n bits >>= bitsPerLetter;\n }\n }\n var chunkOffset = (i / 4) * 3;\n bits >>= bitLength % bitsPerByte;\n var byteLength = Math.floor(bitLength / bitsPerByte);\n for (var k = 0; k < byteLength; k++) {\n var offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);\n }\n }\n return new Uint8Array(out);\n}", "function fromBase64(input) {\n var totalByteLength = (input.length / 4) * 3;\n if (input.substr(-2) === \"==\") {\n totalByteLength -= 2;\n }\n else if (input.substr(-1) === \"=\") {\n totalByteLength--;\n }\n var out = new ArrayBuffer(totalByteLength);\n var dataView = new DataView(out);\n for (var i = 0; i < input.length; i += 4) {\n var bits = 0;\n var bitLength = 0;\n for (var j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);\n bitLength += bitsPerLetter;\n }\n else {\n bits >>= bitsPerLetter;\n }\n }\n var chunkOffset = (i / 4) * 3;\n bits >>= bitLength % bitsPerByte;\n var byteLength = Math.floor(bitLength / bitsPerByte);\n for (var k = 0; k < byteLength; k++) {\n var offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);\n }\n }\n return new Uint8Array(out);\n}", "function fromBase64(input) {\n var totalByteLength = (input.length / 4) * 3;\n if (input.substr(-2) === \"==\") {\n totalByteLength -= 2;\n }\n else if (input.substr(-1) === \"=\") {\n totalByteLength--;\n }\n var out = new ArrayBuffer(totalByteLength);\n var dataView = new DataView(out);\n for (var i = 0; i < input.length; i += 4) {\n var bits = 0;\n var bitLength = 0;\n for (var j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);\n bitLength += bitsPerLetter;\n }\n else {\n bits >>= bitsPerLetter;\n }\n }\n var chunkOffset = (i / 4) * 3;\n bits >>= bitLength % bitsPerByte;\n var byteLength = Math.floor(bitLength / bitsPerByte);\n for (var k = 0; k < byteLength; k++) {\n var offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);\n }\n }\n return new Uint8Array(out);\n}", "function base64ArrayBuffer(arrayBuffer) {\n var base64 = '';\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n var bytes = new Uint8Array(arrayBuffer);\n var byteLength = bytes.byteLength;\n var byteRemainder = byteLength % 3;\n var mainLength = byteLength - byteRemainder;\n var a, b, c, d;\n var chunk;\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12 ;// 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6 ;// 4032 = (2^6 - 1) << 6\n d = chunk & 63 ; // 63 = 2^6 - 1\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n }\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength];\n a = (chunk & 252) >> 2 ;// 252 = (2^6 - 1) << 2\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4 ;// 3 = 2^2 - 1\n base64 += encodings[a] + encodings[b] + '==';\n } else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\n \n a = (chunk & 64512) >> 10 ;// 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n \n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2 ;// 15 = 2^4 - 1\n \n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\n }\n return base64;\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function rawToBase64(raw) {\n var res = '';\n for (var i = 0, len = raw.length; i < len; i++) {\n res += intToString(raw[i]);\n }\n return base64.btoa(res);\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n }", "function base64ArrayBuffer(arrayBuffer) {\n var base64 = '';\n var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n var bytes = new Uint8Array(arrayBuffer);\n var byteLength = bytes.byteLength;\n var byteRemainder = byteLength % 3;\n var mainLength = byteLength - byteRemainder;\n\n var a, b, c, d;\n var chunk;\n\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\n d = chunk & 63; // 63 = 2^6 - 1\n\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n }\n\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength];\n\n a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2\n\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4; // 3 = 2^2 - 1\n\n base64 += encodings[a] + encodings[b] + '==';\n } else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\n\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n\n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\n\n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\n }\n\n return base64;\n}", "function Base64() { \r\n // private property \r\n var _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"; \r\n \r\n // public method for encoding \r\n this.encode = function (input) { \r\n \tif(Ext.isEmpty(input)){\r\n \t\treturn '';\r\n \t}\r\n var output = \"\"; \r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4; \r\n var i = 0; \r\n input = _utf8_encode(input); \r\n while (i < input.length) { \r\n chr1 = input.charCodeAt(i++); \r\n chr2 = input.charCodeAt(i++); \r\n chr3 = input.charCodeAt(i++); \r\n enc1 = chr1 >> 2; \r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); \r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); \r\n enc4 = chr3 & 63; \r\n if (isNaN(chr2)) { \r\n enc3 = enc4 = 64; \r\n } else if (isNaN(chr3)) { \r\n enc4 = 64; \r\n } \r\n output = output + \r\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + \r\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4); \r\n } \r\n return output; \r\n } \r\n \r\n // public method for decoding \r\n this.decode = function (input) {\r\n \tif(Ext.isEmpty(input)){\r\n \t\treturn '';\r\n \t}\r\n var output = \"\"; \r\n var chr1, chr2, chr3; \r\n var enc1, enc2, enc3, enc4; \r\n var i = 0; \r\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\"); \r\n while (i < input.length) { \r\n enc1 = _keyStr.indexOf(input.charAt(i++)); \r\n enc2 = _keyStr.indexOf(input.charAt(i++)); \r\n enc3 = _keyStr.indexOf(input.charAt(i++)); \r\n enc4 = _keyStr.indexOf(input.charAt(i++)); \r\n chr1 = (enc1 << 2) | (enc2 >> 4); \r\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); \r\n chr3 = ((enc3 & 3) << 6) | enc4; \r\n output = output + String.fromCharCode(chr1); \r\n if (enc3 != 64) { \r\n output = output + String.fromCharCode(chr2); \r\n } \r\n if (enc4 != 64) { \r\n output = output + String.fromCharCode(chr3); \r\n } \r\n } \r\n output = _utf8_decode(output); \r\n return output; \r\n } \r\n \r\n // private method for UTF-8 encoding \r\n var _utf8_encode = function (str) { \r\n str = str.replace(/\\r\\n/g,\"\\n\");\r\n var utftext = \"\"; \r\n for (var n = 0; n < str.length; n++) { \r\n var c = str.charCodeAt(n); \r\n if (c < 128) { \r\n utftext += String.fromCharCode(c); \r\n } else if((c > 127) && (c < 2048)) { \r\n utftext += String.fromCharCode((c >> 6) | 192); \r\n utftext += String.fromCharCode((c & 63) | 128); \r\n } else { \r\n utftext += String.fromCharCode((c >> 12) | 224); \r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128); \r\n utftext += String.fromCharCode((c & 63) | 128); \r\n } \r\n \r\n } \r\n return utftext; \r\n } \r\n \r\n // private method for UTF-8 decoding \r\n var _utf8_decode = function (utftext) { \r\n var str = \"\"; \r\n var i = 0, c = 0,c1 = 0,c2 = 0 ,c3; \r\n var c = c1 = c2 = 0; \r\n while ( i < utftext.length ) { \r\n c = utftext.charCodeAt(i); \r\n if (c < 128) { \r\n str += String.fromCharCode(c); \r\n i++; \r\n } else if((c > 191) && (c < 224)) { \r\n c2 = utftext.charCodeAt(i+1); \r\n str += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); \r\n i += 2; \r\n } else { \r\n c2 = utftext.charCodeAt(i+1); \r\n c3 = utftext.charCodeAt(i+2); \r\n str += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); \r\n i += 3; \r\n } \r\n } \r\n return str; \r\n } \r\n}", "function url_base64_decode(str) {\n\t var output = str.replace('-', '+').replace('_', '/');\n\t switch (output.length % 4) {\n\t\tcase 0:\n\t\t break;\n\t\tcase 2:\n\t\t output += '==';\n\t\t break;\n\t\tcase 3:\n\t\t output += '=';\n\t\t break;\n\t\tdefault:\n\t\t throw 'Illegal base64url string!';\n\t }\n\t return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\t}", "function base64ToByteArray( str )\n\t\t{\n\t\t\tvar result = [ ];\n\t\t\tvar digit_num;\n\t\t\tvar cur;\n\t\t\tvar prev;\n\n\t\t\tfor ( var i = 23, l = str.length; i < l; i++ )\n\t\t\t{\n\t\t\t\tcur = reverse_base64_map[ str.charAt( i ) ];\n\t\t\t\tdigit_num = ( i - 23 ) % 4;\n\n\t\t\t\tswitch ( digit_num )\n\t\t\t\t{\n\t\t\t\t\t// case 0: first digit - do nothing, not enough info to work with\n\t\t\t\t\tcase 1: // second digit\n\t\t\t\t\t\tresult.push( prev << 2 | cur >> 4 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2: // third digit\n\t\t\t\t\t\tresult.push( ( prev & 0x0f ) << 4 | cur >> 2 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3: // fourth digit\n\t\t\t\t\t\tresult.push( ( prev & 3 ) << 6 | cur );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tprev = cur;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "function base64ToString (s) {\r\n //the base 64 characters\r\n var BASE64 = new Array ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/');\r\n\t\r\n var decode = new Object();\r\n for (var i=0; i<BASE64.length; i++) {decode[BASE64[i]] = i;} //inverse of the array\r\n decode['='] = 0; //add the equals sign as well\r\n var r = \"\", c1, c2, c3, c4, len=s.length; //define variables\r\n s += \"====\"; //just to make sure it is padded correctly\r\n for (var i=0; i<len; i+=4) { //4 input characters at a time\r\n c1 = s.charAt(i); //the 1st base64 input characther\r\n c2 = s.charAt(i+1);\r\n c3 = s.charAt(i+2);\r\n c4 = s.charAt(i+3);\r\n r += String.fromCharCode (((decode[c1] << 2) & 0xff) | (decode[c2] >> 4)); //reform the string\r\n if (c3 != '=') r += String.fromCharCode (((decode[c2] << 4) & 0xff) | (decode[c3] >> 2));\r\n if (c4 != '=') r += String.fromCharCode (((decode[c3] << 6) & 0xff) | decode[c4]);\r\n }\r\n return r;\r\n}", "function Base64() {\n \n\t// private property\n\t_keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n \n\t// public method for encoding\n\tthis.encode = function (input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = _utf8_encode(input);\n\t\twhile (i < input.length) {\n\t\t\tchr1 = input.charCodeAt(i++);\n\t\t\tchr2 = input.charCodeAt(i++);\n\t\t\tchr3 = input.charCodeAt(i++);\n\t\t\tenc1 = chr1 >> 2;\n\t\t\tenc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n\t\t\tenc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n\t\t\tenc4 = chr3 & 63;\n\t\t\tif (isNaN(chr2)) {\n\t\t\t\tenc3 = enc4 = 64;\n\t\t\t} else if (isNaN(chr3)) {\n\t\t\t\tenc4 = 64;\n\t\t\t}\n\t\t\toutput = output +\n\t\t\t_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n\t\t\t_keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n\t\t}\n\t\treturn output;\n\t}\n \n\t// public method for decoding\n\tthis.decode = function (input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3;\n\t\tvar enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\t\twhile (i < input.length) {\n\t\t\tenc1 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc2 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc3 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc4 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tchr1 = (enc1 << 2) | (enc2 >> 4);\n\t\t\tchr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n\t\t\tchr3 = ((enc3 & 3) << 6) | enc4;\n\t\t\toutput = output + String.fromCharCode(chr1);\n\t\t\tif (enc3 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr2);\n\t\t\t}\n\t\t\tif (enc4 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr3);\n\t\t\t}\n\t\t}\n\t\toutput = _utf8_decode(output);\n\t\treturn output;\n\t}\n \n\t// private method for UTF-8 encoding\n\t_utf8_encode = function (string) {\n\t\tstring = string.replace(/\\r\\n/g,\"\\n\");\n\t\tvar utftext = \"\";\n\t\tfor (var n = 0; n < string.length; n++) {\n\t\t\tvar c = string.charCodeAt(n);\n\t\t\tif (c < 128) {\n\t\t\t\tutftext += String.fromCharCode(c);\n\t\t\t} else if((c > 127) && (c < 2048)) {\n\t\t\t\tutftext += String.fromCharCode((c >> 6) | 192);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t} else {\n\t\t\t\tutftext += String.fromCharCode((c >> 12) | 224);\n\t\t\t\tutftext += String.fromCharCode(((c >> 6) & 63) | 128);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t}\n \n\t\t}\n\t\treturn utftext;\n\t}\n \n\t// private method for UTF-8 decoding\n\t_utf8_decode = function (utftext) {\n\t\tvar string = \"\";\n\t\tvar i = 0;\n\t\tvar c = c1 = c2 = 0;\n\t\twhile ( i < utftext.length ) {\n\t\t\tc = utftext.charCodeAt(i);\n\t\t\tif (c < 128) {\n\t\t\t\tstring += String.fromCharCode(c);\n\t\t\t\ti++;\n\t\t\t} else if((c > 191) && (c < 224)) {\n\t\t\t\tc2 = utftext.charCodeAt(i+1);\n\t\t\t\tstring += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tc2 = utftext.charCodeAt(i+1);\n\t\t\t\tc3 = utftext.charCodeAt(i+2);\n\t\t\t\tstring += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n\t\t\t\ti += 3;\n\t\t\t}\n\t\t}\n\t\treturn string;\n\t}\n}", "function base64_decode(data) {\n var dst = \"\"\n var i, a, b, c, d, z\n\n for (i = 0; i < data.length - 3; i += 4) {\n a = base64_charIndex(data.charAt(i+0))\n b = base64_charIndex(data.charAt(i+1))\n c = base64_charIndex(data.charAt(i+2))\n d = base64_charIndex(data.charAt(i+3))\n\n dst += String.fromCharCode((a << 2) | (b >>> 4))\n if (data.charAt(i+2) != b64pad)\n dst += String.fromCharCode(((b << 4) & 0xF0) | ((c >>> 2) & 0x0F))\n if (data.charAt(i+3) != b64pad)\n dst += String.fromCharCode(((c << 6) & 0xC0) | d)\n }\n\n dst = decodeURIComponent(escape(dst))\n return dst\n }", "function atob(x) { return Buffer.from(x, 'base64').toString('binary'); }", "function Base64() {\n\t// private property\n\t_keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\t// public method for encoding\n\tthis.encode = function (input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = _utf8_encode(input);\n\t\twhile (i < input.length) {\n\t\t\tchr1 = input.charCodeAt(i++);\n\t\t\tchr2 = input.charCodeAt(i++);\n\t\t\tchr3 = input.charCodeAt(i++);\n\t\t\tenc1 = chr1 >> 2;\n\t\t\tenc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n\t\t\tenc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n\t\t\tenc4 = chr3 & 63;\n\t\t\tif (isNaN(chr2)) {\n\t\t\t\tenc3 = enc4 = 64;\n\t\t\t} else if (isNaN(chr3)) {\n\t\t\t\tenc4 = 64;\n\t\t\t}\n\t\t\toutput = output +\n\t\t\t\t_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n\t\t\t\t_keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n\t\t}\n\t\treturn output;\n\t}\n\t// public method for decoding\n\tthis.decode = function (input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3;\n\t\tvar enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\t\twhile (i < input.length) {\n\t\t\tenc1 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc2 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc3 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc4 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tchr1 = (enc1 << 2) | (enc2 >> 4);\n\t\t\tchr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n\t\t\tchr3 = ((enc3 & 3) << 6) | enc4;\n\t\t\toutput = output + String.fromCharCode(chr1);\n\t\t\tif (enc3 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr2);\n\t\t\t}\n\t\t\tif (enc4 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr3);\n\t\t\t}\n\t\t}\n\t\toutput = _utf8_decode(output);\n\t\treturn output;\n\t}\n\t// private method for UTF-8 encoding\n\t_utf8_encode = function (string) {\n\t\tstring = string.replace(/\\r\\n/g, \"\\n\");\n\t\tvar utftext = \"\";\n\t\tfor (var n = 0; n < string.length; n++) {\n\t\t\tvar c = string.charCodeAt(n);\n\t\t\tif (c < 128) {\n\t\t\t\tutftext += String.fromCharCode(c);\n\t\t\t} else if ((c > 127) && (c < 2048)) {\n\t\t\t\tutftext += String.fromCharCode((c >> 6) | 192);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t} else {\n\t\t\t\tutftext += String.fromCharCode((c >> 12) | 224);\n\t\t\t\tutftext += String.fromCharCode(((c >> 6) & 63) | 128);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t}\n\t\t}\n\t\treturn utftext;\n\t}\n\t// private method for UTF-8 decoding\n\t_utf8_decode = function (utftext) {\n\t\tvar string = \"\";\n\t\tvar i = 0;\n\t\tvar c = c1 = c2 = 0;\n\t\twhile (i < utftext.length) {\n\t\t\tc = utftext.charCodeAt(i);\n\t\t\tif (c < 128) {\n\t\t\t\tstring += String.fromCharCode(c);\n\t\t\t\ti++;\n\t\t\t} else if ((c > 191) && (c < 224)) {\n\t\t\t\tc2 = utftext.charCodeAt(i + 1);\n\t\t\t\tstring += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tc2 = utftext.charCodeAt(i + 1);\n\t\t\t\tc3 = utftext.charCodeAt(i + 2);\n\t\t\t\tstring += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n\t\t\t\ti += 3;\n\t\t\t}\n\t\t}\n\t\treturn string;\n\t}\n}", "function ab_to_base64(ab) {\n return base64urlencode(ab_to_str(ab));\n}", "function toBase64(u8arr) {\r\n return btoa(String.fromCharCode.apply(null, u8arr)).\r\n replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=*$/, '');\r\n}", "function toBase64(input) {\n var tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n var output = '';\n var length = input.length;\n var triplet;\n var b64pad = '=';\n\n for (var i = 0; i < length; i += 3) {\n triplet = input.charCodeAt(i) << 16 | (i + 1 < length ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < length ? input.charCodeAt(i + 2) : 0);\n\n for (var j = 0; j < 4; j += 1) {\n if (i * 8 + j * 6 > input.length * 8) {\n output += b64pad;\n } else {\n output += tab.charAt(triplet >>> 6 * (3 - j) & 0x3f);\n }\n }\n }\n\n return output;\n}", "function Base64() {\n\n\t// private property\n\t_keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n\t// public method for encoding\n\tthis.encode = function(input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = _utf8_encode(input);\n\t\twhile (i < input.length) {\n\t\t\tchr1 = input.charCodeAt(i++);\n\t\t\tchr2 = input.charCodeAt(i++);\n\t\t\tchr3 = input.charCodeAt(i++);\n\t\t\tenc1 = chr1 >> 2;\n\t\t\tenc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n\t\t\tenc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n\t\t\tenc4 = chr3 & 63;\n\t\t\tif (isNaN(chr2)) {\n\t\t\t\tenc3 = enc4 = 64;\n\t\t\t} else if (isNaN(chr3)) {\n\t\t\t\tenc4 = 64;\n\t\t\t}\n\t\t\toutput = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2)\n\t\t\t\t\t+ _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n\t\t}\n\t\treturn output;\n\t}\n\n\t// public method for decoding\n\tthis.decode = function(input) {\n\t\tvar output = \"\";\n\t\tvar chr1, chr2, chr3;\n\t\tvar enc1, enc2, enc3, enc4;\n\t\tvar i = 0;\n\t\tinput = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\t\twhile (i < input.length) {\n\t\t\tenc1 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc2 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc3 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tenc4 = _keyStr.indexOf(input.charAt(i++));\n\t\t\tchr1 = (enc1 << 2) | (enc2 >> 4);\n\t\t\tchr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n\t\t\tchr3 = ((enc3 & 3) << 6) | enc4;\n\t\t\toutput = output + String.fromCharCode(chr1);\n\t\t\tif (enc3 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr2);\n\t\t\t}\n\t\t\tif (enc4 != 64) {\n\t\t\t\toutput = output + String.fromCharCode(chr3);\n\t\t\t}\n\t\t}\n\t\toutput = _utf8_decode(output);\n\t\treturn output;\n\t}\n\n\t// private method for UTF-8 encoding\n\t_utf8_encode = function(string) {\n\t\tstring = string.replace(/\\r\\n/g, \"\\n\");\n\t\tvar utftext = \"\";\n\t\tfor ( var n = 0; n < string.length; n++) {\n\t\t\tvar c = string.charCodeAt(n);\n\t\t\tif (c < 128) {\n\t\t\t\tutftext += String.fromCharCode(c);\n\t\t\t} else if ((c > 127) && (c < 2048)) {\n\t\t\t\tutftext += String.fromCharCode((c >> 6) | 192);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t} else {\n\t\t\t\tutftext += String.fromCharCode((c >> 12) | 224);\n\t\t\t\tutftext += String.fromCharCode(((c >> 6) & 63) | 128);\n\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n\t\t\t}\n\n\t\t}\n\t\treturn utftext;\n\t}\n\n\t// private method for UTF-8 decoding\n\t_utf8_decode = function(utftext) {\n\t\tvar string = \"\";\n\t\tvar i = 0;\n\t\tvar c = c1 = c2 = 0;\n\t\twhile (i < utftext.length) {\n\t\t\tc = utftext.charCodeAt(i);\n\t\t\tif (c < 128) {\n\t\t\t\tstring += String.fromCharCode(c);\n\t\t\t\ti++;\n\t\t\t} else if ((c > 191) && (c < 224)) {\n\t\t\t\tc2 = utftext.charCodeAt(i + 1);\n\t\t\t\tstring += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tc2 = utftext.charCodeAt(i + 1);\n\t\t\t\tc3 = utftext.charCodeAt(i + 2);\n\t\t\t\tstring += String.fromCharCode(((c & 15) << 12)\n\t\t\t\t\t\t| ((c2 & 63) << 6) | (c3 & 63));\n\t\t\t\ti += 3;\n\t\t\t}\n\t\t}\n\t\treturn string;\n\t}\n}", "function fromBase64Url(data) {\n var input = data.padRight(data.length + (4 - data.length % 4) % 4, '=')\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n\n return toArrayBuffer(atob(input));\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function convertBase64ToBytes ( base64 ) {\n\n base64 = base64.replace(/[^A-Za-z0-9\\+\\/\\=]+/g, '');\n\n var bytes = [],\n base64Length = base64.length,\n a, b, c, d;\n\n if (\n ( base64Length % 4 ) != 0\n ) {\n return(bytes);\n };\n\n for (\n var i = 0;\n i < base64Length;\n i += 4\n ) {\n\n a = base64Lookup[base64.charCodeAt(i)];\n b = base64Lookup[base64.charCodeAt(( i + 1 ))];\n c = base64Lookup[base64.charCodeAt(( i + 2 ))];\n d = base64Lookup[base64.charCodeAt(( i + 3 ))];\n\n bytes.push(( ( a << 2 ) | ( b >> 4 ) ));\n\n if (\n c != 64\n ) {\n bytes.push(( ( ( b & 15 ) << 4 ) | ( c >> 2 ) ));\n };\n\n if (\n d != 64\n ) {\n bytes.push(( ( ( c & 3 ) << 6 ) | ( d & 63 ) ));\n };\n\n };\n\n return(bytes);\n\n}", "function base16tobase64(h) {\n var i;\n var base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n var c;\n var ret = \"\";\n if(h.length % 2 == 1)\n {\n h = \"0\" + h;\n }\n for (i = 0; i + 3 <= h.length; i += 3)\n {\n c = parseInt(h.substring(i, i + 3), 16);\n ret += base64Chars.charAt(c >> 6) + base64Chars.charAt(c & 63);\n }\n if (i + 1 == h.length)\n {\n c = parseInt(h.substring(i, i + 1), 16);\n ret += base64Chars.charAt(c << 2);\n }\n else if (i + 2 == h.length)\n {\n c = parseInt(h.substring(i, i + 2), 16);\n ret += base64Chars.charAt(c >> 2) + base64Chars.charAt((c & 3) << 4);\n }\n while ((ret.length & 3) > 0) ret += \"=\";\n return ret;\n}", "function base64encode(value) {\n\treturn new Buffer(value).toString('base64');\n}", "base64(pathFile) {\n const fs = require('fs');\n let base64data = null;\n try {\n let buff = fs.readFileSync(pathFile);\n base64data = buff.toString('base64');\n } catch (error) {\n console.log('Image not converted to base 64 :\\n\\n' + error);\n }\n //console.log('Image converted to base 64 is:\\n\\n' + base64data);\n return base64data;\n }", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n}", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output); //polyfill https://github.com/davidchambers/Base64.js\n }", "apply_blob(blob) { return Base64.encode(blob) }", "extractCode(str) {\n //console.log((new Buffer(str, 'base64')))\n let res = {}, length;\n // move the data into a byte array\n let arr = str;\n res.partType = arr[0]; // should be one of the PART_COMBINATIONS values\n length = arr[1]; // length of the first key part\n let c = 2;\n res.part1 = arr.slice(c, c + length);\n c += length;\n length = arr[c]; // length of the second key part\n c += 1;\n res.part2 = arr.slice(c, c + length);\n let keylength = arr[c + length];\n c += length + 1;\n res.pad1 = arr.slice(c, c + keylength);\n c += keylength;\n res.pad2 = arr.slice(c, c + keylength);\n return res;\n }", "function url_base64_decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output);\n }", "base64Pad() {\n return this._b64pad;\n }", "function ToBase64(u8) \n{\n return btoa(String.fromCharCode.apply(null, u8));\n}", "function encode64(input) {\n if(window.btoa){\n return window.btoa(input);\n }\n// base64 strings are 4/3 larger than the original string\n var output = new Array( Math.floor( (input.length + 2) / 3 ) * 4 );\n var chr1, chr2, chr3;\n var enc1, enc2, enc3, enc4;\n var i = 0, p = 0;\n var _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n do {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n \n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n \n if (isNaN(chr2)) {\n \tenc3 = enc4 = 64;\n }\n else if (isNaN(chr3)) {\n \t enc4 = 64;\n }\n\n output[p++] = _keyStr.charAt(enc1);\n output[p++] = _keyStr.charAt(enc2);\n output[p++] = _keyStr.charAt(enc3);\n output[p++] = _keyStr.charAt(enc4);\n } while (i < input.length);\n\n return output.join('');\n}", "function base64Encode(data) {\n if (typeof btoa == \"function\") return btoa(data); //use internal base64 functions if available (gecko only)\n var b64_map =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var byte1, byte2, byte3;\n var ch1, ch2, ch3, ch4;\n var result = new Array(); //array is used instead of string because in most of browsers working with large arrays is faster than working with large strings\n var j = 0;\n for (var i = 0; i < data.length; i += 3) {\n byte1 = data.charCodeAt(i);\n byte2 = data.charCodeAt(i + 1);\n byte3 = data.charCodeAt(i + 2);\n ch1 = byte1 >> 2;\n ch2 = ((byte1 & 3) << 4) | (byte2 >> 4);\n ch3 = ((byte2 & 15) << 2) | (byte3 >> 6);\n ch4 = byte3 & 63;\n\n if (isNaN(byte2)) {\n ch3 = ch4 = 64;\n } else if (isNaN(byte3)) {\n ch4 = 64;\n }\n\n result[j++] =\n b64_map.charAt(ch1) +\n b64_map.charAt(ch2) +\n b64_map.charAt(ch3) +\n b64_map.charAt(ch4);\n }\n\n return result.join(\"\");\n}", "function getBase64(f){\r\n var reader = new FileReader();\r\n reader.readAsDataURL(f);\r\n reader.onload = function () {\r\n console.log(reader.result);\r\n };\r\n }", "function toBase64(input) {\n return util_buffer_from_1.fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString(\"base64\");\n}", "function convertToBase64(input) {\n var result = \"\";\n var charCodes = getExpandedCharCodes(input);\n var i = 0;\n var length = charCodes.length;\n var byte1, byte2, byte3, byte4;\n while (i < length) {\n // Convert every 6-bits in the input 3 character points\n // into a base64 digit\n byte1 = charCodes[i] >> 2;\n byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;\n byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;\n byte4 = charCodes[i + 2] & 63;\n // We are out of characters in the input, set the extra\n // digits to 64 (padding character).\n if (i + 1 >= length) {\n byte3 = byte4 = 64;\n }\n else if (i + 2 >= length) {\n byte4 = 64;\n }\n // Write to the output\n result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);\n i += 3;\n }\n return result;\n }", "static base64Decode(base64Str) {\n return Buffer.from(base64Str, \"base64\").toString(\"utf8\");\n }", "static base64Encode(str, encoding) {\n return Buffer.from(str, encoding).toString(\"base64\");\n }", "function urlBase64Decode(str) {\n var output = str.replace('-', '+').replace('_', '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw 'Illegal base64url string!';\n }\n return window.atob(output);\n }", "function base64encode(input) {\n var output = \"\";\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n\n input = _utf8_encode(input);\n\n while (i < input.length) {\n\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n\n }\n\n return output;\n }", "method_59(param1)\n {\n return new Buffer(param1, 'base64');\n }", "arrayBufferToBase64(buffer) {\n var binary = '';\n var bytes = [].slice.call(new Uint8Array(buffer));\n bytes.forEach((b) => binary += String.fromCharCode(b));\n return binary;\n }", "str2Base64(_str) {\n const _this = this;\n return _this._binb2b64(_this._str2binb(_str));\n }", "function url_base64_decode(str) {\n\tvar output = str.replace(/-/g, '+').replace(/_/g, '/');\n\tswitch (output.length % 4) {\n\t\tcase 0:\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\toutput += '==';\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\toutput += '=';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Illegal base64url string!';\n\t}\n\tvar result = window.atob(output); //polifyll https://github.com/davidchambers/Base64.js\n\ttry {\n\t\treturn decodeURIComponent(escape(result));\n\t} catch (err) {\n\t\treturn result;\n\t}\n}", "get base64String() {\n return exports.base64.encode(this.refString);\n }", "function dateToBase64(date) {\n\t\tvar majorminor = date.split(' ')\n\t\tvar major = majorminor[0].split('-')\n\t\tvar minor = majorminor[1].split(':')\n\t\tvar year = parseInt(major[0]) - 2010\n\t\tvar month = parseInt(major[1])\n\t\tvar day = parseInt(major[2])\n\t\tvar hour = parseInt(minor[0])\n\t\tvar minute = parseInt(minor[1])\n\t\tvar second = parseInt(minor[2])\n\n\t\tyear = BASE64_STRING.substr(year, 1)\n\t\tmonth = BASE64_STRING.substr(month, 1)\n\t\tday = BASE64_STRING.substr(day, 1)\n\t\thour = BASE64_STRING.substr(hour, 1)\n\t\tminute = BASE64_STRING.substr(minute, 1)\n\t\tsecond = BASE64_STRING.substr(second, 1)\n\t\tresult = year + month + day + hour + minute + second\n\n\t\treturn result\n\t}", "function base64_to_ab(a) {\n return str_to_ab(base64urldecode(a));\n}", "decode(str){\n this.init()\n var end = str.length\n while(end>=0 && str.charAt(end-1)=='=') end--\n if(end<2) throw '·Invalid Base64 string at· ' + end\n var m = (end%4)\n if(m==1) throw '·Invalid Base64 string at· ' + (end-1)\n if(m>1) m--\n var n = 3*Math.floor(end/4) + m\n var blob = new Uint8Array(n)\n var control =[[2,4,1],[4,2,1],[6,0,2]]\n var left, right\n var k=0\n var c=0\n for(var i=0; i<n; i++){\n left = this.a2i[str.charAt(k)]\n right = this.a2i[str.charAt(k+1)]\n if(left===undefined || right===undefined) throw '·Invalid Base64 string at· ' + k\n blob[i] = (left << control[c][0]) |( right >> control[c][1])\n k+=control[c][2]\n c = (c+1)%3\n } \n return blob\n }", "function toBase64(base64url) {\n // We this to be a string so we can do .replace on it. If it's\n // already a string, this is a noop.\n base64url = base64url.toString();\n return padString(base64url)\n .replace(/\\-/g, \"+\")\n .replace(/_/g, \"/\");\n}", "getBase64(img, callback) {\n const reader = new FileReader();\n reader.addEventListener('load', () => callback(reader.result));\n reader.readAsDataURL(img);\n }", "function atou(b64) {\n return decodeURIComponent(escape(atob(b64)));\n}", "function text2base64(text) {\n var j = 0;\n var i = 0;\n var base64 = new Array();\n var base64string = \"\";\n var base64key = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var text0, text1, text2;\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// Step thru the input text string 3 characters per loop, creating 4 output characters per loop //\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n for (i=0; i < text.length; )\n {\n text0 = text.charCodeAt(i);\n text1 = text.charCodeAt(i+1);\n text2 = text.charCodeAt(i+2);\n\n base64[j] = base64key.charCodeAt((text0 & 252) >> 2);\n if ((i+1)<text.length) // i+1 is still part of string\n {\n base64[j+1] = base64key.charCodeAt(((text0 & 3) << 4)|((text1 & 240) >> 4));\n if ((i+2)<text.length) // i+2 is still part of string\n {\n base64[j+2] = base64key.charCodeAt(((text1 & 15) << 2) | ((text2 & 192) >> 6));\n base64[j+3] = base64key.charCodeAt((text2 & 63));\n }\n else\n {\n base64[j+2] = base64key.charCodeAt(((text1 & 15) << 2));\n base64[j+3] = 61;\n }\n }\n else\n {\n base64[j+1] = base64key.charCodeAt(((text0 & 3) << 4));\n base64[j+2] = 61;\n base64[j+3] = 61;\n }\n i=i+3;\n j=j+4;\n }\n \n ////////////////////////////////////////////\n // Create output string from byte array //\n ////////////////////////////////////////////\n\n for (i=0; i<base64.length; i++)\n {\n base64string += String.fromCharCode(base64[i]);\n }\n\n return base64string;\n}", "base64Encode(input) {\n return EncodingUtils.base64Encode(input);\n }", "function base64Encode(str)\r\n{\r\n\tvar charBase64 = new Array(\r\n\t\t'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',\r\n\t\t'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',\r\n\t\t'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',\r\n\t\t'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'\r\n\t);\r\n\r\n\tvar out = \"\";\r\n\tvar chr1, chr2, chr3;\r\n\tvar enc1, enc2, enc3, enc4;\r\n\tvar i = 0;\r\n\r\n\tvar len = str.length;\r\n\r\n\tdo\r\n\t{\r\n\t\tchr1 = str.charCodeAt(i++);\r\n\t\tchr2 = str.charCodeAt(i++);\r\n\t\tchr3 = str.charCodeAt(i++);\r\n\r\n\t\t//enc1 = (chr1 & 0xFC) >> 2;\r\n\t\tenc1 = chr1 >> 2;\r\n\t\tenc2 = ((chr1 & 0x03) << 4) | (chr2 >> 4);\r\n\t\tenc3 = ((chr2 & 0x0F) << 2) | (chr3 >> 6);\r\n\t\tenc4 = chr3 & 0x3F;\r\n\r\n\t\tout += charBase64[enc1] + charBase64[enc2];\r\n\r\n\t\tif (isNaN(chr2))\r\n \t\t{\r\n\t\t\tout += '==';\r\n\t\t}\r\n \t\telse if (isNaN(chr3))\r\n \t\t{\r\n\t\t\tout += charBase64[enc3] + '=';\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tout += charBase64[enc3] + charBase64[enc4];\r\n\t\t}\r\n\t}\r\n\twhile (i < len);\r\n\r\n\treturn out;\r\n}", "function toBase64$1(input) {\n return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString(\"base64\");\n}", "function rstr2b64(input) {\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var output = \"\";\n var len = input.length;\n for (var i = 0; i < len; i += 3) {\n var triplet = (input.charCodeAt(i) << 16)\n | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0)\n | (i + 2 < len ? input.charCodeAt(i + 2) : 0);\n for (var j = 0; j < 4; j++) {\n if (i * 8 + j * 6 > input.length * 8) output += b64pad;\n else output += tab.charAt((triplet >>> 6 * (3 - j)) & 0x3F);\n }\n }\n return output;\n}", "function base64_encode(img) {\n // read binary data\n let png = fs.readFileSync(img);\n // convert binary data to base64 encoded string\n return new Buffer.from(png).toString('base64');\n}", "function base64_encode(str) {\n var utf8str = unescape(encodeURIComponent(str))\n return base64_encode_data(utf8str, utf8str.length, b64c)\n }", "function base64_encode(img) {\n // read binary data\n let png = fs.readFileSync(img);\n // convert binary data to base64 encoded string\n return new Buffer.from(png).toString('base64');\n}", "function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}", "function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}", "qb64b() {\n return Buffer.from(this.qb64(), 'utf-8');\n }", "function toBase64() {\n var canvas = document.createElement(\"canvas\");\n var ctx = canvas.getContext(\"2d\");\n var img = document.getElementById(\"preview\");\n ctx.drawImage(img, 10, 10);\n var data = canvas.toDataURL();\n var string = data.replace('data:image/png;base64,', '');\n return string;\n }", "getBase64(file, cb) {\n let reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = function () {\n cb(reader.result)\n };\n reader.onerror = function (error) {\n console.log('Error: ', error);\n };\n }", "function base64Encode_(inputStr)\n {\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var outputStr = \"\";\n var i = 0;\n while (i < inputStr.length)\n {\n //all three \"& 0xff\" added below are there to fix a known bug\n //with bytes returned by xhr.responseText\n var byte1 = inputStr.charCodeAt(i++) & 0xff;\n var byte2 = inputStr.charCodeAt(i++) & 0xff;\n var byte3 = inputStr.charCodeAt(i++) & 0xff;\n var enc1 = byte1 >> 2;\n var enc2 = ((byte1 & 3) << 4) | (byte2 >> 4);\n var enc3, enc4;\n if (isNaN(byte2)) { enc3 = enc4 = 64; } else { enc3 = ((byte2 & 15) << 2) | (byte3 >> 6); if (isNaN(byte3)) { enc4 = 64; } else { enc4 = byte3 & 63; } }\n outputStr += b64.charAt(enc1) + b64.charAt(enc2) + b64.charAt(enc3) + b64.charAt(enc4);\n }\n return outputStr;\n }", "base64EncodedAuthInfo () {\n\t\treturn {\n\t\t\tclientID: this.authInfo.clientID,\n\t\t\tserverToken: this.authInfo.serverToken,\n\t\t\tclientToken: this.authInfo.clientToken,\n\t\t\tencKey: this.authInfo.encKey.toString('base64'),\n\t\t\tmacKey: this.authInfo.macKey.toString('base64')\n\t\t}\n\t}", "function base64ToHex(b64str)\t\t\t\t\t\t\t\t\t// Base64 to Hex\r\n\t{\r\n\t\tfor (var i = 0, bin = atob(b64str.replace(/[ \\r\\n]+$/, \"\")), hex = []; i < bin.length; ++i) {\r\n\t\t\tvar tmp = bin.charCodeAt(i).toString(16);\r\n\t\t\tif (tmp.length === 1) tmp = \"0\" + tmp;\r\n\t\t\thex[hex.length] = tmp;\r\n\t\t}\r\n\t\treturn hex.join(\"\");\r\n\t}", "function rstr2b64(input)\n{\n try { b64pad } catch(e) { b64pad=''; }\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var output = \"\";\n var len = input.length;\n for(var i = 0; i < len; i += 3)\n {\n var triplet = (input.charCodeAt(i) << 16)\n | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)\n | (i + 2 < len ? input.charCodeAt(i+2) : 0);\n for(var j = 0; j < 4; j++)\n {\n if(i * 8 + j * 6 > input.length * 8) output += b64pad;\n else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);\n }\n }\n return output;\n}", "function rstr2b64(input)\n{\n b64pad = b64pad || '';\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var output = \"\";\n var len = input.length;\n for(var i = 0; i < len; i += 3)\n {\n var triplet = (input.charCodeAt(i) << 16)\n | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)\n | (i + 2 < len ? input.charCodeAt(i+2) : 0);\n for(var j = 0; j < 4; j++)\n {\n if(i * 8 + j * 6 > input.length * 8) output += b64pad;\n else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);\n }\n }\n return output;\n}", "function atob(r) { for (var t, a = String(r), c = 0, n = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\", o = \"\"; a.charAt(0 | c) || (n = \"=\", c % 1); o += n.charAt(63 & t >> 8 - c % 1 * 8))t = t << 8 | a.charCodeAt(c += .75); return o }" ]
[ "0.7704935", "0.73232865", "0.7285503", "0.72289795", "0.71821845", "0.7121846", "0.71039695", "0.7087322", "0.7060962", "0.6978246", "0.69750506", "0.69333935", "0.68980336", "0.68980336", "0.6893018", "0.68776006", "0.6873852", "0.6873852", "0.68521667", "0.6835299", "0.6815605", "0.6813565", "0.681203", "0.6793946", "0.67936623", "0.67809427", "0.678039", "0.67782867", "0.67687243", "0.67687243", "0.67687243", "0.6766616", "0.67363125", "0.671255", "0.6708165", "0.6707431", "0.6707042", "0.67024326", "0.67003995", "0.6699874", "0.66882604", "0.66784084", "0.66675943", "0.6664918", "0.66639155", "0.6656727", "0.66404104", "0.6620513", "0.6618162", "0.6592474", "0.65881157", "0.6587896", "0.65802276", "0.6578971", "0.6557221", "0.6557147", "0.65507054", "0.6540846", "0.6529739", "0.6528398", "0.652571", "0.65212154", "0.6514977", "0.6510741", "0.65102285", "0.65095043", "0.6508388", "0.6503669", "0.65010184", "0.6472057", "0.64575666", "0.64535064", "0.6453475", "0.6451968", "0.6442422", "0.643527", "0.6434305", "0.6429564", "0.641176", "0.64093083", "0.6406297", "0.640398", "0.6384247", "0.6377075", "0.6370108", "0.63657457", "0.63592046", "0.6357998", "0.6356476", "0.6347932", "0.6345373", "0.6345373", "0.63279593", "0.63215077", "0.6310301", "0.62993056", "0.62944204", "0.62883043", "0.6276589", "0.62711203", "0.6270722" ]
0.0
-1
Expects r and s to be positive DER integers. The DER format uses the most significant bit as a sign bit (& 0x80). If the significant bit is set AND the integer is positive, a 0x00 is prepended. Examples: 0 => 0x00 1 => 0x01 1 => 0xff 127 => 0x7f 127 => 0x81 128 => 0x0080 128 => 0x80 255 => 0x00ff 255 => 0xff01 16300 => 0x3fac 16300 => 0xc054 62300 => 0x00f35c 62300 => 0xff0ca4
function encode (r, s) { var lenR = r.length var lenS = s.length if (lenR === 0) throw new Error('R length is zero') if (lenS === 0) throw new Error('S length is zero') if (lenR > 33) throw new Error('R length is too long') if (lenS > 33) throw new Error('S length is too long') if (r[0] & 0x80) throw new Error('R value is negative') if (s[0] & 0x80) throw new Error('S value is negative') if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded') if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded') var signature = Buffer.allocUnsafe(6 + lenR + lenS) // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] signature[0] = 0x30 signature[1] = signature.length - 2 signature[2] = 0x02 signature[3] = r.length r.copy(signature, 4) signature[4 + lenR] = 0x02 signature[5 + lenR] = s.length s.copy(signature, 6 + lenR) return signature }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode (r, s) {\n\t var lenR = r.length\n\t var lenS = s.length\n\t if (lenR === 0) throw new Error('R length is zero')\n\t if (lenS === 0) throw new Error('S length is zero')\n\t if (lenR > 33) throw new Error('R length is too long')\n\t if (lenS > 33) throw new Error('S length is too long')\n\t if (r[0] & 0x80) throw new Error('R value is negative')\n\t if (s[0] & 0x80) throw new Error('S value is negative')\n\t if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded')\n\t if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded')\n\n\t var signature = new Buffer(6 + lenR + lenS)\n\n\t // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n\t signature[0] = 0x30\n\t signature[1] = signature.length - 2\n\t signature[2] = 0x02\n\t signature[3] = r.length\n\t r.copy(signature, 4)\n\t signature[4 + lenR] = 0x02\n\t signature[5 + lenR] = s.length\n\t s.copy(signature, 6 + lenR)\n\n\t return signature\n\t}", "function encode (r, s) {\n\t var lenR = r.length\n\t var lenS = s.length\n\t if (lenR === 0) throw new Error('R length is zero')\n\t if (lenS === 0) throw new Error('S length is zero')\n\t if (lenR > 33) throw new Error('R length is too long')\n\t if (lenS > 33) throw new Error('S length is too long')\n\t if (r[0] & 0x80) throw new Error('R value is negative')\n\t if (s[0] & 0x80) throw new Error('S value is negative')\n\t if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded')\n\t if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded')\n\t\n\t var signature = Buffer.allocUnsafe(6 + lenR + lenS)\n\t\n\t // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n\t signature[0] = 0x30\n\t signature[1] = signature.length - 2\n\t signature[2] = 0x02\n\t signature[3] = r.length\n\t r.copy(signature, 4)\n\t signature[4 + lenR] = 0x02\n\t signature[5 + lenR] = s.length\n\t s.copy(signature, 6 + lenR)\n\t\n\t return signature\n\t}", "function encode(r, s) {\n var lenR = r.length;\n var lenS = s.length;\n if (lenR === 0) throw new Error('R length is zero');\n if (lenS === 0) throw new Error('S length is zero');\n if (lenR > 33) throw new Error('R length is too long');\n if (lenS > 33) throw new Error('S length is too long');\n if (r[0] & 0x80) throw new Error('R value is negative');\n if (s[0] & 0x80) throw new Error('S value is negative');\n if (lenR > 1 && r[0] === 0x00 && !(r[1] & 0x80)) throw new Error('R value excessively padded');\n if (lenS > 1 && s[0] === 0x00 && !(s[1] & 0x80)) throw new Error('S value excessively padded');\n\n var signature = Buffer.allocUnsafe(6 + lenR + lenS);\n\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n signature[0] = 0x30;\n signature[1] = signature.length - 2;\n signature[2] = 0x02;\n signature[3] = r.length;\n r.copy(signature, 4);\n signature[4 + lenR] = 0x02;\n signature[5 + lenR] = s.length;\n s.copy(signature, 6 + lenR);\n\n return signature;\n}", "function encode(r,s){var lenR=r.length;var lenS=s.length;if(lenR===0)throw new Error('R length is zero');if(lenS===0)throw new Error('S length is zero');if(lenR>33)throw new Error('R length is too long');if(lenS>33)throw new Error('S length is too long');if(r[0]&0x80)throw new Error('R value is negative');if(s[0]&0x80)throw new Error('S value is negative');if(lenR>1&&r[0]===0x00&&!(r[1]&0x80))throw new Error('R value excessively padded');if(lenS>1&&s[0]===0x00&&!(s[1]&0x80))throw new Error('S value excessively padded');var signature=Buffer.allocUnsafe(6+lenR+lenS);// 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\nsignature[0]=0x30;signature[1]=signature.length-2;signature[2]=0x02;signature[3]=r.length;r.copy(signature,4);signature[4+lenR]=0x02;signature[5+lenR]=s.length;s.copy(signature,6+lenR);return signature;}", "function BIP66_encode (r, s) {\n var lenR = r.length;\n var lenS = s.length;\n var signature = new Buffer(6 + lenR + lenS);\n\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n signature[0] = 0x30;\n signature[1] = signature.length - 2;\n signature[2] = 0x02;\n signature[3] = r.length;\n r.copy(signature, 4);\n signature[4 + lenR] = 0x02;\n signature[5 + lenR] = s.length;\n s.copy(signature, 6 + lenR);\n\n return signature;\n }", "set EAC_R_SIGNED(value) {}", "get EAC_R_SIGNED() {}", "function sign(h, x, s) {\n // v = (x - h) s mod q\n var w, i;\n var h1 = new Array(32);\n var x1 = new Array(32);\n var tmp1 = new Array(64);\n var tmp2 = new Array(64);\n // Don't clobber the arguments, be nice!\n cpy32(h1, h);\n cpy32(x1, x);\n // Reduce modulo group order\n var tmp3 = new Array(32);\n divmod(tmp3, h1, 32, ORDER, 32);\n divmod(tmp3, x1, 32, ORDER, 32);\n // v = x1 - h1\n // If v is negative, add the group order to it to become positive.\n // If v was already positive we don't have to worry about overflow\n // when adding the order because v < ORDER and 2*ORDER < 2^256\n var v = new Array(32);\n mula_small(v, x1, 0, h1, 32, -1);\n mula_small(v, v, 0, ORDER, 32, 1);\n // tmp1 = (x-h)*s mod q\n mula32(tmp1, v, s, 32, 1);\n divmod(tmp2, tmp1, 64, ORDER, 32);\n for (w = 0, i = 0; i < 32; i++)\n w |= v[i] = tmp1[i];\n return w !== 0 ? v : undefined;\n }", "set EAC_RG_SIGNED(value) {}", "function withLeadingZero2Dig(s) {\n return (\"0\" + s).slice(-2);\n }", "function send_bits(s,value,length){if(s.bi_valid>Buf_size-length){s.bi_buf|=value<<s.bi_valid&0xffff;put_short(s,s.bi_buf);s.bi_buf=value>>Buf_size-s.bi_valid;s.bi_valid+=length-Buf_size;}else {s.bi_buf|=value<<s.bi_valid&0xffff;s.bi_valid+=length;}}", "get EAC_RG_SIGNED() {}", "function dec2hex(s) {\n return (s < 15.5 ? '0' : '') + Math.round(s).toString(16);\n}", "signatureExport(obj, sig) {\n const sigR = sig.subarray(0, 32);\n const sigS = sig.subarray(32, 64);\n if (new BN(sigR).cmp(ecparams.n) >= 0) return 1;\n if (new BN(sigS).cmp(ecparams.n) >= 0) return 1;\n const {\n output\n } = obj; // Prepare R\n\n let r = output.subarray(4, 4 + 33);\n r[0] = 0x00;\n r.set(sigR, 1);\n let lenR = 33;\n let posR = 0;\n\n for (; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);\n\n r = r.subarray(posR);\n if (r[0] & 0x80) return 1;\n if (lenR > 1 && r[0] === 0x00 && !(r[1] & 0x80)) return 1; // Prepare S\n\n let s = output.subarray(6 + 33, 6 + 33 + 33);\n s[0] = 0x00;\n s.set(sigS, 1);\n let lenS = 33;\n let posS = 0;\n\n for (; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);\n\n s = s.subarray(posS);\n if (s[0] & 0x80) return 1;\n if (lenS > 1 && s[0] === 0x00 && !(s[1] & 0x80)) return 1; // Set output length for return\n\n obj.outputlen = 6 + lenR + lenS; // Output in specified format\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n\n output[0] = 0x30;\n output[1] = obj.outputlen - 2;\n output[2] = 0x02;\n output[3] = r.length;\n output.set(r, 4);\n output[4 + lenR] = 0x02;\n output[5 + lenR] = s.length;\n output.set(s, 6 + lenR);\n return 0;\n }", "function zweiStellen(s) {\r\n while (s.toString().length < 2) {\r\n\t\ts = \"0\" + s;\r\n }\r\n return s;\r\n}", "signatureImport(output, sig) {\n if (sig.length < 8) return 1;\n if (sig.length > 72) return 1;\n if (sig[0] !== 0x30) return 1;\n if (sig[1] !== sig.length - 2) return 1;\n if (sig[2] !== 0x02) return 1;\n const lenR = sig[3];\n if (lenR === 0) return 1;\n if (5 + lenR >= sig.length) return 1;\n if (sig[4 + lenR] !== 0x02) return 1;\n const lenS = sig[5 + lenR];\n if (lenS === 0) return 1;\n if (6 + lenR + lenS !== sig.length) return 1;\n if (sig[4] & 0x80) return 1;\n if (lenR > 1 && sig[4] === 0x00 && !(sig[5] & 0x80)) return 1;\n if (sig[lenR + 6] & 0x80) return 1;\n if (lenS > 1 && sig[lenR + 6] === 0x00 && !(sig[lenR + 7] & 0x80)) return 1;\n let sigR = sig.subarray(4, 4 + lenR);\n if (sigR.length === 33 && sigR[0] === 0x00) sigR = sigR.subarray(1);\n if (sigR.length > 32) return 1;\n let sigS = sig.subarray(6 + lenR);\n if (sigS.length === 33 && sigS[0] === 0x00) sigS = sigS.slice(1);\n if (sigS.length > 32) throw new Error('S length is too long');\n let r = new BN(sigR);\n if (r.cmp(ecparams.n) >= 0) r = new BN(0);\n let s = new BN(sig.subarray(6 + lenR));\n if (s.cmp(ecparams.n) >= 0) s = new BN(0);\n output.set(r.toArrayLike(Uint8Array, 'be', 32), 0);\n output.set(s.toArrayLike(Uint8Array, 'be', 32), 32);\n return 0;\n }", "signatureExport (obj, sig) {\n const sigR = sig.subarray(0, 32)\n const sigS = sig.subarray(32, 64)\n if (new BN(sigR).cmp(ecparams.n) >= 0) return 1\n if (new BN(sigS).cmp(ecparams.n) >= 0) return 1\n\n const { output } = obj\n\n // Prepare R\n let r = output.subarray(4, 4 + 33)\n r[0] = 0x00\n r.set(sigR, 1)\n\n let lenR = 33\n let posR = 0\n for (; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);\n\n r = r.subarray(posR)\n if (r[0] & 0x80) return 1\n if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) return 1\n\n // Prepare S\n let s = output.subarray(6 + 33, 6 + 33 + 33)\n s[0] = 0x00\n s.set(sigS, 1)\n\n let lenS = 33\n let posS = 0\n for (; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);\n\n s = s.subarray(posS)\n if (s[0] & 0x80) return 1\n if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) return 1\n\n // Set output length for return\n obj.outputlen = 6 + lenR + lenS\n\n // Output in specified format\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n output[0] = 0x30\n output[1] = obj.outputlen - 2\n output[2] = 0x02\n output[3] = r.length\n output.set(r, 4)\n output[4 + lenR] = 0x02\n output[5 + lenR] = s.length\n output.set(s, 6 + lenR)\n\n return 0\n }", "function checksum(s)\n{\n\t// console.log(\"DEBUT CHECK\");\n\ts = s.replace(/^(.(..)*)$/, \"0$1\"); // add a leading zero if needed\n\n\tvar a = s.match(/../g); // split number in groups of two\n\n\tvar C1 = a[0].charAt(0);\n\tvar C2 = a[0].charAt(1);\n\tfor( var i=1; i<a.length;i++ )\n\t{\n\t\tC1 = xor (C1,a[i].charAt(0).toString(16));\n\t\tC2 = xor (C2,a[i].charAt(1).toString(16));\n\t}\n\t// console.log(\"result :\"+C1.toString(16)+C2.toString(16));\n\t// console.log(\"FIN CHECK\");\n\n\treturn ''+C1.toString(16)+C2.toString(16);\n}", "function caml_parse_sign_and_base (s) {\n var i = 0, base = 10, sign = s.get(0) == 45?(i++,-1):1;\n if (s.get(i) == 48)\n switch (s.get(i + 1)) {\n case 120: case 88: base = 16; i += 2; break;\n case 111: case 79: base = 8; i += 2; break;\n case 98: case 66: base = 2; i += 2; break;\n }\n return [i, sign, base];\n}", "function solutionNullify(bits) {\r\n if (bits) {\r\n var alterResult = '';\r\n var bitsLen = bits.length;\r\n for (var i = 0; i < bitsLen; i++) {\r\n var c = bits.charAt(i);\r\n if (c) {\r\n if (c === '1') {\r\n alterResult += c+'00';\r\n } else {\r\n alterResult += c;\r\n }\r\n }\r\n }\r\n return alterResult;\r\n }\r\n}", "function sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n}", "signatureImport (output, sig) {\n if (sig.length < 8) return 1\n if (sig.length > 72) return 1\n if (sig[0] !== 0x30) return 1\n if (sig[1] !== sig.length - 2) return 1\n if (sig[2] !== 0x02) return 1\n\n const lenR = sig[3]\n if (lenR === 0) return 1\n if (5 + lenR >= sig.length) return 1\n if (sig[4 + lenR] !== 0x02) return 1\n\n const lenS = sig[5 + lenR]\n if (lenS === 0) return 1\n if ((6 + lenR + lenS) !== sig.length) return 1\n\n if (sig[4] & 0x80) return 1\n if (lenR > 1 && (sig[4] === 0x00) && !(sig[5] & 0x80)) return 1\n\n if (sig[lenR + 6] & 0x80) return 1\n if (lenS > 1 && (sig[lenR + 6] === 0x00) && !(sig[lenR + 7] & 0x80)) return 1\n\n let sigR = sig.subarray(4, 4 + lenR)\n if (sigR.length === 33 && sigR[0] === 0x00) sigR = sigR.subarray(1)\n if (sigR.length > 32) return 1\n\n let sigS = sig.subarray(6 + lenR)\n if (sigS.length === 33 && sigS[0] === 0x00) sigS = sigS.slice(1)\n if (sigS.length > 32) throw new Error('S length is too long')\n\n let r = new BN(sigR)\n if (r.cmp(ecparams.n) >= 0) r = new BN(0)\n\n let s = new BN(sig.subarray(6 + lenR))\n if (s.cmp(ecparams.n) >= 0) s = new BN(0)\n\n output.set(r.toArrayLike(Uint8Array, 'be', 32), 0)\n output.set(s.toArrayLike(Uint8Array, 'be', 32), 32)\n\n return 0\n }", "function sign(x) {\n x = new this(x);\n return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;\n }", "function encode(bin, s1, s2, pshift) {\n if (s1 === void 0) { s1 = 34; }\n if (s2 === void 0) { s2 = 92; }\n if (pshift === void 0) { pshift = DEFAULT_PSHIFT; }\n var encoded = [];\n bin.forEach(function (b) {\n b += pshift;\n if (b === s1 || b === s2) {\n b += 0x100;\n }\n if (b < 0x80) {\n encoded.push(b);\n }\n else {\n encoded.push((b >>> 6) | 0xc0, (b & 0x3f) | 0x80);\n }\n });\n return new Uint8Array(encoded);\n}", "toSignedNumber() {\n if (this.bits[0] === 0) {\n return this.toNumber();\n }\n\n const minusOneBits = Array.from({length: this.bits.length}, () => 1);\n const minusOne = new Binary(minusOneBits);\n\n const positiveWithCarry = this.add(minusOne).not();\n const positiveNumber = new Binary(positiveWithCarry.bits.slice(1));\n return -positiveNumber.toNumber();\n }", "function sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n }", "function sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n }", "function sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n }", "function encode(s) {\n \t\treqstr(s);\n \t\tvar len = s.length;\n \t\tvar out = [];\n \t\tfor(var i = 0; i < len; i += 3) {\n \t\t\tvar w = x24_r64(c3_x24((s.substring(i,i+3)+\"\\0\\0\").substring(0,3)));\n \t\t\tif(3 > len - i) {\n \t\t\t\tw = (w.substring(0,1 + len - i) + \"==\").substring(0,4);\n \t\t\t}\n \t\t\tout.push(w);\n \t\t}\n \t\treturn out.join('') || '';\n \t}", "function binl(x, len) {\n\t var T, j, i, l,\n\t h0 = 0x67452301,\n\t h1 = 0xefcdab89,\n\t h2 = 0x98badcfe,\n\t h3 = 0x10325476,\n\t h4 = 0xc3d2e1f0,\n\t A1, B1, C1, D1, E1,\n\t A2, B2, C2, D2, E2;\n\t\n\t /* append padding */\n\t x[len >> 5] |= 0x80 << (len % 32);\n\t x[(((len + 64) >>> 9) << 4) + 14] = len;\n\t l = x.length;\n\t\n\t for (i = 0; i < l; i += 16) {\n\t A1 = A2 = h0;\n\t B1 = B2 = h1;\n\t C1 = C2 = h2;\n\t D1 = D2 = h3;\n\t E1 = E2 = h4;\n\t for (j = 0; j <= 79; j += 1) {\n\t T = safe_add(A1, rmd160_f(j, B1, C1, D1));\n\t T = safe_add(T, x[i + rmd160_r1[j]]);\n\t T = safe_add(T, rmd160_K1(j));\n\t T = safe_add(bit_rol(T, rmd160_s1[j]), E1);\n\t A1 = E1;\n\t E1 = D1;\n\t D1 = bit_rol(C1, 10);\n\t C1 = B1;\n\t B1 = T;\n\t T = safe_add(A2, rmd160_f(79 - j, B2, C2, D2));\n\t T = safe_add(T, x[i + rmd160_r2[j]]);\n\t T = safe_add(T, rmd160_K2(j));\n\t T = safe_add(bit_rol(T, rmd160_s2[j]), E2);\n\t A2 = E2;\n\t E2 = D2;\n\t D2 = bit_rol(C2, 10);\n\t C2 = B2;\n\t B2 = T;\n\t }\n\t\n\t T = safe_add(h1, safe_add(C1, D2));\n\t h1 = safe_add(h2, safe_add(D1, E2));\n\t h2 = safe_add(h3, safe_add(E1, A2));\n\t h3 = safe_add(h4, safe_add(A1, B2));\n\t h4 = safe_add(h0, safe_add(B1, C2));\n\t h0 = T;\n\t }\n\t return [h0, h1, h2, h3, h4];\n\t }", "function RansEncPut(R, dst, start, freq, scale_bits) {\n var scale = 1<<scale_bits;\n R = RansEncRenorm(R, dst, freq, scale_bits);\n R = (Math.floor(R / freq) << scale_bits) + (R % freq) + start;\n return R;\n}", "function bnpFromString(s,b) {\n\tvar k;\n\tif(b == 16) k = 4;\n\telse if(b == 8) k = 3;\n\telse if(b == 256) k = 8; // byte array\n\telse if(b == 2) k = 1;\n\telse if(b == 32) k = 5;\n\telse if(b == 4) k = 2;\n\telse { this.fromRadix(s,b); return; }\n\tthis.t = 0;\n\tthis.s = 0;\n\tvar i = s.length, mi = false, sh = 0;\n\twhile(--i >= 0) {\n\t var x = (k==8)?s[i]&0xff:intAt(s,i);\n\t if(x < 0) {\n\t\tif(s.charAt(i) == \"-\") mi = true;\n\t\tcontinue;\n\t }\n\t mi = false;\n\t if(sh == 0)\n\t\tthis[this.t++] = x;\n\t else if(sh+k > this.DB) {\n\t\tthis[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;\n\t\tthis[this.t++] = (x>>(this.DB-sh));\n\t }\n\t else\n\t\tthis[this.t-1] |= x<<sh;\n\t sh += k;\n\t if(sh >= this.DB) sh -= this.DB;\n\t}\n\tif(k == 8 && (s[0]&0x80) != 0) {\n\t this.s = -1;\n\t if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;\n\t}\n\tthis.clamp();\n\tif(mi) BigInteger.ZERO.subTo(this,this);\n }", "function xorsign(){\n var r = h2d(\"0xa84ffd5a5031ed55e439857f1b6705b0ad60b05859456179d316ffd51101022e\");\t//config r\n var s = h2d(\"0x63feb8f431573ce394dc32af6a4cd97d45e804db483902edf7838d3a6cb3d43d\");\t//config s\n\n //0xe59a2207d46696913cd87c716a8d760c1344a0ae335c555397895698582801b2\n //0x59bb6310767c8a010df3e83eacab05d867aee50d90e4ae211aa2cfdfe585b865\n var hexnchc = stringToHex(\"nchcnchcnchcnchcnchcnchcnchcnchc\");\t\t\t\t\t\t//config str\n var nchc = h2d(hexnchc);\n //contract address only have 20 bytes padding to bytes32\n var con = \"\"; //config contract address\n var tmpcon = \"0x000000000000000000000000\"+con.substr(2); var conaddr = h2d(tmpcon);\n var bigs = bignum(s,base=10);\n var bigr = bignum(r,base=10);\n\n var bignchc = bignum(nchc,base=10);\n var bigcon = bignum(conaddr,base=10);\n\n var ansr = bigr.xor(bignchc);\n ansr = ansr.xor(bigcon);\n var resultr = ansr.toString(16);\n resultr = \"0x\"+resultr;\n console.log(resultr);\n\n var anss = bigs.xor(bignchc);\n anss = anss.xor(bigcon);\n var results = anss.toString(16);\n results = \"0x\"+results;\n console.log(results);\n}", "RR_R(r1){\n let lo = r1 & 0x1;\n let hi = r1 >> 1;\n let rt = (lo << (BITS_ADDRESS - 1)) | this.carry_flag;\n\n this.zero_flag = rt === 0;\n this.subtraction_flag = false;\n this.half_carry_flag = false;\n this.carry_flag = lo;\n return rt;\n }", "function bnpFromString(s, b) {\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 256) k = 8; // byte array\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length,\n mi = false,\n sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\") mi = true;\n continue;\n }\n mi = false;\n if (sh == 0)\n this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n } else\n this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n }", "function bnpFromString(s, b) {\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 256) k = 8; // byte array\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length,\n mi = false,\n sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\") mi = true;\n continue;\n }\n mi = false;\n if (sh == 0)\n this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n } else\n this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n }", "function toHex(n){return (n<16?\"0\":\"\")+n.toString(16);}", "function r(e){return 0>e?(-e<<1)+1:(e<<1)+0}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}", "function send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}" ]
[ "0.6717918", "0.6536851", "0.64941883", "0.645361", "0.6337883", "0.58806163", "0.584603", "0.5633133", "0.5474051", "0.5386055", "0.53648365", "0.5350876", "0.52888596", "0.5244996", "0.5232132", "0.52289146", "0.5219259", "0.52143675", "0.5202433", "0.5198171", "0.5176764", "0.5168344", "0.51147366", "0.51125157", "0.51018775", "0.50995207", "0.50995207", "0.50995207", "0.5082324", "0.50586975", "0.5052356", "0.5036476", "0.50319594", "0.5015228", "0.50121796", "0.50121796", "0.5011058", "0.5006225", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914", "0.49964914" ]
0.6521301
10
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prototype;\n\tsubfn.prototype = new r();\n}", "function Base() {}", "function inherts(child , parent) {\n child.prototype = Object.create(parent.prototype);\n child.prototype.constructor = child;\n}", "function Super () {}", "function Super () {}", "function BaseClass() {}", "function BaseClass() {}", "function inherit(o1, o2){\n\t\to1.prototype = new o2(); //Object.create(o2.prototype);//ie 8 falls over on create\n\t\to1.prototype.constructor = o1;\n\t}", "function Derived() {} // private", "function inherits( obj, name ) {\n return ENV.$Class.Inherits( obj, name );\n }", "function superClass(...args) {}", "__previnit(){}", "function inherit(o){\n if(o === null || (typeof o !== 'object' && typeof o !== 'function')){throw TypeError();}\n if(Object.create) {\n return Object.create(o);\n }else {\n function f(){};\n f.prototype = o;\n return new f();\n }\n}", "function Base() {\n}", "function Child() {}", "function Child() {}", "static inherit(p) {\n if (p == null) throw TypeError('p must be a non-null object'); // p must be a non-null object\n if (Object.create) // If Object.create() is defined...\n return Object.create(p); // then just use it.\n let t = typeof p; // Otherwise do some more type checking\n if (t !== \"object\" && t !== \"function\") throw TypeError('p must be object or function');\n function f() {}; // Define a dummy constructor function.\n f.prototype = p; // Set its prototype property to p.\n return new f(); // Use f() to create an \"heir\" of p.\n }", "function Mixin() {}", "function inherit(sub, base) {\n function Inheriter() { }\n Inheriter.prototype = base.prototype;\n sub.prototype = new Inheriter();\n }", "_init() {\n throw new Error('_init not implemented in child class');\n }", "function inheritsFrom (child, parent) {\n child.prototype = Object.create(parent.prototype);\n //can be used for clone\n}", "function inherits(o) {\n function F() {}\n F.prototype = o;\n return new F();\n}", "function Mixin() {\n\t}", "function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) {\n Object.setPrototypeOf\n ? Object.setPrototypeOf(subClass, superClass)\n : subClass.__proto__ = superClass;\n }\n}", "function inheritsFrom(child, parent) {\n child.prototype = Object.create(parent.prototype);\n}", "function PrototypeBasedClass () {\n}", "function inherit(targ, src) {\n var f = function() {\n if (this.__super__ == f) {\n // add __super__ of parent to front of lookup chain\n // so parent class constructor can call its parent using this.__super__\n this.__super__ = src.prototype.__super__;\n // call parent constructor function. this.__super__ now points to parent-of-parent\n src.apply(this, arguments);\n // remove temp __super__, expose targ.prototype.__super__ again\n delete this.__super__;\n }\n };\n\n f.prototype = src.prototype || src; // added || src to allow inheriting from objects as well as functions\n // Extend targ prototype instead of wiping it out --\n // in case inherit() is called after targ.prototype = {stuff}; statement\n targ.prototype = extend$1(new f(), targ.prototype); //\n targ.prototype.constructor = targ;\n targ.prototype.__super__ = f;\n }", "function inherit(childClass, parentClass) {\r\n childClass.prototype = Object.create(parentClass.prototype);\r\n childClass.prototype.constructor = childClass;\r\n}", "constructor () { super() }", "function peg$subclass(child,parent){function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor}", "function inherit(parent, child) {\n const obj = Object.create(child.prototype)\n child.prototype = Object.assign({}, parent.prototype, obj)\n parent.constructor = child\n}", "function peg$subclass(child,parent){function ctor(){this.constructor=child;}ctor.prototype=parent.prototype;child.prototype=new ctor();}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "constructor() { super() }", "function derive(newclass, base) {\n function xxx() {}\n xxx.prototype = base.prototype;\n newclass.prototype = new xxx();\n}", "function inherbit( fn1, fn2 ){\n var prototype = Object.create( fn1.prototype );\n prototype.constructor = fn2;\n fn2.prototype = prototype;\n }", "function $inherits(child, parent) {\n if (child.prototype.__proto__) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n function tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tmp();\n child.prototype.constructor = child;\n }\n}", "function _inherits(SubClass, SuperClass) {\n\tif (typeof SuperClass !== \"function\" && SuperClass !== null) {\n\t\tthrow new TypeError(\"Super expression must either be null or a function, not \" + typeof SuperClass);\n\t}\n\tSubClass.prototype = new SuperClass();\n}", "function _inherits(SubClass, SuperClass) {\n\tif (typeof SuperClass !== \"function\" && SuperClass !== null) {\n\t\tthrow new TypeError(\"Super expression must either be null or a function, not \" + typeof SuperClass);\n\t}\n\tSubClass.prototype = new SuperClass();\n}", "function inherit_protoLess(_class, _base, _extends, original) {\n\t\t\t if (_base != null) {\n\t\t\t var tmp = function () { };\n\t\t\t tmp.prototype = _base.prototype;\n\t\t\t _class.prototype = new tmp();\n\t\t\t _class.prototype.constructor = _class;\n\t\t\t }\n\t\t\t if (_extends != null) {\n\t\t\t arr_each(_extends, function (x) {\n\t\t\t delete x.constructor;\n\t\t\t proto_extend(_class, x);\n\t\t\t });\n\t\t\t }\n\t\t\t proto_extend(_class, original);\n\t\t\t}", "function inherits(childConstructor, parentConstructor) {\n\t var F = function() {}\n\t F.prototype = parentConstructor.prototype\n\t childConstructor.prototype = new F()\n\t childConstructor.prototype.constructor = childConstructor\n\t return childConstructor\n\t}", "async browse() {\n throw new Error('This needs to be overwritten in subclass!');\n }", "constructor(){ super('python') }", "constructor(){ super('python') }", "function e(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function extend(parent, child){\n child.prototype= Object.create(parent.prototype)\n child.prototype.constructor=child\n }", "function classicalInher() {\n // Shape - superclass\n function Shape() {\n this.x = 0;\n this.y = 0;\n }\n\n // superclass method\n Shape.prototype.move = (x, y) => {\n this.x += x;\n this.y += y;\n console.info('Shape moved to ' + x + ', ' + y);\n }\n\n // Rectangle - subclass\n function Rectangle() {\n console.log(this);\n Shape.call(this); // call super constructor\n }\n\n // subclass extends superclass\n Rectangle.prototype = Object.create(Shape.prototype);\n Rectangle.prototype.constructor = Rectangle;\n\n var rect = new Rectangle();\n\n console.log('Is rect an instance of Rectangle?',\n rect instanceof Rectangle); // true\n console.log('Is rect an instance of Shape?',\n rect instanceof Shape); // true\n rect.move(1, 1); // Outputs, 'Shape moved.'\n}", "function inherit (base, from) {\n for (var a in from) {\n if (typeof base[a] === 'undefined') {\n base[a] = from[a];\n }\n }\n }", "function Common() {}", "initialize() {\n // Needs to be implemented by derived classes.\n }", "function Base() {\n }", "function uf(e,t){function i(){this.constructor=e}Af(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}", "function inherit(C, P) {\n function F() {};\n F.prototype = P.prototype;\n C.prototype = new F();\n C.uber = P.prototype;\n C.constructor.prototype = C;\n}", "function inherits(childClass, parentClass) {\n function Surrogate () {}\n Surrogate.prototype = parentClass.prototype;\n childClass.prototype = new Surrogate();\n childClass.prototype.constructor = childClass;\n}", "function UHRBase() {\n\n}", "function UHRBase() {\n\n}", "function inherit(p) {\n\n if (p == null)\n throw TypeError(); // p must be a non-null object\n\n if (Object.create)\n return Object.create(p);\n\n var t = typeof p;\n if (t != \"object\" && t != \"function\")\n throw TypeError();\n\n function f() {} // Define a dummy constructor function.\n f.prototype = p;\n return new f();\n}", "function inherit(p) {\r\n\tif (p == null)\r\n\t\tthrow TypeError(); // p must be a non-null object\r\n\tif (Object.create) // If Object.create() is defined...\r\n\t\treturn Object.create(p); // then just use it.\r\n\tvar t = typeof p; // Otherwise do some more type checking\r\n\tif (t !== \"object\" && t !== \"function\")\r\n\t\tthrow TypeError();\r\n\tfunction f() {\r\n\t}\r\n\t; // Define a dummy constructor function.\r\n\tf.prototype = p; // Set its prototype property to p.\r\n\treturn new f(); // Use f() to create an \"heir\" of p.\r\n}", "function inherit(p) {\n\n if (p == null)\n throw TypeError(); // p must be a non-null object\n if (Object.create)\n return Object.create(p);\n\n var t = typeof p;\n if (t != \"object\" && t != \"function\")\n throw TypeError();\n\n function f() {} // Define a dummy constructor function.\n f.prototype = p;\n return new f();\n}", "function inherit(p) {\n if (p == null) throw TypeError();\n if (Object.create) {\n return Object.create(p);\n }\n let t = typeof p;\n if (t!== \"object\" && t !== \"function\") throw TypeError();\n function f() {};\n f.prototype = p;\n return new f();\n}", "function __extends(e,t){function __(){this.constructor=e}ke(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}", "function Common(){}", "function superclasses(classNames) { }", "constructor () {\n // Run super\n super();\n }", "constructor () {\n // Run super\n super();\n }", "function CNodeBase() {\n\n}", "function ParentWithStatic() { }", "function inherit(original) {\n\t\t\t\tfunction Inherited() {}\n\t\t\t\t\n\t\t\t\tInherited.prototype = original;\n\t\t\t\treturn new Inherited();\n\t\t\t}", "function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}", "function __() { this.constructor = subClass; }", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "configure () {\n // this can be extended in children classes to avoid using the constructor\n }", "function i(e,t){function i(){}i.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new i,e.prototype.constructor=e}", "function inheritsFrom(obj, allegedParent) {\n if (null === obj) { return false; }\n if (void 0 === obj) { return false; }\n if (typeOf(obj) === 'function') { return false; }\n if (typeOf(allegedParent) !== 'object') { return false; }\n if (null === allegedParent) { return false; }\n function F() {}\n F.prototype = allegedParent;\n return Object(obj) instanceof F;\n }", "function inherit(C, P) {\n\tvar F = function () {};\n\tF.prototype = P.prototype;\n\tC.prototype = new F();\n\tC.uber = P.prototype; // KEEP A REFERENCE LINK TO THE PARENT'S PROTOTYPE DIRECTLY\n}", "function inheritPrototype(A, B) {\n var F = function () {};\n F.prototype = B.prototype;\n A.prototype = new F();\n A.prototype.constructor = A;\n }", "function inheritPrototype(childObject, parentObject) {\n var copyOfParent = Object.create(parentObject.prototype); //ECMA5 compatible\n copyOfParent.constructor = childObject;\n childObject.prototype = copyOfParent;\n}", "function a(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "constructor() {\n   if (this.constructor.name === 'relationshipBrowser')\n   throw new Error('relationshipBrowser is abstract!')\n }", "function ParentConstructor() {\n}", "function CNodeBase() {\r\n\r\n}", "function FooBar() {\n // TODO: implement this module\n}", "function u(e){switch(e){case\"class\":case\"enum\":case\"export\":case\"extends\":case\"import\":case\"super\":return!0;default:return!1}}", "function _classCallCheck(n,e){if(!(n instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(n,e){if(!(n instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function BaseElement() {\n }", "constructor() {\n super(...arguments);\n var prototype = Object.getPrototypeOf(this);\n }", "constructor() {\n super(...arguments);\n var prototype = Object.getPrototypeOf(this);\n }", "function i(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}", "function _____SHARED_functions_____(){}", "function o(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Class extends value \"+String(t)+\" is not a constructor or null\");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}", "function Subclass(derivedConstructor, baseConstructor)\n{\n protoConstructor.prototype = baseConstructor.prototype;\n protoConstructor.prototype.constructor = baseConstructor;\n function protoConstructor()\n {\n }\n \n derivedConstructor.prototype = new protoConstructor();\n derivedConstructor.prototype.constructor = derivedConstructor;\n}" ]
[ "0.7398729", "0.7261122", "0.7261122", "0.69321644", "0.6614716", "0.6482389", "0.64594245", "0.6351272", "0.6344033", "0.6344033", "0.6322819", "0.6322819", "0.6123587", "0.61221385", "0.60969925", "0.60739726", "0.6069109", "0.60670304", "0.60664034", "0.60634947", "0.60634947", "0.6059896", "0.6039984", "0.6027665", "0.6020704", "0.6008887", "0.599689", "0.59916216", "0.597612", "0.59643316", "0.59618455", "0.59255844", "0.5873091", "0.5860136", "0.58564687", "0.5842087", "0.58310235", "0.58297706", "0.58297706", "0.58297706", "0.582176", "0.57979", "0.5796227", "0.5766742", "0.57573456", "0.57573456", "0.57528156", "0.574567", "0.57454973", "0.5742419", "0.5742419", "0.57410115", "0.5740687", "0.57382435", "0.5737463", "0.5730208", "0.5719222", "0.5714311", "0.57054234", "0.5702323", "0.57011926", "0.56987137", "0.56987137", "0.5696595", "0.5692051", "0.56831855", "0.56731355", "0.5665342", "0.56595373", "0.5650606", "0.5650313", "0.5650313", "0.5637866", "0.5634848", "0.5632163", "0.56307966", "0.5624748", "0.5615058", "0.5615058", "0.5615058", "0.5611452", "0.5609278", "0.5596968", "0.55956316", "0.5592983", "0.55650496", "0.5561871", "0.55607", "0.55581015", "0.5556633", "0.55535406", "0.5547215", "0.55373114", "0.55373114", "0.5533403", "0.55333114", "0.55333114", "0.5531057", "0.55309755", "0.5530347", "0.5519903" ]
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new Array(n / 2);\n this.sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n this.cosTable[i] = Math.cos(2 * Math.PI * i / n);\n this.sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n /* \n * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.\n */\n this.forward = function(real, imag) {\n\n var n = this.n;\n \n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, this.levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n \n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j+halfsize] * this.cosTable[k] +\n imag[j+halfsize] * this.sinTable[k];\n var tpim = -real[j+halfsize] * this.sinTable[k] +\n imag[j+halfsize] * this.cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n \n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n }\n\n /* \n * Computes the inverse discrete Fourier transform (IDFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. This is a wrapper function. This transform does not perform scaling, so the inverse is not a true inverse.\n */\n this.inverse = function(real, imag) {\n forward(imag, real);\n }\n}", "function realFft(input, output) {\n\n var n = input.length,\n x = output, \n TWO_PI = 2*Math.PI,\n sqrt = Math.sqrt,\n n2, n4, n8, nn, \n t1, t2, t3, t4, \n i1, i2, i3, i4, i5, i6, i7, i8, \n st1, cc1, ss1, cc3, ss3,\n e, \n a,\n rval, ival, mag; \n\n _reverseBinPermute(output, input);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0+1];\n x[i0] += x[i0+1];\n x[i0+1] = st1;\n } \n ix = 2*(id-1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if(n4 !== 1) {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n \n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n \n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n \n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n \n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1; \n x[i3] = t1 - st1;\n \n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4]; \n x[i4] -= x[i3];\n \n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n }\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n \n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4*cc1*(cc1*cc1-0.75);\n ss3 = 4*ss1*(0.75-ss1*ss1);\n \n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n \n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7]*cc1 - x[i3]*ss1; \n t1 = x[i7]*ss1 + x[i3]*cc1;\n \n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8]*cc3 - x[i4]*ss3; \n t3 = x[i8]*ss3 + x[i4]*cc3;\n \n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n \n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6]; \n x[i3] = t2 - x[i6];\n \n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n \n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2]; \n x[i7] = t3 - x[i2];\n \n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1; \n x[i1] += t1;\n \n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5]; \n x[i5] -= t4;\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n \n } while (ix < n);\n }\n }\n \n /* Scale output to have same norm as input. */\n var f = 1 / sqrt(n);\n for (var i = 0; i < n; i++)\n\t x[i] *= f;\n\n}", "function FFT$1(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error('init: radix-2 required');}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT, real-valued\n// only outputs the real valued part\nthis.real_ifft2d=function(re,im){var i2;var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nvar halfn=_n/2;var rowIdx=0;for(var x=0;x<_n;x+=2){//untangle\ni=x;i2=x+1;_tre[0]=re[0+i];_tim[0]=re[0+i2];_tre[_n/2]=re[halfn*_n+i];_tim[_n/2]=re[halfn*_n+i2];for(var x2=1;x2<halfn;x2++){rowIdx=x2*_n;_tre[x2]=re[rowIdx+i]-im[rowIdx+i2];_tre[_n-x2]=re[rowIdx+i]+im[rowIdx+i2];_tim[x2]=im[rowIdx+i]+re[rowIdx+i2];_tim[_n-x2]=re[rowIdx+i2]-im[rowIdx+i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;i2=x+1+y2*_n;re[i]=_tre[y2];re[i2]=_tim[y2];}}};// 2D-FFT, real-valued only\n// ignores the imaginary input\n// see:\n// http://www.inf.fu-berlin.de/lehre/SS12/SP-Par/download/fft1.pdf\n// http://cnx.org/content/m12021/latest/\n// http://images.apple.com/acg/pdf/g4fft.pdf\n// http://www.ti.com/lit/an/spra291/spra291.pdf\nthis.real_fft2d=function(re,im){var i=0,i2=0;// x-axis\nfor(var y=0;y<_n;y+=2){i=y*_n;i2=(y+1)*_n;// tangle\nfor(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=re[x1+i2];}this.fft1d(_tre,_tim);// untangle\nre[0+i]=_tre[0];re[0+i2]=_tim[0];im[0+i]=0;im[0+i2]=0;re[_n/2+i]=_tre[_n/2];re[_n/2+i2]=_tim[_n/2];im[_n/2+i]=0;im[_n/2+i2]=0;for(var x2=1;x2<_n/2;x2++){re[x2+i]=0.5*(_tre[x2]+_tre[_n-x2]);im[x2+i]=0.5*(_tim[x2]-_tim[_n-x2]);re[x2+i2]=0.5*(_tim[x2]+_tim[_n-x2]);im[x2+i2]=-0.5*(_tre[x2]-_tre[_n-x2]);re[_n-x2+i]=re[x2+i];im[_n-x2+i]=-im[x2+i];re[_n-x2+i2]=re[x2+i2];im[_n-x2+i2]=-im[x2+i2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}function _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n);_tim=new Float64Array(_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n);_tim=new Array(_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function FFT(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error(\"init: radix-2 required\");}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables\nfunction _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n*_n);_tim=new Float64Array(_n*_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n*_n);_tim=new Array(_n*_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables", "function ACFFT( NumSamples,\n InverseTransform,\n RealIn, ImagIn, RealOut, ImagOut)\n{\n var NumBits; /* Number of bits needed to store indices */\n var i, j, k, n;\n var BlockSize, BlockEnd;\n\n var angle_numerator = 2.0 * Math.PI;\n var tr, ti; /* temp real, temp imaginary */\n\n if (!IsPowerOfTwo(NumSamples)) {\n console.log(NumSamples + \" is not a power of two\");\n return 1;\n }\n\n if (!gFFTBitTable)\n ACInitFFT();\n\n if (!InverseTransform)\n angle_numerator = -angle_numerator;\n\n NumBits = NumberOfBitsNeeded(NumSamples);\n\n /*\n ** Do simultaneous data copy and bit-reversal ordering into outputs...\n */\n\n for (var i = 0; i < NumSamples; i++) {\n j = FastReverseBits(i, NumBits);\n RealOut[j] = RealIn[i];\n ImagOut[j] = (ImagIn === undefined) ? 0.0 : ImagIn[i];\n }\n\n /*\n ** Do the FFT itself...\n */\n\n BlockEnd = 1;\n for (BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) {\n\n var delta_angle = angle_numerator / BlockSize;\n\n var sm2 = Math.sin(-2 * delta_angle);\n var sm1 = Math.sin(-delta_angle);\n var cm2 = Math.cos(-2 * delta_angle);\n var cm1 = Math.cos(-delta_angle);\n var w = 2 * cm1;\n var ar0, ar1, ar2, ai0, ai1, ai2;\n\n for (var i = 0; i < NumSamples; i += BlockSize) {\n ar2 = cm2;\n ar1 = cm1;\n\n ai2 = sm2;\n ai1 = sm1;\n\n for (var j = i, n = 0; n < BlockEnd; j++, n++) {\n ar0 = w * ar1 - ar2;\n ar2 = ar1;\n ar1 = ar0;\n\n ai0 = w * ai1 - ai2;\n ai2 = ai1;\n ai1 = ai0;\n\n k = j + BlockEnd;\n tr = ar0 * RealOut[k] - ai0 * ImagOut[k];\n ti = ar0 * ImagOut[k] + ai0 * RealOut[k];\n\n RealOut[k] = RealOut[j] - tr;\n ImagOut[k] = ImagOut[j] - ti;\n\n RealOut[j] += tr;\n ImagOut[j] += ti;\n }\n }\n\n BlockEnd = BlockSize;\n }\n\n /*\n ** Need to normalize if inverse transform...\n */\n\n if (InverseTransform) {\n var denom = NumSamples;\n\n for (var i = 0; i < NumSamples; i++) {\n RealOut[i] /= denom;\n ImagOut[i] /= denom;\n }\n }\n}", "function RealFFT( NumSamples, RealIn, RealOut, ImagOut)\n{\n\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = RealIn[2 * i];\n tmpImag[i] = RealIn[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n RealOut[i] = h1r + wr * h2r - wi * h2i;\n ImagOut[i] = h1i + wr * h2i + wi * h2r;\n RealOut[i3] = h1r - wr * h2r + wi * h2i;\n ImagOut[i3] = -h1i + wr * h2i + wi * h2r;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n RealOut[0] = (h1r = RealOut[0]) + ImagOut[0];\n ImagOut[0] = h1r - ImagOut[0];\n}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}", "function fftRadix2(dir, nrows, ncols, buffer, x_ptr, y_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n var nn,m,i,i1,j,k,i2,l,l1,l2\n var c1,c2,t,t1,t2,u1,u2,z,row,a,b,c,d,k1,k2,k3\n \n // Calculate the number of points\n nn = ncols\n m = bits.log2(nn)\n \n for(row=0; row<nrows; ++row) { \n // Do the bit reversal\n i2 = nn >> 1;\n j = 0;\n for(i=0;i<nn-1;i++) {\n if(i < j) {\n t = buffer[x_ptr+i]\n buffer[x_ptr+i] = buffer[x_ptr+j]\n buffer[x_ptr+j] = t\n t = buffer[y_ptr+i]\n buffer[y_ptr+i] = buffer[y_ptr+j]\n buffer[y_ptr+j] = t\n }\n k = i2\n while(k <= j) {\n j -= k\n k >>= 1\n }\n j += k\n }\n \n // Compute the FFT\n c1 = -1.0\n c2 = 0.0\n l2 = 1\n for(l=0;l<m;l++) {\n l1 = l2\n l2 <<= 1\n u1 = 1.0\n u2 = 0.0\n for(j=0;j<l1;j++) {\n for(i=j;i<nn;i+=l2) {\n i1 = i + l1\n a = buffer[x_ptr+i1]\n b = buffer[y_ptr+i1]\n c = buffer[x_ptr+i]\n d = buffer[y_ptr+i]\n k1 = u1 * (a + b)\n k2 = a * (u2 - u1)\n k3 = b * (u1 + u2)\n t1 = k1 - k3\n t2 = k1 + k2\n buffer[x_ptr+i1] = c - t1\n buffer[y_ptr+i1] = d - t2\n buffer[x_ptr+i] += t1\n buffer[y_ptr+i] += t2\n }\n k1 = c1 * (u1 + u2)\n k2 = u1 * (c2 - c1)\n k3 = u2 * (c1 + c2)\n u1 = k1 - k3\n u2 = k1 + k2\n }\n c2 = Math.sqrt((1.0 - c1) / 2.0)\n if(dir < 0) {\n c2 = -c2\n }\n c1 = Math.sqrt((1.0 + c1) / 2.0)\n }\n \n // Scaling for inverse transform\n if(dir < 0) {\n var scale_f = 1.0 / nn\n for(i=0;i<nn;i++) {\n buffer[x_ptr+i] *= scale_f\n buffer[y_ptr+i] *= scale_f\n }\n }\n \n // Advance pointers\n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function processingVideoGenKompFFTOneHz() {\n\tvar TPquant = parseFloat(document.getElementById(\"In1\").value);\n\tvar HPquant = parseFloat(document.getElementById(\"In2\").value);\n\tvar splitFreq = parseFloat(document.getElementById(\"In3\").value);\n\tvar Round =0;\n\tsetFreqQuantMatrix(QuantMatrix,TPquant,HPquant,splitFreq);\n\t// Process chain begin ---// Loop through the pixels, turning them in-RGB-Out\n\t\tGRAYtoRGB(imgArrayIn2, oneHz); \t\n \tsetFFT(swepFFT,imgArrayIn2);\n\t\tFFT1.spec=swepFFT.spec.slice(0,swepFFT.spec.length);\n\t\tswapFFTfor(swepFFT)\n\t\tsetQuantFFT(quantFFT,swepFFT,QuantMatrix,Round);\n\t\t\n\t\tsetInvQuantFFT(iswepFFT,quantFFT,QuantMatrix);\n\t\tiquantFFT.spec=iswepFFT.spec.slice(0,iswepFFT.spec.length);\n\t\tswapFFTback(iswepFFT)\t\t\t\t\n\t\tsetIFFT(imgArrayOut, iswepFFT);\t\n\t\tRGBtoGRAY(iFFTspec,imgArrayOut); \n\t\t\n\t// Process chain end ------------------------------------\n\twriteCanvas(iImageOut);\n\t\t\n\tanalyseError(ErrorLog,iFFTspec, oneHz,255) \n\tLogArray = [\"imgArrayIn2\",\"oneHz\",\"FFT1.spec\",\"swepFFT.spec\",\"QuantMatrix\", \"quantFFT.spec\",\"iquantFFT.spec\",\"iswepFFT.spec\",\"iFFTspec\",\"imgArrayOut\",\"ErrorLog\"];\n}", "forward(buffer) {\n var n = this.bufferSize,\n spectrum = this.spectrum,\n x = this.trans,\n TWO_PI = 2 * Math.PI,\n sqrt = Math.sqrt,\n i = n >>> 1,\n bSi = 2 / n,\n n2, n4, n8, nn,\n t1, t2, t3, t4,\n i1, i2, i3, i4, i5, i6, i7, i8,\n st1, cc1, ss1, cc3, ss3,\n e,\n a,\n rval, ival, mag;\n\n this.reverseBinPermute(x, buffer);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0 + 1];\n x[i0] += x[i0 + 1];\n x[i0 + 1] = st1;\n }\n ix = 2 * (id - 1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while ((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if (n4 !== 1) {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n\n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n\n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n\n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n\n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1;\n x[i3] = t1 - st1;\n\n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n }\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n\n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4 * cc1 * (cc1 * cc1 - 0.75);\n ss3 = 4 * ss1 * (0.75 - ss1 * ss1);\n\n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n\n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7] * cc1 - x[i3] * ss1;\n t1 = x[i7] * ss1 + x[i3] * cc1;\n\n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8] * cc3 - x[i4] * ss3;\n t3 = x[i8] * ss3 + x[i4] * cc3;\n\n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n\n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6];\n x[i3] = t2 - x[i6];\n\n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n\n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2];\n x[i7] = t3 - x[i2];\n\n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1;\n x[i1] += t1;\n\n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5];\n x[i5] -= t4;\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n\n } while (ix < n);\n }\n }\n\n while (--i) {\n rval = x[i];\n ival = x[n - i - 1];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n\n spectrum[0] = bSi * x[0];\n\n return spectrum;\n }", "function fftBluestein(dir, nrows, ncols, buffer, x_ptr, y_ptr, scratch_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n scratch_ptr |= 0\n\n // Initialize tables\n var m = bits.nextPow2(2 * ncols + 1)\n , cos_ptr = scratch_ptr\n , sin_ptr = cos_ptr + ncols\n , xs_ptr = sin_ptr + ncols\n , ys_ptr = xs_ptr + m\n , cft_ptr = ys_ptr + m\n , sft_ptr = cft_ptr + m\n , w = -dir * Math.PI / ncols\n , row, a, b, c, d, k1, k2, k3\n , i\n for(i=0; i<ncols; ++i) {\n a = w * ((i * i) % (ncols * 2))\n c = Math.cos(a)\n d = Math.sin(a)\n buffer[cft_ptr+(m-i)] = buffer[cft_ptr+i] = buffer[cos_ptr+i] = c\n buffer[sft_ptr+(m-i)] = buffer[sft_ptr+i] = buffer[sin_ptr+i] = d\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[cft_ptr+i] = 0.0\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[sft_ptr+i] = 0.0\n }\n\n fftRadix2(1, 1, m, buffer, cft_ptr, sft_ptr)\n \n //Compute scale factor\n if(dir < 0) {\n w = 1.0 / ncols\n } else {\n w = 1.0\n }\n \n //Handle direction\n for(row=0; row<nrows; ++row) {\n \n // Copy row into scratch memory, multiply weights\n for(i=0; i<ncols; ++i) {\n a = buffer[x_ptr+i]\n b = buffer[y_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n //Zero out the rest\n for(i=ncols; i<m; ++i) {\n buffer[xs_ptr+i] = 0.0\n }\n for(i=ncols; i<m; ++i) {\n buffer[ys_ptr+i] = 0.0\n }\n \n // FFT buffer\n fftRadix2(1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Apply multiplier\n for(i=0; i<m; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cft_ptr+i]\n d = buffer[sft_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n \n // Inverse FFT buffer\n fftRadix2(-1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Copy result back into x/y\n for(i=0; i<ncols; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[x_ptr+i] = w * (k1 - k3)\n buffer[y_ptr+i] = w * (k1 + k2)\n }\n \n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function updateFFT() {\n if (analyser == null) return;\n updateAudio(); \n analizerdata = analyser.getFrequencyData();\n for (var p = 0; p < fftSize-fftsizeCute; p++) {\n particles[p].position.y = (bgstartPos.y - 6) +\n (analizerdata[p] / 25)\n\n particlesBase[p].position.y =\n particles[p].position.y - 7.5;\n }\n var freq = analyser.getAverageFrequency();\n var newbloom = (freq / 300);\n if (newbloom > maxBLOOM) newbloom = maxBLOOM;\n //POST.CHANGEBLOON(newbloom);\n LASTBLOON = window.POST.CHANGEBLOON(newbloom);\n ckeckBPM(freq);\n}", "function Poll_FFT_MONOTONE()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n if (gb_use_ntsc_arduino) //63.55 microsegundos\r\n {\r\n //Para belial\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;} //4 770 /21,533203125 = 35,75873015873015873015873015873\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[18] > 230){row = 3;} //* 393,3910306845 /21,533203125 = 18,269043783262040816326530612245\r\n\t }\r\n }\r\n } \r\n \r\n if (spectrum[14] > 230){col = 0;} //2 302,60848514192 /21,533203125 = 14\r\n else{ \r\n if (spectrum[62] > 230){col = 1;}\r\n else{ \r\n \t if (spectrum[26] > 230){col = 2;} //# 561,98718669215 /21,533203125 = 26,09863397608896145124716553288\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n \t }\r\n }\r\n } \t \r\n }\r\n else\r\n {\r\n //if (spectrum[31] > 250){row = 0;}\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;}\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[43] > 230){row = 3;}\r\n\t }\r\n }\r\n }\r\n \r\n //if (spectrum[55] > 250){col = 0;}\r\n if (spectrum[56] > 230){col = 0;}\r\n else{\r\n //if (spectrum[61] > 250){col = 1;}\r\n if (spectrum[62] > 230){col = 1;}\r\n else{\r\n //if (spectrum[67] > 250){col = 2;}\r\n\t if (spectrum[68] > 230){col = 2;}\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n\t }\r\n }\r\n } \t \r\n }\r\n\r\n \r\n //let cadLog = '67:'+spectrum[67].toString()+' 68:'+spectrum[68].toString()+' 69:'+spectrum[69].toString();\r\n //let cadLog = '31:'+spectrum[31].toString()+' 32:'+spectrum[32].toString()+' 33:'+spectrum[33].toString();\r\n //let cadLog = '61:'+spectrum[61].toString()+' 62:'+spectrum[62].toString()+' 63:'+spectrum[63].toString();\r\n //console.log (cadLog);\r\n \t\t\r\n if ((row>-1)||(col>-1))\r\n { \r\n gb_fft_dtmf = RowColToMonotone(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf)\r\n {\t \r\n gb_fft_dtmf_antes = gb_fft_dtmf;\t\r\n \r\n\tcad_areaRX += gb_fft_dtmf;\t\r\n\tgb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\tgb_event_new_data_dtmf = true;\r\n\t\r\n\tif (gb_use_fast === true)\r\n\t{ //Si es fast solo recibe un tono \r\n\t gb_fft_dtmf_two_monotone += gb_fft_dtmf;\r\n\t if (gb_fft_dtmf_two_monotone.length > 1)\r\n\t {\t \t \r\n\t gb_buf_rcv_dtmf = '#' + gb_fft_dtmf_two_monotone + '*';\t \r\n\t gb_fft_dtmf_two_monotone = '';\t \r\n\t }\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t contIniAsteriscos = 1;\t\r\n\t}\r\n\telse\r\n\t{\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n\t case '#':\r\n\t gb_buf_rcv_dtmf = '#';\r\n\t gb_begin_sms = true; \r\n\t gb_end_sms = false;\r\n\t //gb_begin_sync_dtmf= true;\t \r\n\t break;\r\n\t case '*':\t \r\n\t contIniAsteriscos ++;\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t break;\r\n\t default:\t \r\n\t contIniAsteriscos = 0;\t \t \r\n\t break;\r\n\t }\r\n\t}\r\n\t\t\r\n gb_forceDraw = true;\r\n }\r\n //playSoundTrack(gb_fft_dtmf);//Reproduce el Track\r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n } \r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function fft(input) {\n var\n n = input.length,\n nHalf,\n even,\n odd,\n output = [],\n wnkMultiplied,\n wnk,\n k,\n r;\n\n if (n === 1) {\n return input;\n }\n\n // even and odd parts\n even = fft(getListHalf(input, 0));\n odd = fft(getListHalf(input, 1));\n\n // combine\n output.length = n;\n nHalf = n / 2;\n for (k = 0; k < nHalf; k++) {\n r = -2 * Math.PI * k / n;\n wnk = getComplexFromRadians(r);\n wnkMultiplied = complexMultiply(wnk, odd[k]);\n output[k] = complexAdd(even[k], wnkMultiplied);\n output[nHalf + k] = complexSubtract(even[k], wnkMultiplied);\n }\n\n return output;\n}", "function Poll_FFT_DTMF()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n if (gb_use_mic_dtmf === false)\r\n {\r\n return;\r\n }\r\n\t \r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n //if (spectrum[31] > 250){row = 0;}\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;}\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[43] > 230){row = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //if (spectrum[55] > 250){col = 0;}\r\n if (spectrum[56] > 230){col = 0;}\r\n else{\r\n //if (spectrum[61] > 250){col = 1;}\r\n if (spectrum[62] > 230){col = 1;} \r\n else{\r\n //if (spectrum[67] > 250){col = 2;}\r\n\tif (spectrum[68] > 230){col = 2;}\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //console.log('55:'+spectrum[55].toString()+' 56:'+spectrum[56].toString()+' 57:'+spectrum[57].toString());\r\n \t\r\n if ((row>-1) && (col>-1))\r\n { \r\n gb_fft_dtmf = RowColToDtmf(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf){\t\r\n gb_fft_dtmf_antes = gb_fft_dtmf;\r\n cad_areaRX += gb_fft_dtmf;\t\r\n\tgb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\tgb_event_new_data_dtmf = true;\r\n\tif (gb_fft_dtmf === '#'){\r\n\t gb_begin_sync_dtmf= true;\r\n }\r\n\r\n if (gb_use_fast === true)\r\n\t{ //Si es fast solo recibe un tono\r\n\t gb_buf_rcv_dtmf = '#' + DTMFStringToDoubleNumber(gb_fft_dtmf) + '*';\t \r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t contIniAsteriscos = 1;\r\n\t}\r\n\telse\r\n\t{\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n \t case '#':\r\n\t gb_buf_rcv_dtmf = '#';\r\n\t gb_begin_sms = true; \r\n\t gb_end_sms = false;\r\n\t //gb_begin_sync_dtmf= true;\t \r\n\t break;\r\n\t case '*':\t \r\n\t contIniAsteriscos ++;\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t break;\r\n\t default:\t \r\n\t contIniAsteriscos = 0;\t \t \r\n\t break;\r\n\t }\t\r\n\t}\r\n\t\r\n\t\r\n gb_forceDraw = true;\r\n } \r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n } \r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function transformRadix2(real, imag) {\n // Initialization\n if (real.length != imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n == 1)\n // Trivial transform\n return;\n var levels = -1;\n for (var i = 0; i < 32; i++) {\n if (1 << i == n)\n levels = i;\n // Equal to log2(n)\n }\n if (levels == -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++,\n k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n if (inreal.length != inimag.length || inreal.length != outreal.length || outreal.length != outimag.length)\n throw \"Mismatched lengths\";\n\n var n = inreal.length;\n var coef = (inverse ? 2 : -2) * Math.PI;\n for (var k = 0; k < n; k++) { // For each output element\n var sumreal = 0;\n var sumimag = 0;\n for (var t = 0; t < n; t++) { // For each input element\n var angle = coef * (t * k % n) / n; // This is more accurate than t * k\n sumreal += inreal[t]*Math.cos(angle) - inimag[t]*Math.sin(angle);\n sumimag += inreal[t]*Math.sin(angle) + inimag[t]*Math.cos(angle);\n }\n outreal[k] = sumreal;\n outimag[k] = sumimag;\n }\n \n \n // compute the average of the intervals of outreal array\n // peak saves the time index of all peaks\n var peak = [0];\n for(i = 1; i < outreal.length-1; i++){\n if(outreal[i] > outreal[i-1] && outreal[i] > outreal[i+1]){\n peak.push(i);\n }\n }\n // interval saves the interval of all values in peak\n var interval = [];\n for(i = 0; i < peak.length-1; i++){\n interval.push(peak[i+1] - peak[i]);\n }\n // compute the mean value in interval array\n var sum = 0;\n for(i = 0; i < interval.length; i++){\n sum += interval[i];\n }\n var mean = Number((sum/interval.length).toFixed(3));\n // the scan rate is the inverse of mean interval\n var scanrate = Number((1000/mean).toFixed(2)); \n document.getElementById(\"scanrate\").innerHTML = \"<br />\" + scanrate + \"Hz\" \n + \"<br />\" + \"It means your keyboard refreshes every \" + mean + \"ms\" \n + \"<br /><br /><br /><br />\" + \"The computing approach is to look in to the pressing time that your keyboard is able to recognize. More data lies around specific time points, the interval of them is right the refreshing period of your keyboard.\";\n }", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = Object(_kernels_Multiply__WEBPACK_IMPORTED_MODULE_6__[\"multiply\"])({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = Object(_kernels_Add__WEBPACK_IMPORTED_MODULE_1__[\"add\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = Object(_kernels_Sub__WEBPACK_IMPORTED_MODULE_10__[\"sub\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function FFTDrawer(canvas, channel) {\n var canvasContext = canvas.getContext('2d');\n var curveColor = 'rgb(255,160,122)';\n var binCount = FFT_SIZE / 2;\n var data = new Float32Array(binCount);\n\n function drawCurve() {\n var width = canvas.width;\n var height = canvas.height;\n var pixelsPerDb = height / 96.0;\n\n canvasContext.clearRect(0, 0, width, height);\n\n /* Get the proper analyzer from the audio graph */\n var analyzer = (channel == 0) ? analyzer_left : analyzer_right;\n if (!analyzer || !get_global('enable_fft')) {\n requestAnimationFrame(drawCurve);\n return;\n }\n\n /* Draw decibel scale. */\n for (var db = -96.0; db <= 0; db += 12) {\n var y = height - (db + 96) * pixelsPerDb;\n canvasContext.strokeStyle = curveColor;\n canvasContext.strokeText(db.toFixed(0) + 'dB', 10, y);\n }\n\n /* Draw FFT */\n analyzer.getFloatFrequencyData(data);\n canvasContext.beginPath();\n canvasContext.lineWidth = 1;\n canvasContext.strokeStyle = curveColor;\n canvasContext.moveTo(0, height);\n\n var frequencyHz = new Float32Array(width);\n for (var i = 0; i < binCount; ++i) {\n var f = i / binCount;\n\n /* Convert to log frequency scale (octaves). */\n var noctaves = 10;\n f = 1 + Math.log(f) / (noctaves * Math.LN2);\n\n /* Draw the magnitude */\n var x = f * width;\n var y = height - (data[i] + 96) * pixelsPerDb;\n\n canvasContext.lineTo(x, y);\n }\n\n canvasContext.stroke();\n requestAnimationFrame(drawCurve);\n }\n\n function init() {\n requestAnimationFrame(drawCurve);\n }\n\n this.init = init;\n}", "function fft(x) {\n return fftComplexDirection(x,false);\n}", "function transformRadix2(real, imag) {\n // Initialization\n var i, j, k;\n if (real.length !== imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n === 1) // Trivial transform\n return;\n var levels = -1;\n for (i = 0; i < 32; i++) {\n if (1 << i === n)\n levels = i; // Equal to log2(n)\n }\n if (levels === -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (i = 0; i < n; i++) {\n j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (i = 0; i < n; i += size) {\n for (j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n\tconst n = inreal.length;\n\tif (n != inimag.length || n != outreal.length || n != outimag.length)\n\t\tthrow new RangeError(\"Mismatched lengths\");\n\t\n\tconst coef = (inverse ? 2 : -2) * Math.PI;\n\tfor (let k = 0; k < n; k++) { // For each output element\n\t\tlet sumreal = 0;\n\t\tlet sumimag = 0;\n\t\tfor (let t = 0; t < n; t++) { // For each input element\n\t\t\tconst angle = coef * (t * k % n) / n; // This is more accurate than t * k\n\t\t\tsumreal += inreal[t] * Math.cos(angle) - inimag[t] * Math.sin(angle);\n\t\t\tsumimag += inreal[t] * Math.sin(angle) + inimag[t] * Math.cos(angle);\n\t\t}\n\t\toutreal[k] = sumreal;\n\t\toutimag[k] = sumimag;\n\t}\n}", "_transform(chunk,encoding,cb) {\n\n const uint8_view = new Uint8Array(chunk, 0, chunk.length);\n var dataView = new DataView(uint8_view.buffer);\n\n let iFloat = Array(this.sz*2);\n let asComplex = Array(this.sz);\n\n\n // for(let i = 0; i < this.sz*2; i+=1) {\n // iFloat[i] = dataView.getFloat64(i*8, true);\n // }\n\n for(let i = 0; i < this.sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);\n let im = dataView.getFloat64((i*8)+8, true);\n\n asComplex[i/2] = mt.complex(re,im);\n\n iFloat[i] = re;\n iFloat[i+1] = im;\n\n // if( i < 16 ) {\n // console.log(re);\n // }\n\n }\n\n let iShort = mutil.IFloatToIShortMulti(iFloat);\n\n if( this.onFrameIShort !== null ) {\n this.onFrameIShort(iShort);\n }\n\n // console.log(\"iFloat length \" + iFloat.length);\n // console.log(iFloat.slice(0,16));\n\n // console.log(\"iShort length \" + iShort.length);\n // console.log(iShort.slice(0,16));\n\n\n this.handleDefaultStream(iFloat,iShort,asComplex);\n this.handleFineSync(iFloat,iShort,asComplex);\n this.handleAllSubcarriers(iFloat,iShort,asComplex);\n this.handleDemodData(iFloat,iShort,asComplex);\n\n\n // for(x of iFloat) {\n // console.log(x);\n // }\n\n\n this.uint.frame_track_counter++;\n cb();\n }", "function PowerSpectrum( NumSamples, In, Out)\n{\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n var RealOut = new Float32Array(Half);\n var ImagOut = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = In[2 * i];\n tmpImag[i] = In[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i, rt, it;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n rt = h1r + wr * h2r - wi * h2i;\n it = h1i + wr * h2i + wi * h2r;\n\n Out[i] = rt * rt + it * it;\n\n rt = h1r - wr * h2r + wi * h2i;\n it = -h1i + wr * h2i + wi * h2r;\n\n Out[i3] = rt * rt + it * it;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n rt = (h1r = RealOut[0]) + ImagOut[0];\n it = h1r - ImagOut[0];\n Out[0] = rt * rt + it * it;\n\n rt = RealOut[Half / 2];\n it = ImagOut[Half / 2];\n Out[Half / 2] = rt * rt + it * it;\n}", "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(z, t1);\r\n t0.mul(t0, t1);\r\n t0.square(t0);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 5; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 20; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 100; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t0.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t0.square(t0);\r\n }\r\n this.mul(t0, z);\r\n }", "function calculateNext(data){\n \n var AM, BM, TAU_M, AH, BH, TAU_H, AJ, BJ, TAU_J, axr1, bxr1, TAU_Xr1,\n axr2, bxr2, TAU_Xr2, Axs, Bxs, TAU_Xs, TAU_R, TAU_S, Ad, Bd, Cd, TAU_D, \n Af, Bf, Cf, TAU_F, Af2, Bf2, Cf2, TAU_F2, temp, temp2, Ak1, Bk1,\n Ek, Ena, Eks, Eca, FCaSS_INF, exptaufcass, kCaSR, k1, k2, dRR,\n CaCSQN, dCaSR, bjsr, cjsr, CaSSBuf, dCaSS, bcss, ccss, CaBuf, dCai, bc, cc,\n dNai, dKi, sOO; \n\n var minft_t, exptaumt_t, hinft_t, exptauht_t, jinft_t, exptaujt_t, xr1inft_t,\n exptauxr1t_t, xr2inft_t, exptauxr2t_t, xsinft_t, exptauxst_t, rinft_t , sinft_t,\n exptaurt_t, exptaust_t, dinft_t, exptaudt_t, finft_t, exptauft_t, f2inft_t, \n exptauf2t_t, inakcoefft_t, ipkcoefft_t, ical1t_t, ical2t_t, inaca1t_t, inaca2t_t,\n ik1coefft_t, fcassinft_t, exptaufcasst_t; \n\n\n sOO = ( cS[iType] === 'epi') ? 8.958e-8 : ( cS[iType] === 'endo' ) ? 8.848e-8 : 1.142e-7; // (cS.itype === 'M')\n \n\n //table setup starts\n AM = 1.0/(1.+ Math.exp((-60.-cS.v)/5.));\n BM = 0.1/(1.+ Math.exp((cS.v+35.)/5.))+0.10/(1.+Math.exp((cS.v-50.)/200.));\n minft_t = 1.0/((1.+Math.exp((-56.86-cS.v)/9.03))*(1.+Math.exp((-56.86-cS.v)/9.03)));\n TAU_M = AM*BM;\n exptaumt_t = Math.exp(-cS.timestep/TAU_M);\n\n hinft_t = 1.0/((1.+Math.exp((cS.v+71.55)/7.43))*(1.+Math.exp((cS.v+71.55)/7.43)));\n \n AH = (cS.v > -40) ? 0. : (0.057*Math.exp(-(cS.v+80.)/6.8));\n BH = (cS.v > -40) ? (0.77/(0.13*(1.+Math.exp(-(cS.v+10.66)/11.1)))) \n : (2.7*Math.exp(0.079*cS.v)+(3.1e5)*Math.exp(0.3485*cS.v));\n TAU_H = 1.0/(AH+BH);\n exptauht_t = Math.exp(-cS.timestep/TAU_H);\n\n AJ = (cS.v > -40) ? 0. : (((-2.5428e4)*Math.exp(0.2444*cS.v)-(6.948e-6)*Math.exp(-0.04391*cS.v))*(cS.v+37.78)/(1.+Math.exp(0.311*(cS.v+79.23))));\n BJ = (cS.v > -40) ? (0.6*Math.exp((0.057)*cS.v)/(1.+Math.exp(-0.1*(cS.v+32.))))\n : (0.02424*Math.exp(-0.01052*cS.v)/(1.+Math.exp(-0.1378*(cS.v+40.14))));\n TAU_J = 1.0/(AJ+BJ);\n exptaujt_t = Math.exp(-cS.timestep/TAU_J);\n\n jinft_t = hinft_t;\n\n xr1inft_t = 1.0/(1.+Math.exp((-26.-cS.v)/7.));\n\n axr1 = 450.0/(1.+Math.exp((-45.-cS.v)/10.));\n bxr1 = 6.0/(1.+Math.exp((cS.v-(-30.))/11.5));\n TAU_Xr1 = axr1*bxr1;\n exptauxr1t_t = Math.exp(-cS.timestep/TAU_Xr1);\n\n\n xr2inft_t = 1.0/(1.+Math.exp((cS.v-(-88.))/24.));\n \n axr2 = 3.0/(1.+Math.exp((-60.-cS.v)/20.));\n bxr2 = 1.12/(1.+Math.exp((cS.v-60.)/20.));\n TAU_Xr2 = axr2*bxr2;\n exptauxr2t_t = Math.exp(-cS.timestep/TAU_Xr2);\n\n xsinft_t = 1.0/(1.+ Math.exp((-5.-cS.v)/14.));\n\n Axs = (1400.0/(Math.sqrt(1.+Math.exp((5.-cS.v)/6.))));\n Bxs = (1.0/(1.+ Math.exp((cS.v-35.)/15.)));\n TAU_Xs = Axs*Bxs+80.;\n exptauxst_t = Math.exp(-cS.timestep/TAU_Xs);\n\n rinft_t = ( cS.itype === 'epi') ? 1.0/(1.+ Math.exp((20.- cS.v)/6.)) \n : ( cS.itype === 'endo' ) ? 1.0/(1.+Math.exp((20.-cS.v)/6.))\n : 1.0/(1.+ Math.exp((20.-cS.v)/6.)) ; // (cS.itype === 'M')\n\n sinft_t = ( cS.itype === 'epi') ? 1.0/(1.+Math.exp((cS.v+20.)/5.))\n : ( cS.itype === 'endo' ) ? 1.0/(1.+ Math.exp((cS.v+28.)/5.))\n : 1.0/(1.+ Math.exp((cS.v+20.)/5.)); // (cS.itype === 'M')\n\n TAU_R = ( cS.itype === 'epi') ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : ( cS.itype === 'endo' ) ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8; // (cS.itype === 'M')\n\n TAU_S = ( cS.itype === 'epi') ? 85.* Math.exp(-(cS.v+45.)*(cS.v+45.)/320.) +5.0/(1.+Math.exp((cS.v-20.)/5.))+3. \n : ( cS.itype === 'endo' ) ? 1000.*Math.exp(-(cS.v+67.)*(cS.v+67.)/1000.)+8.\n : 85.*Math.exp(-(cS.v+45.)*(cS.v+45.)/320.)+5.0/(1.+Math.exp((cS.v-20.)/5.))+3.; // (cS.itype === 'M')\n \n exptaurt_t = Math.exp(-cS.timestep/TAU_R);\n exptaust_t = Math.exp(-cS.timestep/TAU_S);\n \n dinft_t = 1.0/(1.+Math.exp((-8.-cS.v)/7.5));\n \n Ad = 1.4/(1.+Math.exp((-35.-cS.v)/13.))+0.25;\n Bd = 1.4/(1.+Math.exp((cS.v+5.)/5.));\n Cd = 1.0/(1.+Math.exp((50.-cS.v)/20.));\n TAU_D = Ad*Bd+Cd;\n exptaudt_t = Math.exp(-cS.timestep/TAU_D);\n\n finft_t = 1.0/(1.+Math.exp((cS.v+20.)/7.));\n\n Af = 1102.5*Math.exp(-(cS.v+27.)*(cS.v+27.)/225.);\n Bf = 200.0/(1.+Math.exp((13.-cS.v)/10.));\n Cf = (180.0/(1.+Math.exp((cS.v+30.)/10.)))+20.;\n TAU_F = Af+Bf+Cf;\n exptauft_t = Math.exp(-cS.timestep/TAU_F);\n\n f2inft_t = 0.67/(1.+Math.exp((cS.v+35.)/7.))+0.33;\n\n //original code had the following, but paper uses denom of 170**2, not 7**2\n\n Af2 = 600.*Math.exp(-(cS.v+25.)*(cS.v+25.)/49.);\n\n // paper value for Af2 is INCORRECT to match the figure\n //Af2=600.*exp(-(vv+25.)*(vv+25.)/(170.*170.))\n \n Bf2 = 31.0/(1.+Math.exp((25.-cS.v)/10.));\n Cf2 = 16.0/(1.+Math.exp((cS.v+30.)/10.));\n TAU_F2 = Af2+Bf2+Cf2\n exptauf2t_t = Math.exp(-cS.timestep/TAU_F2);\n\n inakcoefft_t = (1.0/(1.+0.1245*Math.exp(-0.1*cS.v*cC.fort)+0.0353*Math.exp(-cS.v*cC.fort)))*cS.knak*(cS.Ko/(cS.Ko+cS.KmK)); \n ipkcoefft_t = cS.GpK/(1.+Math.exp((25.-cS.v)/5.98)); \n temp = Math.exp(2*(cS.v-15)*cC.fort);\n\n if(!(Math.abs(cS.v-15.) < 1e-4)){\n // need implemented\n ical1t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)* (0.25*temp)/(temp-1.);\n ical2t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)*cS.Cao/(temp-1.);\n }\n \n temp = Math.exp((cS.n-1.)*cS.v*cC.fort);\n temp2 = cS.knaca/((cC.KmNai3+cC.Nao3)*(cS.KmCa+cS.Cao)*(1.+cS.ksat*temp));\n inaca1t_t = temp2*Math.exp(cS.n*cS.v*cC.fort)*cS.Cao;\n inaca2t_t = temp2*temp*cC.Nao3*cS.alphanaca; \n\n\n //reversal potentials\n Ek = cC.rtof*(Math.log((cS.Ko/cS.ki)));\n Ena = cC.rtof*(Math.log((cS.Nao/cS.nai)));\n Eks = cC.rtof*(Math.log((cS.Ko+cS.pKNa*cS.Nao)/(cS.ki+cS.pKNa*cS.nai)));\n Eca = 0.5*cC.rtof*(Math.log((cS.Cao/cS.cai)));\n \n // need to figure out vmek is (cS.v - Ek) \n Ak1 = 0.1/(1.+Math.exp(0.06*((cS.v - Ek)-200.)));\n Bk1 = (3.*Math.exp(0.0002*((cS.v - Ek)+100.))+Math.exp(0.1*((cS.v - Ek)-10.)))/(1.+Math.exp(-0.5*((cS.v - Ek)))); \n ik1coefft_t = cS.GK1*Ak1/(Ak1+Bk1); \n \n fcassinft_t = 0.6/(1+(cS.cass/0.05)*(cS.cass/0.05))+0.4;\n temp = 80.0/(1+(cS.cass/0.05)*(cS.cass/0.05))+2.;\n exptaufcasst_t = Math.exp(-cS.timestep/temp); \n\n //stimulus\n\n cS.Istim = _s1s2Stimulus(count, settings);\n \n //Compute currents\n\n cS.sm = minft_t - (minft_t-cS.sm)*exptaumt_t;\n cS.sh = hinft_t - (hinft_t-cS.sh)*exptauht_t;\n cS.sj = jinft_t - (jinft_t-cS.sj)*exptaujt_t;\n cS.ina = cS.GNa*cS.sm *cS.sm *cS.sm *cS.sh*cS.sj*(cS.v-Ena); \n\n cS.sxr1 = xr1inft_t-(xr1inft_t - cS.sxr1) * exptauxr1t_t;\n\n \n cS.sxr2 = xr2inft_t-(xr2inft_t - cS.sxr2) * exptauxr2t_t;\n \n cS.ikr = cS.Gkr*cC.Gkrfactor*cS.sxr1*cS.sxr2*(cS.v-Ek); \n \n cS.sxs = xsinft_t-(xsinft_t-cS.sxs)*exptauxst_t;\n\n cS.iks = cS.Gks*cS.sxs*cS.sxs*(cS.v-Eks);\n\n cS.sr = rinft_t-(rinft_t-cS.sr)*exptaurt_t;\n\n cS.ss = sinft_t-(sinft_t-cS.ss)*exptaust_t;\n\n cS.ito = cS.Gto*cS.sr*cS.ss*(cS.v-Ek);\n\n cS.sd = dinft_t-(dinft_t-cS.sd)*exptaudt_t;\n\n cS.sf = finft_t-(finft_t-cS.sf)*exptauft_t;\n\n cS.sf2 = f2inft_t-(f2inft_t-cS.sf2)*exptauf2t_t; \n\n FCaSS_INF = (cS.cass > cS.casshi) ? 0.4 : fcassinft_t ;\n\n exptaufcass = (cS.cass > cS.casshi) ? cC.exptaufcassinf : exptaufcasst_t;\n\n cS.sfcass = FCaSS_INF-(FCaSS_INF- cS.sfcass)*exptaufcass;\n\n cS.ical = cS.sd*cS.sf*cS.sf2*cS.sfcass*(ical1t_t* cS.cass - ical2t_t);\n\n cS.ik1 = ik1coefft_t*(cS.v-Ek);\n\n cS.ipk = ipkcoefft_t*(cS.v-Ek);\n\n cS.inaca = inaca1t_t*cS.nai*cS.nai*cS.nai-inaca2t_t*cS.cai;\n\n cS.inak = inakcoefft_t*(cS.nai/(cS.nai+cS.KmNa));\n\n cS.ipca = cS.GpCa*cS.cai/(cS.KpCa+cS.cai);\n\n cS.ibna = cS.GbNa*(cS.v-Ena);\n\n cS.ibca = cS.GbCa*(cS.v-Eca);\n\n //total current\n cS.sItot = cS.ikr+ cS.iks+ cS.ik1+ cS.ito+ cS.ina+ cS.ibna+ cS.ical+ cS.ibca+ cS.inak+ cS.inaca+ cS.ipca+ cS.ipk+ cS.Istim;\n\n //console.log(cS.ikr, cS.iks, cS.ik1, cS.ito, cS.ina, cS.ibna, cS.ical, cS.ibca, cS.inak, cS.inaca, cS.ipca, cS.ipk, cS.Istim);\n\n //update concentrations\n\n kCaSR = cS.maxsr-((cS.maxsr-cS.minsr)/(1+(cS.EC/cS.casr*(cS.EC/cS.casr))));\n k1 = cS.k1prime/kCaSR;\n k2 = cS.k2prime*kCaSR;\n dRR = cS.k4*(1.-cS.srr)-k2*cS.cass*cS.srr;\n cS.srr = cS.srr+cS.timestep*dRR;\n sOO = k1*cS.cass*cS.cass*cS.srr/(cS.k3+k1*cS.cass*cS.cass);\n\n //intracellular calcium currents\n\n cS.Irel = cS.Vrel*sOO*(cS.casr- cS.cass);\n cS.Ileak = cS.Vleak*(cS.casr-cS.cai);\n cS.Iup = cS.Vmaxup/(1.+((cS.Kup*cS.Kup)/(cS.cai*cS.cai)));\n cS.Ixfer = cS.Vxfer*(cS.cass - cS.cai);\n\n\n CaCSQN = cS.Bufsr*cS.casr/(cS.casr+cS.Kbufsr);\n dCaSR = cS.timestep*(cS.Iup-cS.Irel-cS.Ileak);\n bjsr = cS.Bufsr-CaCSQN-dCaSR-cS.casr+cS.Kbufsr;\n cjsr = cS.Kbufsr*(CaCSQN+dCaSR+cS.casr);\n cS.casr = (Math.sqrt(bjsr*bjsr+4.*cjsr)-bjsr)/2.;\n\n CaSSBuf = cS.Bufss * cS.cass/(cS.cass+cS.Kbufss);\n dCaSS = cS.timestep * (-cS.Ixfer*(cS.Vc/cS.Vss)+cS.Irel*(cS.Vsr/cS.Vss)+(-cS.ical*cC.inversevssF2*cS.CAPACITANCE)); \n bcss = cS.Bufss - CaSSBuf - dCaSS - cS.cass+cS.Kbufss;\n ccss = cS.Kbufss*(CaSSBuf+dCaSS+cS.cass);\n cS.cass = (Math.sqrt(bcss*bcss+4.*ccss)-bcss)/2.;\n\n CaBuf = cS.Bufc*cS.cai/(cS.cai+cS.Kbufc);\n dCai = cS.timestep *((-(cS.ibca+cS.ipca-2*cS.inaca)*cC.inverseVcF2*cS.CAPACITANCE)-(cS.Iup-cS.Ileak)*(cS.Vsr/cS.Vc)+cS.Ixfer); \n bc = cS.Bufc-CaBuf-dCai-cS.cai+cS.Kbufc;\n cc = cS.Kbufc*(CaBuf+dCai+cS.cai);\n cS.cai = (Math.sqrt(bc*bc+4.*cc)-bc)/2.;\n\n dNai = -(cS.ina+cS.ibna+3.*cS.inak+3.*cS.inaca)*cC.inverseVcF*cS.CAPACITANCE;\n cS.nai = cS.nai+cS.timestep*dNai;\n\n dKi = -(cS.Istim+cS.ik1+cS.ito+cS.ikr+cS.iks-2.*cS.inak+cS.ipk)*cC.inverseVcF*cS.CAPACITANCE; \n cS.ki = cS.ki+cS.timestep*dKi;\n cS.v = cS.v - cS.sItot * cS.timestep ;\n \n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n\n return data; \n }", "function calculateNext(data) {\n \n\t\tvar yinft_t, exptauyt_t, xinft_t, exptauxt_t, ikcoefft_t, rinft_t, exptaurt_t, itoterm1t_t, itoterm2t_t, itoterm3t_t,\n\t\tinacaterm1t_t, inacaterm2t_t, minft_t, exptaumt_t, hinft_t, exptauht_t, dinft_t, exptaudt_t, finft_t, exptauft_t,\n\t\tisicaterm1t_t, isikterm1t_t, isikterm2t_t, pinft_t, exptaupt_t, ik1term1t_t, \n\n\t\tadum, bdum, ena, ek, emh, eca, vmek, yinf, exptauy, ikc, inac, ionc, xinf, exptaux, ikcoeff, ik1term1, rinf, exptaur,\n\t\titoterm1, itoterm2, itoterm3, icac, inacaterm1, inacaterm2, nai3, dum2, dum3, dum4, minf, exptaum, hinf, exptauh, \n\t\tdinf, exptaud, finf, exptauf, tvar, inf, isicaterm1, isikterm1, isikterm2, imk, imna, imca, iion,\n\t\tfactor, derv, pinf, exptaup, iup, itr, irel, dcaup, dcarel, dcai, dna, dk ;\n\n\t\tadum = 0.05 * Math.exp(-0.067 * (cS.v + 42.));\n bdum = (Math.abs(cS.v + 42.) <= 1e-6) ? 2.5 : (cS.v + 42.) / (1.- Math.exp(-0.2 * (cS.v + 42.)));\n cS.tau = adum + bdum;\n yinft_t = adum / cS.tau;\n exptauyt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 0.5 * Math.exp(0.0826 * (cS.v + 50.)) / (1.0 + Math.exp(0.057 * (cS.v + 50.)));\n bdum = 1.3 * Math.exp(-0.06 * (cS.v + 20.)) / (1. + Math.exp(-0.04 * (cS.v + 20.)));\n cS.tau = adum + bdum;\n xinft_t = adum / cS.tau;\n exptauxt_t = Math.exp(-cS.timestep * cS.tau);\n ikcoefft_t = Math.exp(-cS.v * cC.fort);\n adum = 0.033 * Math.exp(-cS.v / 17.);\n bdum = 33. / (1. + Math.exp(-(cS.v + 10.) / 8.));\n cS.tau = adum + bdum;\n rinft_t = adum / cS.tau;\n exptaurt_t = Math.exp(-cS.timestep * cS.tau);\n itoterm1t_t = (Math.abs(cS.v + 10.) <= (10e-6)) ? 5. : (cS.v + 10.) / (1.-Math.exp(-2. * (cS.v + 10.)));\n itoterm2t_t = Math.exp(.02 * cS.v);\n itoterm3t_t = Math.exp(-.02 * cS.v);\n inacaterm1t_t = Math.exp(cS.gamma * cS.v * cC.fort);\n inacaterm2t_t = Math.exp((cS.gamma - 1.) * cS.v * cC.fort);\n adum = (Math.abs(cS.v + 41.) <= 1e-6) ? 2000 : 200. * (cS.v + 41.) / (1.-Math.exp(-0.1 * (cS.v + 41.)));\n bdum = 8000. * Math.exp(-0.056 * (cS.v + 66.));\n cS.tau = adum + bdum;\n minft_t = adum / cS.tau;\n exptaumt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 20. * Math.exp(-0.125 * (cS.v + 75.));\n bdum = 2000. / (1. + 320. * Math.exp(-0.1 * (cS.v + 75.)));\n cS.tau = adum + bdum;\n hinft_t = adum / cS.tau;\n exptauht_t = Math.exp(-cS.timestep * cS.tau);\n if(Math.abs(cS.v + 19.) <= 1e-6){\n adum = 120.;\n bdum = 120.;\n }\n else{\n adum = 30. * (cS.v + 19.) / (1.-Math.exp(-(cS.v + 19.) / 4.));\n bdum = 12. * (cS.v + 19.) / (Math.exp((cS.v + 19.) / 10.)-1.);\n }\n cS.tau = adum + bdum;\n dinft_t = adum / cS.tau;\n exptaudt_t = Math.exp(-cS.timestep * cS.tau);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 25. : 6.25 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 50. / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n finft_t = adum / cS.tau;\n exptauft_t = Math.exp(-cS.timestep * cS.tau);\n isicaterm1t_t = Math.exp(-2. * (cS.v - 50.) * cC.fort);\n isikterm1t_t = (1.- Math.exp(-(cS.v - 50.) * cC.fort));\n isikterm2t_t = Math.exp((50. - cS.v) * cC.fort);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 2.5 : .625 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 5.0 / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n pinft_t = adum / cS.tau;\n exptaupt_t = Math.exp(-cS.timestep * cS.tau);\n\n // compute equilibrium potentials\n\t\t\n\t\tena = cC.rtof * Math.log(cS.nao / cS.nai);\n ek = cC.rtof * Math.log(cS.kc / cS.ki);\n emh = cC.rtof * Math.log((cS.nao + 0.12 * cS.kc) / (cS.nai + 0.12 * cS.ki));\n eca = 0.5 * cC.rtof * Math.log(cS.cao / cS.cai);\n \n vmek = cS.v - ek;\n ik1term1t_t = cS.gk1 * (vmek) / (1. + Math.exp(2. * (vmek + 10.) * cC.fort));\n\t\t\n\t\t// hyperpolarizing-activated current\n yinf = yinft_t;\n exptauy = exptauyt_t;\n cS.y = yinf - (yinf - cS.y) * exptauy;\n\n cS.ifk = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfk * (cS.v - ek);\n cS.ifna = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfna * (cS.v - ena);\n// cS.ifk = 0.0\n// cS.ifna = 0.0\n ikc = cS.ifk;\n inac = cS.ifna;\n ionc = cS.ifk + cS.ifna;\n\n// time-dependent (delayed K + current)\n xinf = xinft_t;\n exptaux = exptauxt_t;\n cS.x = xinf - (xinf - cS.x) * exptaux;\n\n ikcoeff = ikcoefft_t;\n cS.ik = cS.x * cS.ikmax * (cS.ki - cS.kc * ikcoeff) / 140.;\n ikc = ikc + cS.ik;\n ionc = ionc + cS.ik;\n\n// time-independent (background) K + current\n ik1term1 = ik1term1t_t;\n cS.ik1 = (cS.kc / (cS.kc + cS.km1)) * ik1term1;\n ikc = ikc + cS.ik1;\n ionc = ionc + cS.ik1;\n\n\t\t// transient outward current\n rinf = rinft_t;\n exptaur = exptaurt_t;\n cS.r = rinf - (rinf - cS.r) * exptaur;\n\n itoterm1 = itoterm1t_t;\n itoterm2 = itoterm2t_t;\n itoterm3 = itoterm3t_t;\n cS.ito = (cS.r * cS.gto * (0.2 + (cS.kc / (cS.kc + cS.kmt))) * (cS.cai / \n (cS.kact + cS.cai)) * itoterm1) * (cS.ki * itoterm2-cS.kc * itoterm3); // gto = 0.28\n ikc = ikc + cS.ito;\n ionc = ionc + cS.ito;\n\t\t \n// background sodium current\n cS.ibna = cS.gbna * (cS.v - ena);\n inac = inac + cS.ibna;\n ionc = ionc + cS.ibna;\n\n// background calcium current\n cS.ibca = cS.gbca * (cS.v - eca);\n icac = cS.ibca;\n ionc = ionc + cS.ibca;\n\n// na-k pump exchange current\n cS.inak = cS.ipmax * (cS.kc / (cS.kmk + cS.kc)) * (cS.nai / (cS.kmna + cS.nai));\n ikc = ikc - 2. * cS.inak;\n inac = inac + 3. * cS.inak;\n ionc = ionc + cS.inak;\n\n// na-ca pump exchange current\n inacaterm1 = inacaterm1t_t;\n inacaterm2 = inacaterm2t_t;\n nai3 = cS.nai * cS.nai * cS.nai;\n dum2 = nai3 * cS.cao * inacaterm1;\n dum3 = cC.nao3 * (cS.cai) * inacaterm2;\n dum4 = 1. + cS.dnaca * ((cS.cai) * cC.nao3 + cS.cao * nai3);\n cS.inaca = cS.knaca * (dum2 - dum3) / dum4;\n inac = inac + 3 * cS.inaca;\n icac = icac - 2. * cS.inaca;\n ionc = ionc + cS.inaca;\n\n// fast sodium current\n minf = minft_t;\n exptaum = exptaumt_t;\n cS.m = minf - (minf - cS.m) * exptaum;\n\n hinf = hinft_t;\n exptauh = exptauht_t;\n cS.h = hinf - (hinf - cS.h) * exptauh;\n\n cS.ina = cS.m * cS.m * cS.m * cS.h * cS.gna * (cS.v - emh);\n inac = inac + cS.ina;\n ionc = ionc + cS.ina; \n\n// fast second inward current (calcium)\n dinf = dinft_t;\n exptaud = exptaudt_t;\n cS.d = dinf - (dinf - cS.d) * exptaud;\n\n finf = finft_t;\n exptauf = exptauft_t;\n cS.f = finf - (finf - cS.f) * exptauf;\n\n adum = 5.;\n bdum = cS.cai * adum / cS.kmf2;\n tvar = adum + bdum;\n inf = adum / (adum + bdum);\n cS.f2 = inf - (inf - cS.f2) * Math.exp(-cS.timestep * tvar);\n\n dum2 = cS.d * cS.f * cS.f2 * (4. * cS.psi * (cS.v - 50.) * cC.fort);\n isicaterm1 = isicaterm1t_t;\n dum3 = (1. - isicaterm1);\n dum4 = cS.cai * cC.exp100fort - cS.cao * isicaterm1;\n cS.isica = dum2 * dum4 / dum3;\n icac = icac + cS.isica;\n ionc = ionc + cS.isica;\n\n// more fast inward current\n isikterm1 = isikterm1t_t;\n isikterm2 = isikterm2t_t;\n dum3 = isikterm1;\n dum4 = cS.ki * cC.exp50fort - cS.kc * isikterm2;\n cS.isik = dum2 * dum4 / (400. * dum3);\n ikc = ikc + cS.isik;\n ionc = ionc + cS.isik;\n\n// total currents used to update each ion concentration\n imk = ikc;\n imna = inac;\n imca = icac;\n\n// convert from nanoamperes to microampers per square cm\n\n// iion = 0.015 * ionc\n\n// derv = -1000. * iion / cm\n\n imna = cS.ifna + cS.ina + 3. * cS.inaca + 3. * cS.inak + cS.ibna;\n imk = cS.ifk + cS.ik + cS.ik1 + cS.ito + cS.isik - 2. * cS.inak;\n imca = cS.isica - 2. * cS.inaca + cS.ibca;\n iion = imna + imk + imca;\n\n\n// stimulus\n// if(ttim * 1000.0.le.1.0) then\n// if(mod(it,icycle).le.istimdur) then\n// if(ttim * 1000.0.le.1.0.or.\n// & (ttim * 1000.0.gt.500.0.and.ttim * 1000.0.le.501.0)) then\n// ionc = ionc-10000.0\n// endif\n// 1750 works, 1800 does not so use 1750 as diast. thresh, 3500 = 2 * \n // if(mod(ntime,icycle).le.istimdur) then\n factor = _s1s2Stimulus(count,data);\n iion = iion - factor;\n imk = imk - factor;\n \n derv = iion / cS.cm;\n\n \n// change in intracellular sodium \n dna = (-imna / (cC.vi * cS.fcon)) * cS.timestep;\n cS.nai = cS.nai + dna;\n\n// change in extracellular potassium\n dk = (-cS.prate * (cS.kc - cS.kb) + imk / (cC.ve * cS.fcon)) * cS.timestep;\n cS.kc = cS.kc + dk;\n\n// change in intracellular potassium\n dk = (-imk / (cC.vi * cS.fcon)) * cS.timestep;\n cS.ki = cS.ki + dk;\n\t\t\n// intracellular calcium handling\n pinf = pinft_t;\n exptaup = exptaupt_t;\n cS.p = pinf - (pinf - cS.p) * exptaup;\n\n iup = cC.aup * cS.cai * (cS.cabarup - cS.caup);\n itr = cC.atr * cS.p * (cS.caup - cS.carel);\n irel = cC.arel * cS.carel * (((cS.cai) * cS.cai) / ((cS.cai) * cS.cai + cS.kmca * cS.kmca));\n\n dcaup = ((iup - itr) / (2. * cC.vup * cS.fcon)) * cS.timestep;\n cS.caup = cS.caup + dcaup;\n\n dcarel = ((itr - irel) / (2. * cC.vrel * cS.fcon)) * cS.timestep;\n cS.carel = cS.carel + dcarel;\n\n dcai = (-(imca + iup - irel) / (2. * cC.vi * cS.fcon)) * cS.timestep;\n cS.cai = cS.cai + dcai;\n\n// update voltage\n cS.v = cS.v - cS.timestep * derv;\n\t\t\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "function dft_direct (re, im) {\n let N = re.length;\n // is this necessary? should be able to do DFT with any N\n //if (N.toString(2) % 10) return; // check that N is a power of 2\n\n // array containing N evenly spaced points around the unit circle\n let W = discrete_circle(N);\n\n // debugger;\n // initialize imaginary values to zero if not provided\n im = im || re.map( a => 0 );\n\n // sum (x * W) over N points (0 to N-1), for all frequencies k in N\n return re.map( (_, k) =>\n re.map( (_, n) => cpx_mult([re[n], im[n]], W[n * k % N]) )\n .reduce( (a, b) => cpx_add(a, b) ));\n}", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = backend_util.mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = backend_util.complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = complex({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = backend_util.complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = complex({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = complex({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = complex({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = backend_util.exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = complex({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = multiply({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = add({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = sub({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = real({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = real({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = imag({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = imag({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = concat({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = concat({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function doFFT(values) {\n\tvar data = new complex_array.ComplexArray(values.length);\n\tdata.real = new Float32Array(values);\n\tvar frequencies = data.FFT();\n\n\treturn frequencies;\n}", "calculateLoudness(buffer) {\n\n // first call or after resetMemory\n if (this.copybuffer == undefined) {\n // how long should the copybuffer be at least? \n // --> at least maxT should fit in and length shall be an integer fraction of buffer length\n let length = Math.floor(this.sampleRate * this.loudnessprops.maxT / buffer.length + 1) * buffer.length;\n this.copybuffer = new CircularAudioBuffer(context, this.nChannels, length, this.sampleRate);\n }\n\n //accumulate buffer to previous call\n this.copybuffer.concat(buffer);\n\n // must be gt nSamplesPerInterval\n // or: wait at least one interval time T to be able to calculate loudness\n if (this.copybuffer.getLength() < this.nSamplesPerInterval) {\n console.log('buffer too small ... have to eat more data');\n return NaN;\n }\n\n // get array of meansquares from buffer of overlapping intervals\n let meanSquares = this.getBufferMeanSquares(this.copybuffer, this.nSamplesPerInterval, this.nStepsize);\n\n // first stage filter\n this.filterBlocks(meanSquares, this.gamma_a);\n\n // second stage filter\n let gamma_r = 0.;\n for (let chIdx = 0; chIdx < this.nChannels; chIdx++) {\n let mean = 0.;\n for (let idx = 0; idx < meanSquares[chIdx].length; idx++) {\n mean += meanSquares[chIdx][idx];\n }\n mean /= meanSquares[chIdx].length;\n gamma_r += (this.channelWeight[chIdx] * mean);\n }\n gamma_r = -0.691 + 10.0 * Math.log10(gamma_r) - 10.;\n\n this.filterBlocks(meanSquares, gamma_r);\n\n // gated loudness from filtered blocks\n let gatedLoudness = 0.;\n for (let chIdx = 0; chIdx < this.nChannels; chIdx++) {\n let mean = 0.;\n for (let idx = 0; idx < meanSquares[chIdx].length; idx++) {\n mean += meanSquares[chIdx][idx];\n }\n mean /= meanSquares[chIdx].length;\n\n gatedLoudness += (this.channelWeight[chIdx] * mean);\n }\n gatedLoudness = -0.691 + 10.0 * Math.log10(gatedLoudness);\n\n //console.log(this.id, '- gatedLoudness:', gatedLoudness);\n\n return gatedLoudness;\n }", "function yt(t){var S,k,_,A,e,u=Math.floor,I=new Array(64),C=new Array(64),T=new Array(64),F=new Array(64),w=new Array(65535),y=new Array(65535),Q=new Array(64),v=new Array(64),P=[],E=0,q=7,O=new Array(64),B=new Array(64),R=new Array(64),n=new Array(256),j=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],D=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],U=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],N=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function G(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(E|=1<<q),n--,--q<0&&(255==E?(V(255),V(0)):V(E),q=7,E=0)}function V(t){P.push(t)}function Y(t){V(t>>8&255),V(255&t)}function X(t,e,n,r,i){for(var o,a=i[0],s=i[240],h=function(t,e){var n,r,i,o,a,s,h,c,l,u,f=0;for(l=0;l<8;++l){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],h=t[f+6];var d=n+(c=t[f+7]),p=n-c,g=r+h,m=r-h,w=i+s,y=i-s,v=o+a,b=o-a,x=d+v,S=d-v,k=g+w,_=g-w;t[f]=x+k,t[f+4]=x-k;var A=.707106781*(_+S);t[f+2]=S+A,t[f+6]=S-A;var I=.382683433*((x=b+y)-(_=m+p)),C=.5411961*x+I,T=1.306562965*_+I,F=.707106781*(k=y+m),P=p+F,E=p-F;t[f+5]=E+C,t[f+3]=E-C,t[f+1]=P+T,t[f+7]=P-T,f+=8}for(l=f=0;l<8;++l){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],h=t[f+48];var q=n+(c=t[f+56]),O=n-c,B=r+h,R=r-h,j=i+s,D=i-s,M=o+a,U=o-a,N=q+M,z=q-M,L=B+j,H=B-j;t[f]=N+L,t[f+32]=N-L;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var G=.382683433*((N=U+D)-(H=R+O)),V=.5411961*N+G,Y=1.306562965*H+G,X=.707106781*(L=D+R),J=O+X,K=O-X;t[f+40]=K+V,t[f+24]=K-V,t[f+8]=J+Y,t[f+56]=J-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],Q[l]=0<u?u+.5|0:u-.5|0;return Q}(t,e),c=0;c<64;++c)v[b[c]]=h[c];var l=v[0]-n;n=v[0],0==l?G(r[0]):(G(r[y[o=32767+l]]),G(w[o]));for(var u=63;0<u&&0==v[u];u--);if(0==u)return G(a),n;for(var f,d=1;d<=u;){for(var p=d;0==v[d]&&d<=u;++d);var g=d-p;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)G(s);g&=15}o=32767+v[d],G(i[(g<<4)+y[o]]),G(w[o]),d++}return 63!=u&&G(a),n}function J(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=u((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),I[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=u((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),C[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],h=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[h]=1/(I[b[h]]*s[c]*s[l]*8),F[h]=1/(C[b[h]]*s[c]*s[l]*8),h++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&J(e),P=new Array,E=0,q=7,Y(65496),Y(65504),Y(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),Y(1),Y(1),V(0),V(0),function(){Y(65499),Y(132),V(0);for(var t=0;t<64;t++)V(I[t]);V(1);for(var e=0;e<64;e++)V(C[e])}(),n=t.width,r=t.height,Y(65472),Y(17),V(8),Y(r),Y(n),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1),function(){Y(65476),Y(418),V(0);for(var t=0;t<16;t++)V(D[t+1]);for(var e=0;e<=11;e++)V(M[e]);V(16);for(var n=0;n<16;n++)V(U[n+1]);for(var r=0;r<=161;r++)V(N[r]);V(1);for(var i=0;i<16;i++)V(z[i+1]);for(var o=0;o<=11;o++)V(L[o]);V(17);for(var a=0;a<16;a++)V(H[a+1]);for(var s=0;s<=161;s++)V(W[s])}(),Y(65498),Y(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var i=0,o=0,a=0;E=0,q=7,this.encode.displayName=\"_encode_\";for(var s,h,c,l,u,f,d,p,g,m=t.data,w=t.width,y=t.height,v=4*w,b=0;b<y;){for(s=0;s<v;){for(f=u=v*b+s,d=-1,g=p=0;g<64;g++)f=u+(p=g>>3)*v+(d=4*(7&g)),y<=b+p&&(f-=v*(b+1+p-y)),v<=s+d&&(f-=s+d-v+4),h=m[f++],c=m[f++],l=m[f++],O[g]=(j[h]+j[c+256>>0]+j[l+512>>0]>>16)-128,B[g]=(j[h+768>>0]+j[c+1024>>0]+j[l+1280>>0]>>16)-128,R[g]=(j[h+1280>>0]+j[c+1536>>0]+j[l+1792>>0]>>16)-128;i=X(O,T,i,S,_),o=X(B,F,o,k,A),a=X(R,F,a,k,A),s+=32}b+=8}if(0<=q){var x=[];x[1]=q+1,x[0]=(1<<q+1)-1,G(x)}return Y(65497),new Uint8Array(P)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),S=r(D,M),k=r(z,L),_=r(U,N),A=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)y[32767+r]=n,w[32767+r]=[],w[32767+r][1]=n,w[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)y[32767+i]=n,w[32767+i]=[],w[32767+i][1]=n,w[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)j[t]=19595*t,j[t+256>>0]=38470*t,j[t+512>>0]=7471*t+32768,j[t+768>>0]=-11059*t,j[t+1024>>0]=-21709*t,j[t+1280>>0]=32768*t+8421375,j[t+1536>>0]=-27439*t,j[t+1792>>0]=-5329*t}(),J(t),(new Date).getTime()}()}", "function _t(t) {\n var N,\n L,\n A,\n S,\n e,\n c = Math.floor,\n _ = new Array(64),\n F = new Array(64),\n P = new Array(64),\n k = new Array(64),\n y = new Array(65535),\n v = new Array(65535),\n Z = new Array(64),\n w = new Array(64),\n I = [],\n C = 0,\n B = 7,\n j = new Array(64),\n E = new Array(64),\n M = new Array(64),\n n = new Array(256),\n O = new Array(2048),\n b = [0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63],\n q = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],\n T = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n R = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125],\n D = [1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250],\n U = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],\n z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n H = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119],\n W = [0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250];\n\n function r(t, e) {\n for (var n = 0, r = 0, i = new Array(), o = 1; o <= 16; o++) {\n for (var a = 1; a <= t[o]; a++) i[e[r]] = [], i[e[r]][0] = n, i[e[r]][1] = o, r++, n++;\n\n n *= 2;\n }\n\n return i;\n }\n\n function V(t) {\n for (var e = t[0], n = t[1] - 1; 0 <= n;) e & 1 << n && (C |= 1 << B), n--, --B < 0 && (255 == C ? (G(255), G(0)) : G(C), B = 7, C = 0);\n }\n\n function G(t) {\n I.push(t);\n }\n\n function Y(t) {\n G(t >> 8 & 255), G(255 & t);\n }\n\n function J(t, e, n, r, i) {\n for (var o, a = i[0], s = i[240], l = function (t, e) {\n var n,\n r,\n i,\n o,\n a,\n s,\n l,\n h,\n u,\n c,\n f = 0;\n\n for (u = 0; u < 8; ++u) {\n n = t[f], r = t[f + 1], i = t[f + 2], o = t[f + 3], a = t[f + 4], s = t[f + 5], l = t[f + 6];\n var p = n + (h = t[f + 7]),\n d = n - h,\n g = r + l,\n m = r - l,\n y = i + s,\n v = i - s,\n w = o + a,\n b = o - a,\n x = p + w,\n N = p - w,\n L = g + y,\n A = g - y;\n t[f] = x + L, t[f + 4] = x - L;\n var S = .707106781 * (A + N);\n t[f + 2] = N + S, t[f + 6] = N - S;\n\n var _ = .382683433 * ((x = b + v) - (A = m + d)),\n F = .5411961 * x + _,\n P = 1.306562965 * A + _,\n k = .707106781 * (L = v + m),\n I = d + k,\n C = d - k;\n\n t[f + 5] = C + F, t[f + 3] = C - F, t[f + 1] = I + P, t[f + 7] = I - P, f += 8;\n }\n\n for (u = f = 0; u < 8; ++u) {\n n = t[f], r = t[f + 8], i = t[f + 16], o = t[f + 24], a = t[f + 32], s = t[f + 40], l = t[f + 48];\n var B = n + (h = t[f + 56]),\n j = n - h,\n E = r + l,\n M = r - l,\n O = i + s,\n q = i - s,\n T = o + a,\n R = o - a,\n D = B + T,\n U = B - T,\n z = E + O,\n H = E - O;\n t[f] = D + z, t[f + 32] = D - z;\n var W = .707106781 * (H + U);\n t[f + 16] = U + W, t[f + 48] = U - W;\n var V = .382683433 * ((D = R + q) - (H = M + j)),\n G = .5411961 * D + V,\n Y = 1.306562965 * H + V,\n J = .707106781 * (z = q + M),\n X = j + J,\n K = j - J;\n t[f + 40] = K + G, t[f + 24] = K - G, t[f + 8] = X + Y, t[f + 56] = X - Y, f++;\n }\n\n for (u = 0; u < 64; ++u) c = t[u] * e[u], Z[u] = 0 < c ? c + .5 | 0 : c - .5 | 0;\n\n return Z;\n }(t, e), h = 0; h < 64; ++h) w[b[h]] = l[h];\n\n var u = w[0] - n;\n n = w[0], 0 == u ? V(r[0]) : (V(r[v[o = 32767 + u]]), V(y[o]));\n\n for (var c = 63; 0 < c && 0 == w[c]; c--);\n\n if (0 == c) return V(a), n;\n\n for (var f, p = 1; p <= c;) {\n for (var d = p; 0 == w[p] && p <= c; ++p);\n\n var g = p - d;\n\n if (16 <= g) {\n f = g >> 4;\n\n for (var m = 1; m <= f; ++m) V(s);\n\n g &= 15;\n }\n\n o = 32767 + w[p], V(i[(g << 4) + v[o]]), V(y[o]), p++;\n }\n\n return 63 != c && V(a), n;\n }\n\n function X(t) {\n if (t <= 0 && (t = 1), 100 < t && (t = 100), e != t) {\n (function (t) {\n for (var e = [16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99], n = 0; n < 64; n++) {\n var r = c((e[n] * t + 50) / 100);\n r < 1 ? r = 1 : 255 < r && (r = 255), _[b[n]] = r;\n }\n\n for (var i = [17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99], o = 0; o < 64; o++) {\n var a = c((i[o] * t + 50) / 100);\n a < 1 ? a = 1 : 255 < a && (a = 255), F[b[o]] = a;\n }\n\n for (var s = [1, 1.387039845, 1.306562965, 1.175875602, 1, .785694958, .5411961, .275899379], l = 0, h = 0; h < 8; h++) for (var u = 0; u < 8; u++) P[l] = 1 / (_[b[l]] * s[h] * s[u] * 8), k[l] = 1 / (F[b[l]] * s[h] * s[u] * 8), l++;\n })(t < 50 ? Math.floor(5e3 / t) : Math.floor(200 - 2 * t)), e = t;\n }\n }\n\n this.encode = function (t, e) {\n var n, r;\n new Date().getTime();\n e && X(e), I = new Array(), C = 0, B = 7, Y(65496), Y(65504), Y(16), G(74), G(70), G(73), G(70), G(0), G(1), G(1), G(0), Y(1), Y(1), G(0), G(0), function () {\n Y(65499), Y(132), G(0);\n\n for (var t = 0; t < 64; t++) G(_[t]);\n\n G(1);\n\n for (var e = 0; e < 64; e++) G(F[e]);\n }(), n = t.width, r = t.height, Y(65472), Y(17), G(8), Y(r), Y(n), G(3), G(1), G(17), G(0), G(2), G(17), G(1), G(3), G(17), G(1), function () {\n Y(65476), Y(418), G(0);\n\n for (var t = 0; t < 16; t++) G(q[t + 1]);\n\n for (var e = 0; e <= 11; e++) G(T[e]);\n\n G(16);\n\n for (var n = 0; n < 16; n++) G(R[n + 1]);\n\n for (var r = 0; r <= 161; r++) G(D[r]);\n\n G(1);\n\n for (var i = 0; i < 16; i++) G(U[i + 1]);\n\n for (var o = 0; o <= 11; o++) G(z[o]);\n\n G(17);\n\n for (var a = 0; a < 16; a++) G(H[a + 1]);\n\n for (var s = 0; s <= 161; s++) G(W[s]);\n }(), Y(65498), Y(12), G(3), G(1), G(0), G(2), G(17), G(3), G(17), G(0), G(63), G(0);\n var i = 0,\n o = 0,\n a = 0;\n C = 0, B = 7, this.encode.displayName = \"_encode_\";\n\n for (var s, l, h, u, c, f, p, d, g, m = t.data, y = t.width, v = t.height, w = 4 * y, b = 0; b < v;) {\n for (s = 0; s < w;) {\n for (f = c = w * b + s, p = -1, g = d = 0; g < 64; g++) f = c + (d = g >> 3) * w + (p = 4 * (7 & g)), v <= b + d && (f -= w * (b + 1 + d - v)), w <= s + p && (f -= s + p - w + 4), l = m[f++], h = m[f++], u = m[f++], j[g] = (O[l] + O[h + 256 >> 0] + O[u + 512 >> 0] >> 16) - 128, E[g] = (O[l + 768 >> 0] + O[h + 1024 >> 0] + O[u + 1280 >> 0] >> 16) - 128, M[g] = (O[l + 1280 >> 0] + O[h + 1536 >> 0] + O[u + 1792 >> 0] >> 16) - 128;\n\n i = J(j, P, i, N, A), o = J(E, k, o, L, S), a = J(M, k, a, L, S), s += 32;\n }\n\n b += 8;\n }\n\n if (0 <= B) {\n var x = [];\n x[1] = B + 1, x[0] = (1 << B + 1) - 1, V(x);\n }\n\n return Y(65497), new Uint8Array(I);\n }, function () {\n new Date().getTime();\n t || (t = 50), function () {\n for (var t = String.fromCharCode, e = 0; e < 256; e++) n[e] = t(e);\n }(), N = r(q, T), L = r(U, z), A = r(R, D), S = r(H, W), function () {\n for (var t = 1, e = 2, n = 1; n <= 15; n++) {\n for (var r = t; r < e; r++) v[32767 + r] = n, y[32767 + r] = [], y[32767 + r][1] = n, y[32767 + r][0] = r;\n\n for (var i = -(e - 1); i <= -t; i++) v[32767 + i] = n, y[32767 + i] = [], y[32767 + i][1] = n, y[32767 + i][0] = e - 1 + i;\n\n t <<= 1, e <<= 1;\n }\n }(), function () {\n for (var t = 0; t < 256; t++) O[t] = 19595 * t, O[t + 256 >> 0] = 38470 * t, O[t + 512 >> 0] = 7471 * t + 32768, O[t + 768 >> 0] = -11059 * t, O[t + 1024 >> 0] = -21709 * t, O[t + 1280 >> 0] = 32768 * t + 8421375, O[t + 1536 >> 0] = -27439 * t, O[t + 1792 >> 0] = -5329 * t;\n }(), X(t), new Date().getTime();\n }();\n }", "twistMU() {\n this.fourCycle(this.edgeLoc, 1, 4, 7, 10, this.edgeOrient, 1, 1, 1, 1, 2);\n this.fourCycle(this.sideLoc, 3, 2, 0, 5, this.sideOrient, 2, 1, 2, 3, 4);\n }", "function draw() {\n\t background(0);\n\t var spectrum = fft.analyze();// run the FFT analysis\n\n/*\nLocal Variable, fft.getEnergy maps the different \nfrequencies of the audio and returns values between 0 and 255\n*/\n var bass = fft.getEnergy( \"bass\" );\n var treble = fft.getEnergy( \"treble\" );\n var highMid = fft.getEnergy( \"highMid\" ); \n\n/* \nLocal variable which assigns values to the mapped frequencies\n*/\n var mapMid = map( highMid, 0, 255, -50, 255 );\n var mapTreble = map( treble, 0, 255, -140, 200 );\n\n var pieces = 60;//Local variable for the number of lines in the shape\n var radius = 350\n \t translate (width/2, height/2);// Moves origin to the centre of the canvas\n \t stroke (0);\n \tstrokeWeight(3);\n for( i = 0; i < pieces; i++ ) { // draws a shape of each piece\n \t\n stroke(219, 162, 188);\n rotate(frameCount * 0.0001);\n line(mapMid, mapMid, 10, bass ); \n stroke(17, 218, 211);\n point(mapTreble, 480);\n point(mapMid, 670);\n \n /* \n Push() adds a new item at the end of the array.\n Pop() removes the last item of an array\n */\n push();\n rotate(-frameCount * 0.01);\n stroke(17, 218, 211);\n point(120, bass) ;\n fill(17, 218, 211);\n point(bass,300) ;\n pop();\n \n push();\n rotate(-frameCount * 0.01);//negative framecount allows points to spin counter clockwise\n stroke(219, 162, 188);\n point(550, bass) ;\n point(430, mapTreble) ;\n line( bass, 740, mouseY, 740 );\n pop();\n\n }\n}", "function FFTM(x,y){this.x=x;this.y=y;}", "function FFTM(x,y){this.x=x;this.y=y;}", "function initFourierImage() {\r\n //event listeners\r\n function loadImage(loc) {\r\n var start = +new Date();\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //draw the initial image\r\n var img = new Image();\r\n img.addEventListener('load', function() {\r\n //make each canvas the image's exact size\r\n dims[0] = img.width;\r\n dims[1] = img.height;\r\n for (var ai = 0; ai < 4; ai++) {\r\n canvases[ai] = $s('#canvas'+ai);\r\n canvases[ai].width = dims[0], canvases[ai].height = dims[1];\r\n ctxs[ai] = canvases[ai].getContext('2d');\r\n }\r\n\r\n //draw the image to the canvas\r\n ctxs[0].drawImage(img, 0, 0, img.width, img.height);\r\n\r\n //grab the pixels\r\n var imageData = ctxs[0].getImageData(0, 0, dims[0], dims[1]);\r\n var h_es = []; //the h values\r\n for (var ai = 0; ai < imageData.data.length; ai+=4) {\r\n //greyscale, so you only need every 4th value\r\n h_es.push(imageData.data[ai]);\r\n }\r\n\r\n //initialize the h values\r\n h = function(n, m) {\r\n if (arguments.length === 0) return h_es;\r\n\r\n var idx = n*dims[0] + m;\r\n return h_es[idx];\r\n }; //create it in function form to make the code match the math\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to draw the image.');\r\n });\r\n img.src = loc;\r\n });\r\n }\r\n $s('#draw-cs-btn').addEventListener('click', function() {\r\n loadImage('cs.png');\r\n });\r\n $s('#draw-circle-btn').addEventListener('click', function() {\r\n loadImage('circle.png');\r\n });\r\n $s('#draw-grace-btn').addEventListener('click', function() {\r\n loadImage('grace.png');\r\n });\r\n\r\n $s('#transform-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h()) return alert('You need to draw an image to canvas 1 first.');\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h hat values\r\n var h_hats = [];\r\n FFT(h_hats, h());\r\n h_hats = shiftFFT(h_hats);\r\n\r\n //get the largest magnitude\r\n var maxMagnitude = 0;\r\n for (var ai = 0; ai < h_hats.length; ai++) {\r\n var mag = h_hats[ai].magnitude();\r\n if (mag > maxMagnitude) {\r\n maxMagnitude = mag;\r\n }\r\n }\r\n\r\n //apply a low or high pass filter\r\n var lpr = parseInt($s('#low-freq-radius').value); //low pass radius\r\n var hpr = parseInt($s('#high-freq-radius').value); //high \" \"\r\n var N = dims[1], M = dims[0];\r\n for (var k = 0; k < N; k++) {\r\n for (var l = 0; l < M; l++) {\r\n var idx = k*M + l;\r\n var dist = Math.pow(k-M/2, 2) + Math.pow(l-N/2, 2);\r\n if (dist > lpr*lpr && isNaN(hpr) ||\r\n dist < hpr*hpr && isNaN(lpr) ||\r\n dist < lpr*lpr && !isNaN(lpr) && !isNaN(hpr) ||\r\n dist > hpr*hpr && !isNaN(lpr) && !isNaN(hpr)) {\r\n h_hats[idx] = new Complex(0, 0);\r\n }\r\n }\r\n }\r\n\r\n //store them in a nice function to match the math\r\n $h = function(k, l) {\r\n if (arguments.length === 0) return h_hats;\r\n \r\n var idx = k*dims[0] + l;\r\n return h_hats[idx];\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[1].getImageData(0, 0, dims[0], dims[1]);\r\n var logOfMaxMag = Math.log(cc*maxMagnitude+1);\r\n for (var k = 0; k < dims[1]; k++) {\r\n for (var l = 0; l < dims[0]; l++) {\r\n var idxInPixels = 4*(dims[0]*k + l);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n var color = Math.log(cc*$h(k, l).magnitude()+1);\r\n color = Math.round(255*(color/logOfMaxMag));\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = color;\r\n }\r\n }\r\n }\r\n ctxs[1].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the FT.');\r\n });\r\n });\r\n\r\n $s('#reconstruct-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!$h()) {\r\n return alert('You first need to compute the Fourier transform.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h prime values\r\n var h_primes = [];\r\n var h_hats = $h();\r\n h_hats = unshiftFFT(h_hats);\r\n invFFT(h_primes, h_hats);\r\n\r\n //store them in a nice function to match the math\r\n h_ = function(n, m) {\r\n if (arguments.length === 0) return h_primes;\r\n\r\n var idx = n*dims[0] + m;\r\n return round(h_primes[idx], 2);\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[2].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = h_(n, m);\r\n }\r\n }\r\n }\r\n ctxs[2].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to reconstruct the image.');\r\n });\r\n });\r\n\r\n $s('#difference-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h_()) {\r\n return alert('You haven\\'t reconstructed an image yet.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //find the range of the errors\r\n var minError = Infinity;\r\n var maxError = 0;\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var error = h_(n, m) - h(n, m);\r\n if (error < minError) minError = error;\r\n if (error > maxError) maxError = error;\r\n }\r\n }\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[3].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m); //idx in the pixels array\r\n var error = h_(n, m) - h(n, m);\r\n var color = getCoolColor(error, [minError, maxError]);\r\n for (var c = 0; c < 3; c++) {\r\n currImageData.data[idxInPixels+c] = color[c];\r\n }\r\n currImageData.data[idxInPixels+3] = 255; // fullalpha\t\t\r\n }\r\n }\r\n ctxs[3].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the difference.');\r\n });\r\n });\r\n\r\n //initialize the working variables\r\n canvases = [], ctxs = [];\r\n h = $h = h_ = function() { return false; };\r\n}", "function fDCTQuant(data, fdtbl)\n {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n /* Pass 1: process rows. */\n var dataOff=0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff+1];\n d2 = data[dataOff+2];\n d3 = data[dataOff+3];\n d4 = data[dataOff+4];\n d5 = data[dataOff+5];\n d6 = data[dataOff+6];\n d7 = data[dataOff+7];\n \n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n \n /* Even part */\n var tmp10 = tmp0 + tmp3; /* phase 2 */\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n \n data[dataOff] = tmp10 + tmp11; /* phase 3 */\n data[dataOff+4] = tmp10 - tmp11;\n \n var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n data[dataOff+2] = tmp13 + z1; /* phase 5 */\n data[dataOff+6] = tmp13 - z1;\n \n /* Odd part */\n tmp10 = tmp4 + tmp5; /* phase 2 */\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n var z3 = tmp11 * 0.707106781; /* c4 */\n \n var z11 = tmp7 + z3; /* phase 5 */\n var z13 = tmp7 - z3;\n \n data[dataOff+5] = z13 + z2; /* phase 6 */\n data[dataOff+3] = z13 - z2;\n data[dataOff+1] = z11 + z4;\n data[dataOff+7] = z11 - z4;\n \n dataOff += 8; /* advance pointer to next row */\n }\n \n /* Pass 2: process columns. */\n dataOff = 0;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n \n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n \n /* Even part */\n var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n \n data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n data[dataOff+32] = tmp10p2 - tmp11p2;\n \n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n data[dataOff+48] = tmp13p2 - z1p2;\n \n /* Odd part */\n tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n \n var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n var z13p2 = tmp7p2 - z3p2;\n \n data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n data[dataOff+24] = z13p2 - z2p2;\n data[dataOff+ 8] = z11p2 + z4p2;\n data[dataOff+56] = z11p2 - z4p2;\n \n dataOff++; /* advance pointer to next column */\n }\n \n // Quantize/descale the coefficients\n var fDCTQuant;\n for (i=0; i<I64; ++i)\n {\n // Apply the quantization and scaling factor & Round to nearest integer\n fDCTQuant = data[i]*fdtbl[i];\n outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n //outputfDCTQuant[i] = fround(fDCTQuant);\n \n }\n return outputfDCTQuant;\n }", "function transformRadix2(real, imag) {\n\t // Initialization\n\t if (real.length != imag.length) throw \"Mismatched lengths\";\n\t var n = real.length;\n\t if (n == 1) // Trivial transform\n\t return;\n\t var levels = -1;\n\t for (var i = 0; i < 32; i++) {\n\t if (1 << i == n) levels = i; // Equal to log2(n)\n\t }\n\t if (levels == -1) throw \"Length is not a power of 2\";\n\t var cosTable = new Array(n / 2);\n\t var sinTable = new Array(n / 2);\n\t for (var i = 0; i < n / 2; i++) {\n\t cosTable[i] = Math.cos(2 * Math.PI * i / n);\n\t sinTable[i] = Math.sin(2 * Math.PI * i / n);\n\t }\n\n\t // Bit-reversed addressing permutation\n\t for (var i = 0; i < n; i++) {\n\t var j = reverseBits(i, levels);\n\t if (j > i) {\n\t var temp = real[i];\n\t real[i] = real[j];\n\t real[j] = temp;\n\t temp = imag[i];\n\t imag[i] = imag[j];\n\t imag[j] = temp;\n\t }\n\t }\n\n\t // Cooley-Tukey decimation-in-time radix-2 FFT\n\t for (var size = 2; size <= n; size *= 2) {\n\t var halfsize = size / 2;\n\t var tablestep = n / size;\n\t for (var i = 0; i < n; i += size) {\n\t for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n\t var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n\t var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n\t real[j + halfsize] = real[j] - tpre;\n\t imag[j + halfsize] = imag[j] - tpim;\n\t real[j] += tpre;\n\t imag[j] += tpim;\n\t }\n\t }\n\t }\n\n\t // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n\t function reverseBits(x, bits) {\n\t var y = 0;\n\t for (var i = 0; i < bits; i++) {\n\t y = y << 1 | x & 1;\n\t x >>>= 1;\n\t }\n\t return y;\n\t }\n\t}", "function calculateNext(data) {\n \n var hthv, hthw, hthso, hthsi, hthvm, htho, hthvinf, hthwinf,\n tvm, ts, to, twp, twm, tso, tsi, vinf, winf, dv, dw, ds;\n \n cS.istim = _s1s2Stimulus(count,data);\n\n // Step functions\n hthv = (cS.u >= cS.thv);\n hthw = (cS.u >= cS.thw);\n hthso = (cS.u >= cS.thw);\n hthsi = (cS.u >= cS.thw);\n hthvm = (cS.u >= cS.thvm);\n htho = (cS.u >= cS.tho);\n hthvinf = (cS.u >= cS.thvm);\n hthwinf = (cS.u >= cS.tho); //thwinf = tho.\n\n // Multi-part terms\n tvm = (1 - hthvm) * cS.tv1m + hthvm * cS.tv2m;\n ts = (1 - hthw) * cS.ts1 + hthw * cS.ts2;\n to = (1 - htho) * cS.to1 + htho * cS.to2;\n twp = cS.tw1p + (cS.tw2p - cS.tw1p) * (1 + Math.tanh((cS.w - cS.wcp) * cS.kwp)) / 2;\n twm = cS.tw1m + (cS.tw2m - cS.tw1m) * (1 + Math.tanh((cS.u - cS.uwm) * cS.kwm)) / 2;\n tso = cS.tso1 + (cS.tso2 - cS.tso1) * (1 + Math.tanh((cS.u - cS.uso) * cS.kso)) / 2;\n tsi = cS.tsi1 + (cS.tsi1 - cS.tsi1) * (1 + Math.tanh((cS.s - cS.sc) * cS.ksi)) / 2;\n vinf = 1 - hthvinf;\n winf = (1 - hthwinf) * (1 - cS.u / cS.twinf) + hthwinf * cS.winfstar;\n\n // Gate evolution\n dv = (1 - hthv) * (vinf - cS.v) / tvm - hthv * cS.v / cS.tvp;\n dw = (1 - hthw) * (winf - cS.w) / twm - hthw * cS.w / twp;\n ds = ((1 + Math.tanh((cS.u - cS.us) * cS.ks)) / 2 - cS.s) / ts;\n cS.v = cS.v + cS.timestep * dv;\n cS.w = cS.w + cS.timestep * dw;\n cS.s = cS.s + cS.timestep * ds;\n \n // Currents\n cS.xfi = -cS.v * hthv * (cS.u - cS.thv) * (cS.uu - cS.u) / cS.tfi;\n cS.xso = (cS.u - cS.uo) * (1 - hthso) / to + hthso / tso;\n cS.xsi = -hthsi * cS.w * cS.s / tsi;\n \n // update u using forward Euler\n cS.u = cS.u - cS.timestep * (cS.xfi + cS.xso + cS.xsi - cS.istim);\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n \n return data; \n }", "function fDCTQuant(data, fdtbl)\n\t {\n\t var d0, d1, d2, d3, d4, d5, d6, d7;\n\t /* Pass 1: process rows. */\n\t var dataOff=0;\n\t var i;\n\t var I8 = 8;\n\t var I64 = 64;\n\t for (i=0; i<I8; ++i)\n\t {\n\t d0 = data[dataOff];\n\t d1 = data[dataOff+1];\n\t d2 = data[dataOff+2];\n\t d3 = data[dataOff+3];\n\t d4 = data[dataOff+4];\n\t d5 = data[dataOff+5];\n\t d6 = data[dataOff+6];\n\t d7 = data[dataOff+7];\n\t \n\t var tmp0 = d0 + d7;\n\t var tmp7 = d0 - d7;\n\t var tmp1 = d1 + d6;\n\t var tmp6 = d1 - d6;\n\t var tmp2 = d2 + d5;\n\t var tmp5 = d2 - d5;\n\t var tmp3 = d3 + d4;\n\t var tmp4 = d3 - d4;\n\t \n\t /* Even part */\n\t var tmp10 = tmp0 + tmp3; /* phase 2 */\n\t var tmp13 = tmp0 - tmp3;\n\t var tmp11 = tmp1 + tmp2;\n\t var tmp12 = tmp1 - tmp2;\n\t \n\t data[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t data[dataOff+4] = tmp10 - tmp11;\n\t \n\t var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t data[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t data[dataOff+6] = tmp13 - z1;\n\t \n\t /* Odd part */\n\t tmp10 = tmp4 + tmp5; /* phase 2 */\n\t tmp11 = tmp5 + tmp6;\n\t tmp12 = tmp6 + tmp7;\n\t \n\t /* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t var z3 = tmp11 * 0.707106781; /* c4 */\n\t \n\t var z11 = tmp7 + z3; /* phase 5 */\n\t var z13 = tmp7 - z3;\n\t \n\t data[dataOff+5] = z13 + z2; /* phase 6 */\n\t data[dataOff+3] = z13 - z2;\n\t data[dataOff+1] = z11 + z4;\n\t data[dataOff+7] = z11 - z4;\n\t \n\t dataOff += 8; /* advance pointer to next row */\n\t }\n\t \n\t /* Pass 2: process columns. */\n\t dataOff = 0;\n\t for (i=0; i<I8; ++i)\n\t {\n\t d0 = data[dataOff];\n\t d1 = data[dataOff + 8];\n\t d2 = data[dataOff + 16];\n\t d3 = data[dataOff + 24];\n\t d4 = data[dataOff + 32];\n\t d5 = data[dataOff + 40];\n\t d6 = data[dataOff + 48];\n\t d7 = data[dataOff + 56];\n\t \n\t var tmp0p2 = d0 + d7;\n\t var tmp7p2 = d0 - d7;\n\t var tmp1p2 = d1 + d6;\n\t var tmp6p2 = d1 - d6;\n\t var tmp2p2 = d2 + d5;\n\t var tmp5p2 = d2 - d5;\n\t var tmp3p2 = d3 + d4;\n\t var tmp4p2 = d3 - d4;\n\t \n\t /* Even part */\n\t var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n\t var tmp13p2 = tmp0p2 - tmp3p2;\n\t var tmp11p2 = tmp1p2 + tmp2p2;\n\t var tmp12p2 = tmp1p2 - tmp2p2;\n\t \n\t data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t data[dataOff+32] = tmp10p2 - tmp11p2;\n\t \n\t var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t data[dataOff+48] = tmp13p2 - z1p2;\n\t \n\t /* Odd part */\n\t tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t tmp11p2 = tmp5p2 + tmp6p2;\n\t tmp12p2 = tmp6p2 + tmp7p2;\n\t \n\t /* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t \n\t var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n\t var z13p2 = tmp7p2 - z3p2;\n\t \n\t data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t data[dataOff+24] = z13p2 - z2p2;\n\t data[dataOff+ 8] = z11p2 + z4p2;\n\t data[dataOff+56] = z11p2 - z4p2;\n\t \n\t dataOff++; /* advance pointer to next column */\n\t }\n\t \n\t // Quantize/descale the coefficients\n\t var fDCTQuant;\n\t for (i=0; i<I64; ++i)\n\t {\n\t // Apply the quantization and scaling factor & Round to nearest integer\n\t fDCTQuant = data[i]*fdtbl[i];\n\t outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t //outputfDCTQuant[i] = fround(fDCTQuant);\n\t \n\t }\n\t return outputfDCTQuant;\n\t }", "function Poll_FFT_DTMF()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n if (gb_use_mic_dtmf === true)\r\n { \r\n if ((typeof gb_mic === 'undefined') || (typeof gb_fft === 'undefined'))\r\n {\r\n\treturn;\r\n }\r\n\t \r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n if (spectrum[31] > 250){row = 0;}\r\n else{\r\n if (spectrum[35] > 250){row = 1;}\r\n else{\r\n if (spectrum[39] > 250){row = 2;}\r\n else{\r\n if (spectrum[43] > 250){row = 3;}\r\n\t }\r\n }\r\n }\r\n \r\n if (spectrum[55] > 250){col = 0;}\r\n else{\r\n if (spectrum[61] > 250){col = 1;}\r\n else{\r\n if (spectrum[67] > 250){col = 2;}\r\n else{\r\n if (spectrum[76] > 250){col = 3;}\r\n\t }\r\n }\r\n }\r\n \t\t\r\n if ((row>-1) && (col>-1))\r\n {\r\n gb_fft_dtmf = RowColToDtmf(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf)\r\n\t{\t\r\n gb_fft_dtmf_antes = gb_fft_dtmf;\r\n gb_cad_areaRX += gb_fft_dtmf;\t\r\n\t gb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\t gb_event_new_data_dtmf = true;\r\n\t if (gb_fft_dtmf === '#')\r\n\t {\r\n\t gb_begin_sync_dtmf= true;\r\n }\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n\t case '#': gb_begin_sms = true; gb_end_sms = false; break;\r\n\t case '*': gb_end_sms = true; gb_begin_sms = false; break;\t \r\n\t }\r\n\t if (gb_fft_dtmf === '*')\r\n\t {\r\n\t \r\n\t }\r\n gb_forceDraw = true;\r\n }\r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n }\r\n }\r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n } \r\n}", "function tone(hh, peak) {\n let spectrum = junco_fft.analyze();\n let hh_value = spectrum[hh]; //TODO:ersetzten durch eigenes highhead value \n debugValues += hh_value.toString()\n debugValues += \" - \"\n if (lastHHval > hh_value) { //vergleichen und schauen in welche Richtung der Track läuft \n if (direction_hh > 0 && lastHHval > peak) { //TODO: anderer Wert\n if (hh === 131) { \n if (spacer < 2 && timer < 5) {\n let step = new Step(hh * 6, Math.floor(peak * 0.5));\n stair.push(step);\n spacer++;\n if (spacer === 1) {\n timer = 10;\n } else if (spacer === 2) {\n timer = 10;\n }\n } else {\n return;\n }\n }\n }\n if (hh === 104) {\n if (spacer < 1 && timer === 0) {\n let step = new Step(hh * 6, Math.floor(peak * 0.5));\n stair.push(step);\n spacer++;\n console.log(spacer)\n timer = 15;\n } else {\n return;\n }\n }\n if (hh === 87) {\n if (spacer < 1 && timer === 0) {\n let step = new Step(hh * 6, Math.floor(peak * 0.4));\n stair.push(step);\n spacer++;\n console.log(spacer)\n timer = 15;\n } else {\n return;\n }\n }\n if (hh === 65) {\n if (spacer < 2 && timer < 5) {\n let step = new Step(hh * 6, Math.floor(peak));\n stair.push(step);\n spacer++;\n if (spacer === 1) {\n timer = 10;\n } else if (spacer === 2) {\n timer = 20;\n }\n } else {\n return;\n }\n }\n direction_hh = -1; //man schaut auf welcher Seite des Ausschlags man ist\n } else {\n direction_hh = 1;\n }\n lastHHval = hh_value;\n}", "function workerThreadFn() {\n\n let that = {};\n\n that.n = 1024;\n that.inverse = true;\n\n that.fft = new FFT.complex(that.n, that.inverse);\n\n parentPort.on('message', (payloadIn)=>{\n // let a = msg.bufferInput;\n // console.log(msg);\n\n let chunkCopy = payloadIn.chunk;\n\n const ffttype = 'complex';\n\n const width = 8*2;\n\n // how many uint32's (how many samples) did we get\n const sz = 1024;\n\n\n var dataView = new DataView(chunkCopy);\n\n\n // it's possible that a proxy may be faster here instead of building bufferInput/fftInput\n // https://ponyfoo.com/articles/es6-proxies-in-depth\n \n let bufferInput = new ArrayBuffer(sz*width); // in bytes\n let bufferOutput = new ArrayBuffer(sz*width); // in bytes\n\n // this.w.postMessage(bufferInput,[bufferInput]);\n\n\n let fftInput = new Float64Array(bufferInput);\n let fftOutput = new Float64Array(bufferOutput);\n // let uint8_out_view = new Uint8Array(bufferOutput);\n\n\n // in place modify of the copy\n for(let i = 0; i < sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);// * this.gain;\n let im = dataView.getFloat64((i*8)+8, true);// * this.gain;\n // console.log('re: ' + re + ' im: ' + im);\n fftInput[i] = re;\n fftInput[i+1] = im;\n }\n\n that.fft.simple(fftOutput, fftInput, ffttype);\n\n const payloadOut = {id:payloadIn.id, bufferOutput:bufferOutput};\n\n parentPort.postMessage(payloadOut, [payloadOut.bufferOutput]);\n // console.log('finished');\n\n\n });\n}", "function fDCTQuant(data, fdtbl)\n {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n /* Pass 1: process rows. */\n var dataOff=0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff+1];\n d2 = data[dataOff+2];\n d3 = data[dataOff+3];\n d4 = data[dataOff+4];\n d5 = data[dataOff+5];\n d6 = data[dataOff+6];\n d7 = data[dataOff+7];\n\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n\n /* Even part */\n var tmp10 = tmp0 + tmp3; /* phase 2 */\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n\n data[dataOff] = tmp10 + tmp11; /* phase 3 */\n data[dataOff+4] = tmp10 - tmp11;\n\n var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n data[dataOff+2] = tmp13 + z1; /* phase 5 */\n data[dataOff+6] = tmp13 - z1;\n\n /* Odd part */\n tmp10 = tmp4 + tmp5; /* phase 2 */\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n\n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n var z3 = tmp11 * 0.707106781; /* c4 */\n\n var z11 = tmp7 + z3; /* phase 5 */\n var z13 = tmp7 - z3;\n\n data[dataOff+5] = z13 + z2; /* phase 6 */\n data[dataOff+3] = z13 - z2;\n data[dataOff+1] = z11 + z4;\n data[dataOff+7] = z11 - z4;\n\n dataOff += 8; /* advance pointer to next row */\n }\n\n /* Pass 2: process columns. */\n dataOff = 0;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n\n /* Even part */\n var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n\n data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n data[dataOff+32] = tmp10p2 - tmp11p2;\n\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n data[dataOff+48] = tmp13p2 - z1p2;\n\n /* Odd part */\n tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n\n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\n var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n var z13p2 = tmp7p2 - z3p2;\n\n data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n data[dataOff+24] = z13p2 - z2p2;\n data[dataOff+ 8] = z11p2 + z4p2;\n data[dataOff+56] = z11p2 - z4p2;\n\n dataOff++; /* advance pointer to next column */\n }\n\n // Quantize/descale the coefficients\n var fDCTQuant;\n for (i=0; i<I64; ++i)\n {\n // Apply the quantization and scaling factor & Round to nearest integer\n fDCTQuant = data[i]*fdtbl[i];\n outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n //outputfDCTQuant[i] = fround(fDCTQuant);\n\n }\n return outputfDCTQuant;\n }", "function TMhs(htma,sol,T_BaseFrame){\n var T0 = [];\n for(var i=0;i<n;i=i+1){\n var RPY = RPYangles(htma[i]); //get old roll angle (RPYangles() returns [[roll],[pitch],[yaw]])\n var phiB = RPY[0][0]; //roll\n var Tb = htma[i]; //transform beform the update\n var Tz = trotz(sol[15][i][0] + -1.0*phiB);\n var T = hlao.matrix_multiplication(Tz,Tb);\n //console.log(T);\n \n if(i == 0){\n var T0n = [\n [T[0][0], T[0][1], T[0][2], T[0][3]],\n [T[1][0], T[1][1], T[1][2], T[1][3]],\n [T[2][0], T[2][1], T[2][2], T[2][3]],\n [T[3][0], T[3][1], T[3][2], T[3][3]]\n ];\n T0[i] = hlao.matrix_multiplication(T_BaseFrame,T0n); //note: T_BaseFrame defined in Tu.js\n } else {\n T0n = hlao.matrix_multiplication(T0n,T);\n T0[i] = hlao.matrix_multiplication(T0[i-1],T);\n }\n }\n \n return [T0, T0n];\n}", "function mt(t){var S,I,k,_,e,u=Math.floor,C=new Array(64),A=new Array(64),T=new Array(64),F=new Array(64),y=new Array(65535),w=new Array(65535),Q=new Array(64),v=new Array(64),P=[],O=0,E=7,q=new Array(64),B=new Array(64),D=new Array(64),n=new Array(256),U=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],j=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],M=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],N=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var s=1;s<=t[o];s++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function G(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(O|=1<<E),n--,--E<0&&(255==O?(V(255),V(0)):V(O),E=7,O=0)}function V(t){P.push(t)}function Y(t){V(t>>8&255),V(255&t)}function X(t,e,n,r,i){for(var o,s=i[0],a=i[240],h=function(t,e){var n,r,i,o,s,a,h,c,l,u,f=0;for(l=0;l<8;++l){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],s=t[f+4],a=t[f+5],h=t[f+6];var d=n+(c=t[f+7]),p=n-c,g=r+h,m=r-h,y=i+a,w=i-a,v=o+s,b=o-s,x=d+v,S=d-v,I=g+y,k=g-y;t[f]=x+I,t[f+4]=x-I;var _=.707106781*(k+S);t[f+2]=S+_,t[f+6]=S-_;var C=.382683433*((x=b+w)-(k=m+p)),A=.5411961*x+C,T=1.306562965*k+C,F=.707106781*(I=w+m),P=p+F,O=p-F;t[f+5]=O+A,t[f+3]=O-A,t[f+1]=P+T,t[f+7]=P-T,f+=8}for(l=f=0;l<8;++l){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],s=t[f+32],a=t[f+40],h=t[f+48];var E=n+(c=t[f+56]),q=n-c,B=r+h,D=r-h,U=i+a,j=i-a,R=o+s,M=o-s,N=E+R,z=E-R,L=B+U,H=B-U;t[f]=N+L,t[f+32]=N-L;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var G=.382683433*((N=M+j)-(H=D+q)),V=.5411961*N+G,Y=1.306562965*H+G,X=.707106781*(L=j+D),K=q+X,J=q-X;t[f+40]=J+V,t[f+24]=J-V,t[f+8]=K+Y,t[f+56]=K-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],Q[l]=0<u?u+.5|0:u-.5|0;return Q}(t,e),c=0;c<64;++c)v[b[c]]=h[c];var l=v[0]-n;n=v[0],0==l?G(r[0]):(G(r[w[o=32767+l]]),G(y[o]));for(var u=63;0<u&&0==v[u];u--);if(0==u)return G(s),n;for(var f,d=1;d<=u;){for(var p=d;0==v[d]&&d<=u;++d);var g=d-p;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)G(a);g&=15}o=32767+v[d],G(i[(g<<4)+w[o]]),G(y[o]),d++}return 63!=u&&G(s),n}function K(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=u((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),C[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var s=u((i[o]*t+50)/100);s<1?s=1:255<s&&(s=255),A[b[o]]=s}for(var a=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],h=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[h]=1/(C[b[h]]*a[c]*a[l]*8),F[h]=1/(A[b[h]]*a[c]*a[l]*8),h++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&K(e),P=new Array,O=0,E=7,Y(65496),Y(65504),Y(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),Y(1),Y(1),V(0),V(0),function(){Y(65499),Y(132),V(0);for(var t=0;t<64;t++)V(C[t]);V(1);for(var e=0;e<64;e++)V(A[e])}(),n=t.width,r=t.height,Y(65472),Y(17),V(8),Y(r),Y(n),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1),function(){Y(65476),Y(418),V(0);for(var t=0;t<16;t++)V(j[t+1]);for(var e=0;e<=11;e++)V(R[e]);V(16);for(var n=0;n<16;n++)V(M[n+1]);for(var r=0;r<=161;r++)V(N[r]);V(1);for(var i=0;i<16;i++)V(z[i+1]);for(var o=0;o<=11;o++)V(L[o]);V(17);for(var s=0;s<16;s++)V(H[s+1]);for(var a=0;a<=161;a++)V(W[a])}(),Y(65498),Y(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var i=0,o=0,s=0;O=0,E=7,this.encode.displayName=\"_encode_\";for(var a,h,c,l,u,f,d,p,g,m=t.data,y=t.width,w=t.height,v=4*y,b=0;b<w;){for(a=0;a<v;){for(f=u=v*b+a,d=-1,g=p=0;g<64;g++)f=u+(p=g>>3)*v+(d=4*(7&g)),w<=b+p&&(f-=v*(b+1+p-w)),v<=a+d&&(f-=a+d-v+4),h=m[f++],c=m[f++],l=m[f++],q[g]=(U[h]+U[c+256>>0]+U[l+512>>0]>>16)-128,B[g]=(U[h+768>>0]+U[c+1024>>0]+U[l+1280>>0]>>16)-128,D[g]=(U[h+1280>>0]+U[c+1536>>0]+U[l+1792>>0]>>16)-128;i=X(q,T,i,S,k),o=X(B,F,o,I,_),s=X(D,F,s,I,_),a+=32}b+=8}if(0<=E){var x=[];x[1]=E+1,x[0]=(1<<E+1)-1,G(x)}return Y(65497),new Uint8Array(P)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),S=r(j,R),I=r(z,L),k=r(M,N),_=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)w[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)w[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)U[t]=19595*t,U[t+256>>0]=38470*t,U[t+512>>0]=7471*t+32768,U[t+768>>0]=-11059*t,U[t+1024>>0]=-21709*t,U[t+1280>>0]=32768*t+8421375,U[t+1536>>0]=-27439*t,U[t+1792>>0]=-5329*t}(),K(t),(new Date).getTime()}()}", "calculateTCUs (initial_directions, initial_PCEs) {\r\n // Ensure that the TCU volumes are up to date. Here we are assuming the user movement volumes have already been converted to their PCE.\r\n if (initial_directions == -1) {\r\n var direction_array = PROJECT.getIntersectionByID(this._intersection_ID).getZoneByIndex(this._zone_ID - 1).getDirectionArray();\r\n var PCE_table = PROJECT.getIntersectionByID(this._intersection_ID).getZoneByIndex(this._zone_ID - 1).getZonePCEs().getPCEArray();\r\n } else {\r\n var direction_array = initial_directions;\r\n var PCE_table = initial_PCEs.getPCEArray();\r\n console.log(direction_array);\r\n console.log(PCE_table);\r\n }\r\n \r\n for (var direction = 0; direction < 4; direction++) {\r\n \r\n var right_vol = PCE_table[direction].getRight();\r\n var through_vol = PCE_table[direction].getThrough();\r\n var left_vol = PCE_table[direction].getLeft();\r\n \r\n var right_turn_lanes = direction_array[direction].getRightTurn();\r\n var through_lanes = direction_array[direction].getThrough();\r\n var left_turn_lanes = direction_array[direction].getLeftTurn();\r\n var shared_right = direction_array[direction].getSharedRight();\r\n var shared_left = direction_array[direction].getSharedLeft();\r\n var chan_right = direction_array[direction].getChannelizedRight();\r\n \r\n // Gets the direction exactly 2 away from 'direction'; masking by three returns only the 1s and 2s bits (0 - 3)\r\n var opposing_throughs_vol = PCE_table[(direction + 2) & 3].getThrough();\r\n var opposing_right_vol = PCE_table[(direction + 2) & 3].getRight();\r\n var opposing_through_lanes = direction_array[(direction + 2) & 3].getThrough();\r\n var opposing_right_lanes = direction_array[(direction + 2) & 3].getRightTurn();\r\n var opposing_chan_right = direction_array[(direction + 2) & 3].getChannelizedRight();\r\n var opposing_left_lanes = direction_array[(direction + 2) & 3].getLeftTurn();\r\n var opposing_shared_left = direction_array[(direction + 2) & 3].getSharedLeft();\r\n \r\n var this_phase_split;\r\n \r\n if (direction % 2 === 0 && !this._north_south_split_override) {\r\n this._north_south_split_phase = (left_turn_lanes > 0 && shared_left) ? true : \r\n (opposing_left_lanes > 0 && opposing_shared_left) ? true : false;\r\n this_phase_split = this._north_south_split_phase;\r\n } else if (!this._east_west_split_override) {\r\n this._east_west_split_phase = (left_turn_lanes > 0 && shared_left) ? true : \r\n (opposing_left_lanes > 0 && opposing_shared_left) ? true : false;\r\n this_phase_split = this._east_west_split_phase;\r\n }\r\n \r\n if (this_phase_split) {\r\n this._protected_lefts[direction] = false;\r\n } else {\r\n this._protected_lefts[direction] = left_turn_lanes > 1 ? true : \r\n (left_vol >= 240 && left_turn_lanes == 1) ? true : \r\n (opposing_through_lanes == 1 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 50000) ? true :\r\n (opposing_through_lanes == 2 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 90000) ? true :\r\n (opposing_through_lanes == 3 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 110000) ? true :\r\n (opposing_through_lanes > 3 && left_turn_lanes > 0) ? true:\r\n false;\r\n }\r\n \r\n var throughs = through_vol;\r\n var rights = 0;\r\n var lefts = 0;\r\n \r\n if (!chan_right) {\r\n // Calculates % of right-turn volume in exclusive right-turn lanes and shared through-right\r\n var right_vol_splitfrac = ( (1 + (right_turn_lanes - shared_right)) / (right_turn_lanes + 1) );\r\n\r\n // Add shared rights to through volume\r\n throughs = Math.round(throughs + ((right_vol / UNIVERSAL_RIGHT_TURN_ADJUSTMENT_FACTOR ) * (1 - right_vol_splitfrac) ) );\r\n\r\n // Will be zero if no exclusive lanes; = right_vol if no shared right; something between 0 and right_vol if shared and exclusive rights exist for this approach\r\n rights = Math.round(right_vol * right_vol_splitfrac / right_turn_lanes) * (1 - chan_right);\r\n // Old version of this line; allows rights to be channelized AND shared. Probably an unnecessary case\r\n // rights = Math.round(right_vol * (right_vol_splitfrac * (1 - chan_right)) / right_turn_lanes);\r\n }\r\n \r\n // This needs to be adjusted for phase effect.\r\n var left_turn_factor = 5;\r\n var left_vol_splitfrac = (1 + (left_turn_lanes - shared_left)) / (left_turn_lanes + 1);\r\n \r\n throughs = throughs + (((left_vol * left_turn_factor) / UNIVERSAL_LEFT_TURN_ADJUSTMENT_FACTOR ) * (1 - left_vol_splitfrac) );\r\n var lefts = Math.round(left_vol * left_vol_splitfrac / left_turn_lanes);\r\n \r\n // Convert through volume to a flow rate\r\n throughs = Math.round(throughs / through_lanes);\r\n \r\n /////// NOW SET THE VOLUMES IN this._TCUs\r\n this._TCUs.getDirectionByIndex(direction).setLeft(lefts);\r\n this._TCUs.getDirectionByIndex(direction).setThrough(throughs);\r\n this._TCUs.getDirectionByIndex(direction).setRight(rights);\r\n \r\n console.log(this);\r\n } \r\n this.calculateCapacities();\r\n }", "function draw() {\n background(0, 0, 0, 0.031);\n translate(posX ? posX : 0, posY ? posY : 0)\n stroke(78, 255, 255)\n rect(0.9 * width, 0, 10, accumulator);\n// fill(0,255,0,0.05)\n // fft.smooth();\n // fft.log\n // noise.start();\n spectrum = fft.analyze();\n chunkSize = Math.floor(spectrum.length / population);\n reducedSpectrum = arrayChunk(spectrum, chunkSize);\n // con\n reducedSpectrum.map((cluster, index) => {\n let sum = cluster.reduce((accum, element) => {\n return accum + element;\n });\n // then((sum) => {\n let val = sum / cluster.length;\n // console.log(val)\n if (index < population) {\n var comp = map(index, 0, population, 360, 0);\n stroke(comp, 255, 255);\n var r = map(val, 0, 255, 0.1, 125);\n x = map(index, 0, population, 0, width);\n y = map(index, 0, population, height, 0);\n ellipse(width / 2 + ants[index].dist, y , r);\n random(1) < 0.13 ? ants[index].move() : null;\n } else {\n accumulator += val;\n }\n // })\n // })\n })\n\n // for (i = 0; i < spectrum.length; i++) {\n // if (i < population) {\n // var comp = map(i, 0, population, 360, 0);\n // stroke(comp, 255, 255);\n // var r = map(spectrum[i], 0, 255, 0.1, 125);\n // x = map(i, 0, population, 0, width);\n // y = map(i, 0, population, height, 0);\n // ellipse(width / 2 + ants[i].dist, y, r);\n // ants[i].move();\n // } else {\n // accumulator += spectrum[i];\n // }\n // }\n}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "twistU() {\n this.fourCycle(this.cornerLoc, 0, 2, 4, 6, this.cornerOrient, 0, 0, 0, 0, 3);\n this.fourCycle(this.edgeLoc, 0, 3, 6, 9, this.edgeOrient, 1, 1, 1, 1, 2);\n this.sideOrient[1] = (this.sideOrient[1] + 3) % 4;\n }", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tvar I8 = 8;\n\t\t\tvar I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tvar I8 = 8;\n\t\t\tvar I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fft_rx2 (re, im) {\n let N = re.length;\n if (N.toString(2) % 10) // return immediately if N is not power of 2\n return;\n else if (N <= 32) // if N is sufficiently small, compute dft directly\n return dft_direct(re, im);\n\n let W = discrete_circle(N); // N evenly spaced points around the unit circle\n im = im || re.map( a => 0 ); // set imaginary values to zero if not provided\n\n // compute N/2-point DFT for even and odd samples of input array\n let S_1 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => !(i % 2) ) ));\n let S_2 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => i % 2 ) ));\n\n // mutiply by twiddle factor. later, exploit symmetry W[k+N/2] = -W[k]\n let G_2 = S_2.map( (a, k) => cpx_mult(a, W[k % N]) );\n\n // combine for all frequencies k in N/2-1\n let X = [];\n for (let k of xrange(N/2)) {\n X[k] = cpx_add(S_1[k], G_2[k]);\n X[k + N/2] = cpx_sub(S_1[k], G_2[k]);\n }\n\n return X;\n}", "function FluidField(canvas) {\r\n\r\n function lin_solve2(x, x0, y, y0, a, c)\r\n {\r\n if (a === 0 && c === 1) {\r\n for (var j=1 ; j <= height; j++) {\r\n var currentRow = j * rowSize;\r\n ++currentRow;\r\n for (var i = 0; i < width; i++) {\r\n x[currentRow] = x0[currentRow];\r\n y[currentRow] = y0[currentRow];\r\n ++currentRow;\r\n }\r\n }\r\n } else {\r\n var invC = 1/c;\r\n for (var k=0 ; k<iterations; k++) {\r\n for (var j=1 ; j <= height; j++) {\r\n var lastRow = (j - 1) * rowSize;\r\n var currentRow = j * rowSize;\r\n var nextRow = (j + 1) * rowSize;\r\n var lastX = x[currentRow];\r\n var lastY = y[currentRow];\r\n ++currentRow;\r\n for (var i = 1; i <= width; i++) {\r\n lastX = x[currentRow] = (x0[currentRow] + a * (lastX + x[currentRow] + x[lastRow] + x[nextRow])) * invC;\r\n lastY = y[currentRow] = (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow])) * invC;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.update = function () {\r\n\tvar a = 0;\r\n lin_solve2(u, u_prev, v, v_prev, a, 1 + 4 * a);\r\n }\r\n\r\n var iterations = 1;\r\n var visc = 0.5;\r\n var dt = 0.1;\r\n var u;\r\n var u_prev;\r\n var v;\r\n var v_prev;\r\n var width;\r\n var height;\r\n var rowSize;\r\n var size;\r\n var displayFunc;\r\n function reset()\r\n {\r\n rowSize = width;\r\n size = (width)*(height);\r\n u = new Array(size);\r\n u_prev = new Array(size);\r\n v = new Array(size);\r\n v_prev = new Array(size);\r\n for (var i = 0; i < size; i++)\r\n u_prev[i] = v_prev[i] = u[i] = v[i] = 0;\r\n }\r\n this.reset = reset;\r\n this.setResolution = function (hRes, wRes)\r\n {\r\n var res = wRes * hRes;\r\n if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) {\r\n width = wRes;\r\n height = hRes;\r\n reset();\r\n return true;\r\n }\r\n return false;\r\n }\r\n this.setResolution(1, 1);\r\n}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function createFFT(smoothing,bins){\n // remember to call this function in setup\n // creates new p5 FFT constructor\n fft = new p5.FFT(smoothing,bins);\n}", "function each( x, F, i0, i1 )\n{\n var len = x.length, argslen = arguments.length;\n if ( argslen < 4 ) i1 = len-1;\n if ( 0 > i1 ) i1 += len;\n if ( argslen < 3 ) i0 = 0;\n if ( i0 > i1 ) return x;\n var i, k, l=i1-i0+1, l1, lr, r, q;\n r=l&15; q=r&1;\n if ( q ) F(x[i0], i0, x);\n for (i=q; i<r; i+=2)\n { \n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n }\n for (i=r; i<l; i+=16)\n {\n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n }\n return x;\n}", "function calculateNext(data) {\n \n var aK1, bK1, hlp, hlp2, hlp3, tau, fNaK, am, bm, ad, bd, Infi, af, bf, ar, br, ato, bto, Itot;\n //xlap;\n \n var vi_t, tauv_t, xi_t, taux_t, zIK1_t, zINaCa1_t, zINaCa2_t, zINaK_t, zINab_t, zICab_t,\n expm_t, mi_t, zINa_t, expv_t, zICa_t, expff_t, fi_t, zIto_t, expto_t, toi_t, expxx_t,\n zIK_t;\n \n \n /* tabulations */\n \n vi_t=.5*(1-((Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v)))));\n tauv_t = .25+2.24*((1-(Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v))))/(1-(Math.exp(0.07*(cS.v+92.4))-Math.exp(-(0.07*(cS.v+92.4))))/(Math.exp(0.07*(cS.v+92.4))+Math.exp(-(0.07*(cS.v+92.4))))));\n xi_t = 0.988/(1+Math.exp(-.861-0.062*cS.v));\n taux_t = 240*Math.exp(-((25.5+cS.v)*(25.5+cS.v))/156)+182*(1+(Math.exp(0.154+0.0116*cS.v)-Math.exp(-(0.154+0.0116*cS.v)))/(Math.exp(0.154+0.0116*cS.v)+Math.exp(-(0.154+0.0116*cS.v))))+40*(1+(Math.exp(160+2*cS.v)-Math.exp(-(160+2*cS.v)))/(Math.exp(160+2*cS.v)+Math.exp(-(160+2*cS.v))));\n \n /* Time-independent functions */\n aK1 = 0.1/(1.0+Math.exp(0.06*(cS.v-cC.ek1-200.0)));\n bK1=(3.0*Math.exp(0.0002*(cS.v-cC.ek1+100.0))+Math.exp(0.1*(cS.v-cC.ek1-10.0)))/(1.0+Math.exp(-0.5*(cS.v-cC.ek1)));\n hlp = aK1/(aK1+bK1);\n zIK1_t = cS.gK1*hlp*(cS.v-cC.ek1);\n \n hlp = cS.v/cC.RTonF;\n hlp2 = Math.exp(cS.eta*hlp);\n hlp3 = Math.exp((cS.eta-1.0)*hlp);\n hlp = cS.gNaCa/( (cS.KmNa*cS.KmNa*cS.KmNa+cS.Nae*cS.Nae*cS.Nae)*(cS.KmCa+cS.Cae)*(1.0+cS.ksat*hlp3));\n zINaCa1_t = hlp*hlp2*cS.Nai*cS.Nai*cS.Nai*cS.Cae;\n zINaCa2_t = hlp*hlp3*cS.Nae*cS.Nae*cS.Nae;\n \n hlp = cS.v/cC.RTonF;\n fNaK = 1.0/(1.0+0.1245*Math.exp(-0.1*hlp) + 0.0365*cC.sigma*Math.exp(-hlp));\n hlp = cS.KmNai/cS.Nai;\n hlp2 = 1.0/(1.0+Math.sqrt(hlp*hlp*hlp));\n hlp3 = cS.Ke/(cS.Ke+cS.KmKe);\n zINaK_t = cS.gNaK*fNaK*hlp2*hlp3;\n zINab_t = cS.gNab*(cS.v-cC.ena);\n zICab_t = cS.gCab*(cS.v-cC.eca);\n \n /* NA gating variables */\n am = ((Math.abs(cS.v+47.13)) > 0.001) ? 0.32*(cS.v+47.13)/(1.0 - Math.exp(-0.1*(cS.v+47.13)) ): 3.2;\n bm = 0.08*Math.exp(cS.v/(-11.0));\n hlp = am+bm;\n tau = 1.0/hlp;\n expm_t = Math.exp(-cS.timestep/tau);\n \n mi_t = am/hlp;\n zINa_t = cS.gNa*(cS.v - cC.ena);\n expv_t = Math.exp(-cS.timestep/tauv_t);\n \n \n /*CA gating variables */\n \n hlp = Math.sqrt(2.0*cC.pi);\n hlp2= (cS.v-22.36)/16.6813;\n ad = (14.9859/(16.6813*hlp))*Math.exp(-0.5*hlp2*hlp2);\n hlp2 = (cS.v-6.2744)/14.93;\n bd = 0.1471-((5.3/(14.93*hlp))*Math.exp(-0.5*hlp2*hlp2));\n hlp = ad+bd;\n Infi = ad/hlp;\n zICa_t = cS.gCa*cC.fCa*Infi*(cS.v-cC.eca);\n \n af = 0.006872/(1.0+Math.exp((cS.v-6.1546)/6.1223));\n hlp = 0.0687*Math.exp(-0.1081*(cS.v+9.8255)) + 0.0112;\n hlp2 = 1.0+Math.exp(-0.2779*(cS.v+9.8255));\n bf = hlp/hlp2 + 0.0005474;\n hlp = af+bf;\n tau = 1.0/hlp;\n expff_t = Math.exp(-cS.timestep/tau);\n fi_t = af/hlp;\n \n /*TO gating variables */\n hlp = cS.v-42.2912;\n hlp2 = 0.5266*Math.exp(-0.0166*hlp);\n hlp3 = 1.0 + Math.exp(-0.0943*hlp);\n ar = hlp2/hlp3;\n hlp = 0.5149*Math.exp(-0.1344*(cS.v-5.0027)) + 0.00005186*cS.v;\n hlp2 = 1.0 + Math.exp(-0.1348*(cS.v-0.00005186));\n br = hlp/hlp2;\n hlp = ar+br;\n Infi = ar/hlp;\n zIto_t= cS.gto*Infi*(cS.v-cC.eto);\n hlp = cS.v + 34.2531;\n hlp2 = 0.0721*Math.exp(-0.173*hlp)+0.00005612*cS.v;\n hlp3 = 1.0+Math.exp(-0.1732*hlp);\n ato = hlp2/hlp3;\n hlp = cS.v + 34.0235;\n hlp2 = 0.0767*Math.exp(-1.66E-9*hlp)+0.0001215*cS.v;\n hlp3 = 1.0+Math.exp(-0.1604*hlp);\n bto = hlp2/hlp3;\n hlp = ato+bto;\n tau = 1.0/hlp;\n expto_t = Math.exp(-cS.timestep/tau);\n toi_t = ato/hlp;\n \n /* IK gating variables */\n expxx_t= Math.exp(-cS.timestep/(taux_t+40.0*(1.0-(Math.exp(160.0+cS.v*2.0)- Math.exp(-(160.0+cS.v*2.0)))/(Math.exp(160.0+cS.v*2.0)+ Math.exp(-(160.0+cS.v*2.0)))) ));\n zIK_t = cS.gK*(cS.v- cC.ekr);\n \n cS.istim = _s1s2Stimulus(count, data);\n \n /* Gating variables */\n cS.m = mi_t + ( cS.m - mi_t ) * expm_t;\n cS.f = fi_t + ( cS.f - fi_t ) * expff_t;\n cS.xv = vi_t + ( cS.xv - vi_t ) * expv_t;\n cS.to = toi_t + ( cS.to - toi_t ) * expto_t;\n cS.xx = xi_t + ( cS.xx - xi_t ) * expxx_t;\n \n /* The membrane currents */\n cS.ica = cS.f*zICa_t;\n cS.icab= zICab_t;\n cS.ina = cS.gNa*cS.xv*cS.xv*cS.m*cS.m*cS.m*(cS.v - cC.ena);\n cS.inab= zINab_t;\n cS.ik = cS.xx*cS.xx*zIK_t;\n cS.ik1 = zIK1_t;\n cS.ito = cS.to*zIto_t;\n cS.inaca = zINaCa1_t - cS.Cai*zINaCa2_t;\n cS.inak = zINaK_t;\n Itot= cS.ica+cS.icab+cS.ik1+cS.ik+cS.ina+cS.inab+cS.inaca+cS.inak+cS.ito-cS.istim;\n \n // \n \n /*if(count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i+1)-2.0*cS.v);\n }\n else if (count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i-1)-2.0*cS.v)\n }\n else{\n xlap = cC.d_o_dx2*(v(i+1)-2.0*cS.v+v(i-1))\n }*/\n \n /* The membrane potential */\n \n //cS.v = cS.v - cS.timestep*Itot+xlap; \n cS.v = cS.v - cS.timestep*Itot;\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "constructor({audioCtx, fftSize, carFreq, modAmpl, modFreq, visualCtx}) {\n this.audioCtx = audioCtx;\n this,fftSize = fftSize;\n this.carFreq = carFreq;\n this.modAmpl = modAmpl;\n this.modFreq = modFreq;\n this.visualCtx = visualCtx;\n this.play = false;\n\n\n this.animate;\n this.analyserNode = audioCtx.createAnalyser();\n this.analyserNode.smoothingTimeConstant = 0.0;\n this.analyserNode.fftSize = fftSize;\n\n // Create the array for the data values\n this.frequencyArray = new Uint8Array(this.analyserNode.frequencyBinCount);\n\n // Uses the chroma.js library by Gregor Aisch to create a color gradient\n // download from https://github.com/gka/chroma.js\n this.colorScale = new chroma.scale('Spectral').domain([1,0]);\n // Global Variables for Drawing\n this.column = 0;\n this.canvasWidth = 800;\n this.canvasHeight = 256;\n }", "function Ku(t) {\n for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];\n for (var r = 0, i = e; r < i.length; r++) {\n var o = i[r];\n t = o.Yf(t);\n }\n return t;\n}", "function setup() {\n createCanvas(700, 300);\n fft = new p5.FFT();\n \n basso=[50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46]; // the Basso Continuo\n \n violino=[78, 78, 76, 76, 74, 74, 73, 73, 71, 71, 69, 69, 71, 71, 73, 73, 74, 74, 73, 73, 71, 71, 69, 69, 67, 67, 66, 66, 67, 67, 64, 64, 62, 66, 69, 67, 66, 62, 66, 64, 62, 61, 62, 69, 67, 71, 69, 67, 66, 62, 64, 73, 74, 78, 81, 69, 71, 67, 69, 66, 62, 74, 74, 74]; // the three violine voices are actually the same, just shifted by two bars.\n\ni=0;\ns=0;\nv=[];\nb=new Canon(basso,0); // the basso\n}", "_precompute() {\n\t\t\tconst encTable = this._tables[0];\n\t\t\tconst decTable = this._tables[1];\n\t\t\tconst sbox = encTable[4];\n\t\t\tconst sboxInv = decTable[4];\n\t\t\tconst d = [];\n\t\t\tconst th = [];\n\t\t\tlet xInv, x2, x4, x8;\n\n\t\t\t// Compute double and third tables\n\t\t\tfor (let i = 0; i < 256; i++) {\n\t\t\t\tth[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n\t\t\t}\n\n\t\t\tfor (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n\t\t\t\t// Compute sbox\n\t\t\t\tlet s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n\t\t\t\ts = s >> 8 ^ s & 255 ^ 99;\n\t\t\t\tsbox[x] = s;\n\t\t\t\tsboxInv[s] = x;\n\n\t\t\t\t// Compute MixColumns\n\t\t\t\tx8 = d[x4 = d[x2 = d[x]]];\n\t\t\t\tlet tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n\t\t\t\tlet tEnc = d[s] * 0x101 ^ s * 0x1010100;\n\n\t\t\t\tfor (let i = 0; i < 4; i++) {\n\t\t\t\t\tencTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n\t\t\t\t\tdecTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Compactify. Considerable speedup on Firefox.\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tencTable[i] = encTable[i].slice(0);\n\t\t\t\tdecTable[i] = decTable[i].slice(0);\n\t\t\t}\n\t\t}", "process(fft) {\n var dct = new DCT()\n if (fft.length != this.fftSize) {\n throw Error('Passed in FFT bins were incorrect size. Expected ' + this.fftSize + ' but was ' + fft.length);\n }\n var melSpec = this.filterBank.filter(fft),\n melSpecLog = melSpec.map(log),\n melCoef = dct.process(melSpecLog).slice(0, 13)\n return melCoef;\n }", "function triangulate(){\n var tfs = arrTF.slice();\n for (var i = 0; i < tfs.length; i++) {\n var f = tfs[i];\n if(f.length <= 3)continue;\n while(f.length > 3){\n arrE.push([f[0],f[2]]);\n arrTF.push([f[0],f[1],f[2]]);\n f.splice(1, 1);\n }\n arrTF[i] = f;\n }\n}", "triggerFreqShifter() {\n this.freqShifterActive = this.freqShifterActive ? this.freqShifterActive = false : this.freqShifterActive = true;\n\n if (this.freqShifterActive) {\n this.player.connect(this.freqShifter);\n this.freqShifter.wet.rampTo(1, 0.1);\n this.volOut.volume.rampTo(-20, 0.5);\n this.shifterLoop = new Tone.Loop((time) => this.shifterLFO(), 0.01); // calls below function every 0.01 seconds\n this.shifterLoop.start();\n /*\n this.player.connect(this.freqShifter);\n this.freqShifter.wet.rampTo(1, 0.1);\n this.freqShifterLFO.start();\n */\n }\n\n else {\n this.freqShifter.wet.rampTo(0, 0.1);\n this.player.disconnect(this.freqShifter);\n this.volOut.volume.rampTo(-0, 0.5);\n this.shifterLoop.stop();\n this.freqShifterGoingDown = true;\n\n this.freqShifter.pitch = 0;\n\n this.freqShifterParamTrackActive = false;\n this.freqShifterParamTrackActive_Y = false;\n /*\n this.freqShifter.wet.rampTo(0, 0.1);\n this.player.disconnect(this.freqShifter);\n this.freqShifterParamTrack.wet.rampTo(0, 0.1);\n this.freqShifterParamTrackActive = false;\n this.freqShifterParamTrackActive_Y = false;\n */\n }\n }", "function xu(t) {\n t.Wh.forEach((function(t) {\n t.next();\n }));\n}", "function mdct_short(inout, inoutPos) {\n\t\tfor (var l = 0; l < 3; l++) {\n\t\t\tvar tc0, tc1, tc2, ts0, ts1, ts2;\n\n\t\t\tts0 = inout[inoutPos + 2 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t- inout[inoutPos + 5 * 3];\n\t\t\ttc0 = inout[inoutPos + 0 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t- inout[inoutPos + 3 * 3];\n\t\t\ttc1 = ts0 + tc0;\n\t\t\ttc2 = ts0 - tc0;\n\n\t\t\tts0 = inout[inoutPos + 5 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t+ inout[inoutPos + 2 * 3];\n\t\t\ttc0 = inout[inoutPos + 3 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t+ inout[inoutPos + 0 * 3];\n\t\t\tts1 = ts0 + tc0;\n\t\t\tts2 = -ts0 + tc0;\n\n\t\t\ttc0 = (inout[inoutPos + 1 * 3] * win[Encoder.SHORT_TYPE][1] - inout[inoutPos + 4 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tts0 = (inout[inoutPos + 4 * 3] * win[Encoder.SHORT_TYPE][1] + inout[inoutPos + 1 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 0] = tc1 * 1.907525191737280e-11 + tc0;\n\t\t\t/*\n\t\t\t * tritab_s[ 2 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 5] = -ts1 * 1.907525191737280e-11 + ts0;\n\t\t\t/*\n\t\t\t * tritab_s[0 ]\n\t\t\t */\n\t\t\ttc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 2]\n\t\t\t */\n\t\t\tts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;\n\t\t\tinout[inoutPos + 3 * 1] = tc2 - ts1;\n\t\t\tinout[inoutPos + 3 * 2] = tc2 + ts1;\n\n\t\t\ttc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;\n\t\t\tts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 0]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 3] = tc1 + ts2;\n\t\t\tinout[inoutPos + 3 * 4] = tc1 - ts2;\n\n\t\t\tinoutPos++;\n\t\t}\n\t}", "function mdct_short(inout, inoutPos) {\n\t\tfor (var l = 0; l < 3; l++) {\n\t\t\tvar tc0, tc1, tc2, ts0, ts1, ts2;\n\n\t\t\tts0 = inout[inoutPos + 2 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t- inout[inoutPos + 5 * 3];\n\t\t\ttc0 = inout[inoutPos + 0 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t- inout[inoutPos + 3 * 3];\n\t\t\ttc1 = ts0 + tc0;\n\t\t\ttc2 = ts0 - tc0;\n\n\t\t\tts0 = inout[inoutPos + 5 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t+ inout[inoutPos + 2 * 3];\n\t\t\ttc0 = inout[inoutPos + 3 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t+ inout[inoutPos + 0 * 3];\n\t\t\tts1 = ts0 + tc0;\n\t\t\tts2 = -ts0 + tc0;\n\n\t\t\ttc0 = (inout[inoutPos + 1 * 3] * win[Encoder.SHORT_TYPE][1] - inout[inoutPos + 4 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tts0 = (inout[inoutPos + 4 * 3] * win[Encoder.SHORT_TYPE][1] + inout[inoutPos + 1 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 0] = tc1 * 1.907525191737280e-11 + tc0;\n\t\t\t/*\n\t\t\t * tritab_s[ 2 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 5] = -ts1 * 1.907525191737280e-11 + ts0;\n\t\t\t/*\n\t\t\t * tritab_s[0 ]\n\t\t\t */\n\t\t\ttc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 2]\n\t\t\t */\n\t\t\tts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;\n\t\t\tinout[inoutPos + 3 * 1] = tc2 - ts1;\n\t\t\tinout[inoutPos + 3 * 2] = tc2 + ts1;\n\n\t\t\ttc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;\n\t\t\tts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 0]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 3] = tc1 + ts2;\n\t\t\tinout[inoutPos + 3 * 4] = tc1 - ts2;\n\n\t\t\tinoutPos++;\n\t\t}\n\t}", "stepThyratrons() {\n let X2bPtr = this.Xptr[1]-1;\n if (X2bPtr===0) X2bPtr = ROTOR_SIZES.X2;\n let S1bPtr = this.Sptr[0]-1;\n if (S1bPtr===0) S1bPtr = ROTOR_SIZES.S1;\n\n // Get Chi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let X5bPtr=this.Xptr[4]-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n X5bPtr=X5bPtr-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n // Get Psi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let S5bPtr=this.Sptr[4]-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n S5bPtr=S5bPtr-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n\n const x2sw = this.limitations.X2;\n const s1sw = this.limitations.S1;\n const p5sw = this.limitations.P5;\n\n // Limitation calculations\n let lim=1;\n if (x2sw) lim = this.rings.X[2][X2bPtr-1];\n if (s1sw) lim = lim ^ this.rings.S[1][S1bPtr-1];\n\n // P5\n if (p5sw) {\n let p5lim = this.P5Zbit[1];\n p5lim = p5lim ^ this.rings.X[5][X5bPtr-1];\n p5lim = p5lim ^ this.rings.S[5][S5bPtr-1];\n lim = lim ^ p5lim;\n }\n\n const basicmotor = this.rings.M[2][this.Mptr[0]-1];\n this.totalmotor = basicmotor;\n\n if (x2sw || s1sw) {\n if (basicmotor===0 && lim===1) {\n this.totalmotor = 0;\n } else {\n this.totalmotor = 1;\n }\n }\n\n // Step Chi rotors\n for (let r=0; r<5; r++) {\n this.Xptr[r]++;\n if (this.Xptr[r] > ROTOR_SIZES[\"X\"+(r+1)]) this.Xptr[r] = 1;\n }\n\n if (this.totalmotor) {\n // Step Psi rotors\n for (let r=0; r<5; r++) {\n this.Sptr[r]++;\n if (this.Sptr[r] > ROTOR_SIZES[\"S\"+(r+1)]) this.Sptr[r] = 1;\n }\n }\n\n // Move M37 rotor if M61 set\n if (this.rings.M[1][this.Mptr[1]-1]===1) this.Mptr[0]++;\n if (this.Mptr[0] > ROTOR_SIZES.M37) this.Mptr[0]=1;\n\n // Always move M61 rotor\n this.Mptr[1]++;\n if (this.Mptr[1] > ROTOR_SIZES.M61) this.Mptr[1]=1;\n }", "function ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function frameLooper() {\n window.requestAnimationFrame(frameLooper); // recursive yaaay, for looping\n // fbc_array is our actual frequency/amplitude array\n // having access to this will be key to split up later\n fbc_array = new Uint8Array(analyser.frequencyBinCount);\n\n analyser.getByteFrequencyData(fbc_array);\n ctx.clearRect(0, 0, canvas.width, canvas.height); // clear the canvas every loop\n ctx.fillStyle = '#00CCFF'; // color of the bars. I chose sky blue\n bars = 128; // how many bars to render. 128 might make the most sense.\n // fbc_array.length == 1024, so each bar represents 8 frequencies\n\n for(var i = 0; i < bars; i++){\n bar_x = i * 2; // each bar is 3 units apart on the x axis\n bar_width = 1; // each bar is 2 units wide. 0-1 is a bar, 2 is not, 3-4 is a bar, etc. But this is based on the width of the canvas\n bar_height = -(fbc_array[i] / 2); // frequency data, of the current index. The amplitude\n\n // amps[0].text = fbc_array[0]; // not working\n\n // here I'm finding out stuff about the bar_height\n // barH.innerHTML = fbc_array; // this is a simple trick for now, but I want to make a 32x32 grid, and loop over it and fill the number (amp) into each of them\n // Doing this at every frame makes everything lag, so idk if I'll have to comment out the *BAR* visualization for testing purposes. Then I'll make a grid of the array, change the color of the text as it increases, and that'll be my new visualisation.\n\n // fillRect(x, y, width, height) // explanation of the parameters below\n ctx.fillRect(bar_x, canvas.height, bar_width, bar_height); // this draws the bars themselves\n }\n\n\n // Table visualization\n for(var j = 0; j < fbc_array.length; j++){\n amps[j].innerHTML = fbc_array[j];\n // styling is gonna be difficult\n // amps[j].css({\"background-color\":`rgb(0,${j}, ${j})`});\n }\n\n}", "_AMDF(buf, sampleRate) {\n var SIZE = buf.length; // set SIZE variable equal to buffer length 4096 => half a second\n var MAX_SAMPLES = Math.floor(SIZE / 2); // set MAX_SAMPLES = 4096/2 = 2048\n var best_offset = -1; // initialise best_offset to -1\n var best_correlation = 0; // initialise best_correlation to 0\n var rms = 0; // initialise rms to 0 (rms => root-mean-square)\n var foundGoodCorrelation = false; // initialise foundGoodCorrelation flag to false\n var correlations = new Array(MAX_SAMPLES); // create an array variable called correlations of size MAX_SAMPLES (2048)\n\n for (var i = 0; i < SIZE; i++) {\n var val = buf[i]; // val is equal to the (i)th value in the array\n rms += val * val; // rms is the summation of each value squared\n }\n rms = Math.sqrt(rms / SIZE); // set rms equal to the square root of rms/SIZE (square root of the average)\n if (rms < 0.01) // not enough signal\n return -1;\n\n var lastCorrelation = 1; // initialise lastCorrelation to 1 so that the first check won't be the best correlation\n for (var offset = 52; offset < 160; offset++) { // offset initialised to 52, goes through a for loop from 52 to 160, which will cover the notes that Singphony can render\n var correlation = 0; // re-set correlation to 0 at each offset value\n\n for (var i = 0; i < MAX_SAMPLES; i++) { // cycle through from 0 to 2048\n correlation += Math.abs((buf[i]) - (buf[i + offset])); // step through at each value and subtract the value at the offset from the value in the original buffer and keep adding that to the correlation value\n } // correlation will be a large enough positive float\n\n correlation = 1 - (correlation / MAX_SAMPLES); // set correlation to 1 - correlation/512\n correlations[offset] = correlation; // store it, for the tweaking we need to do below.\n if ((correlation > this.GOOD_ENOUGH_CORRELATION) && (correlation > lastCorrelation)) { // if the correlation value is higher than 0.9 and the previous correlation value\n foundGoodCorrelation = true; // set foundGoodCorrelation flag to true\n if (correlation > best_correlation) { //\n best_correlation = correlation; // update the best_correlation value to the latest correlation value\n best_offset = offset; // update best_offset to the latest offset value\n }\n } else if (foundGoodCorrelation) {\n // short-circuit - we found a good correlation, then a bad one, so we'd just be seeing copies from here.\n return sampleRate / best_offset;\n }\n lastCorrelation = correlation; // set lastCorrelation to latest correlation\n }\n return -1;\n }", "function sha1_ft(t, b, c, d)\r\n{\r\n if(t < 20) return (b & c) | ((~b) & d);\r\n if(t < 40) return b ^ c ^ d;\r\n if(t < 60) return (b & c) | (b & d) | (c & d);\r\n return b ^ c ^ d;\r\n}", "function calculateNext(data) {\n\n var alpham, betam, alphah, betah, alphaj, betaj, alphaoa,\n betaoa, alphaoi, betaoi, alphaua, betaua, alphaui, betaui, alphaxr, betaxr, alphaxs, betaxs,\n temp, xnaca11, xnaca21;\n\n var exptaum_t, xinfm_t, exptauh_t, xinfh_t, exptauj_t, xinfj_t, \n xk1t_t, exptauoa_t, xinfoa_t, exptauoi_t, xinfoi_t, exptauua_t, xinfua_t, exptauui_t, xinfui_t, xkurcoeff_t, xkrcoeff_t, \n exptaud_t, xinfd_t, exptauf_t, xinff_t, xnakt_t, xnaca1_t, \n xnaca2_t, exptauw_t, xinfw_t;\n\n /* moved to settings as previous value required \n exptauxr_t, xinfxr_t, exptauxs_t, xinfxs_t*/\n\n var xinffca_t , xpcat_t, ecat_t, xupt_t, carow2_t;\n\n var xinfut_t, exptauvt_t, xinfvt_t; \n\n var xstim, eca, xinfm1, exptaum1, xinfh1, exptauh1, xinfj1, exptauj1,\n xinfoa1, exptauoa1, xinfoi1, exptauoi1,\n xinfua1, exptauua1, xinfui1, exptauui1, xkurcoeff1,\n xinfxr1, exptauxr1, xkrcoeff1,\n xinfxs1, exptauxs1,\n xinfd1, exptaud1, xinff1, exptauf1, xinffca1,\n xinfu, exptauv, xinfv, xinfw1, exptauw1,\n xtr, xup, xupleak,\n di_ups, carow21; \n\n //calculations start\n //\n\n alpham = (Math.abs( cS.v + 47.13) < 1e-5) ? 3.2 : 0.32 * ( cS.v + 47.13 )/( 1.- Math.exp(-0.1*( cS.v + 47.13 ) ) );\n\n betam = 0.08 * Math.exp (- cS.v /11.);\n\n alphah = ( cS.v > -40.0 ) ? 0.0 : 0.135 * Math.exp(-( cS.v+80.0)/6.8); \n\n betah = ( cS.v > -40.0 ) ? 1.0/ (0.13 * (1.0 + Math.exp (-( cS.v + 10.66)/11.1))) \n : 3.56 * Math.exp ( 0.079 * cS.v ) + 3.1e5 * Math.exp(0.35 * cS.v); \n\n alphaj = ( cS.v > -40.0 ) ? 0.0 \n : (-127140 * Math.exp(0.2444 * cS.v)-3.474e-5 * Math.exp(-0.04391 * cS.v)) * ( cS.v + 37.78)/(1. + Math.exp (0.311 * ( cS.v + 79.23))); \n\n betaj = ( cS.v > -40.0 ) ? 0.3 * Math.exp(-2.535e-7 * cS.v)/(1.+Math.exp(-0.1 * ( cS.v+32.))) \n : 0.1212 * Math.exp(-0.01052 * cS.v)/(1.+Math.exp(-0.1378 * ( cS.v+40.14))); \n\n alphaoa = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaoa = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) );\n\n alphaoi = 1.0 / ( 18.53 + Math.exp ( ( cS.v + 113.7 ) / 10.95 ) );\n\n betaoi = 1.0 / ( 35.56 + Math.exp ( - ( cS.v + 1.26 ) / 7.44 ) ); \n\n alphaua = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaua = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) ); \n\n alphaui = 1.0 / ( 21. + Math.exp ( - ( cS.v-185. ) / 28. ) ) ; \n\n betaui = Math.exp ( ( cS.v-158. ) / 16. ); \n\n alphaxr = 0.0003* ( cS.v + 14.1 ) / ( 1.- Math.exp ( - ( cS.v + 14.1 ) / 5. ) ); \n\n betaxr = 7.3898e-5* ( cS.v-3.3328 ) / ( Math.exp ( ( cS.v-3.3328 ) / 5.1237 ) -1. ); \n\n alphaxs = 4e-5* ( cS.v-19.9 ) / ( 1.- Math.exp ( - ( cS.v-19.9 ) / 17. ) ); \n\n betaxs = 3.5e-5* ( cS.v-19.9 ) / ( Math.exp ( ( cS.v-19.9 ) / 9. ) -1. );\n\n //table variables depending on V\n\n exptaum_t = Math.exp(- cS.timestep*(alpham+betam));\n\n xinfm_t = alpham/(alpham+betam);\n\n exptauh_t = Math.exp(- cS.timestep*(alphah+betah));\n\n xinfh_t = alphah/(alphah+betah);\n\n exptauj_t = Math.exp(- cS.timestep*(alphaj+betaj));\n\n xinfj_t = alphaj/(alphaj+betaj);\n\n xk1t_t = cS.gk1*( cS.v- cC.ek)/(1.+Math.exp(0.07*( cS.v + 80.)));\n\n exptauoa_t = Math.exp(- cS.timestep*((alphaoa+betaoa)* cS.xkq10));\n\n xinfoa_t = 1.0/(1.+Math.exp(-( cS.v+20.47)/17.54));\n\n exptauoi_t = Math.exp(- cS.timestep*((alphaoi+betaoi)* cS.xkq10));\n\n xinfoi_t = 1.0/(1.+Math.exp(( cS.v+43.1)/5.3));\n\n exptauua_t = Math.exp(- cS.timestep*((alphaua+betaua)* cS.xkq10));\n\n xinfua_t = 1.0/(1.+Math.exp(-( cS.v+30.3)/9.6));\n\n exptauui_t = Math.exp(- cS.timestep*((alphaui+betaui)* cS.xkq10));\n\n xinfui_t = 1.0/(1.+Math.exp(( cS.v-99.45)/27.48));\n\n xkurcoeff_t = (0.005+0.05/(1.+Math.exp(-( cS.v-15.)/13.)))*( cS.v- cC.ek);\n\n\n if(!((Math.abs( cS.v+14.1) < 1e-5) || (Math.abs( cS.v-3.3328)<1e-5))){\n cS.exptauxr_t = Math.exp(- cS.timestep*(alphaxr+betaxr));\n cS.xinfxr_t = 1.0/(1.+Math.exp(-( cS.v+14.1)/6.5));\n }\n\n xkrcoeff_t = cS.gkr*( cS.v- cC.ek)/(1.+Math.exp(( cS.v+15.)/22.4));\n\n if(!(Math.abs( cS.v-19.9) < 1e-5)){\n cS.exptauxs_t = Math.exp(- cS.timestep/0.5*(alphaxs+betaxs));\n cS.xinfxs_t = 1.0/Math.sqrt(1.+Math.exp(-( cS.v-19.9)/12.7));\n }\n\n //temp varaible used for calculations\n temp = (1.0-Math.exp(-( cS.v+10.)/6.24))/(0.035*( cS.v+10.)* (1.+Math.exp(-( cS.v+10.)/6.24)));\n\n if(Math.abs( cS.v+10) < 1e-5){\n exptaud_t = 2.2894;\n exptauf_t = 0.9997795;\n }\n else{\n exptaud_t = Math.exp(- cS.timestep/temp); \n exptauf_t = Math.exp(- cS.timestep/9.*(0.0197*Math.exp(Math.pow(-(0.0337 *( cS.v+10.)), 2))+0.02));\n }\n\n xinfd_t = 1.0/(1.+Math.exp(-( cS.v+10.)/8.));\n\n xinff_t = 1.0/(1.+Math.exp(( cS.v+28.)/6.9));\n\n xnakt_t = (1.0/(1.+0.1245*Math.exp(-0.1* cS.v/ cC.rtof)+0.0365* cC.sigma*Math.exp(- cS.v/ cC.rtof)))* cS.xinakmax/(1.+(Math.pow(( cS.xkmnai/ cS.cnai),1.5)))*( cS.cko/( cS.cko+ cS.xkmko));\n\n xnaca1_t = cS.xinacamax*Math.exp( cS.gamma* cS.v/ cC.rtof)*(Math.pow( cS.cnai,3))* cS.ccao/((Math.pow( cS.xkmna,3)+ Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)));\n\n xnaca2_t = cS.xinacamax*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)/((Math.pow( cS.xkmna,3) + Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof))); \n\n temp = 6.0*(1.-Math.exp(-( cS.v-7.9)/5.))/((1.+0.3*Math.exp(-( cS.v-7.9)/5.))*( cS.v-7.9)); \n\n exptauw_t = Math.exp(- cS.timestep/temp);\n\n xinfw_t = 1.0-1.0/(1.+Math.exp(-( cS.v-40.)/17.));\n\n //table variables depending on ca\n\n xinffca_t = 1.0/(1.+ cS.ccai/0.00035);\n xpcat_t = cS.xipcamax* cS.ccai/(0.0005+ cS.ccai);\n ecat_t = cC.rtof*0.5*Math.log( cS.ccao/ cS.ccai);\n xupt_t = cS.xupmax/(1.+ cS.xkup/ cS.ccai);\n carow2_t = ( cS.trpnmax* cS.xkmtrpn/( cS.ccai+ cS.xkmtrpn)/( cS.ccai+ cS.xkmtrpn) + cS.cmdnmax* cS.xkmcmdn/( cS.ccai+ cS.xkmcmdn)/( cS.ccai+ cS.xkmcmdn)+1.)/ cC.c_b1c;\n\n //table variables depending on fn\n /* fnlo=-0.2,fnhi=2.3,nfnt=2500\n dfntable=(fnhi-fnlo)/float(nfnt)\n fn=fnlo+i*dfntable\n */\n xinfut_t = 1.0/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n temp = 1.91+2.09/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n exptauvt_t = Math.exp(- cS.timestep/temp);\n\n xinfvt_t = 1.-1.0/(1.+ Math.exp(-( cS.fn-6.835e-14)/13.67e-16));\n\n\n // table loop starts here\n\n xstim = _s1s2Stimulus(count, data);\n\n //c equilibrium potentials\n eca = ecat_t;\n\n //c fast sodium current\n xinfm1 = xinfm_t;\n exptaum1 = exptaum_t;\n xinfh1 = xinfh_t;\n exptauh1 = exptauh_t;\n xinfj1 = xinfj_t;\n exptauj1 = exptauj_t;\n\n cS.xm = xinfm1 + ( cS.xm - xinfm1) * exptaum1;\n cS.xh = xinfh1 + ( cS.xh - xinfh1) * exptauh1;\n cS.xj = xinfj1 + ( cS.xj - xinfj1) * exptauj1; \n cS.xna = cS.xm * cS.xm * cS.xm * cS.xh * cS.xj * cS.gna *( cS.v - cC.ena);\n\n //c time-independent k+ current\n cS.xk1 = xk1t_t;\n\n //c transient outward k+ current\n xinfoa1 = xinfoa_t;\n exptauoa1 = exptauoa_t;\n xinfoi1 = xinfoi_t;\n exptauoi1 = exptauoi_t;\n\n cS.xoa = xinfoa1+( cS.xoa-xinfoa1)*exptauoa1;\n cS.xoi = xinfoi1+( cS.xoi-xinfoi1)*exptauoi1;\n cS.xto = cS.xoa* cS.xoa* cS.xoa* cS.xoi* cS.gto*( cS.v - cC.ek);\n\n //c ultrarapid delayed rectifier k+ current\n xinfua1 = xinfua_t;\n exptauua1 = exptauua_t;\n xinfui1 = xinfui_t;\n exptauui1 = exptauui_t;\n xkurcoeff1= xkurcoeff_t;\n\n cS.xua = xinfua1+( cS.xua-xinfua1)*exptauua1;\n cS.xui = xinfui1+( cS.xui-xinfui1)*exptauui1;\n cS.xkur = cS.xua* cS.xua* cS.xua* cS.xui*xkurcoeff1;\n\n //c rapid delayed outward rectifier k+ current\n xinfxr1 = cS.xinfxr_t;\n exptauxr1 = cS.exptauxr_t;\n xkrcoeff1 = xkrcoeff_t;\n\n cS.xr = xinfxr1+( cS.xr-xinfxr1)*exptauxr1;\n cS.xkr = cS.xr*xkrcoeff1;\n\n //c slow delayed outward rectifier k+ current\n xinfxs1 = cS.xinfxs_t;\n exptauxs1 = cS.exptauxs_t;\n\n cS.xs = xinfxs1+( cS.xs-xinfxs1)*exptauxs1;\n cS.xks = cS.xs* cS.xs* cS.gks*( cS.v- cC.ek);\n\n //c L-tpe ca2+ current\n xinfd1 = xinfd_t;\n exptaud1 = exptaud_t;\n xinff1 = xinff_t;\n exptauf1 = exptauf_t;\n xinffca1 = xinffca_t;\n\n cS.xd = xinfd1+( cS.xd-xinfd1)*exptaud1;\n cS.xf = xinff1+( cS.xf-xinff1)*exptauf1;\n cS.xfca = xinffca1+( cS.xfca-xinffca1)* cC.exptaufca;\n cS.xcal = cS.xd* cS.xf* cS.xfca* cS.gcal*( cS.v-65.0);\n\n //xnak, xnaca, xbca, xbna, xpca; \n\n //cc na+/k+ pump current\n cS.xnak = xnakt_t;\n\n //c na+/ca2+ exchanger current\n xnaca11 = xnaca1_t;\n xnaca21 = xnaca2_t;\n cS.xnaca = xnaca11 - xnaca21* cC.cnao3* cS.ccai;\n\n //cc background currents\n cS.xbca = cS.gbca * ( cS.v - eca);\n\n cS.xbna = cS.gbna * ( cS.v - cC.ena);\n\n //c ca2+ pump current\n cS.xpca = xpcat_t;\n\n /*c ca2+ release current from JSR\n c correction: divide first fn term by cm, multiply second fn term by cm\n c then to ensure computational accuracy (no problems with tiny numbers),\n c divide fn by 1e-12 and adjust functions accordingly*/\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel- cS.ccai);\n\n cS.fn = cS.vrel/ cS.cm* cS.xrel-0.5 * cS.cm/ cS.xxf*(0.5* cS.xcal-0.2* cS.xnaca);\n\n xinfu = xinfut_t;\n exptauv = exptauvt_t;\n xinfv = xinfvt_t;\n\n cS.xu = xinfu+( cS.xu-xinfu)* cC.exptauu;\n cS.xv = xinfv+( cS.xv-xinfv)*exptauv;\n\n xinfw1 = xinfw_t;\n exptauw1 = exptauw_t;\n\n cS.xw = xinfw1+( cS.xw-xinfw1)*exptauw1;\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel - cS.ccai);\n\n // c transfer current from NSR to JSR\n xtr = ( cS.ccaup - cS.ccarel)/ cS.tautr;\n\n // c ca2+ uptake current by the NSR\n xup = xupt_t;\n\n // c ca2+ leak current by the NSR\n xupleak = cS.ccaup* cS.xupmax/ cS.ccaupmax;\n\n //c intracellular ion concentrations\n di_ups = xup-xupleak;\n carow21 = carow2_t;\n cS.ccai = cS.ccai + cS.timestep * ( cC.c_b1d*( cS.xnaca + cS.xnaca - cS.xpca - cS.xcal - cS.xbca)- cC.c_b1e* di_ups + cS.xrel) / carow21; \n cS.ccaup = cS.ccaup + cS.timestep * (xup - xupleak-xtr*( cS.vrel/ cS.vup));\n cS.ccarel = cS.ccarel + cS.timestep * ((xtr - cS.xrel)/ (1.+( cS.csqnmax* cS.xkmcsqn)/(Math.pow(( cS.ccarel+ cS.xkmcsqn),2))));\n\n //console.log( cS.xna , cS.xk1 , + cS.xkur + cS.xto , cS.xkur , cS.xkr , cS.xks , cS.xcal , cS.xpca , cS.xnak, cS.xnaca, cS.xbna, cS.xbca-xstim);\n \n cS.v = cS.v - cS.timestep * ( cS.xna + cS.xk1 + cS.xto + cS.xkur + cS.xkr + cS.xks + cS.xcal + cS.xpca + cS.xnak + cS.xnaca + cS.xbna + cS.xbca - xstim);\n\n // table loop ends\n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n\n // iterate the count\n count++;\n\n return data; \n }", "function makeSamples(groove, color, data){\n\n\tvar oneSecond = 44100;\n\tvar loop = false;\n\tvar repeats = 4;\n\tvar repeated = 0;\n\tvar PI = Math.PI;\n\n\tvar maxSamples = (groove.duration * oneSecond ) / 1000 ;\t\n var instrumentType = \"sin\";\n var delay = false;\n if (color == 0) {\n\tdelay = true;\n } \n else if (color == 1) {\n } \n else if (color == 2) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 3) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 4) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 5) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 6) {\n\tinstrumentType = \"sqr\";\n\tdelay = true;\n } \n else if (color == 7) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 8) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 9) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 10) {\n\tinstrumentType = \"saw\";\n } \n\n var freqs = data[0];\n var times = data[1];\n\tdebugfreqs = freqs;\n \tdebugtimes = times;\n\n var samples = [];\n ii = 0;\n var tcounter = 0;\n for (var j = 0; j < freqs.length - 1; j++) {\n\t\tif (j == 0 && times[0] > groove.startLine){\n\t\t\tvar freqDur = times[j] / groove.lineLength;\n\t \n\t\t\tfreqDur = freqDur * groove.duration;\n\t\t\tfreqDur = freqDur * 44100;\n\t\t\tfreqDur = Math.floor(freqDur / 1000);\n\t \n\t \tfor (var i = 0; i < freqDur; i++) {\n\t \t var t = i / oneSecond; \n\t \t samples[ii] = 0;\n\t \t ii++;\n\t\t }\n\t\t}\n var frequency = freqs[j];\n//\tif (freqs.length > j + 1 && freqs[j + 1] == 0){\n//\t\tfrequency = 0;\n//\t}\n\n var freqDur = times[j + 1] / groove.lineLength;\n \n freqDur = freqDur * groove.duration;\n freqDur = freqDur * 44100;\n freqDur = Math.floor(freqDur / 1000);\n\n// \tfor (var i = 0; i < freqDur; i++){\n\t\tvar i = 0;\n while (true){\n var t = i / oneSecond; // time from 0 to 1\n if (frequency == 0){\n samples[ii] = 0;\n }\n\t\t else if (instrumentType == \"sin\"){\n\t\t samples[ii] = Math.sin(frequency * 2 * PI * t); // wave equation (between -1,+1)\n\t\t }\n else if (instrumentType == \"sqr\") {\n\t\t\t if (Math.sin(frequency * 2 * PI * t) > 0){\n\t\t\t\t\tsamples[ii] = 1; } else { samples[ii] = -1;\n\t\t\t\t}\n\t\t }\n else if (instrumentType == \"saw\") {\n \tsamples[ii] = 1 - ((frequency*t)%1);\n\t\t }\n samples[ii] = samples[ii] * 0.25;\n\n\t\t\tif (i >= freqDur){\n\t\t\t\tif (instrumentType == \"sin\"){\n\t\t\t\t\tif (samples[ii] == 0 || (samples[ii -1] < samples[ii] && samples[ii] < 0.01 && samples[ii] > -0.01)){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\n\t\t\t}\n ii++;\n if (maxSamples > 0 && ii >= maxSamples){\n\t\t\t\tbreak;\n\t\t }\n\t\t i++;\n }\n if (maxSamples > 0 && ii >= maxSamples){\n\t\t\tbreak;\n\t }\n }\n if (maxSamples == 0){\n\t\tmaxSamples = ii;\n }\n else {\n\t\twhile (ii < maxSamples){\n\t \t\tsamples[ii] = 0;\n\t \tii++;\n\t\t}\n }\n//\tdocument.write(ii);\n//\tdocument.write(\"<br/>\");\n// var delayLine = new Array;\n// var pointer = 0;\n// var delayLength = oneSecond / 2;\n// for (var ijj = 0; ijj < groove.lineLength; ijj++){\n//\t\tdelayLine[ijj] = 0;\n// }\n for (var repeat = 1 ; repeat < repeats; repeat++){\n for (var jj = 0 ; jj < ii ; jj++){\n samples[jj + ii * repeat] = samples[jj];\n\t if (delay){\n//\t\tsamples[jj + ii * repeat] = samples[jj + ii * repeat] - 0.5*delayLine[pointer];\n//\t\tdelayLine[pointer] = samples[jj + ii * repeat];\n//\t\tpointer = (pointer+1)%lineLength;\n }\n\t }\n\t}\n return samples;\n}", "function addEqualiser() {\n\n var gainDb = -40.0; // atenuation When it takes a positive value it is a real gain, when negative it is an attenuation. It is expressed in dB, has a default value of 0 and can take a value in a nominal range of -40 to 40.\n var bandSplit = [360, 3600];\n context_player = new AudioContext();\n\n for (var i = 0; i < 2; i++) {\n\n mediaElement_player.push(null);\n sourceNode_player.push(null);\n source_player.push(null);\n lGain_player.push(null);\n mGain_player.push(null);\n hGain_player.push(null);\n sum_player.push(null);\n volumeNodes.push(null);\n\n\n mediaElement_player[i] = document.getElementById('jp_audio_' + i);\n source_player[i] = context_player.createMediaElementSource(mediaElement_player[i]);\n\n initFrequencyQuality(i);\n\n // affects the ammount of treble in a sound - treble knob - atenuates the sounds below the 3600 frequencies\n var lBand_player = context_player.createBiquadFilter();\n lBand_player.type = \"lowshelf\";\n lBand_player.frequency.value = bandSplit[1];\n lBand_player.gain.value = gainDb;\n\n // affects the ammount of bass in a sound - bass knob - atenuates the sounds higher than 360 frequencies\n var hBand_player = context_player.createBiquadFilter();\n hBand_player.type = \"highshelf\";\n hBand_player.frequency.value = bandSplit[0];\n hBand_player.gain.value = gainDb;\n\n var hInvert_player = context_player.createGain();\n hInvert_player.gain.value = -1.0;\n\n //Subtract low and high frequencies (add invert) from the source for the mid frequencies\n var mBand_player = context_player.createGain();\n\n //or use picking\n //mBand_player = context_player.createBiquadFilter();\n //mBand_player.type = \"peaking\";\n //mBand_player.frequency.value = bandSplit[0];\n //mBand_player.gain.value = gainDb;\n\n var lInvert_player = context_player.createGain();\n lInvert_player.gain.value = -1.0;\n\n sourceNode_player[i].connect(lBand_player);\n sourceNode_player[i].connect(mBand_player);\n sourceNode_player[i].connect(hBand_player);\n\n hBand_player.connect(hInvert_player);\n lBand_player.connect(lInvert_player);\n\n hInvert_player.connect(mBand_player);\n lInvert_player.connect(mBand_player);\n\n\n lGain_player[i] = context_player.createGain();\n mGain_player[i] = context_player.createGain();\n hGain_player[i] = context_player.createGain();\n\n lBand_player.connect(lGain_player[i]);\n mBand_player.connect(mGain_player[i]);\n hBand_player.connect(hGain_player[i]);\n\n sum_player[i] = context_player.createGain();\n lGain_player[i].connect(sum_player[i]);\n mGain_player[i].connect(sum_player[i]);\n hGain_player[i].connect(sum_player[i]);\n\n lGain_player[i].gain.value = 1;\n mGain_player[i].gain.value = 1;\n hGain_player[i].gain.value = 1;\n\n volumeNodes[i] = context_player.createGain();\n sum_player[i].connect(volumeNodes[i]);\n volumeNodes[i].connect(context_player.destination);\n }\n\n //set volume\n var x = 50 / 100;\n // Use an equal-power crossfading curve:\n var gain1 = Math.cos(x * 0.5 * Math.PI);\n var gain2 = Math.cos((1.0 - x) * 0.5 * Math.PI);\n volumeNodes[0].gain.value = gain1;\n volumeNodes[1].gain.value = gain2;\n\n //create audio Recording node\n audioRecordNode = context_player.createGain();\n volumeNodes[0].connect(audioRecordNode);\n volumeNodes[1].connect(audioRecordNode);\n audioRecorder = new Recorder(audioRecordNode);\n}", "function sha1_ft(t, b, c, d) {\n if (t < 20) return (b & c) | ((~b) & d);\n if (t < 40) return b ^ c ^ d;\n if (t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}", "function setupAudioNodes(audioContext, drawWaveformFunction, drawSpectrumFunction, drawSpectrogramFunction, htmlIds, colorScale)\n{\n // Setup a script node\n let scriptNode = audioContext.createScriptProcessor();\n // Connect to destination\n scriptNode.connect(audioContext.destination);\n \n // Setup an analyzer\n let analyser = audioContext.createAnalyser();\n analyser.smoothingTimeConstant = 0;\n // Higher FFT size means more bins. More bins mean more points to graph.\n // Also means each bin has a smaller range of frequencies so it's kind of like more precise.\n analyser.fftSize = 2048 * 2;\n \n // Create a buffer source node\n let sourceNode = audioContext.createBufferSource();\n sourceNode.connect(analyser);\n analyser.connect(scriptNode);\n \n sourceNode.connect(audioContext.destination);\n \n console.log(\"Sample rate: \" + audioContext.sampleRate + \" Hz\");\n console.log(\"FFT size: \" + analyser.fftSize);\n // FrequencyBinCount is half of FFT size\n console.log(\"FrequencyBinCount: \" + analyser.frequencyBinCount);\n \n let frequencyPerBin = (audioContext.sampleRate / 2) / analyser.frequencyBinCount;\n console.log(\"Each frequency bin represents \" + frequencyPerBin + \" Hz of range\");\n console.log(\"frequencyData[0]\" + \" is the strength of frequencies from \" + (0 * frequencyPerBin) + \" Hz to \" + ((0 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[1]\" + \" is the strength of frequencies from \" + (1 * frequencyPerBin) + \" Hz to \" + ((1 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[2]\" + \" is the strength of frequencies from \" + (2 * frequencyPerBin) + \" Hz to \" + ((2 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[\" + (analyser.frequencyBinCount - 1) + \"]\" + \" is the strength of frequencies from \" + (analyser.frequencyBinCount - 1) * frequencyPerBin + \" Hz to \" + (((analyser.frequencyBinCount - 1) + 1) * frequencyPerBin) + \" Hz\");\n \n // When the script node is called we use information from the analyzer node to draw\n scriptNode.onaudioprocess = function()\n {\n let frequencyData = new Uint8Array(analyser.frequencyBinCount);\n analyser.getByteFrequencyData(frequencyData);\n \n let timeDomainData = new Uint8Array(analyser.frequencyBinCount);\n analyser.getByteTimeDomainData(timeDomainData);\n \n if (sourceNode.buffer !== null)\n {\n //console.log(frequencyData);\n //console.log(timeDomainData);\n drawWaveformFunction(timeDomainData, htmlIds.waveformCanvas, colorScale);\n drawSpectrumFunction(frequencyData, htmlIds.spectrumCanvas, colorScale);\n drawSpectrogramFunction(frequencyData, htmlIds.spectrogramCanvas, colorScale);\n }\n }\n \n return sourceNode;\n}", "function draw(data)\n{\n var spectrum = []; // an array that will hold noise cancelled data\n var i, x, L=0, ldata=0, nBins=0, binNum=0, c=0; // uint8\n var minLvl, maxLvl; //uint\n var level, y, sum; //int\n var offsetIndex = 0;\n var FFT_N = 128; //data.length;\n\n samplePos = 0;\n // Remove noise and apply EQ levels\n for(x=0; x < FFT_N/2; x++ ) {\n L = noise[x];\n spectrum[x] = data[x+ offsetIndex];\n if ( spectrum[x] < L ) {\n spectrum[x] = 0;\n } else {\n spectrum[x] = ((spectrum[x] - L) * (256 - eq[x] >> peakHeight));\n }\n }\n //fill colors first, then we will erase idle sections.\n for(i=0; i < totalColumns; i++) {\n client.setPixelColor(i, LED_RED); // row 0, RED\n client.setPixelColor(8 + i, LED_BLUE); // Rwo 1, Blue\n client.setPixelColor(16+ i, LED_BLUE); // Row 2, Blue\n client.setPixelColor(24+ i, LED_GREEN); // Row 3, Green\n client.setPixelColor(32+ i, LED_GREEN); // Row 4, Green\n }\n\n for(x=0; x < totalColumns; x++ ) {\n ldata = colData[x];\n nBins = ldata[0] + 2;\n binNum = ldata[1];\n for(sum=0, i=2; i < nBins; i++ ) {\n sum += spectrum[binNum++] * ldata[i]; // Weighted\n colDiv[x] += data[x];\n }\n col[x][colCount] = sum / colDiv[x]; // Average\n minLvl = maxLvl = col[x][0];\n for(i=1; i < totalFrames; i++ ) {\n if(col[x][i] < minLvl) {\n minLvl = col[x][i];\n } else if( col[x][i] > maxLvl ) {\n maxLvl = col[x][i];\n }\n }\n // minLvl and maxLvl indicate the extents of the FFT output, used\n // for vertically scaling the output graph (so it looks interesting\n // regardless of volume level). If they're too close together though\n // (e.g. at very low volume levels) the graph becomes super coarse\n // and 'jumpy'...so keep some minimum distance between them (this\n // also lets the graph go to zero when no sound is playing):\n\n if( maxLvl-minLvl < peakHeight) {\n maxLvl = minLvl + peakHeight;\n }\n minLvAvg[x] = (minLvAvg[x] * 7 + minLvl) >> 3; // Dampen min/max levels\n maxLvAvg[x] = (maxLvAvg[x] * 7 + maxLvl) >> 3; // fake rolling average\n // Second fixed-point scale based on dynamic min/max levels\n level = 10 * (col[x][colCount] - minLvAvg[x]) / parseInt(maxLvAvg[x] - minLvAvg[x]);\n // clip output and convert to byte\n if( level < 0) { c = 0; }\n else if ( level > peakOffTop ) { c = peakOffTop; } // Allow dot to go a few pixels off the top\n else { c = parseInt(level); }\n\n if( c > peak[x] ) { peak[x] = c; } // keep dot on top\n if(peak[x] < 0 ) { // empty the column\n clearColumnLeds(x,peakHeight);\n //continue;\n } else if(c < peakHeight ) { // empty partial column\n clearColumnLeds(x, peakHeight - c);\n }\n // the peak dot color varies but doesn't necessarily match\n // the three screen regions.. yellow has a little more influence.\n y = peakHeight - peak[x];\n\n /******************** DO NOT DELETE **********************/\n /* Save this section for a high Peak Array of LEDs - It is not so useful for 5 pixel High\n if( y < 1 ) { setColumnRowPixelColor(x,y, LED_RED); }\n else if( y < 5 ) { setColumnRowPixelColor(x,y, LED_BLUE); }\n else { setColumnRowPixelColor(x,y, LED_GREEN); }\n */\n /******************** DO NOT DELETE **********************/\n\n }\n client.writePixels();\n\n /******************** Important **************************/\n // Every third frame, make the peak pixels drop by 1:\n if ( ++dotCount >= 3 ) {\n dotCount = 0;\n // reset Averages, col dividers and peaks\n for ( i = 0; i < totalColumns; i++ ) {\n minLvAvg[i] = 0;\n maxLvAvg[i] = 512;\n colDiv[i] = 0;\n //peak[i] = 0; // We are dropping the peaks below\n }\n for ( x = 0; x < peakHeight; x++ ) {\n peak[x] -= (peak[x] > 0) ? 1 : 0; // if peak is above 0, then subtract 1\n }\n // rotate hue over LEDs\n LED_RED = OPC.rotateColor(1, LED_RED);\n LED_BLUE = OPC.rotateColor(1, LED_BLUE);\n LED_GREEN = OPC.rotateColor(1, LED_GREEN);\n }\n // Adjust the Frame Count\n if ( ++colCount >= totalFrames ) {\n colCount = 0;\n }\n\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}" ]
[ "0.6596565", "0.61714965", "0.60477644", "0.6025667", "0.5921966", "0.58883363", "0.58471066", "0.5780482", "0.5777901", "0.57056165", "0.5629252", "0.5589546", "0.557242", "0.5466943", "0.54559976", "0.5343446", "0.53264683", "0.53212196", "0.53055847", "0.5275151", "0.5267552", "0.5250317", "0.5102653", "0.50990796", "0.50930905", "0.5084815", "0.508224", "0.50624067", "0.50604284", "0.50559014", "0.5050557", "0.50390697", "0.50330496", "0.49996087", "0.49986285", "0.49935427", "0.49909884", "0.49909884", "0.49609938", "0.4947724", "0.49457186", "0.4900564", "0.48830053", "0.48729786", "0.4865719", "0.48616993", "0.48505142", "0.48234326", "0.48176217", "0.48152348", "0.48109633", "0.48028553", "0.48028553", "0.48028553", "0.48028553", "0.47309542", "0.47224936", "0.47224936", "0.4708908", "0.47049507", "0.47008523", "0.47008523", "0.47008523", "0.47008523", "0.47008523", "0.46916747", "0.46792063", "0.46654007", "0.4653582", "0.46506783", "0.46466127", "0.46462524", "0.4623433", "0.46098328", "0.46009755", "0.45916352", "0.45905033", "0.45905033", "0.45783153", "0.45766956", "0.45704642", "0.4569603", "0.45622358", "0.45546532", "0.45474714", "0.45388436", "0.45354983", "0.45342526", "0.45318976", "0.45247862", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273", "0.4517273" ]
0.0
-1
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prototype;\n\tsubfn.prototype = new r();\n}", "function Base() {}", "function inherts(child , parent) {\n child.prototype = Object.create(parent.prototype);\n child.prototype.constructor = child;\n}", "function Super () {}", "function Super () {}", "function BaseClass() {}", "function BaseClass() {}", "function inherit(o1, o2){\n\t\to1.prototype = new o2(); //Object.create(o2.prototype);//ie 8 falls over on create\n\t\to1.prototype.constructor = o1;\n\t}", "function Derived() {} // private", "function inherits( obj, name ) {\n return ENV.$Class.Inherits( obj, name );\n }", "function superClass(...args) {}", "function inherit(o){\n if(o === null || (typeof o !== 'object' && typeof o !== 'function')){throw TypeError();}\n if(Object.create) {\n return Object.create(o);\n }else {\n function f(){};\n f.prototype = o;\n return new f();\n }\n}", "__previnit(){}", "function Base() {\n}", "function Child() {}", "function Child() {}", "static inherit(p) {\n if (p == null) throw TypeError('p must be a non-null object'); // p must be a non-null object\n if (Object.create) // If Object.create() is defined...\n return Object.create(p); // then just use it.\n let t = typeof p; // Otherwise do some more type checking\n if (t !== \"object\" && t !== \"function\") throw TypeError('p must be object or function');\n function f() {}; // Define a dummy constructor function.\n f.prototype = p; // Set its prototype property to p.\n return new f(); // Use f() to create an \"heir\" of p.\n }", "function Mixin() {}", "function inherit(sub, base) {\n function Inheriter() { }\n Inheriter.prototype = base.prototype;\n sub.prototype = new Inheriter();\n }", "_init() {\n throw new Error('_init not implemented in child class');\n }", "function inheritsFrom (child, parent) {\n child.prototype = Object.create(parent.prototype);\n //can be used for clone\n}", "function inherits(o) {\n function F() {}\n F.prototype = o;\n return new F();\n}", "function Mixin() {\n\t}", "function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) {\n Object.setPrototypeOf\n ? Object.setPrototypeOf(subClass, superClass)\n : subClass.__proto__ = superClass;\n }\n}", "function inheritsFrom(child, parent) {\n child.prototype = Object.create(parent.prototype);\n}", "function PrototypeBasedClass () {\n}", "function inherit(targ, src) {\n var f = function() {\n if (this.__super__ == f) {\n // add __super__ of parent to front of lookup chain\n // so parent class constructor can call its parent using this.__super__\n this.__super__ = src.prototype.__super__;\n // call parent constructor function. this.__super__ now points to parent-of-parent\n src.apply(this, arguments);\n // remove temp __super__, expose targ.prototype.__super__ again\n delete this.__super__;\n }\n };\n\n f.prototype = src.prototype || src; // added || src to allow inheriting from objects as well as functions\n // Extend targ prototype instead of wiping it out --\n // in case inherit() is called after targ.prototype = {stuff}; statement\n targ.prototype = extend$1(new f(), targ.prototype); //\n targ.prototype.constructor = targ;\n targ.prototype.__super__ = f;\n }", "function inherit(childClass, parentClass) {\r\n childClass.prototype = Object.create(parentClass.prototype);\r\n childClass.prototype.constructor = childClass;\r\n}", "constructor () { super() }", "function peg$subclass(child,parent){function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor}", "function inherit(parent, child) {\n const obj = Object.create(child.prototype)\n child.prototype = Object.assign({}, parent.prototype, obj)\n parent.constructor = child\n}", "function peg$subclass(child,parent){function ctor(){this.constructor=child;}ctor.prototype=parent.prototype;child.prototype=new ctor();}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function n(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "constructor() { super() }", "function derive(newclass, base) {\n function xxx() {}\n xxx.prototype = base.prototype;\n newclass.prototype = new xxx();\n}", "function inherbit( fn1, fn2 ){\n var prototype = Object.create( fn1.prototype );\n prototype.constructor = fn2;\n fn2.prototype = prototype;\n }", "function $inherits(child, parent) {\n if (child.prototype.__proto__) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n function tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tmp();\n child.prototype.constructor = child;\n }\n}", "function _inherits(SubClass, SuperClass) {\n\tif (typeof SuperClass !== \"function\" && SuperClass !== null) {\n\t\tthrow new TypeError(\"Super expression must either be null or a function, not \" + typeof SuperClass);\n\t}\n\tSubClass.prototype = new SuperClass();\n}", "function _inherits(SubClass, SuperClass) {\n\tif (typeof SuperClass !== \"function\" && SuperClass !== null) {\n\t\tthrow new TypeError(\"Super expression must either be null or a function, not \" + typeof SuperClass);\n\t}\n\tSubClass.prototype = new SuperClass();\n}", "function inherit_protoLess(_class, _base, _extends, original) {\n\t\t\t if (_base != null) {\n\t\t\t var tmp = function () { };\n\t\t\t tmp.prototype = _base.prototype;\n\t\t\t _class.prototype = new tmp();\n\t\t\t _class.prototype.constructor = _class;\n\t\t\t }\n\t\t\t if (_extends != null) {\n\t\t\t arr_each(_extends, function (x) {\n\t\t\t delete x.constructor;\n\t\t\t proto_extend(_class, x);\n\t\t\t });\n\t\t\t }\n\t\t\t proto_extend(_class, original);\n\t\t\t}", "function inherits(childConstructor, parentConstructor) {\n\t var F = function() {}\n\t F.prototype = parentConstructor.prototype\n\t childConstructor.prototype = new F()\n\t childConstructor.prototype.constructor = childConstructor\n\t return childConstructor\n\t}", "async browse() {\n throw new Error('This needs to be overwritten in subclass!');\n }", "constructor(){ super('python') }", "constructor(){ super('python') }", "function extend(parent, child){\n child.prototype= Object.create(parent.prototype)\n child.prototype.constructor=child\n }", "function e(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "function classicalInher() {\n // Shape - superclass\n function Shape() {\n this.x = 0;\n this.y = 0;\n }\n\n // superclass method\n Shape.prototype.move = (x, y) => {\n this.x += x;\n this.y += y;\n console.info('Shape moved to ' + x + ', ' + y);\n }\n\n // Rectangle - subclass\n function Rectangle() {\n console.log(this);\n Shape.call(this); // call super constructor\n }\n\n // subclass extends superclass\n Rectangle.prototype = Object.create(Shape.prototype);\n Rectangle.prototype.constructor = Rectangle;\n\n var rect = new Rectangle();\n\n console.log('Is rect an instance of Rectangle?',\n rect instanceof Rectangle); // true\n console.log('Is rect an instance of Shape?',\n rect instanceof Shape); // true\n rect.move(1, 1); // Outputs, 'Shape moved.'\n}", "function inherit (base, from) {\n for (var a in from) {\n if (typeof base[a] === 'undefined') {\n base[a] = from[a];\n }\n }\n }", "function Common() {}", "initialize() {\n // Needs to be implemented by derived classes.\n }", "function Base() {\n }", "function inherit(C, P) {\n function F() {};\n F.prototype = P.prototype;\n C.prototype = new F();\n C.uber = P.prototype;\n C.constructor.prototype = C;\n}", "function inherits(childClass, parentClass) {\n function Surrogate () {}\n Surrogate.prototype = parentClass.prototype;\n childClass.prototype = new Surrogate();\n childClass.prototype.constructor = childClass;\n}", "function uf(e,t){function i(){this.constructor=e}Af(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}", "function inherit(p) {\n\n if (p == null)\n throw TypeError(); // p must be a non-null object\n\n if (Object.create)\n return Object.create(p);\n\n var t = typeof p;\n if (t != \"object\" && t != \"function\")\n throw TypeError();\n\n function f() {} // Define a dummy constructor function.\n f.prototype = p;\n return new f();\n}", "function UHRBase() {\n\n}", "function UHRBase() {\n\n}", "function inherit(p) {\r\n\tif (p == null)\r\n\t\tthrow TypeError(); // p must be a non-null object\r\n\tif (Object.create) // If Object.create() is defined...\r\n\t\treturn Object.create(p); // then just use it.\r\n\tvar t = typeof p; // Otherwise do some more type checking\r\n\tif (t !== \"object\" && t !== \"function\")\r\n\t\tthrow TypeError();\r\n\tfunction f() {\r\n\t}\r\n\t; // Define a dummy constructor function.\r\n\tf.prototype = p; // Set its prototype property to p.\r\n\treturn new f(); // Use f() to create an \"heir\" of p.\r\n}", "function inherit(p) {\n\n if (p == null)\n throw TypeError(); // p must be a non-null object\n if (Object.create)\n return Object.create(p);\n\n var t = typeof p;\n if (t != \"object\" && t != \"function\")\n throw TypeError();\n\n function f() {} // Define a dummy constructor function.\n f.prototype = p;\n return new f();\n}", "function inherit(p) {\n if (p == null) throw TypeError();\n if (Object.create) {\n return Object.create(p);\n }\n let t = typeof p;\n if (t!== \"object\" && t !== \"function\") throw TypeError();\n function f() {};\n f.prototype = p;\n return new f();\n}", "function __extends(e,t){function __(){this.constructor=e}ke(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}", "function Common(){}", "function superclasses(classNames) { }", "constructor () {\n // Run super\n super();\n }", "constructor () {\n // Run super\n super();\n }", "function CNodeBase() {\n\n}", "function ParentWithStatic() { }", "function inherit(original) {\n\t\t\t\tfunction Inherited() {}\n\t\t\t\t\n\t\t\t\tInherited.prototype = original;\n\t\t\t\treturn new Inherited();\n\t\t\t}", "function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}", "function __() { this.constructor = subClass; }", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "configure () {\n // this can be extended in children classes to avoid using the constructor\n }", "function i(e,t){function i(){}i.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new i,e.prototype.constructor=e}", "function inheritsFrom(obj, allegedParent) {\n if (null === obj) { return false; }\n if (void 0 === obj) { return false; }\n if (typeOf(obj) === 'function') { return false; }\n if (typeOf(allegedParent) !== 'object') { return false; }\n if (null === allegedParent) { return false; }\n function F() {}\n F.prototype = allegedParent;\n return Object(obj) instanceof F;\n }", "function inherit(C, P) {\n\tvar F = function () {};\n\tF.prototype = P.prototype;\n\tC.prototype = new F();\n\tC.uber = P.prototype; // KEEP A REFERENCE LINK TO THE PARENT'S PROTOTYPE DIRECTLY\n}", "function inheritPrototype(A, B) {\n var F = function () {};\n F.prototype = B.prototype;\n A.prototype = new F();\n A.prototype.constructor = A;\n }", "function inheritPrototype(childObject, parentObject) {\n var copyOfParent = Object.create(parentObject.prototype); //ECMA5 compatible\n copyOfParent.constructor = childObject;\n childObject.prototype = copyOfParent;\n}", "function a(e,t){function n(){}n.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new n,e.prototype.constructor=e}", "constructor() {\n   if (this.constructor.name === 'relationshipBrowser')\n   throw new Error('relationshipBrowser is abstract!')\n }", "function ParentConstructor() {\n}", "function CNodeBase() {\r\n\r\n}", "function FooBar() {\n // TODO: implement this module\n}", "function u(e){switch(e){case\"class\":case\"enum\":case\"export\":case\"extends\":case\"import\":case\"super\":return!0;default:return!1}}", "function _classCallCheck(n,e){if(!(n instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function _classCallCheck(n,e){if(!(n instanceof e))throw new TypeError(\"Cannot call a class as a function\")}", "function BaseElement() {\n }", "constructor() {\n super(...arguments);\n var prototype = Object.getPrototypeOf(this);\n }", "constructor() {\n super(...arguments);\n var prototype = Object.getPrototypeOf(this);\n }", "function i(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}", "function o(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Class extends value \"+String(t)+\" is not a constructor or null\");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}", "function _____SHARED_functions_____(){}", "function Subclass(derivedConstructor, baseConstructor)\n{\n protoConstructor.prototype = baseConstructor.prototype;\n protoConstructor.prototype.constructor = baseConstructor;\n function protoConstructor()\n {\n }\n \n derivedConstructor.prototype = new protoConstructor();\n derivedConstructor.prototype.constructor = derivedConstructor;\n}" ]
[ "0.7401219", "0.72619385", "0.72619385", "0.6934079", "0.66181535", "0.64842397", "0.64601207", "0.63533044", "0.6344312", "0.6344312", "0.6324127", "0.6324127", "0.61254305", "0.61223876", "0.61002636", "0.6075639", "0.6069061", "0.6068982", "0.6067097", "0.6064537", "0.6064537", "0.60617334", "0.604004", "0.60306615", "0.602075", "0.6012298", "0.59998775", "0.59917843", "0.59790534", "0.5968011", "0.5962082", "0.59279114", "0.58770686", "0.5859899", "0.5858589", "0.5845335", "0.58329916", "0.58307445", "0.58307445", "0.58307445", "0.5821816", "0.5800161", "0.579694", "0.57711303", "0.5761807", "0.5761807", "0.5754941", "0.57494783", "0.57457507", "0.57429934", "0.57429934", "0.5742589", "0.57414746", "0.5739991", "0.57394964", "0.57296354", "0.57188696", "0.57152355", "0.5704936", "0.5704872", "0.5704605", "0.5698947", "0.5698636", "0.5698636", "0.5694323", "0.5685573", "0.5675649", "0.56657064", "0.56590986", "0.56513727", "0.56511694", "0.56511694", "0.5638588", "0.5635942", "0.5635039", "0.5630992", "0.56255937", "0.5613845", "0.5613845", "0.5613845", "0.5611511", "0.5610232", "0.55989736", "0.5598236", "0.55949694", "0.55678844", "0.556221", "0.55605096", "0.55601245", "0.5557497", "0.55530405", "0.5545872", "0.55360603", "0.55360603", "0.55348593", "0.553482", "0.553482", "0.55310327", "0.55308324", "0.5527986", "0.55219996" ]
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new Array(n / 2);\n this.sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n this.cosTable[i] = Math.cos(2 * Math.PI * i / n);\n this.sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n /* \n * Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.\n */\n this.forward = function(real, imag) {\n\n var n = this.n;\n \n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, this.levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n \n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j+halfsize] * this.cosTable[k] +\n imag[j+halfsize] * this.sinTable[k];\n var tpim = -real[j+halfsize] * this.sinTable[k] +\n imag[j+halfsize] * this.cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n \n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n }\n\n /* \n * Computes the inverse discrete Fourier transform (IDFT) of the given complex vector, storing the result back into the vector.\n * The vector's length must be equal to the size n that was passed to the object constructor, and this must be a power of 2. This is a wrapper function. This transform does not perform scaling, so the inverse is not a true inverse.\n */\n this.inverse = function(real, imag) {\n forward(imag, real);\n }\n}", "function realFft(input, output) {\n\n var n = input.length,\n x = output, \n TWO_PI = 2*Math.PI,\n sqrt = Math.sqrt,\n n2, n4, n8, nn, \n t1, t2, t3, t4, \n i1, i2, i3, i4, i5, i6, i7, i8, \n st1, cc1, ss1, cc3, ss3,\n e, \n a,\n rval, ival, mag; \n\n _reverseBinPermute(output, input);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0+1];\n x[i0] += x[i0+1];\n x[i0+1] = st1;\n } \n ix = 2*(id-1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if(n4 !== 1) {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n \n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n \n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n \n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n \n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1; \n x[i3] = t1 - st1;\n \n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for(i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4]; \n x[i4] -= x[i3];\n \n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1; \n x[i1] += t1;\n }\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n \n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4*cc1*(cc1*cc1-0.75);\n ss3 = 4*ss1*(0.75-ss1*ss1);\n \n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n \n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n \n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7]*cc1 - x[i3]*ss1; \n t1 = x[i7]*ss1 + x[i3]*cc1;\n \n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8]*cc3 - x[i4]*ss3; \n t3 = x[i8]*ss3 + x[i4]*cc3;\n \n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n \n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6]; \n x[i3] = t2 - x[i6];\n \n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n \n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2]; \n x[i7] = t3 - x[i2];\n \n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1; \n x[i1] += t1;\n \n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5]; \n x[i5] -= t4;\n }\n \n ix = (id << 1) - n2;\n id = id << 2;\n \n } while (ix < n);\n }\n }\n \n /* Scale output to have same norm as input. */\n var f = 1 / sqrt(n);\n for (var i = 0; i < n; i++)\n\t x[i] *= f;\n\n}", "function FFT$1(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error('init: radix-2 required');}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT, real-valued\n// only outputs the real valued part\nthis.real_ifft2d=function(re,im){var i2;var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nvar halfn=_n/2;var rowIdx=0;for(var x=0;x<_n;x+=2){//untangle\ni=x;i2=x+1;_tre[0]=re[0+i];_tim[0]=re[0+i2];_tre[_n/2]=re[halfn*_n+i];_tim[_n/2]=re[halfn*_n+i2];for(var x2=1;x2<halfn;x2++){rowIdx=x2*_n;_tre[x2]=re[rowIdx+i]-im[rowIdx+i2];_tre[_n-x2]=re[rowIdx+i]+im[rowIdx+i2];_tim[x2]=im[rowIdx+i]+re[rowIdx+i2];_tim[_n-x2]=re[rowIdx+i2]-im[rowIdx+i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;i2=x+1+y2*_n;re[i]=_tre[y2];re[i2]=_tim[y2];}}};// 2D-FFT, real-valued only\n// ignores the imaginary input\n// see:\n// http://www.inf.fu-berlin.de/lehre/SS12/SP-Par/download/fft1.pdf\n// http://cnx.org/content/m12021/latest/\n// http://images.apple.com/acg/pdf/g4fft.pdf\n// http://www.ti.com/lit/an/spra291/spra291.pdf\nthis.real_fft2d=function(re,im){var i=0,i2=0;// x-axis\nfor(var y=0;y<_n;y+=2){i=y*_n;i2=(y+1)*_n;// tangle\nfor(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=re[x1+i2];}this.fft1d(_tre,_tim);// untangle\nre[0+i]=_tre[0];re[0+i2]=_tim[0];im[0+i]=0;im[0+i2]=0;re[_n/2+i]=_tre[_n/2];re[_n/2+i2]=_tim[_n/2];im[_n/2+i]=0;im[_n/2+i2]=0;for(var x2=1;x2<_n/2;x2++){re[x2+i]=0.5*(_tre[x2]+_tre[_n-x2]);im[x2+i]=0.5*(_tim[x2]-_tim[_n-x2]);re[x2+i2]=0.5*(_tim[x2]+_tim[_n-x2]);im[x2+i2]=-0.5*(_tre[x2]-_tre[_n-x2]);re[_n-x2+i]=re[x2+i];im[_n-x2+i]=-im[x2+i];re[_n-x2+i2]=re[x2+i2];im[_n-x2+i2]=-im[x2+i2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}function _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n);_tim=new Float64Array(_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n);_tim=new Array(_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function FFT(){var _n=0,// order\n_bitrev=null,// bit reversal table\n_cstb=null;// sin/cos table\nvar _tre,_tim;this.init=function(n){if(n!==0&&(n&n-1)===0){_n=n;_setVariables();_makeBitReversal();_makeCosSinTable();}else{throw new Error(\"init: radix-2 required\");}};// 1D-FFT\nthis.fft1d=function(re,im){fft(re,im,1);};// 1D-IFFT\nthis.ifft1d=function(re,im){var n=1/_n;fft(re,im,-1);for(var i=0;i<_n;i++){re[i]*=n;im[i]*=n;}};// 2D-FFT\nthis.fft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.fft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.fft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// 2D-IFFT\nthis.ifft2d=function(re,im){var i=0;// x-axis\nfor(var y=0;y<_n;y++){i=y*_n;for(var x1=0;x1<_n;x1++){_tre[x1]=re[x1+i];_tim[x1]=im[x1+i];}this.ifft1d(_tre,_tim);for(var x2=0;x2<_n;x2++){re[x2+i]=_tre[x2];im[x2+i]=_tim[x2];}}// y-axis\nfor(var x=0;x<_n;x++){for(var y1=0;y1<_n;y1++){i=x+y1*_n;_tre[y1]=re[i];_tim[y1]=im[i];}this.ifft1d(_tre,_tim);for(var y2=0;y2<_n;y2++){i=x+y2*_n;re[i]=_tre[y2];im[i]=_tim[y2];}}};// core operation of FFT\nfunction fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables\nfunction _setVariables(){if(typeof Uint8Array!=='undefined'){_bitrev=new Uint8Array(_n);}else{_bitrev=new Array(_n);}if(typeof Float64Array!=='undefined'){_cstb=new Float64Array(_n*1.25);_tre=new Float64Array(_n*_n);_tim=new Float64Array(_n*_n);}else{_cstb=new Array(_n*1.25);_tre=new Array(_n*_n);_tim=new Array(_n*_n);}}// make bit reversal table\nfunction _makeBitReversal(){var i=0,j=0,k=0;_bitrev[0]=0;while(++i<_n){k=_n>>1;while(k<=j){j-=k;k>>=1;}j+=k;_bitrev[i]=j;}}// make trigonometric function table\nfunction _makeCosSinTable(){var n2=_n>>1,n4=_n>>2,n8=_n>>3,n2p4=n2+n4,t=Math.sin(Math.PI/_n),dc=2*t*t,ds=Math.sqrt(dc*(2-dc)),c=_cstb[n4]=1,s=_cstb[0]=0;t=2*dc;for(var i=1;i<n8;i++){c-=dc;dc+=t*c;s+=ds;ds-=t*s;_cstb[i]=s;_cstb[n4-i]=c;}if(n8!==0){_cstb[n8]=Math.sqrt(0.5);}for(var j=0;j<n4;j++){_cstb[n2-j]=_cstb[j];}for(var k=0;k<n2p4;k++){_cstb[k+n2]=-_cstb[k];}}}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}// set variables", "function ACFFT( NumSamples,\n InverseTransform,\n RealIn, ImagIn, RealOut, ImagOut)\n{\n var NumBits; /* Number of bits needed to store indices */\n var i, j, k, n;\n var BlockSize, BlockEnd;\n\n var angle_numerator = 2.0 * Math.PI;\n var tr, ti; /* temp real, temp imaginary */\n\n if (!IsPowerOfTwo(NumSamples)) {\n console.log(NumSamples + \" is not a power of two\");\n return 1;\n }\n\n if (!gFFTBitTable)\n ACInitFFT();\n\n if (!InverseTransform)\n angle_numerator = -angle_numerator;\n\n NumBits = NumberOfBitsNeeded(NumSamples);\n\n /*\n ** Do simultaneous data copy and bit-reversal ordering into outputs...\n */\n\n for (var i = 0; i < NumSamples; i++) {\n j = FastReverseBits(i, NumBits);\n RealOut[j] = RealIn[i];\n ImagOut[j] = (ImagIn === undefined) ? 0.0 : ImagIn[i];\n }\n\n /*\n ** Do the FFT itself...\n */\n\n BlockEnd = 1;\n for (BlockSize = 2; BlockSize <= NumSamples; BlockSize <<= 1) {\n\n var delta_angle = angle_numerator / BlockSize;\n\n var sm2 = Math.sin(-2 * delta_angle);\n var sm1 = Math.sin(-delta_angle);\n var cm2 = Math.cos(-2 * delta_angle);\n var cm1 = Math.cos(-delta_angle);\n var w = 2 * cm1;\n var ar0, ar1, ar2, ai0, ai1, ai2;\n\n for (var i = 0; i < NumSamples; i += BlockSize) {\n ar2 = cm2;\n ar1 = cm1;\n\n ai2 = sm2;\n ai1 = sm1;\n\n for (var j = i, n = 0; n < BlockEnd; j++, n++) {\n ar0 = w * ar1 - ar2;\n ar2 = ar1;\n ar1 = ar0;\n\n ai0 = w * ai1 - ai2;\n ai2 = ai1;\n ai1 = ai0;\n\n k = j + BlockEnd;\n tr = ar0 * RealOut[k] - ai0 * ImagOut[k];\n ti = ar0 * ImagOut[k] + ai0 * RealOut[k];\n\n RealOut[k] = RealOut[j] - tr;\n ImagOut[k] = ImagOut[j] - ti;\n\n RealOut[j] += tr;\n ImagOut[j] += ti;\n }\n }\n\n BlockEnd = BlockSize;\n }\n\n /*\n ** Need to normalize if inverse transform...\n */\n\n if (InverseTransform) {\n var denom = NumSamples;\n\n for (var i = 0; i < NumSamples; i++) {\n RealOut[i] /= denom;\n ImagOut[i] /= denom;\n }\n }\n}", "function RealFFT( NumSamples, RealIn, RealOut, ImagOut)\n{\n\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = RealIn[2 * i];\n tmpImag[i] = RealIn[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n RealOut[i] = h1r + wr * h2r - wi * h2i;\n ImagOut[i] = h1i + wr * h2i + wi * h2r;\n RealOut[i3] = h1r - wr * h2r + wi * h2i;\n ImagOut[i3] = -h1i + wr * h2i + wi * h2r;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n RealOut[0] = (h1r = RealOut[0]) + ImagOut[0];\n ImagOut[0] = h1r - ImagOut[0];\n}", "function fft(re,im,inv){var d,h,ik,m,tmp,wr,wi,xr,xi,n4=_n>>2;// bit reversal\nfor(var l=0;l<_n;l++){m=_bitrev[l];if(l<m){tmp=re[l];re[l]=re[m];re[m]=tmp;tmp=im[l];im[l]=im[m];im[m]=tmp;}}// butterfly operation\n//butfly(re,im,inv,n4);\nfor(var k=1;k<_n;k<<=1){h=0;d=_n/(k<<1);for(var j=0;j<k;j++){wr=_cstb[h+n4];wi=inv*_cstb[h];for(var i=j;i<_n;i+=k<<1){ik=i+k;xr=wr*re[ik]+wi*im[ik];xi=wr*im[ik]-wi*re[ik];re[ik]=re[i]-xr;re[i]+=xr;im[ik]=im[i]-xi;im[i]+=xi;}h+=d;}}}", "function fftRadix2(dir, nrows, ncols, buffer, x_ptr, y_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n var nn,m,i,i1,j,k,i2,l,l1,l2\n var c1,c2,t,t1,t2,u1,u2,z,row,a,b,c,d,k1,k2,k3\n \n // Calculate the number of points\n nn = ncols\n m = bits.log2(nn)\n \n for(row=0; row<nrows; ++row) { \n // Do the bit reversal\n i2 = nn >> 1;\n j = 0;\n for(i=0;i<nn-1;i++) {\n if(i < j) {\n t = buffer[x_ptr+i]\n buffer[x_ptr+i] = buffer[x_ptr+j]\n buffer[x_ptr+j] = t\n t = buffer[y_ptr+i]\n buffer[y_ptr+i] = buffer[y_ptr+j]\n buffer[y_ptr+j] = t\n }\n k = i2\n while(k <= j) {\n j -= k\n k >>= 1\n }\n j += k\n }\n \n // Compute the FFT\n c1 = -1.0\n c2 = 0.0\n l2 = 1\n for(l=0;l<m;l++) {\n l1 = l2\n l2 <<= 1\n u1 = 1.0\n u2 = 0.0\n for(j=0;j<l1;j++) {\n for(i=j;i<nn;i+=l2) {\n i1 = i + l1\n a = buffer[x_ptr+i1]\n b = buffer[y_ptr+i1]\n c = buffer[x_ptr+i]\n d = buffer[y_ptr+i]\n k1 = u1 * (a + b)\n k2 = a * (u2 - u1)\n k3 = b * (u1 + u2)\n t1 = k1 - k3\n t2 = k1 + k2\n buffer[x_ptr+i1] = c - t1\n buffer[y_ptr+i1] = d - t2\n buffer[x_ptr+i] += t1\n buffer[y_ptr+i] += t2\n }\n k1 = c1 * (u1 + u2)\n k2 = u1 * (c2 - c1)\n k3 = u2 * (c1 + c2)\n u1 = k1 - k3\n u2 = k1 + k2\n }\n c2 = Math.sqrt((1.0 - c1) / 2.0)\n if(dir < 0) {\n c2 = -c2\n }\n c1 = Math.sqrt((1.0 + c1) / 2.0)\n }\n \n // Scaling for inverse transform\n if(dir < 0) {\n var scale_f = 1.0 / nn\n for(i=0;i<nn;i++) {\n buffer[x_ptr+i] *= scale_f\n buffer[y_ptr+i] *= scale_f\n }\n }\n \n // Advance pointers\n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function processingVideoGenKompFFTOneHz() {\n\tvar TPquant = parseFloat(document.getElementById(\"In1\").value);\n\tvar HPquant = parseFloat(document.getElementById(\"In2\").value);\n\tvar splitFreq = parseFloat(document.getElementById(\"In3\").value);\n\tvar Round =0;\n\tsetFreqQuantMatrix(QuantMatrix,TPquant,HPquant,splitFreq);\n\t// Process chain begin ---// Loop through the pixels, turning them in-RGB-Out\n\t\tGRAYtoRGB(imgArrayIn2, oneHz); \t\n \tsetFFT(swepFFT,imgArrayIn2);\n\t\tFFT1.spec=swepFFT.spec.slice(0,swepFFT.spec.length);\n\t\tswapFFTfor(swepFFT)\n\t\tsetQuantFFT(quantFFT,swepFFT,QuantMatrix,Round);\n\t\t\n\t\tsetInvQuantFFT(iswepFFT,quantFFT,QuantMatrix);\n\t\tiquantFFT.spec=iswepFFT.spec.slice(0,iswepFFT.spec.length);\n\t\tswapFFTback(iswepFFT)\t\t\t\t\n\t\tsetIFFT(imgArrayOut, iswepFFT);\t\n\t\tRGBtoGRAY(iFFTspec,imgArrayOut); \n\t\t\n\t// Process chain end ------------------------------------\n\twriteCanvas(iImageOut);\n\t\t\n\tanalyseError(ErrorLog,iFFTspec, oneHz,255) \n\tLogArray = [\"imgArrayIn2\",\"oneHz\",\"FFT1.spec\",\"swepFFT.spec\",\"QuantMatrix\", \"quantFFT.spec\",\"iquantFFT.spec\",\"iswepFFT.spec\",\"iFFTspec\",\"imgArrayOut\",\"ErrorLog\"];\n}", "forward(buffer) {\n var n = this.bufferSize,\n spectrum = this.spectrum,\n x = this.trans,\n TWO_PI = 2 * Math.PI,\n sqrt = Math.sqrt,\n i = n >>> 1,\n bSi = 2 / n,\n n2, n4, n8, nn,\n t1, t2, t3, t4,\n i1, i2, i3, i4, i5, i6, i7, i8,\n st1, cc1, ss1, cc3, ss3,\n e,\n a,\n rval, ival, mag;\n\n this.reverseBinPermute(x, buffer);\n\n for (var ix = 0, id = 4; ix < n; id *= 4) {\n for (var i0 = ix; i0 < n; i0 += id) {\n //sumdiff(x[i0], x[i0+1]); // {a, b} <--| {a+b, a-b}\n st1 = x[i0] - x[i0 + 1];\n x[i0] += x[i0 + 1];\n x[i0 + 1] = st1;\n }\n ix = 2 * (id - 1);\n }\n\n n2 = 2;\n nn = n >>> 1;\n\n while ((nn = nn >>> 1)) {\n ix = 0;\n n2 = n2 << 1;\n id = n2 << 1;\n n4 = n2 >>> 2;\n n8 = n2 >>> 3;\n do {\n if (n4 !== 1) {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n\n i1 += n8;\n i2 += n8;\n i3 += n8;\n i4 += n8;\n\n //sumdiff(x[i3], x[i4], t1, t2); // {s, d} <--| {a+b, a-b}\n t1 = x[i3] + x[i4];\n t2 = x[i3] - x[i4];\n\n t1 = -t1 * Math.SQRT1_2;\n t2 *= Math.SQRT1_2;\n\n // sumdiff(t1, x[i2], x[i4], x[i3]); // {s, d} <--| {a+b, a-b}\n st1 = x[i2];\n x[i4] = t1 + st1;\n x[i3] = t1 - st1;\n\n //sumdiff3(x[i1], t2, x[i2]); // {a, b, d} <--| {a+b, b, a-b}\n x[i2] = x[i1] - t2;\n x[i1] += t2;\n }\n } else {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n //diffsum3_r(x[i3], x[i4], t1); // {a, b, s} <--| {a, b-a, a+b}\n t1 = x[i3] + x[i4];\n x[i4] -= x[i3];\n\n //sumdiff3(x[i1], t1, x[i3]); // {a, b, d} <--| {a+b, b, a-b}\n x[i3] = x[i1] - t1;\n x[i1] += t1;\n }\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n } while (ix < n);\n\n e = TWO_PI / n2;\n\n for (var j = 1; j < n8; j++) {\n a = j * e;\n ss1 = Math.sin(a);\n cc1 = Math.cos(a);\n\n //ss3 = sin(3*a); cc3 = cos(3*a);\n cc3 = 4 * cc1 * (cc1 * cc1 - 0.75);\n ss3 = 4 * ss1 * (0.75 - ss1 * ss1);\n\n ix = 0; id = n2 << 1;\n do {\n for (i0 = ix; i0 < n; i0 += id) {\n i1 = i0 + j;\n i2 = i1 + n4;\n i3 = i2 + n4;\n i4 = i3 + n4;\n\n i5 = i0 + n4 - j;\n i6 = i5 + n4;\n i7 = i6 + n4;\n i8 = i7 + n4;\n\n //cmult(c, s, x, y, &u, &v)\n //cmult(cc1, ss1, x[i7], x[i3], t2, t1); // {u,v} <--| {x*c-y*s, x*s+y*c}\n t2 = x[i7] * cc1 - x[i3] * ss1;\n t1 = x[i7] * ss1 + x[i3] * cc1;\n\n //cmult(cc3, ss3, x[i8], x[i4], t4, t3);\n t4 = x[i8] * cc3 - x[i4] * ss3;\n t3 = x[i8] * ss3 + x[i4] * cc3;\n\n //sumdiff(t2, t4); // {a, b} <--| {a+b, a-b}\n st1 = t2 - t4;\n t2 += t4;\n t4 = st1;\n\n //sumdiff(t2, x[i6], x[i8], x[i3]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i6]; x[i8] = t2 + st1; x[i3] = t2 - st1;\n x[i8] = t2 + x[i6];\n x[i3] = t2 - x[i6];\n\n //sumdiff_r(t1, t3); // {a, b} <--| {a+b, b-a}\n st1 = t3 - t1;\n t1 += t3;\n t3 = st1;\n\n //sumdiff(t3, x[i2], x[i4], x[i7]); // {s, d} <--| {a+b, a-b}\n //st1 = x[i2]; x[i4] = t3 + st1; x[i7] = t3 - st1;\n x[i4] = t3 + x[i2];\n x[i7] = t3 - x[i2];\n\n //sumdiff3(x[i1], t1, x[i6]); // {a, b, d} <--| {a+b, b, a-b}\n x[i6] = x[i1] - t1;\n x[i1] += t1;\n\n //diffsum3_r(t4, x[i5], x[i2]); // {a, b, s} <--| {a, b-a, a+b}\n x[i2] = t4 + x[i5];\n x[i5] -= t4;\n }\n\n ix = (id << 1) - n2;\n id = id << 2;\n\n } while (ix < n);\n }\n }\n\n while (--i) {\n rval = x[i];\n ival = x[n - i - 1];\n mag = bSi * sqrt(rval * rval + ival * ival);\n\n if (mag > this.peak) {\n this.peakBand = i;\n this.peak = mag;\n }\n\n spectrum[i] = mag;\n }\n\n spectrum[0] = bSi * x[0];\n\n return spectrum;\n }", "function fftBluestein(dir, nrows, ncols, buffer, x_ptr, y_ptr, scratch_ptr) {\n dir |= 0\n nrows |= 0\n ncols |= 0\n x_ptr |= 0\n y_ptr |= 0\n scratch_ptr |= 0\n\n // Initialize tables\n var m = bits.nextPow2(2 * ncols + 1)\n , cos_ptr = scratch_ptr\n , sin_ptr = cos_ptr + ncols\n , xs_ptr = sin_ptr + ncols\n , ys_ptr = xs_ptr + m\n , cft_ptr = ys_ptr + m\n , sft_ptr = cft_ptr + m\n , w = -dir * Math.PI / ncols\n , row, a, b, c, d, k1, k2, k3\n , i\n for(i=0; i<ncols; ++i) {\n a = w * ((i * i) % (ncols * 2))\n c = Math.cos(a)\n d = Math.sin(a)\n buffer[cft_ptr+(m-i)] = buffer[cft_ptr+i] = buffer[cos_ptr+i] = c\n buffer[sft_ptr+(m-i)] = buffer[sft_ptr+i] = buffer[sin_ptr+i] = d\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[cft_ptr+i] = 0.0\n }\n for(i=ncols; i<=m-ncols; ++i) {\n buffer[sft_ptr+i] = 0.0\n }\n\n fftRadix2(1, 1, m, buffer, cft_ptr, sft_ptr)\n \n //Compute scale factor\n if(dir < 0) {\n w = 1.0 / ncols\n } else {\n w = 1.0\n }\n \n //Handle direction\n for(row=0; row<nrows; ++row) {\n \n // Copy row into scratch memory, multiply weights\n for(i=0; i<ncols; ++i) {\n a = buffer[x_ptr+i]\n b = buffer[y_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n //Zero out the rest\n for(i=ncols; i<m; ++i) {\n buffer[xs_ptr+i] = 0.0\n }\n for(i=ncols; i<m; ++i) {\n buffer[ys_ptr+i] = 0.0\n }\n \n // FFT buffer\n fftRadix2(1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Apply multiplier\n for(i=0; i<m; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cft_ptr+i]\n d = buffer[sft_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[xs_ptr+i] = k1 - k3\n buffer[ys_ptr+i] = k1 + k2\n }\n \n // Inverse FFT buffer\n fftRadix2(-1, 1, m, buffer, xs_ptr, ys_ptr)\n \n // Copy result back into x/y\n for(i=0; i<ncols; ++i) {\n a = buffer[xs_ptr+i]\n b = buffer[ys_ptr+i]\n c = buffer[cos_ptr+i]\n d = -buffer[sin_ptr+i]\n k1 = c * (a + b)\n k2 = a * (d - c)\n k3 = b * (c + d)\n buffer[x_ptr+i] = w * (k1 - k3)\n buffer[y_ptr+i] = w * (k1 + k2)\n }\n \n x_ptr += ncols\n y_ptr += ncols\n }\n}", "function updateFFT() {\n if (analyser == null) return;\n updateAudio(); \n analizerdata = analyser.getFrequencyData();\n for (var p = 0; p < fftSize-fftsizeCute; p++) {\n particles[p].position.y = (bgstartPos.y - 6) +\n (analizerdata[p] / 25)\n\n particlesBase[p].position.y =\n particles[p].position.y - 7.5;\n }\n var freq = analyser.getAverageFrequency();\n var newbloom = (freq / 300);\n if (newbloom > maxBLOOM) newbloom = maxBLOOM;\n //POST.CHANGEBLOON(newbloom);\n LASTBLOON = window.POST.CHANGEBLOON(newbloom);\n ckeckBPM(freq);\n}", "function Poll_FFT_MONOTONE()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n if (gb_use_ntsc_arduino) //63.55 microsegundos\r\n {\r\n //Para belial\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;} //4 770 /21,533203125 = 35,75873015873015873015873015873\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[18] > 230){row = 3;} //* 393,3910306845 /21,533203125 = 18,269043783262040816326530612245\r\n\t }\r\n }\r\n } \r\n \r\n if (spectrum[14] > 230){col = 0;} //2 302,60848514192 /21,533203125 = 14\r\n else{ \r\n if (spectrum[62] > 230){col = 1;}\r\n else{ \r\n \t if (spectrum[26] > 230){col = 2;} //# 561,98718669215 /21,533203125 = 26,09863397608896145124716553288\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n \t }\r\n }\r\n } \t \r\n }\r\n else\r\n {\r\n //if (spectrum[31] > 250){row = 0;}\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;}\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[43] > 230){row = 3;}\r\n\t }\r\n }\r\n }\r\n \r\n //if (spectrum[55] > 250){col = 0;}\r\n if (spectrum[56] > 230){col = 0;}\r\n else{\r\n //if (spectrum[61] > 250){col = 1;}\r\n if (spectrum[62] > 230){col = 1;}\r\n else{\r\n //if (spectrum[67] > 250){col = 2;}\r\n\t if (spectrum[68] > 230){col = 2;}\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n\t }\r\n }\r\n } \t \r\n }\r\n\r\n \r\n //let cadLog = '67:'+spectrum[67].toString()+' 68:'+spectrum[68].toString()+' 69:'+spectrum[69].toString();\r\n //let cadLog = '31:'+spectrum[31].toString()+' 32:'+spectrum[32].toString()+' 33:'+spectrum[33].toString();\r\n //let cadLog = '61:'+spectrum[61].toString()+' 62:'+spectrum[62].toString()+' 63:'+spectrum[63].toString();\r\n //console.log (cadLog);\r\n \t\t\r\n if ((row>-1)||(col>-1))\r\n { \r\n gb_fft_dtmf = RowColToMonotone(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf)\r\n {\t \r\n gb_fft_dtmf_antes = gb_fft_dtmf;\t\r\n \r\n\tcad_areaRX += gb_fft_dtmf;\t\r\n\tgb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\tgb_event_new_data_dtmf = true;\r\n\t\r\n\tif (gb_use_fast === true)\r\n\t{ //Si es fast solo recibe un tono \r\n\t gb_fft_dtmf_two_monotone += gb_fft_dtmf;\r\n\t if (gb_fft_dtmf_two_monotone.length > 1)\r\n\t {\t \t \r\n\t gb_buf_rcv_dtmf = '#' + gb_fft_dtmf_two_monotone + '*';\t \r\n\t gb_fft_dtmf_two_monotone = '';\t \r\n\t }\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t contIniAsteriscos = 1;\t\r\n\t}\r\n\telse\r\n\t{\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n\t case '#':\r\n\t gb_buf_rcv_dtmf = '#';\r\n\t gb_begin_sms = true; \r\n\t gb_end_sms = false;\r\n\t //gb_begin_sync_dtmf= true;\t \r\n\t break;\r\n\t case '*':\t \r\n\t contIniAsteriscos ++;\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t break;\r\n\t default:\t \r\n\t contIniAsteriscos = 0;\t \t \r\n\t break;\r\n\t }\r\n\t}\r\n\t\t\r\n gb_forceDraw = true;\r\n }\r\n //playSoundTrack(gb_fft_dtmf);//Reproduce el Track\r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n } \r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function fft(input) {\n var\n n = input.length,\n nHalf,\n even,\n odd,\n output = [],\n wnkMultiplied,\n wnk,\n k,\n r;\n\n if (n === 1) {\n return input;\n }\n\n // even and odd parts\n even = fft(getListHalf(input, 0));\n odd = fft(getListHalf(input, 1));\n\n // combine\n output.length = n;\n nHalf = n / 2;\n for (k = 0; k < nHalf; k++) {\n r = -2 * Math.PI * k / n;\n wnk = getComplexFromRadians(r);\n wnkMultiplied = complexMultiply(wnk, odd[k]);\n output[k] = complexAdd(even[k], wnkMultiplied);\n output[nHalf + k] = complexSubtract(even[k], wnkMultiplied);\n }\n\n return output;\n}", "function Poll_FFT_DTMF()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n if (gb_use_mic_dtmf === false)\r\n {\r\n return;\r\n }\r\n\t \r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n //if (spectrum[31] > 250){row = 0;}\r\n if (spectrum[32] > 230){row = 0;}\r\n else{\r\n if (spectrum[35] > 230){row = 1;}\r\n else{\r\n if (spectrum[39] > 230){row = 2;}\r\n else{\r\n if (spectrum[43] > 230){row = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //if (spectrum[55] > 250){col = 0;}\r\n if (spectrum[56] > 230){col = 0;}\r\n else{\r\n //if (spectrum[61] > 250){col = 1;}\r\n if (spectrum[62] > 230){col = 1;} \r\n else{\r\n //if (spectrum[67] > 250){col = 2;}\r\n\tif (spectrum[68] > 230){col = 2;}\r\n else{\r\n if (spectrum[76] > 230){col = 3;}\r\n\t}\r\n }\r\n }\r\n \r\n //console.log('55:'+spectrum[55].toString()+' 56:'+spectrum[56].toString()+' 57:'+spectrum[57].toString());\r\n \t\r\n if ((row>-1) && (col>-1))\r\n { \r\n gb_fft_dtmf = RowColToDtmf(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf){\t\r\n gb_fft_dtmf_antes = gb_fft_dtmf;\r\n cad_areaRX += gb_fft_dtmf;\t\r\n\tgb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\tgb_event_new_data_dtmf = true;\r\n\tif (gb_fft_dtmf === '#'){\r\n\t gb_begin_sync_dtmf= true;\r\n }\r\n\r\n if (gb_use_fast === true)\r\n\t{ //Si es fast solo recibe un tono\r\n\t gb_buf_rcv_dtmf = '#' + DTMFStringToDoubleNumber(gb_fft_dtmf) + '*';\t \r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t contIniAsteriscos = 1;\r\n\t}\r\n\telse\r\n\t{\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n \t case '#':\r\n\t gb_buf_rcv_dtmf = '#';\r\n\t gb_begin_sms = true; \r\n\t gb_end_sms = false;\r\n\t //gb_begin_sync_dtmf= true;\t \r\n\t break;\r\n\t case '*':\t \r\n\t contIniAsteriscos ++;\r\n\t gb_begin_sms = false; \r\n\t gb_end_sms = true;\r\n\t break;\r\n\t default:\t \r\n\t contIniAsteriscos = 0;\t \t \r\n\t break;\r\n\t }\t\r\n\t}\r\n\t\r\n\t\r\n gb_forceDraw = true;\r\n } \r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n } \r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function transformRadix2(real, imag) {\n // Initialization\n if (real.length != imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n == 1)\n // Trivial transform\n return;\n var levels = -1;\n for (var i = 0; i < 32; i++) {\n if (1 << i == n)\n levels = i;\n // Equal to log2(n)\n }\n if (levels == -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (var i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (var i = 0; i < n; i++) {\n var j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (var i = 0; i < n; i += size) {\n for (var j = i, k = 0; j < i + halfsize; j++,\n k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n if (inreal.length != inimag.length || inreal.length != outreal.length || outreal.length != outimag.length)\n throw \"Mismatched lengths\";\n\n var n = inreal.length;\n var coef = (inverse ? 2 : -2) * Math.PI;\n for (var k = 0; k < n; k++) { // For each output element\n var sumreal = 0;\n var sumimag = 0;\n for (var t = 0; t < n; t++) { // For each input element\n var angle = coef * (t * k % n) / n; // This is more accurate than t * k\n sumreal += inreal[t]*Math.cos(angle) - inimag[t]*Math.sin(angle);\n sumimag += inreal[t]*Math.sin(angle) + inimag[t]*Math.cos(angle);\n }\n outreal[k] = sumreal;\n outimag[k] = sumimag;\n }\n \n \n // compute the average of the intervals of outreal array\n // peak saves the time index of all peaks\n var peak = [0];\n for(i = 1; i < outreal.length-1; i++){\n if(outreal[i] > outreal[i-1] && outreal[i] > outreal[i+1]){\n peak.push(i);\n }\n }\n // interval saves the interval of all values in peak\n var interval = [];\n for(i = 0; i < peak.length-1; i++){\n interval.push(peak[i+1] - peak[i]);\n }\n // compute the mean value in interval array\n var sum = 0;\n for(i = 0; i < interval.length; i++){\n sum += interval[i];\n }\n var mean = Number((sum/interval.length).toFixed(3));\n // the scan rate is the inverse of mean interval\n var scanrate = Number((1000/mean).toFixed(2)); \n document.getElementById(\"scanrate\").innerHTML = \"<br />\" + scanrate + \"Hz\" \n + \"<br />\" + \"It means your keyboard refreshes every \" + mean + \"ms\" \n + \"<br /><br /><br /><br />\" + \"The computing approach is to look in to the pressing time that your keyboard is able to recognize. More data lies around specific time points, the interval of them is right the refreshing period of your keyboard.\";\n }", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"backend_util\"].exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = Object(_kernels_Complex__WEBPACK_IMPORTED_MODULE_2__[\"complex\"])({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = Object(_kernels_Multiply__WEBPACK_IMPORTED_MODULE_6__[\"multiply\"])({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = Object(_kernels_Add__WEBPACK_IMPORTED_MODULE_1__[\"add\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = Object(_kernels_Sub__WEBPACK_IMPORTED_MODULE_10__[\"sub\"])({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = Object(_kernels_Real__WEBPACK_IMPORTED_MODULE_7__[\"real\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = Object(_kernels_Imag__WEBPACK_IMPORTED_MODULE_5__[\"imag\"])({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = Object(_kernels_Concat__WEBPACK_IMPORTED_MODULE_3__[\"concat\"])({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function FFTDrawer(canvas, channel) {\n var canvasContext = canvas.getContext('2d');\n var curveColor = 'rgb(255,160,122)';\n var binCount = FFT_SIZE / 2;\n var data = new Float32Array(binCount);\n\n function drawCurve() {\n var width = canvas.width;\n var height = canvas.height;\n var pixelsPerDb = height / 96.0;\n\n canvasContext.clearRect(0, 0, width, height);\n\n /* Get the proper analyzer from the audio graph */\n var analyzer = (channel == 0) ? analyzer_left : analyzer_right;\n if (!analyzer || !get_global('enable_fft')) {\n requestAnimationFrame(drawCurve);\n return;\n }\n\n /* Draw decibel scale. */\n for (var db = -96.0; db <= 0; db += 12) {\n var y = height - (db + 96) * pixelsPerDb;\n canvasContext.strokeStyle = curveColor;\n canvasContext.strokeText(db.toFixed(0) + 'dB', 10, y);\n }\n\n /* Draw FFT */\n analyzer.getFloatFrequencyData(data);\n canvasContext.beginPath();\n canvasContext.lineWidth = 1;\n canvasContext.strokeStyle = curveColor;\n canvasContext.moveTo(0, height);\n\n var frequencyHz = new Float32Array(width);\n for (var i = 0; i < binCount; ++i) {\n var f = i / binCount;\n\n /* Convert to log frequency scale (octaves). */\n var noctaves = 10;\n f = 1 + Math.log(f) / (noctaves * Math.LN2);\n\n /* Draw the magnitude */\n var x = f * width;\n var y = height - (data[i] + 96) * pixelsPerDb;\n\n canvasContext.lineTo(x, y);\n }\n\n canvasContext.stroke();\n requestAnimationFrame(drawCurve);\n }\n\n function init() {\n requestAnimationFrame(drawCurve);\n }\n\n this.init = init;\n}", "function fft(x) {\n return fftComplexDirection(x,false);\n}", "function transformRadix2(real, imag) {\n // Initialization\n var i, j, k;\n if (real.length !== imag.length)\n throw \"Mismatched lengths\";\n var n = real.length;\n if (n === 1) // Trivial transform\n return;\n var levels = -1;\n for (i = 0; i < 32; i++) {\n if (1 << i === n)\n levels = i; // Equal to log2(n)\n }\n if (levels === -1)\n throw \"Length is not a power of 2\";\n var cosTable = new Array(n / 2);\n var sinTable = new Array(n / 2);\n for (i = 0; i < n / 2; i++) {\n cosTable[i] = Math.cos(2 * Math.PI * i / n);\n sinTable[i] = Math.sin(2 * Math.PI * i / n);\n }\n\n // Bit-reversed addressing permutation\n for (i = 0; i < n; i++) {\n j = reverseBits(i, levels);\n if (j > i) {\n var temp = real[i];\n real[i] = real[j];\n real[j] = temp;\n temp = imag[i];\n imag[i] = imag[j];\n imag[j] = temp;\n }\n }\n\n // Cooley-Tukey decimation-in-time radix-2 FFT\n for (var size = 2; size <= n; size *= 2) {\n var halfsize = size / 2;\n var tablestep = n / size;\n for (i = 0; i < n; i += size) {\n for (j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n real[j + halfsize] = real[j] - tpre;\n imag[j + halfsize] = imag[j] - tpim;\n real[j] += tpre;\n imag[j] += tpim;\n }\n }\n }\n\n // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n function reverseBits(x, bits) {\n var y = 0;\n for (var i = 0; i < bits; i++) {\n y = (y << 1) | (x & 1);\n x >>>= 1;\n }\n return y;\n }\n}", "function naiveDft(inreal, inimag, outreal, outimag, inverse) {\n\tconst n = inreal.length;\n\tif (n != inimag.length || n != outreal.length || n != outimag.length)\n\t\tthrow new RangeError(\"Mismatched lengths\");\n\t\n\tconst coef = (inverse ? 2 : -2) * Math.PI;\n\tfor (let k = 0; k < n; k++) { // For each output element\n\t\tlet sumreal = 0;\n\t\tlet sumimag = 0;\n\t\tfor (let t = 0; t < n; t++) { // For each input element\n\t\t\tconst angle = coef * (t * k % n) / n; // This is more accurate than t * k\n\t\t\tsumreal += inreal[t] * Math.cos(angle) - inimag[t] * Math.sin(angle);\n\t\t\tsumimag += inreal[t] * Math.sin(angle) + inimag[t] * Math.cos(angle);\n\t\t}\n\t\toutreal[k] = sumreal;\n\t\toutimag[k] = sumimag;\n\t}\n}", "_transform(chunk,encoding,cb) {\n\n const uint8_view = new Uint8Array(chunk, 0, chunk.length);\n var dataView = new DataView(uint8_view.buffer);\n\n let iFloat = Array(this.sz*2);\n let asComplex = Array(this.sz);\n\n\n // for(let i = 0; i < this.sz*2; i+=1) {\n // iFloat[i] = dataView.getFloat64(i*8, true);\n // }\n\n for(let i = 0; i < this.sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);\n let im = dataView.getFloat64((i*8)+8, true);\n\n asComplex[i/2] = mt.complex(re,im);\n\n iFloat[i] = re;\n iFloat[i+1] = im;\n\n // if( i < 16 ) {\n // console.log(re);\n // }\n\n }\n\n let iShort = mutil.IFloatToIShortMulti(iFloat);\n\n if( this.onFrameIShort !== null ) {\n this.onFrameIShort(iShort);\n }\n\n // console.log(\"iFloat length \" + iFloat.length);\n // console.log(iFloat.slice(0,16));\n\n // console.log(\"iShort length \" + iShort.length);\n // console.log(iShort.slice(0,16));\n\n\n this.handleDefaultStream(iFloat,iShort,asComplex);\n this.handleFineSync(iFloat,iShort,asComplex);\n this.handleAllSubcarriers(iFloat,iShort,asComplex);\n this.handleDemodData(iFloat,iShort,asComplex);\n\n\n // for(x of iFloat) {\n // console.log(x);\n // }\n\n\n this.uint.frame_track_counter++;\n cb();\n }", "function PowerSpectrum( NumSamples, In, Out)\n{\n var Half = NumSamples / 2;\n var i;\n\n var theta = Math.PI / Half;\n\n var tmpReal = new Float32Array(Half);\n var tmpImag = new Float32Array(Half);\n var RealOut = new Float32Array(Half);\n var ImagOut = new Float32Array(Half);\n\n for (var i = 0; i < Half; i++) {\n tmpReal[i] = In[2 * i];\n tmpImag[i] = In[2 * i + 1];\n }\n\n ACFFT(Half, 0, tmpReal, tmpImag, RealOut, ImagOut);\n\n var wtemp = (Math.sin(0.5 * theta));\n\n var wpr = -2.0 * wtemp * wtemp;\n var wpi = -1.0 * (Math.sin(theta));\n var wr = 1.0 + wpr;\n var wi = wpi;\n\n var i3;\n\n var h1r, h1i, h2r, h2i, rt, it;\n\n for (var i = 1; i < Half / 2; i++) {\n\n i3 = Half - i;\n\n h1r = 0.5 * (RealOut[i] + RealOut[i3]);\n h1i = 0.5 * (ImagOut[i] - ImagOut[i3]);\n h2r = 0.5 * (ImagOut[i] + ImagOut[i3]);\n h2i = -0.5 * (RealOut[i] - RealOut[i3]);\n\n rt = h1r + wr * h2r - wi * h2i;\n it = h1i + wr * h2i + wi * h2r;\n\n Out[i] = rt * rt + it * it;\n\n rt = h1r - wr * h2r + wi * h2i;\n it = -h1i + wr * h2i + wi * h2r;\n\n Out[i3] = rt * rt + it * it;\n\n wr = (wtemp = wr) * wpr - wi * wpi + wr;\n wi = wi * wpr + wtemp * wpi + wi;\n }\n\n rt = (h1r = RealOut[0]) + ImagOut[0];\n it = h1r - ImagOut[0];\n Out[0] = rt * rt + it * it;\n\n rt = RealOut[Half / 2];\n it = ImagOut[Half / 2];\n Out[Half / 2] = rt * rt + it * it;\n}", "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(z, t1);\r\n t0.mul(t0, t1);\r\n t0.square(t0);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 5; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 20; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 100; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t0.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t0.square(t0);\r\n }\r\n this.mul(t0, z);\r\n }", "function calculateNext(data){\n \n var AM, BM, TAU_M, AH, BH, TAU_H, AJ, BJ, TAU_J, axr1, bxr1, TAU_Xr1,\n axr2, bxr2, TAU_Xr2, Axs, Bxs, TAU_Xs, TAU_R, TAU_S, Ad, Bd, Cd, TAU_D, \n Af, Bf, Cf, TAU_F, Af2, Bf2, Cf2, TAU_F2, temp, temp2, Ak1, Bk1,\n Ek, Ena, Eks, Eca, FCaSS_INF, exptaufcass, kCaSR, k1, k2, dRR,\n CaCSQN, dCaSR, bjsr, cjsr, CaSSBuf, dCaSS, bcss, ccss, CaBuf, dCai, bc, cc,\n dNai, dKi, sOO; \n\n var minft_t, exptaumt_t, hinft_t, exptauht_t, jinft_t, exptaujt_t, xr1inft_t,\n exptauxr1t_t, xr2inft_t, exptauxr2t_t, xsinft_t, exptauxst_t, rinft_t , sinft_t,\n exptaurt_t, exptaust_t, dinft_t, exptaudt_t, finft_t, exptauft_t, f2inft_t, \n exptauf2t_t, inakcoefft_t, ipkcoefft_t, ical1t_t, ical2t_t, inaca1t_t, inaca2t_t,\n ik1coefft_t, fcassinft_t, exptaufcasst_t; \n\n\n sOO = ( cS[iType] === 'epi') ? 8.958e-8 : ( cS[iType] === 'endo' ) ? 8.848e-8 : 1.142e-7; // (cS.itype === 'M')\n \n\n //table setup starts\n AM = 1.0/(1.+ Math.exp((-60.-cS.v)/5.));\n BM = 0.1/(1.+ Math.exp((cS.v+35.)/5.))+0.10/(1.+Math.exp((cS.v-50.)/200.));\n minft_t = 1.0/((1.+Math.exp((-56.86-cS.v)/9.03))*(1.+Math.exp((-56.86-cS.v)/9.03)));\n TAU_M = AM*BM;\n exptaumt_t = Math.exp(-cS.timestep/TAU_M);\n\n hinft_t = 1.0/((1.+Math.exp((cS.v+71.55)/7.43))*(1.+Math.exp((cS.v+71.55)/7.43)));\n \n AH = (cS.v > -40) ? 0. : (0.057*Math.exp(-(cS.v+80.)/6.8));\n BH = (cS.v > -40) ? (0.77/(0.13*(1.+Math.exp(-(cS.v+10.66)/11.1)))) \n : (2.7*Math.exp(0.079*cS.v)+(3.1e5)*Math.exp(0.3485*cS.v));\n TAU_H = 1.0/(AH+BH);\n exptauht_t = Math.exp(-cS.timestep/TAU_H);\n\n AJ = (cS.v > -40) ? 0. : (((-2.5428e4)*Math.exp(0.2444*cS.v)-(6.948e-6)*Math.exp(-0.04391*cS.v))*(cS.v+37.78)/(1.+Math.exp(0.311*(cS.v+79.23))));\n BJ = (cS.v > -40) ? (0.6*Math.exp((0.057)*cS.v)/(1.+Math.exp(-0.1*(cS.v+32.))))\n : (0.02424*Math.exp(-0.01052*cS.v)/(1.+Math.exp(-0.1378*(cS.v+40.14))));\n TAU_J = 1.0/(AJ+BJ);\n exptaujt_t = Math.exp(-cS.timestep/TAU_J);\n\n jinft_t = hinft_t;\n\n xr1inft_t = 1.0/(1.+Math.exp((-26.-cS.v)/7.));\n\n axr1 = 450.0/(1.+Math.exp((-45.-cS.v)/10.));\n bxr1 = 6.0/(1.+Math.exp((cS.v-(-30.))/11.5));\n TAU_Xr1 = axr1*bxr1;\n exptauxr1t_t = Math.exp(-cS.timestep/TAU_Xr1);\n\n\n xr2inft_t = 1.0/(1.+Math.exp((cS.v-(-88.))/24.));\n \n axr2 = 3.0/(1.+Math.exp((-60.-cS.v)/20.));\n bxr2 = 1.12/(1.+Math.exp((cS.v-60.)/20.));\n TAU_Xr2 = axr2*bxr2;\n exptauxr2t_t = Math.exp(-cS.timestep/TAU_Xr2);\n\n xsinft_t = 1.0/(1.+ Math.exp((-5.-cS.v)/14.));\n\n Axs = (1400.0/(Math.sqrt(1.+Math.exp((5.-cS.v)/6.))));\n Bxs = (1.0/(1.+ Math.exp((cS.v-35.)/15.)));\n TAU_Xs = Axs*Bxs+80.;\n exptauxst_t = Math.exp(-cS.timestep/TAU_Xs);\n\n rinft_t = ( cS.itype === 'epi') ? 1.0/(1.+ Math.exp((20.- cS.v)/6.)) \n : ( cS.itype === 'endo' ) ? 1.0/(1.+Math.exp((20.-cS.v)/6.))\n : 1.0/(1.+ Math.exp((20.-cS.v)/6.)) ; // (cS.itype === 'M')\n\n sinft_t = ( cS.itype === 'epi') ? 1.0/(1.+Math.exp((cS.v+20.)/5.))\n : ( cS.itype === 'endo' ) ? 1.0/(1.+ Math.exp((cS.v+28.)/5.))\n : 1.0/(1.+ Math.exp((cS.v+20.)/5.)); // (cS.itype === 'M')\n\n TAU_R = ( cS.itype === 'epi') ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : ( cS.itype === 'endo' ) ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8; // (cS.itype === 'M')\n\n TAU_S = ( cS.itype === 'epi') ? 85.* Math.exp(-(cS.v+45.)*(cS.v+45.)/320.) +5.0/(1.+Math.exp((cS.v-20.)/5.))+3. \n : ( cS.itype === 'endo' ) ? 1000.*Math.exp(-(cS.v+67.)*(cS.v+67.)/1000.)+8.\n : 85.*Math.exp(-(cS.v+45.)*(cS.v+45.)/320.)+5.0/(1.+Math.exp((cS.v-20.)/5.))+3.; // (cS.itype === 'M')\n \n exptaurt_t = Math.exp(-cS.timestep/TAU_R);\n exptaust_t = Math.exp(-cS.timestep/TAU_S);\n \n dinft_t = 1.0/(1.+Math.exp((-8.-cS.v)/7.5));\n \n Ad = 1.4/(1.+Math.exp((-35.-cS.v)/13.))+0.25;\n Bd = 1.4/(1.+Math.exp((cS.v+5.)/5.));\n Cd = 1.0/(1.+Math.exp((50.-cS.v)/20.));\n TAU_D = Ad*Bd+Cd;\n exptaudt_t = Math.exp(-cS.timestep/TAU_D);\n\n finft_t = 1.0/(1.+Math.exp((cS.v+20.)/7.));\n\n Af = 1102.5*Math.exp(-(cS.v+27.)*(cS.v+27.)/225.);\n Bf = 200.0/(1.+Math.exp((13.-cS.v)/10.));\n Cf = (180.0/(1.+Math.exp((cS.v+30.)/10.)))+20.;\n TAU_F = Af+Bf+Cf;\n exptauft_t = Math.exp(-cS.timestep/TAU_F);\n\n f2inft_t = 0.67/(1.+Math.exp((cS.v+35.)/7.))+0.33;\n\n //original code had the following, but paper uses denom of 170**2, not 7**2\n\n Af2 = 600.*Math.exp(-(cS.v+25.)*(cS.v+25.)/49.);\n\n // paper value for Af2 is INCORRECT to match the figure\n //Af2=600.*exp(-(vv+25.)*(vv+25.)/(170.*170.))\n \n Bf2 = 31.0/(1.+Math.exp((25.-cS.v)/10.));\n Cf2 = 16.0/(1.+Math.exp((cS.v+30.)/10.));\n TAU_F2 = Af2+Bf2+Cf2\n exptauf2t_t = Math.exp(-cS.timestep/TAU_F2);\n\n inakcoefft_t = (1.0/(1.+0.1245*Math.exp(-0.1*cS.v*cC.fort)+0.0353*Math.exp(-cS.v*cC.fort)))*cS.knak*(cS.Ko/(cS.Ko+cS.KmK)); \n ipkcoefft_t = cS.GpK/(1.+Math.exp((25.-cS.v)/5.98)); \n temp = Math.exp(2*(cS.v-15)*cC.fort);\n\n if(!(Math.abs(cS.v-15.) < 1e-4)){\n // need implemented\n ical1t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)* (0.25*temp)/(temp-1.);\n ical2t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)*cS.Cao/(temp-1.);\n }\n \n temp = Math.exp((cS.n-1.)*cS.v*cC.fort);\n temp2 = cS.knaca/((cC.KmNai3+cC.Nao3)*(cS.KmCa+cS.Cao)*(1.+cS.ksat*temp));\n inaca1t_t = temp2*Math.exp(cS.n*cS.v*cC.fort)*cS.Cao;\n inaca2t_t = temp2*temp*cC.Nao3*cS.alphanaca; \n\n\n //reversal potentials\n Ek = cC.rtof*(Math.log((cS.Ko/cS.ki)));\n Ena = cC.rtof*(Math.log((cS.Nao/cS.nai)));\n Eks = cC.rtof*(Math.log((cS.Ko+cS.pKNa*cS.Nao)/(cS.ki+cS.pKNa*cS.nai)));\n Eca = 0.5*cC.rtof*(Math.log((cS.Cao/cS.cai)));\n \n // need to figure out vmek is (cS.v - Ek) \n Ak1 = 0.1/(1.+Math.exp(0.06*((cS.v - Ek)-200.)));\n Bk1 = (3.*Math.exp(0.0002*((cS.v - Ek)+100.))+Math.exp(0.1*((cS.v - Ek)-10.)))/(1.+Math.exp(-0.5*((cS.v - Ek)))); \n ik1coefft_t = cS.GK1*Ak1/(Ak1+Bk1); \n \n fcassinft_t = 0.6/(1+(cS.cass/0.05)*(cS.cass/0.05))+0.4;\n temp = 80.0/(1+(cS.cass/0.05)*(cS.cass/0.05))+2.;\n exptaufcasst_t = Math.exp(-cS.timestep/temp); \n\n //stimulus\n\n cS.Istim = _s1s2Stimulus(count, settings);\n \n //Compute currents\n\n cS.sm = minft_t - (minft_t-cS.sm)*exptaumt_t;\n cS.sh = hinft_t - (hinft_t-cS.sh)*exptauht_t;\n cS.sj = jinft_t - (jinft_t-cS.sj)*exptaujt_t;\n cS.ina = cS.GNa*cS.sm *cS.sm *cS.sm *cS.sh*cS.sj*(cS.v-Ena); \n\n cS.sxr1 = xr1inft_t-(xr1inft_t - cS.sxr1) * exptauxr1t_t;\n\n \n cS.sxr2 = xr2inft_t-(xr2inft_t - cS.sxr2) * exptauxr2t_t;\n \n cS.ikr = cS.Gkr*cC.Gkrfactor*cS.sxr1*cS.sxr2*(cS.v-Ek); \n \n cS.sxs = xsinft_t-(xsinft_t-cS.sxs)*exptauxst_t;\n\n cS.iks = cS.Gks*cS.sxs*cS.sxs*(cS.v-Eks);\n\n cS.sr = rinft_t-(rinft_t-cS.sr)*exptaurt_t;\n\n cS.ss = sinft_t-(sinft_t-cS.ss)*exptaust_t;\n\n cS.ito = cS.Gto*cS.sr*cS.ss*(cS.v-Ek);\n\n cS.sd = dinft_t-(dinft_t-cS.sd)*exptaudt_t;\n\n cS.sf = finft_t-(finft_t-cS.sf)*exptauft_t;\n\n cS.sf2 = f2inft_t-(f2inft_t-cS.sf2)*exptauf2t_t; \n\n FCaSS_INF = (cS.cass > cS.casshi) ? 0.4 : fcassinft_t ;\n\n exptaufcass = (cS.cass > cS.casshi) ? cC.exptaufcassinf : exptaufcasst_t;\n\n cS.sfcass = FCaSS_INF-(FCaSS_INF- cS.sfcass)*exptaufcass;\n\n cS.ical = cS.sd*cS.sf*cS.sf2*cS.sfcass*(ical1t_t* cS.cass - ical2t_t);\n\n cS.ik1 = ik1coefft_t*(cS.v-Ek);\n\n cS.ipk = ipkcoefft_t*(cS.v-Ek);\n\n cS.inaca = inaca1t_t*cS.nai*cS.nai*cS.nai-inaca2t_t*cS.cai;\n\n cS.inak = inakcoefft_t*(cS.nai/(cS.nai+cS.KmNa));\n\n cS.ipca = cS.GpCa*cS.cai/(cS.KpCa+cS.cai);\n\n cS.ibna = cS.GbNa*(cS.v-Ena);\n\n cS.ibca = cS.GbCa*(cS.v-Eca);\n\n //total current\n cS.sItot = cS.ikr+ cS.iks+ cS.ik1+ cS.ito+ cS.ina+ cS.ibna+ cS.ical+ cS.ibca+ cS.inak+ cS.inaca+ cS.ipca+ cS.ipk+ cS.Istim;\n\n //console.log(cS.ikr, cS.iks, cS.ik1, cS.ito, cS.ina, cS.ibna, cS.ical, cS.ibca, cS.inak, cS.inaca, cS.ipca, cS.ipk, cS.Istim);\n\n //update concentrations\n\n kCaSR = cS.maxsr-((cS.maxsr-cS.minsr)/(1+(cS.EC/cS.casr*(cS.EC/cS.casr))));\n k1 = cS.k1prime/kCaSR;\n k2 = cS.k2prime*kCaSR;\n dRR = cS.k4*(1.-cS.srr)-k2*cS.cass*cS.srr;\n cS.srr = cS.srr+cS.timestep*dRR;\n sOO = k1*cS.cass*cS.cass*cS.srr/(cS.k3+k1*cS.cass*cS.cass);\n\n //intracellular calcium currents\n\n cS.Irel = cS.Vrel*sOO*(cS.casr- cS.cass);\n cS.Ileak = cS.Vleak*(cS.casr-cS.cai);\n cS.Iup = cS.Vmaxup/(1.+((cS.Kup*cS.Kup)/(cS.cai*cS.cai)));\n cS.Ixfer = cS.Vxfer*(cS.cass - cS.cai);\n\n\n CaCSQN = cS.Bufsr*cS.casr/(cS.casr+cS.Kbufsr);\n dCaSR = cS.timestep*(cS.Iup-cS.Irel-cS.Ileak);\n bjsr = cS.Bufsr-CaCSQN-dCaSR-cS.casr+cS.Kbufsr;\n cjsr = cS.Kbufsr*(CaCSQN+dCaSR+cS.casr);\n cS.casr = (Math.sqrt(bjsr*bjsr+4.*cjsr)-bjsr)/2.;\n\n CaSSBuf = cS.Bufss * cS.cass/(cS.cass+cS.Kbufss);\n dCaSS = cS.timestep * (-cS.Ixfer*(cS.Vc/cS.Vss)+cS.Irel*(cS.Vsr/cS.Vss)+(-cS.ical*cC.inversevssF2*cS.CAPACITANCE)); \n bcss = cS.Bufss - CaSSBuf - dCaSS - cS.cass+cS.Kbufss;\n ccss = cS.Kbufss*(CaSSBuf+dCaSS+cS.cass);\n cS.cass = (Math.sqrt(bcss*bcss+4.*ccss)-bcss)/2.;\n\n CaBuf = cS.Bufc*cS.cai/(cS.cai+cS.Kbufc);\n dCai = cS.timestep *((-(cS.ibca+cS.ipca-2*cS.inaca)*cC.inverseVcF2*cS.CAPACITANCE)-(cS.Iup-cS.Ileak)*(cS.Vsr/cS.Vc)+cS.Ixfer); \n bc = cS.Bufc-CaBuf-dCai-cS.cai+cS.Kbufc;\n cc = cS.Kbufc*(CaBuf+dCai+cS.cai);\n cS.cai = (Math.sqrt(bc*bc+4.*cc)-bc)/2.;\n\n dNai = -(cS.ina+cS.ibna+3.*cS.inak+3.*cS.inaca)*cC.inverseVcF*cS.CAPACITANCE;\n cS.nai = cS.nai+cS.timestep*dNai;\n\n dKi = -(cS.Istim+cS.ik1+cS.ito+cS.ikr+cS.iks-2.*cS.inak+cS.ipk)*cC.inverseVcF*cS.CAPACITANCE; \n cS.ki = cS.ki+cS.timestep*dKi;\n cS.v = cS.v - cS.sItot * cS.timestep ;\n \n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n\n return data; \n }", "function calculateNext(data) {\n \n\t\tvar yinft_t, exptauyt_t, xinft_t, exptauxt_t, ikcoefft_t, rinft_t, exptaurt_t, itoterm1t_t, itoterm2t_t, itoterm3t_t,\n\t\tinacaterm1t_t, inacaterm2t_t, minft_t, exptaumt_t, hinft_t, exptauht_t, dinft_t, exptaudt_t, finft_t, exptauft_t,\n\t\tisicaterm1t_t, isikterm1t_t, isikterm2t_t, pinft_t, exptaupt_t, ik1term1t_t, \n\n\t\tadum, bdum, ena, ek, emh, eca, vmek, yinf, exptauy, ikc, inac, ionc, xinf, exptaux, ikcoeff, ik1term1, rinf, exptaur,\n\t\titoterm1, itoterm2, itoterm3, icac, inacaterm1, inacaterm2, nai3, dum2, dum3, dum4, minf, exptaum, hinf, exptauh, \n\t\tdinf, exptaud, finf, exptauf, tvar, inf, isicaterm1, isikterm1, isikterm2, imk, imna, imca, iion,\n\t\tfactor, derv, pinf, exptaup, iup, itr, irel, dcaup, dcarel, dcai, dna, dk ;\n\n\t\tadum = 0.05 * Math.exp(-0.067 * (cS.v + 42.));\n bdum = (Math.abs(cS.v + 42.) <= 1e-6) ? 2.5 : (cS.v + 42.) / (1.- Math.exp(-0.2 * (cS.v + 42.)));\n cS.tau = adum + bdum;\n yinft_t = adum / cS.tau;\n exptauyt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 0.5 * Math.exp(0.0826 * (cS.v + 50.)) / (1.0 + Math.exp(0.057 * (cS.v + 50.)));\n bdum = 1.3 * Math.exp(-0.06 * (cS.v + 20.)) / (1. + Math.exp(-0.04 * (cS.v + 20.)));\n cS.tau = adum + bdum;\n xinft_t = adum / cS.tau;\n exptauxt_t = Math.exp(-cS.timestep * cS.tau);\n ikcoefft_t = Math.exp(-cS.v * cC.fort);\n adum = 0.033 * Math.exp(-cS.v / 17.);\n bdum = 33. / (1. + Math.exp(-(cS.v + 10.) / 8.));\n cS.tau = adum + bdum;\n rinft_t = adum / cS.tau;\n exptaurt_t = Math.exp(-cS.timestep * cS.tau);\n itoterm1t_t = (Math.abs(cS.v + 10.) <= (10e-6)) ? 5. : (cS.v + 10.) / (1.-Math.exp(-2. * (cS.v + 10.)));\n itoterm2t_t = Math.exp(.02 * cS.v);\n itoterm3t_t = Math.exp(-.02 * cS.v);\n inacaterm1t_t = Math.exp(cS.gamma * cS.v * cC.fort);\n inacaterm2t_t = Math.exp((cS.gamma - 1.) * cS.v * cC.fort);\n adum = (Math.abs(cS.v + 41.) <= 1e-6) ? 2000 : 200. * (cS.v + 41.) / (1.-Math.exp(-0.1 * (cS.v + 41.)));\n bdum = 8000. * Math.exp(-0.056 * (cS.v + 66.));\n cS.tau = adum + bdum;\n minft_t = adum / cS.tau;\n exptaumt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 20. * Math.exp(-0.125 * (cS.v + 75.));\n bdum = 2000. / (1. + 320. * Math.exp(-0.1 * (cS.v + 75.)));\n cS.tau = adum + bdum;\n hinft_t = adum / cS.tau;\n exptauht_t = Math.exp(-cS.timestep * cS.tau);\n if(Math.abs(cS.v + 19.) <= 1e-6){\n adum = 120.;\n bdum = 120.;\n }\n else{\n adum = 30. * (cS.v + 19.) / (1.-Math.exp(-(cS.v + 19.) / 4.));\n bdum = 12. * (cS.v + 19.) / (Math.exp((cS.v + 19.) / 10.)-1.);\n }\n cS.tau = adum + bdum;\n dinft_t = adum / cS.tau;\n exptaudt_t = Math.exp(-cS.timestep * cS.tau);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 25. : 6.25 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 50. / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n finft_t = adum / cS.tau;\n exptauft_t = Math.exp(-cS.timestep * cS.tau);\n isicaterm1t_t = Math.exp(-2. * (cS.v - 50.) * cC.fort);\n isikterm1t_t = (1.- Math.exp(-(cS.v - 50.) * cC.fort));\n isikterm2t_t = Math.exp((50. - cS.v) * cC.fort);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 2.5 : .625 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 5.0 / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n pinft_t = adum / cS.tau;\n exptaupt_t = Math.exp(-cS.timestep * cS.tau);\n\n // compute equilibrium potentials\n\t\t\n\t\tena = cC.rtof * Math.log(cS.nao / cS.nai);\n ek = cC.rtof * Math.log(cS.kc / cS.ki);\n emh = cC.rtof * Math.log((cS.nao + 0.12 * cS.kc) / (cS.nai + 0.12 * cS.ki));\n eca = 0.5 * cC.rtof * Math.log(cS.cao / cS.cai);\n \n vmek = cS.v - ek;\n ik1term1t_t = cS.gk1 * (vmek) / (1. + Math.exp(2. * (vmek + 10.) * cC.fort));\n\t\t\n\t\t// hyperpolarizing-activated current\n yinf = yinft_t;\n exptauy = exptauyt_t;\n cS.y = yinf - (yinf - cS.y) * exptauy;\n\n cS.ifk = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfk * (cS.v - ek);\n cS.ifna = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfna * (cS.v - ena);\n// cS.ifk = 0.0\n// cS.ifna = 0.0\n ikc = cS.ifk;\n inac = cS.ifna;\n ionc = cS.ifk + cS.ifna;\n\n// time-dependent (delayed K + current)\n xinf = xinft_t;\n exptaux = exptauxt_t;\n cS.x = xinf - (xinf - cS.x) * exptaux;\n\n ikcoeff = ikcoefft_t;\n cS.ik = cS.x * cS.ikmax * (cS.ki - cS.kc * ikcoeff) / 140.;\n ikc = ikc + cS.ik;\n ionc = ionc + cS.ik;\n\n// time-independent (background) K + current\n ik1term1 = ik1term1t_t;\n cS.ik1 = (cS.kc / (cS.kc + cS.km1)) * ik1term1;\n ikc = ikc + cS.ik1;\n ionc = ionc + cS.ik1;\n\n\t\t// transient outward current\n rinf = rinft_t;\n exptaur = exptaurt_t;\n cS.r = rinf - (rinf - cS.r) * exptaur;\n\n itoterm1 = itoterm1t_t;\n itoterm2 = itoterm2t_t;\n itoterm3 = itoterm3t_t;\n cS.ito = (cS.r * cS.gto * (0.2 + (cS.kc / (cS.kc + cS.kmt))) * (cS.cai / \n (cS.kact + cS.cai)) * itoterm1) * (cS.ki * itoterm2-cS.kc * itoterm3); // gto = 0.28\n ikc = ikc + cS.ito;\n ionc = ionc + cS.ito;\n\t\t \n// background sodium current\n cS.ibna = cS.gbna * (cS.v - ena);\n inac = inac + cS.ibna;\n ionc = ionc + cS.ibna;\n\n// background calcium current\n cS.ibca = cS.gbca * (cS.v - eca);\n icac = cS.ibca;\n ionc = ionc + cS.ibca;\n\n// na-k pump exchange current\n cS.inak = cS.ipmax * (cS.kc / (cS.kmk + cS.kc)) * (cS.nai / (cS.kmna + cS.nai));\n ikc = ikc - 2. * cS.inak;\n inac = inac + 3. * cS.inak;\n ionc = ionc + cS.inak;\n\n// na-ca pump exchange current\n inacaterm1 = inacaterm1t_t;\n inacaterm2 = inacaterm2t_t;\n nai3 = cS.nai * cS.nai * cS.nai;\n dum2 = nai3 * cS.cao * inacaterm1;\n dum3 = cC.nao3 * (cS.cai) * inacaterm2;\n dum4 = 1. + cS.dnaca * ((cS.cai) * cC.nao3 + cS.cao * nai3);\n cS.inaca = cS.knaca * (dum2 - dum3) / dum4;\n inac = inac + 3 * cS.inaca;\n icac = icac - 2. * cS.inaca;\n ionc = ionc + cS.inaca;\n\n// fast sodium current\n minf = minft_t;\n exptaum = exptaumt_t;\n cS.m = minf - (minf - cS.m) * exptaum;\n\n hinf = hinft_t;\n exptauh = exptauht_t;\n cS.h = hinf - (hinf - cS.h) * exptauh;\n\n cS.ina = cS.m * cS.m * cS.m * cS.h * cS.gna * (cS.v - emh);\n inac = inac + cS.ina;\n ionc = ionc + cS.ina; \n\n// fast second inward current (calcium)\n dinf = dinft_t;\n exptaud = exptaudt_t;\n cS.d = dinf - (dinf - cS.d) * exptaud;\n\n finf = finft_t;\n exptauf = exptauft_t;\n cS.f = finf - (finf - cS.f) * exptauf;\n\n adum = 5.;\n bdum = cS.cai * adum / cS.kmf2;\n tvar = adum + bdum;\n inf = adum / (adum + bdum);\n cS.f2 = inf - (inf - cS.f2) * Math.exp(-cS.timestep * tvar);\n\n dum2 = cS.d * cS.f * cS.f2 * (4. * cS.psi * (cS.v - 50.) * cC.fort);\n isicaterm1 = isicaterm1t_t;\n dum3 = (1. - isicaterm1);\n dum4 = cS.cai * cC.exp100fort - cS.cao * isicaterm1;\n cS.isica = dum2 * dum4 / dum3;\n icac = icac + cS.isica;\n ionc = ionc + cS.isica;\n\n// more fast inward current\n isikterm1 = isikterm1t_t;\n isikterm2 = isikterm2t_t;\n dum3 = isikterm1;\n dum4 = cS.ki * cC.exp50fort - cS.kc * isikterm2;\n cS.isik = dum2 * dum4 / (400. * dum3);\n ikc = ikc + cS.isik;\n ionc = ionc + cS.isik;\n\n// total currents used to update each ion concentration\n imk = ikc;\n imna = inac;\n imca = icac;\n\n// convert from nanoamperes to microampers per square cm\n\n// iion = 0.015 * ionc\n\n// derv = -1000. * iion / cm\n\n imna = cS.ifna + cS.ina + 3. * cS.inaca + 3. * cS.inak + cS.ibna;\n imk = cS.ifk + cS.ik + cS.ik1 + cS.ito + cS.isik - 2. * cS.inak;\n imca = cS.isica - 2. * cS.inaca + cS.ibca;\n iion = imna + imk + imca;\n\n\n// stimulus\n// if(ttim * 1000.0.le.1.0) then\n// if(mod(it,icycle).le.istimdur) then\n// if(ttim * 1000.0.le.1.0.or.\n// & (ttim * 1000.0.gt.500.0.and.ttim * 1000.0.le.501.0)) then\n// ionc = ionc-10000.0\n// endif\n// 1750 works, 1800 does not so use 1750 as diast. thresh, 3500 = 2 * \n // if(mod(ntime,icycle).le.istimdur) then\n factor = _s1s2Stimulus(count,data);\n iion = iion - factor;\n imk = imk - factor;\n \n derv = iion / cS.cm;\n\n \n// change in intracellular sodium \n dna = (-imna / (cC.vi * cS.fcon)) * cS.timestep;\n cS.nai = cS.nai + dna;\n\n// change in extracellular potassium\n dk = (-cS.prate * (cS.kc - cS.kb) + imk / (cC.ve * cS.fcon)) * cS.timestep;\n cS.kc = cS.kc + dk;\n\n// change in intracellular potassium\n dk = (-imk / (cC.vi * cS.fcon)) * cS.timestep;\n cS.ki = cS.ki + dk;\n\t\t\n// intracellular calcium handling\n pinf = pinft_t;\n exptaup = exptaupt_t;\n cS.p = pinf - (pinf - cS.p) * exptaup;\n\n iup = cC.aup * cS.cai * (cS.cabarup - cS.caup);\n itr = cC.atr * cS.p * (cS.caup - cS.carel);\n irel = cC.arel * cS.carel * (((cS.cai) * cS.cai) / ((cS.cai) * cS.cai + cS.kmca * cS.kmca));\n\n dcaup = ((iup - itr) / (2. * cC.vup * cS.fcon)) * cS.timestep;\n cS.caup = cS.caup + dcaup;\n\n dcarel = ((itr - irel) / (2. * cC.vrel * cS.fcon)) * cS.timestep;\n cS.carel = cS.carel + dcarel;\n\n dcai = (-(imca + iup - irel) / (2. * cC.vi * cS.fcon)) * cS.timestep;\n cS.cai = cS.cai + dcai;\n\n// update voltage\n cS.v = cS.v - cS.timestep * derv;\n\t\t\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "function dft_direct (re, im) {\n let N = re.length;\n // is this necessary? should be able to do DFT with any N\n //if (N.toString(2) % 10) return; // check that N is a power of 2\n\n // array containing N evenly spaced points around the unit circle\n let W = discrete_circle(N);\n\n // debugger;\n // initialize imaginary values to zero if not provided\n im = im || re.map( a => 0 );\n\n // sum (x * W) over N points (0 to N-1), for all frequencies k in N\n return re.map( (_, k) =>\n re.map( (_, n) => cpx_mult([re[n], im[n]], W[n * k % N]) )\n .reduce( (a, b) => cpx_add(a, b) ));\n}", "function fftRadix2(realVals, imagVals, size, inverse, cpuBackend) {\n if (size === 1) {\n return { real: realVals, imag: imagVals };\n }\n const data = backend_util.mergeRealAndImagArrays(realVals, imagVals);\n const half = size / 2;\n const evenComplex = backend_util.complexWithEvenIndex(data);\n const evenRealVals = evenComplex.real;\n const evenImagVals = evenComplex.imag;\n const evenShape = [evenRealVals.length];\n const evenRealInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenRealVals);\n const evenImagInfo = cpuBackend.makeTensorInfo(evenShape, 'float32', evenImagVals);\n const evenTensorInfo = complex({ inputs: { real: evenRealInfo, imag: evenImagInfo }, backend: cpuBackend });\n const oddComplex = backend_util.complexWithOddIndex(data);\n const oddRealVals = oddComplex.real;\n const oddImagVals = oddComplex.imag;\n const oddShape = [oddRealVals.length];\n const oddRealInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddRealVals);\n const oddImagInfo = cpuBackend.makeTensorInfo(oddShape, 'float32', oddImagVals);\n const oddTensorInfo = complex({ inputs: { real: oddRealInfo, imag: oddImagInfo }, backend: cpuBackend });\n // Recursive call for half part of original input.\n const $evenComplex = fftRadix2(evenRealVals, evenImagVals, half, inverse, cpuBackend);\n const $evenRealVals = $evenComplex.real;\n const $evenImagVals = $evenComplex.imag;\n const $evenShape = [$evenRealVals.length];\n const $evenRealInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenRealVals);\n const $evenImagInfo = cpuBackend.makeTensorInfo($evenShape, 'float32', $evenImagVals);\n const $evenTensorInfo = complex({\n inputs: { real: $evenRealInfo, imag: $evenImagInfo },\n backend: cpuBackend\n });\n const $oddComplex = fftRadix2(oddRealVals, oddImagVals, half, inverse, cpuBackend);\n const $oddRealVals = $oddComplex.real;\n const $oddImagVals = $oddComplex.imag;\n const $oddShape = [$oddRealVals.length];\n const $oddRealInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddRealVals);\n const $oddImagInfo = cpuBackend.makeTensorInfo($oddShape, 'float32', $oddImagVals);\n const $oddTensorInfo = complex({ inputs: { real: $oddRealInfo, imag: $oddImagInfo }, backend: cpuBackend });\n const e = backend_util.exponents(size, inverse);\n const eShape = [e.real.length];\n const eRealInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.real);\n const eImagInfo = cpuBackend.makeTensorInfo(eShape, 'float32', e.imag);\n const complexInfo = complex({ inputs: { real: eRealInfo, imag: eImagInfo }, backend: cpuBackend });\n const exponentInfo = multiply({ inputs: { a: complexInfo, b: $oddTensorInfo }, backend: cpuBackend });\n const addPart = add({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const subPart = sub({\n inputs: { a: $evenTensorInfo, b: exponentInfo },\n backend: cpuBackend\n });\n const addPartReal = real({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartReal = real({ inputs: { input: subPart }, backend: cpuBackend });\n const addPartImag = imag({ inputs: { input: addPart }, backend: cpuBackend });\n const subPartImag = imag({ inputs: { input: subPart }, backend: cpuBackend });\n const $real = concat({\n inputs: [addPartReal, subPartReal],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $imag = concat({\n inputs: [addPartImag, subPartImag],\n backend: cpuBackend,\n attrs: { axis: 0 }\n });\n const $realVals = cpuBackend.data.get($real.dataId).values;\n const $imagVals = cpuBackend.data.get($imag.dataId).values;\n cpuBackend.disposeIntermediateTensorInfo(evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($evenTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddRealInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddImagInfo);\n cpuBackend.disposeIntermediateTensorInfo($oddTensorInfo);\n cpuBackend.disposeIntermediateTensorInfo(eRealInfo);\n cpuBackend.disposeIntermediateTensorInfo(eImagInfo);\n cpuBackend.disposeIntermediateTensorInfo(complexInfo);\n cpuBackend.disposeIntermediateTensorInfo(exponentInfo);\n cpuBackend.disposeIntermediateTensorInfo(addPart);\n cpuBackend.disposeIntermediateTensorInfo(subPart);\n cpuBackend.disposeIntermediateTensorInfo(addPartReal);\n cpuBackend.disposeIntermediateTensorInfo(addPartImag);\n cpuBackend.disposeIntermediateTensorInfo(subPartReal);\n cpuBackend.disposeIntermediateTensorInfo(subPartImag);\n cpuBackend.disposeIntermediateTensorInfo($real);\n cpuBackend.disposeIntermediateTensorInfo($imag);\n return { real: $realVals, imag: $imagVals };\n}", "function doFFT(values) {\n\tvar data = new complex_array.ComplexArray(values.length);\n\tdata.real = new Float32Array(values);\n\tvar frequencies = data.FFT();\n\n\treturn frequencies;\n}", "calculateLoudness(buffer) {\n\n // first call or after resetMemory\n if (this.copybuffer == undefined) {\n // how long should the copybuffer be at least? \n // --> at least maxT should fit in and length shall be an integer fraction of buffer length\n let length = Math.floor(this.sampleRate * this.loudnessprops.maxT / buffer.length + 1) * buffer.length;\n this.copybuffer = new CircularAudioBuffer(context, this.nChannels, length, this.sampleRate);\n }\n\n //accumulate buffer to previous call\n this.copybuffer.concat(buffer);\n\n // must be gt nSamplesPerInterval\n // or: wait at least one interval time T to be able to calculate loudness\n if (this.copybuffer.getLength() < this.nSamplesPerInterval) {\n console.log('buffer too small ... have to eat more data');\n return NaN;\n }\n\n // get array of meansquares from buffer of overlapping intervals\n let meanSquares = this.getBufferMeanSquares(this.copybuffer, this.nSamplesPerInterval, this.nStepsize);\n\n // first stage filter\n this.filterBlocks(meanSquares, this.gamma_a);\n\n // second stage filter\n let gamma_r = 0.;\n for (let chIdx = 0; chIdx < this.nChannels; chIdx++) {\n let mean = 0.;\n for (let idx = 0; idx < meanSquares[chIdx].length; idx++) {\n mean += meanSquares[chIdx][idx];\n }\n mean /= meanSquares[chIdx].length;\n gamma_r += (this.channelWeight[chIdx] * mean);\n }\n gamma_r = -0.691 + 10.0 * Math.log10(gamma_r) - 10.;\n\n this.filterBlocks(meanSquares, gamma_r);\n\n // gated loudness from filtered blocks\n let gatedLoudness = 0.;\n for (let chIdx = 0; chIdx < this.nChannels; chIdx++) {\n let mean = 0.;\n for (let idx = 0; idx < meanSquares[chIdx].length; idx++) {\n mean += meanSquares[chIdx][idx];\n }\n mean /= meanSquares[chIdx].length;\n\n gatedLoudness += (this.channelWeight[chIdx] * mean);\n }\n gatedLoudness = -0.691 + 10.0 * Math.log10(gatedLoudness);\n\n //console.log(this.id, '- gatedLoudness:', gatedLoudness);\n\n return gatedLoudness;\n }", "function yt(t){var S,k,_,A,e,u=Math.floor,I=new Array(64),C=new Array(64),T=new Array(64),F=new Array(64),w=new Array(65535),y=new Array(65535),Q=new Array(64),v=new Array(64),P=[],E=0,q=7,O=new Array(64),B=new Array(64),R=new Array(64),n=new Array(256),j=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],D=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],U=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],N=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function G(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(E|=1<<q),n--,--q<0&&(255==E?(V(255),V(0)):V(E),q=7,E=0)}function V(t){P.push(t)}function Y(t){V(t>>8&255),V(255&t)}function X(t,e,n,r,i){for(var o,a=i[0],s=i[240],h=function(t,e){var n,r,i,o,a,s,h,c,l,u,f=0;for(l=0;l<8;++l){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],h=t[f+6];var d=n+(c=t[f+7]),p=n-c,g=r+h,m=r-h,w=i+s,y=i-s,v=o+a,b=o-a,x=d+v,S=d-v,k=g+w,_=g-w;t[f]=x+k,t[f+4]=x-k;var A=.707106781*(_+S);t[f+2]=S+A,t[f+6]=S-A;var I=.382683433*((x=b+y)-(_=m+p)),C=.5411961*x+I,T=1.306562965*_+I,F=.707106781*(k=y+m),P=p+F,E=p-F;t[f+5]=E+C,t[f+3]=E-C,t[f+1]=P+T,t[f+7]=P-T,f+=8}for(l=f=0;l<8;++l){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],h=t[f+48];var q=n+(c=t[f+56]),O=n-c,B=r+h,R=r-h,j=i+s,D=i-s,M=o+a,U=o-a,N=q+M,z=q-M,L=B+j,H=B-j;t[f]=N+L,t[f+32]=N-L;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var G=.382683433*((N=U+D)-(H=R+O)),V=.5411961*N+G,Y=1.306562965*H+G,X=.707106781*(L=D+R),J=O+X,K=O-X;t[f+40]=K+V,t[f+24]=K-V,t[f+8]=J+Y,t[f+56]=J-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],Q[l]=0<u?u+.5|0:u-.5|0;return Q}(t,e),c=0;c<64;++c)v[b[c]]=h[c];var l=v[0]-n;n=v[0],0==l?G(r[0]):(G(r[y[o=32767+l]]),G(w[o]));for(var u=63;0<u&&0==v[u];u--);if(0==u)return G(a),n;for(var f,d=1;d<=u;){for(var p=d;0==v[d]&&d<=u;++d);var g=d-p;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)G(s);g&=15}o=32767+v[d],G(i[(g<<4)+y[o]]),G(w[o]),d++}return 63!=u&&G(a),n}function J(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=u((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),I[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=u((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),C[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],h=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[h]=1/(I[b[h]]*s[c]*s[l]*8),F[h]=1/(C[b[h]]*s[c]*s[l]*8),h++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&J(e),P=new Array,E=0,q=7,Y(65496),Y(65504),Y(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),Y(1),Y(1),V(0),V(0),function(){Y(65499),Y(132),V(0);for(var t=0;t<64;t++)V(I[t]);V(1);for(var e=0;e<64;e++)V(C[e])}(),n=t.width,r=t.height,Y(65472),Y(17),V(8),Y(r),Y(n),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1),function(){Y(65476),Y(418),V(0);for(var t=0;t<16;t++)V(D[t+1]);for(var e=0;e<=11;e++)V(M[e]);V(16);for(var n=0;n<16;n++)V(U[n+1]);for(var r=0;r<=161;r++)V(N[r]);V(1);for(var i=0;i<16;i++)V(z[i+1]);for(var o=0;o<=11;o++)V(L[o]);V(17);for(var a=0;a<16;a++)V(H[a+1]);for(var s=0;s<=161;s++)V(W[s])}(),Y(65498),Y(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var i=0,o=0,a=0;E=0,q=7,this.encode.displayName=\"_encode_\";for(var s,h,c,l,u,f,d,p,g,m=t.data,w=t.width,y=t.height,v=4*w,b=0;b<y;){for(s=0;s<v;){for(f=u=v*b+s,d=-1,g=p=0;g<64;g++)f=u+(p=g>>3)*v+(d=4*(7&g)),y<=b+p&&(f-=v*(b+1+p-y)),v<=s+d&&(f-=s+d-v+4),h=m[f++],c=m[f++],l=m[f++],O[g]=(j[h]+j[c+256>>0]+j[l+512>>0]>>16)-128,B[g]=(j[h+768>>0]+j[c+1024>>0]+j[l+1280>>0]>>16)-128,R[g]=(j[h+1280>>0]+j[c+1536>>0]+j[l+1792>>0]>>16)-128;i=X(O,T,i,S,_),o=X(B,F,o,k,A),a=X(R,F,a,k,A),s+=32}b+=8}if(0<=q){var x=[];x[1]=q+1,x[0]=(1<<q+1)-1,G(x)}return Y(65497),new Uint8Array(P)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),S=r(D,M),k=r(z,L),_=r(U,N),A=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)y[32767+r]=n,w[32767+r]=[],w[32767+r][1]=n,w[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)y[32767+i]=n,w[32767+i]=[],w[32767+i][1]=n,w[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)j[t]=19595*t,j[t+256>>0]=38470*t,j[t+512>>0]=7471*t+32768,j[t+768>>0]=-11059*t,j[t+1024>>0]=-21709*t,j[t+1280>>0]=32768*t+8421375,j[t+1536>>0]=-27439*t,j[t+1792>>0]=-5329*t}(),J(t),(new Date).getTime()}()}", "function _t(t) {\n var N,\n L,\n A,\n S,\n e,\n c = Math.floor,\n _ = new Array(64),\n F = new Array(64),\n P = new Array(64),\n k = new Array(64),\n y = new Array(65535),\n v = new Array(65535),\n Z = new Array(64),\n w = new Array(64),\n I = [],\n C = 0,\n B = 7,\n j = new Array(64),\n E = new Array(64),\n M = new Array(64),\n n = new Array(256),\n O = new Array(2048),\n b = [0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63],\n q = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],\n T = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n R = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125],\n D = [1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250],\n U = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],\n z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n H = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119],\n W = [0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250];\n\n function r(t, e) {\n for (var n = 0, r = 0, i = new Array(), o = 1; o <= 16; o++) {\n for (var a = 1; a <= t[o]; a++) i[e[r]] = [], i[e[r]][0] = n, i[e[r]][1] = o, r++, n++;\n\n n *= 2;\n }\n\n return i;\n }\n\n function V(t) {\n for (var e = t[0], n = t[1] - 1; 0 <= n;) e & 1 << n && (C |= 1 << B), n--, --B < 0 && (255 == C ? (G(255), G(0)) : G(C), B = 7, C = 0);\n }\n\n function G(t) {\n I.push(t);\n }\n\n function Y(t) {\n G(t >> 8 & 255), G(255 & t);\n }\n\n function J(t, e, n, r, i) {\n for (var o, a = i[0], s = i[240], l = function (t, e) {\n var n,\n r,\n i,\n o,\n a,\n s,\n l,\n h,\n u,\n c,\n f = 0;\n\n for (u = 0; u < 8; ++u) {\n n = t[f], r = t[f + 1], i = t[f + 2], o = t[f + 3], a = t[f + 4], s = t[f + 5], l = t[f + 6];\n var p = n + (h = t[f + 7]),\n d = n - h,\n g = r + l,\n m = r - l,\n y = i + s,\n v = i - s,\n w = o + a,\n b = o - a,\n x = p + w,\n N = p - w,\n L = g + y,\n A = g - y;\n t[f] = x + L, t[f + 4] = x - L;\n var S = .707106781 * (A + N);\n t[f + 2] = N + S, t[f + 6] = N - S;\n\n var _ = .382683433 * ((x = b + v) - (A = m + d)),\n F = .5411961 * x + _,\n P = 1.306562965 * A + _,\n k = .707106781 * (L = v + m),\n I = d + k,\n C = d - k;\n\n t[f + 5] = C + F, t[f + 3] = C - F, t[f + 1] = I + P, t[f + 7] = I - P, f += 8;\n }\n\n for (u = f = 0; u < 8; ++u) {\n n = t[f], r = t[f + 8], i = t[f + 16], o = t[f + 24], a = t[f + 32], s = t[f + 40], l = t[f + 48];\n var B = n + (h = t[f + 56]),\n j = n - h,\n E = r + l,\n M = r - l,\n O = i + s,\n q = i - s,\n T = o + a,\n R = o - a,\n D = B + T,\n U = B - T,\n z = E + O,\n H = E - O;\n t[f] = D + z, t[f + 32] = D - z;\n var W = .707106781 * (H + U);\n t[f + 16] = U + W, t[f + 48] = U - W;\n var V = .382683433 * ((D = R + q) - (H = M + j)),\n G = .5411961 * D + V,\n Y = 1.306562965 * H + V,\n J = .707106781 * (z = q + M),\n X = j + J,\n K = j - J;\n t[f + 40] = K + G, t[f + 24] = K - G, t[f + 8] = X + Y, t[f + 56] = X - Y, f++;\n }\n\n for (u = 0; u < 64; ++u) c = t[u] * e[u], Z[u] = 0 < c ? c + .5 | 0 : c - .5 | 0;\n\n return Z;\n }(t, e), h = 0; h < 64; ++h) w[b[h]] = l[h];\n\n var u = w[0] - n;\n n = w[0], 0 == u ? V(r[0]) : (V(r[v[o = 32767 + u]]), V(y[o]));\n\n for (var c = 63; 0 < c && 0 == w[c]; c--);\n\n if (0 == c) return V(a), n;\n\n for (var f, p = 1; p <= c;) {\n for (var d = p; 0 == w[p] && p <= c; ++p);\n\n var g = p - d;\n\n if (16 <= g) {\n f = g >> 4;\n\n for (var m = 1; m <= f; ++m) V(s);\n\n g &= 15;\n }\n\n o = 32767 + w[p], V(i[(g << 4) + v[o]]), V(y[o]), p++;\n }\n\n return 63 != c && V(a), n;\n }\n\n function X(t) {\n if (t <= 0 && (t = 1), 100 < t && (t = 100), e != t) {\n (function (t) {\n for (var e = [16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99], n = 0; n < 64; n++) {\n var r = c((e[n] * t + 50) / 100);\n r < 1 ? r = 1 : 255 < r && (r = 255), _[b[n]] = r;\n }\n\n for (var i = [17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99], o = 0; o < 64; o++) {\n var a = c((i[o] * t + 50) / 100);\n a < 1 ? a = 1 : 255 < a && (a = 255), F[b[o]] = a;\n }\n\n for (var s = [1, 1.387039845, 1.306562965, 1.175875602, 1, .785694958, .5411961, .275899379], l = 0, h = 0; h < 8; h++) for (var u = 0; u < 8; u++) P[l] = 1 / (_[b[l]] * s[h] * s[u] * 8), k[l] = 1 / (F[b[l]] * s[h] * s[u] * 8), l++;\n })(t < 50 ? Math.floor(5e3 / t) : Math.floor(200 - 2 * t)), e = t;\n }\n }\n\n this.encode = function (t, e) {\n var n, r;\n new Date().getTime();\n e && X(e), I = new Array(), C = 0, B = 7, Y(65496), Y(65504), Y(16), G(74), G(70), G(73), G(70), G(0), G(1), G(1), G(0), Y(1), Y(1), G(0), G(0), function () {\n Y(65499), Y(132), G(0);\n\n for (var t = 0; t < 64; t++) G(_[t]);\n\n G(1);\n\n for (var e = 0; e < 64; e++) G(F[e]);\n }(), n = t.width, r = t.height, Y(65472), Y(17), G(8), Y(r), Y(n), G(3), G(1), G(17), G(0), G(2), G(17), G(1), G(3), G(17), G(1), function () {\n Y(65476), Y(418), G(0);\n\n for (var t = 0; t < 16; t++) G(q[t + 1]);\n\n for (var e = 0; e <= 11; e++) G(T[e]);\n\n G(16);\n\n for (var n = 0; n < 16; n++) G(R[n + 1]);\n\n for (var r = 0; r <= 161; r++) G(D[r]);\n\n G(1);\n\n for (var i = 0; i < 16; i++) G(U[i + 1]);\n\n for (var o = 0; o <= 11; o++) G(z[o]);\n\n G(17);\n\n for (var a = 0; a < 16; a++) G(H[a + 1]);\n\n for (var s = 0; s <= 161; s++) G(W[s]);\n }(), Y(65498), Y(12), G(3), G(1), G(0), G(2), G(17), G(3), G(17), G(0), G(63), G(0);\n var i = 0,\n o = 0,\n a = 0;\n C = 0, B = 7, this.encode.displayName = \"_encode_\";\n\n for (var s, l, h, u, c, f, p, d, g, m = t.data, y = t.width, v = t.height, w = 4 * y, b = 0; b < v;) {\n for (s = 0; s < w;) {\n for (f = c = w * b + s, p = -1, g = d = 0; g < 64; g++) f = c + (d = g >> 3) * w + (p = 4 * (7 & g)), v <= b + d && (f -= w * (b + 1 + d - v)), w <= s + p && (f -= s + p - w + 4), l = m[f++], h = m[f++], u = m[f++], j[g] = (O[l] + O[h + 256 >> 0] + O[u + 512 >> 0] >> 16) - 128, E[g] = (O[l + 768 >> 0] + O[h + 1024 >> 0] + O[u + 1280 >> 0] >> 16) - 128, M[g] = (O[l + 1280 >> 0] + O[h + 1536 >> 0] + O[u + 1792 >> 0] >> 16) - 128;\n\n i = J(j, P, i, N, A), o = J(E, k, o, L, S), a = J(M, k, a, L, S), s += 32;\n }\n\n b += 8;\n }\n\n if (0 <= B) {\n var x = [];\n x[1] = B + 1, x[0] = (1 << B + 1) - 1, V(x);\n }\n\n return Y(65497), new Uint8Array(I);\n }, function () {\n new Date().getTime();\n t || (t = 50), function () {\n for (var t = String.fromCharCode, e = 0; e < 256; e++) n[e] = t(e);\n }(), N = r(q, T), L = r(U, z), A = r(R, D), S = r(H, W), function () {\n for (var t = 1, e = 2, n = 1; n <= 15; n++) {\n for (var r = t; r < e; r++) v[32767 + r] = n, y[32767 + r] = [], y[32767 + r][1] = n, y[32767 + r][0] = r;\n\n for (var i = -(e - 1); i <= -t; i++) v[32767 + i] = n, y[32767 + i] = [], y[32767 + i][1] = n, y[32767 + i][0] = e - 1 + i;\n\n t <<= 1, e <<= 1;\n }\n }(), function () {\n for (var t = 0; t < 256; t++) O[t] = 19595 * t, O[t + 256 >> 0] = 38470 * t, O[t + 512 >> 0] = 7471 * t + 32768, O[t + 768 >> 0] = -11059 * t, O[t + 1024 >> 0] = -21709 * t, O[t + 1280 >> 0] = 32768 * t + 8421375, O[t + 1536 >> 0] = -27439 * t, O[t + 1792 >> 0] = -5329 * t;\n }(), X(t), new Date().getTime();\n }();\n }", "twistMU() {\n this.fourCycle(this.edgeLoc, 1, 4, 7, 10, this.edgeOrient, 1, 1, 1, 1, 2);\n this.fourCycle(this.sideLoc, 3, 2, 0, 5, this.sideOrient, 2, 1, 2, 3, 4);\n }", "function draw() {\n\t background(0);\n\t var spectrum = fft.analyze();// run the FFT analysis\n\n/*\nLocal Variable, fft.getEnergy maps the different \nfrequencies of the audio and returns values between 0 and 255\n*/\n var bass = fft.getEnergy( \"bass\" );\n var treble = fft.getEnergy( \"treble\" );\n var highMid = fft.getEnergy( \"highMid\" ); \n\n/* \nLocal variable which assigns values to the mapped frequencies\n*/\n var mapMid = map( highMid, 0, 255, -50, 255 );\n var mapTreble = map( treble, 0, 255, -140, 200 );\n\n var pieces = 60;//Local variable for the number of lines in the shape\n var radius = 350\n \t translate (width/2, height/2);// Moves origin to the centre of the canvas\n \t stroke (0);\n \tstrokeWeight(3);\n for( i = 0; i < pieces; i++ ) { // draws a shape of each piece\n \t\n stroke(219, 162, 188);\n rotate(frameCount * 0.0001);\n line(mapMid, mapMid, 10, bass ); \n stroke(17, 218, 211);\n point(mapTreble, 480);\n point(mapMid, 670);\n \n /* \n Push() adds a new item at the end of the array.\n Pop() removes the last item of an array\n */\n push();\n rotate(-frameCount * 0.01);\n stroke(17, 218, 211);\n point(120, bass) ;\n fill(17, 218, 211);\n point(bass,300) ;\n pop();\n \n push();\n rotate(-frameCount * 0.01);//negative framecount allows points to spin counter clockwise\n stroke(219, 162, 188);\n point(550, bass) ;\n point(430, mapTreble) ;\n line( bass, 740, mouseY, 740 );\n pop();\n\n }\n}", "function FFTM(x,y){this.x=x;this.y=y;}", "function FFTM(x,y){this.x=x;this.y=y;}", "function initFourierImage() {\r\n //event listeners\r\n function loadImage(loc) {\r\n var start = +new Date();\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //draw the initial image\r\n var img = new Image();\r\n img.addEventListener('load', function() {\r\n //make each canvas the image's exact size\r\n dims[0] = img.width;\r\n dims[1] = img.height;\r\n for (var ai = 0; ai < 4; ai++) {\r\n canvases[ai] = $s('#canvas'+ai);\r\n canvases[ai].width = dims[0], canvases[ai].height = dims[1];\r\n ctxs[ai] = canvases[ai].getContext('2d');\r\n }\r\n\r\n //draw the image to the canvas\r\n ctxs[0].drawImage(img, 0, 0, img.width, img.height);\r\n\r\n //grab the pixels\r\n var imageData = ctxs[0].getImageData(0, 0, dims[0], dims[1]);\r\n var h_es = []; //the h values\r\n for (var ai = 0; ai < imageData.data.length; ai+=4) {\r\n //greyscale, so you only need every 4th value\r\n h_es.push(imageData.data[ai]);\r\n }\r\n\r\n //initialize the h values\r\n h = function(n, m) {\r\n if (arguments.length === 0) return h_es;\r\n\r\n var idx = n*dims[0] + m;\r\n return h_es[idx];\r\n }; //create it in function form to make the code match the math\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to draw the image.');\r\n });\r\n img.src = loc;\r\n });\r\n }\r\n $s('#draw-cs-btn').addEventListener('click', function() {\r\n loadImage('cs.png');\r\n });\r\n $s('#draw-circle-btn').addEventListener('click', function() {\r\n loadImage('circle.png');\r\n });\r\n $s('#draw-grace-btn').addEventListener('click', function() {\r\n loadImage('grace.png');\r\n });\r\n\r\n $s('#transform-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h()) return alert('You need to draw an image to canvas 1 first.');\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h hat values\r\n var h_hats = [];\r\n FFT(h_hats, h());\r\n h_hats = shiftFFT(h_hats);\r\n\r\n //get the largest magnitude\r\n var maxMagnitude = 0;\r\n for (var ai = 0; ai < h_hats.length; ai++) {\r\n var mag = h_hats[ai].magnitude();\r\n if (mag > maxMagnitude) {\r\n maxMagnitude = mag;\r\n }\r\n }\r\n\r\n //apply a low or high pass filter\r\n var lpr = parseInt($s('#low-freq-radius').value); //low pass radius\r\n var hpr = parseInt($s('#high-freq-radius').value); //high \" \"\r\n var N = dims[1], M = dims[0];\r\n for (var k = 0; k < N; k++) {\r\n for (var l = 0; l < M; l++) {\r\n var idx = k*M + l;\r\n var dist = Math.pow(k-M/2, 2) + Math.pow(l-N/2, 2);\r\n if (dist > lpr*lpr && isNaN(hpr) ||\r\n dist < hpr*hpr && isNaN(lpr) ||\r\n dist < lpr*lpr && !isNaN(lpr) && !isNaN(hpr) ||\r\n dist > hpr*hpr && !isNaN(lpr) && !isNaN(hpr)) {\r\n h_hats[idx] = new Complex(0, 0);\r\n }\r\n }\r\n }\r\n\r\n //store them in a nice function to match the math\r\n $h = function(k, l) {\r\n if (arguments.length === 0) return h_hats;\r\n \r\n var idx = k*dims[0] + l;\r\n return h_hats[idx];\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[1].getImageData(0, 0, dims[0], dims[1]);\r\n var logOfMaxMag = Math.log(cc*maxMagnitude+1);\r\n for (var k = 0; k < dims[1]; k++) {\r\n for (var l = 0; l < dims[0]; l++) {\r\n var idxInPixels = 4*(dims[0]*k + l);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n var color = Math.log(cc*$h(k, l).magnitude()+1);\r\n color = Math.round(255*(color/logOfMaxMag));\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = color;\r\n }\r\n }\r\n }\r\n ctxs[1].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the FT.');\r\n });\r\n });\r\n\r\n $s('#reconstruct-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!$h()) {\r\n return alert('You first need to compute the Fourier transform.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //compute the h prime values\r\n var h_primes = [];\r\n var h_hats = $h();\r\n h_hats = unshiftFFT(h_hats);\r\n invFFT(h_primes, h_hats);\r\n\r\n //store them in a nice function to match the math\r\n h_ = function(n, m) {\r\n if (arguments.length === 0) return h_primes;\r\n\r\n var idx = n*dims[0] + m;\r\n return round(h_primes[idx], 2);\r\n };\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[2].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m);\r\n currImageData.data[idxInPixels+3] = 255; //full alpha\r\n for (var c = 0; c < 3; c++) { //RGB are the same, lol c++\r\n currImageData.data[idxInPixels+c] = h_(n, m);\r\n }\r\n }\r\n }\r\n ctxs[2].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to reconstruct the image.');\r\n });\r\n });\r\n\r\n $s('#difference-btn').addEventListener('click', function() {\r\n var start = +new Date();\r\n\r\n if (!h_()) {\r\n return alert('You haven\\'t reconstructed an image yet.');\r\n }\r\n\r\n //placed in a callback so the UI has a chance to update\r\n disableButtons(function() {\r\n //find the range of the errors\r\n var minError = Infinity;\r\n var maxError = 0;\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var error = h_(n, m) - h(n, m);\r\n if (error < minError) minError = error;\r\n if (error > maxError) maxError = error;\r\n }\r\n }\r\n\r\n //draw the pixels\r\n var currImageData = ctxs[3].getImageData(0, 0, dims[0], dims[1]);\r\n for (var n = 0; n < dims[1]; n++) {\r\n for (var m = 0; m < dims[0]; m++) {\r\n var idxInPixels = 4*(dims[0]*n + m); //idx in the pixels array\r\n var error = h_(n, m) - h(n, m);\r\n var color = getCoolColor(error, [minError, maxError]);\r\n for (var c = 0; c < 3; c++) {\r\n currImageData.data[idxInPixels+c] = color[c];\r\n }\r\n currImageData.data[idxInPixels+3] = 255; // fullalpha\t\t\r\n }\r\n }\r\n ctxs[3].putImageData(currImageData, 0, 0);\r\n\r\n enableButtons();\r\n\r\n var duration = +new Date() - start;\r\n console.log('It took '+duration+'ms to compute the difference.');\r\n });\r\n });\r\n\r\n //initialize the working variables\r\n canvases = [], ctxs = [];\r\n h = $h = h_ = function() { return false; };\r\n}", "function fDCTQuant(data, fdtbl)\n {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n /* Pass 1: process rows. */\n var dataOff=0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff+1];\n d2 = data[dataOff+2];\n d3 = data[dataOff+3];\n d4 = data[dataOff+4];\n d5 = data[dataOff+5];\n d6 = data[dataOff+6];\n d7 = data[dataOff+7];\n \n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n \n /* Even part */\n var tmp10 = tmp0 + tmp3; /* phase 2 */\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n \n data[dataOff] = tmp10 + tmp11; /* phase 3 */\n data[dataOff+4] = tmp10 - tmp11;\n \n var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n data[dataOff+2] = tmp13 + z1; /* phase 5 */\n data[dataOff+6] = tmp13 - z1;\n \n /* Odd part */\n tmp10 = tmp4 + tmp5; /* phase 2 */\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n var z3 = tmp11 * 0.707106781; /* c4 */\n \n var z11 = tmp7 + z3; /* phase 5 */\n var z13 = tmp7 - z3;\n \n data[dataOff+5] = z13 + z2; /* phase 6 */\n data[dataOff+3] = z13 - z2;\n data[dataOff+1] = z11 + z4;\n data[dataOff+7] = z11 - z4;\n \n dataOff += 8; /* advance pointer to next row */\n }\n \n /* Pass 2: process columns. */\n dataOff = 0;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n \n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n \n /* Even part */\n var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n \n data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n data[dataOff+32] = tmp10p2 - tmp11p2;\n \n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n data[dataOff+48] = tmp13p2 - z1p2;\n \n /* Odd part */\n tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n \n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n \n var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n var z13p2 = tmp7p2 - z3p2;\n \n data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n data[dataOff+24] = z13p2 - z2p2;\n data[dataOff+ 8] = z11p2 + z4p2;\n data[dataOff+56] = z11p2 - z4p2;\n \n dataOff++; /* advance pointer to next column */\n }\n \n // Quantize/descale the coefficients\n var fDCTQuant;\n for (i=0; i<I64; ++i)\n {\n // Apply the quantization and scaling factor & Round to nearest integer\n fDCTQuant = data[i]*fdtbl[i];\n outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n //outputfDCTQuant[i] = fround(fDCTQuant);\n \n }\n return outputfDCTQuant;\n }", "function transformRadix2(real, imag) {\n\t // Initialization\n\t if (real.length != imag.length) throw \"Mismatched lengths\";\n\t var n = real.length;\n\t if (n == 1) // Trivial transform\n\t return;\n\t var levels = -1;\n\t for (var i = 0; i < 32; i++) {\n\t if (1 << i == n) levels = i; // Equal to log2(n)\n\t }\n\t if (levels == -1) throw \"Length is not a power of 2\";\n\t var cosTable = new Array(n / 2);\n\t var sinTable = new Array(n / 2);\n\t for (var i = 0; i < n / 2; i++) {\n\t cosTable[i] = Math.cos(2 * Math.PI * i / n);\n\t sinTable[i] = Math.sin(2 * Math.PI * i / n);\n\t }\n\n\t // Bit-reversed addressing permutation\n\t for (var i = 0; i < n; i++) {\n\t var j = reverseBits(i, levels);\n\t if (j > i) {\n\t var temp = real[i];\n\t real[i] = real[j];\n\t real[j] = temp;\n\t temp = imag[i];\n\t imag[i] = imag[j];\n\t imag[j] = temp;\n\t }\n\t }\n\n\t // Cooley-Tukey decimation-in-time radix-2 FFT\n\t for (var size = 2; size <= n; size *= 2) {\n\t var halfsize = size / 2;\n\t var tablestep = n / size;\n\t for (var i = 0; i < n; i += size) {\n\t for (var j = i, k = 0; j < i + halfsize; j++, k += tablestep) {\n\t var tpre = real[j + halfsize] * cosTable[k] + imag[j + halfsize] * sinTable[k];\n\t var tpim = -real[j + halfsize] * sinTable[k] + imag[j + halfsize] * cosTable[k];\n\t real[j + halfsize] = real[j] - tpre;\n\t imag[j + halfsize] = imag[j] - tpim;\n\t real[j] += tpre;\n\t imag[j] += tpim;\n\t }\n\t }\n\t }\n\n\t // Returns the integer whose value is the reverse of the lowest 'bits' bits of the integer 'x'.\n\t function reverseBits(x, bits) {\n\t var y = 0;\n\t for (var i = 0; i < bits; i++) {\n\t y = y << 1 | x & 1;\n\t x >>>= 1;\n\t }\n\t return y;\n\t }\n\t}", "function calculateNext(data) {\n \n var hthv, hthw, hthso, hthsi, hthvm, htho, hthvinf, hthwinf,\n tvm, ts, to, twp, twm, tso, tsi, vinf, winf, dv, dw, ds;\n \n cS.istim = _s1s2Stimulus(count,data);\n\n // Step functions\n hthv = (cS.u >= cS.thv);\n hthw = (cS.u >= cS.thw);\n hthso = (cS.u >= cS.thw);\n hthsi = (cS.u >= cS.thw);\n hthvm = (cS.u >= cS.thvm);\n htho = (cS.u >= cS.tho);\n hthvinf = (cS.u >= cS.thvm);\n hthwinf = (cS.u >= cS.tho); //thwinf = tho.\n\n // Multi-part terms\n tvm = (1 - hthvm) * cS.tv1m + hthvm * cS.tv2m;\n ts = (1 - hthw) * cS.ts1 + hthw * cS.ts2;\n to = (1 - htho) * cS.to1 + htho * cS.to2;\n twp = cS.tw1p + (cS.tw2p - cS.tw1p) * (1 + Math.tanh((cS.w - cS.wcp) * cS.kwp)) / 2;\n twm = cS.tw1m + (cS.tw2m - cS.tw1m) * (1 + Math.tanh((cS.u - cS.uwm) * cS.kwm)) / 2;\n tso = cS.tso1 + (cS.tso2 - cS.tso1) * (1 + Math.tanh((cS.u - cS.uso) * cS.kso)) / 2;\n tsi = cS.tsi1 + (cS.tsi1 - cS.tsi1) * (1 + Math.tanh((cS.s - cS.sc) * cS.ksi)) / 2;\n vinf = 1 - hthvinf;\n winf = (1 - hthwinf) * (1 - cS.u / cS.twinf) + hthwinf * cS.winfstar;\n\n // Gate evolution\n dv = (1 - hthv) * (vinf - cS.v) / tvm - hthv * cS.v / cS.tvp;\n dw = (1 - hthw) * (winf - cS.w) / twm - hthw * cS.w / twp;\n ds = ((1 + Math.tanh((cS.u - cS.us) * cS.ks)) / 2 - cS.s) / ts;\n cS.v = cS.v + cS.timestep * dv;\n cS.w = cS.w + cS.timestep * dw;\n cS.s = cS.s + cS.timestep * ds;\n \n // Currents\n cS.xfi = -cS.v * hthv * (cS.u - cS.thv) * (cS.uu - cS.u) / cS.tfi;\n cS.xso = (cS.u - cS.uo) * (1 - hthso) / to + hthso / tso;\n cS.xsi = -hthsi * cS.w * cS.s / tsi;\n \n // update u using forward Euler\n cS.u = cS.u - cS.timestep * (cS.xfi + cS.xso + cS.xsi - cS.istim);\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n \n return data; \n }", "function fDCTQuant(data, fdtbl)\n\t {\n\t var d0, d1, d2, d3, d4, d5, d6, d7;\n\t /* Pass 1: process rows. */\n\t var dataOff=0;\n\t var i;\n\t var I8 = 8;\n\t var I64 = 64;\n\t for (i=0; i<I8; ++i)\n\t {\n\t d0 = data[dataOff];\n\t d1 = data[dataOff+1];\n\t d2 = data[dataOff+2];\n\t d3 = data[dataOff+3];\n\t d4 = data[dataOff+4];\n\t d5 = data[dataOff+5];\n\t d6 = data[dataOff+6];\n\t d7 = data[dataOff+7];\n\t \n\t var tmp0 = d0 + d7;\n\t var tmp7 = d0 - d7;\n\t var tmp1 = d1 + d6;\n\t var tmp6 = d1 - d6;\n\t var tmp2 = d2 + d5;\n\t var tmp5 = d2 - d5;\n\t var tmp3 = d3 + d4;\n\t var tmp4 = d3 - d4;\n\t \n\t /* Even part */\n\t var tmp10 = tmp0 + tmp3; /* phase 2 */\n\t var tmp13 = tmp0 - tmp3;\n\t var tmp11 = tmp1 + tmp2;\n\t var tmp12 = tmp1 - tmp2;\n\t \n\t data[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t data[dataOff+4] = tmp10 - tmp11;\n\t \n\t var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t data[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t data[dataOff+6] = tmp13 - z1;\n\t \n\t /* Odd part */\n\t tmp10 = tmp4 + tmp5; /* phase 2 */\n\t tmp11 = tmp5 + tmp6;\n\t tmp12 = tmp6 + tmp7;\n\t \n\t /* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t var z3 = tmp11 * 0.707106781; /* c4 */\n\t \n\t var z11 = tmp7 + z3; /* phase 5 */\n\t var z13 = tmp7 - z3;\n\t \n\t data[dataOff+5] = z13 + z2; /* phase 6 */\n\t data[dataOff+3] = z13 - z2;\n\t data[dataOff+1] = z11 + z4;\n\t data[dataOff+7] = z11 - z4;\n\t \n\t dataOff += 8; /* advance pointer to next row */\n\t }\n\t \n\t /* Pass 2: process columns. */\n\t dataOff = 0;\n\t for (i=0; i<I8; ++i)\n\t {\n\t d0 = data[dataOff];\n\t d1 = data[dataOff + 8];\n\t d2 = data[dataOff + 16];\n\t d3 = data[dataOff + 24];\n\t d4 = data[dataOff + 32];\n\t d5 = data[dataOff + 40];\n\t d6 = data[dataOff + 48];\n\t d7 = data[dataOff + 56];\n\t \n\t var tmp0p2 = d0 + d7;\n\t var tmp7p2 = d0 - d7;\n\t var tmp1p2 = d1 + d6;\n\t var tmp6p2 = d1 - d6;\n\t var tmp2p2 = d2 + d5;\n\t var tmp5p2 = d2 - d5;\n\t var tmp3p2 = d3 + d4;\n\t var tmp4p2 = d3 - d4;\n\t \n\t /* Even part */\n\t var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n\t var tmp13p2 = tmp0p2 - tmp3p2;\n\t var tmp11p2 = tmp1p2 + tmp2p2;\n\t var tmp12p2 = tmp1p2 - tmp2p2;\n\t \n\t data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t data[dataOff+32] = tmp10p2 - tmp11p2;\n\t \n\t var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t data[dataOff+48] = tmp13p2 - z1p2;\n\t \n\t /* Odd part */\n\t tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t tmp11p2 = tmp5p2 + tmp6p2;\n\t tmp12p2 = tmp6p2 + tmp7p2;\n\t \n\t /* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t \n\t var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n\t var z13p2 = tmp7p2 - z3p2;\n\t \n\t data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t data[dataOff+24] = z13p2 - z2p2;\n\t data[dataOff+ 8] = z11p2 + z4p2;\n\t data[dataOff+56] = z11p2 - z4p2;\n\t \n\t dataOff++; /* advance pointer to next column */\n\t }\n\t \n\t // Quantize/descale the coefficients\n\t var fDCTQuant;\n\t for (i=0; i<I64; ++i)\n\t {\n\t // Apply the quantization and scaling factor & Round to nearest integer\n\t fDCTQuant = data[i]*fdtbl[i];\n\t outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t //outputfDCTQuant[i] = fround(fDCTQuant);\n\t \n\t }\n\t return outputfDCTQuant;\n\t }", "function Poll_FFT_DTMF()\r\n{\r\n //44100 / 1024 = 43,06 Hz saltos 21,533203125 Hz\r\n try\r\n {\r\n if (gb_use_mic_dtmf === true)\r\n { \r\n if ((typeof gb_mic === 'undefined') || (typeof gb_fft === 'undefined'))\r\n {\r\n\treturn;\r\n }\r\n\t \r\n let spectrum = gb_fft.analyze();\r\n let row= -1;\r\n let col= -1; \r\n \r\n if (spectrum[31] > 250){row = 0;}\r\n else{\r\n if (spectrum[35] > 250){row = 1;}\r\n else{\r\n if (spectrum[39] > 250){row = 2;}\r\n else{\r\n if (spectrum[43] > 250){row = 3;}\r\n\t }\r\n }\r\n }\r\n \r\n if (spectrum[55] > 250){col = 0;}\r\n else{\r\n if (spectrum[61] > 250){col = 1;}\r\n else{\r\n if (spectrum[67] > 250){col = 2;}\r\n else{\r\n if (spectrum[76] > 250){col = 3;}\r\n\t }\r\n }\r\n }\r\n \t\t\r\n if ((row>-1) && (col>-1))\r\n {\r\n gb_fft_dtmf = RowColToDtmf(row,col);\r\n gb_cadDTMF = gb_fft_dtmf;\r\n if (gb_fft_dtmf_antes != gb_fft_dtmf)\r\n\t{\t\r\n gb_fft_dtmf_antes = gb_fft_dtmf;\r\n gb_cad_areaRX += gb_fft_dtmf;\t\r\n\t gb_buf_rcv_dtmf += gb_fft_dtmf;\r\n\t gb_event_new_data_dtmf = true;\r\n\t if (gb_fft_dtmf === '#')\r\n\t {\r\n\t gb_begin_sync_dtmf= true;\r\n }\r\n\t switch (gb_fft_dtmf)\r\n\t {\r\n\t case '#': gb_begin_sms = true; gb_end_sms = false; break;\r\n\t case '*': gb_end_sms = true; gb_begin_sms = false; break;\t \r\n\t }\r\n\t if (gb_fft_dtmf === '*')\r\n\t {\r\n\t \r\n\t }\r\n gb_forceDraw = true;\r\n }\r\n }\r\n else\r\n {\r\n gb_fft_dtmf= gb_fft_dtmf_antes= '';\r\n }\r\n }\r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n } \r\n}", "function tone(hh, peak) {\n let spectrum = junco_fft.analyze();\n let hh_value = spectrum[hh]; //TODO:ersetzten durch eigenes highhead value \n debugValues += hh_value.toString()\n debugValues += \" - \"\n if (lastHHval > hh_value) { //vergleichen und schauen in welche Richtung der Track läuft \n if (direction_hh > 0 && lastHHval > peak) { //TODO: anderer Wert\n if (hh === 131) { \n if (spacer < 2 && timer < 5) {\n let step = new Step(hh * 6, Math.floor(peak * 0.5));\n stair.push(step);\n spacer++;\n if (spacer === 1) {\n timer = 10;\n } else if (spacer === 2) {\n timer = 10;\n }\n } else {\n return;\n }\n }\n }\n if (hh === 104) {\n if (spacer < 1 && timer === 0) {\n let step = new Step(hh * 6, Math.floor(peak * 0.5));\n stair.push(step);\n spacer++;\n console.log(spacer)\n timer = 15;\n } else {\n return;\n }\n }\n if (hh === 87) {\n if (spacer < 1 && timer === 0) {\n let step = new Step(hh * 6, Math.floor(peak * 0.4));\n stair.push(step);\n spacer++;\n console.log(spacer)\n timer = 15;\n } else {\n return;\n }\n }\n if (hh === 65) {\n if (spacer < 2 && timer < 5) {\n let step = new Step(hh * 6, Math.floor(peak));\n stair.push(step);\n spacer++;\n if (spacer === 1) {\n timer = 10;\n } else if (spacer === 2) {\n timer = 20;\n }\n } else {\n return;\n }\n }\n direction_hh = -1; //man schaut auf welcher Seite des Ausschlags man ist\n } else {\n direction_hh = 1;\n }\n lastHHval = hh_value;\n}", "function workerThreadFn() {\n\n let that = {};\n\n that.n = 1024;\n that.inverse = true;\n\n that.fft = new FFT.complex(that.n, that.inverse);\n\n parentPort.on('message', (payloadIn)=>{\n // let a = msg.bufferInput;\n // console.log(msg);\n\n let chunkCopy = payloadIn.chunk;\n\n const ffttype = 'complex';\n\n const width = 8*2;\n\n // how many uint32's (how many samples) did we get\n const sz = 1024;\n\n\n var dataView = new DataView(chunkCopy);\n\n\n // it's possible that a proxy may be faster here instead of building bufferInput/fftInput\n // https://ponyfoo.com/articles/es6-proxies-in-depth\n \n let bufferInput = new ArrayBuffer(sz*width); // in bytes\n let bufferOutput = new ArrayBuffer(sz*width); // in bytes\n\n // this.w.postMessage(bufferInput,[bufferInput]);\n\n\n let fftInput = new Float64Array(bufferInput);\n let fftOutput = new Float64Array(bufferOutput);\n // let uint8_out_view = new Uint8Array(bufferOutput);\n\n\n // in place modify of the copy\n for(let i = 0; i < sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);// * this.gain;\n let im = dataView.getFloat64((i*8)+8, true);// * this.gain;\n // console.log('re: ' + re + ' im: ' + im);\n fftInput[i] = re;\n fftInput[i+1] = im;\n }\n\n that.fft.simple(fftOutput, fftInput, ffttype);\n\n const payloadOut = {id:payloadIn.id, bufferOutput:bufferOutput};\n\n parentPort.postMessage(payloadOut, [payloadOut.bufferOutput]);\n // console.log('finished');\n\n\n });\n}", "function fDCTQuant(data, fdtbl)\n {\n var d0, d1, d2, d3, d4, d5, d6, d7;\n /* Pass 1: process rows. */\n var dataOff=0;\n var i;\n var I8 = 8;\n var I64 = 64;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff+1];\n d2 = data[dataOff+2];\n d3 = data[dataOff+3];\n d4 = data[dataOff+4];\n d5 = data[dataOff+5];\n d6 = data[dataOff+6];\n d7 = data[dataOff+7];\n\n var tmp0 = d0 + d7;\n var tmp7 = d0 - d7;\n var tmp1 = d1 + d6;\n var tmp6 = d1 - d6;\n var tmp2 = d2 + d5;\n var tmp5 = d2 - d5;\n var tmp3 = d3 + d4;\n var tmp4 = d3 - d4;\n\n /* Even part */\n var tmp10 = tmp0 + tmp3; /* phase 2 */\n var tmp13 = tmp0 - tmp3;\n var tmp11 = tmp1 + tmp2;\n var tmp12 = tmp1 - tmp2;\n\n data[dataOff] = tmp10 + tmp11; /* phase 3 */\n data[dataOff+4] = tmp10 - tmp11;\n\n var z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n data[dataOff+2] = tmp13 + z1; /* phase 5 */\n data[dataOff+6] = tmp13 - z1;\n\n /* Odd part */\n tmp10 = tmp4 + tmp5; /* phase 2 */\n tmp11 = tmp5 + tmp6;\n tmp12 = tmp6 + tmp7;\n\n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n var z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n var z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n var z3 = tmp11 * 0.707106781; /* c4 */\n\n var z11 = tmp7 + z3; /* phase 5 */\n var z13 = tmp7 - z3;\n\n data[dataOff+5] = z13 + z2; /* phase 6 */\n data[dataOff+3] = z13 - z2;\n data[dataOff+1] = z11 + z4;\n data[dataOff+7] = z11 - z4;\n\n dataOff += 8; /* advance pointer to next row */\n }\n\n /* Pass 2: process columns. */\n dataOff = 0;\n for (i=0; i<I8; ++i)\n {\n d0 = data[dataOff];\n d1 = data[dataOff + 8];\n d2 = data[dataOff + 16];\n d3 = data[dataOff + 24];\n d4 = data[dataOff + 32];\n d5 = data[dataOff + 40];\n d6 = data[dataOff + 48];\n d7 = data[dataOff + 56];\n\n var tmp0p2 = d0 + d7;\n var tmp7p2 = d0 - d7;\n var tmp1p2 = d1 + d6;\n var tmp6p2 = d1 - d6;\n var tmp2p2 = d2 + d5;\n var tmp5p2 = d2 - d5;\n var tmp3p2 = d3 + d4;\n var tmp4p2 = d3 - d4;\n\n /* Even part */\n var tmp10p2 = tmp0p2 + tmp3p2; /* phase 2 */\n var tmp13p2 = tmp0p2 - tmp3p2;\n var tmp11p2 = tmp1p2 + tmp2p2;\n var tmp12p2 = tmp1p2 - tmp2p2;\n\n data[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n data[dataOff+32] = tmp10p2 - tmp11p2;\n\n var z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n data[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n data[dataOff+48] = tmp13p2 - z1p2;\n\n /* Odd part */\n tmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n tmp11p2 = tmp5p2 + tmp6p2;\n tmp12p2 = tmp6p2 + tmp7p2;\n\n /* The rotator is modified from fig 4-8 to avoid extra negations. */\n var z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n var z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n var z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n var z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\n var z11p2 = tmp7p2 + z3p2; /* phase 5 */\n var z13p2 = tmp7p2 - z3p2;\n\n data[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n data[dataOff+24] = z13p2 - z2p2;\n data[dataOff+ 8] = z11p2 + z4p2;\n data[dataOff+56] = z11p2 - z4p2;\n\n dataOff++; /* advance pointer to next column */\n }\n\n // Quantize/descale the coefficients\n var fDCTQuant;\n for (i=0; i<I64; ++i)\n {\n // Apply the quantization and scaling factor & Round to nearest integer\n fDCTQuant = data[i]*fdtbl[i];\n outputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n //outputfDCTQuant[i] = fround(fDCTQuant);\n\n }\n return outputfDCTQuant;\n }", "function TMhs(htma,sol,T_BaseFrame){\n var T0 = [];\n for(var i=0;i<n;i=i+1){\n var RPY = RPYangles(htma[i]); //get old roll angle (RPYangles() returns [[roll],[pitch],[yaw]])\n var phiB = RPY[0][0]; //roll\n var Tb = htma[i]; //transform beform the update\n var Tz = trotz(sol[15][i][0] + -1.0*phiB);\n var T = hlao.matrix_multiplication(Tz,Tb);\n //console.log(T);\n \n if(i == 0){\n var T0n = [\n [T[0][0], T[0][1], T[0][2], T[0][3]],\n [T[1][0], T[1][1], T[1][2], T[1][3]],\n [T[2][0], T[2][1], T[2][2], T[2][3]],\n [T[3][0], T[3][1], T[3][2], T[3][3]]\n ];\n T0[i] = hlao.matrix_multiplication(T_BaseFrame,T0n); //note: T_BaseFrame defined in Tu.js\n } else {\n T0n = hlao.matrix_multiplication(T0n,T);\n T0[i] = hlao.matrix_multiplication(T0[i-1],T);\n }\n }\n \n return [T0, T0n];\n}", "function mt(t){var S,I,k,_,e,u=Math.floor,C=new Array(64),A=new Array(64),T=new Array(64),F=new Array(64),y=new Array(65535),w=new Array(65535),Q=new Array(64),v=new Array(64),P=[],O=0,E=7,q=new Array(64),B=new Array(64),D=new Array(64),n=new Array(256),U=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],j=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],M=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],N=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],L=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var s=1;s<=t[o];s++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function G(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(O|=1<<E),n--,--E<0&&(255==O?(V(255),V(0)):V(O),E=7,O=0)}function V(t){P.push(t)}function Y(t){V(t>>8&255),V(255&t)}function X(t,e,n,r,i){for(var o,s=i[0],a=i[240],h=function(t,e){var n,r,i,o,s,a,h,c,l,u,f=0;for(l=0;l<8;++l){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],s=t[f+4],a=t[f+5],h=t[f+6];var d=n+(c=t[f+7]),p=n-c,g=r+h,m=r-h,y=i+a,w=i-a,v=o+s,b=o-s,x=d+v,S=d-v,I=g+y,k=g-y;t[f]=x+I,t[f+4]=x-I;var _=.707106781*(k+S);t[f+2]=S+_,t[f+6]=S-_;var C=.382683433*((x=b+w)-(k=m+p)),A=.5411961*x+C,T=1.306562965*k+C,F=.707106781*(I=w+m),P=p+F,O=p-F;t[f+5]=O+A,t[f+3]=O-A,t[f+1]=P+T,t[f+7]=P-T,f+=8}for(l=f=0;l<8;++l){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],s=t[f+32],a=t[f+40],h=t[f+48];var E=n+(c=t[f+56]),q=n-c,B=r+h,D=r-h,U=i+a,j=i-a,R=o+s,M=o-s,N=E+R,z=E-R,L=B+U,H=B-U;t[f]=N+L,t[f+32]=N-L;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var G=.382683433*((N=M+j)-(H=D+q)),V=.5411961*N+G,Y=1.306562965*H+G,X=.707106781*(L=j+D),K=q+X,J=q-X;t[f+40]=J+V,t[f+24]=J-V,t[f+8]=K+Y,t[f+56]=K-Y,f++}for(l=0;l<64;++l)u=t[l]*e[l],Q[l]=0<u?u+.5|0:u-.5|0;return Q}(t,e),c=0;c<64;++c)v[b[c]]=h[c];var l=v[0]-n;n=v[0],0==l?G(r[0]):(G(r[w[o=32767+l]]),G(y[o]));for(var u=63;0<u&&0==v[u];u--);if(0==u)return G(s),n;for(var f,d=1;d<=u;){for(var p=d;0==v[d]&&d<=u;++d);var g=d-p;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)G(a);g&=15}o=32767+v[d],G(i[(g<<4)+w[o]]),G(y[o]),d++}return 63!=u&&G(s),n}function K(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=u((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),C[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var s=u((i[o]*t+50)/100);s<1?s=1:255<s&&(s=255),A[b[o]]=s}for(var a=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],h=0,c=0;c<8;c++)for(var l=0;l<8;l++)T[h]=1/(C[b[h]]*a[c]*a[l]*8),F[h]=1/(A[b[h]]*a[c]*a[l]*8),h++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&K(e),P=new Array,O=0,E=7,Y(65496),Y(65504),Y(16),V(74),V(70),V(73),V(70),V(0),V(1),V(1),V(0),Y(1),Y(1),V(0),V(0),function(){Y(65499),Y(132),V(0);for(var t=0;t<64;t++)V(C[t]);V(1);for(var e=0;e<64;e++)V(A[e])}(),n=t.width,r=t.height,Y(65472),Y(17),V(8),Y(r),Y(n),V(3),V(1),V(17),V(0),V(2),V(17),V(1),V(3),V(17),V(1),function(){Y(65476),Y(418),V(0);for(var t=0;t<16;t++)V(j[t+1]);for(var e=0;e<=11;e++)V(R[e]);V(16);for(var n=0;n<16;n++)V(M[n+1]);for(var r=0;r<=161;r++)V(N[r]);V(1);for(var i=0;i<16;i++)V(z[i+1]);for(var o=0;o<=11;o++)V(L[o]);V(17);for(var s=0;s<16;s++)V(H[s+1]);for(var a=0;a<=161;a++)V(W[a])}(),Y(65498),Y(12),V(3),V(1),V(0),V(2),V(17),V(3),V(17),V(0),V(63),V(0);var i=0,o=0,s=0;O=0,E=7,this.encode.displayName=\"_encode_\";for(var a,h,c,l,u,f,d,p,g,m=t.data,y=t.width,w=t.height,v=4*y,b=0;b<w;){for(a=0;a<v;){for(f=u=v*b+a,d=-1,g=p=0;g<64;g++)f=u+(p=g>>3)*v+(d=4*(7&g)),w<=b+p&&(f-=v*(b+1+p-w)),v<=a+d&&(f-=a+d-v+4),h=m[f++],c=m[f++],l=m[f++],q[g]=(U[h]+U[c+256>>0]+U[l+512>>0]>>16)-128,B[g]=(U[h+768>>0]+U[c+1024>>0]+U[l+1280>>0]>>16)-128,D[g]=(U[h+1280>>0]+U[c+1536>>0]+U[l+1792>>0]>>16)-128;i=X(q,T,i,S,k),o=X(B,F,o,I,_),s=X(D,F,s,I,_),a+=32}b+=8}if(0<=E){var x=[];x[1]=E+1,x[0]=(1<<E+1)-1,G(x)}return Y(65497),new Uint8Array(P)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),S=r(j,R),I=r(z,L),k=r(M,N),_=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)w[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)w[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)U[t]=19595*t,U[t+256>>0]=38470*t,U[t+512>>0]=7471*t+32768,U[t+768>>0]=-11059*t,U[t+1024>>0]=-21709*t,U[t+1280>>0]=32768*t+8421375,U[t+1536>>0]=-27439*t,U[t+1792>>0]=-5329*t}(),K(t),(new Date).getTime()}()}", "calculateTCUs (initial_directions, initial_PCEs) {\r\n // Ensure that the TCU volumes are up to date. Here we are assuming the user movement volumes have already been converted to their PCE.\r\n if (initial_directions == -1) {\r\n var direction_array = PROJECT.getIntersectionByID(this._intersection_ID).getZoneByIndex(this._zone_ID - 1).getDirectionArray();\r\n var PCE_table = PROJECT.getIntersectionByID(this._intersection_ID).getZoneByIndex(this._zone_ID - 1).getZonePCEs().getPCEArray();\r\n } else {\r\n var direction_array = initial_directions;\r\n var PCE_table = initial_PCEs.getPCEArray();\r\n console.log(direction_array);\r\n console.log(PCE_table);\r\n }\r\n \r\n for (var direction = 0; direction < 4; direction++) {\r\n \r\n var right_vol = PCE_table[direction].getRight();\r\n var through_vol = PCE_table[direction].getThrough();\r\n var left_vol = PCE_table[direction].getLeft();\r\n \r\n var right_turn_lanes = direction_array[direction].getRightTurn();\r\n var through_lanes = direction_array[direction].getThrough();\r\n var left_turn_lanes = direction_array[direction].getLeftTurn();\r\n var shared_right = direction_array[direction].getSharedRight();\r\n var shared_left = direction_array[direction].getSharedLeft();\r\n var chan_right = direction_array[direction].getChannelizedRight();\r\n \r\n // Gets the direction exactly 2 away from 'direction'; masking by three returns only the 1s and 2s bits (0 - 3)\r\n var opposing_throughs_vol = PCE_table[(direction + 2) & 3].getThrough();\r\n var opposing_right_vol = PCE_table[(direction + 2) & 3].getRight();\r\n var opposing_through_lanes = direction_array[(direction + 2) & 3].getThrough();\r\n var opposing_right_lanes = direction_array[(direction + 2) & 3].getRightTurn();\r\n var opposing_chan_right = direction_array[(direction + 2) & 3].getChannelizedRight();\r\n var opposing_left_lanes = direction_array[(direction + 2) & 3].getLeftTurn();\r\n var opposing_shared_left = direction_array[(direction + 2) & 3].getSharedLeft();\r\n \r\n var this_phase_split;\r\n \r\n if (direction % 2 === 0 && !this._north_south_split_override) {\r\n this._north_south_split_phase = (left_turn_lanes > 0 && shared_left) ? true : \r\n (opposing_left_lanes > 0 && opposing_shared_left) ? true : false;\r\n this_phase_split = this._north_south_split_phase;\r\n } else if (!this._east_west_split_override) {\r\n this._east_west_split_phase = (left_turn_lanes > 0 && shared_left) ? true : \r\n (opposing_left_lanes > 0 && opposing_shared_left) ? true : false;\r\n this_phase_split = this._east_west_split_phase;\r\n }\r\n \r\n if (this_phase_split) {\r\n this._protected_lefts[direction] = false;\r\n } else {\r\n this._protected_lefts[direction] = left_turn_lanes > 1 ? true : \r\n (left_vol >= 240 && left_turn_lanes == 1) ? true : \r\n (opposing_through_lanes == 1 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 50000) ? true :\r\n (opposing_through_lanes == 2 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 90000) ? true :\r\n (opposing_through_lanes == 3 && (left_vol * ( opposing_throughs_vol + opposing_right_vol * (1 - opposing_chan_right) ) ) > 110000) ? true :\r\n (opposing_through_lanes > 3 && left_turn_lanes > 0) ? true:\r\n false;\r\n }\r\n \r\n var throughs = through_vol;\r\n var rights = 0;\r\n var lefts = 0;\r\n \r\n if (!chan_right) {\r\n // Calculates % of right-turn volume in exclusive right-turn lanes and shared through-right\r\n var right_vol_splitfrac = ( (1 + (right_turn_lanes - shared_right)) / (right_turn_lanes + 1) );\r\n\r\n // Add shared rights to through volume\r\n throughs = Math.round(throughs + ((right_vol / UNIVERSAL_RIGHT_TURN_ADJUSTMENT_FACTOR ) * (1 - right_vol_splitfrac) ) );\r\n\r\n // Will be zero if no exclusive lanes; = right_vol if no shared right; something between 0 and right_vol if shared and exclusive rights exist for this approach\r\n rights = Math.round(right_vol * right_vol_splitfrac / right_turn_lanes) * (1 - chan_right);\r\n // Old version of this line; allows rights to be channelized AND shared. Probably an unnecessary case\r\n // rights = Math.round(right_vol * (right_vol_splitfrac * (1 - chan_right)) / right_turn_lanes);\r\n }\r\n \r\n // This needs to be adjusted for phase effect.\r\n var left_turn_factor = 5;\r\n var left_vol_splitfrac = (1 + (left_turn_lanes - shared_left)) / (left_turn_lanes + 1);\r\n \r\n throughs = throughs + (((left_vol * left_turn_factor) / UNIVERSAL_LEFT_TURN_ADJUSTMENT_FACTOR ) * (1 - left_vol_splitfrac) );\r\n var lefts = Math.round(left_vol * left_vol_splitfrac / left_turn_lanes);\r\n \r\n // Convert through volume to a flow rate\r\n throughs = Math.round(throughs / through_lanes);\r\n \r\n /////// NOW SET THE VOLUMES IN this._TCUs\r\n this._TCUs.getDirectionByIndex(direction).setLeft(lefts);\r\n this._TCUs.getDirectionByIndex(direction).setThrough(throughs);\r\n this._TCUs.getDirectionByIndex(direction).setRight(rights);\r\n \r\n console.log(this);\r\n } \r\n this.calculateCapacities();\r\n }", "function draw() {\n background(0, 0, 0, 0.031);\n translate(posX ? posX : 0, posY ? posY : 0)\n stroke(78, 255, 255)\n rect(0.9 * width, 0, 10, accumulator);\n// fill(0,255,0,0.05)\n // fft.smooth();\n // fft.log\n // noise.start();\n spectrum = fft.analyze();\n chunkSize = Math.floor(spectrum.length / population);\n reducedSpectrum = arrayChunk(spectrum, chunkSize);\n // con\n reducedSpectrum.map((cluster, index) => {\n let sum = cluster.reduce((accum, element) => {\n return accum + element;\n });\n // then((sum) => {\n let val = sum / cluster.length;\n // console.log(val)\n if (index < population) {\n var comp = map(index, 0, population, 360, 0);\n stroke(comp, 255, 255);\n var r = map(val, 0, 255, 0.1, 125);\n x = map(index, 0, population, 0, width);\n y = map(index, 0, population, height, 0);\n ellipse(width / 2 + ants[index].dist, y , r);\n random(1) < 0.13 ? ants[index].move() : null;\n } else {\n accumulator += val;\n }\n // })\n // })\n })\n\n // for (i = 0; i < spectrum.length; i++) {\n // if (i < population) {\n // var comp = map(i, 0, population, 360, 0);\n // stroke(comp, 255, 255);\n // var r = map(spectrum[i], 0, 255, 0.1, 125);\n // x = map(i, 0, population, 0, width);\n // y = map(i, 0, population, height, 0);\n // ellipse(width / 2 + ants[i].dist, y, r);\n // ants[i].move();\n // } else {\n // accumulator += spectrum[i];\n // }\n // }\n}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "function _t(t){var N,L,A,S,e,c=Math.floor,_=new Array(64),F=new Array(64),P=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),E=new Array(64),M=new Array(64),n=new Array(256),O=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],D=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],z=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var a=1;a<=t[o];a++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,a=i[0],s=i[240],l=function(t,e){var n,r,i,o,a,s,l,h,u,c,f=0;for(u=0;u<8;++u){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],a=t[f+4],s=t[f+5],l=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+l,m=r-l,y=i+s,v=i-s,w=o+a,b=o-a,x=p+w,N=p-w,L=g+y,A=g-y;t[f]=x+L,t[f+4]=x-L;var S=.707106781*(A+N);t[f+2]=N+S,t[f+6]=N-S;var _=.382683433*((x=b+v)-(A=m+d)),F=.5411961*x+_,P=1.306562965*A+_,k=.707106781*(L=v+m),I=d+k,C=d-k;t[f+5]=C+F,t[f+3]=C-F,t[f+1]=I+P,t[f+7]=I-P,f+=8}for(u=f=0;u<8;++u){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],a=t[f+32],s=t[f+40],l=t[f+48];var B=n+(h=t[f+56]),j=n-h,E=r+l,M=r-l,O=i+s,q=i-s,T=o+a,R=o-a,D=B+T,U=B-T,z=E+O,H=E-O;t[f]=D+z,t[f+32]=D-z;var W=.707106781*(H+U);t[f+16]=U+W,t[f+48]=U-W;var V=.382683433*((D=R+q)-(H=M+j)),G=.5411961*D+V,Y=1.306562965*H+V,J=.707106781*(z=q+M),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(u=0;u<64;++u)c=t[u]*e[u],Z[u]=0<c?c+.5|0:c-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=l[h];var u=w[0]-n;n=w[0],0==u?V(r[0]):(V(r[v[o=32767+u]]),V(y[o]));for(var c=63;0<c&&0==w[c];c--);if(0==c)return V(a),n;for(var f,p=1;p<=c;){for(var d=p;0==w[p]&&p<=c;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(s);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=c&&V(a),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=c((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var a=c((i[o]*t+50)/100);a<1?a=1:255<a&&(a=255),F[b[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],l=0,h=0;h<8;h++)for(var u=0;u<8;u++)P[l]=1/(_[b[l]]*s[h]*s[u]*8),k[l]=1/(F[b[l]]*s[h]*s[u]*8),l++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(F[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(q[t+1]);for(var e=0;e<=11;e++)G(T[e]);G(16);for(var n=0;n<16;n++)G(R[n+1]);for(var r=0;r<=161;r++)G(D[r]);G(1);for(var i=0;i<16;i++)G(U[i+1]);for(var o=0;o<=11;o++)G(z[o]);G(17);for(var a=0;a<16;a++)G(H[a+1]);for(var s=0;s<=161;s++)G(W[s])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,a=0;C=0,B=7,this.encode.displayName=\"_encode_\";for(var s,l,h,u,c,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(s=0;s<w;){for(f=c=w*b+s,p=-1,g=d=0;g<64;g++)f=c+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=s+p&&(f-=s+p-w+4),l=m[f++],h=m[f++],u=m[f++],j[g]=(O[l]+O[h+256>>0]+O[u+512>>0]>>16)-128,E[g]=(O[l+768>>0]+O[h+1024>>0]+O[u+1280>>0]>>16)-128,M[g]=(O[l+1280>>0]+O[h+1536>>0]+O[u+1792>>0]>>16)-128;i=J(j,P,i,N,A),o=J(E,k,o,L,S),a=J(M,k,a,L,S),s+=32}b+=8}if(0<=B){var x=[];x[1]=B+1,x[0]=(1<<B+1)-1,V(x)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),N=r(q,T),L=r(U,z),A=r(R,D),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)O[t]=19595*t,O[t+256>>0]=38470*t,O[t+512>>0]=7471*t+32768,O[t+768>>0]=-11059*t,O[t+1024>>0]=-21709*t,O[t+1280>>0]=32768*t+8421375,O[t+1536>>0]=-27439*t,O[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()}", "twistU() {\n this.fourCycle(this.cornerLoc, 0, 2, 4, 6, this.cornerOrient, 0, 0, 0, 0, 3);\n this.fourCycle(this.edgeLoc, 0, 3, 6, 9, this.edgeOrient, 1, 1, 1, 1, 2);\n this.sideOrient[1] = (this.sideOrient[1] + 3) % 4;\n }", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tvar I8 = 8;\n\t\t\tvar I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tvar I8 = 8;\n\t\t\tvar I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fft_rx2 (re, im) {\n let N = re.length;\n if (N.toString(2) % 10) // return immediately if N is not power of 2\n return;\n else if (N <= 32) // if N is sufficiently small, compute dft directly\n return dft_direct(re, im);\n\n let W = discrete_circle(N); // N evenly spaced points around the unit circle\n im = im || re.map( a => 0 ); // set imaginary values to zero if not provided\n\n // compute N/2-point DFT for even and odd samples of input array\n let S_1 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => !(i % 2) ) ));\n let S_2 = fft_rx2(...[re, im].map( a => a.filter( (_, i) => i % 2 ) ));\n\n // mutiply by twiddle factor. later, exploit symmetry W[k+N/2] = -W[k]\n let G_2 = S_2.map( (a, k) => cpx_mult(a, W[k % N]) );\n\n // combine for all frequencies k in N/2-1\n let X = [];\n for (let k of xrange(N/2)) {\n X[k] = cpx_add(S_1[k], G_2[k]);\n X[k + N/2] = cpx_sub(S_1[k], G_2[k]);\n }\n\n return X;\n}", "function FluidField(canvas) {\r\n\r\n function lin_solve2(x, x0, y, y0, a, c)\r\n {\r\n if (a === 0 && c === 1) {\r\n for (var j=1 ; j <= height; j++) {\r\n var currentRow = j * rowSize;\r\n ++currentRow;\r\n for (var i = 0; i < width; i++) {\r\n x[currentRow] = x0[currentRow];\r\n y[currentRow] = y0[currentRow];\r\n ++currentRow;\r\n }\r\n }\r\n } else {\r\n var invC = 1/c;\r\n for (var k=0 ; k<iterations; k++) {\r\n for (var j=1 ; j <= height; j++) {\r\n var lastRow = (j - 1) * rowSize;\r\n var currentRow = j * rowSize;\r\n var nextRow = (j + 1) * rowSize;\r\n var lastX = x[currentRow];\r\n var lastY = y[currentRow];\r\n ++currentRow;\r\n for (var i = 1; i <= width; i++) {\r\n lastX = x[currentRow] = (x0[currentRow] + a * (lastX + x[currentRow] + x[lastRow] + x[nextRow])) * invC;\r\n lastY = y[currentRow] = (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow])) * invC;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.update = function () {\r\n\tvar a = 0;\r\n lin_solve2(u, u_prev, v, v_prev, a, 1 + 4 * a);\r\n }\r\n\r\n var iterations = 1;\r\n var visc = 0.5;\r\n var dt = 0.1;\r\n var u;\r\n var u_prev;\r\n var v;\r\n var v_prev;\r\n var width;\r\n var height;\r\n var rowSize;\r\n var size;\r\n var displayFunc;\r\n function reset()\r\n {\r\n rowSize = width;\r\n size = (width)*(height);\r\n u = new Array(size);\r\n u_prev = new Array(size);\r\n v = new Array(size);\r\n v_prev = new Array(size);\r\n for (var i = 0; i < size; i++)\r\n u_prev[i] = v_prev[i] = u[i] = v[i] = 0;\r\n }\r\n this.reset = reset;\r\n this.setResolution = function (hRes, wRes)\r\n {\r\n var res = wRes * hRes;\r\n if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) {\r\n width = wRes;\r\n height = hRes;\r\n reset();\r\n return true;\r\n }\r\n return false;\r\n }\r\n this.setResolution(1, 1);\r\n}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tconst I8 = 8;\n\t\t\tconst I64 = 64;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff+1];\n\t\t\t\td2 = data[dataOff+2];\n\t\t\t\td3 = data[dataOff+3];\n\t\t\t\td4 = data[dataOff+4];\n\t\t\t\td5 = data[dataOff+5];\n\t\t\t\td6 = data[dataOff+6];\n\t\t\t\td7 = data[dataOff+7];\n\t\t\t\t\n\t\t\t\tvar tmp0 = d0 + d7;\n\t\t\t\tvar tmp7 = d0 - d7;\n\t\t\t\tvar tmp1 = d1 + d6;\n\t\t\t\tvar tmp6 = d1 - d6;\n\t\t\t\tvar tmp2 = d2 + d5;\n\t\t\t\tvar tmp5 = d2 - d5;\n\t\t\t\tvar tmp3 = d3 + d4;\n\t\t\t\tvar tmp4 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10 = tmp0 + tmp3;\t/* phase 2 */\n\t\t\t\tvar tmp13 = tmp0 - tmp3;\n\t\t\t\tvar tmp11 = tmp1 + tmp2;\n\t\t\t\tvar tmp12 = tmp1 - tmp2;\n\t\n\t\t\t\tdata[dataOff] = tmp10 + tmp11; /* phase 3 */\n\t\t\t\tdata[dataOff+4] = tmp10 - tmp11;\n\t\n\t\t\t\tvar z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+2] = tmp13 + z1; /* phase 5 */\n\t\t\t\tdata[dataOff+6] = tmp13 - z1;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10 = tmp4 + tmp5; /* phase 2 */\n\t\t\t\ttmp11 = tmp5 + tmp6;\n\t\t\t\ttmp12 = tmp6 + tmp7;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */\n\t\t\t\tvar z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */\n\t\t\t\tvar z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */\n\t\t\t\tvar z3 = tmp11 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11 = tmp7 + z3;\t/* phase 5 */\n\t\t\t\tvar z13 = tmp7 - z3;\n\t\n\t\t\t\tdata[dataOff+5] = z13 + z2;\t/* phase 6 */\n\t\t\t\tdata[dataOff+3] = z13 - z2;\n\t\t\t\tdata[dataOff+1] = z11 + z4;\n\t\t\t\tdata[dataOff+7] = z11 - z4;\n\t\n\t\t\t\tdataOff += 8; /* advance pointer to next row */\n\t\t\t}\n\t\n\t\t\t/* Pass 2: process columns. */\n\t\t\tdataOff = 0;\n\t\t\tfor (i=0; i<I8; ++i)\n\t\t\t{\n\t\t\t\td0 = data[dataOff];\n\t\t\t\td1 = data[dataOff + 8];\n\t\t\t\td2 = data[dataOff + 16];\n\t\t\t\td3 = data[dataOff + 24];\n\t\t\t\td4 = data[dataOff + 32];\n\t\t\t\td5 = data[dataOff + 40];\n\t\t\t\td6 = data[dataOff + 48];\n\t\t\t\td7 = data[dataOff + 56];\n\t\t\t\t\n\t\t\t\tvar tmp0p2 = d0 + d7;\n\t\t\t\tvar tmp7p2 = d0 - d7;\n\t\t\t\tvar tmp1p2 = d1 + d6;\n\t\t\t\tvar tmp6p2 = d1 - d6;\n\t\t\t\tvar tmp2p2 = d2 + d5;\n\t\t\t\tvar tmp5p2 = d2 - d5;\n\t\t\t\tvar tmp3p2 = d3 + d4;\n\t\t\t\tvar tmp4p2 = d3 - d4;\n\t\n\t\t\t\t/* Even part */\n\t\t\t\tvar tmp10p2 = tmp0p2 + tmp3p2;\t/* phase 2 */\n\t\t\t\tvar tmp13p2 = tmp0p2 - tmp3p2;\n\t\t\t\tvar tmp11p2 = tmp1p2 + tmp2p2;\n\t\t\t\tvar tmp12p2 = tmp1p2 - tmp2p2;\n\t\n\t\t\t\tdata[dataOff] = tmp10p2 + tmp11p2; /* phase 3 */\n\t\t\t\tdata[dataOff+32] = tmp10p2 - tmp11p2;\n\t\n\t\t\t\tvar z1p2 = (tmp12p2 + tmp13p2) * 0.707106781; /* c4 */\n\t\t\t\tdata[dataOff+16] = tmp13p2 + z1p2; /* phase 5 */\n\t\t\t\tdata[dataOff+48] = tmp13p2 - z1p2;\n\t\n\t\t\t\t/* Odd part */\n\t\t\t\ttmp10p2 = tmp4p2 + tmp5p2; /* phase 2 */\n\t\t\t\ttmp11p2 = tmp5p2 + tmp6p2;\n\t\t\t\ttmp12p2 = tmp6p2 + tmp7p2;\n\t\n\t\t\t\t/* The rotator is modified from fig 4-8 to avoid extra negations. */\n\t\t\t\tvar z5p2 = (tmp10p2 - tmp12p2) * 0.382683433; /* c6 */\n\t\t\t\tvar z2p2 = 0.541196100 * tmp10p2 + z5p2; /* c2-c6 */\n\t\t\t\tvar z4p2 = 1.306562965 * tmp12p2 + z5p2; /* c2+c6 */\n\t\t\t\tvar z3p2 = tmp11p2 * 0.707106781; /* c4 */\n\t\n\t\t\t\tvar z11p2 = tmp7p2 + z3p2;\t/* phase 5 */\n\t\t\t\tvar z13p2 = tmp7p2 - z3p2;\n\t\n\t\t\t\tdata[dataOff+40] = z13p2 + z2p2; /* phase 6 */\n\t\t\t\tdata[dataOff+24] = z13p2 - z2p2;\n\t\t\t\tdata[dataOff+ 8] = z11p2 + z4p2;\n\t\t\t\tdata[dataOff+56] = z11p2 - z4p2;\n\t\n\t\t\t\tdataOff++; /* advance pointer to next column */\n\t\t\t}\n\t\n\t\t\t// Quantize/descale the coefficients\n\t\t\tvar fDCTQuant;\n\t\t\tfor (i=0; i<I64; ++i)\n\t\t\t{\n\t\t\t\t// Apply the quantization and scaling factor & Round to nearest integer\n\t\t\t\tfDCTQuant = data[i]*fdtbl[i];\n\t\t\t\toutputfDCTQuant[i] = (fDCTQuant > 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}", "function createFFT(smoothing,bins){\n // remember to call this function in setup\n // creates new p5 FFT constructor\n fft = new p5.FFT(smoothing,bins);\n}", "function each( x, F, i0, i1 )\n{\n var len = x.length, argslen = arguments.length;\n if ( argslen < 4 ) i1 = len-1;\n if ( 0 > i1 ) i1 += len;\n if ( argslen < 3 ) i0 = 0;\n if ( i0 > i1 ) return x;\n var i, k, l=i1-i0+1, l1, lr, r, q;\n r=l&15; q=r&1;\n if ( q ) F(x[i0], i0, x);\n for (i=q; i<r; i+=2)\n { \n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n }\n for (i=r; i<l; i+=16)\n {\n k = i0+i;\n F(x[ k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n F(x[++k], k, x);\n }\n return x;\n}", "function calculateNext(data) {\n \n var aK1, bK1, hlp, hlp2, hlp3, tau, fNaK, am, bm, ad, bd, Infi, af, bf, ar, br, ato, bto, Itot;\n //xlap;\n \n var vi_t, tauv_t, xi_t, taux_t, zIK1_t, zINaCa1_t, zINaCa2_t, zINaK_t, zINab_t, zICab_t,\n expm_t, mi_t, zINa_t, expv_t, zICa_t, expff_t, fi_t, zIto_t, expto_t, toi_t, expxx_t,\n zIK_t;\n \n \n /* tabulations */\n \n vi_t=.5*(1-((Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v)))));\n tauv_t = .25+2.24*((1-(Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v))))/(1-(Math.exp(0.07*(cS.v+92.4))-Math.exp(-(0.07*(cS.v+92.4))))/(Math.exp(0.07*(cS.v+92.4))+Math.exp(-(0.07*(cS.v+92.4))))));\n xi_t = 0.988/(1+Math.exp(-.861-0.062*cS.v));\n taux_t = 240*Math.exp(-((25.5+cS.v)*(25.5+cS.v))/156)+182*(1+(Math.exp(0.154+0.0116*cS.v)-Math.exp(-(0.154+0.0116*cS.v)))/(Math.exp(0.154+0.0116*cS.v)+Math.exp(-(0.154+0.0116*cS.v))))+40*(1+(Math.exp(160+2*cS.v)-Math.exp(-(160+2*cS.v)))/(Math.exp(160+2*cS.v)+Math.exp(-(160+2*cS.v))));\n \n /* Time-independent functions */\n aK1 = 0.1/(1.0+Math.exp(0.06*(cS.v-cC.ek1-200.0)));\n bK1=(3.0*Math.exp(0.0002*(cS.v-cC.ek1+100.0))+Math.exp(0.1*(cS.v-cC.ek1-10.0)))/(1.0+Math.exp(-0.5*(cS.v-cC.ek1)));\n hlp = aK1/(aK1+bK1);\n zIK1_t = cS.gK1*hlp*(cS.v-cC.ek1);\n \n hlp = cS.v/cC.RTonF;\n hlp2 = Math.exp(cS.eta*hlp);\n hlp3 = Math.exp((cS.eta-1.0)*hlp);\n hlp = cS.gNaCa/( (cS.KmNa*cS.KmNa*cS.KmNa+cS.Nae*cS.Nae*cS.Nae)*(cS.KmCa+cS.Cae)*(1.0+cS.ksat*hlp3));\n zINaCa1_t = hlp*hlp2*cS.Nai*cS.Nai*cS.Nai*cS.Cae;\n zINaCa2_t = hlp*hlp3*cS.Nae*cS.Nae*cS.Nae;\n \n hlp = cS.v/cC.RTonF;\n fNaK = 1.0/(1.0+0.1245*Math.exp(-0.1*hlp) + 0.0365*cC.sigma*Math.exp(-hlp));\n hlp = cS.KmNai/cS.Nai;\n hlp2 = 1.0/(1.0+Math.sqrt(hlp*hlp*hlp));\n hlp3 = cS.Ke/(cS.Ke+cS.KmKe);\n zINaK_t = cS.gNaK*fNaK*hlp2*hlp3;\n zINab_t = cS.gNab*(cS.v-cC.ena);\n zICab_t = cS.gCab*(cS.v-cC.eca);\n \n /* NA gating variables */\n am = ((Math.abs(cS.v+47.13)) > 0.001) ? 0.32*(cS.v+47.13)/(1.0 - Math.exp(-0.1*(cS.v+47.13)) ): 3.2;\n bm = 0.08*Math.exp(cS.v/(-11.0));\n hlp = am+bm;\n tau = 1.0/hlp;\n expm_t = Math.exp(-cS.timestep/tau);\n \n mi_t = am/hlp;\n zINa_t = cS.gNa*(cS.v - cC.ena);\n expv_t = Math.exp(-cS.timestep/tauv_t);\n \n \n /*CA gating variables */\n \n hlp = Math.sqrt(2.0*cC.pi);\n hlp2= (cS.v-22.36)/16.6813;\n ad = (14.9859/(16.6813*hlp))*Math.exp(-0.5*hlp2*hlp2);\n hlp2 = (cS.v-6.2744)/14.93;\n bd = 0.1471-((5.3/(14.93*hlp))*Math.exp(-0.5*hlp2*hlp2));\n hlp = ad+bd;\n Infi = ad/hlp;\n zICa_t = cS.gCa*cC.fCa*Infi*(cS.v-cC.eca);\n \n af = 0.006872/(1.0+Math.exp((cS.v-6.1546)/6.1223));\n hlp = 0.0687*Math.exp(-0.1081*(cS.v+9.8255)) + 0.0112;\n hlp2 = 1.0+Math.exp(-0.2779*(cS.v+9.8255));\n bf = hlp/hlp2 + 0.0005474;\n hlp = af+bf;\n tau = 1.0/hlp;\n expff_t = Math.exp(-cS.timestep/tau);\n fi_t = af/hlp;\n \n /*TO gating variables */\n hlp = cS.v-42.2912;\n hlp2 = 0.5266*Math.exp(-0.0166*hlp);\n hlp3 = 1.0 + Math.exp(-0.0943*hlp);\n ar = hlp2/hlp3;\n hlp = 0.5149*Math.exp(-0.1344*(cS.v-5.0027)) + 0.00005186*cS.v;\n hlp2 = 1.0 + Math.exp(-0.1348*(cS.v-0.00005186));\n br = hlp/hlp2;\n hlp = ar+br;\n Infi = ar/hlp;\n zIto_t= cS.gto*Infi*(cS.v-cC.eto);\n hlp = cS.v + 34.2531;\n hlp2 = 0.0721*Math.exp(-0.173*hlp)+0.00005612*cS.v;\n hlp3 = 1.0+Math.exp(-0.1732*hlp);\n ato = hlp2/hlp3;\n hlp = cS.v + 34.0235;\n hlp2 = 0.0767*Math.exp(-1.66E-9*hlp)+0.0001215*cS.v;\n hlp3 = 1.0+Math.exp(-0.1604*hlp);\n bto = hlp2/hlp3;\n hlp = ato+bto;\n tau = 1.0/hlp;\n expto_t = Math.exp(-cS.timestep/tau);\n toi_t = ato/hlp;\n \n /* IK gating variables */\n expxx_t= Math.exp(-cS.timestep/(taux_t+40.0*(1.0-(Math.exp(160.0+cS.v*2.0)- Math.exp(-(160.0+cS.v*2.0)))/(Math.exp(160.0+cS.v*2.0)+ Math.exp(-(160.0+cS.v*2.0)))) ));\n zIK_t = cS.gK*(cS.v- cC.ekr);\n \n cS.istim = _s1s2Stimulus(count, data);\n \n /* Gating variables */\n cS.m = mi_t + ( cS.m - mi_t ) * expm_t;\n cS.f = fi_t + ( cS.f - fi_t ) * expff_t;\n cS.xv = vi_t + ( cS.xv - vi_t ) * expv_t;\n cS.to = toi_t + ( cS.to - toi_t ) * expto_t;\n cS.xx = xi_t + ( cS.xx - xi_t ) * expxx_t;\n \n /* The membrane currents */\n cS.ica = cS.f*zICa_t;\n cS.icab= zICab_t;\n cS.ina = cS.gNa*cS.xv*cS.xv*cS.m*cS.m*cS.m*(cS.v - cC.ena);\n cS.inab= zINab_t;\n cS.ik = cS.xx*cS.xx*zIK_t;\n cS.ik1 = zIK1_t;\n cS.ito = cS.to*zIto_t;\n cS.inaca = zINaCa1_t - cS.Cai*zINaCa2_t;\n cS.inak = zINaK_t;\n Itot= cS.ica+cS.icab+cS.ik1+cS.ik+cS.ina+cS.inab+cS.inaca+cS.inak+cS.ito-cS.istim;\n \n // \n \n /*if(count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i+1)-2.0*cS.v);\n }\n else if (count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i-1)-2.0*cS.v)\n }\n else{\n xlap = cC.d_o_dx2*(v(i+1)-2.0*cS.v+v(i-1))\n }*/\n \n /* The membrane potential */\n \n //cS.v = cS.v - cS.timestep*Itot+xlap; \n cS.v = cS.v - cS.timestep*Itot;\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "constructor({audioCtx, fftSize, carFreq, modAmpl, modFreq, visualCtx}) {\n this.audioCtx = audioCtx;\n this,fftSize = fftSize;\n this.carFreq = carFreq;\n this.modAmpl = modAmpl;\n this.modFreq = modFreq;\n this.visualCtx = visualCtx;\n this.play = false;\n\n\n this.animate;\n this.analyserNode = audioCtx.createAnalyser();\n this.analyserNode.smoothingTimeConstant = 0.0;\n this.analyserNode.fftSize = fftSize;\n\n // Create the array for the data values\n this.frequencyArray = new Uint8Array(this.analyserNode.frequencyBinCount);\n\n // Uses the chroma.js library by Gregor Aisch to create a color gradient\n // download from https://github.com/gka/chroma.js\n this.colorScale = new chroma.scale('Spectral').domain([1,0]);\n // Global Variables for Drawing\n this.column = 0;\n this.canvasWidth = 800;\n this.canvasHeight = 256;\n }", "function Ku(t) {\n for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];\n for (var r = 0, i = e; r < i.length; r++) {\n var o = i[r];\n t = o.Yf(t);\n }\n return t;\n}", "_precompute() {\n\t\t\tconst encTable = this._tables[0];\n\t\t\tconst decTable = this._tables[1];\n\t\t\tconst sbox = encTable[4];\n\t\t\tconst sboxInv = decTable[4];\n\t\t\tconst d = [];\n\t\t\tconst th = [];\n\t\t\tlet xInv, x2, x4, x8;\n\n\t\t\t// Compute double and third tables\n\t\t\tfor (let i = 0; i < 256; i++) {\n\t\t\t\tth[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n\t\t\t}\n\n\t\t\tfor (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n\t\t\t\t// Compute sbox\n\t\t\t\tlet s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n\t\t\t\ts = s >> 8 ^ s & 255 ^ 99;\n\t\t\t\tsbox[x] = s;\n\t\t\t\tsboxInv[s] = x;\n\n\t\t\t\t// Compute MixColumns\n\t\t\t\tx8 = d[x4 = d[x2 = d[x]]];\n\t\t\t\tlet tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n\t\t\t\tlet tEnc = d[s] * 0x101 ^ s * 0x1010100;\n\n\t\t\t\tfor (let i = 0; i < 4; i++) {\n\t\t\t\t\tencTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n\t\t\t\t\tdecTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Compactify. Considerable speedup on Firefox.\n\t\t\tfor (let i = 0; i < 5; i++) {\n\t\t\t\tencTable[i] = encTable[i].slice(0);\n\t\t\t\tdecTable[i] = decTable[i].slice(0);\n\t\t\t}\n\t\t}", "function setup() {\n createCanvas(700, 300);\n fft = new p5.FFT();\n \n basso=[50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46, 50, 50, 45, 45, 47, 47, 43, 43, 44, 44, 38, 38, 44, 44, 46, 46]; // the Basso Continuo\n \n violino=[78, 78, 76, 76, 74, 74, 73, 73, 71, 71, 69, 69, 71, 71, 73, 73, 74, 74, 73, 73, 71, 71, 69, 69, 67, 67, 66, 66, 67, 67, 64, 64, 62, 66, 69, 67, 66, 62, 66, 64, 62, 61, 62, 69, 67, 71, 69, 67, 66, 62, 64, 73, 74, 78, 81, 69, 71, 67, 69, 66, 62, 74, 74, 74]; // the three violine voices are actually the same, just shifted by two bars.\n\ni=0;\ns=0;\nv=[];\nb=new Canon(basso,0); // the basso\n}", "process(fft) {\n var dct = new DCT()\n if (fft.length != this.fftSize) {\n throw Error('Passed in FFT bins were incorrect size. Expected ' + this.fftSize + ' but was ' + fft.length);\n }\n var melSpec = this.filterBank.filter(fft),\n melSpecLog = melSpec.map(log),\n melCoef = dct.process(melSpecLog).slice(0, 13)\n return melCoef;\n }", "function triangulate(){\n var tfs = arrTF.slice();\n for (var i = 0; i < tfs.length; i++) {\n var f = tfs[i];\n if(f.length <= 3)continue;\n while(f.length > 3){\n arrE.push([f[0],f[2]]);\n arrTF.push([f[0],f[1],f[2]]);\n f.splice(1, 1);\n }\n arrTF[i] = f;\n }\n}", "triggerFreqShifter() {\n this.freqShifterActive = this.freqShifterActive ? this.freqShifterActive = false : this.freqShifterActive = true;\n\n if (this.freqShifterActive) {\n this.player.connect(this.freqShifter);\n this.freqShifter.wet.rampTo(1, 0.1);\n this.volOut.volume.rampTo(-20, 0.5);\n this.shifterLoop = new Tone.Loop((time) => this.shifterLFO(), 0.01); // calls below function every 0.01 seconds\n this.shifterLoop.start();\n /*\n this.player.connect(this.freqShifter);\n this.freqShifter.wet.rampTo(1, 0.1);\n this.freqShifterLFO.start();\n */\n }\n\n else {\n this.freqShifter.wet.rampTo(0, 0.1);\n this.player.disconnect(this.freqShifter);\n this.volOut.volume.rampTo(-0, 0.5);\n this.shifterLoop.stop();\n this.freqShifterGoingDown = true;\n\n this.freqShifter.pitch = 0;\n\n this.freqShifterParamTrackActive = false;\n this.freqShifterParamTrackActive_Y = false;\n /*\n this.freqShifter.wet.rampTo(0, 0.1);\n this.player.disconnect(this.freqShifter);\n this.freqShifterParamTrack.wet.rampTo(0, 0.1);\n this.freqShifterParamTrackActive = false;\n this.freqShifterParamTrackActive_Y = false;\n */\n }\n }", "function xu(t) {\n t.Wh.forEach((function(t) {\n t.next();\n }));\n}", "function mdct_short(inout, inoutPos) {\n\t\tfor (var l = 0; l < 3; l++) {\n\t\t\tvar tc0, tc1, tc2, ts0, ts1, ts2;\n\n\t\t\tts0 = inout[inoutPos + 2 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t- inout[inoutPos + 5 * 3];\n\t\t\ttc0 = inout[inoutPos + 0 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t- inout[inoutPos + 3 * 3];\n\t\t\ttc1 = ts0 + tc0;\n\t\t\ttc2 = ts0 - tc0;\n\n\t\t\tts0 = inout[inoutPos + 5 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t+ inout[inoutPos + 2 * 3];\n\t\t\ttc0 = inout[inoutPos + 3 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t+ inout[inoutPos + 0 * 3];\n\t\t\tts1 = ts0 + tc0;\n\t\t\tts2 = -ts0 + tc0;\n\n\t\t\ttc0 = (inout[inoutPos + 1 * 3] * win[Encoder.SHORT_TYPE][1] - inout[inoutPos + 4 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tts0 = (inout[inoutPos + 4 * 3] * win[Encoder.SHORT_TYPE][1] + inout[inoutPos + 1 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 0] = tc1 * 1.907525191737280e-11 + tc0;\n\t\t\t/*\n\t\t\t * tritab_s[ 2 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 5] = -ts1 * 1.907525191737280e-11 + ts0;\n\t\t\t/*\n\t\t\t * tritab_s[0 ]\n\t\t\t */\n\t\t\ttc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 2]\n\t\t\t */\n\t\t\tts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;\n\t\t\tinout[inoutPos + 3 * 1] = tc2 - ts1;\n\t\t\tinout[inoutPos + 3 * 2] = tc2 + ts1;\n\n\t\t\ttc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;\n\t\t\tts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 0]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 3] = tc1 + ts2;\n\t\t\tinout[inoutPos + 3 * 4] = tc1 - ts2;\n\n\t\t\tinoutPos++;\n\t\t}\n\t}", "function mdct_short(inout, inoutPos) {\n\t\tfor (var l = 0; l < 3; l++) {\n\t\t\tvar tc0, tc1, tc2, ts0, ts1, ts2;\n\n\t\t\tts0 = inout[inoutPos + 2 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t- inout[inoutPos + 5 * 3];\n\t\t\ttc0 = inout[inoutPos + 0 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t- inout[inoutPos + 3 * 3];\n\t\t\ttc1 = ts0 + tc0;\n\t\t\ttc2 = ts0 - tc0;\n\n\t\t\tts0 = inout[inoutPos + 5 * 3] * win[Encoder.SHORT_TYPE][0]\n\t\t\t\t\t+ inout[inoutPos + 2 * 3];\n\t\t\ttc0 = inout[inoutPos + 3 * 3] * win[Encoder.SHORT_TYPE][2]\n\t\t\t\t\t+ inout[inoutPos + 0 * 3];\n\t\t\tts1 = ts0 + tc0;\n\t\t\tts2 = -ts0 + tc0;\n\n\t\t\ttc0 = (inout[inoutPos + 1 * 3] * win[Encoder.SHORT_TYPE][1] - inout[inoutPos + 4 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tts0 = (inout[inoutPos + 4 * 3] * win[Encoder.SHORT_TYPE][1] + inout[inoutPos + 1 * 3]) * 2.069978111953089e-11;\n\t\t\t/*\n\t\t\t * tritab_s [ 1 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 0] = tc1 * 1.907525191737280e-11 + tc0;\n\t\t\t/*\n\t\t\t * tritab_s[ 2 ]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 5] = -ts1 * 1.907525191737280e-11 + ts0;\n\t\t\t/*\n\t\t\t * tritab_s[0 ]\n\t\t\t */\n\t\t\ttc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 2]\n\t\t\t */\n\t\t\tts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0;\n\t\t\tinout[inoutPos + 3 * 1] = tc2 - ts1;\n\t\t\tinout[inoutPos + 3 * 2] = tc2 + ts1;\n\n\t\t\ttc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0;\n\t\t\tts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11;\n\t\t\t/*\n\t\t\t * tritab_s[ 0]\n\t\t\t */\n\t\t\tinout[inoutPos + 3 * 3] = tc1 + ts2;\n\t\t\tinout[inoutPos + 3 * 4] = tc1 - ts2;\n\n\t\t\tinoutPos++;\n\t\t}\n\t}", "stepThyratrons() {\n let X2bPtr = this.Xptr[1]-1;\n if (X2bPtr===0) X2bPtr = ROTOR_SIZES.X2;\n let S1bPtr = this.Sptr[0]-1;\n if (S1bPtr===0) S1bPtr = ROTOR_SIZES.S1;\n\n // Get Chi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let X5bPtr=this.Xptr[4]-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n X5bPtr=X5bPtr-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n // Get Psi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let S5bPtr=this.Sptr[4]-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n S5bPtr=S5bPtr-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n\n const x2sw = this.limitations.X2;\n const s1sw = this.limitations.S1;\n const p5sw = this.limitations.P5;\n\n // Limitation calculations\n let lim=1;\n if (x2sw) lim = this.rings.X[2][X2bPtr-1];\n if (s1sw) lim = lim ^ this.rings.S[1][S1bPtr-1];\n\n // P5\n if (p5sw) {\n let p5lim = this.P5Zbit[1];\n p5lim = p5lim ^ this.rings.X[5][X5bPtr-1];\n p5lim = p5lim ^ this.rings.S[5][S5bPtr-1];\n lim = lim ^ p5lim;\n }\n\n const basicmotor = this.rings.M[2][this.Mptr[0]-1];\n this.totalmotor = basicmotor;\n\n if (x2sw || s1sw) {\n if (basicmotor===0 && lim===1) {\n this.totalmotor = 0;\n } else {\n this.totalmotor = 1;\n }\n }\n\n // Step Chi rotors\n for (let r=0; r<5; r++) {\n this.Xptr[r]++;\n if (this.Xptr[r] > ROTOR_SIZES[\"X\"+(r+1)]) this.Xptr[r] = 1;\n }\n\n if (this.totalmotor) {\n // Step Psi rotors\n for (let r=0; r<5; r++) {\n this.Sptr[r]++;\n if (this.Sptr[r] > ROTOR_SIZES[\"S\"+(r+1)]) this.Sptr[r] = 1;\n }\n }\n\n // Move M37 rotor if M61 set\n if (this.rings.M[1][this.Mptr[1]-1]===1) this.Mptr[0]++;\n if (this.Mptr[0] > ROTOR_SIZES.M37) this.Mptr[0]=1;\n\n // Always move M61 rotor\n this.Mptr[1]++;\n if (this.Mptr[1] > ROTOR_SIZES.M61) this.Mptr[1]=1;\n }", "function ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function frameLooper() {\n window.requestAnimationFrame(frameLooper); // recursive yaaay, for looping\n // fbc_array is our actual frequency/amplitude array\n // having access to this will be key to split up later\n fbc_array = new Uint8Array(analyser.frequencyBinCount);\n\n analyser.getByteFrequencyData(fbc_array);\n ctx.clearRect(0, 0, canvas.width, canvas.height); // clear the canvas every loop\n ctx.fillStyle = '#00CCFF'; // color of the bars. I chose sky blue\n bars = 128; // how many bars to render. 128 might make the most sense.\n // fbc_array.length == 1024, so each bar represents 8 frequencies\n\n for(var i = 0; i < bars; i++){\n bar_x = i * 2; // each bar is 3 units apart on the x axis\n bar_width = 1; // each bar is 2 units wide. 0-1 is a bar, 2 is not, 3-4 is a bar, etc. But this is based on the width of the canvas\n bar_height = -(fbc_array[i] / 2); // frequency data, of the current index. The amplitude\n\n // amps[0].text = fbc_array[0]; // not working\n\n // here I'm finding out stuff about the bar_height\n // barH.innerHTML = fbc_array; // this is a simple trick for now, but I want to make a 32x32 grid, and loop over it and fill the number (amp) into each of them\n // Doing this at every frame makes everything lag, so idk if I'll have to comment out the *BAR* visualization for testing purposes. Then I'll make a grid of the array, change the color of the text as it increases, and that'll be my new visualisation.\n\n // fillRect(x, y, width, height) // explanation of the parameters below\n ctx.fillRect(bar_x, canvas.height, bar_width, bar_height); // this draws the bars themselves\n }\n\n\n // Table visualization\n for(var j = 0; j < fbc_array.length; j++){\n amps[j].innerHTML = fbc_array[j];\n // styling is gonna be difficult\n // amps[j].css({\"background-color\":`rgb(0,${j}, ${j})`});\n }\n\n}", "_AMDF(buf, sampleRate) {\n var SIZE = buf.length; // set SIZE variable equal to buffer length 4096 => half a second\n var MAX_SAMPLES = Math.floor(SIZE / 2); // set MAX_SAMPLES = 4096/2 = 2048\n var best_offset = -1; // initialise best_offset to -1\n var best_correlation = 0; // initialise best_correlation to 0\n var rms = 0; // initialise rms to 0 (rms => root-mean-square)\n var foundGoodCorrelation = false; // initialise foundGoodCorrelation flag to false\n var correlations = new Array(MAX_SAMPLES); // create an array variable called correlations of size MAX_SAMPLES (2048)\n\n for (var i = 0; i < SIZE; i++) {\n var val = buf[i]; // val is equal to the (i)th value in the array\n rms += val * val; // rms is the summation of each value squared\n }\n rms = Math.sqrt(rms / SIZE); // set rms equal to the square root of rms/SIZE (square root of the average)\n if (rms < 0.01) // not enough signal\n return -1;\n\n var lastCorrelation = 1; // initialise lastCorrelation to 1 so that the first check won't be the best correlation\n for (var offset = 52; offset < 160; offset++) { // offset initialised to 52, goes through a for loop from 52 to 160, which will cover the notes that Singphony can render\n var correlation = 0; // re-set correlation to 0 at each offset value\n\n for (var i = 0; i < MAX_SAMPLES; i++) { // cycle through from 0 to 2048\n correlation += Math.abs((buf[i]) - (buf[i + offset])); // step through at each value and subtract the value at the offset from the value in the original buffer and keep adding that to the correlation value\n } // correlation will be a large enough positive float\n\n correlation = 1 - (correlation / MAX_SAMPLES); // set correlation to 1 - correlation/512\n correlations[offset] = correlation; // store it, for the tweaking we need to do below.\n if ((correlation > this.GOOD_ENOUGH_CORRELATION) && (correlation > lastCorrelation)) { // if the correlation value is higher than 0.9 and the previous correlation value\n foundGoodCorrelation = true; // set foundGoodCorrelation flag to true\n if (correlation > best_correlation) { //\n best_correlation = correlation; // update the best_correlation value to the latest correlation value\n best_offset = offset; // update best_offset to the latest offset value\n }\n } else if (foundGoodCorrelation) {\n // short-circuit - we found a good correlation, then a bad one, so we'd just be seeing copies from here.\n return sampleRate / best_offset;\n }\n lastCorrelation = correlation; // set lastCorrelation to latest correlation\n }\n return -1;\n }", "function sha1_ft(t, b, c, d)\r\n{\r\n if(t < 20) return (b & c) | ((~b) & d);\r\n if(t < 40) return b ^ c ^ d;\r\n if(t < 60) return (b & c) | (b & d) | (c & d);\r\n return b ^ c ^ d;\r\n}", "function calculateNext(data) {\n\n var alpham, betam, alphah, betah, alphaj, betaj, alphaoa,\n betaoa, alphaoi, betaoi, alphaua, betaua, alphaui, betaui, alphaxr, betaxr, alphaxs, betaxs,\n temp, xnaca11, xnaca21;\n\n var exptaum_t, xinfm_t, exptauh_t, xinfh_t, exptauj_t, xinfj_t, \n xk1t_t, exptauoa_t, xinfoa_t, exptauoi_t, xinfoi_t, exptauua_t, xinfua_t, exptauui_t, xinfui_t, xkurcoeff_t, xkrcoeff_t, \n exptaud_t, xinfd_t, exptauf_t, xinff_t, xnakt_t, xnaca1_t, \n xnaca2_t, exptauw_t, xinfw_t;\n\n /* moved to settings as previous value required \n exptauxr_t, xinfxr_t, exptauxs_t, xinfxs_t*/\n\n var xinffca_t , xpcat_t, ecat_t, xupt_t, carow2_t;\n\n var xinfut_t, exptauvt_t, xinfvt_t; \n\n var xstim, eca, xinfm1, exptaum1, xinfh1, exptauh1, xinfj1, exptauj1,\n xinfoa1, exptauoa1, xinfoi1, exptauoi1,\n xinfua1, exptauua1, xinfui1, exptauui1, xkurcoeff1,\n xinfxr1, exptauxr1, xkrcoeff1,\n xinfxs1, exptauxs1,\n xinfd1, exptaud1, xinff1, exptauf1, xinffca1,\n xinfu, exptauv, xinfv, xinfw1, exptauw1,\n xtr, xup, xupleak,\n di_ups, carow21; \n\n //calculations start\n //\n\n alpham = (Math.abs( cS.v + 47.13) < 1e-5) ? 3.2 : 0.32 * ( cS.v + 47.13 )/( 1.- Math.exp(-0.1*( cS.v + 47.13 ) ) );\n\n betam = 0.08 * Math.exp (- cS.v /11.);\n\n alphah = ( cS.v > -40.0 ) ? 0.0 : 0.135 * Math.exp(-( cS.v+80.0)/6.8); \n\n betah = ( cS.v > -40.0 ) ? 1.0/ (0.13 * (1.0 + Math.exp (-( cS.v + 10.66)/11.1))) \n : 3.56 * Math.exp ( 0.079 * cS.v ) + 3.1e5 * Math.exp(0.35 * cS.v); \n\n alphaj = ( cS.v > -40.0 ) ? 0.0 \n : (-127140 * Math.exp(0.2444 * cS.v)-3.474e-5 * Math.exp(-0.04391 * cS.v)) * ( cS.v + 37.78)/(1. + Math.exp (0.311 * ( cS.v + 79.23))); \n\n betaj = ( cS.v > -40.0 ) ? 0.3 * Math.exp(-2.535e-7 * cS.v)/(1.+Math.exp(-0.1 * ( cS.v+32.))) \n : 0.1212 * Math.exp(-0.01052 * cS.v)/(1.+Math.exp(-0.1378 * ( cS.v+40.14))); \n\n alphaoa = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaoa = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) );\n\n alphaoi = 1.0 / ( 18.53 + Math.exp ( ( cS.v + 113.7 ) / 10.95 ) );\n\n betaoi = 1.0 / ( 35.56 + Math.exp ( - ( cS.v + 1.26 ) / 7.44 ) ); \n\n alphaua = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaua = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) ); \n\n alphaui = 1.0 / ( 21. + Math.exp ( - ( cS.v-185. ) / 28. ) ) ; \n\n betaui = Math.exp ( ( cS.v-158. ) / 16. ); \n\n alphaxr = 0.0003* ( cS.v + 14.1 ) / ( 1.- Math.exp ( - ( cS.v + 14.1 ) / 5. ) ); \n\n betaxr = 7.3898e-5* ( cS.v-3.3328 ) / ( Math.exp ( ( cS.v-3.3328 ) / 5.1237 ) -1. ); \n\n alphaxs = 4e-5* ( cS.v-19.9 ) / ( 1.- Math.exp ( - ( cS.v-19.9 ) / 17. ) ); \n\n betaxs = 3.5e-5* ( cS.v-19.9 ) / ( Math.exp ( ( cS.v-19.9 ) / 9. ) -1. );\n\n //table variables depending on V\n\n exptaum_t = Math.exp(- cS.timestep*(alpham+betam));\n\n xinfm_t = alpham/(alpham+betam);\n\n exptauh_t = Math.exp(- cS.timestep*(alphah+betah));\n\n xinfh_t = alphah/(alphah+betah);\n\n exptauj_t = Math.exp(- cS.timestep*(alphaj+betaj));\n\n xinfj_t = alphaj/(alphaj+betaj);\n\n xk1t_t = cS.gk1*( cS.v- cC.ek)/(1.+Math.exp(0.07*( cS.v + 80.)));\n\n exptauoa_t = Math.exp(- cS.timestep*((alphaoa+betaoa)* cS.xkq10));\n\n xinfoa_t = 1.0/(1.+Math.exp(-( cS.v+20.47)/17.54));\n\n exptauoi_t = Math.exp(- cS.timestep*((alphaoi+betaoi)* cS.xkq10));\n\n xinfoi_t = 1.0/(1.+Math.exp(( cS.v+43.1)/5.3));\n\n exptauua_t = Math.exp(- cS.timestep*((alphaua+betaua)* cS.xkq10));\n\n xinfua_t = 1.0/(1.+Math.exp(-( cS.v+30.3)/9.6));\n\n exptauui_t = Math.exp(- cS.timestep*((alphaui+betaui)* cS.xkq10));\n\n xinfui_t = 1.0/(1.+Math.exp(( cS.v-99.45)/27.48));\n\n xkurcoeff_t = (0.005+0.05/(1.+Math.exp(-( cS.v-15.)/13.)))*( cS.v- cC.ek);\n\n\n if(!((Math.abs( cS.v+14.1) < 1e-5) || (Math.abs( cS.v-3.3328)<1e-5))){\n cS.exptauxr_t = Math.exp(- cS.timestep*(alphaxr+betaxr));\n cS.xinfxr_t = 1.0/(1.+Math.exp(-( cS.v+14.1)/6.5));\n }\n\n xkrcoeff_t = cS.gkr*( cS.v- cC.ek)/(1.+Math.exp(( cS.v+15.)/22.4));\n\n if(!(Math.abs( cS.v-19.9) < 1e-5)){\n cS.exptauxs_t = Math.exp(- cS.timestep/0.5*(alphaxs+betaxs));\n cS.xinfxs_t = 1.0/Math.sqrt(1.+Math.exp(-( cS.v-19.9)/12.7));\n }\n\n //temp varaible used for calculations\n temp = (1.0-Math.exp(-( cS.v+10.)/6.24))/(0.035*( cS.v+10.)* (1.+Math.exp(-( cS.v+10.)/6.24)));\n\n if(Math.abs( cS.v+10) < 1e-5){\n exptaud_t = 2.2894;\n exptauf_t = 0.9997795;\n }\n else{\n exptaud_t = Math.exp(- cS.timestep/temp); \n exptauf_t = Math.exp(- cS.timestep/9.*(0.0197*Math.exp(Math.pow(-(0.0337 *( cS.v+10.)), 2))+0.02));\n }\n\n xinfd_t = 1.0/(1.+Math.exp(-( cS.v+10.)/8.));\n\n xinff_t = 1.0/(1.+Math.exp(( cS.v+28.)/6.9));\n\n xnakt_t = (1.0/(1.+0.1245*Math.exp(-0.1* cS.v/ cC.rtof)+0.0365* cC.sigma*Math.exp(- cS.v/ cC.rtof)))* cS.xinakmax/(1.+(Math.pow(( cS.xkmnai/ cS.cnai),1.5)))*( cS.cko/( cS.cko+ cS.xkmko));\n\n xnaca1_t = cS.xinacamax*Math.exp( cS.gamma* cS.v/ cC.rtof)*(Math.pow( cS.cnai,3))* cS.ccao/((Math.pow( cS.xkmna,3)+ Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)));\n\n xnaca2_t = cS.xinacamax*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)/((Math.pow( cS.xkmna,3) + Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof))); \n\n temp = 6.0*(1.-Math.exp(-( cS.v-7.9)/5.))/((1.+0.3*Math.exp(-( cS.v-7.9)/5.))*( cS.v-7.9)); \n\n exptauw_t = Math.exp(- cS.timestep/temp);\n\n xinfw_t = 1.0-1.0/(1.+Math.exp(-( cS.v-40.)/17.));\n\n //table variables depending on ca\n\n xinffca_t = 1.0/(1.+ cS.ccai/0.00035);\n xpcat_t = cS.xipcamax* cS.ccai/(0.0005+ cS.ccai);\n ecat_t = cC.rtof*0.5*Math.log( cS.ccao/ cS.ccai);\n xupt_t = cS.xupmax/(1.+ cS.xkup/ cS.ccai);\n carow2_t = ( cS.trpnmax* cS.xkmtrpn/( cS.ccai+ cS.xkmtrpn)/( cS.ccai+ cS.xkmtrpn) + cS.cmdnmax* cS.xkmcmdn/( cS.ccai+ cS.xkmcmdn)/( cS.ccai+ cS.xkmcmdn)+1.)/ cC.c_b1c;\n\n //table variables depending on fn\n /* fnlo=-0.2,fnhi=2.3,nfnt=2500\n dfntable=(fnhi-fnlo)/float(nfnt)\n fn=fnlo+i*dfntable\n */\n xinfut_t = 1.0/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n temp = 1.91+2.09/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n exptauvt_t = Math.exp(- cS.timestep/temp);\n\n xinfvt_t = 1.-1.0/(1.+ Math.exp(-( cS.fn-6.835e-14)/13.67e-16));\n\n\n // table loop starts here\n\n xstim = _s1s2Stimulus(count, data);\n\n //c equilibrium potentials\n eca = ecat_t;\n\n //c fast sodium current\n xinfm1 = xinfm_t;\n exptaum1 = exptaum_t;\n xinfh1 = xinfh_t;\n exptauh1 = exptauh_t;\n xinfj1 = xinfj_t;\n exptauj1 = exptauj_t;\n\n cS.xm = xinfm1 + ( cS.xm - xinfm1) * exptaum1;\n cS.xh = xinfh1 + ( cS.xh - xinfh1) * exptauh1;\n cS.xj = xinfj1 + ( cS.xj - xinfj1) * exptauj1; \n cS.xna = cS.xm * cS.xm * cS.xm * cS.xh * cS.xj * cS.gna *( cS.v - cC.ena);\n\n //c time-independent k+ current\n cS.xk1 = xk1t_t;\n\n //c transient outward k+ current\n xinfoa1 = xinfoa_t;\n exptauoa1 = exptauoa_t;\n xinfoi1 = xinfoi_t;\n exptauoi1 = exptauoi_t;\n\n cS.xoa = xinfoa1+( cS.xoa-xinfoa1)*exptauoa1;\n cS.xoi = xinfoi1+( cS.xoi-xinfoi1)*exptauoi1;\n cS.xto = cS.xoa* cS.xoa* cS.xoa* cS.xoi* cS.gto*( cS.v - cC.ek);\n\n //c ultrarapid delayed rectifier k+ current\n xinfua1 = xinfua_t;\n exptauua1 = exptauua_t;\n xinfui1 = xinfui_t;\n exptauui1 = exptauui_t;\n xkurcoeff1= xkurcoeff_t;\n\n cS.xua = xinfua1+( cS.xua-xinfua1)*exptauua1;\n cS.xui = xinfui1+( cS.xui-xinfui1)*exptauui1;\n cS.xkur = cS.xua* cS.xua* cS.xua* cS.xui*xkurcoeff1;\n\n //c rapid delayed outward rectifier k+ current\n xinfxr1 = cS.xinfxr_t;\n exptauxr1 = cS.exptauxr_t;\n xkrcoeff1 = xkrcoeff_t;\n\n cS.xr = xinfxr1+( cS.xr-xinfxr1)*exptauxr1;\n cS.xkr = cS.xr*xkrcoeff1;\n\n //c slow delayed outward rectifier k+ current\n xinfxs1 = cS.xinfxs_t;\n exptauxs1 = cS.exptauxs_t;\n\n cS.xs = xinfxs1+( cS.xs-xinfxs1)*exptauxs1;\n cS.xks = cS.xs* cS.xs* cS.gks*( cS.v- cC.ek);\n\n //c L-tpe ca2+ current\n xinfd1 = xinfd_t;\n exptaud1 = exptaud_t;\n xinff1 = xinff_t;\n exptauf1 = exptauf_t;\n xinffca1 = xinffca_t;\n\n cS.xd = xinfd1+( cS.xd-xinfd1)*exptaud1;\n cS.xf = xinff1+( cS.xf-xinff1)*exptauf1;\n cS.xfca = xinffca1+( cS.xfca-xinffca1)* cC.exptaufca;\n cS.xcal = cS.xd* cS.xf* cS.xfca* cS.gcal*( cS.v-65.0);\n\n //xnak, xnaca, xbca, xbna, xpca; \n\n //cc na+/k+ pump current\n cS.xnak = xnakt_t;\n\n //c na+/ca2+ exchanger current\n xnaca11 = xnaca1_t;\n xnaca21 = xnaca2_t;\n cS.xnaca = xnaca11 - xnaca21* cC.cnao3* cS.ccai;\n\n //cc background currents\n cS.xbca = cS.gbca * ( cS.v - eca);\n\n cS.xbna = cS.gbna * ( cS.v - cC.ena);\n\n //c ca2+ pump current\n cS.xpca = xpcat_t;\n\n /*c ca2+ release current from JSR\n c correction: divide first fn term by cm, multiply second fn term by cm\n c then to ensure computational accuracy (no problems with tiny numbers),\n c divide fn by 1e-12 and adjust functions accordingly*/\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel- cS.ccai);\n\n cS.fn = cS.vrel/ cS.cm* cS.xrel-0.5 * cS.cm/ cS.xxf*(0.5* cS.xcal-0.2* cS.xnaca);\n\n xinfu = xinfut_t;\n exptauv = exptauvt_t;\n xinfv = xinfvt_t;\n\n cS.xu = xinfu+( cS.xu-xinfu)* cC.exptauu;\n cS.xv = xinfv+( cS.xv-xinfv)*exptauv;\n\n xinfw1 = xinfw_t;\n exptauw1 = exptauw_t;\n\n cS.xw = xinfw1+( cS.xw-xinfw1)*exptauw1;\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel - cS.ccai);\n\n // c transfer current from NSR to JSR\n xtr = ( cS.ccaup - cS.ccarel)/ cS.tautr;\n\n // c ca2+ uptake current by the NSR\n xup = xupt_t;\n\n // c ca2+ leak current by the NSR\n xupleak = cS.ccaup* cS.xupmax/ cS.ccaupmax;\n\n //c intracellular ion concentrations\n di_ups = xup-xupleak;\n carow21 = carow2_t;\n cS.ccai = cS.ccai + cS.timestep * ( cC.c_b1d*( cS.xnaca + cS.xnaca - cS.xpca - cS.xcal - cS.xbca)- cC.c_b1e* di_ups + cS.xrel) / carow21; \n cS.ccaup = cS.ccaup + cS.timestep * (xup - xupleak-xtr*( cS.vrel/ cS.vup));\n cS.ccarel = cS.ccarel + cS.timestep * ((xtr - cS.xrel)/ (1.+( cS.csqnmax* cS.xkmcsqn)/(Math.pow(( cS.ccarel+ cS.xkmcsqn),2))));\n\n //console.log( cS.xna , cS.xk1 , + cS.xkur + cS.xto , cS.xkur , cS.xkr , cS.xks , cS.xcal , cS.xpca , cS.xnak, cS.xnaca, cS.xbna, cS.xbca-xstim);\n \n cS.v = cS.v - cS.timestep * ( cS.xna + cS.xk1 + cS.xto + cS.xkur + cS.xkr + cS.xks + cS.xcal + cS.xpca + cS.xnak + cS.xnaca + cS.xbna + cS.xbca - xstim);\n\n // table loop ends\n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n\n // iterate the count\n count++;\n\n return data; \n }", "function makeSamples(groove, color, data){\n\n\tvar oneSecond = 44100;\n\tvar loop = false;\n\tvar repeats = 4;\n\tvar repeated = 0;\n\tvar PI = Math.PI;\n\n\tvar maxSamples = (groove.duration * oneSecond ) / 1000 ;\t\n var instrumentType = \"sin\";\n var delay = false;\n if (color == 0) {\n\tdelay = true;\n } \n else if (color == 1) {\n } \n else if (color == 2) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 3) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 4) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 5) {\n\tinstrumentType = \"sqr\";\n } \n else if (color == 6) {\n\tinstrumentType = \"sqr\";\n\tdelay = true;\n } \n else if (color == 7) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 8) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 9) {\n\tinstrumentType = \"saw\";\n } \n else if (color == 10) {\n\tinstrumentType = \"saw\";\n } \n\n var freqs = data[0];\n var times = data[1];\n\tdebugfreqs = freqs;\n \tdebugtimes = times;\n\n var samples = [];\n ii = 0;\n var tcounter = 0;\n for (var j = 0; j < freqs.length - 1; j++) {\n\t\tif (j == 0 && times[0] > groove.startLine){\n\t\t\tvar freqDur = times[j] / groove.lineLength;\n\t \n\t\t\tfreqDur = freqDur * groove.duration;\n\t\t\tfreqDur = freqDur * 44100;\n\t\t\tfreqDur = Math.floor(freqDur / 1000);\n\t \n\t \tfor (var i = 0; i < freqDur; i++) {\n\t \t var t = i / oneSecond; \n\t \t samples[ii] = 0;\n\t \t ii++;\n\t\t }\n\t\t}\n var frequency = freqs[j];\n//\tif (freqs.length > j + 1 && freqs[j + 1] == 0){\n//\t\tfrequency = 0;\n//\t}\n\n var freqDur = times[j + 1] / groove.lineLength;\n \n freqDur = freqDur * groove.duration;\n freqDur = freqDur * 44100;\n freqDur = Math.floor(freqDur / 1000);\n\n// \tfor (var i = 0; i < freqDur; i++){\n\t\tvar i = 0;\n while (true){\n var t = i / oneSecond; // time from 0 to 1\n if (frequency == 0){\n samples[ii] = 0;\n }\n\t\t else if (instrumentType == \"sin\"){\n\t\t samples[ii] = Math.sin(frequency * 2 * PI * t); // wave equation (between -1,+1)\n\t\t }\n else if (instrumentType == \"sqr\") {\n\t\t\t if (Math.sin(frequency * 2 * PI * t) > 0){\n\t\t\t\t\tsamples[ii] = 1; } else { samples[ii] = -1;\n\t\t\t\t}\n\t\t }\n else if (instrumentType == \"saw\") {\n \tsamples[ii] = 1 - ((frequency*t)%1);\n\t\t }\n samples[ii] = samples[ii] * 0.25;\n\n\t\t\tif (i >= freqDur){\n\t\t\t\tif (instrumentType == \"sin\"){\n\t\t\t\t\tif (samples[ii] == 0 || (samples[ii -1] < samples[ii] && samples[ii] < 0.01 && samples[ii] > -0.01)){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\t\t\n\t\t\t}\n ii++;\n if (maxSamples > 0 && ii >= maxSamples){\n\t\t\t\tbreak;\n\t\t }\n\t\t i++;\n }\n if (maxSamples > 0 && ii >= maxSamples){\n\t\t\tbreak;\n\t }\n }\n if (maxSamples == 0){\n\t\tmaxSamples = ii;\n }\n else {\n\t\twhile (ii < maxSamples){\n\t \t\tsamples[ii] = 0;\n\t \tii++;\n\t\t}\n }\n//\tdocument.write(ii);\n//\tdocument.write(\"<br/>\");\n// var delayLine = new Array;\n// var pointer = 0;\n// var delayLength = oneSecond / 2;\n// for (var ijj = 0; ijj < groove.lineLength; ijj++){\n//\t\tdelayLine[ijj] = 0;\n// }\n for (var repeat = 1 ; repeat < repeats; repeat++){\n for (var jj = 0 ; jj < ii ; jj++){\n samples[jj + ii * repeat] = samples[jj];\n\t if (delay){\n//\t\tsamples[jj + ii * repeat] = samples[jj + ii * repeat] - 0.5*delayLine[pointer];\n//\t\tdelayLine[pointer] = samples[jj + ii * repeat];\n//\t\tpointer = (pointer+1)%lineLength;\n }\n\t }\n\t}\n return samples;\n}", "function addEqualiser() {\n\n var gainDb = -40.0; // atenuation When it takes a positive value it is a real gain, when negative it is an attenuation. It is expressed in dB, has a default value of 0 and can take a value in a nominal range of -40 to 40.\n var bandSplit = [360, 3600];\n context_player = new AudioContext();\n\n for (var i = 0; i < 2; i++) {\n\n mediaElement_player.push(null);\n sourceNode_player.push(null);\n source_player.push(null);\n lGain_player.push(null);\n mGain_player.push(null);\n hGain_player.push(null);\n sum_player.push(null);\n volumeNodes.push(null);\n\n\n mediaElement_player[i] = document.getElementById('jp_audio_' + i);\n source_player[i] = context_player.createMediaElementSource(mediaElement_player[i]);\n\n initFrequencyQuality(i);\n\n // affects the ammount of treble in a sound - treble knob - atenuates the sounds below the 3600 frequencies\n var lBand_player = context_player.createBiquadFilter();\n lBand_player.type = \"lowshelf\";\n lBand_player.frequency.value = bandSplit[1];\n lBand_player.gain.value = gainDb;\n\n // affects the ammount of bass in a sound - bass knob - atenuates the sounds higher than 360 frequencies\n var hBand_player = context_player.createBiquadFilter();\n hBand_player.type = \"highshelf\";\n hBand_player.frequency.value = bandSplit[0];\n hBand_player.gain.value = gainDb;\n\n var hInvert_player = context_player.createGain();\n hInvert_player.gain.value = -1.0;\n\n //Subtract low and high frequencies (add invert) from the source for the mid frequencies\n var mBand_player = context_player.createGain();\n\n //or use picking\n //mBand_player = context_player.createBiquadFilter();\n //mBand_player.type = \"peaking\";\n //mBand_player.frequency.value = bandSplit[0];\n //mBand_player.gain.value = gainDb;\n\n var lInvert_player = context_player.createGain();\n lInvert_player.gain.value = -1.0;\n\n sourceNode_player[i].connect(lBand_player);\n sourceNode_player[i].connect(mBand_player);\n sourceNode_player[i].connect(hBand_player);\n\n hBand_player.connect(hInvert_player);\n lBand_player.connect(lInvert_player);\n\n hInvert_player.connect(mBand_player);\n lInvert_player.connect(mBand_player);\n\n\n lGain_player[i] = context_player.createGain();\n mGain_player[i] = context_player.createGain();\n hGain_player[i] = context_player.createGain();\n\n lBand_player.connect(lGain_player[i]);\n mBand_player.connect(mGain_player[i]);\n hBand_player.connect(hGain_player[i]);\n\n sum_player[i] = context_player.createGain();\n lGain_player[i].connect(sum_player[i]);\n mGain_player[i].connect(sum_player[i]);\n hGain_player[i].connect(sum_player[i]);\n\n lGain_player[i].gain.value = 1;\n mGain_player[i].gain.value = 1;\n hGain_player[i].gain.value = 1;\n\n volumeNodes[i] = context_player.createGain();\n sum_player[i].connect(volumeNodes[i]);\n volumeNodes[i].connect(context_player.destination);\n }\n\n //set volume\n var x = 50 / 100;\n // Use an equal-power crossfading curve:\n var gain1 = Math.cos(x * 0.5 * Math.PI);\n var gain2 = Math.cos((1.0 - x) * 0.5 * Math.PI);\n volumeNodes[0].gain.value = gain1;\n volumeNodes[1].gain.value = gain2;\n\n //create audio Recording node\n audioRecordNode = context_player.createGain();\n volumeNodes[0].connect(audioRecordNode);\n volumeNodes[1].connect(audioRecordNode);\n audioRecorder = new Recorder(audioRecordNode);\n}", "function sha1_ft(t, b, c, d) {\n if (t < 20) return (b & c) | ((~b) & d);\n if (t < 40) return b ^ c ^ d;\n if (t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}", "function setupAudioNodes(audioContext, drawWaveformFunction, drawSpectrumFunction, drawSpectrogramFunction, htmlIds, colorScale)\n{\n // Setup a script node\n let scriptNode = audioContext.createScriptProcessor();\n // Connect to destination\n scriptNode.connect(audioContext.destination);\n \n // Setup an analyzer\n let analyser = audioContext.createAnalyser();\n analyser.smoothingTimeConstant = 0;\n // Higher FFT size means more bins. More bins mean more points to graph.\n // Also means each bin has a smaller range of frequencies so it's kind of like more precise.\n analyser.fftSize = 2048 * 2;\n \n // Create a buffer source node\n let sourceNode = audioContext.createBufferSource();\n sourceNode.connect(analyser);\n analyser.connect(scriptNode);\n \n sourceNode.connect(audioContext.destination);\n \n console.log(\"Sample rate: \" + audioContext.sampleRate + \" Hz\");\n console.log(\"FFT size: \" + analyser.fftSize);\n // FrequencyBinCount is half of FFT size\n console.log(\"FrequencyBinCount: \" + analyser.frequencyBinCount);\n \n let frequencyPerBin = (audioContext.sampleRate / 2) / analyser.frequencyBinCount;\n console.log(\"Each frequency bin represents \" + frequencyPerBin + \" Hz of range\");\n console.log(\"frequencyData[0]\" + \" is the strength of frequencies from \" + (0 * frequencyPerBin) + \" Hz to \" + ((0 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[1]\" + \" is the strength of frequencies from \" + (1 * frequencyPerBin) + \" Hz to \" + ((1 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[2]\" + \" is the strength of frequencies from \" + (2 * frequencyPerBin) + \" Hz to \" + ((2 + 1)*frequencyPerBin) + \" Hz\");\n console.log(\"frequencyData[\" + (analyser.frequencyBinCount - 1) + \"]\" + \" is the strength of frequencies from \" + (analyser.frequencyBinCount - 1) * frequencyPerBin + \" Hz to \" + (((analyser.frequencyBinCount - 1) + 1) * frequencyPerBin) + \" Hz\");\n \n // When the script node is called we use information from the analyzer node to draw\n scriptNode.onaudioprocess = function()\n {\n let frequencyData = new Uint8Array(analyser.frequencyBinCount);\n analyser.getByteFrequencyData(frequencyData);\n \n let timeDomainData = new Uint8Array(analyser.frequencyBinCount);\n analyser.getByteTimeDomainData(timeDomainData);\n \n if (sourceNode.buffer !== null)\n {\n //console.log(frequencyData);\n //console.log(timeDomainData);\n drawWaveformFunction(timeDomainData, htmlIds.waveformCanvas, colorScale);\n drawSpectrumFunction(frequencyData, htmlIds.spectrumCanvas, colorScale);\n drawSpectrogramFunction(frequencyData, htmlIds.spectrogramCanvas, colorScale);\n }\n }\n \n return sourceNode;\n}", "function draw(data)\n{\n var spectrum = []; // an array that will hold noise cancelled data\n var i, x, L=0, ldata=0, nBins=0, binNum=0, c=0; // uint8\n var minLvl, maxLvl; //uint\n var level, y, sum; //int\n var offsetIndex = 0;\n var FFT_N = 128; //data.length;\n\n samplePos = 0;\n // Remove noise and apply EQ levels\n for(x=0; x < FFT_N/2; x++ ) {\n L = noise[x];\n spectrum[x] = data[x+ offsetIndex];\n if ( spectrum[x] < L ) {\n spectrum[x] = 0;\n } else {\n spectrum[x] = ((spectrum[x] - L) * (256 - eq[x] >> peakHeight));\n }\n }\n //fill colors first, then we will erase idle sections.\n for(i=0; i < totalColumns; i++) {\n client.setPixelColor(i, LED_RED); // row 0, RED\n client.setPixelColor(8 + i, LED_BLUE); // Rwo 1, Blue\n client.setPixelColor(16+ i, LED_BLUE); // Row 2, Blue\n client.setPixelColor(24+ i, LED_GREEN); // Row 3, Green\n client.setPixelColor(32+ i, LED_GREEN); // Row 4, Green\n }\n\n for(x=0; x < totalColumns; x++ ) {\n ldata = colData[x];\n nBins = ldata[0] + 2;\n binNum = ldata[1];\n for(sum=0, i=2; i < nBins; i++ ) {\n sum += spectrum[binNum++] * ldata[i]; // Weighted\n colDiv[x] += data[x];\n }\n col[x][colCount] = sum / colDiv[x]; // Average\n minLvl = maxLvl = col[x][0];\n for(i=1; i < totalFrames; i++ ) {\n if(col[x][i] < minLvl) {\n minLvl = col[x][i];\n } else if( col[x][i] > maxLvl ) {\n maxLvl = col[x][i];\n }\n }\n // minLvl and maxLvl indicate the extents of the FFT output, used\n // for vertically scaling the output graph (so it looks interesting\n // regardless of volume level). If they're too close together though\n // (e.g. at very low volume levels) the graph becomes super coarse\n // and 'jumpy'...so keep some minimum distance between them (this\n // also lets the graph go to zero when no sound is playing):\n\n if( maxLvl-minLvl < peakHeight) {\n maxLvl = minLvl + peakHeight;\n }\n minLvAvg[x] = (minLvAvg[x] * 7 + minLvl) >> 3; // Dampen min/max levels\n maxLvAvg[x] = (maxLvAvg[x] * 7 + maxLvl) >> 3; // fake rolling average\n // Second fixed-point scale based on dynamic min/max levels\n level = 10 * (col[x][colCount] - minLvAvg[x]) / parseInt(maxLvAvg[x] - minLvAvg[x]);\n // clip output and convert to byte\n if( level < 0) { c = 0; }\n else if ( level > peakOffTop ) { c = peakOffTop; } // Allow dot to go a few pixels off the top\n else { c = parseInt(level); }\n\n if( c > peak[x] ) { peak[x] = c; } // keep dot on top\n if(peak[x] < 0 ) { // empty the column\n clearColumnLeds(x,peakHeight);\n //continue;\n } else if(c < peakHeight ) { // empty partial column\n clearColumnLeds(x, peakHeight - c);\n }\n // the peak dot color varies but doesn't necessarily match\n // the three screen regions.. yellow has a little more influence.\n y = peakHeight - peak[x];\n\n /******************** DO NOT DELETE **********************/\n /* Save this section for a high Peak Array of LEDs - It is not so useful for 5 pixel High\n if( y < 1 ) { setColumnRowPixelColor(x,y, LED_RED); }\n else if( y < 5 ) { setColumnRowPixelColor(x,y, LED_BLUE); }\n else { setColumnRowPixelColor(x,y, LED_GREEN); }\n */\n /******************** DO NOT DELETE **********************/\n\n }\n client.writePixels();\n\n /******************** Important **************************/\n // Every third frame, make the peak pixels drop by 1:\n if ( ++dotCount >= 3 ) {\n dotCount = 0;\n // reset Averages, col dividers and peaks\n for ( i = 0; i < totalColumns; i++ ) {\n minLvAvg[i] = 0;\n maxLvAvg[i] = 512;\n colDiv[i] = 0;\n //peak[i] = 0; // We are dropping the peaks below\n }\n for ( x = 0; x < peakHeight; x++ ) {\n peak[x] -= (peak[x] > 0) ? 1 : 0; // if peak is above 0, then subtract 1\n }\n // rotate hue over LEDs\n LED_RED = OPC.rotateColor(1, LED_RED);\n LED_BLUE = OPC.rotateColor(1, LED_BLUE);\n LED_GREEN = OPC.rotateColor(1, LED_GREEN);\n }\n // Adjust the Frame Count\n if ( ++colCount >= totalFrames ) {\n colCount = 0;\n }\n\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}", "function sha1_ft(t, b, c, d)\n{\n if(t < 20) return (b & c) | ((~b) & d);\n if(t < 40) return b ^ c ^ d;\n if(t < 60) return (b & c) | (b & d) | (c & d);\n return b ^ c ^ d;\n}" ]
[ "0.65954375", "0.6168972", "0.6044958", "0.6022759", "0.591924", "0.58853126", "0.5843347", "0.577806", "0.57772064", "0.5703021", "0.562801", "0.55890924", "0.5570078", "0.5464318", "0.54534", "0.5339202", "0.5326124", "0.5318228", "0.53027326", "0.52718914", "0.52644837", "0.5250019", "0.51002055", "0.5096984", "0.5089478", "0.5085867", "0.50818896", "0.5062489", "0.50592065", "0.5053552", "0.50457776", "0.50395507", "0.50318575", "0.49991494", "0.4997923", "0.49906737", "0.49865484", "0.49865484", "0.49596334", "0.49486697", "0.49455962", "0.49007112", "0.48839712", "0.48683113", "0.48617876", "0.48600242", "0.48516387", "0.48220733", "0.48169217", "0.4816723", "0.48098448", "0.48025116", "0.48025116", "0.48025116", "0.48025116", "0.47310892", "0.47233245", "0.47233245", "0.4707004", "0.47061676", "0.47017288", "0.47017288", "0.47017288", "0.47017288", "0.47017288", "0.4687284", "0.46807086", "0.46659926", "0.46513113", "0.46496043", "0.46476468", "0.46458715", "0.46238944", "0.46099308", "0.45991912", "0.45899886", "0.4589064", "0.4589064", "0.45789668", "0.4576599", "0.45682994", "0.45675915", "0.45629087", "0.45546445", "0.45448613", "0.45376247", "0.45360956", "0.45337763", "0.45290184", "0.45245162", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879", "0.4517879" ]
0.0
-1
alternative to using Object.keys for old browsers
function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getKeys(obj) {\n return Object.keys(obj); // Yes it is builtin!\n }", "function Object_keys(obj) {\n\t if (Object.keys) return Object.keys(obj)\n\t else {\n\t var res = [];\n\t for (var key in obj) res.push(key);\n\t return res;\n\t }\n\t}", "function keys(obj){\n return Object.keys(obj)\n}", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function getKeys(obj){\n return _.keys(obj)\n }", "function keys(obj) {\n return Object.keys(obj);\n}", "getKeys(obj){\n var keys = [];\n for(var key in obj) keys.push(key);\n return keys;\n }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n /* this function will take an object as an argument, \n * and output an array containg the object keys. The function takes an empty array,\n * then by using the Object.key() method, it will add the keys to the array and return it*/\n var arr = [];\n arr = Object.keys(object);\n return arr;\n // YOUR CODE ABOVE HERE //\n}", "function keysInObject(obj) {\n return Object.keys(obj);\n }", "function objectKeys(obj) {\n\tif (Object.keys) return Object.keys(obj);\n\n\t// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n}", "function keys(obj) {\n // Retrieve all the names of the object's properties.\n // Return the keys as strings in an array.\n // Based on http://underscorejs.org/#keys\n return Object.keys(obj);\n}", "function objectKeys(obj) {\n return Object.keys(obj);\n}", "function objectKeys (obj) {\n return Object.keys(obj)\n}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n //return an array of the object keys\n return Object.keys(object);\n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function typed_keys(o) {\n return Object.keys(o);\n}", "function keys(o) {\n return Object.keys(o);\n}", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function _getKeys(obj) {\n\tvar keys = [];\n\tfor(var key in obj){\n\t keys.push(key);\n\t}\n\treturn keys;\n }", "function useHyperCube_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n \n //create an empty array to hold keys\n var arr = [];\n // use for in loop to retrieve all of the keys in the object\n for(var key in object){\n arr.push(key);\n \n }\n // return Object.keys(object);\nreturn arr;\n \n \n // YOUR CODE ABOVE HERE //\n}", "function QdtPicassoMiniMap_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function _objectKeys(obj) {\r\n if (Array.isArray(obj)) {\r\n var keys = new Array(obj.length);\r\n for (var k = 0; k < keys.length; k++) {\r\n keys[k] = \"\" + k;\r\n }\r\n return keys;\r\n }\r\n if (Object.keys) {\r\n return Object.keys(obj);\r\n }\r\n var keys = [];\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n keys.push(i);\r\n }\r\n }\r\n return keys;\r\n}", "function keys(obj)\n{\n var keys = [];\n for (var key in obj)\n {\n if (obj.hasOwnProperty(key))\n keys.push(key);\n }\n return keys\n}", "function agh_keys(obj) {\n /*?lwiki\n * @fn agh.keys\n * 指定したオブジェクトに含まれる key を配列にして返します。\n * @param[in] obj 非 null のオブジェクトを指定します。\n * @return key を格納した配列を返します。\n */\n var keys = [];\n try { for (var key in obj) keys.push(key); } catch(e) {}\n return keys;\n }", "function objectKeys(obj) {\n if (typeof obj !== 'object') return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n }", "getObjectKeys(obj){\n\t\tlet arr = '';\n\t\tObject.keys(obj).map(function(keyName, keyIndex) {\t\t\t\n\t\t\tarr = obj[keyName]['name'];\n\t\t})\n\t\treturn arr;\n\t}", "function _keys( obj ) {\n\t\tvar result = [];\n\t\tfor( var key in obj )\n\t\t\tresult.push(key);\n\t\treturn result.sort();\n\t}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n let obj = [];\n for (var key in object) {\n obj.push(key);\n }\n return obj;\n\n \n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function keysFor(obj) {\n var keys = [],\n key;\n\n if (!obj) {\n return keys;\n }\n\n if (Object.keys) {\n return Object.keys(obj);\n }\n\n for (key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n keys.push(key);\n }\n }\n\n return keys;\n}", "function keys(obj){\n\tvar arr = [];\n\tfor(var key in obj){\n\t\tarr.push(key);\n\t}\n\treturn arr;\n}", "function getKeys(obj){\n\tvar keys = [];\n\tfor(var key in obj){\n\t\tkeys.push(key);\n\t}\n\treturn keys;\n}", "function getKeys(obj) {\r\n var keys = [];\r\n for (var key in obj) {\r\n keys.push(key);\r\n\r\n }\r\n return keys;\r\n }", "function keysFor(obj){\n a = []\n for(i in obj)\n a.push(i)\n return a\n}", "function keys(object) {\n var __keys__ = [], prop;\n for (prop in object) __keys__.push(prop);\n return __keys__;\n}", "function objectKeys(object) {\n if (Object.keys) {\n return Object.keys(object);\n }\n var result = [];\n\n angular.forEach(object, function (val, key) {\n result.push(key);\n });\n return result;\n}", "function objectKeys(object) {\n if (Object.keys) {\n return Object.keys(object);\n }\n var result = [];\n\n angular.forEach(object, function (val, key) {\n result.push(key);\n });\n return result;\n}", "function getKeys(obj) {\n var keys;\n if(obj.keys) {\n keys = obj.keys();\n } else {\n keys = [];\n\n for(var k in obj) {\n if(Object.prototype.hasOwnProperty.call(obj, k)) {\n keys.push(k);\n }\n }\n }\n\n return keys;\n}", "function keys(obj) {\r\n if (!types.isObject(obj)) return []; \r\n var keys = [];\r\n for (var key in obj) if (has(obj, key)) keys.push(key);\r\n return keys;\r\n }", "function keys(obj) {\n if (!is_1.isObject(obj))\n return [];\n return Object.keys(obj);\n}", "function keys(o){\n var tmp = new Array();\n for (k in o) tmp.push(k);\n return tmp;\n}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n\n//creating new variable called 'keys' that is an array literal\nvar keys = [];\n//assigning value to keys variable using Object.keys(), referencing object passed through function\n keys = Object.keys(object);\n//printing array variable keys to console\nreturn keys;\n \n//returns an error but it works in repl.it\n \n // YOUR CODE ABOVE HERE //\n}", "function keys(object)\n{\n var keys = [];\n for (var k in object) {\n keys.push(k);\n }\n return keys;\n}", "function getObjAllKeys(obj) {\n\t if (!isObject(obj) && !isArray(obj)) {\n\t return [];\n\t }\n\t var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'];\n\t var keys = [];\n\t for (var key in obj) {\n\t if (dontEnums.indexOf(key) < 0) {\n\t keys.push(key);\n\t }\n\t }\n\t keys = keys.sort();\n\t return keys;\n\t}", "function getKeys(object) {\n var keys = [];\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n return keys;\n }", "get keys() {}", "function objectKeys(obj) {\n if (typeof obj !== 'object') return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n }", "function keys() {\n return Object.keys(index);\n}", "function keys(o) {\n\tif (typeof o !== \"object\") throw TypeError();\n\tvar result = [];\n\tfor(var prop in o)\n\t{\n\t\tif (o.hasOwnProperty(prop))\n\t\t\tresult.push(prop);\n\t}\n\treturn result;\n}", "function box_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(obj) {\n var keys = [];\n\n for(var key in obj) {\n if(obj.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n log(keys.join('\\n'));\n return keys;\n}", "function panel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function keys(object) {\n var output = [];\n for (var key in object) {\n if (hasKey(object, key)) {\n output.push(key);\n }\n }\n return output;\n}", "function components_image_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(obj) {\n if (util.isArray(obj)) {\n return \"Object is an array\";\n }\n var keys=[];\n for (var k in obj) {\n keys.push(k);\n }\n return keys;\n}", "function card_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(object)\n{\n var i = 0;\n var result = \"\";\n for(var key in object)\n {\n\t i++;\n\t if(object.hasOwnProperty(key))\n\t result += key;\n }\n if(i == 0)\n\t return 0;\n else\n\t return result;\n}", "function baseKeys(object) {\n if (!isPrototype(object)) {\n return Object.keys(Object(object))\n }\n var result = []\n for (var key in Object(object)) {\n if (object.hasOwnProperty(key) && key !== 'constructor') {\n result.push(key)\n }\n }\n return result\n}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function get_keys(arr,add) {\n if (arr instanceof Array) {\n arr.forEach(function(d){\n if (add) d.d3plus = {}\n for (k in d) {\n if (!vars.data.keys[k] && d[k]) {\n vars.data.keys[k] = typeof d[k]\n }\n }\n })\n }\n else {\n for (var d in arr) {\n for (k in arr[d]) {\n if (!vars.data.keys[k] && arr[d][k]) {\n vars.data.keys[k] = typeof arr[d][k]\n }\n }\n }\n }\n }", "function breadcrumb_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function objectKeys(obj)\n\t\t\t{\n\t\t\t\tif (typeof obj !== 'object')\n\t\t\t\t\treturn [];\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in obj)\n\t\t\t\t\tkeys.push(key);\n\t\t\t\treturn keys;\n\t\t\t}", "function getPlainObjectKeys(object) {\r\n var enumerables = new Set();\r\n for (var key in object)\r\n enumerables.add(key); // *all* enumerables\r\n Object.getOwnPropertySymbols(object).forEach(function (k) {\r\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\r\n enumerables.add(k);\r\n }); // *own* symbols\r\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\r\n // as there is no efficient iterator that returns *all* properties\r\n return Array.from(enumerables);\r\n}", "function keys(object) {\r\n let keys = [];\r\n for (let property in object) {\r\n if (object.hasOwnProperty(property)) {\r\n keys.push(property);\r\n }\r\n }\r\n return keys;\r\n}", "function object_keys (fn, data) {\n var res = []\n Object.keys(data).forEach((key) => {\n Object.keys(data[key]).forEach((key2) => {\n var ret = fn(key, key2, data[key][key2])\n if (ret !== undefined) {\n res.push(ret)\n }\n })\n })\n return res\n}", "function getKeys(obj) {\n\t\t\tvar keys = [];\n\n\t\t\tfor (var key in obj) {\n\t\t\t\tif (obj.hasOwnProperty(key)) keys.push(key);\n\n\t\t\t\t// if our value is also an object\n\t\t\t\tif (getSize(obj[key]) > 0) {\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn keys;\n\t\t}", "function list_item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function allKeys(obj) {\r\n if (!types.isObject(obj)) return [];\r\n var keys = [];\r\n for (var key in obj) keys.push(key);\r\n return keys;\r\n }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n \n // create array literal\n var aObj = [];\n // use key in loop in object and access the key\n for(var key in object){\n //use push method to pus keys into an array literal\n aObj.push(key);\n }\n //return an array that holds keys \n return aObj;\n\n // YOUR CODE ABOVE HERE //\n}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n for (var key in object)\n enumerables.add(key); // *all* enumerables\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\n enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n return Array.from(enumerables);\n}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n for (var key in object)\n enumerables.add(key); // *all* enumerables\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\n enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n return Array.from(enumerables);\n}", "function dropdown_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "keys( cb ){\n\t\tlet _keys = Object.keys( this.data );\n\t\tif (cb != null) { cb( null, _keys ); }\n\t\treturn _keys;\n\t}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n\n for (var key in object) enumerables.add(key); // *all* enumerables\n\n\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable) enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n\n return Array.from(enumerables);\n}", "function getKeys(getJsonObject){\r\n\t\treturn Object.keys(getJsonObject);\r\n\t}", "function getObjectKeys(object) {\n // create empty array to hold object keys\n let objectArray= [];\n // use for in loop to iterate through object items \n for( var key in object){\n // push only the keys onto the empty array \n objectArray.push(key);\n }\n \n return objectArray; \n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function menu_menu_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function keysToString(object) {\n var anArr = [];\n \nfor (var key in object){\n anArr.push(key);\n}\nreturn anArr.join(' ');\n}" ]
[ "0.7384008", "0.731263", "0.7241272", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.71108866", "0.6997259", "0.6959686", "0.6932814", "0.69273907", "0.6917455", "0.6880489", "0.68795663", "0.6870773", "0.6816776", "0.68019634", "0.6798845", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.67811394", "0.6757965", "0.67335415", "0.6722508", "0.67185706", "0.6708124", "0.670529", "0.6700983", "0.6695076", "0.66944396", "0.66837627", "0.6672694", "0.66411614", "0.66347253", "0.66322047", "0.66296965", "0.66228354", "0.6588193", "0.6581697", "0.6581697", "0.6581522", "0.6574609", "0.6559612", "0.6556164", "0.6555894", "0.65261346", "0.6499472", "0.6494743", "0.6484928", "0.6470631", "0.64627564", "0.6454734", "0.6433473", "0.6431336", "0.64044034", "0.63769877", "0.63672125", "0.6362902", "0.6346276", "0.63460124", "0.633847", "0.6333307", "0.6333307", "0.6333307", "0.6333307", "0.6333307", "0.6333307", "0.6333307", "0.632893", "0.6324719", "0.6313808", "0.63090473", "0.6294693", "0.6291609", "0.62745106", "0.62709993", "0.62651515", "0.625271", "0.62423164", "0.62423164", "0.6232816", "0.6227952", "0.6227952", "0.6222867", "0.6208673", "0.62080324", "0.62034655", "0.619093", "0.6188353" ]
0.0
-1
Do not cache `Buffer.isEncoding` when checking encoding names as some modules monkeypatch it to support additional encodings
function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); return nenc || enc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detectUTF8(txt) {\n if(txt) return txt.match(/([\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEF][\\x80-\\xBF][\\x80-\\xBF]|\\xF0[\\x90-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[\\xF1-\\xF7][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xF8[\\x88-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[\\xF9-\\xFB][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xFC[\\x84-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xFD[\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF])/) != null;\n return false;\n}", "function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!==\"string\"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error(\"Unknown encoding: \"+enc);return nenc||enc}", "function detectEncoding(samples) {\n var encoding = null;\n if (looksLikeUtf8(samples)) {\n encoding = 'utf8';\n } else if (looksLikeWin1252(samples)) {\n // Win1252 is the same as Latin1, except it replaces a block of control\n // characters with n-dash, Euro and other glyphs. Encountered in-the-wild\n // in Natural Earth (airports.dbf uses n-dash).\n encoding = 'win1252';\n }\n return encoding;\n }", "function encodingIsAsciiCompat(enc) {\n enc = standardizeEncodingName(enc);\n // gb.* selects the Guo Biao encodings\n // big5 in not compatible -- second byte starts at 0x40\n return !enc || /^(win|latin|utf8|ascii|iso88|gb)/.test(enc);\n }", "function testStringEncodings(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\texpect(_.isObject(encodings)).to.eql(true);\n\t\texpect(_.has(encodings, \"ASCII\")).to.eql(true);\n\t\texpect(_.has(encodings, \"UTF8_BINARY\")).to.eql(true);\n\t\texpect(_.has(encodings, \"ISO_8859_1\")).to.eql(true);\n\t\texpect(encodings.UTF8_BINARY).to.eql(0);\n\t\texpect(encodings.ASCII).to.eql(1);\n\t\texpect(encodings.ISO_8859_1).to.eql(2);\n\t}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function getFullEncoding(spec){return spec.encoding;}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function hasUTF8(input)\n{\n return (input.indexOf('<meta charset=\"utf-8\">') != -1 || input.indexOf('<meta charset=\"UTF-8\">') != -1);\n}", "function isBuffer(_chunk, encoding) {\n return encoding === \"buffer\";\n }", "function getEncodings() {\n iconv.encodingExists('ascii'); // make iconv load its encodings\n return Object.keys(iconv.encodings);\n }", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function isValidName(encodingName) {\n return fixEncoding(encodingName) !== undefined;\n}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer$5.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer$1.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer$4.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}" ]
[ "0.66366535", "0.65744627", "0.6534928", "0.64787394", "0.6463427", "0.6265117", "0.6263352", "0.62615985", "0.62555206", "0.6209522", "0.6144942", "0.6139519", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.61048186", "0.6088967", "0.60741097", "0.60017306" ]
0.0
-1
Checks the type of a UTF8 byte, whether it's ASCII, a leading byte, or a continuation byte. If an invalid byte is detected, 2 is returned.
function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; return byte >> 6 === 0x02 ? -1 : -2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function $lrG1$var$utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }" ]
[ "0.8007454", "0.79413825", "0.7896979", "0.78161865", "0.78161865", "0.77798647", "0.7769451", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.77520263", "0.7751524" ]
0.0
-1
Checks at most 3 bytes at the end of a Buffer in order to detect an incomplete multibyte UTF8 character. The total number of bytes (2, 3, or 4) needed to complete the UTF8 character (if applicable) are returned.
function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 1; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } return nb; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function $lrG1$var$utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}", "function $lrG1$var$utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer." ]
[ "0.8212385", "0.8212385", "0.8134619", "0.8134619", "0.8054928", "0.8054928", "0.80309063", "0.80119467", "0.78480685", "0.7844014", "0.7777412", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.7706933" ]
0.0
-1
Validates as many continuation bytes for a multibyte UTF8 character as needed or are available. If we see a noncontinuation byte where we expect one, we "replace" the validated continuation bytes we've seen so far with a single UTF8 replacement character ('\ufffd'), to match v8's UTF8 decoding behavior. The continuation byte check is included three times in the case where all of the continuation bytes for a character exist in the same buffer. It is also done this way as a slight performance increase instead of using a loop.
function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; return '\ufffd'; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function $lrG1$var$utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function validateUtf8(bytes, start, end) {\n let continuation = 0;\n for (let i = start; i < end; i += 1) {\n const byte = bytes[i];\n if (continuation) {\n if ((byte & FIRST_TWO_BITS) !== CONTINUING_CHAR) {\n return false;\n }\n continuation -= 1;\n }\n else if (byte & FIRST_BIT) {\n if ((byte & FIRST_THREE_BITS) === TWO_BIT_CHAR) {\n continuation = 1;\n }\n else if ((byte & FIRST_FOUR_BITS) === THREE_BIT_CHAR) {\n continuation = 2;\n }\n else if ((byte & FIRST_FIVE_BITS) === FOUR_BIT_CHAR) {\n continuation = 3;\n }\n else {\n return false;\n }\n }\n }\n return !continuation;\n}", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "decodeCharAt (pos) {\n let c, c1, c2, c3;\n c = this.readByteAt(pos);\n\n if (c === null) {\n return null;\n }\n\n // Zero continuation (0 to 127)\n if ((c & 0x80) === 0) {\n return {\n code: c,\n value: String.fromCodePoint(c),\n width: 1\n };\n }\n\n // One continuation (128 to 2047)\n if ((c & 0xE0) === 0xC0) {\n c1 = this.readContinuationByte(pos + 1);\n\n if (c1 >= 0) {\n const codePoint = ((c & 0x1F) << 6) | c1;\n\n if (codePoint >= 128) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 2\n };\n }\n }\n } else if ((c & 0xF0) === 0xE0) {\n // Two continuations (2048 to 55295 and 57344 to 65535)\n c1 = this.readContinuationByte(pos + 1);\n c2 = this.readContinuationByte(pos + 2);\n\n if ((c1 | c2) >= 0) {\n const codePoint = ((c & 0x0F) << 12) | (c1 << 6) | c2;\n\n if (codePoint >= 2048 && (codePoint < 55296 || codePoint > 57343)) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 3\n };\n }\n }\n } else if ((c & 0xF8) === 0xF0) {\n // Three continuations (65536 to 1114111)\n c1 = this.readContinuationByte(pos + 1);\n c2 = this.readContinuationByte(pos + 2);\n c3 = this.readContinuationByte(pos + 3);\n\n if ((c1 | c2 | c3) >= 0) {\n const codePoint = ((c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3;\n\n if (codePoint >= 65536 && codePoint <= 1114111) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 4\n };\n }\n }\n }\n\n // invalid character\n return null;\n }", "function checkContinuation(uint8array, start, checkLength) {\n var array = uint8array;\n if (start + checkLength < array.length) {\n while (checkLength--) {\n if ((array[++start] & 0xC0) !== 0x80) return false;\n }\n return true;\n } else {\n return false;\n }\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}" ]
[ "0.7937871", "0.7937871", "0.74657726", "0.73097616", "0.73097616", "0.71145594", "0.6709752", "0.6588986", "0.6557973", "0.6544995", "0.6481389", "0.6435539", "0.63858587", "0.6272498", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114" ]
0.0
-1
Attempts to complete a multibyte UTF8 character using bytes from a Buffer.
function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed; var r = utf8CheckExtraBytes(this, buf, p); if (r !== undefined) return r; if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, p, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, p, 0, buf.length); this.lastNeed -= buf.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function $lrG1$var$utf8Text(buf, i) {\n var total = $lrG1$var$utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString(\"utf8\",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString(\"utf8\",i,end)}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}" ]
[ "0.71276367", "0.70124817", "0.6781994", "0.67014897", "0.6564168", "0.6473516", "0.6473516", "0.6347521", "0.634379", "0.634379", "0.6313653", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375" ]
0.0
-1
Returns all complete UTF8 characters in a Buffer. If the Buffer ended on a partial character, the character's bytes are buffered until the required number of bytes are available.
function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString('utf8', i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); buf.copy(this.lastChar, 0, end); return buf.toString('utf8', i, end); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
For UTF8, a replacement character is added when ending on a partial character.
function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + '\ufffd'; return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function exchange_chars_utf8(str){\n var newstr = str;\n var bad_chars = [\n chr(0x00C9).concat(\"o\"), chr(0x00C9).concat(\"O\"), chr(0x00C9).concat(\"a\"),\n chr(0x00C9).concat(\"A\"), chr(0x00C9).concat(\"u\"), chr(0x00C9).concat(\"U\"),\n chr(137), chr(136), chr(251) , chr(194).concat(\"a\") ,\n chr(194).concat(\"i\"), chr(194).concat(\"e\"), chr(208).concat(\"c\"), chr(194).concat(\"E\"),\n chr(207).concat(\"c\"), chr(207).concat(\"s\"), chr(207).concat(\"S\"), chr(201).concat(\"i\"),\n chr(200).concat(\"e\"), chr(193).concat(\"e\"), chr(193).concat(\"a\"), chr(193).concat(\"i\"),\n chr(193).concat(\"o\"), chr(193).concat(\"u\"), chr(195).concat(\"u\"), chr(201).concat(\"e\"),\n chr(195).concat(chr(194)), \"&amp;#263;\", \"ä\"\n ];\n // console.log(bad_chars);\n var rep_chars = [\n \"ö\", \"Ö\", \"ä\",\n \"Ä\", \"ü\", \"Ü\",\n \"\" , \"\" , \"ß\", \"á\",\n \"í\", \"é\", \"ç\", \"É\",\n \"č\", \"š\", \"Š\", \"ï\",\n \"ë\", \"è\", \"à\", \"ì\",\n \"ò\", \"ú\", \"û\", \"ë\",\n \"ä\", \"ć\", \"ä\"\n ];\n if(bad_chars.length != rep_chars.length){\n //error\n }\n else{\n var regex;\n for(var i = 0; i < rep_chars.length;i++){\n regex = new RegExp(bad_chars[i], \"g\");\n newstr = newstr.replace(regex, rep_chars[i]);\n }\n }\n return newstr;\n\n}", "function $lrG1$var$utf8Text(buf, i) {\n var total = $lrG1$var$utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function replaceLastCharacter(string, character) {\n return string.slice(0, string.length - 1) + character;\n }", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf){var r=buf&&buf.length?this.write(buf):\"\";if(this.lastNeed)return r+\"�\".repeat(this.lastTotal-this.lastNeed);return r}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function autoEdUnicodeControlChars(str) { //MAIN FUNCTION describes list of fixes\n \n //Removes unneeded Unicode control characters\n str = str.replace(new RegExp('\\u200E|\\uFEFF|\\u200B', 'gi'), '');\n \n return str;\n}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n }" ]
[ "0.6675062", "0.6675062", "0.6231528", "0.6222556", "0.6221065", "0.6221065", "0.5836165", "0.58046544", "0.58046544", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.56987494", "0.5690213", "0.5690213", "0.5660663", "0.5636449", "0.5636449", "0.55870664", "0.557169", "0.5554909", "0.55448425", "0.55448425", "0.55448425", "0.55369556", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.552003", "0.552003", "0.552003", "0.552003", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.5504979" ]
0.0
-1
UTF16LE typically needs two bytes per character, but even if we have an even number of bytes available, we need to check if we end on a leading/high surrogate. In that case, we need to wait for the next two bytes in order to decode the last character properly.
function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString('utf16le', i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 0xD800 && c <= 0xDBFF) { this.lastNeed = 2; this.lastTotal = 4; this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; return r.slice(0, -1); } } return r; } this.lastNeed = 1; this.lastTotal = 2; this.lastChar[0] = buf[buf.length - 1]; return buf.toString('utf16le', i, buf.length - 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isUTF16 (data) {\n var i = 0\n var len = data && data.length\n var pos = null\n var b1, b2, next, prev\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false\n }\n } else {\n b1 = data[0]\n b2 = data[1]\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i\n break\n } else if (data[i] > 0xFF) {\n return false\n }\n }\n\n if (pos === null) {\n return false // Non ASCII\n }\n\n next = data[pos + 1] // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true\n }\n\n prev = data[pos - 1] // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true\n }\n }\n\n return false\n }", "function isUTF16(data) {\n var i = 0;\n var len = data && data.length;\n var pos = null;\n var b1, b2, next, prev;\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false;\n }\n } else {\n b1 = data[0];\n b2 = data[1];\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true;\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true;\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i;\n break;\n } else if (data[i] > 0xFF) {\n return false;\n }\n }\n\n if (pos === null) {\n return false; // Non ASCII\n }\n\n next = data[pos + 1]; // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true;\n }\n\n prev = data[pos - 1]; // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true;\n }\n }\n\n return false;\n}", "function isUTF16(data) {\n var i = 0;\n var len = data && data.length;\n var pos = null;\n var b1, b2, next, prev;\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false;\n }\n } else {\n b1 = data[0];\n b2 = data[1];\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true;\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true;\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i;\n break;\n } else if (data[i] > 0xFF) {\n return false;\n }\n }\n\n if (pos === null) {\n return false; // Non ASCII\n }\n\n next = data[pos + 1]; // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true;\n }\n\n prev = data[pos - 1]; // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true;\n }\n }\n\n return false;\n}", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString(\"utf16le\",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString(\"utf16le\",i,buf.length-1)}", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function lengthBytesUTF16(str) {\nreturn str.length*2;\n}", "function lengthBytesUTF16(str) {\r\n return str.length*2;\r\n}" ]
[ "0.69665134", "0.6921958", "0.6921958", "0.6815354", "0.67462623", "0.67462623", "0.67347175", "0.67347175", "0.67262256", "0.66409534" ]
0.0
-1
For UTF16LE we do not explicitly append special replacement characters if we end on a partial character, we simply let v8 handle that.
function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString('utf16le', 0, end); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $lrG1$var$utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function exchange_chars_utf8(str){\n var newstr = str;\n var bad_chars = [\n chr(0x00C9).concat(\"o\"), chr(0x00C9).concat(\"O\"), chr(0x00C9).concat(\"a\"),\n chr(0x00C9).concat(\"A\"), chr(0x00C9).concat(\"u\"), chr(0x00C9).concat(\"U\"),\n chr(137), chr(136), chr(251) , chr(194).concat(\"a\") ,\n chr(194).concat(\"i\"), chr(194).concat(\"e\"), chr(208).concat(\"c\"), chr(194).concat(\"E\"),\n chr(207).concat(\"c\"), chr(207).concat(\"s\"), chr(207).concat(\"S\"), chr(201).concat(\"i\"),\n chr(200).concat(\"e\"), chr(193).concat(\"e\"), chr(193).concat(\"a\"), chr(193).concat(\"i\"),\n chr(193).concat(\"o\"), chr(193).concat(\"u\"), chr(195).concat(\"u\"), chr(201).concat(\"e\"),\n chr(195).concat(chr(194)), \"&amp;#263;\", \"ä\"\n ];\n // console.log(bad_chars);\n var rep_chars = [\n \"ö\", \"Ö\", \"ä\",\n \"Ä\", \"ü\", \"Ü\",\n \"\" , \"\" , \"ß\", \"á\",\n \"í\", \"é\", \"ç\", \"É\",\n \"č\", \"š\", \"Š\", \"ï\",\n \"ë\", \"è\", \"à\", \"ì\",\n \"ò\", \"ú\", \"û\", \"ë\",\n \"ä\", \"ć\", \"ä\"\n ];\n if(bad_chars.length != rep_chars.length){\n //error\n }\n else{\n var regex;\n for(var i = 0; i < rep_chars.length;i++){\n regex = new RegExp(bad_chars[i], \"g\");\n newstr = newstr.replace(regex, rep_chars[i]);\n }\n }\n return newstr;\n\n}", "function Utf16BeEncoding()\r\n{\r\n // note: false means big-endian.\r\n var myUtf16EncodingBase = new Utf16EncodingBase(false);\r\n \r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n return myUtf16EncodingBase.stringFromBytes(dynamicDataView, beginIdx, size);\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n return myUtf16EncodingBase.stringToBytes(dynamicDataView, beginIdx, str);\r\n }\r\n}", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function Utf16LeEncoding()\r\n{\r\n // note: true means little-endian.\r\n var myUtf16EncodingBase = new Utf16EncodingBase(true);\r\n \r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n return myUtf16EncodingBase.stringFromBytes(dynamicDataView, beginIdx, size);\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n return myUtf16EncodingBase.stringToBytes(dynamicDataView, beginIdx, str);\r\n }\r\n}", "function Utf8Encoding()\r\n{\r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n var aResult = \"\";\r\n var aCode;\r\n var i;\r\n var aValue;\r\n for (i = 0; i < size; i++)\r\n {\r\n aValue = dynamicDataView.getUint8(beginIdx + i);\r\n\r\n // If one byte character.\r\n if (aValue <= 0x7f)\r\n {\r\n aResult += String.fromCharCode(aValue);\r\n }\r\n // If mutlibyte character.\r\n else if (aValue >= 0xc0)\r\n {\r\n // 2 bytes.\r\n if (aValue < 0xe0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x1f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 3 bytes.\r\n else if (aValue < 0xf0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x0f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 4 bytes.\r\n else\r\n {\r\n // turned into two characters in JS as surrogate pair\r\n aCode = (((dynamicDataView.getUint8(beginIdx + i++) & 0x07) << 18) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f)) - 0x10000;\r\n // High surrogate\r\n aResult += String.fromCharCode(((aCode & 0xffc00) >>> 10) + 0xd800);\r\n // Low surrogate\r\n aCode = (aCode & 0x3ff) + 0xdc00;\r\n }\r\n aResult += String.fromCharCode(aCode);\r\n } // Otherwise it's an invalid UTF-8, skipped.\r\n }\r\n \r\n return aResult;\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n var aLength = str.length;\r\n var aResultSize = 0;\r\n var aCode;\r\n var i;\r\n for (i = 0; i < aLength; i++)\r\n {\r\n aCode = str.charCodeAt(i);\r\n if (aCode <= 0x7f)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, aCode);\r\n }\r\n // 2 bytes \r\n else if (aCode <= 0x7ff)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xc0 | (aCode >>> 6 & 0x1f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n // 3 bytes\r\n else if (aCode <= 0xd700 || aCode >= 0xe000)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xe0 | (aCode >>> 12 & 0x0f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n else\r\n // 4 bytes, surrogate pair\r\n {\r\n aCode = (((aCode - 0xd800) << 10) | (str.charCodeAt(++i) - 0xdc00)) + 0x10000;\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xf0 | (aCode >>> 18 & 0x07));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 12 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n }\r\n \r\n return aResultSize;\r\n }\r\n}", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function utf16EncodeAsString(codePoint) {\n ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);\n if (codePoint <= 65535) {\n return String.fromCharCode(codePoint);\n }\n var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;\n var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;\n return String.fromCharCode(codeUnit1, codeUnit2);\n }", "function encodeUTF16BE(input) {\n\t var output = '';\n\t\n\t for (var i = 0; i < input.length; i++) {\n\t var c = input.charCodeAt(i);\n\t\n\t if (c < 0xFFFF) {\n\t output += encodeUnit(c);\n\t } else {\n\t var lead = ((c - 0x10000) >> 10) + 0xD800;\n\t var trail = ((c - 0x10000) & 0x3FF) + 0xDC00;\n\t output += encodeUnit(lead);\n\t output += encodeUnit(trail);\n\t }\n\t }\n\t\n\t return output;\n\t}", "function fixChar(str) {\r\n var newStr = \"\";\r\n for (var i = 0; i < str.length; i++) {\r\n var firstChar = str.charCodeAt(i);\r\n if (firstChar === 0x9 || firstChar === 0xA || firstChar === 0xD\r\n || (firstChar >= 0x20 && firstChar <= 0xD7FF)\r\n || (firstChar >= 0xE000 && firstChar <= 0xFFFD)) {\r\n newStr += str[i];\r\n continue;\r\n }\r\n if (i + 1 === str.length) {\r\n newStr += \"\\uFFFD\";\r\n return newStr;\r\n }\r\n // UTF-16 surrogate characters\r\n var secondChar = str.charCodeAt(i + 1);\r\n if ((firstChar >= 0xD800 && firstChar <= 0xDBFF)\r\n && (secondChar >= 0xDC00 && secondChar <= 0xDFFF)) {\r\n newStr += str[i] + str[i + 1];\r\n i++;\r\n continue;\r\n }\r\n newStr += \"\\uFFFD\";\r\n }\r\n return newStr;\r\n}", "function replaceMisEncodedCharacters(data) {\n const replacements = {\n o_: 'ō',\n u_: 'ū',\n '&amp;': '&',\n }\n\n Object.keys(data).map(key => {\n const newData =\n data[key] &&\n data[key].replace &&\n data[key].replace(\n new RegExp(Object.keys(replacements).join('|'), 'g'),\n match => replacements[match]\n )\n\n if (newData) data[key] = newData\n })\n\n return data\n}", "function UTF16Encoding(cp) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.\n\t\t// 2. If cp ≤ 0xFFFF, return cp.\n\t\tif (cp <= 0xFFFF) {\n\t\t\treturn cp;\n\t\t} else {\n\t\t\t// 3. Let cu1 be floor((cp - 0x10000) / 0x400) + 0xD800.\n\t\t\tvar cu1 = Math.floor((cp - 0x10000) / 0x400) + 0xD800;\n\t\t\t// 4. Let cu2 be ((cp - 0x10000) modulo 0x400) + 0xDC00.\n\t\t\tvar cu2 = ((cp - 0x10000) % 0x400) + 0xDC00;\n\t\t\t// 5. Return the code unit sequence consisting of cu1 followed by cu2.\n\t\t\treturn [cu1, cu2];\n\t\t}\n\t}", "function replaceCodePoint(codePoint) {\n var _a;\n if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {\n return 0xfffd;\n }\n return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;\n}", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString(\"utf16le\",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString(\"utf16le\",i,buf.length-1)}", "function nullCharacterInForeignContent(p, token) {\r\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\r\n p._insertCharacters(token);\r\n}", "function autoEdUnicodeControlChars(str) { //MAIN FUNCTION describes list of fixes\n \n //Removes unneeded Unicode control characters\n str = str.replace(new RegExp('\\u200E|\\uFEFF|\\u200B', 'gi'), '');\n \n return str;\n}", "function specialreplace(ent, base){\n var chr = \"\";\n var num = parseInt(ent.replace(/[\\&\\#\\;x]/g, ''), base);\n // see [[UTF-16]] for chars outside the BMP\n // try this with Gothic letters at full volume ^_^\n if (num > 0xFFFF) {\n num -= 0x10000;\n chr = String.fromCharCode(0xD800 + (num >> 10), 0xDC00 + (num & 0x3FF)); \n } else {\n chr = String.fromCharCode(num);\n }\n if (dont_replace.indexOf(chr) == -1) {\n str = str.replace(ent, chr, \"gi\");\n }\n }", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "codeMapReplace(str, ignoreRanges = [], opt) {\n let index = 0;\n let result = '';\n const strContainsChinese = opt.fixChineseSpacing && utils_1.hasChinese(str);\n let lastCharHasChinese = false;\n for (let i = 0; i < str.length; i++) {\n // Get current character, taking surrogates in consideration\n const char = /[\\uD800-\\uDBFF]/.test(str[i]) && /[\\uDC00-\\uDFFF]/.test(str[i + 1])\n ? str[i] + str[i + 1]\n : str[i];\n let s;\n let ignoreFixingChinese = false;\n switch (true) {\n // current character is in ignored list\n case utils_1.inRange(index, ignoreRanges):\n // could be UTF-32 with high and low surrogates\n case char.length === 2 && utils_1.inRange(index + 1, ignoreRanges):\n s = char;\n // if it's the first character of an ignored string, then leave ignoreFixingChinese to true\n if (!ignoreRanges.find((range) => range[1] >= index && range[0] === index)) {\n ignoreFixingChinese = true;\n }\n break;\n default:\n s = this.map[char] || opt.unknown || '';\n }\n // fix Chinese spacing issue\n if (strContainsChinese) {\n if (lastCharHasChinese &&\n !ignoreFixingChinese &&\n !utils_1.hasPunctuationOrSpace(s)) {\n s = ' ' + s;\n }\n lastCharHasChinese = !!s && utils_1.hasChinese(char);\n }\n result += s;\n index += char.length;\n // If it's UTF-32 then skip next character\n i += char.length - 1;\n }\n return result;\n }", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}", "function replaceChars(buffer, enc, next) {\n //Regex expression to replace it into the string\n let text = buffer.toString();\n text = text.replace(/:\\)/gi, 'joy');\n text = text.replace(/:\\(/gi, 'sorrow');\n this.push(text);\n next();\n}", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):\"\";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString(\"utf16le\",0,end)}return r}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n }", "function utf8Write(view, offset, string) {\n var byteLength = view.byteLength;\n for(var i = 0, l = string.length; i < l; i++) {\n var codePoint = string.charCodeAt(i);\n\n // One byte of UTF-8\n if (codePoint < 0x80) {\n view.setUint8(offset++, codePoint >>> 0 & 0x7f | 0x00);\n continue;\n }\n\n // Two bytes of UTF-8\n if (codePoint < 0x800) {\n view.setUint8(offset++, codePoint >>> 6 & 0x1f | 0xc0);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n\n // Three bytes of UTF-8.\n if (codePoint < 0x10000) {\n view.setUint8(offset++, codePoint >>> 12 & 0x0f | 0xe0);\n view.setUint8(offset++, codePoint >>> 6 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n\n // Four bytes of UTF-8\n if (codePoint < 0x110000) {\n view.setUint8(offset++, codePoint >>> 18 & 0x07 | 0xf0);\n view.setUint8(offset++, codePoint >>> 12 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 6 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n throw new Error(\"bad codepoint \" + codePoint);\n }\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function escapeString(s) {\n s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;\n return s;\n function getReplacement(c) {\n return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));\n }\n }", "function r(e){\n // if variant is present as \\uFE0F\n return m(e.indexOf(y)<0?e.replace(b,\"\"):e)}", "function nullCharacterInForeignContent(p, token) {\n token.chars = REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "function UnescapeSpecialChars(text) {\n\ntext = text.replace(/7f8137798425a7fed2b8c5703b70d078/gm, \"\\\\\")\ntext = text.replace(/833344d5e1432da82ef02e1301477ce8/gm, \"`\")\ntext = text.replace(/3389dae361af79b04c9c8e7057f60cc6/gm, \"*\")\ntext = text.replace(/b14a7b8059d9c055954c92674ce60032/gm, \"_\")\ntext = text.replace(/f95b70fdc3088560732a5ac135644506/gm, \"{\")\ntext = text.replace(/cbb184dd8e05c9709e5dcaedaa0495cf/gm, \"}\")\ntext = text.replace(/815417267f76f6f460a4a61f9db75fdb/gm, \"[\")\ntext = text.replace(/0fbd1776e1ad22c59a7080d35c7fd4db/gm, \"]\")\ntext = text.replace(/84c40473414caf2ed4a7b1283e48bbf4/gm, \"(\")\ntext = text.replace(/9371d7a2e3ae86a00aab4771e39d255d/gm, \")\")\ntext = text.replace(/01abfc750a0c942167651c40d088531d/gm, \"#\")\ntext = text.replace(/5058f1af8388633f609cadb75a75dc9d/gm, \".\")\ntext = text.replace(/9033e0e305f247c0c3c80d0c7848c8b3/gm, \"!\")\ntext = text.replace(/853ae90f0351324bd73ea615e6487517/gm, \":\")\nreturn text;\n}", "parseEscapeUnicodeJSON (idx) {\n const start = idx;\n const len = this.size;\n const uson = this.input;\n\n /* At least four hexadecimal digits must be present */\n if (len - start < 4) {\n return this.parseError (USON.error.unexpectedEnd, len);\n }\n\n /* Get the code point */\n let codep = parseInt (uson.substr (start, 4), 16);\n\n if (Number.isNaN (codep)) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n idx += 4;\n\n /* Check if it's a surrogate */\n if ((codep & 0xF800) === 0xD800) {\n /* Must be a low surrogate */\n if ((codep & 0xFC00) !== 0xDC00) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n /* Get the high surrogate */\n if (len - start < 10) {\n return this.parseError (USON.error.unexpectedEnd, len);\n }\n\n if (uson[4] !== '\\\\' || uson[5] !== 'u') {\n return this.parseError (USON.error.unexpectedToken, start);\n }\n\n idx += 6;\n const high = parseInt (uson.substr (start + 6, 4), 16);\n\n if (Number.isNaN (high)) {\n return this.parseError (USON.error.escapeUnicode, idx);\n }\n\n if ((codep & 0xFC00) !== 0xD800) {\n return this.parseError (USON.error.escapeUnicode, idx);\n }\n\n codep = (((high & 0x3FF) << 10) + 0x10000) | (codep & 0x3FF);\n }\n\n if (codep > 0x10FFFF) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n this.pos = idx;\n\n return String.fromCodePoint (codep);\n}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function f(e,t){// not handling '\\' and handling \\u2028 or \\u2029 to unicode escape sequence\n// not handling '\\' and handling \\u2028 or \\u2029 to unicode escape sequence\nreturn 8232===(-2&e)?(t?\"u\":\"\\\\u\")+(8232===e?\"2028\":\"2029\"):10===e||13===e?(t?\"\":\"\\\\\")+(10===e?\"n\":\"r\"):String.fromCharCode(e)}", "function surprised(){\n vm.input = vm.input.concat(\"😮\");\n }", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "function replaceSpecialChars(value) {\n return value.replace(/[\\&\\:\\(\\)\\[\\\\\\/]/g, ' ').replace(/\\s{2,}/g, ' ').replace(/^\\s/, '').replace(/\\s$/, '').split(' ').join('*');\n }", "_transform(chunk, encoding, callback) {\n const transformChunk = chunk.toString()\n .replace(/[a-z]|[A-Z]|[0-9]/g, this.replaceChar);\n this.push(transformChunk)\n callback();\n }", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}" ]
[ "0.61745626", "0.61719906", "0.61677617", "0.6157869", "0.6157869", "0.6081929", "0.6043509", "0.58793575", "0.58793575", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5790016", "0.5790016", "0.5742851", "0.570861", "0.5700932", "0.5645289", "0.5601927", "0.5599127", "0.55610025", "0.55610025", "0.5554971", "0.5553155", "0.5536044", "0.55246514", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.5519115", "0.55121964", "0.54685193", "0.54685193", "0.54454744", "0.54315233", "0.5412928", "0.54113775", "0.540182", "0.540182", "0.540182", "0.540182", "0.53999656", "0.53999656", "0.53999656", "0.53999656", "0.53750587", "0.53750587", "0.53750587", "0.53750587", "0.53722477", "0.5347385", "0.5330676", "0.532493", "0.53183514", "0.5307718", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.52844334", "0.5278398", "0.5277595", "0.52567065", "0.5256431", "0.5225117", "0.52234775", "0.5220015", "0.5220015", "0.5220015", "0.5220015" ]
0.0
-1
Pass bytes on through for singlebyte encodings (e.g. ascii, latin1, hex)
function simpleWrite(buf) { return buf.toString(this.encoding); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return\"�\".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return\"�\".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return\"�\".repeat(p+2)}}}}", "function Utf8Encoding()\r\n{\r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n var aResult = \"\";\r\n var aCode;\r\n var i;\r\n var aValue;\r\n for (i = 0; i < size; i++)\r\n {\r\n aValue = dynamicDataView.getUint8(beginIdx + i);\r\n\r\n // If one byte character.\r\n if (aValue <= 0x7f)\r\n {\r\n aResult += String.fromCharCode(aValue);\r\n }\r\n // If mutlibyte character.\r\n else if (aValue >= 0xc0)\r\n {\r\n // 2 bytes.\r\n if (aValue < 0xe0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x1f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 3 bytes.\r\n else if (aValue < 0xf0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x0f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 4 bytes.\r\n else\r\n {\r\n // turned into two characters in JS as surrogate pair\r\n aCode = (((dynamicDataView.getUint8(beginIdx + i++) & 0x07) << 18) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f)) - 0x10000;\r\n // High surrogate\r\n aResult += String.fromCharCode(((aCode & 0xffc00) >>> 10) + 0xd800);\r\n // Low surrogate\r\n aCode = (aCode & 0x3ff) + 0xdc00;\r\n }\r\n aResult += String.fromCharCode(aCode);\r\n } // Otherwise it's an invalid UTF-8, skipped.\r\n }\r\n \r\n return aResult;\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n var aLength = str.length;\r\n var aResultSize = 0;\r\n var aCode;\r\n var i;\r\n for (i = 0; i < aLength; i++)\r\n {\r\n aCode = str.charCodeAt(i);\r\n if (aCode <= 0x7f)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, aCode);\r\n }\r\n // 2 bytes \r\n else if (aCode <= 0x7ff)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xc0 | (aCode >>> 6 & 0x1f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n // 3 bytes\r\n else if (aCode <= 0xd700 || aCode >= 0xe000)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xe0 | (aCode >>> 12 & 0x0f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n else\r\n // 4 bytes, surrogate pair\r\n {\r\n aCode = (((aCode - 0xd800) << 10) | (str.charCodeAt(++i) - 0xdc00)) + 0x10000;\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xf0 | (aCode >>> 18 & 0x07));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 12 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n }\r\n \r\n return aResultSize;\r\n }\r\n}", "function EncodeUTF8(cb) {\n this.ondata = cb;\n }", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n }", "function encodeBytes(input) {\n switch (input.type.typeClass) {\n case \"bytes\":\n return Conversion.toBytes(input.value.asHex);\n case \"string\": {\n let coercedInput = (input);\n switch (coercedInput.value.kind) {\n case \"valid\":\n return stringToBytes(coercedInput.value.asString);\n case \"malformed\":\n return Conversion.toBytes(coercedInput.value.asHex);\n }\n }\n }\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function encode_utf8(s) {\n\t return encode_latin1(unescape(encodeURIComponent(s)));\n\t }", "function stringToUTF8Bytes(string) {\r\n return new TextEncoder().encode(string);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function encode_utf8(s) {\r\n\treturn unescape(encodeURIComponent(s));\r\n }", "function encodeUTF8(input) {\n\t var output = \"\";\n\t\n\t for (var i = 0; i < input.length; i++) {\n\t var c = input.charCodeAt(i);\n\t\n\t if (c < 0x80) {\n\t // One byte\n\t output += fromCharCode(c);\n\t } else if (c < 0x800) {\n\t // Two bytes\n\t output += fromCharCode(0xC0 | (c >>> 6));\n\t output += fromCharCode(0x80 | (c & 0x3f));\n\t } else if (c < 0x10000) {\n\t // Three bytes\n\t output += fromCharCode(0xE0 | (c >>> 12));\n\t output += fromCharCode(0x80 | (c >>> 6 & 0x3f));\n\t output += fromCharCode(0x80 | (c & 0x3f));\n\t }\n\t }\n\t\n\t return output;\n\t}", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function convertBytesToString ( bytes ) {\n\n var string = [],\n pos = 0,\n c = 0;\n\n while (\n pos < bytes.length\n ) {\n\n var c1 = bytes[pos++];\n\n if (\n c1 < 128\n ) {\n string[c++] = String.fromCharCode(c1);\n } else if (\n c1 > 191 &&\n c1 < 224\n ) {\n\n var c2 = bytes[pos++];\n\n string[c++] = String.fromCharCode(( c1 & 31 ) << 6 | c2 & 63);\n\n } else if (\n c1 > 239 &&\n c1 < 365\n ) {\n\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n var c4 = bytes[pos++];\n var u = ( ( c1 & 7 ) << 18 | ( c2 & 63 ) << 12 | ( c3 & 63 ) << 6 | c4 & 63 ) - 0x10000;\n\n string[c++] = String.fromCharCode(0xD800 + ( u >> 10 ));\n string[c++] = String.fromCharCode(0xDC00 + ( u & 1023 ));\n\n } else {\n\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n\n string[c++] = String.fromCharCode(( c1 & 15 ) << 12 | ( c2 & 63 ) << 6 | c3 & 63);\n\n };\n\n };\n\n return(string.join(''));\n\n}", "encodeValue(value) {\n return standardEncoding(value);\n }", "function bytesToString(bytes) {\n if (typeof bytes === \"string\") {\n return bytes;\n } else {\n var str = \"\";\n for (var i = 0; i < bytes.length; ++i) {\n str += String.fromCharCode(bytes[i]);\n }\n return str;\n }\n}", "function genUtf8Char1B() {\n var bin = \"0\" + genBitStr(7);\n var hex = bitStrToHexStr(bin);\n try {\n return hexStrToUtf8Str(hex);\n }\n catch (_a) {\n return genUtf8Char1B();\n }\n }", "function toUtf8Bytes(...args) {\n return ethers_1.utils.toUtf8Bytes(...args);\n}", "function encode(string){\n\n}", "function simpleWrite(buf){return buf.toString(this.encoding)}", "toHex(bytes) {\n return Buffer.from(bytes).toString('hex').toUpperCase();\n }", "function bytesToString(aBytes, aCharset) {\n var converter = Cc[\"@mozilla.org/intl/scriptableunicodeconverter\"].\n createInstance(Ci.nsIScriptableUnicodeConverter);\n LOG(\"bytesToString: converting using charset: \" + aCharset);\n\n try {\n converter.charset = aCharset;\n return converter.convertFromByteArray(aBytes, aBytes.length);\n } catch (ex) {}\n\n return null;\n}", "function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!==\"string\"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error(\"Unknown encoding: \"+enc);return nenc||enc}", "function encode_utf8(s) {\n return unescape(encodeURIComponent(s));\n}", "function encodeUtf8$1(input) {\r\n var encoder = \r\n // tslint:disable-next-line\r\n typeof TextEncoder === 'undefined'\r\n ? // @ts-ignore\r\n new (require('util')).TextEncoder('utf-8') // Node.\r\n : new TextEncoder(); // Browser.\r\n // @ts-ignore\r\n return encoder.encode(input);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "_utf8_encode(string) {\r\n string = string.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n for (var n = 0; n < string.length; n++) {\r\n var c = string.charCodeAt(n);\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n } else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n } else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n\r\n }\r\n return utftext;\r\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\uFFFD'.repeat(p);\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\uFFFD'.repeat(p + 1);\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\uFFFD'.repeat(p + 2);\n }\n }\n }\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\uFFFD'.repeat(p);\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\uFFFD'.repeat(p + 1);\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\uFFFD'.repeat(p + 2);\n }\n }\n }\n}", "function encode_utf8(s) {\r\n var i, necessary = false;\r\n\r\n for (i = 0; i < s.length; i++) {\r\n if ((s.charCodeAt(i) == 0x9D) ||\r\n\t \t(s.charCodeAt(i) > 0xFF)) {\r\n necessary = true;\r\n break;\r\n }\r\n }\r\n if (!necessary) {\r\n return s;\r\n }\r\n return String.fromCharCode(0x9D) + unicode_to_utf8(s);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "function encode_utf8( s )\n{\n \n return unescape( encodeURIComponent( s ) );\n}", "function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }", "function i(t){var n=t;return e.isBuffer(n)||(n=new e(n)),c.default.encode(n)}", "function utf8CheckExtraBytes(self, buf, p) {\n\t if ((buf[0] & 0xC0) !== 0x80) {\n\t self.lastNeed = 0;\n\t return '\\uFFFD'.repeat(p);\n\t }\n\t if (self.lastNeed > 1 && buf.length > 1) {\n\t if ((buf[1] & 0xC0) !== 0x80) {\n\t self.lastNeed = 1;\n\t return '\\uFFFD'.repeat(p + 1);\n\t }\n\t if (self.lastNeed > 2 && buf.length > 2) {\n\t if ((buf[2] & 0xC0) !== 0x80) {\n\t self.lastNeed = 2;\n\t return '\\uFFFD'.repeat(p + 2);\n\t }\n\t }\n\t }\n\t}", "function utf8CheckExtraBytes(self, buf, p) {\n\t if ((buf[0] & 0xC0) !== 0x80) {\n\t self.lastNeed = 0;\n\t return '\\uFFFD'.repeat(p);\n\t }\n\t if (self.lastNeed > 1 && buf.length > 1) {\n\t if ((buf[1] & 0xC0) !== 0x80) {\n\t self.lastNeed = 1;\n\t return '\\uFFFD'.repeat(p + 1);\n\t }\n\t if (self.lastNeed > 2 && buf.length > 2) {\n\t if ((buf[2] & 0xC0) !== 0x80) {\n\t self.lastNeed = 2;\n\t return '\\uFFFD'.repeat(p + 2);\n\t }\n\t }\n\t }\n\t}", "function getEncoding(character) {\n\treturn getBinary(characterValue(character));\n}", "function getEncoding(character) {\n\treturn getBinary(characterValue(character));\n}", "function bytesToString(bytes) {\n var s = '';\n for (var i = 0; i < bytes.length; i += 1) {\n s += String.fromCharCode(bytes[i]);\n }\n\n return s;\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "apply_blob(blob) { return Base64.encode(blob) }", "function bytesToSring(bytes) {\n const chars = [];\n for (let i = 0, n = bytes.length; i < n;) {\n chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));\n }\n return String.fromCharCode.apply(null, chars);\n}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}" ]
[ "0.63480157", "0.63194925", "0.6203319", "0.61778533", "0.6119751", "0.6044178", "0.5955961", "0.5948356", "0.59131217", "0.59131217", "0.59131217", "0.5899713", "0.58946466", "0.5892134", "0.5868687", "0.5868687", "0.5868687", "0.5868687", "0.5787701", "0.57683253", "0.5724343", "0.5691013", "0.5679561", "0.56541485", "0.5649699", "0.5647616", "0.5646762", "0.563076", "0.5627838", "0.5613073", "0.56072426", "0.56008023", "0.55982816", "0.5579583", "0.5570621", "0.55485195", "0.55354846", "0.55354846", "0.55218333", "0.5512549", "0.5506977", "0.54923785", "0.5489722", "0.54723954", "0.546842", "0.546842", "0.5466952", "0.5466952", "0.5466194", "0.5456845", "0.5456845", "0.5456845", "0.5456845", "0.5456845", "0.54465735", "0.5444121", "0.5437496", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5437327", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366", "0.5428366" ]
0.0
-1
Encode a buffer as a base58check encoded string
function encode (payload) { var checksum = checksumFn(payload) return base58.encode(Buffer.concat([ payload, checksum ], payload.length + 4)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode(buffer, version) {\n\tversion = version || 0\n\n\t// FIXME: `new Buffer(buffer)` is unnecessary if input is a Buffer\n\tvar version = new Buffer([ version ])\n\tvar payload = new Buffer(buffer)\n\n\tvar message = Buffer.concat([ version, payload ])\n\tvar checksum = sha256(message).slice(0, 4)\n\n\treturn base58.encode(Buffer.concat([ message, checksum ]))\n}", "converseToBase58(): string {\n return bs58.encode(this.converseToBuffer());\n }", "function encode(source) {\n if (Array.isArray(source) || source instanceof Uint8Array) {\n source = _Buffer.from(source);\n }\n\n if (!_Buffer.isBuffer(source)) {\n throw new TypeError('Expected Buffer');\n }\n\n if (source.length === 0) {\n return '';\n } // Skip & count leading zeroes.\n\n\n var zeroes = 0;\n var length = 0;\n var pbegin = 0;\n var pend = source.length;\n\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n } // Allocate enough space in big-endian base58 representation.\n\n\n var size = (pend - pbegin) * iFACTOR + 1 >>> 0;\n var b58 = new Uint8Array(size); // Process the bytes.\n\n while (pbegin !== pend) {\n var carry = source[pbegin]; // Apply \"b58 = b58 * 256 + ch\".\n\n var i = 0;\n\n for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {\n carry += 256 * b58[it1] >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = carry / BASE >>> 0;\n }\n\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n\n length = i;\n pbegin++;\n } // Skip leading zeroes in base58 result.\n\n\n var it2 = size - length;\n\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n } // Translate the result into a string.\n\n\n var str = LEADER.repeat(zeroes);\n\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n\n return str;\n }", "convertBase58(cleeString)\r\n {\r\n //----------------------------------------------\r\n // PublicKey = \"123\"\r\n // keyAsString = \"0x004872dd8b2ceaa54f922e8e6ba6a8eaa77b48872144b\"\r\n // adresseAsString = \"12EHDzypjuALLPyopJHU37QuhyQs3bG\"\r\n //----------------------------------------------\r\n let k = \"0\"+cleeString.substring(2); // Faut Enlever le \"x\"\r\n let bytes = Buffer.from(k,'hex')\r\n let adresseAsString = bs58.encode(bytes);\r\n return adresseAsString;\r\n\r\n }", "function base58Encode(data) {\n return basex_1.Base58.encode(bytes_1.concat([data, bytes_1.hexDataSlice(sha2_1.sha256(sha2_1.sha256(data)), 0, 4)]));\n}", "function base58Encode(data) {\n return __WEBPACK_IMPORTED_MODULE_1__ethersproject_basex__[\"a\" /* Base58 */].encode(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__ethersproject_bytes__[\"c\" /* concat */])([data, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__ethersproject_bytes__[\"i\" /* hexDataSlice */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__ethersproject_sha2__[\"c\" /* sha256 */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__ethersproject_sha2__[\"c\" /* sha256 */])(data)), 0, 4)]));\n}", "function EncodeBase58(pbegin, pend) {\n\n}", "function encode(buffer, base) {\r\n /**<sum>Attempt to encode a byte buffer in a given base.</sum>\r\n \r\n <arg id=\"text\" type=\"str\">\r\n The string to be converted.\r\n </arg>\r\n <kwarg id=\"base\" type=\"int\">\r\n The base of the return value.\r\n </kwarg>\r\n \r\n <return>str</return>\r\n \r\n <except>Raises 'BaseUnsupported' if the base is unsupported.</except>\r\n **/\r\n \r\n var buf = buffer.map(function(byte) {\r\n return _to_base_x(byte, 2).zfill(8);\r\n }).join('');\r\n if (base == 32 || base == 64) {\r\n var n = Math.floor(Math.log(base, 2))\r\n var l = Math.floor(lcm(8, n) / n)\r\n \r\n buf = buf.match(new RegExp('.{1,'+n+'}', 'g'));\r\n buf[buf.length-1] = buf[buf.length-1].ljust(n,'0')\r\n buf = buf.map(function(chnk) {\r\n return convert(chnk, 2, base);\r\n }).join('');\r\n buf = buf.ljust(buf.length + ((-buf.length).mod(l)), '=');\r\n } else {\r\n buf = buffer.map(function(byte) {\r\n return _to_base_x(byte, base).zfill(Math.ceil(Math.log(256,base)));\r\n }).join('');\r\n }\r\n \r\n return buf.toString();\r\n }", "function base58Encode(data) {\n return basex_lib_esm[\"a\" /* Base58 */].encode(Object(bytes_lib_esm[\"b\" /* concat */])([data, Object(bytes_lib_esm[\"e\" /* hexDataSlice */])(Object(sha2[\"c\" /* sha256 */])(Object(sha2[\"c\" /* sha256 */])(data)), 0, 4)]));\n}", "function encode (payload) {\n var checksum = checksumFn(payload)\n\n return base58.encode(Buffer.concat([\n payload,\n checksum\n ], payload.length + 4))\n }", "function base58_encode(data) {\n var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n var BYTES_TO_LENGTHS = [0, 2, 3, 5, 6, 7, 9, 10, 11]\n var ALPHABET_MAP = {}\n var BASE = ALPHABET.length\n\n // pre-compute lookup table\n for (var z = 0; z < ALPHABET.length; z++) {\n var x = ALPHABET.charAt(z)\n if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous')\n ALPHABET_MAP[x] = z\n }\n\n function encode_partial(data, pos) {\n var len = 8\n if (pos + len > data.length) len = data.length - pos\n var digits = [0]\n for (var i = 0; i < len; ++i) {\n for (var j = 0, carry = data[pos + i]; j < digits.length; ++j) {\n carry += digits[j] << 8\n digits[j] = carry % BASE\n carry = (carry / BASE) | 0\n }\n\n while (carry > 0) {\n digits.push(carry % BASE)\n carry = (carry / BASE) | 0\n }\n }\n\n var res = ''\n // deal with leading zeros\n for (var k = digits.length; k < BYTES_TO_LENGTHS[len]; ++k) res += ALPHABET[0]\n // convert digits to a string\n for (var q = digits.length - 1; q >= 0; --q) res += ALPHABET[digits[q]]\n return res\n }\n\n var res = ''\n for (var i = 0; i < data.length; i += 8) {\n res += encode_partial(data, i)\n }\n return res\n}", "function encode (payload) {\n var checksum = sha256x2(payload)\n\n return base58.encode(Buffer.concat([\n payload,\n checksum\n ], payload.length + 4))\n}", "function encode(source) {\n source = new Uint8Array(source);\n if (source.length === 0) {\n return '';\n }\n // Skip & count leading zeroes.\n let zeroes = 0;\n let length = 0;\n let pbegin = 0;\n let pend = source.length;\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++;\n zeroes++;\n }\n // Allocate enough space in big-endian base58 representation.\n let size = ((pend - pbegin) * iFACTOR + 1) >>> 0;\n let b58 = new Uint8Array(size);\n // Process the bytes.\n while (pbegin !== pend) {\n let carry = source[pbegin];\n // Apply \"b58 = b58 * 256 + ch\".\n let i = 0;\n for (\n let it1 = size - 1;\n (carry !== 0 || i < length) && it1 !== -1;\n it1--, i++\n ) {\n carry += (256 * b58[it1]) >>> 0;\n b58[it1] = carry % BASE >>> 0;\n carry = (carry / BASE) >>> 0;\n }\n if (carry !== 0) {\n throw new Error('Non-zero carry');\n }\n length = i;\n pbegin++;\n }\n // Skip leading zeroes in base58 result.\n let it2 = size - length;\n while (it2 !== size && b58[it2] === 0) {\n it2++;\n }\n // Translate the result into a string.\n let str = LEADER.repeat(zeroes);\n for (; it2 < size; ++it2) {\n str += ALPHABET.charAt(b58[it2]);\n }\n return str;\n }", "function encode (payload) {\n\t var checksum = sha256x2(payload)\n\n\t return base58.encode(Buffer.concat([\n\t payload,\n\t checksum\n\t ], payload.length + 4))\n\t}", "toString() {\n /* istanbul ignore next */\n return bintools.bufferToB58(this.toBuffer());\n }", "function encode(hash, prefix) {\n var payload = hash\n if (prefix) {\n payload = Buffer.allocUnsafe(hash.length + 1)\n payload.writeUInt8(prefix, 0)\n hash.copy(payload, 1)\n }\n const checksum = Buffer.from(checksumFn(payload))\n return base58.encode(Buffer.concat([\n payload,\n checksum\n ], payload.length + 4))\n }", "toString() {\n return bintools.bufferToB58(this.toBuffer());\n }", "function base (ALPHABET) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256)\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i)\n var xc = x.charCodeAt(0)\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i\n }\n var BASE = ALPHABET.length\n var LEADER = ALPHABET.charAt(0)\n var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up\n function encode (source) {\n if (source instanceof Uint8Array) {\n } else if (ArrayBuffer.isView(source)) {\n source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength)\n } else if (Array.isArray(source)) {\n source = Uint8Array.from(source)\n }\n if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0\n var length = 0\n var pbegin = 0\n var pend = source.length\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++\n zeroes++\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0\n var b58 = new Uint8Array(size)\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin]\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0\n b58[it1] = (carry % BASE) >>> 0\n carry = (carry / BASE) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n pbegin++\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length\n while (it2 !== size && b58[it2] === 0) {\n it2++\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes)\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return new Uint8Array() }\n var psz = 0\n // Skip leading spaces.\n if (source[psz] === ' ') { return }\n // Skip and count leading '1's.\n var zeroes = 0\n var length = 0\n while (source[psz] === LEADER) {\n zeroes++\n psz++\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size)\n // Process the characters.\n while (source[psz]) {\n // Decode character\n var carry = BASE_MAP[source.charCodeAt(psz)]\n // Invalid character\n if (carry === 255) { return }\n var i = 0\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0\n b256[it3] = (carry % 256) >>> 0\n carry = (carry / 256) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n psz++\n }\n // Skip trailing spaces.\n if (source[psz] === ' ') { return }\n // Skip leading zeroes in b256.\n var it4 = size - length\n while (it4 !== size && b256[it4] === 0) {\n it4++\n }\n var vch = new Uint8Array(zeroes + (size - it4))\n var j = zeroes\n while (it4 !== size) {\n vch[j++] = b256[it4++]\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string)\n if (buffer) { return buffer }\n throw new Error('Non-base' + BASE + ' character')\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encode(input) {\n if (Array.isArray(input)) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n}", "function encodeString(value) {\n return Buffer.from(value).toString(\"base64\");\n}", "function encodeString(value) {\n return Buffer.from(value).toString(\"base64\");\n}", "function encodeString(value) {\n return Buffer.from(value).toString(\"base64\");\n}", "function b58convert(encoded, newMagicNumber) {\n let data = b58.decode(encoded)\n data = data.slice(4)\n data = Buffer.concat([Buffer.from(newMagicNumber, 'hex'), data])\n return b58.encode(data)\n}", "function encode(input) {\n if (input instanceof Array) {\n var output = [];\n for (var i = 0; i < input.length; i++) {\n output.push(encode(input[i]));\n }\n var buf = Buffer.concat(output);\n return Buffer.concat([encodeLength(buf.length, 192), buf]);\n }\n else {\n var inputBuf = toBuffer(input);\n return inputBuf.length === 1 && inputBuf[0] < 128\n ? inputBuf\n : Buffer.concat([encodeLength(inputBuf.length, 128), inputBuf]);\n }\n }", "getAddress() {\n let encodable = [\n me.record ? me.record.id : this.pubkey,\n bin(this.box.publicKey),\n PK.usedBanks\n ]\n return base58.encode(r(encodable))\n }", "function base58ToHex(b58) {\n\t var hexBuf = new Buffer(bs58.decode(b58));\n\t return hexBuf.toString('hex');\n\t}", "encode(chars) {\n const bytes = [];\n for (let i = 0; i < chars.length; i += 1) {\n const char = chars[i];\n if (char === 96) {\n bytes.push(char);\n bytes.push(char);\n } else if (char === 10) {\n bytes.push(char);\n } else if (char >= 32 && char <= 126) {\n bytes.push(char);\n } else {\n let str = '';\n if (char >= 0 && char <= 31) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 127 && char <= 255) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 0x100 && char <= 0xffff) {\n str += `\\`u${ascii[(char >> 8) & mask[8]]}${ascii[char & mask[8]]}`;\n } else if (char >= 0x10000 && char <= 0xffffffff) {\n str += '`u{';\n const digit = (char >> 24) & mask[8];\n if (digit > 0) {\n str += ascii[digit];\n }\n str += `${ascii[(char >> 16) & mask[8]] + ascii[(char >> 8) & mask[8]] + ascii[char & mask[8]]}}`;\n } else {\n throw new Error('escape.encode(char): char > 0xffffffff not allowed');\n }\n const buf = Buffer.from(str);\n buf.forEach((b) => {\n bytes.push(b);\n });\n }\n }\n return Buffer.from(bytes);\n }", "function encrypt(buffer) {\r\n var encrypters = [172, 115, 254, 242, 170, 186, 109, 171, 48, 58, 139, 167, 222, 13, 21, 33, 74];\r\n var bytes = new Uint8Array(buffer);\r\n var output = \"\";\r\n for (var i = 0; i < bytes.length; i++) {\r\n var oldValue = bytes[i];\r\n var encrypter = encrypters[i % encrypters.length];\r\n bytes[i] = oldValue ^ encrypter;\r\n output += String.fromCharCode(bytes[i]);\r\n }\r\n resultDataBuffer = buffer;\r\n return output;\r\n}", "function encodeBytes(input) {\n switch (input.type.typeClass) {\n case \"bytes\":\n return Conversion.toBytes(input.value.asHex);\n case \"string\": {\n let coercedInput = (input);\n switch (coercedInput.value.kind) {\n case \"valid\":\n return stringToBytes(coercedInput.value.asString);\n case \"malformed\":\n return Conversion.toBytes(coercedInput.value.asHex);\n }\n }\n }\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n }", "function i(t){var n=t;return e.isBuffer(n)||(n=new e(n)),c.default.encode(n)}", "function encode(s) {\n \t\treqstr(s);\n \t\tvar len = s.length;\n \t\tvar out = [];\n \t\tfor(var i = 0; i < len; i += 3) {\n \t\t\tvar w = x24_r64(c3_x24((s.substring(i,i+3)+\"\\0\\0\").substring(0,3)));\n \t\t\tif(3 > len - i) {\n \t\t\t\tw = (w.substring(0,1 + len - i) + \"==\").substring(0,4);\n \t\t\t}\n \t\t\tout.push(w);\n \t\t}\n \t\treturn out.join('') || '';\n \t}", "function toString(buffer) {\n var string = \"\";\n for (var i = 0, l = buffer.length; i < l; ++i) {\n var x = buffer[i];\n if (x < 0x10) string += \"0\" + x.toString(16);\n else string += x.toString(16);\n }\n return string;\n}", "function bufferToString(buffer) {\n\t // base64-arraybuffer\n\t var bytes = new Uint8Array(buffer);\n\t var base64String = '';\n\t var i;\n\n\t for (i = 0; i < bytes.length; i += 3) {\n\t /*jslint bitwise: true */\n\t base64String += BASE_CHARS[bytes[i] >> 2];\n\t base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t base64String += BASE_CHARS[bytes[i + 2] & 63];\n\t }\n\n\t if (bytes.length % 3 === 2) {\n\t base64String = base64String.substring(0, base64String.length - 1) + '=';\n\t } else if (bytes.length % 3 === 1) {\n\t base64String = base64String.substring(0, base64String.length - 2) + '==';\n\t }\n\n\t return base64String;\n\t}", "function bufferToString(buffer) {\n\t // base64-arraybuffer\n\t var bytes = new Uint8Array(buffer);\n\t var base64String = '';\n\t var i;\n\n\t for (i = 0; i < bytes.length; i += 3) {\n\t /*jslint bitwise: true */\n\t base64String += BASE_CHARS[bytes[i] >> 2];\n\t base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t base64String += BASE_CHARS[bytes[i + 2] & 63];\n\t }\n\n\t if (bytes.length % 3 === 2) {\n\t base64String = base64String.substring(0, base64String.length - 1) + '=';\n\t } else if (bytes.length % 3 === 1) {\n\t base64String = base64String.substring(0, base64String.length - 2) + '==';\n\t }\n\n\t return base64String;\n\t}", "function bufferToString(buffer) {\n\t // base64-arraybuffer\n\t var bytes = new Uint8Array(buffer);\n\t var base64String = '';\n\t var i;\n\n\t for (i = 0; i < bytes.length; i += 3) {\n\t /*jslint bitwise: true */\n\t base64String += BASE_CHARS[bytes[i] >> 2];\n\t base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t base64String += BASE_CHARS[bytes[i + 2] & 63];\n\t }\n\n\t if (bytes.length % 3 === 2) {\n\t base64String = base64String.substring(0, base64String.length - 1) + '=';\n\t } else if (bytes.length % 3 === 1) {\n\t base64String = base64String.substring(0, base64String.length - 2) + '==';\n\t }\n\n\t return base64String;\n\t }", "function bufferToString(buffer) {\n\t // base64-arraybuffer\n\t var bytes = new Uint8Array(buffer);\n\t var base64String = '';\n\t var i;\n\n\t for (i = 0; i < bytes.length; i += 3) {\n\t /*jslint bitwise: true */\n\t base64String += BASE_CHARS[bytes[i] >> 2];\n\t base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t base64String += BASE_CHARS[bytes[i + 2] & 63];\n\t }\n\n\t if (bytes.length % 3 === 2) {\n\t base64String = base64String.substring(0, base64String.length - 1) + '=';\n\t } else if (bytes.length % 3 === 1) {\n\t base64String = base64String.substring(0, base64String.length - 2) + '==';\n\t }\n\n\t return base64String;\n\t }", "function bufferToString(buffer) {\n\t // base64-arraybuffer\n\t var bytes = new Uint8Array(buffer);\n\t var base64String = '';\n\t var i;\n\n\t for (i = 0; i < bytes.length; i += 3) {\n\t /*jslint bitwise: true */\n\t base64String += BASE_CHARS[bytes[i] >> 2];\n\t base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t base64String += BASE_CHARS[bytes[i + 2] & 63];\n\t }\n\n\t if (bytes.length % 3 === 2) {\n\t base64String = base64String.substring(0, base64String.length - 1) + '=';\n\t } else if (bytes.length % 3 === 1) {\n\t base64String = base64String.substring(0, base64String.length - 2) + '==';\n\t }\n\n\t return base64String;\n\t }", "function encode(input) {\n var output = '';\n var chr1;\n var chr2;\n var chr3;\n var enc1;\n var enc2;\n var enc3;\n var enc4;\n var i = 0;\n input = utf8Encode(input);\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output\n + keyStr.charAt(enc1) + keyStr.charAt(enc2)\n + keyStr.charAt(enc3) + keyStr.charAt(enc4);\n }\n return output;\n }", "function fixBuffer(buffer) {\n var binary = '';\n var bytes = new Uint8Array(buffer);\n var len = bytes.byteLength;\n for (var i = 0; i < len; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return binary;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n for (var i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" /* BASE_CHARS */[bytes[i] >> 2];\n base64String += \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" /* BASE_CHARS */[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64String +=\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" /* BASE_CHARS */[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64String += \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" /* BASE_CHARS */[bytes[i + 2] & 63];\n }\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n }\n else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n return base64String;\n }", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if (bytes.length % 3 === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n}", "function asciiHexStringToBinaryBuffer(buffer) {\r\n\r\n var pair;\r\n\r\n // Two ASCII chars make one binary octet\r\n var binBuffer = new Buffer(buffer.length / 2);\r\n\r\n var binBufferIndex = 0;\r\n\r\n for (var index = 0; index < buffer.length; index += 2) {\r\n\r\n pair = \"\";\r\n pair += buffer[index];\r\n pair += buffer[index+1];\r\n\r\n binBuffer[binBufferIndex] = asciiHexToBinary(pair);\r\n\r\n binBufferIndex++;\r\n }\r\n\r\n return binBuffer;\r\n}", "function bufferToString(buffer) {\n // base64-arraybuffer\n var bytes = new Uint8Array(buffer);\n var base64String = '';\n var i;\n\n for (i = 0; i < bytes.length; i += 3) {\n /*jslint bitwise: true */\n base64String += BASE_CHARS[bytes[i] >> 2];\n base64String += BASE_CHARS[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64String += BASE_CHARS[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64String += BASE_CHARS[bytes[i + 2] & 63];\n }\n\n if ((bytes.length % 3) === 2) {\n base64String = base64String.substring(0, base64String.length - 1) + '=';\n } else if (bytes.length % 3 === 1) {\n base64String = base64String.substring(0, base64String.length - 2) + '==';\n }\n\n return base64String;\n }", "function BIP66_encode (r, s) {\n var lenR = r.length;\n var lenS = s.length;\n var signature = new Buffer(6 + lenR + lenS);\n\n // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]\n signature[0] = 0x30;\n signature[1] = signature.length - 2;\n signature[2] = 0x02;\n signature[3] = r.length;\n r.copy(signature, 4);\n signature[4 + lenR] = 0x02;\n signature[5 + lenR] = s.length;\n s.copy(signature, 6 + lenR);\n\n return signature;\n }", "encodeString(input) {\n let output = '';\n let chr1;\n let chr2;\n let chr3;\n let enc1;\n let enc2;\n let enc3;\n let enc4;\n let i = 0;\n input = this.unicodeEncode(input);\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n }\n else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output +\n this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) +\n this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4);\n }\n return output;\n }", "function bip39ToBuffer(str) {\n if (!isValidBip39(str)) {\n throw new Error(\"invalid BIP39 phrase\");\n }\n const wrds = str.split(' ');\n let binStr = '';\n for (w of wrds) {\n binStr = binStr + toBinaryStr(words[w], 11);\n }\n //console.log(\"bin str : \" + binStr);\n\n let entLength = (32 * wrds.length) / 3; // entropy length in bits\n //console.log(\"entropy length: \" + entLength);\n let buffer = Buffer.alloc(entLength / 8);\n // we don't need the final 4-8 bits, those are just a checksum.\n for (let i=0; i<entLength/8 ; i++) {\n let n = binStr.slice(i*8,i*8+8);\n buffer.writeUInt8(parseInt(n, 2), i);\n }\n return buffer;\n}", "function base64encode(value) {\n\treturn new Buffer(value).toString('base64');\n}", "function encodeRecoveryKey(key) {\n const buf = new Buffer(OLM_RECOVERY_KEY_PREFIX.length + key.length + 1);\n buf.set(OLM_RECOVERY_KEY_PREFIX, 0);\n buf.set(key, OLM_RECOVERY_KEY_PREFIX.length);\n\n let parity = 0;\n for (let i = 0; i < buf.length - 1; ++i) {\n parity ^= buf[i];\n }\n buf[buf.length - 1] = parity;\n const base58key = _bs2.default.encode(buf);\n\n return base58key.match(/.{1,4}/g).join(\" \");\n}", "function encode (obj) {\n return Buffer.from(JSON.stringify(obj)).toString('base64');\n}", "function cliEncode(any) {\n return Buffer.from(JSON.stringify(any)).toString('base64');\n}", "function encode (input) {\n var output = \"\";\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n input = _utf8_encode(input);\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output +\n _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +\n _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n }\n return output;\n }", "function encodeIntoByteBuffer(self, buffer) {\n const initialPosition = buffer.position;\n buffer.putInt32(encodingCookie);\n buffer.putInt32(0); // Placeholder for payload length in bytes.\n buffer.putInt32(1);\n buffer.putInt32(self.numberOfSignificantValueDigits);\n buffer.putInt64(self.lowestDiscernibleValue);\n buffer.putInt64(self.highestTrackableValue);\n buffer.putInt64(1);\n const payloadStartPosition = buffer.position;\n fillBufferFromCountsArray(self, buffer);\n const backupIndex = buffer.position;\n buffer.position = initialPosition + 4;\n buffer.putInt32(backupIndex - payloadStartPosition); // Record the payload length\n buffer.position = backupIndex;\n return backupIndex - initialPosition;\n}", "function encodeBase32(input) {\n if (!input) return;\n\n return base32Encode(input, \"RFC4648-HEX\", {\n padding: false,\n }).toLowerCase();\n}", "function sha256_encode_bytes() {\n var j = 0;\n var output = new Array(32);\n for (var i = 0; i < 8; i++) {\n output[j++] = ((ihash[i] >>> 24) & 0xff);\n output[j++] = ((ihash[i] >>> 16) & 0xff);\n output[j++] = ((ihash[i] >>> 8) & 0xff);\n output[j++] = (ihash[i] & 0xff);\n }\n return output;\n}", "function buf2binstring(buf) {\n\t return _buf2binstring(buf, buf.length);\n\t }", "encryptWithkey(buffer, key){\n var cipher = crypto.createCipheriv('aes-256-ecb',key,new Buffer(0));\n var crypted = cipher.update(buffer,'utf8','base64');\n crypted = crypted+ cipher.final('base64');\n console.log('printed: ', crypted);\n return crypted;\n }", "function sha256_encode_bytes() {\n var j = 0;\n var output = new Array(32);\n\n for (var i = 0; i < 8; i++) {\n output[j++] = ihash[i] >>> 24 & 0xff;\n output[j++] = ihash[i] >>> 16 & 0xff;\n output[j++] = ihash[i] >>> 8 & 0xff;\n output[j++] = ihash[i] & 0xff;\n }\n\n return output;\n}", "function sha256_encode_bytes() {\n var j = 0;\n var output = new Array(32);\n\n for (var i = 0; i < 8; i++) {\n output[j++] = ihash[i] >>> 24 & 0xff;\n output[j++] = ihash[i] >>> 16 & 0xff;\n output[j++] = ihash[i] >>> 8 & 0xff;\n output[j++] = ihash[i] & 0xff;\n }\n\n return output;\n}", "function encode(input, encoding) {\n if (encoding === void 0) { encoding = \"utf8\"; }\n if (Buffer.isBuffer(input)) {\n return fromBase64(input.toString(\"base64\"));\n }\n return fromBase64(new Buffer(input, encoding).toString(\"base64\"));\n}", "function sha256_encode_bytes() {\n var j = 0;\n var output = new Array(32);\n for (var i = 0; i < 8; i++) {\n output[j++] = ((ihash[i] >>> 24) & 0xff);\n output[j++] = ((ihash[i] >>> 16) & 0xff);\n output[j++] = ((ihash[i] >>> 8) & 0xff);\n output[j++] = (ihash[i] & 0xff);\n }\n return output;\n}", "function encode(str) {\n // バイナリイメージでbtoaにかける\n const binUi8a = unescape(encodeURIComponent(str));\n\n return btoa(binUi8a);\n }", "function base64UrlEncode(input) {\n var str = String (input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n // str.charAt (idx | 0) || (map = '=', idx % 1);\n str.charAt (idx | 0);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt (63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt (idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError (\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n }", "function simpleWrite(buf){return buf.toString(this.encoding)}", "function utf7EncoderWrite(str) {\n // Naive implementation.\n // Non-direct chars are encoded as \"+<base64>-\"; single \"+\" char is encoded as \"+-\".\n return new Buffer(str.replace(nonDirectChars, function(chunk) {\n return \"+\" + (chunk === '+' ? '' : \n this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) \n + \"-\";\n }.bind(this)));\n}", "function encode(string){\n\n}", "function encodeB(string, startCode) {\n\t\tvar result = \"\";\n\t\tvar sum = 0;\n\n\t\tfor (var i = 0, j = string.length; i < j; i++) {\n\t\t\tresult += encodingByChar(string[i]);\n\t\t\tsum += weightByCharacter(string[i]) * (i + 1);\n\t\t}\n\t\treturn {\n\t\t\tresult: result,\n\t\t\tchecksum: (sum + startCode) % 103\n\t\t}\n\t}", "function bufferToString(buffer) {\n return String.fromCharCode.apply(null, new Uint8Array(buffer));\n}", "function btoa(input) {\n var str = String (input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt (idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt (63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt (idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError (\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");\n }\n block = block << 8 | charCode;\n }\n return output;\n }", "function ab2str(buf) {\n return String.fromCharCode.apply(null, new Uint8Array(buf));\n}", "function ab2str(buf) {\n return String.fromCharCode.apply(null, new Uint8Array(buf));\n}", "function encode_chunk( hash, offset ) {\n /* Converts 40 bits at once. */\n let chunk = hash[ offset ] * Math.pow( 2, 32 );\n chunk += hash[ offset + 1 ] * Math.pow( 2, 24 );\n chunk += hash[ offset + 2 ] * Math.pow( 2, 16 );\n chunk += hash[ offset + 3 ] * Math.pow( 2, 8 );\n chunk += hash[ offset + 4 ];\n\n /* Limit to a maximum of 99,999. */\n chunk %= 100000;\n\n /* Convert this to a string. */\n let s = chunk.toString();\n\n /* Left-pad with zeros if less than 5 characters. */\n while ( s.length < 5 )\n s = `0${s}`;\n\n return s;\n }", "function ab2str(buf) {\n return String.fromCharCode.apply(null, new Uint8Array(buf));\n}", "function ab2str(buf) {\n return String.fromCharCode.apply(null, new Uint8Array(buf));\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n return forge.util.hexToBytes(hex);\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n return forge.util.hexToBytes(hex);\n}", "function toBinStr_old(bits){\n\t\tvar data = '';\n\t\tvar pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\n\t\tbits = pad + bits;\n\t\tfor(var i = 0; i < bits.length; i+= 8){\n\t\t\tdata += String.fromCharCode(parseInt(bits.substr(i,8),2))\n\t\t}\n\t\treturn data;\n\t}", "function flatEscape(buffer) {\n // Escape high and low bytes 0x00 and 0xff (and by necessity, 0x01 and 0xfe)\n var b, bytes = [];\n for (var i = 0, end = buffer.length; i < end; ++i) {\n b = buffer[i];\n // Escape low bytes with 0x01 and by adding 1\n if (b === 0x01 || b === 0x00) bytes.push(0x01, b + 1);\n // Escape high bytes with 0xfe and by subtracting 1\n else if (b === 0xfe || b === 0xff) bytes.push(0xfe, b - 1);\n // Otherwise no escapement needed\n else bytes.push(b);\n }\n // Add end byte\n bytes.push(0);\n return bops.from(bytes);\n}", "function multihash (buf) {\n var hash = crypto.createHash('sha256').update(buf).digest()\n var multihash = multihashes.encode(hash, 'sha2-256')\n\n return multihashes.toB58String(multihash)\n}" ]
[ "0.7658369", "0.7200657", "0.70704764", "0.6996845", "0.6938743", "0.6932482", "0.68172807", "0.6767494", "0.6751692", "0.67067915", "0.670423", "0.6684465", "0.6655286", "0.65639096", "0.6387093", "0.630735", "0.62225014", "0.6030916", "0.6015538", "0.6015538", "0.6015538", "0.6015538", "0.6015538", "0.6015538", "0.6015538", "0.6015538", "0.6015137", "0.6015137", "0.6015137", "0.5999212", "0.5970544", "0.5917412", "0.5913044", "0.58243656", "0.57894087", "0.5735562", "0.5718183", "0.57153875", "0.5694641", "0.56711996", "0.5663047", "0.5663047", "0.5662839", "0.5662839", "0.5662839", "0.5662558", "0.5659636", "0.5652719", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5647121", "0.5646261", "0.56312686", "0.5617126", "0.5602203", "0.5591388", "0.55757815", "0.55716777", "0.5552199", "0.55136615", "0.55119884", "0.54963326", "0.54932237", "0.54889375", "0.54757", "0.5466356", "0.54545933", "0.54545933", "0.54542077", "0.54526526", "0.5448952", "0.54481584", "0.54448956", "0.54370344", "0.5435827", "0.5425316", "0.54213184", "0.54115283", "0.5401086", "0.5401086", "0.539773", "0.5397238", "0.5397238", "0.53932375", "0.53932375", "0.5387388", "0.537967", "0.53752244" ]
0.6869967
11