Best JavaScript code snippet using puppeteer
index.js
Source:index.js
1import React, { useState, useEffect } from 'react'2import { useHistory, useRouteMatch } from 'react-router-dom'3import QRCode from 'qrcode.react'4// redux5import { useStore, useSelector } from 'react-redux'6import { gameList } from '@/store/actions/game'7import { getGame } from '@/store/reducers/game'8import Loading from '@/components/Ui/Loading'9import Shell from '@/components/Shell'10import Meta from '@/components/Meta'11import { isMobile, formatPic } from '@/utils'12import './style.scss'13const Game = () => {14 const [showGame, onShowGame] = useState(false)15 const [show, onShow] = useState(false)16 const history = useHistory()17 const {18 params: { wd }19 } = useRouteMatch()20 const store = useStore()21 const info = useSelector(state => getGame(state))22 useEffect(() => {23 const getData = args => gameList(args)(store.dispatch, store.getState)24 if (wd) {25 onShowGame(true)26 }27 if (!info.data) {28 getData()29 }30 }, [info.data, store.dispatch, store.getState, wd])31 const getPic = data => {32 const piclist = data ? (33 data.map((item, i) => {34 if (item.indexOf('banner') === -1) {35 return (36 <li key={`game-img-${i}`}>37 <img src={formatPic(item)} />38 </li>39 )40 }41 })42 ) : (43 <Loading />44 )45 return piclist46 }47 const game = name => {48 if (wd) {49 history.push('/game')50 } else {51 history.push(`/game/${name}`)52 }53 }54 const gameShowlist = (data = []) => {55 const renderList = data ? (56 data.map((item, i) => {57 if (item.downloadUrl.android.indexOf('http') !== -1 || item.downloadUrl.ios.indexOf('http') !== -1) {58 return (59 <li key={`game-list-${i}`} onClick={() => game(item.name)}>60 <img src={formatPic(item.icon)} />61 <p>{item.name}</p>62 <div>63 {item.downloadUrl.android.indexOf('http') !== -1 ? (64 isMobile() ? (65 <a className='an' href={item.downloadUrl.android}>66 å®å67 </a>68 ) : (69 <span className='qrcode'>70 <a className='an' href={item.downloadUrl.android}>71 å®å72 </a>73 <span className='an'>74 <i />75 <QRCode value={item.downloadUrl.android} />76 <p>å®åç¨æ·æ«æä¸è½½</p>77 </span>78 </span>79 )80 ) : null}81 {item.downloadUrl.ios.indexOf('http') !== -1 ? (82 isMobile() ? (83 <a className='ios' href={item.downloadUrl.android}>84 è¹æ85 </a>86 ) : (87 <span className='qrcode'>88 <a className='ios' href={item.downloadUrl.ios}>89 è¹æ90 </a>91 <span className='ios'>92 <i />93 <QRCode value={item.downloadUrl.ios} />94 <p>è¹æç¨æ·æ«æä¸è½½</p>95 </span>96 </span>97 )98 ) : null}99 </div>100 </li>101 )102 }103 })104 ) : (105 <Loading />106 )107 return renderList108 }109 const findGame = (data, name) => {110 return name ? data.filter(item => item.name === name)[0] : null111 }112 const { data = [], loading } = info113 const dataInfo = findGame(data, wd) || null114 const { shortDesc, name } = dataInfo || {}115 if (loading) return <Loading />116 return (117 <>118 {wd ? (119 <Meta title={`${name}_${name}å®åIOSä¸è½½`}>120 <meta name='keywords' content={`${name},${name}å®åä¸è½½,${name}IOSä¸è½½`} />121 <meta name='description' content={shortDesc} />122 </Meta>123 ) : (124 <Meta title='游æå表_å®åIOS游æä¸è½½'>125 <meta name='keywords' content='游æå表,ææºæ¸¸æä¸è½½,å®å游æä¸è½½,IOS游æä¸è½½' />126 <meta name='description' content='æä¾å®ååIOS游æä¸è½½' />127 </Meta>128 )}129 {loading ? <Loading /> : null}130 <div className='wp'>131 {wd ? null : <ul className='gamelist clearfix'>{gameShowlist(data)}</ul>}132 {dataInfo && (133 <div className='gameinfo' style={{ display: showGame ? 'block' : 'none' }}>134 <span className='safari-close closeA' onClick={game} />135 <div className='info clearfix'>136 <img src={formatPic(dataInfo.icon)} />137 <div className='type'>138 <h1>{dataInfo.name}</h1>139 {dataInfo.shortDesc ? <p>{dataInfo.shortDesc}</p> : ''}140 {dataInfo.Type ? <p>ç±»åï¼{dataInfo.Type}</p> : ''}141 </div>142 <div className='down'>143 {dataInfo.downloadUrl.android.indexOf('http') !== -1 ? (144 isMobile() ? (145 <a className='an' href={dataInfo.downloadUrl.android}>146 å®å <em className='version'>{dataInfo.Version.android}</em>147 <em>{dataInfo.size.android}MB</em>148 </a>149 ) : (150 <span className='qrcode'>151 <a className='an' href={dataInfo.downloadUrl.android}>152 å®å <em className='version'>{dataInfo.Version.android}</em>153 <em>{dataInfo.size.android}MB</em>154 </a>155 <span className='an'>156 <i />157 <QRCode value={dataInfo.downloadUrl.android} />158 <p>å®åç¨æ·æ«æä¸è½½</p>159 </span>160 </span>161 )162 ) : null}163 {dataInfo.downloadUrl.ios.indexOf('http') !== -1 ? (164 isMobile() ? (165 <a className='ios' href={dataInfo.downloadUrl.ios}>166 è¹æ <em className='version'>{dataInfo.Version.ios}</em>167 <em>{dataInfo.size.ios}MB</em>168 </a>169 ) : (170 <span className='qrcode'>171 <a className='ios' href={dataInfo.downloadUrl.ios}>172 è¹æ <em className='version'>{dataInfo.Version.ios}</em>173 <em>{dataInfo.size.ios}MB</em>174 </a>175 <span className='ios'>176 <i />177 <QRCode value={dataInfo.downloadUrl.ios} />178 <p>è¹æç¨æ·æ«æä¸è½½</p>179 </span>180 </span>181 )182 ) : null}183 </div>184 </div>185 <div className='summary'>{dataInfo.Description}</div>186 <div className='piclist'>187 <ul>{getPic(dataInfo.imgList)}</ul>188 </div>189 </div>190 )}191 <div className='mask' style={{ display: showGame ? 'block' : 'none' }} onClick={game} />192 <div className='safariDown' style={{ display: show ? 'block' : 'none' }}>193 <div className='join row'>194 <span className='join-left'>195 <a href='http://app.guopan.cn/?channelid=12633'>196 <img src='//cdn2.guopan.cn/frontend/m/static/img/join_e476d12.png' width='50' height='50' />197 </a>198 </span>199 <div className='join-middel col'>200 <p className='j-head'>æç游æ</p>201 <p className='j-desc'>ç©æ游æ´è½»æ¾</p>202 </div>203 <div className='join-right'>204 <a href='http://app.guopan.cn/?channelid=12633' className='j-link'>205 ç«å³ä¸è½½206 </a>207 </div>208 </div>209 <i className='safari-close' onClick={() => onShow(false)} />210 </div>211 </div>212 </>213 )214}215Game.loadDataOnServer = async ({ store, match, res, req, user }) => {216 if (user) return { code: 200 }217 await gameList()(store.dispatch, store.getState)218 return { code: 200 }219}...
docs.js
Source:docs.js
1import _ from 'underscore';2import { Docs } from '../imports/api/docs';3import { Meteor } from 'meteor/meteor';4 5export function upsertDrawing(profileID, downloadUrl, jobID){6 var selector = {jobID: jobID,7 fileType:'drawings'};8 var modifier = {$set: {9 downloadurl: downloadUrl,10 fileType:'drawings',11 userID: profileID12 }};13 if (Meteor.isServer) {14 var fileUpsert = Docs.upsert(selector, modifier);15 }16 return fileUpsert;17}18export function upsertManual(profileID, downloadUrl, jobID){19 var selector = {jobID: jobID,20 fileType:'manual'};21 var modifier = {$set: {22 downloadurl: downloadUrl,23 fileType:'manual',24 userID: profileID25 }};26 if (Meteor.isServer) {27 var fileUpsert = Docs.upsert(selector, modifier);28 }29 return fileUpsert;30}31export function upsertManualParts(profileID, downloadUrl, jobID){32 var selector = {jobID: jobID,33 fileType:'parts'};34 var modifier = {$set: {35 downloadurl: downloadUrl,36 fileType:'parts',37 userID: profileID38 }};39 if (Meteor.isServer) {40 var fileUpsert = Docs.upsert(selector, modifier);41 }42 return fileUpsert;43}44export function upsertSpecs(profileID, downloadUrl, jobID){45 var selector = {jobID: jobID,46 fileType:'specification'};47 var modifier = {$set: {48 downloadurl: downloadUrl,49 fileType:'specification',50 userID: profileID51 }};52 if (Meteor.isServer) {53 var fileUpsert = Docs.upsert(selector, modifier);54 }55 return fileUpsert;56}57export function upsertPage(profileID, downloadUrl, jobID, page){58 var pages = {};59 pages.userID = profileID;60 pages.downloadurl = downloadUrl;61 pages.jobID = jobID;62 pages.page = page;63 pages.fileType = 'page';64 65 if (Meteor.isServer) {66 var fileUpsert = Docs.insert(pages);67 }68 return fileUpsert;69}70export function upsertCvs(profileID, downloadUrl){71 var selector = {userID: profileID,72 fileType:'cv'};73 var modifier = {$set: {74 downloadurl: downloadUrl,75 fileType:'cv'76 }};77 if (Meteor.isServer) {78 var fileUpsert = Docs.upsert(selector, modifier);79 }80 return fileUpsert;81}82export function upsertPassports(profileID, downloadUrl){83 var selector = {userID: profileID,84 fileType:'passport'};85 var modifier = {$set: {86 downloadurl: downloadUrl,87 fileType:'passport'88 }};89 if (Meteor.isServer) {90 var fileUpsert = Docs.upsert(selector, modifier);91 }92 return fileUpsert;93}94export function upsertPhoto(profileID, downloadUrl){95 var selector = {userID: profileID,96 fileType:'photo'};97 var modifier = {$set: {98 downloadurl: downloadUrl,99 fileType:'photo'100 }};101 if (Meteor.isServer) {102 var fileUpsert = Docs.upsert(selector, modifier);103 }104 return fileUpsert;105}106export function upsertLicenses(profileID, downloadUrl, certType, expDate){107 var certs = {};108 certs.userID = profileID;109 certs.downloadurl = downloadUrl;110 certs.certType = certType;111 certs.expDate = expDate;112 certs.fileType = 'license';113 114 if (Meteor.isServer) {115 var fileUpsert = Docs.insert(certs);116 }117 return fileUpsert;118}119export function upsertMisc(profileID, downloadUrl, fileName, desc){120 var miscs = {};121 miscs.userID = profileID;122 miscs.downloadurl = downloadUrl;123 miscs.fileName = fileName;124 miscs.desc = desc;125 miscs.fileType = 'misc';126 127 if (Meteor.isServer) {128 var fileUpsert = Docs.insert(miscs);129 }130 return fileUpsert;131}132export function upsertService(profileID, downloadUrl, jobID, date){133 var services = {};134 services.userID = profileID;135 services.downloadurl = downloadUrl;136 services.jobID = jobID;137 services.date = date;138 services.fileType = 'service';139 140 if (Meteor.isServer) {141 var fileUpsert = Docs.insert(services);142 }143 return fileUpsert;144}145export function upsertYmpDrawing(profileID, downloadUrl, jobID){146 var selector = {jobID: jobID,147 fileType:'ympdrawings'};148 var modifier = {$set: {149 downloadurl: downloadUrl,150 fileType:'ympdrawings',151 userID: profileID152 }};153 if (Meteor.isServer) {154 var fileUpsert = Docs.upsert(selector, modifier);155 }156 return fileUpsert;157}158export function upsertYmpManual(profileID, downloadUrl, jobID){159 var selector = {jobID: jobID,160 fileType:'ympmanual'};161 var modifier = {$set: {162 downloadurl: downloadUrl,163 fileType:'ympmanual',164 userID: profileID165 }};166 if (Meteor.isServer) {167 var fileUpsert = Docs.upsert(selector, modifier);168 }169 return fileUpsert;170}171export function upsertYmpManualParts(profileID, downloadUrl, jobID){172 var selector = {jobID: jobID,173 fileType:'ympmanualparts'};174 var modifier = {$set: {175 downloadurl: downloadUrl,176 fileType:'ympmanualparts',177 userID: profileID178 }};179 if (Meteor.isServer) {180 var fileUpsert = Docs.upsert(selector, modifier);181 }182 return fileUpsert;183}184export function upsertYmpSpecs(profileID, downloadUrl, jobID){185 var selector = {jobID: jobID,186 fileType:'ympspecification'};187 var modifier = {$set: {188 downloadurl: downloadUrl,189 fileType:'ympspecification',190 userID: profileID191 }};192 if (Meteor.isServer) {193 var fileUpsert = Docs.upsert(selector, modifier);194 }195 return fileUpsert;196}197export function upsertYmpPage(profileID, downloadUrl, jobID, page){198 var pages = {};199 pages.userID = profileID;200 pages.downloadurl = downloadUrl;201 pages.jobID = jobID;202 pages.page = page;203 pages.fileType = 'ymppage';204 205 if (Meteor.isServer) {206 var fileUpsert = Docs.insert(pages);207 }208 return fileUpsert;209}210 211Meteor.methods({212 upsertDrawing,213 upsertManual,214 upsertManualParts,215 upsertSpecs,216 upsertPage,217 upsertCvs,218 upsertPassports,219 upsertPhoto,220 upsertLicenses,221 upsertMisc,222 upsertService,223 upsertYmpDrawing,224 upsertYmpManual,225 upsertYmpManualParts,226 upsertYmpSpecs,227 upsertYmpPage...
download.js
Source:download.js
1window.onload = function () {2 //ãã¡ã¤ã«ã®åç
§3 var storageRef = firebase.storage().ref();45 const DownloadTask1 = storageRef.child("uploaded01/3-2-1-ââ.jpg");6 const DownloadTask2 = storageRef.child("uploaded01/3-2-2-ââ.jpg");7 const DownloadTask3 = storageRef.child("uploaded01/3-2-3-ââ.jpg");8 const DownloadTask4 = storageRef.child("uploaded01/3-2-4-ââ.jpg");9 const DownloadTask5 = storageRef.child("uploaded01/3-2-5-ââ.jpg");10 const DownloadTask6 = storageRef.child("uploaded01/3-2-6-ââ.jpg");11 const DownloadTask7 = storageRef.child("uploaded01/3-2-7-ââ.jpg");12 const DownloadTask8 = storageRef.child("uploaded01/3-2-8-ââ.jpg");13 const DownloadTask9 = storageRef.child("uploaded01/3-2-9-ââ.jpg");14 const DownloadTask10 = storageRef.child("uploaded01/3-2-10-ââ.jpg");1516 //ç»åãã¼ã¿å¼ã³åºã17 DownloadTask1.getDownloadURL().then((downloadURL) => {18 document.getElementById("image1").src = downloadURL;19 });20 DownloadTask2.getDownloadURL().then((downloadURL) => {21 document.getElementById("image2").src = downloadURL;22 });23 DownloadTask3.getDownloadURL().then((downloadURL) => {24 document.getElementById("image3").src = downloadURL;25 });26 DownloadTask4.getDownloadURL().then((downloadURL) => {27 document.getElementById("image4").src = downloadURL;28 });29 DownloadTask5.getDownloadURL().then((downloadURL) => {30 document.getElementById("image5").src = downloadURL;31 });32 DownloadTask6.getDownloadURL().then((downloadURL) => {33 document.getElementById("image6").src = downloadURL;34 });35 DownloadTask7.getDownloadURL().then((downloadURL) => {36 document.getElementById("image7").src = downloadURL;37 });38 DownloadTask8.getDownloadURL().then((downloadURL) => {39 document.getElementById("image8").src = downloadURL;40 });41 DownloadTask9.getDownloadURL().then((downloadURL) => {42 document.getElementById("image9").src = downloadURL;43 });44 DownloadTask10.getDownloadURL().then((downloadURL) => {45 document.getElementById("image10").src = downloadURL;46 });4748 var nullURL = "http://127.0.0.1:8887/null" ;49 //ç»åãã¼ã¿ããªãå ´åã¯ç°è²ã®ç»åã表示50 if(document.getElementById("image1").src = nullURL){51 image1.src = "back.png";52 }53 if(document.getElementById("image2").src = nullURL){54 image2.src = "back.png";55 }56 if(document.getElementById("image3").src = nullURL){57 image3.src = "back.png";58 }59 if(document.getElementById("image4").src = nullURL){60 image4.src = "back.png";61 }62 if(document.getElementById("image5").src = nullURL){63 image5.src = "back.png";64 }65 if(document.getElementById("image6").src = nullURL){66 image6.src = "back.png";67 }68 if(document.getElementById("image7").src = nullURL){69 image7.src = "back.png";70 }71 if(document.getElementById("image8").src = nullURL){72 image8.src = "back.png";73 }74 if(document.getElementById("image9").src = nullURL){75 image9.src = "back.png";76 }77 if(document.getElementById("image10").src = nullURL){78 image10.src = "back.png";79 }8081 var reload =document.getElementById('reload');82 reload.addEventListener('click',function(){83 for(var i = 0; i<100; i++){84 setTimeout(function () {85 location.reload();86 }, 200);87 }88 89 });9091 var disreload =document.getElementById('stop');92 disreload.addEventListener('click',function(){93 preventDefault();94 });95/*96 window.addEventListener('load',function(){97 //200ããªç§ã§èªåãªãã¼ã98 setInterval('location.reload()',200);99 });100*/
...
model.js
Source:model.js
1/* global window */2import modelExtend from "dva-model-extend";3import { pathMatchRegexp } from "utils";4import { getOfferReportLists } from "api";5import { pageModel } from "utils/model";6export default modelExtend(pageModel, {7 namespace: "offerReport",8 state: {},9 subscriptions: {10 setup({ dispatch, history }) {11 history.listen(location => {12 if (pathMatchRegexp("/offerReport", location.pathname)) {13 const payload = location.query || { page: 1, pageSize: 10 };14 dispatch({15 type: "query",16 payload17 });18 }19 });20 }21 },22 effects: {23 *query({ payload = {} }, { call, put }) {24 const res = yield call(getOfferReportLists, payload);25 if (res.success) {26 yield put({27 type: "querySuccess",28 payload: {29 list: res.data,30 pagination: {31 current: Number(payload.page) || 1,32 pageSize: Number(payload.pageSize) || 10,33 total: res.data.total34 }35 }36 });37 }38 },39 *download({ payload }, { call, put }) {40 var downloadUrl = "/api/v1/reports/exportOfferManager?";41 var addFirstJoint = false;42 var advertiser = Object.getOwnPropertyDescriptor(payload, "advertiser");43 if (advertiser.value !== undefined) {44 downloadUrl = downloadUrl + "advertiser=" + advertiser.value;45 addFirstJoint = true;46 }47 var offerId = Object.getOwnPropertyDescriptor(payload, "offerId");48 if (offerId.value !== undefined) {49 if (addFirstJoint) {50 downloadUrl = downloadUrl + "&";51 addFirstJoint = false;52 }53 downloadUrl = downloadUrl + "offerId=" + offerId.value;54 addFirstJoint = true;55 }56 var advOfferId = Object.getOwnPropertyDescriptor(payload, "advOfferId");57 if (advOfferId.value !== undefined) {58 if (addFirstJoint) {59 downloadUrl = downloadUrl + "&";60 addFirstJoint = false;61 }62 downloadUrl = downloadUrl + "advOfferId=" + advOfferId.value;63 addFirstJoint = true;64 }65 var offerName = Object.getOwnPropertyDescriptor(payload, "offerName");66 if (offerName.value !== undefined) {67 if (addFirstJoint) {68 downloadUrl = downloadUrl + "&";69 addFirstJoint = false;70 }71 downloadUrl = downloadUrl + "offerName=" + offerName.value;72 addFirstJoint = true;73 }74 var offerType = Object.getOwnPropertyDescriptor(payload, "offerType");75 if (offerType.value !== undefined) {76 if (addFirstJoint) {77 downloadUrl = downloadUrl + "&";78 addFirstJoint = false;79 }80 downloadUrl = downloadUrl + "offerType=" + offerType.value;81 addFirstJoint = true;82 }83 var country = Object.getOwnPropertyDescriptor(payload, "country");84 if (country.value !== undefined) {85 if (addFirstJoint) {86 downloadUrl = downloadUrl + "&";87 addFirstJoint = false;88 }89 downloadUrl = downloadUrl + "country=" + country.value;90 addFirstJoint = true;91 }92 var carrier = Object.getOwnPropertyDescriptor(payload, "carrier");93 if (carrier.value !== undefined) {94 if (addFirstJoint) {95 downloadUrl = downloadUrl + "&";96 addFirstJoint = false;97 }98 downloadUrl = downloadUrl + "carrier=" + carrier.value;99 addFirstJoint = true;100 }101 var status = Object.getOwnPropertyDescriptor(payload, "status");102 if (status.value !== undefined) {103 if (addFirstJoint) {104 downloadUrl = downloadUrl + "&";105 addFirstJoint = false;106 }107 downloadUrl = downloadUrl + "status=" + status.value;108 addFirstJoint = true;109 }110 window.open(downloadUrl);111 }112 },113 reducers: {114 showModal(state, { payload }) {115 return { ...state, ...payload, modalVisible: true };116 },117 hideModal(state) {118 return { ...state, modalVisible: false };119 }120 }...
config.js
Source:config.js
1// built in list of tag colors2const tagMap = {3 blue: '#3578ba',4 green: '#7aba5d',5 yellow: '#edd648',6 orange: '#f1a340',7 red: '#d9634f',8 purple: '#b87cda',9 aqua: '#5abfdc',10 gray: '#888888'11};12// list of ides and their protocols along with additional metadata13// used to open codemarks/reviews/foos with a selected IDE of choice14const ides = [15 {16 ideName: 'VS Code',17 protocol: 'vscode://codestream.codestream/',18 moniker: 'vsc',19 downloadUrl:20 'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream'21 },22 {23 ideName: 'VS Code Insiders',24 protocol: 'vscode-insiders://codestream.codestream/',25 moniker: 'vsc-insiders',26 downloadUrl:27 'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream'28 },29 {30 ideName: 'Visual Studio',31 protocol: 'codestream-vs://codestream/',32 moniker: 'vs',33 downloadUrl:34 'https://marketplace.visualstudio.com/items?itemName=CodeStream.codestream-vs'35 },36 {},37 {38 ideName: 'IntelliJ IDEA',39 protocol: 'jetbrains://idea/codestream/',40 moniker: 'jb-idea',41 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'42 },43 {44 ideName: 'PyCharm',45 protocol: 'jetbrains://pycharm/codestream/',46 moniker: 'jb-pycharm',47 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'48 },49 {50 ideName: 'WebStorm',51 protocol: 'jetbrains://web-storm/codestream/',52 moniker: 'jb-web-storm',53 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'54 },55 {56 ideName: 'PhpStorm',57 protocol: 'jetbrains://php-storm/codestream/',58 moniker: 'jb-phpstorm',59 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'60 },61 {62 ideName: 'RubyMine',63 protocol: 'jetbrains://rubymine/codestream/',64 moniker: 'jb-rubymine',65 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'66 },67 {68 ideName: 'Rider',69 protocol: 'jetbrains://rd/codestream/',70 moniker: 'jb-rider',71 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'72 },73 {74 ideName: 'CLion',75 protocol: 'jetbrains://clion/codestream/',76 moniker: 'jb-clion',77 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'78 },79 {80 ideName: 'GoLand',81 protocol: 'jetbrains://goland/codestream/',82 moniker: 'jb-goland',83 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'84 },85 {86 ideName: 'DataGrip',87 protocol: 'jetbrains://datagrip/codestream/',88 moniker: 'jb-datagrip',89 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'90 },91 {92 ideName: 'AppCode',93 protocol: 'jetbrains://appcode/codestream/',94 moniker: 'jb-appcode',95 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'96 },97 {98 ideName: 'Android Studio',99 protocol: 'jetbrains://studio/codestream/',100 moniker: 'jb-studio',101 downloadUrl: 'https://plugins.jetbrains.com/plugin/12206-codestream'102 },103 {},104 /*105 {106 ideName: 'Atom',107 protocol: 'atom://codestream/',108 moniker: 'atom',109 downloadUrl: 'https://atom.io/packages/codestream'110 }111 */112];113const lastOriginToIdeMonikers = {114 'Atom': 'atom',115 'VS Code': 'vsc',116 'JetBrains': undefined,117 'VS': 'vs'118};119module.exports = {120 ides: ides,121 tagMap: tagMap,122 lastOriginToIdeMonikers: lastOriginToIdeMonikers,123 defaultCookieName: 'cs__ide-mru'...
app.js
Source:app.js
1angular.module('bootstrapDemoApp', ['ui.bootstrap', 'plunker'], function($httpProvider){2 FastClick.attach(document.body);3 delete $httpProvider.defaults.headers.common['X-Requested-With'];4});5function MainCtrl($scope, $http, $document, $modal, orderByFilter) {6 var url = "http://50.116.42.77:3001";7 //iFrame for downloading8 var $iframe = angular.element('<iframe>').css('display','none');9 $document.find('body').append($iframe);10 var downloadFileFromUrl = function(downloadUrl) {11 $iframe.attr('src', '');12 $iframe.attr('src', downloadUrl);13 };14 15 $scope.showBuildModal = function() {16 var modalInstance = $modal.open({17 templateUrl: 'buildModal.html',18 controller: 'SelectModulesCtrl',19 resolve: {20 modules: function() {21 return $http.get(url + "/api/bootstrap").then(function(response) {22 return response.data.modules;23 });24 }25 }26 });27 modalInstance.result.then(function(selectedModules) {28 var downloadUrl = url + "/api/bootstrap/download?";29 angular.forEach(selectedModules, function(module) {30 downloadUrl += "modules=" + module + "&";31 });32 downloadFileFromUrl(downloadUrl);33 });34 };35 36 $scope.showDownloadModal = function() {37 var modalInstance = $modal.open({38 templateUrl: 'downloadModal.html',39 controller: 'DownloadCtrl'40 });41 };42}43var SelectModulesCtrl = function($scope, $modalInstance, modules) {44 $scope.selectedModules = [];45 $scope.modules = modules;46 $scope.selectedChanged = function(module, selected) {47 if (selected) {48 $scope.selectedModules.push(module);49 } else {50 $scope.selectedModules.splice($scope.selectedModules.indexOf(module), 1);51 }52 };53 $scope.downloadBuild = function () {54 $modalInstance.close($scope.selectedModules);55 };56 $scope.cancel = function () {57 $modalInstance.dismiss();58 };59};60var DownloadCtrl = function($scope, $modalInstance) {61 $scope.options = {62 minified: true,63 tpls: true64 };65 66 $scope.download = function (version) {67 var options = $scope.options;68 var downloadUrl = ['ui-bootstrap-'];69 if (options.tpls) {70 downloadUrl.push('tpls-');71 }72 downloadUrl.push(version);73 if (options.minified) {74 downloadUrl.push('.min');75 }76 downloadUrl.push('.js');77 return downloadUrl.join('');78 };79 80 $scope.cancel = function () {81 $modalInstance.dismiss();82 };...
streamtape.js
Source:streamtape.js
1function doGetPixelList() {2 var queryPixel = "720P,1080P,480P";3 try {4 queryPixel = queryPixelsFunction();5 } catch (err) {6 //Nothing to do7 }8 if (null == queryPixel) {9 queryPixel = "720P,1080P,480P";10 }11 var pixelList = queryPixel.split(',');12 if ((pixelList == null) || (pixelList.length == 0)) {13 pixelList = queryPixel.split("720P,1080P,480P");14 }15 16 return pixelList;17}18function buildUrlMap(downloadUrl)19{20 var urlMap = new Object();21 22 var pixelList = doGetPixelList();23 24 for (var i = 0; i < pixelList.length; i++) {25 urlMap[pixelList[i]] = downloadUrl;26 }27 28 urlMap[""] = downloadUrl;29 urlMap[" "] = downloadUrl;30 31 return urlMap; 32}33function internalCreateError() {34 var result = new Object();35 result.errorMessage = 'Video is not available.';36 result.shouldRetry = false;37 return (result);38}39function doAnalyseDownloadUrl() {40 var documentTitle = document.title.toLowerCase();41 if ((documentTitle.indexOf('not') > -1) && (documentTitle.indexOf('found') > -1)) {42 return internalCreateError();43 }44 var downloadElement = document.querySelector('div[id$=link]');45 if (null == downloadElement) {46 return internalCreateError();47 }48 var downloadUrl = downloadElement.textContent;49 var index = downloadUrl.length - 71;50 downloadUrl = downloadUrl.substring(index);51 var firstChar = downloadUrl.substring(0, 1);52 if (firstChar != '=') {53 downloadUrl = '=' + downloadUrl;54 }55 downloadUrl = 'https://streamtape.com/get_video?id' + downloadUrl;56 downloadUrl = downloadUrl + '&stream=1';57 var result = new Object();58 var urlMap=buildUrlMap(downloadUrl);59 60 result.urlMap = urlMap;61 result.shouldRetry = false;62 return (result);63}...
When_I_download_the_X_file_by_going_to_URL_X.js
Source:When_I_download_the_X_file_by_going_to_URL_X.js
1const { When } = require('cucumber');2When(/^I download the (XLS|PDF) file by going to URL "([^"]*)"$/, {timeout: 60*1000 * 2}, function (fileType, downloadUrl) {3 // delete previous download file4 var fileName = decodeURI(downloadUrl.substring(downloadUrl.lastIndexOf('/') + 1, downloadUrl.lastIndexOf('.')));5 var fileExt = decodeURI(downloadUrl.substring(downloadUrl.lastIndexOf('.') + 1));6 this.fs_session.deleteDownloadFile(fileName, fileExt);7 // download file from URL8 browser.url(downloadUrl)9 var downloadFilePath = this.fs_session.checkDownloadFile(fileName, fileExt);10 expect(downloadFilePath).toContain(fileName + '.' + fileExt);11 // pass download Url for steps after12 this.downloadUrl = downloadUrl;...
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.screenshot({ path: 'google.png' });7 await page.pdf({ path: 'google.pdf', format: 'A4' });8 await page.pdf({ path: 'google-landscape.pdf', format: 'A4', landscape: true });9 const [response] = await Promise.all([10 page.waitForNavigation(),11 ]);12 const buffer = await response.buffer();13 fs.writeFileSync('./logo.png', buffer);14 await browser.close();15})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: 'example.png' });6 await browser.close();7})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.screenshot({path: 'google.png'});7 await page.pdf({path: 'google.pdf', format: 'A4'});8 await browser.close();9})();10const puppeteer = require('puppeteer');11const fs = require('fs');12(async () => {13 const browser = await puppeteer.launch();14 const page = await browser.newPage();15 await page.screenshot({path: 'google.png'});16 await page.pdf({path: 'google.pdf', format: 'A4'});17 await browser.close();18})();19const puppeteer = require('puppeteer');20const fs = require('fs');21(async () => {22 const browser = await puppeteer.launch();23 const page = await browser.newPage();24 await page.screenshot({path: 'google.png'});25 await page.pdf({path: 'google.pdf', format: 'A4'});26 await browser.close();27})();28const puppeteer = require('puppeteer');29const fs = require('fs');30(async () => {31 const browser = await puppeteer.launch();32 const page = await browser.newPage();33 await page.screenshot({path: 'google.png'});34 await page.pdf({path: 'google.pdf', format: 'A4'});35 await browser.close();36})();37const puppeteer = require('puppeteer');38const fs = require('fs');39(async () => {40 const browser = await puppeteer.launch();41 const page = await browser.newPage();
Using AI Code Generation
1(async () => {2 const browser = await puppeteer.launch();3 const page = await browser.newPage();4 await page.screenshot({path: 'google.png'});5 await browser.close();6})();7(async () => {8 const browser = await puppeteer.launch();9 const page = await browser.newPage();10 await page.screenshot({path: 'google.png'});11 await browser.close();12})();13(async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 await page.screenshot({path: 'google.png'});17 await browser.close();18})();19(async () => {20 const browser = await puppeteer.launch();21 const page = await browser.newPage();22 await page.screenshot({path: 'google.png'});23 await browser.close();24})();25(async () => {26 const browser = await puppeteer.launch();27 const page = await browser.newPage();28 await page.screenshot({path: 'google.png'});29 await browser.close();30})();31(async () => {32 const browser = await puppeteer.launch();33 const page = await browser.newPage();34 await page.screenshot({path: 'google.png'});35 await browser.close();36})();37(async () => {38 const browser = await puppeteer.launch();39 const page = await browser.newPage();40 await page.screenshot({path: 'google.png'});41 await browser.close();42})();43(async () => {44 const browser = await puppeteer.launch();45 const page = await browser.newPage();
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 try {5 const browser = await puppeteer.launch({ headless: false });6 const page = await browser.newPage();7 await page.screenshot({ path: 'google.png' });8 const image = await page.$('img');9 const src = await image.getProperty('src');10 const srcTxt = await src.jsonValue();11 await page.goto(srcTxt);12 await page.waitFor(5000);13 await page.screenshot({ path: 'google2.png' });14 await browser.close();15 } catch (error) {16 console.log('error:', error);17 }18})();19const puppeteer = require('puppeteer');20const fs = require('fs');21(async () => {22 try {23 const browser = await puppeteer.launch({ headless: false });24 const page = await browser.newPage();25 await page.screenshot({ path: 'google.png' });26 const image = await page.$('img');27 const src = await image.getProperty('src');28 const srcTxt = await src.jsonValue();29 const viewSource = await page.goto(srcTxt);30 const buffer = await viewSource.buffer();31 fs.writeFileSync('google2.png', buffer);32 await browser.close();33 } catch (error) {34 console.log('error:', error);35 }36})();37const puppeteer = require('puppeteer');38const fs = require('fs');39(async () => {40 try {41 const browser = await puppeteer.launch({ headless: false });42 const page = await browser.newPage();43 await page.screenshot({ path: 'google.png' });44 const image = await page.$('img');45 const src = await image.getProperty('src');46 const srcTxt = await src.jsonValue();47 const viewSource = await page.goto(srcTxt);48 const buffer = await viewSource.buffer();49 fs.writeFileSync('google2.png', buffer);
Using AI Code Generation
1const puppeteer = require('puppeteer');2(async () => {3const browser = await puppeteer.launch();4const page = await browser.newPage();5await page.waitFor(2000);6await page.pdf({path: 'example.pdf', format: 'A4'});7await browser.close();8})();9const puppeteer = require('puppeteer');10(async () => {11const browser = await puppeteer.launch();12const page = await browser.newPage();13await page.waitFor(2000);14await page.pdf({path: 'example.pdf', format: 'A4'});15await browser.close();16})();17const puppeteer = require('puppeteer');18(async () => {19const browser = await puppeteer.launch();20const page = await browser.newPage();21await page.waitFor(2000);22await page.pdf({path: 'example.pdf', format: 'A4'});23await browser.close();24})();25const puppeteer = require('puppeteer');26(async () => {27const browser = await puppeteer.launch();28const page = await browser.newPage();29await page.waitFor(2000);30await page.pdf({path: 'example.pdf', format: 'A4'});31await browser.close();32})();33const puppeteer = require('puppeteer');34(async () => {35const browser = await puppeteer.launch();36const page = await browser.newPage();37await page.waitFor(2000);38await page.pdf({path: 'example.pdf', format: 'A4'});
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!!