Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static getChromeDownloadDirectory() {
// .meteor/chimp_config.js configures chrome download dir relative to cwd()
let chimpopts = require ('../../../.meteor/chimp_config');
let downloadDir = chimpopts.webdriverio.desiredCapabilities.chromeOptions.prefs["download.default_directory"];
expect(downloadDir, ".meteor/chimp_config.js must specify download.default_directory").to.be.ok;
downloadDir = process.cwd() + "/" + downloadDir;
return downloadDir;
}
if (this._event.properties.products.shakemap) {
var contourLayer = null,
shakemap = this._event.properties.products.shakemap[0],
shakemapContents = shakemap.contents;
if ('download/cont_mi.json' in shakemapContents) {
this._contourLayer = contourLayer = new ContoursLayer({
url: shakemapContents['download/cont_mi.json'].url
});
layerControl.addOverlay(contourLayer, 'ShakeMap MMI Contours');
contourLayer.addTo(map);
}
if ('download/stationlist.json' in shakemapContents) {
this._stationLayer = new ShakeMapStationLayer(
shakemapContents['download/stationlist.json'].url);
layerControl.addOverlay(this._stationLayer, 'ShakeMap Stations');
}
}
}
// Add Map Controls
if (!Util.isMobile()) {
map.addControl(new MousePosition());
map.addControl(new L.Control.Scale({'position':'bottomleft'}));
}
map.addControl(layerControl);
this._content.appendChild(_el);
this._content.appendChild(this._closeButton);
};
getStations (product: any): void {
if ((product == null) ||
(!product.contents['download/stationlist.json'])) {
this.stationsJson$.next(null);
return;
}
const stations = product.contents['download/stationlist.json'];
this.httpClient.get(stations.url).pipe(
catchError(this.handleError())
).subscribe((response) => {
try {
this.onStations(response);
} catch (e) {
/* Processing errored */
this.error = e;
this.stationsJson$.next(null);
}
});
}
getStations (product: any): void {
if ((product == null) ||
(!product.contents['download/stationlist.json'])) {
this.stationsJson$.next(null);
return;
}
const stations = product.contents['download/stationlist.json'];
this.httpClient.get(stations.url).pipe(
catchError(this.handleError())
).subscribe((response) => {
try {
this.onStations(response);
} catch (e) {
/* Processing errored */
this.error = e;
this.stationsJson$.next(null);
this._dyfiLayer = new DYFIUTMLayer({
url: dyfiContents['dyfi_geo.geojson'].url
});
layerControl.addOverlay(this._dyfiLayer, 'DYFI Responses');
}
}
// Adds shake map contours data to map
if (this._event.properties.products.shakemap) {
var contourLayer = null,
shakemap = this._event.properties.products.shakemap[0],
shakemapContents = shakemap.contents;
if ('download/cont_mi.json' in shakemapContents) {
this._contourLayer = contourLayer = new ContoursLayer({
url: shakemapContents['download/cont_mi.json'].url
});
layerControl.addOverlay(contourLayer, 'ShakeMap MMI Contours');
contourLayer.addTo(map);
}
if ('download/stationlist.json' in shakemapContents) {
this._stationLayer = new ShakeMapStationLayer(
shakemapContents['download/stationlist.json'].url);
layerControl.addOverlay(this._stationLayer, 'ShakeMap Stations');
}
}
}
// Add Map Controls
if (!Util.isMobile()) {
map.addControl(new MousePosition());
getMetadata(product: any): void {
if (product === null || !product.contents['download/info.json']) {
this.onMetadata(null);
return;
}
const metadata = product.contents['download/info.json'];
this.httpClient
.get(metadata.url)
.pipe(catchError(this.handleError()))
.subscribe((data: any) => {
try {
this.onMetadata(data);
} catch (e) {
/* Processing error */
this.error = e;
this.metadata$.next(null);
}
});
}
getMetadata(product: any): void {
if (product === null || !product.contents['download/info.json']) {
this.onMetadata(null);
return;
}
const metadata = product.contents['download/info.json'];
this.httpClient
.get(metadata.url)
.pipe(catchError(this.handleError()))
.subscribe((data: any) => {
try {
this.onMetadata(data);
} catch (e) {
/* Processing error */
this.error = e;
this.metadata$.next(null);
async init() {
Logger.info(`${magenta('[DOWNLOADING]')} Figure Map`)
const url = `${flashImagesURL}/gordon/${PRODUCTION}/figuremap.xml`
const figureMap = await Download(url, undefined, { encoding: 'utf8' })
Logger.info(`${magenta('[DOWNLOADING]')}${green('[DONE]')} Figure Map`)
const swfs = await this.parser.parseFigureMap(figureMap)
if (swfs.length > 0) {
const data = await this.extractSWFs(swfs)
await Promise.all(data.map(async data => {
const { name } = data
Logger.info(`${cyanBright('[GENERATING]')}${red('[IMAGES]')} ${name}`)
const { metaData, paths } = await this.generator.generateImages(data)
Logger.info(`${cyanBright('[GENERATING]')}${magentaBright('[METADATA]')} ${name}`)
const furni = furnis[furniId];
console.log(chalk`{blue [Downloading]} ${furni.name} (${furni.classname})`);
try {
await downloadFurni(furni);
} catch (err) {
console.log(chalk`{red [ERROR]} ${furni.name} (${furni.classname}) ${buildFurniUrl(furni.revision, furni.classname)}`);
}
writeFurni(furni);
console.log(chalk`{green [Done]} ${furni.name} (${furni.classname})`);
}
}
Download(Config.furniDataURL, path.join(__dirname, 'raw')).then(() => {
const xml = fs.readFileSync(path.join(__dirname, 'raw', 'furnidata.xml'));
const {roomitemtypes, wallitemtypes} = Parser.parse(xml.toString(), {
attributeNamePrefix : '',
ignoreAttributes: false,
parseAttributeValue: true
}).furnidata;
downloadSWFs(roomitemtypes.furnitype.filter(furni => !furni.classname.includes('*')));
downloadSWFs(wallitemtypes.furnitype);
});
function init(){
handlers['eprint.iacr.org'] = ePrintScraper;
handlers['arxiv.org'] = arxivScraper;
handlers["eccc.weizmann.ac.il"] = ecccScraper;
handlers['epubs.siam.org'] = siamScraper;
handlers['research.microsoft.com'] = msrScraper;
handlers['citeseerx.ist.psu.edu'] = citeseerxScraper;
handlers['ac.els-cdn.com'] = sciencedirectScraper;
handlers['www.sciencedirect.com'] = sciencedirectScraper;
handlers['download.springer.com'] = springerScraper;
handlers['link.springer.com'] = springerScraper;
handlers['delivery.acm.org'] = acmScraper;
handlers['proceedings.mlr.press'] = mlrScraper;
handlers['journals.aps.org'] = apsScraper;
}