Best JavaScript code snippet using stryker-parent
arjs-debugui.js
Source:arjs-debugui.js
1// @namespace2var ARjs = ARjs || {}3/**4 * Create an debug UI for an ARjs.Anchor5 * 6 * @param {ARjs.Anchor} arAnchor - the anchor to user7 */8ARjs.SessionDebugUI = function(arSession, tangoPointCloud){9 var trackingBackend = arSession.arContext.parameters.trackingBackend10 this.domElement = document.createElement('div')11 this.domElement.style.color = 'rgba(0,0,0,0.9)'12 this.domElement.style.backgroundColor = 'rgba(127,127,127,0.5)'13 this.domElement.style.display = 'inline-block'14 this.domElement.style.padding = '0.5em'15 this.domElement.style.margin = '0.5em'16 this.domElement.style.textAlign = 'left'17 //////////////////////////////////////////////////////////////////////////////18 // add title19 //////////////////////////////////////////////////////////////////////////////20 // var domElement = document.createElement('div')21 // domElement.style.display = 'block'22 // domElement.style.fontWeight = 'bold'23 // domElement.style.fontSize = '120%'24 // this.domElement.appendChild(domElement)25 // domElement.innerHTML = 'AR.js Session Debug'26 //////////////////////////////////////////////////////////////////////////////27 // current-tracking-backend28 //////////////////////////////////////////////////////////////////////////////29 var domElement = document.createElement('span')30 domElement.style.display = 'block'31 this.domElement.appendChild(domElement)32 domElement.innerHTML = '<b>trackingBackend</b> : ' +trackingBackend33 34 //////////////////////////////////////////////////////////////////////////////35 // augmented-websites36 //////////////////////////////////////////////////////////////////////////////37 if( ARjs.SessionDebugUI.AugmentedWebsiteURL ){38 var domElement = document.createElement('a')39 domElement.innerHTML = 'Share on augmented-websites'40 domElement.style.display = 'block'41 // domElement.setAttribute('target', '_blank')42 domElement.href = ARjs.SessionDebugUI.AugmentedWebsiteURL + '?'+location.href43 this.domElement.appendChild(domElement) 44 }45 //////////////////////////////////////////////////////////////////////////////46 // toggle-point-cloud47 //////////////////////////////////////////////////////////////////////////////48 if( trackingBackend === 'tango' && tangoPointCloud ){49 var domElement = document.createElement('button')50 this.domElement.appendChild(domElement)51 domElement.id= 'buttonTangoTogglePointCloud'52 domElement.innerHTML = 'toggle-point-cloud'53 domElement.href='javascript:void(0)'54 domElement.addEventListener('click', function(){55 var scene = arSession.parameters.scene56 // TODO how tangoPointCloud, get connected here ???57 // in arguments simply ?58 if( tangoPointCloud.object3d.parent ){59 scene.remove(tangoPointCloud.object3d)60 }else{61 scene.add(tangoPointCloud.object3d) 62 }63 })64 }65}66/**67 * Url of augmented-website service - if === '' then dont include augmented-website link68 * @type {String}69 */70ARjs.SessionDebugUI.AugmentedWebsiteURL = 'https://webxr.io/augmented-website'71//////////////////////////////////////////////////////////////////////////////72// ARjs.AnchorDebugUI73//////////////////////////////////////////////////////////////////////////////74/**75 * Create an debug UI for an ARjs.Anchor76 * 77 * @param {ARjs.Anchor} arAnchor - the anchor to user78 */79ARjs.AnchorDebugUI = function(arAnchor){80 var _this = this 81 var arSession = arAnchor.arSession82 var trackingBackend = arSession.arContext.parameters.trackingBackend83 84 this.domElement = document.createElement('div')85 this.domElement.style.color = 'rgba(0,0,0,0.9)'86 this.domElement.style.backgroundColor = 'rgba(127,127,127,0.5)'87 this.domElement.style.display = 'inline-block'88 this.domElement.style.padding = '0.5em'89 this.domElement.style.margin = '0.5em'90 this.domElement.style.textAlign = 'left'91 //////////////////////////////////////////////////////////////////////////////92 // add title93 //////////////////////////////////////////////////////////////////////////////94 // var domElement = document.createElement('div')95 // domElement.style.display = 'block'96 // domElement.style.fontWeight = 'bold'97 // domElement.style.fontSize = '120%'98 // this.domElement.appendChild(domElement)99 // domElement.innerHTML = 'Anchor Marker Debug'100 //////////////////////////////////////////////////////////////////////////////101 // current-tracking-backend102 //////////////////////////////////////////////////////////////////////////////103 var domElement = document.createElement('span')104 domElement.style.display = 'block'105 this.domElement.appendChild(domElement)106 domElement.innerHTML = '<b>markersAreaEnabled</b> :' +arAnchor.parameters.markersAreaEnabled107 //////////////////////////////////////////////////////////////////////////////108 // toggle-marker-helper109 //////////////////////////////////////////////////////////////////////////////110 if( arAnchor.parameters.markersAreaEnabled ){111 var domElement = document.createElement('button')112 domElement.style.display = 'block'113 this.domElement.appendChild(domElement)114 domElement.id= 'buttonToggleMarkerHelpers'115 domElement.innerHTML = 'toggle-marker-helper'116 domElement.href='javascript:void(0)'117 var subMarkerHelpersVisible = false118 domElement.addEventListener('click', function(){119 subMarkerHelpersVisible = subMarkerHelpersVisible ? false : true120 arAnchor.markersArea.setSubMarkersVisibility(subMarkerHelpersVisible) 121 })122 }123 124 //////////////////////////////////////////////////////////////////////////////125 // Learn-new-marker-area126 //////////////////////////////////////////////////////////////////////////////127 if( arAnchor.parameters.markersAreaEnabled ){128 var domElement = document.createElement('button')129 domElement.style.display = 'block'130 this.domElement.appendChild(domElement)131 domElement.id = 'buttonMarkersAreaLearner'132 domElement.innerHTML = 'Learn-new-marker-area'133 domElement.href ='javascript:void(0)'134 domElement.addEventListener('click', function(){135 if( ARjs.AnchorDebugUI.MarkersAreaLearnerURL !== null ){136 var learnerURL = ARjs.AnchorDebugUI.MarkersAreaLearnerURL137 }else{138 var learnerURL = ARjs.Context.baseURL + 'examples/multi-markers/examples/learner.html'139 }140 ARjs.MarkersAreaUtils.navigateToLearnerPage(learnerURL, trackingBackend)141 }) 142 }143 //////////////////////////////////////////////////////////////////////////////144 // Reset-marker-area145 //////////////////////////////////////////////////////////////////////////////146 if( arAnchor.parameters.markersAreaEnabled ){147 var domElement = document.createElement('button')148 domElement.style.display = 'block'149 this.domElement.appendChild(domElement)150 domElement.id = 'buttonMarkersAreaReset'151 domElement.innerHTML = 'Reset-marker-area'152 domElement.href ='javascript:void(0)'153 domElement.addEventListener('click', function(){154 ARjs.MarkersAreaUtils.storeDefaultMultiMarkerFile(trackingBackend)155 location.reload()156 })157 }158}159/**160 * url for the markers-area learner. if not set, take the default one161 * @type {String}162 */...
threex.webcamgrabbing.js
Source:threex.webcamgrabbing.js
1var THREEx = THREEx || {}2// shim3navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;4window.URL = window.URL || window.webkitURL;5/**6 * Grab camera7 * @constructor8 */9THREEx.WebcamGrabbing = function(){10 //////////////////////////////////////////////////////////////////////////////////11 // Comments12 //////////////////////////////////////////////////////////////////////////////////13 // create video element14 var domElement = document.createElement('video')15 domElement.setAttribute('autoplay', true)16 // window.domElement = video17 domElement.style.zIndex = -1;18 domElement.style.position = 'absolute'19 // domElement.style.top = '50%'20 // domElement.style.left = '50%'21 // domElement.style.marginRight = '50%'22 // domElement.style.transform = 'translate(-50%, -50%)'23 // domElement.style.minWidth = '100%'24 domElement.style.top = '0px'25 domElement.style.left = '0px'26 domElement.style.width = '100%'27 domElement.style.height = '100%'28 /**29 * Resize video element.30 * - Made complex to handle the aspect change31 * - it is frequently when the mobile is changing orientation32 * - after a search on the internet, it seems hard/impossible to prevent browser from changing orientation33 */34 function onResize(){35 // is the size of the video available ?36 if( domElement.videoHeight === 0 ) return37 var videoAspect = domElement.videoWidth / domElement.videoHeight38 var windowAspect = window.innerWidth / window.innerHeight39 // var video = document.querySelector('video')40// if( videoAspect < windowAspect ){41// domElement.style.left = '0%'42// domElement.style.width = window.innerWidth + 'px'43// domElement.style.marginLeft = '0px'44//45// domElement.style.top = '50%'46// domElement.style.height = (window.innerWidth/videoAspect) + 'px'47// domElement.style.marginTop = -(window.innerWidth/videoAspect) /2 + 'px'48// console.log('videoAspect <<<<< windowAspect')49// }else{50// domElement.style.top = '0%'51// domElement.style.height = window.innerHeight+'px'52// domElement.style.marginTop = '0px'53//54// domElement.style.left = '50%'55// domElement.style.width = (window.innerHeight*videoAspect) + 'px'56// domElement.style.marginLeft = -(window.innerHeight*videoAspect)/2 + 'px'57// console.log('videoAspect >>>> windowAspect')58// }59 }60 window.addEventListener('resize', function(event){61 onResize()62 })63 // just to be sure - resize on mobile is funky to say the least64 setInterval(function(){65 onResize()66 }, 500)67 // get the media sources68 MediaStreamTrack.getSources(function(sourceInfos) {69 // define getUserMedia() constraints70 var constraints = {71 video: true,72 audio: false,73 }74 // to mirror the video element when it isnt 'environment'75 // domElement.style.transform = 'scaleX(-1)'76 // it it finds the videoSource 'environment', modify constraints.video77 for (var i = 0; i != sourceInfos.length; ++i) {78 var sourceInfo = sourceInfos[i];79 if(sourceInfo.kind == "video" && sourceInfo.facing == "environment") {80 constraints.video = {81 optional: [{sourceId: sourceInfo.id}]82 }83 // not to mirror the video element when it is 'environment'84 // domElement.style.transform = ''85 }86 }87 // try to get user media88 navigator.getUserMedia( constraints, function(stream){89 domElement.src = URL.createObjectURL(stream);90 }, function(error) {91 console.error("Cant getUserMedia()! due to ", error);92 });93 });94 this.domElement = domElement...
dom.types.ts
Source:dom.types.ts
1import * as Handsontable from 'handsontable';2const domElement = new HTMLElement();3const domEvent = new Event('foo');4const htmlCharacters = Handsontable.dom.HTML_CHARACTERS;5Handsontable.dom.addEvent(domElement, "eventName", () => {});6Handsontable.dom.addClass(domElement, ['foo', 'bar']);7Handsontable.dom.addEvent(domElement, 'foo', () => {});8Handsontable.dom.closest(domElement, ['foo'], domElement);9Handsontable.dom.closestDown(domElement, ['foo', 'bar'], domElement);10Handsontable.dom.empty(domElement);11Handsontable.dom.fastInnerHTML(domElement, 'foo');12Handsontable.dom.fastInnerText(domElement, 'foo');13Handsontable.dom.getCaretPosition(domElement);14Handsontable.dom.getComputedStyle(domElement);15Handsontable.dom.getCssTransform(domElement);16Handsontable.dom.getParent(domElement, 1);17Handsontable.dom.getScrollLeft(domElement);18Handsontable.dom.getScrollTop(domElement);19Handsontable.dom.getScrollableElement(domElement);20Handsontable.dom.getScrollbarWidth();21Handsontable.dom.getSelectionEndPosition(domElement);22Handsontable.dom.getSelectionText();23Handsontable.dom.getStyle(domElement, 'foo');24Handsontable.dom.getTrimmingContainer(domElement);25Handsontable.dom.getWindowScrollLeft();26Handsontable.dom.getWindowScrollTop();27Handsontable.dom.hasClass(domElement, 'foo');28Handsontable.dom.hasHorizontalScrollbar(domElement);29Handsontable.dom.hasVerticalScrollbar(domElement);30Handsontable.dom.index(domElement);31Handsontable.dom.innerHeight(domElement);32Handsontable.dom.innerWidth(domElement);33Handsontable.dom.isChildOf(domElement, 'foo');34Handsontable.dom.isChildOfWebComponentTable(domElement);35Handsontable.dom.isImmediatePropagationStopped(domEvent);36Handsontable.dom.isInput(domElement);37Handsontable.dom.isLeftClick(domEvent);38Handsontable.dom.isOutsideInput(domElement);39Handsontable.dom.isRightClick(domEvent);40Handsontable.dom.isVisible(domElement);41Handsontable.dom.offset(domElement);42Handsontable.dom.outerHeight(domElement);43Handsontable.dom.outerWidth(domElement);44Handsontable.dom.overlayContainsElement('foo', domElement);45Handsontable.dom.pageX(domEvent);46Handsontable.dom.pageY(domEvent);47Handsontable.dom.polymerUnwrap(domElement);48Handsontable.dom.polymerWrap(domElement);49Handsontable.dom.removeClass(domElement, ['foo', 'bar']);50Handsontable.dom.removeEvent(domElement, 'foo', () => {});51Handsontable.dom.removeTextNodes(domElement, domElement);52Handsontable.dom.resetCssTransform(domElement);53Handsontable.dom.setCaretPosition(domElement, 0, 0);54Handsontable.dom.setOverlayPosition(domElement, 0, 0);55Handsontable.dom.stopImmediatePropagation(domEvent);...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!