hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
f6ec5368cc70ab32a292b58992fc1973f34f8c21
2,625
js
JavaScript
metadata-editor/app/gxe/types/inspire2/base/InspireDocumentType.js
arup-group/geoportal-server-catalog-1
b95a238c6ef21bf498ad027a1830ddd52de1d767
[ "Apache-2.0" ]
67
2016-05-09T07:24:26.000Z
2022-03-15T22:03:22.000Z
metadata-editor/app/gxe/types/inspire2/base/InspireDocumentType.js
arup-group/geoportal-server-catalog-1
b95a238c6ef21bf498ad027a1830ddd52de1d767
[ "Apache-2.0" ]
282
2016-05-18T05:41:33.000Z
2022-03-09T01:57:09.000Z
metadata-editor/app/gxe/types/inspire2/base/InspireDocumentType.js
arup-group/geoportal-server-catalog-1
b95a238c6ef21bf498ad027a1830ddd52de1d767
[ "Apache-2.0" ]
53
2016-06-04T06:06:53.000Z
2022-03-02T09:28:47.000Z
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/has", "dojo/dom-style", "esri/dijit/metadata/types/iso/base/IsoDocumentType", "./PortalItemTransformer", "dojo/i18n!../../../../nls/i18nInspire"], function(declare, lang, has, domStyle, DocumentType, PortalItemTransformer, i18nInspire) { var oThisClass = declare(DocumentType, { caption: null, key: null, isService: false, metadataStandardName: null, metadataStandardVersion: null, beforeInitializeAttribute: function(gxeDocument, attribute) { var p = attribute.gxePath; if(!this.isService && (p === "/gmd:MD_Metadata/gmd:hierarchyLevel/gmd:MD_ScopeCode/@codeListValue")) { attribute.optionsFilter = "dataset,series"; } else if(!this.isService && (p === "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:scope/gmd:DQ_Scope/gmd:level/gmd:MD_ScopeCode/@codeListValue")) { attribute.optionsFilter = "dataset,series"; } else { this.inherited(arguments); } }, beforeInitializeElement: function(gxeDocument, element) { var p = element.gxePath; if(p === "/gmd:MD_Metadata/gmd:contact/gmd:CI_ResponsibleParty/gmd:contactInfo/gmd:CI_Contact/gmd:address/gmd:CI_Address/gmd:electronicMailAddress") { element.minOccurs = 1; } else if(!this.isService && (p === "/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:identifier")) { element.minOccurs = 1; } else if(p === "/gmd:MD_Metadata/gmd:dataQualityInfo") { element.minOccurs = 1; } else if(p === "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:report") { element.minOccurs = 1; } else if(this.isService && (p === "/gmd:MD_Metadata/gmd:dataQualityInfo/gmd:DQ_DataQuality/gmd:lineage/gmd:LI_Lineage/gmd:statement")) { element.minOccurs = 0; } else { this.inherited(arguments); } }, newPortalItemTransformer: function(gxeDocument) { return new PortalItemTransformer(); }, initializeNamespaces: function() { this.addNamespace("gmd", "http://www.isotc211.org/2005/gmd"); this.addNamespace("gco", "http://www.isotc211.org/2005/gco"); this.addNamespace("srv", "http://www.isotc211.org/2005/srv"); this.addNamespace("gml","http://www.opengis.net/gml"); this.addNamespace("gmx","http://www.isotc211.org/2005/gmx"); this.addNamespace("xlink", "http://www.w3.org/1999/xlink"); this.addNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); }, }); return oThisClass; });
39.772727
168
0.657143
f6ec92056167e871bffcd8ee26e26f9a301add4a
4,917
js
JavaScript
MobileClient/components/SendPage.js
ramon54321/popcornproject
e03b6d6fe23a179d59ed386ca02e83dac7d44041
[ "MIT" ]
1
2018-01-25T17:08:22.000Z
2018-01-25T17:08:22.000Z
MobileClient/components/SendPage.js
ramon54321/popcornproject
e03b6d6fe23a179d59ed386ca02e83dac7d44041
[ "MIT" ]
1
2018-02-09T14:59:53.000Z
2018-02-09T14:59:53.000Z
MobileClient/components/SendPage.js
ramon54321/popcornproject
e03b6d6fe23a179d59ed386ca02e83dac7d44041
[ "MIT" ]
2
2018-01-25T17:09:54.000Z
2018-07-31T16:08:06.000Z
import React, { Component } from "react"; import { Text, View, TextInput, StyleSheet, Alert } from "react-native"; import Tabs from "./Tabs"; import Main from "./Main"; import { StackNavigator } from "react-navigation"; import { getTransactionByCode, confirmTransaction } from "../api"; import { connect } from "react-redux"; import actions from "../redux/actions"; class SendPage extends Component { constructor(props) { super(props); this.state = { values: [null, null, null, null], text: "", user: "", coins: "", hash: "" }; this.showAlert = this.showAlert.bind(this); } inputs = []; confirmRequest = async () => { const response = await confirmTransaction(this.state.hash); if (response.success) { this.setState({ text: "You sent brownies!", values: [null, null, null, null] }); } else { this.setState({ text: "Something went wrong!" }); } }; showAlert() { Alert.alert( "Confirmation window", `Do you want send ${this.state.coins}$ to ${this.state.user}`, [ { text: "Cancel", onPress: () => console.log("Cancel Pressed"), style: "cancel" }, { text: "OK", onPress: this.confirmRequest } ] ); } handleTextInputChange = (value, index) => { if (!value) return; const currentValues = [...this.state.values]; currentValues[index] = value; this.setState( { values: currentValues }, async () => { if (index !== 3) { this.inputs[index + 1].focus(); } else { this.inputs[index].blur(); console.log(currentValues); const code = currentValues.reduce((string, input) => { return string + input; }, ""); const response = await getTransactionByCode(code); console.log(response); if (response.request) { this.setState({ text: `Send ${response.request.amount}$ to ${ response.request.userid } `, user: response.request.userid, coins: response.request.amount, hash: code }); } else { this.setState({ text: `The code is wrong! ` }); } } } ); }; render() { return ( <View style={styles.mainView}> <Text style={styles.balance}>{`${this.props.balance} $`}</Text> <View style={styles.view1}> <View style={styles.inputContainer}> <TextInput editable={true} ref={ref => this.inputs.push(ref)} maxLength={1} onChangeText={code => this.handleTextInputChange(code, 0)} style={styles.input} value={this.state.values[0]} /> <TextInput editable={true} ref={ref => this.inputs.push(ref)} maxLength={1} onChangeText={code => this.handleTextInputChange(code, 1)} style={styles.input} value={this.state.values[1]} /> <TextInput editable={true} ref={ref => this.inputs.push(ref)} maxLength={1} onChangeText={code => this.handleTextInputChange(code, 2)} style={styles.input} value={this.state.values[2]} /> <TextInput editable={true} ref={ref => this.inputs.push(ref)} maxLength={1} onChangeText={code => this.handleTextInputChange(code, 3)} style={styles.input} value={this.state.values[3]} /> </View> <Text style={styles.text}>{this.state.text}</Text> </View> <Tabs names={["Back", "Confirm"]} pages={["Back", this.showAlert]} navigation={this.props.navigation} /> </View> ); } } const mapStateToProps = store => ({ user: store.user, balance: store.balance, requests: store.requests }); export default connect(mapStateToProps)(SendPage); const styles = StyleSheet.create({ text: { color: "#663300", fontSize: 35, fontWeight: "bold" }, view1: { flex: 1, justifyContent: "center", alignItems: "center" }, mainView: { flex: 1, flexDirection: "column", justifyContent: "space-between", alignItems: "center" }, balance: { color: "#663300", fontSize: 50, fontWeight: "bold", alignSelf: "flex-end" }, input: { borderColor: "#000000", borderWidth: 1, width: 70, height: 70, padding: 10, margin: 5, borderRadius: 4, fontSize: 50, textAlign: "center" }, inputContainer: { height: 80, flexDirection: "row" } });
25.609375
72
0.517389
f6ed0ee7ac23672deb3b772e1c0aa35106ec4e55
2,664
js
JavaScript
projects/mercury/src/layout/WorkspaceLayout.js
fairspace/workspace
a437131837882d7b5f1a698f0457d53cadd115a5
[ "Apache-2.0" ]
5
2021-10-30T23:09:09.000Z
2022-01-21T14:59:03.000Z
projects/mercury/src/layout/WorkspaceLayout.js
fairspace/workspace
a437131837882d7b5f1a698f0457d53cadd115a5
[ "Apache-2.0" ]
5
2021-09-08T09:48:24.000Z
2022-02-12T06:32:13.000Z
projects/mercury/src/layout/WorkspaceLayout.js
fairspace/workspace
a437131837882d7b5f1a698f0457d53cadd115a5
[ "Apache-2.0" ]
null
null
null
import React, {useContext} from 'react'; import {VocabularyProvider} from '../metadata/vocabulary/VocabularyContext'; import {CollectionsProvider} from '../collections/CollectionsContext'; import MainMenu from './MainMenu'; import {currentWorkspace} from '../workspaces/workspaces'; import WorkspaceRoutes from '../routes/WorkspaceRoutes'; import WorkspaceContext, {WorkspacesProvider} from "../workspaces/WorkspaceContext"; import {ServicesProvider} from '../common/contexts/ServicesContext'; import Layout from "./Layout"; import TopBar from "./TopBar"; import {UsersProvider} from "../users/UsersContext"; import {FeaturesProvider} from "../common/contexts/FeaturesContext"; import {MetadataViewProvider} from "../metadata/views/MetadataViewContext"; import {MetadataViewFacetsProvider} from "../metadata/views/MetadataViewFacetsContext"; import {ExternalStoragesProvider} from "../external-storage/ExternalStoragesContext"; import {StatusProvider} from "../status/StatusContext"; import type {Workspace} from "../workspaces/WorkspacesAPI"; const WorkspaceLayoutInner = () => { const {workspaces} = useContext(WorkspaceContext); const workspace: Workspace = currentWorkspace() && workspaces.find(w => w.iri === currentWorkspace()); const title = (workspace && workspace.code) || ''; return ( <StatusProvider> <UsersProvider> <VocabularyProvider> <CollectionsProvider> <ServicesProvider> <FeaturesProvider> <ExternalStoragesProvider> <MetadataViewFacetsProvider> <MetadataViewProvider> <Layout renderMenu={() => <MainMenu />} renderMain={() => <WorkspaceRoutes />} renderTopbar={() => <TopBar title={title} />} /> </MetadataViewProvider> </MetadataViewFacetsProvider> </ExternalStoragesProvider> </FeaturesProvider> </ServicesProvider> </CollectionsProvider> </VocabularyProvider> </UsersProvider> </StatusProvider> ); }; const WorkspaceLayout = () => ( <WorkspacesProvider> <WorkspaceLayoutInner /> </WorkspacesProvider> ); export default WorkspaceLayout;
45.152542
106
0.570946
f6ed26a8e145b5bb53ee3ca5384d2e71de33c9d0
1,933
js
JavaScript
lib/request.js
ndcolter-mcafee/opendxl-client-javascript
56b49cbe083be9040fc9375b3d5761c0e78d2a2c
[ "Apache-2.0" ]
2
2018-02-28T16:02:56.000Z
2018-03-14T17:17:40.000Z
lib/request.js
ndcolter-mcafee/opendxl-client-javascript
56b49cbe083be9040fc9375b3d5761c0e78d2a2c
[ "Apache-2.0" ]
2
2018-08-22T15:32:18.000Z
2018-09-07T23:27:52.000Z
lib/request.js
ndcolter-mcafee/opendxl-client-javascript
56b49cbe083be9040fc9375b3d5761c0e78d2a2c
[ "Apache-2.0" ]
7
2018-02-28T01:12:54.000Z
2019-10-29T20:16:30.000Z
'use strict' var inherits = require('inherits') var Message = require('./message') /** * @classdesc Request messages are sent using the {@link Client#asyncRequest} * method of a client instance. Request messages are used when invoking a * method on a remote service. This communication is one-to-one where a * client sends a request to a service instance and in turn receives a * response. * @param {String} destinationTopic - The topic to publish the event to. * @augments Message * @constructor */ function Request (destinationTopic) { Message.call(this, destinationTopic) this.messageType = Message.MESSAGE_TYPE_REQUEST /** * The topic that the {@link Response} to this request will be sent to. * @type {string} * @default '' * @name Request#replyToTopic */ this.replyToTopic = '' /** * The identifier of the service that this request will be routed to. If an * identifier is not specified, the initial broker that receives the request * will select the service to handle the request (round-robin by default). * @type {string} * @default '' * @name Request#serviceId */ this.serviceId = '' } inherits(Request, Message) /** * Pack bytes for this message onto the end of the supplied buffer. * @private * @param {BufferList} buffer - Buffer into which to pack the message bytes. */ Request.prototype._packMessage = function (buffer) { Message.prototype._packMessage.call(this, buffer) this._packObjects(buffer, [this.replyToTopic, this.serviceId]) } /** * Unpack bytes from the supplied buffer into member variables for this * object. * @private * @param {BufferList} buffer - Buffer to unpack message bytes from. */ Request.prototype._unpackMessage = function (buffer) { Message.prototype._unpackMessage.call(this, buffer) this.replyToTopic = this._unpackObject(buffer) this.serviceId = this._unpackObject(buffer) } module.exports = Request
31.177419
78
0.720641
f6eec8d67212ecd1f319957f66672585cf20e62a
2,665
js
JavaScript
components/common/WorldMap.js
kwstaskara/umami
86c76c98c50cbd3278041b0d50c6b5c0bcf1a805
[ "MIT" ]
2
2021-06-27T18:00:20.000Z
2021-06-28T03:18:03.000Z
components/common/WorldMap.js
kwstaskara/umami
86c76c98c50cbd3278041b0d50c6b5c0bcf1a805
[ "MIT" ]
null
null
null
components/common/WorldMap.js
kwstaskara/umami
86c76c98c50cbd3278041b0d50c6b5c0bcf1a805
[ "MIT" ]
null
null
null
import React, { useState, useMemo } from 'react'; import ReactTooltip from 'react-tooltip'; import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps'; import classNames from 'classnames'; import tinycolor from 'tinycolor2'; import useTheme from 'hooks/useTheme'; import { THEME_COLORS } from 'lib/constants'; import styles from './WorldMap.module.css'; const geoUrl = '/world-110m.json'; export default function WorldMap({ data, className }) { const [tooltip, setTooltip] = useState(); const [theme] = useTheme(); const colors = useMemo( () => ({ baseColor: THEME_COLORS[theme].primary, fillColor: THEME_COLORS[theme].gray100, strokeColor: THEME_COLORS[theme].primary, hoverColor: THEME_COLORS[theme].primary, }), [theme], ); function getFillColor(code) { if (code === 'AQ') return; const country = data?.find(({ x }) => x === code); if (!country) { return colors.fillColor; } return tinycolor(colors.baseColor)[theme === 'light' ? 'lighten' : 'darken']( 40 * (1.0 - country.z / 100), ); } function getOpacity(code) { return code === 'AQ' ? 0 : 1; } function handleHover({ ISO_A2: code, NAME: name }) { if (code === 'AQ') return; const country = data?.find(({ x }) => x === code); setTooltip(`${name}: ${country?.y || 0} visitors`); } return ( <div className={classNames(styles.container, className)} data-tip="" data-for="world-map-tooltip" > <ComposableMap projection="geoMercator"> <ZoomableGroup zoom={0.8} minZoom={0.7} center={[0, 40]}> <Geographies geography={geoUrl}> {({ geographies }) => { return geographies.map(geo => { const code = geo.properties.ISO_A2; return ( <Geography key={geo.rsmKey} geography={geo} fill={getFillColor(code)} stroke={colors.strokeColor} opacity={getOpacity(code)} style={{ default: { outline: 'none' }, hover: { outline: 'none', fill: colors.hoverColor }, pressed: { outline: 'none' }, }} onMouseOver={() => handleHover(geo.properties)} onMouseOut={() => setTooltip(null)} /> ); }); }} </Geographies> </ZoomableGroup> </ComposableMap> <ReactTooltip id="world-map-tooltip">{tooltip}</ReactTooltip> </div> ); }
30.988372
89
0.541088
f6ef560aa4c6445ca5fd884511462c7dc32ae55c
4,505
js
JavaScript
gulpfile.js
kseo05/wat-aspect
00b0b98ea2fe826b2d510e72eabd410df45c2fa4
[ "MIT" ]
null
null
null
gulpfile.js
kseo05/wat-aspect
00b0b98ea2fe826b2d510e72eabd410df45c2fa4
[ "MIT" ]
null
null
null
gulpfile.js
kseo05/wat-aspect
00b0b98ea2fe826b2d510e72eabd410df45c2fa4
[ "MIT" ]
null
null
null
/* global __dirname */ 'use strict'; var del = require('del'); var gulp = require('gulp'); var gulpBabel = require('gulp-babel'); var gulpConcat = require('gulp-concat'); var gulpJsdoc2md = require('gulp-jsdoc-to-markdown'); var gulpRename = require('gulp-rename'); var gulpShell = require('gulp-shell'); var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); var webpackDevServerConfig = require('./webpack.browser.devserver.config'); var path = require('path'); var paths = { src: [ 'src/watAspect.js', ], dist: [ 'dist/*', ], docs: { badges: './docs/badges.md', api: './docs/api.md', install: './docs/install.md', examples: './docs/examples.md', license: './LICENSE.md', readme: 'README.md', dest: './docs', }, config: { umdBuild: 'webpack.umd.config.js', umdBuildeMin: 'webpack.umd.min.config.js', browserBuild: 'webpack.browser.config.js', browserBuildMin: 'webpack.browser.min.config.js', }, }; // Clean tasks. gulp.task('clean', function () { return del(path.dist); }); // Documentation tasks. gulp.task('docs:api', function () { return gulp.src(paths.src) .pipe(gulpBabel()) .pipe(gulpJsdoc2md()) .pipe(gulpRename(function (pathInfo) { pathInfo.basename = 'api'; pathInfo.extname = '.md'; })) .pipe(gulp.dest(paths.docs.dest)); }); gulp.task('docs', ['docs:api'], function () { return gulp.src([ paths.docs.badges, paths.docs.api, paths.docs.install, paths.docs.examples, paths.docs.license ]) .pipe(gulpConcat(paths.docs.readme)) .pipe(gulp.dest('./')); }); // Build tasks. gulp.task('umd:build', [ 'clean', 'docs' ], gulpShell.task([ `webpack --config ${paths.config.umdBuild}`, ])); gulp.task('umd:build:min', ['umd:build'], gulpShell.task([ `webpack --config ${paths.config.umdBuildeMin}`, ])); gulp.task('browser:build', [ 'clean', 'docs' ], gulpShell.task([ `webpack --config ${paths.config.browserBuild}`, ])); gulp.task('browser:build:min', ['browser:build'], gulpShell.task([ `webpack --config ${paths.config.browserBuildMin}`, ])); gulp.task('all:build', [ 'umd:build', 'browser:build' ]); gulp.task('all:build:min', [ 'umd:build:min', 'browser:build:min' ]); // Dev & Demo Server tasks. var runDevServer = function (contentBase, port) { webpackDevServerConfig.output.path = path.join(__dirname, contentBase); var filename = 'watAspect.browser.js'; var compiler = webpack(webpackDevServerConfig); var server = new WebpackDevServer(compiler, { contentBase: contentBase, // contentBase: '/', //web root path // or: contentBase: "http://localhost/", hot: true, // Enable special support for Hot Module Replacement // Page is no longer updated, but a "webpackHotUpdate" message is send to the content // Use "webpack/hot/dev-server" as additional module in your entry point // Note: this does _not_ add the `HotModuleReplacementPlugin` like the CLI option does. // Set this as true if you want to access dev server from arbitrary url. // This is handy if you are using a html5 router. historyApiFallback: true, // Set this if you want to enable gzip compression for assets compress: false, // Set this if you want webpack-dev-server to delegate a single path to an arbitrary server. // Use "*" to proxy all paths to the specified server. // This is useful if you want to get rid of 'http://localhost:8080/' in script[src], // and has many other use cases (see https://github.com/webpack/webpack-dev-server/pull/127 ). // proxy: { // '*': 'http://localhost:9090', // }, // pass [static options](http://expressjs.com/en/4x/api.html#express.static) to inner express server staticOptions: { }, // webpack-dev-middleware options quiet: false, noInfo: false, lazy: false, filename: filename, headers: { 'Access-Control-Allow-Origin': '*', }, inline: true, }); server.listen(port, 'localhost', function (err, result) { /* eslint-disable no-console, no-undef */ if (err) { console.log(err); } console.log(`Listening at http://localhost:${port}/webpack-dev-server/`); console.log(`Listening at http://localhost:${port}/${filename}`); /* eslint-enable no-console, no-undef */ // server.close(); }); }; gulp.task('browser:demo:basic', function () { runDevServer('demo/basic', 3333); }); // Default tasks. gulp.task('default', ['all:build:min']);
30.856164
117
0.650166
f6efbefc1db691fc157200723e41f6d1140f0f79
15,777
js
JavaScript
script.js
superzmy/CSDNGreener
f8f3c3a1f4402be09f9e963744564ee593a77a6d
[ "MIT" ]
null
null
null
script.js
superzmy/CSDNGreener
f8f3c3a1f4402be09f9e963744564ee593a77a6d
[ "MIT" ]
null
null
null
script.js
superzmy/CSDNGreener
f8f3c3a1f4402be09f9e963744564ee593a77a6d
[ "MIT" ]
null
null
null
// ==UserScript== // @name (持续更新)CSDN页面浮窗广告完全过滤净化(净化复制内容|自动展开|让你专注于文章|不影响功能使用) // @namespace https://github.com/AdlerED // @version 2.2.0 // @description ⚡️拥有数项独家功能的最强脚本,不服比一比⚡️|✔️CSDN体验秒杀AdBlock|✔️分辨率自适配,分屏不用滚动|✔️超级预优化|✔️独家超级免会员|✔️独家原创文章免登录展开|✔️独家推荐内容自由开关|✔️独家免登录复制|✔️独家防外链重定向|✔️独家论坛未登录自动展开文章、评论|✔️全面净化|✔️沉浸阅读|✔️净化剪贴板|✔️作者信息文章顶部展示 // @author Adler // @connect www.csdn.net // @include *://*.csdn.net/* // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js // @note 20-04-15 2.2.0 一些广告被其他插件屏蔽导致的异常无视之 // @note 20-03-30 2.1.9 干掉“记录你的创作历程”,干掉未登录情况下的角标提醒 // @note 20-03-13 2.1.8 窄屏适配加强 // @note 20-03-13 2.1.7 更新简介 // @note 20-03-12 2.1.6 宽度自适应(感谢来自GitHub的朋友LeonG7的建议)!修复剪贴板净化无效的问题。 // @note 20-03-04 2.1.5 适配AdGuard // @note 20-02-27 2.1.4 优化免登录复制 // @note 20-02-25 2.1.3 免登录复制更新,现已可用 // @note 20-02-24 2.1.2 By Github@JalinWang 更改去除剪贴板劫持的方式,使得原文格式在复制时能够保留 // @note 20-02-22 2.1.1 紧急修复由于 CSDN 修改前端结构导致的文章错位 // @note 20-02-11 2.1.0 若干动画优化,视觉体验更流畅 // @note 20-02-06 2.0.9 武汉加油!修改推荐内容切换开关位置,减少违和感 // @note 20-01-17 2.0.8 去除右侧广告 // @note 20-01-17 2.0.7 感谢来自GitHub的朋友“gleans”的建议,去掉页头广告 // @note 19-12-12 2.0.6 感谢来自GitHub的朋友“yexuesong”的建议,将作者信息在文章顶部展示 // @note 19-10-30 2.0.5 美化隐藏按钮,增加点击动画 // @note 19-10-30 2.0.4 删除CSDN官方在主页推送的文章(大多是广告) // @note 19-10-30 2.0.3 添加更多屏蔽脚本 // @note 19-10-30 2.0.0 祝自己生日快乐~完全重写CSDNGreener,统一使用JQuery,效率更高 // @note 19-10-27 1.5.2 删除分享海报提示&&感谢GitHub的朋友“CHN-STUDENT”的反馈,去除底部课程推荐 // @note 19-10-27 1.5.1 感谢来自GitHub的朋友“CHN-STUDENT”的细致复现反馈,去除了底部的课程推荐广告 // @note 19-10-04 1.5.0 移除了底部主题信息和打赏 // @note 19-09-10 1.4.9 感谢来自GitHub的朋友“programmerZe”的细致复现反馈,修复了评论区点击查看回复后,已经展开的评论会收起的问题 // @note 19-09-04 1.4.8 感谢来自GitHub的朋友“dwdcth”的细致复现反馈,现在查看原创文章不会无限弹登录窗口了,且加强了自动展开功能 // @note 19-08-20 1.4.7 感谢油叉用户“SupremeSir”的反馈,修复了右侧悬浮栏遮挡文章的问题 // @note 19-08-14 1.4.6 无语。刚更新的免登录复制,又改了。修复! // @note 19-08-13 1.4.5 更新了独家功能:免登录复制 // @note 19-08-13 1.4.4 感谢来自GitHub的朋友“iamsunxing”的反馈,修复了顶部不贴边的问题 // @note 19-08-01 1.4.3 感谢油叉用户“ddddy”的反馈,去除了更多推广广告 // @note 19-07-30 1.4.2 感谢油叉用户“周义杰”的反馈,增加了防CSDN外链重定向的功能(CSDN臭流氓) // @note 19-07-20 1.4.1 修复了推荐内容开关跨文章无效问题(忘了配置Cookie作用域) // @note 19-07-19 1.4.0 1. 构架大更新 2. 感谢来自GitHub的朋友"lukemin"的反馈,加入了下方推荐内容是否隐藏开关(实用) // @note 19-07-13 1.3.0 感谢来自GitHub的朋友“Holaplace”的反馈,修复了文章无法自动展开的问题(CSDN总改这个,令人头疼) // @note 19-06-08 1.2.6 感谢油叉用户“DeskyAki”的反馈,修复了文章无法自动展开的问题 // @note 19-06-07 1.2.4 修复了登录后评论无法正常打开的问题 // @note 19-06-07 1.2.3 感谢油叉用户"永远的殿下"的反馈,在一上午的努力攻克下,终于实现了未登录展开评论的语句 // @note 19-06-05 1.2.0 修复了评论无法自动展开的BUG // @note 19-06-04 1.1.9 修复了无法自动展开的BUG(自闭了) // @note 19-06-04 1.1.6 CSDN太坏了,把“消息”按钮的Class设置成了“GitChat”,所以修复了“消息”按钮消失的问题 // @note 19-06-04 1.1.5 1. 优化了论坛体验 2.美化、优化代码结构 // @note 19-06-04 1.1.4 感谢来自GitHub的朋友“iamsunxing”的反馈,增加了论坛广告匹配规则 // @note 19-06-03 1.1.3 感谢来自GitHub的朋友“wangwei135”的反馈,去除了评论区上方的广告 // @note 19-05-27 1.1.2 感谢油叉用户“夏伟杰”的反馈,修复了富文本编辑器无法使用的问题 // @note 19-05-25 1.1.0 1. 修复了主页广告的问题 2. 论坛自动展开 3. 论坛广告消除 // @note 19-05-25 1.0.9 感谢油叉用户“渣渣不准说话”的反馈,修复了收藏按钮消失的问题 // @note 19-03-01 1.0.3 添加页面选择性过滤规则 // @note 19-03-01 1.0.2 增加了净化剪贴板功能 // @note 19-03-01 1.0.1 修复了排版问题, 优化了代码结构 // @note 19-02-26 1.0.0 初版发布 // ==/UserScript== var version = "2.2.0"; var currentURL = window.location.href; var list; (function () { 'use strict'; l("CSDNGreener V" + version); var blockURL = currentURL.split("/").length; var main = /(www\.csdn\.net\/)$/; var article = /article/; var bbs = /bbs\.csdn\.net/; var blog = /blog\.csdn\.net/; var blog2 = /\/article\/list\//; var download = /download\.csdn\.net/; var login = /passport\.csdn\.net/; var zone = /me\.csdn\.net/; // 数组初始化 list = []; // 头部分 // APP put(".app-app"); // VIP put(".vip-caise"); // 记录你的成长历程(记个毛) put("#writeGuide"); // 新通知小圆点(未登录才消掉) if ($(".userinfo a").text() === '登录/注册') { put("#msg-circle"); } // Cookie common(6, 1); if (main.test(currentURL)) { l("正在优化主页体验..."); // 常规 // 头部广告 put(".banner-ad-box"); // 右侧广告 put(".slide-outer"); // 右侧浮窗 put(".csdn-side-toolbar"); // 右侧详情 put(".persion_article"); clean(10); common(5, 10); loop(1); } else if ((blog.test(currentURL) && blockURL === 4) || blog2.test(currentURL)) { l("正在优化个人博客主页体验..."); // 常规 // 左侧广告 put(".mb8"); put("#kp_box_503"); clean(10); common(5, 10); } else if (article.test(currentURL)) { l("正在优化阅读体验..."); // 常规 // 右侧广告,放到第一个清除 put(".recommend-right"); // 快来写博客吧 put(".blog_tip_box"); // 推荐关注用户 put(".blog-expert-recommend-box"); // 右下角VIP put(".meau-gotop-box"); // 广告 put(".mediav_ad"); put(".pulllog-box"); put(".recommend-ad-box"); put(".box-shadow"); put(".type_hot_word"); put(".fourth_column"); // 高分辨率时右侧文章推荐 put(".right-item"); // 广告 put("#asideFooter"); put("#ad-div"); put("#479"); put("#480"); // 打赏 put(".postTime"); // 课程推荐 put(".t0"); // 分享海报 put(".shareSuggest"); // 底部主题 put(".template-box"); // 评论区广告 put("div#dmp_ad_58"); // 打赏 put(".reward-user-box"); // 右侧打赏按钮 put(".to-reward"); // 推荐内容广告 put(".recommend-recommend-box"); // 右侧广告 put(".indexSuperise"); clean(10); // 填充 common(4, 5); // 评论 common(1, 30); // 其它 common(2, 20); // 顶部显示作者信息 common(8, 1); // 循环线程开始 loop(2); } else if (bbs.test(currentURL)) { l("正在优化论坛体验..."); // 常规 // 评论嵌入小广告 put(".post_recommend"); // 底部推荐 put("#post_feed_wrap"); // 底部相关文章里面的广告 put(".bbs_feed_ad_box"); put(".recommend-ad-box"); // 底部相关文字里面的热词提示 put(".type_hot_word"); // 底部蓝色flex属性的广告栏+登录注册框 put(".pulllog-box"); // 猜你喜欢 put(".personalized-recommend-box"); // 发帖减半提示 put(".totast-box"); // 顶部广告 put(".recommend-right"); // 顶部广告 put(".ad_top"); clean(10); // 展开 common(3, 50); common(5, 10); } else if (download.test(currentURL)) { l("正在优化下载页体验..."); // 常规 put(".fixed_dl"); put("indexSuperise"); clean(10); common(5, 10); } else if (login.test(currentURL)) { l("正在优化登录页体验..."); // 常规 // 登录界面大图广告 put(".main-tu"); clean(10); common(5, 10); } else if (zone.test(currentURL)) { l("正在优化个人空间体验..."); // 常规 clean(10); common(7, 10); common(5, 10); } else { e("不受支持的页面!"); } l("超级优化完毕。"); l("如果觉得好用,来 https://greasyfork.org/zh-CN/scripts/378351 收藏脚本来支持我吧!"); l("开源&&提建议:https://github.com/AdlerED/CSDNGreener"); l("我的博客:https://www.stackoverflow.wiki/"); l("我的微信:1101635162"); })(); function l(log) { console.log("[CSDNGreener] " + log); } function e(error) { console.error("[CSDNGreener] " + error); } function clear() { list = []; } function put(tag) { list.push(tag); } function clean(times) { var loop = setInterval(function () { --times; if (times <= 0) { clearInterval(loop); } /* for (var j = 0; j < list.length; j++) { $(list[j]).hide(1000); } setInterval(function () { for (var k = 0; k < list.length; k++) { $(list[k]).remove(); } }, 1000); */ for (var k = 0; k < list.length; k++) { $(list[k]).remove(); } }, 100); } function loop(num) { var did = false; setInterval(function () { if (num === 1) { // 主页中间的广告 $(".J_adv").remove(); // 主页有新的内容横条 $(".feed-fix-box").remove(); // 主页广告 iframe if (currentURL == "https://www.csdn.net/") { $("iframe").remove(); } // 删除 CSDN 官方在主页的文章(大多是广告) $("li.clearfix").each(function(index, ele) { var banned = /csdn<\/a>/; var aMark = $(ele).find(".name").html(); if (banned.test(aMark)) { $(ele).remove(); } }); } else if (num === 2) { // 评论查看更多展开监听 $("div.comment-list-box").css("max-height", "none"); // 文章宽度自适应 if (window.innerWidth < 1100) { $("article").width(window.innerWidth - 150); did = true; } else { if (did === true) { $("article").removeAttr("style"); did = false; } } } }, 500); } function common(num, times) { var loop = setInterval(function () { --times; if (times <= 0) { clearInterval(loop); } if (num === 1) { // 查看更多 $(".btn-readmore").removeClass("no-login"); $(".btn-readmore").addClass("fans-read-more"); $(".btn-readmore").removeAttr("href"); $(".btn-readmore").removeAttr("target"); $(".btn-readmore").removeAttr("rel"); $(".btn-readmore").click(); // 已登录用户展开评论 try{ document.getElementById("btnMoreComment").click(); }catch(e){} // 删除查看更多按钮 $("#btnMoreComment").parent("div.opt-box").remove(); // 展开内容 $("div.comment-list-box").css("max-height", "none"); // 改回背景颜色 $(".login-mark").remove(); // 删除登录框 $(".login-box").remove(); } else if (num === 2) { // 挡住评论的“出头推荐” if ($(".recommend-box").length > 1) { $(".recommend-box")[0].remove(); } // 去外链 $("#content_views").off(); // 去除推广广告 $("li[data-type='ad']").remove(); // 免登录复制 $(".hljs-button").removeClass("signin"); $(".hljs-button").addClass("{2}"); $(".hljs-button").attr("data-title", "免登录复制"); // 去除剪贴板劫持 $("code").attr("onclick", "mdcp.copyCode(event)"); try { // 复制时保留原文格式,参考 https://greasyfork.org/en/scripts/390502-csdnremovecopyright/code Object.defineProperty(window, "articleType", { value: 0, writable: false, configurable: false }); } catch (err) { } csdn.copyright.init("", "", ""); // 页头广告 try{ document.getElementsByClassName("column-advert-box")[0].style.display="none"; }catch(e){} } else if (num == 3) { //论坛自动展开 $(".js_show_topic").click(); } else if (num == 4) { // 左侧栏填充屏幕 $(".blog_container_aside").hide(); var screenWidth = document.body.clientWidth; if (screenWidth <= 1500) { $("main").css("cssText", "width:96% !important;"); } else { $("main").css("cssText", "width:100% !important;"); } // 右侧栏靠右 $(".tool-box").css("right", "0px"); $(".csdn-side-toolbar").css("right", "0px"); } else if (num == 5) { // 改回背景颜色 $(".login-mark").remove(); // 删除登录框 $(".login-box").remove(); } else if (num == 6) { // 推荐内容开关 cookie var removeCookie = $.cookie("remove"); var remove; if (removeCookie == undefined) { $.cookie('remove', true, { path: '/' }); remove = true; } if (removeCookie == "true") { remove = true; } else { remove = false; } // 删除推荐内容(自定义) if (remove) { $(".recommend-box").hide(); } // 推荐内容开关 $(".blog-content-box").append("<br><div class='blog-content-box' id='switch'></div>"); //$(".comment-edit-box").after("<center><font size='1px'><a href='https://greasyfork.org/zh-CN/scripts/378351'>CSDN Greener V" + version + "</a><br><a href='https://github.com/AdlerED'>By GitHub :: AdlerED</a></font></center>"); if (remove) { $("#switch").append("<button class='hide-recommend-button'>显示推荐内容</button>"); } else { $("#switch").append("<button class='hide-recommend-button'>隐藏推荐内容</button>"); } renderHideButton(); // 开关监听 $(".hide-recommend-button").click(function () { if ($.cookie('remove') == "true") { $.cookie('remove', false, { path: '/' }); $(".recommend-box").slideDown(2000); $(".hide-recommend-button").html("隐藏推荐内容"); } else { $.cookie('remove', true, { path: '/' }); $(".recommend-box").slideUp(1000); $(".hide-recommend-button").html("显示推荐内容"); } renderHideButton(); }); } else if (num === 7) { $(".me_r")[1].remove(); } else if (num === 8) { $(".article-bar-top").append("<br>"); $(".article-bar-top").append($(".aside-box-footerClassify").children("dd").html()); $("dl").each(function (index, element) { var key = $(this).children("dt"); var value = $(this).children("dd").children("span"); if (key.html().indexOf("原创") != -1) { key = $(this).children("dt").children("a") value = $(this).children("dd").children("a").children("span"); addInfo(key, value); } else if (value.html() != undefined) { addInfo(key, value); } } ); function addInfo(key, value) { var bind = key.html() + "&nbsp;" + value.html() + "&nbsp;&nbsp;"; $(".article-bar-top").append(bind + " "); } $(".blog_container_aside").remove(); } }, 100); } function renderHideButton() { $(".hide-recommend-button").css({ "width": "270px", "height": "40px", "border-width": "0px", "border-radius": "3px", "background": "#F7F7F7", "cursor": "pointer", "outline": "none", "font-family": "Microsoft YaHei", "color": "rgba(15,15,15,0.6)", "font-size": "17px", "display": "block", "margin": "0 auto" }); $(".hide-recommend-button").hover( function () { $(".hide-recommend-button").css("background", "#EEEEEE"); }, function () { $(".hide-recommend-button").css("background", "#F7F7F7"); } ); }
33.711538
240
0.472904
f6f05f82f8ec7ceb23939b0ef5d3218bf829bf7e
9,227
js
JavaScript
test/multiple-nodes.js
wehriam/js-libp2p-floodsub-stream
01801031855d52d7184af97d10034318e64b6db3
[ "MIT" ]
null
null
null
test/multiple-nodes.js
wehriam/js-libp2p-floodsub-stream
01801031855d52d7184af97d10034318e64b6db3
[ "MIT" ]
null
null
null
test/multiple-nodes.js
wehriam/js-libp2p-floodsub-stream
01801031855d52d7184af97d10034318e64b6db3
[ "MIT" ]
null
null
null
/* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 8] */ 'use strict' const chai = require('chai') chai.use(require('dirty-chai')) const expect = chai.expect const parallel = require('async/parallel') const crypto = require('libp2p-crypto') const FloodSub = require('../src') const utils = require('./utils') const first = utils.first const createNode = utils.createNode const expectSet = utils.expectSet describe('multiple nodes (more than 2)', () => { describe('every peer subscribes to the topic', () => { describe('line', () => { // line // ◉────◉────◉ // a b c let a let b let c before((done) => { parallel([ (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb) ], (err, nodes) => { if (err) { return done(err) } a = nodes[0] b = nodes[1] c = nodes[2] done() }) }) after((done) => { // note: setTimeout to avoid the tests finishing // before swarm does its dials setTimeout(() => { parallel([ (cb) => a.libp2p.stop(cb), (cb) => b.libp2p.stop(cb), (cb) => c.libp2p.stop(cb) ], done) }, 1000) }) it('establish the connections', (done) => { parallel([ (cb) => a.libp2p.dial(b.libp2p.peerInfo, cb), (cb) => b.libp2p.dial(c.libp2p.peerInfo, cb) ], (err) => { expect(err).to.not.exist() // wait for the pubsub pipes to be established setTimeout(done, 1000) }) }) it('subscribe to the topic on node a', (done) => { a.ps.subscribe('Z') expectSet(a.ps.subscriptions, ['Z']) b.ps.once('floodsub:subscription-change', () => { expect(b.ps.peers.size).to.equal(2) const aPeerId = a.libp2p.peerInfo.id.toB58String() const topics = b.ps.peers.get(aPeerId).topics expectSet(topics, ['Z']) expect(c.ps.peers.size).to.equal(1) expectSet(first(c.ps.peers).topics, []) done() }) }) it('subscribe to the topic on node b', (done) => { b.ps.subscribe('Z') expectSet(b.ps.subscriptions, ['Z']) parallel([ cb => a.ps.once('floodsub:subscription-change', () => cb()), cb => c.ps.once('floodsub:subscription-change', () => cb()) ], () => { expect(a.ps.peers.size).to.equal(1) expectSet(first(a.ps.peers).topics, ['Z']) expect(c.ps.peers.size).to.equal(1) expectSet(first(c.ps.peers).topics, ['Z']) done() }) }) it('subscribe to the topic on node c', (done) => { c.ps.subscribe('Z') expectSet(c.ps.subscriptions, ['Z']) b.ps.once('floodsub:subscription-change', () => { expect(a.ps.peers.size).to.equal(1) expectSet(first(a.ps.peers).topics, ['Z']) expect(b.ps.peers.size).to.equal(2) b.ps.peers.forEach((peer) => { expectSet(peer.topics, ['Z']) }) done() }) }) it('publish on node a', (done) => { let counter = 0 a.ps.on('Z', incMsg) b.ps.on('Z', incMsg) c.ps.on('Z', incMsg) a.ps.publish('Z', Buffer.from('hey')) function incMsg (msg) { expect(msg.data.toString()).to.equal('hey') check() } function check () { if (++counter === 3) { a.ps.removeListener('Z', incMsg) b.ps.removeListener('Z', incMsg) c.ps.removeListener('Z', incMsg) done() } } }) it('publish array on node a', (done) => { let counter = 0 const msgs = Array.from(Array(2), () => crypto.randomBytes(8)) const msgStrings = msgs.map((b) => b.toString()) a.ps.on('Z', incMsg) b.ps.on('Z', incMsg) c.ps.on('Z', incMsg) a.ps.publish('Z', msgs) function incMsg (msg) { expect(msgStrings).to.include(msg.data.toString()) check() } function check () { if (++counter === 6) { a.ps.removeListener('Z', incMsg) b.ps.removeListener('Z', incMsg) c.ps.removeListener('Z', incMsg) done() } } }) // since the topology is the same, just the publish // gets sent by other peer, we reused the same peers describe('1 level tree', () => { // 1 level tree // ┌◉┐ // │b│ // ◉─┘ └─◉ // a c it('publish on node b', (done) => { let counter = 0 a.ps.on('Z', incMsg) b.ps.on('Z', incMsg) c.ps.on('Z', incMsg) const msgs = Array.from(Array(2), () => crypto.randomBytes(8)) const msgStrings = msgs.map((b) => b.toString()) b.ps.publish('Z', msgs[0]) function incMsg (msg) { expect(msg.data.toString()).to.equal(msgStrings[0]) check() } function check () { if (++counter === 3) { a.ps.removeListener('Z', incMsg) b.ps.removeListener('Z', incMsg) c.ps.removeListener('Z', incMsg) done() } } }) }) }) describe('2 level tree', () => { // 2 levels tree // ┌◉┐ // │c│ // ┌◉─┘ └─◉┐ // │b d│ // ◉─┘ └─◉ // a e let a let b let c let d let e before((done) => { parallel([ (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb), (cb) => spawnPubSubNode(cb) ], (err, nodes) => { if (err) { return done(err) } a = nodes[0] b = nodes[1] c = nodes[2] d = nodes[3] e = nodes[4] done() }) }) after((done) => { // note: setTimeout to avoid the tests finishing // before swarm does its dials setTimeout(() => { parallel([ (cb) => a.libp2p.stop(cb), (cb) => b.libp2p.stop(cb), (cb) => c.libp2p.stop(cb), (cb) => d.libp2p.stop(cb), (cb) => e.libp2p.stop(cb) ], done) }, 1000) }) it('establish the connections', (done) => { parallel([ (cb) => a.libp2p.dial(b.libp2p.peerInfo, cb), (cb) => b.libp2p.dial(c.libp2p.peerInfo, cb), (cb) => c.libp2p.dial(d.libp2p.peerInfo, cb), (cb) => d.libp2p.dial(e.libp2p.peerInfo, cb) ], (err) => { expect(err).to.not.exist() // wait for the pubsub pipes to be established setTimeout(done, 2000) }) }) it('subscribes', () => { a.ps.subscribe('Z') expectSet(a.ps.subscriptions, ['Z']) b.ps.subscribe('Z') expectSet(b.ps.subscriptions, ['Z']) c.ps.subscribe('Z') expectSet(c.ps.subscriptions, ['Z']) d.ps.subscribe('Z') expectSet(d.ps.subscriptions, ['Z']) e.ps.subscribe('Z') expectSet(e.ps.subscriptions, ['Z']) }) it('publishes from c', (done) => { let counter = 0 a.ps.on('Z', incMsg) b.ps.on('Z', incMsg) c.ps.on('Z', incMsg) d.ps.on('Z', incMsg) e.ps.on('Z', incMsg) c.ps.publish('Z', Buffer.from('hey from c')) function incMsg (msg) { expect(msg.data.toString()).to.equal('hey from c') check() } function check () { if (++counter === 5) { a.ps.removeListener('Z', incMsg) b.ps.removeListener('Z', incMsg) c.ps.removeListener('Z', incMsg) d.ps.removeListener('Z', incMsg) e.ps.removeListener('Z', incMsg) done() } } }) }) }) describe('only some nodes subscribe the networks', () => { describe('line', () => { // line // ◉────◎────◉ // a b c before((done) => {}) after((done) => {}) }) describe('1 level tree', () => { // 1 level tree // ┌◉┐ // │b│ // ◎─┘ └─◉ // a c before((done) => {}) after((done) => {}) }) describe('2 level tree', () => { // 2 levels tree // ┌◉┐ // │c│ // ┌◎─┘ └─◉┐ // │b d│ // ◉─┘ └─◎ // a e before((done) => {}) after((done) => {}) }) }) }) function spawnPubSubNode (callback) { createNode('/ip4/127.0.0.1/tcp/0', (err, node) => { if (err) { return callback(err) } const ps = new FloodSub(node) ps.start((err) => { if (err) { return callback(err) } callback(null, { libp2p: node, ps: ps }) }) }) }
25.141689
72
0.446407
f6f061d9992cb9557fcaf325c3ac2c90527f39db
55
js
JavaScript
1-Basic-JavaScript/21-1-declare-string-variables.js
ZahraRazzaghi/FreeCodeCamp-javaScript
ebff45fa5b4691c22495ca0fedc80c185faffa78
[ "MIT" ]
1
2020-08-20T08:09:12.000Z
2020-08-20T08:09:12.000Z
1-Basic-JavaScript/21-1-declare-string-variables.js
ZahraRazzaghi/FreeCodeCamp-javaScript
ebff45fa5b4691c22495ca0fedc80c185faffa78
[ "MIT" ]
null
null
null
1-Basic-JavaScript/21-1-declare-string-variables.js
ZahraRazzaghi/FreeCodeCamp-javaScript
ebff45fa5b4691c22495ca0fedc80c185faffa78
[ "MIT" ]
null
null
null
var myFirstName="Zahra"; var myLastName='Razzaghi';
18.333333
28
0.727273
f6f0a2d56f52ea1a8b7b72325a38dd55e1463e29
1,394
js
JavaScript
lib/aggregation/reporting/src/test/lib/summarizer-test.js
wanglw/cf-abacus
96eb2da512503614b976e53103db820a4fc0548f
[ "Apache-2.0" ]
98
2015-08-08T01:42:35.000Z
2019-10-27T23:49:45.000Z
lib/aggregation/reporting/src/test/lib/summarizer-test.js
wanglw/cf-abacus
96eb2da512503614b976e53103db820a4fc0548f
[ "Apache-2.0" ]
1,166
2015-07-27T23:17:17.000Z
2019-10-21T19:37:46.000Z
lib/aggregation/reporting/src/test/lib/summarizer-test.js
wanglw/cf-abacus
96eb2da512503614b976e53103db820a4fc0548f
[ "Apache-2.0" ]
159
2015-07-28T23:52:05.000Z
2019-08-22T13:27:32.000Z
'use strict'; const summarizer = require('../../lib/summarizer.js'); /* eslint-disable no-unused-expressions */ describe('summarizer', () => { const summarizeFnErrMsg = 'SummarizeFn error'; let sandbox; let summaryFunction; beforeEach(() => { sandbox = sinon.createSandbox(); summaryFunction = sandbox.stub().throws(new Error(summarizeFnErrMsg)); }); afterEach(() => { sandbox.restore(); sandbox.reset(); }); describe('summarizeWindowElement', () => { context('when summary function errors', () => { const windowElement = {}; it('returns summary 0', () => { expect( summarizer.summarizeWindowElement( sandbox.any, windowElement, summaryFunction, sandbox.any, sandbox.any ) ).to.deep.equal({ summary: 0 }); }); }); }); describe('summarizeMetric', () => { context('when summary function errors', () => { let chargePlanMetric; beforeEach(() => { chargePlanMetric = summarizer.summarizeMetric(sandbox.any, sandbox.any, summaryFunction); }); it('throws', (done) => { chargePlanMetric({ metric: 'metric' }, (err) => { expect(err).to.exist; expect(err.message).to.equal(summarizeFnErrMsg); done(); }); }); }); }); });
22.126984
97
0.548063
f6f0e0a6cb2abeebc94fd47fd2bc17b931b4f9eb
512
js
JavaScript
node/stack/src/client/components/counter.js
petrsmid/modern-javascript-course
6ff3236ce3b2e267030f1120f468aecbc308d996
[ "MIT" ]
null
null
null
node/stack/src/client/components/counter.js
petrsmid/modern-javascript-course
6ff3236ce3b2e267030f1120f468aecbc308d996
[ "MIT" ]
null
null
null
node/stack/src/client/components/counter.js
petrsmid/modern-javascript-course
6ff3236ce3b2e267030f1120f468aecbc308d996
[ "MIT" ]
null
null
null
import React from 'react'; export default class Counter extends React.Component { constructor(props) { super(props); this.state = { count: 0 } } render() { return ( <div> <h1>Count: {this.state.count}</h1> <button type="button" onClick={(e)=>{ this.setState({ count: this.state.count+1 }); }}>Increment</button> </div> ); } }
23.272727
54
0.427734
f6f17b5143584b671232b42df09c9d08867cc243
652
js
JavaScript
Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.setMinutes.js
densogiaichned/serenity
99c0b895fed02949b528437d6b450d85befde7a5
[ "BSD-2-Clause" ]
2
2022-02-08T09:18:50.000Z
2022-02-21T17:57:23.000Z
Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.setMinutes.js
densogiaichned/serenity
99c0b895fed02949b528437d6b450d85befde7a5
[ "BSD-2-Clause" ]
null
null
null
Userland/Libraries/LibJS/Tests/builtins/Date/Date.prototype.setMinutes.js
densogiaichned/serenity
99c0b895fed02949b528437d6b450d85befde7a5
[ "BSD-2-Clause" ]
null
null
null
test("basic functionality", () => { let d = new Date(2000, 2, 1); d.setMinutes(30); expect(d.getMinutes()).toBe(30); d.setMinutes(30, 50); expect(d.getMinutes()).toBe(30); expect(d.getSeconds()).toBe(50); d.setMinutes(30, 50, 600); expect(d.getMinutes()).toBe(30); expect(d.getSeconds()).toBe(50); expect(d.getMilliseconds()).toBe(600); d.setMinutes(""); expect(d.getMinutes()).toBe(0); d.setMinutes("a"); expect(d.getMinutes()).toBe(NaN); }); test("invalid date", () => { let date = new Date(NaN); expect(date.setMinutes(2)).toBeNaN(); expect(date.getMinutes()).toBeNaN(); });
23.285714
42
0.590491
f6f1c8b3c5eba2d6dfe121cb51e7c456008a3865
2,586
js
JavaScript
app/routes/application.js
ericbai/textup-frontend
f514e9b785ebf82584ac77ce1b4f94e4274029ba
[ "Apache-2.0" ]
2
2016-06-24T23:53:30.000Z
2019-02-21T21:06:58.000Z
app/routes/application.js
ericbai/textup-frontend
f514e9b785ebf82584ac77ce1b4f94e4274029ba
[ "Apache-2.0" ]
6
2017-11-08T03:41:06.000Z
2022-01-27T14:48:57.000Z
app/routes/application.js
ericbai/textup-frontend
f514e9b785ebf82584ac77ce1b4f94e4274029ba
[ "Apache-2.0" ]
null
null
null
import Ember from 'ember'; import HasSlideoutOutlet from 'textup-frontend/mixins/route/has-slideout-outlet'; import Loading from 'textup-frontend/mixins/loading-slider'; const { isPresent } = Ember; export default Ember.Route.extend(HasSlideoutOutlet, Loading, { authService: Ember.inject.service(), lockService: Ember.inject.service(), requestService: Ember.inject.service(), splashScreenService: Ember.inject.service(), stateService: Ember.inject.service(), beforeModel() { this._super(...arguments); return this.get('authService').trySetUpFromStorage(); }, // Use the redirect hook because it does not invalidate the work done thus far. // see: https://guides.emberjs.com/v2.4.0/routing/redirection/ redirect(model, { targetName }) { this._super(...arguments); // initialize location state based on the immediate location we are going to. This is so that // if we have typed in or pasted in a notification preview url we don't accidentally redirect // away from it. const url = this.get('stateService').startTrackingAndGetUrlToRestoreIfNeeded(targetName); if (isPresent(url)) { this.transitionTo(url); } }, actions: { willTransition(transition) { this._super(...arguments); this.get('lockService').syncLockStatusWithTransition(transition); }, didTransition() { this._super(...arguments); // call super for slideout this.get('splashScreenService').tryRemove(); // Initialize locking after we have arrived on the final page that we are meant to be on // Checking AFTER the transition is complete ensures that, no matter what the URL we type in // and where the app ends up sending us, we will always initialize the lock status correctly. // For example, if we typed in the index route (which is public) and ended up on the main route // (which is private), then we would want to determine whether we should start locked on the // FINAL route not the initial route. // [NOTE] this method only works on the first call. Calling subsequent times will short circuit // The reason is that the `willTransition` hook is not called on the initial render so we // have to use the `didTransition` hook to see where we ended up on the initial render this.get('lockService').scheduleCheckIfShouldStartLocked(); }, error(reason, transition) { this._super(...arguments); this.get('authService').storeAttemptedTransition(transition); this.get('requestService').handleResponseErrorObj(reason); }, }, });
45.368421
101
0.710363
f6f203e4b100e798094dcd613fe5ebabfa2a62e9
781
js
JavaScript
src/helpers/swipeAngle/swipeAngle.js
oayres/react-pure-carousel
6b428ef6e2c21815b1d77aa9648ab3bdb552d4ac
[ "MIT" ]
null
null
null
src/helpers/swipeAngle/swipeAngle.js
oayres/react-pure-carousel
6b428ef6e2c21815b1d77aa9648ab3bdb552d4ac
[ "MIT" ]
null
null
null
src/helpers/swipeAngle/swipeAngle.js
oayres/react-pure-carousel
6b428ef6e2c21815b1d77aa9648ab3bdb552d4ac
[ "MIT" ]
null
null
null
const normaliseAngle = (swipeAngle) => { if (swipeAngle < 0) { swipeAngle = 360 - Math.abs(swipeAngle) } return swipeAngle } const mapAngleToDirection = (swipeAngle, vertical) => { let direction = 0 if (swipeAngle <= 45 || swipeAngle >= 315) { direction = 1 } else if (swipeAngle >= 135 && swipeAngle <= 225) { direction = -1 } else if (vertical) { if (swipeAngle >= 35 && swipeAngle <= 135) { direction = 1 } else { direction = -1 } } return direction } const swipeAngle = (xDist, yDist, vertical) => { const radius = Math.atan2(yDist, xDist) let swipeAngle = Math.round(radius * 180 / Math.PI) swipeAngle = normaliseAngle(swipeAngle) return mapAngleToDirection(swipeAngle, vertical) } export default swipeAngle
22.314286
55
0.642766
f6f261e98169125dda48b7497386effd3ba23cd6
11,160
js
JavaScript
lib/reactjs-coverflow.js
Bastorx/react-coverflow2
e1b371e83da2917a4f307ab944c64a1ffef1ebfa
[ "MIT" ]
10
2016-04-01T08:02:26.000Z
2019-12-13T13:23:26.000Z
lib/reactjs-coverflow.js
Bastorx/react-coverflow2
e1b371e83da2917a4f307ab944c64a1ffef1ebfa
[ "MIT" ]
21
2016-03-31T09:36:41.000Z
2018-03-23T11:00:19.000Z
lib/reactjs-coverflow.js
Bastorx/react-coverflow2
e1b371e83da2917a4f307ab944c64a1ffef1ebfa
[ "MIT" ]
3
2016-05-23T02:06:26.000Z
2017-07-12T07:15:10.000Z
"use strict"; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _class, _temp; var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _reactDom = require("react-dom"); var _propTypes = require("prop-types"); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } module.exports = (_temp = _class = function (_Component) { _inherits(Coverflow, _Component); function Coverflow(props) { _classCallCheck(this, Coverflow); var _this = _possibleConstructorReturn(this, (Coverflow.__proto__ || Object.getPrototypeOf(Coverflow)).call(this, props)); var childrens = props.children && props.children.length; _this._handleWheel = _this._handleWheel.bind(_this); _this._handleTouchStart = _this._handleTouchStart.bind(_this); _this._handleTouchMove = _this._handleTouchMove.bind(_this); _this._handleResize = _this._handleResize.bind(_this); _this.previous = _this.previous.bind(_this); _this.next = _this.next.bind(_this); _this.goAt = _this.goAt.bind(_this); _this.getPosition = _this.getPosition.bind(_this); _this._animation = _this._animation.bind(_this); _this._loadCSS = _this._loadCSS.bind(_this); _this.state = { position: props.startPosition > (childrens || 0) ? (childrens || 0) - 1 : props.startPosition, shouldUpdate: false }; return _this; } _createClass(Coverflow, [{ key: "componentWillMount", value: function componentWillMount() { this._loadCSS(); } }, { key: "componentDidMount", value: function componentDidMount() { var _this2 = this; this._loadCSS(); var coverflow = (0, _reactDom.findDOMNode)(this.refs.coverflow); var elements = coverflow.getElementsByClassName("reactjs-coverflow_Element"); var offset = []; this._forEach(elements, function (e) { offset.push(e.offsetLeft); }); this._forEach(elements, function (e, key) { var rotateY = _this2.state.position > key ? " rotateY(" + _this2.props.rotate + "deg)" : _this2.state.position < key ? " rotateY(-" + _this2.props.rotate + "deg)" : ""; e.style.transform = rotateY; if (_this2.props.animationSpeed) { e.style.transition = "transform " + (typeof _this2.props.animationSpeed == "string" ? _this2.props.animationSpeed : _this2.props.animationSpeed + "s"); } }); this.setState({ offset: offset, elements: elements, coverflow: coverflow }); window.addEventListener("resize", this._handleResize); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { if (!this.state.shouldUpdate) return; this.setState({ shouldUpdate: false }); this._handleResize(); } }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps(newProps) { if (newProps.margin != this.props.margin) this.setState({ shouldUpdate: true }); if (newProps.children != this.props.children) { var childrens = newProps.children && newProps.children.length; if (this.state.position > (childrens || 0)) this.setState({ position: (childrens || 0) - 1 }); if (childrens && this.state.position < 0) this.setState({ position: 0 }); this.setState({ shouldUpdate: true }); } } }, { key: "render", value: function render() { var _this3 = this; var translateX = 0; if (this.state.offset && this.state.offset[this.state.position]) { var activeElementWith = this.state.elements[this.state.position] && this.state.elements[this.state.position].offsetWidth / 2 || 0; translateX = !!this.props.translateX || this.props.translateX === 0 ? "translateX(" + (typeof this.props.translateX == "string" ? this.props.translateX : this.props.translateX + "px") + ") translateX(" + -this.state.offset[this.state.position] + "px)" : "translateX(" + (this.state.coverflow.offsetWidth / 2 - activeElementWith - this.state.offset[this.state.position]) + "px)"; } var transition = this.props.animationSpeed ? typeof this.props.animationSpeed == "string" ? this.props.animationSpeed : this.props.animationSpeed + "s" : undefined; return _react2.default.createElement( "div", { ref: "coverflow", id: this.props.id, className: "reactjs-coverflow_Main" + (this.props.className ? " " + this.props.className : ""), style: this.props.style, onWheel: this.props.enableScroll ? this._handleWheel : "", onTouchStart: this._handleTouchStart, onTouchMove: this._handleTouchMove }, _react2.default.createElement( "div", { className: "reactjs-coverflow_Coverflow", style: { transform: translateX, transition: transition } }, this.props.children && this.props.children.map(function (element, i) { return _react2.default.createElement( "figure", { key: i, className: "reactjs-coverflow_Element" + (i == _this3.state.position ? " active" : ""), style: _this3.props.margin ? { margin: "auto " + (typeof _this3.props.margin == "string" ? _this3.props.margin : _this3.props.margin + "px") } : {} }, element ); }) ) ); } }, { key: "previous", value: function previous() { if (this.state.position > 0) { var position = this.state.position - 1; this.setState({ position: position }); if (this.props.onChange) { this.props.onChange(position); } this._animation(position); } } }, { key: "next", value: function next() { if (this.state.position < this.state.offset.length - 1) { var position = this.state.position + 1; this.setState({ position: position }); if (this.props.onChange) { this.props.onChange(position); } this._animation(position); } } }, { key: "goAt", value: function goAt(position) { if (position < 0) position = 0;else if (position >= this.state.offset.length) position = this.state.offset.length - 1; this.setState({ position: position }); if (this.props.onChange) { this.props.onChange(position); } this._animation(position); } }, { key: "getPosition", value: function getPosition() { return this.state.position; } }, { key: "_handleWheel", value: function _handleWheel(e) { e.preventDefault(); if (e.deltaY < 0) { this.previous(); } else if (e.deltaY > 0) { this.next(); } } }, { key: "_handleTouchStart", value: function _handleTouchStart(e) { e.preventDefault(); this.setState({ touchStart: e.nativeEvent.touches[0].clientX }); } }, { key: "_handleTouchMove", value: function _handleTouchMove(e) { e.preventDefault(); var clientX = e.nativeEvent.touches[0].clientX; var lastX = this.state.touchStart; var move = clientX - lastX; var width = this.state.elements[this.state.position].offsetWidth / 2; if (Math.abs(move) >= width) { this.setState({ touchStart: e.nativeEvent.touches[0].clientX }); if (move > 0) { this.previous(); } else if (move < 0) { this.next(); } } } }, { key: "_handleResize", value: function _handleResize() { var offset = []; this._forEach(this.state.elements, function (e) { offset.push(e.offsetLeft); }); this.setState({ offset: offset }); this._animation(this.state.position, offset); } }, { key: "_animation", value: function _animation(position, o) { var _this4 = this; var offset = o ? o : this.state.offset; var elementsNumber = this.state.elements.length; this._forEach(this.state.elements, function (e, key) { var rotateY = position > key ? " rotateY(" + _this4.props.rotate + "deg)" : position < key ? " rotateY(-" + _this4.props.rotate + "deg)" : ""; e.style.transform = rotateY; e.style.zIndex = elementsNumber - Math.abs(position - key); }); } }, { key: "_loadCSS", value: function _loadCSS() { if (!this.constructor.cssLoaded && typeof document != "undefined") { this.constructor.cssLoaded = true; var css = ".reactjs-coverflow_Main { position: relative; margin: 0; padding: 0; background-color: rgba(0, 0, 0, 0.1); overflow: hidden; } .reactjs-coverflow_Coverflow { width: 100%; height: 100%; display: flex; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-perspective: 500px; perspective: 500px; align-items: center; transition: transform 0.7s; } .reactjs-coverflow_Element { position: relative; margin: auto 20px; transition: transform 0.7s; }"; var head = document.head || document.getElementsByTagName("head")[0]; var style = document.createElement("style"); style.type = "text/css"; if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.insertBefore(style, head.firstChild); } } }, { key: "_forEach", value: function _forEach(array, cb) { for (var i = 0; i < array.length; i++) { cb(array[i], i); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.removeEventListener("resize", this._handleResize); } }]); return Coverflow; }(_react.Component), _class.defaultProps = { enableScroll: true, startPosition: 0, rotate: 40, translateX: null }, _class.propTypes = { startPosition: _propTypes2.default.number, enableScroll: _propTypes2.default.bool, rotate: _propTypes2.default.number, margin: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), animationSpeed: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), translateX: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), onChange: _propTypes2.default.func }, _temp);
36.710526
564
0.677061
f6f2c20b8fe0ecfbca5ba7c372b39858b255aaee
574
js
JavaScript
src/input/check.js
HsuTing/cat-components
2a0af6bd6681c865b27cfe0582b017230d9159eb
[ "MIT" ]
1
2017-07-21T03:51:34.000Z
2017-07-21T03:51:34.000Z
src/input/check.js
HsuTing/cat-components
2a0af6bd6681c865b27cfe0582b017230d9159eb
[ "MIT" ]
62
2017-02-27T03:08:05.000Z
2018-05-03T06:27:20.000Z
src/input/check.js
HsuTing/cat-components
2a0af6bd6681c865b27cfe0582b017230d9159eb
[ "MIT" ]
null
null
null
'use strict'; import validator from 'validator'; export default (value, rules = [], e = null) => { const error = []; rules.forEach(rule => { if(typeof rule.validator === 'string') { if(rule.not && !validator[rule.validator](value, rule.options)) error.push(rule.message); else if(!rule.not && validator[rule.validator](value, rule.options)) error.push(rule.message); } else { if(rule.validator(value, e)) error.push(rule.message); } }); return { value, isError: error.length !== 0, error }; };
22.076923
74
0.585366
f6f3933325ac2dac247250d3443f490255eac6a7
648
js
JavaScript
components/social-meta.js
giuseppeg/next-site
8e5dd82e6d12e0097af9aa52deac61ee2f3ee354
[ "MIT" ]
2
2021-03-16T18:36:22.000Z
2021-07-18T10:18:43.000Z
components/social-meta.js
giuseppeg/next-site
8e5dd82e6d12e0097af9aa52deac61ee2f3ee354
[ "MIT" ]
null
null
null
components/social-meta.js
giuseppeg/next-site
8e5dd82e6d12e0097af9aa52deac61ee2f3ee354
[ "MIT" ]
1
2020-05-07T01:22:22.000Z
2020-05-07T01:22:22.000Z
import Head from 'next/head'; export default ({ title, description, image, url, keywords }) => ( <Head> <meta name="twitter:site" content="@zeithq" /> <meta name="twitter:card" content={image ? 'summary_large_image' : 'summary'} /> {title && <meta name="og:title" content={title} />} {url && <meta name="og:url" content={url} />} {description && <meta name="description" content={description} />} {description && <meta name="og:description" content={description} />} {image && <meta name="og:image" content={`https://nextjs.org${image}`} />} {keywords && <meta name="keywords" content={keywords} />} </Head> );
43.2
84
0.625
f6f415250ca8ae1da2e75e60e314c8746e1fe096
849
js
JavaScript
alldata.js
kmcarter2025/Bandbank1
be51c027290f0d4ed996a16b390b4eab8601e503
[ "MIT" ]
null
null
null
alldata.js
kmcarter2025/Bandbank1
be51c027290f0d4ed996a16b390b4eab8601e503
[ "MIT" ]
null
null
null
alldata.js
kmcarter2025/Bandbank1
be51c027290f0d4ed996a16b390b4eab8601e503
[ "MIT" ]
null
null
null
function AllData(){ const ctx = React.useContext(UserContext); const userAccounts = ctx.users; return ( <div> {userAccounts.map(function(user, i){ return ( <table className="ui celled table"> <thead bgcolor="success"> <tr> <th>Email</th> <th>Name</th> <th>Password</th> </tr> </thead> <tbody> <tr key={i}> <td>{user.name}</td> <td>{user.email}</td> <td>{user.password}</td> </tr> </tbody> </table>) })} </div> ); };
25.727273
50
0.315665
f6f422e476be9bd3d05d572b64036600c6969a52
1,305
js
JavaScript
lesson29/app.js
mannysys/express4-demo
1c075462fb5bb80b969bee006b2980668c2ebd85
[ "MIT" ]
null
null
null
lesson29/app.js
mannysys/express4-demo
1c075462fb5bb80b969bee006b2980668c2ebd85
[ "MIT" ]
null
null
null
lesson29/app.js
mannysys/express4-demo
1c075462fb5bb80b969bee006b2980668c2ebd85
[ "MIT" ]
null
null
null
/** * Created by shadow on 16/2/10. */ const express = require('express'); const cookieParser = require('cookie-parser'); const session = require('express-session'); const consolidate = require('consolidate'); const bodyParser = require('body-parser'); const FileStore = require('session-file-store')(session); const app = express(); app.engine('html',consolidate.ejs); app.set('views',__dirname + '/views'); app.set('view engine','html'); app.use(cookieParser()); app.use(session({ store: new FileStore(), cookie: {maxAge:200000}, //存储有效时间200秒 secret:'tiger' //任意加密的一个字符串 })); app.use(bodyParser()); app.get('/', function(req,res){ res.render('home',{logined:req.session.logined}); }); app.get('/login', function(req, res){ if(req.session.logined){ res.send('logined'); }else{ res.render('login'); } }); app.post('/login', function(req,res){ var loginname = req.body.loginname; var password = req.body.password; if(loginname && password && loginname === 'leo' && password === '123'){ req.session.logined = true; res.redirect('/'); }else{ res.render('login',{error:'登录失败!'}) } }); app.get('/logout',function(req,res){ req.session.logined = undefined; res.redirect('back'); }); app.listen(3000);
22.5
75
0.629119
f6f43c4073b7e19c9ae91a9cb2316d4747327610
532
js
JavaScript
assets/cms/js/partials/blocks/gallery.js
gotpop/got
1dc14db4eb04773b382a1de220dada40930ee573
[ "MIT" ]
null
null
null
assets/cms/js/partials/blocks/gallery.js
gotpop/got
1dc14db4eb04773b382a1de220dada40930ee573
[ "MIT" ]
null
null
null
assets/cms/js/partials/blocks/gallery.js
gotpop/got
1dc14db4eb04773b382a1de220dada40930ee573
[ "MIT" ]
null
null
null
import alt from "../../fields/alt"; import id from "../../fields/id"; import image from "../../fields/image"; import title from "../../fields/title"; const gallery = { label: "Gallery item", name: "gallery", widget: "list", fields: [ title, { label: "Gallery image", name: "galleryImage", widget: "list", fields: [ image, title, alt ] }, id ] }; export default gallery;
19.703704
39
0.447368
f6f4ba9c27adecc8f39d4c4202ba53ed22137f8d
429
js
JavaScript
src/components/app-title.js
tylervipond/art-portfolio-2020
224dc046717ecb0de733477b59f2c4c66e76c324
[ "MIT" ]
null
null
null
src/components/app-title.js
tylervipond/art-portfolio-2020
224dc046717ecb0de733477b59f2c4c66e76c324
[ "MIT" ]
null
null
null
src/components/app-title.js
tylervipond/art-portfolio-2020
224dc046717ecb0de733477b59f2c4c66e76c324
[ "MIT" ]
null
null
null
import styled from '@emotion/styled'; import { COLOR_TEXT, FONT_APP_TITLE, FONT_PAGE_TITLE, TYPE_FACE_DISPLAY, SCREEN_SIZE_MEDIUM, asPx, asRem, } from '../styles'; export const AppTitle = styled.h1` font-size: ${asRem(FONT_PAGE_TITLE)}; font-family: ${TYPE_FACE_DISPLAY}; color: ${COLOR_TEXT}; margin: 0; @media (min-width: ${asPx(SCREEN_SIZE_MEDIUM)}) { font-size: ${asRem(FONT_APP_TITLE)}; } `;
19.5
51
0.685315
f6f513ac0537a4822eb888aa5cb3c022309a43c5
7,843
js
JavaScript
build/v1.2.9/src-min-noconflict/mode-move.js
loredanacirstea/ace-mode-move
b0ed8cdcb8cfcea4758ff3e6cf50aec163bb13cc
[ "MIT" ]
null
null
null
build/v1.2.9/src-min-noconflict/mode-move.js
loredanacirstea/ace-mode-move
b0ed8cdcb8cfcea4758ff3e6cf50aec163bb13cc
[ "MIT" ]
2
2019-07-29T22:21:50.000Z
2019-07-29T22:23:30.000Z
build/v1.3.1/src-min-noconflict/mode-move.js
loredanacirstea/ace-mode-move
b0ed8cdcb8cfcea4758ff3e6cf50aec163bb13cc
[ "MIT" ]
null
null
null
ace.define("ace/mode/move_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=/\\(?:[nrt0'"\\]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source,o=function(){this.$rules={start:[{token:"variable.other.source.move",regex:"'[a-zA-Z_][a-zA-Z0-9_]*(?![\\'])"},{token:"string.quoted.single.source.move",regex:"'(?:[^'\\\\]|"+s+")'"},{token:"identifier",regex:/r#[a-zA-Z_][a-zA-Z0-9_]*\b/},{stateName:"bracketedComment",onMatch:function(e,t,n){return n.unshift(this.next,e.length-1,t),"string.quoted.raw.source.move"},regex:/r#*"/,next:[{onMatch:function(e,t,n){var r="string.quoted.raw.source.move";return e.length>=n[1]?(e.length>n[1]&&(r="invalid"),n.shift(),n.shift(),this.next=n.shift()):this.next="",r},regex:/"#*/,next:"start"},{defaultToken:"string.quoted.raw.source.move"}]},{token:"string.quoted.double.source.move",regex:'"',push:[{token:"string.quoted.double.source.move",regex:'"',next:"pop"},{token:"constant.character.escape.source.move",regex:s},{defaultToken:"string.quoted.double.source.move"}]},{token:["keyword.source.move","text","entity.name.function.source.move"],regex:"\\b(fn)(\\s+)((?:r#)?[a-zA-Z_][a-zA-Z0-9_]*)"},{token:"support.constant",regex:"\\b[a-zA-Z_][\\w\\d]*::"},{token:"keyword.source.move",regex:'\\b(?:mut|create|resource|abstract|continue|for|new|switch|goto|do|if|private|this|break|protected|throw|else|public|enum|return|catch|try|interface|static|class|finally|const|super|while|true|false|assert|release|new|return|let|import|main|script|public|private|struct|module|if|else|for|else|for|while|do|break|continue|throw|returns|return|suicide|new|is|this|super|modules|native|copy|exists|move|withdraw_from_sender|deposit|main")\\b'},{token:"storage.type.source.move",regex:"\\b(?:boolean|double|byte|int|short|char|void|long|float|address|string|bool|u64|bytearray|0x42)\\b"},{token:"variable.language.source.move",regex:"\\bSelf\\b"},{token:"comment.line.doc.source.move",regex:"//!.*$"},{token:"comment.line.double-dash.source.move",regex:"//.*$"},{token:"comment.start.block.source.move",regex:"/\\*",stateName:"comment",push:[{token:"comment.start.block.source.move",regex:"/\\*",push:"comment"},{token:"comment.end.block.source.move",regex:"\\*/",next:"pop"},{defaultToken:"comment.block.source.move"}]},{token:"keyword.operator",regex:/\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/},{token:"punctuation.operator",regex:/[?:,;.#]/},{token:"paren.lparen",regex:/[\[({]/},{token:"paren.rparen",regex:/[\])}]/},{token:"constant.language.source.move",regex:"\\b(?:true|false|Some|None|Ok|Err)\\b"},{token:"support.constant.source.move",regex:"\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b"},{token:"meta.preprocessor.source.move",regex:"\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b"},{token:"constant.numeric.source.move",regex:/\b(?:0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*(?!\.))(?:[iu](?:size|8|16|32|64|128))?\b/},{token:"constant.numeric.source.move",regex:/\b(?:[0-9][0-9_]*)(?:\.[0-9][0-9_]*)?(?:[Ee][+-][0-9][0-9_]*)?(?:f32|f64)?\b/}]},this.normalizeRules()};o.metaData={fileTypes:["mvir"],foldingStartMarker:"^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$",foldingStopMarker:"^\\s*\\}",name:"Move",scopeName:"source.move"},r.inherits(o,i),t.MoveHighlightRules=o}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/move",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/move_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./move_highlight_rules").MoveHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../range").Range,a=e("../worker/worker_client").WorkerClient,f=e("./behaviour/cstyle").CstyleBehaviour,l=e("./folding/cstyle").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"){var u=t.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc_comment"){if(o=="start")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/move"}.call(c.prototype),t.Mode=c})
7,843
7,843
0.680607
f6f5292e616229ad43f93690b7738d48bb47b32f
1,072
js
JavaScript
src/utils/Color.js
yuko1101/hypixel-api-reborn
5652f96aef447de781a74ae7d6fb9b3fa9e68e35
[ "MIT" ]
1
2020-10-04T07:31:15.000Z
2020-10-04T07:31:15.000Z
src/utils/Color.js
yuko1101/hypixel-api-reborn
5652f96aef447de781a74ae7d6fb9b3fa9e68e35
[ "MIT" ]
null
null
null
src/utils/Color.js
yuko1101/hypixel-api-reborn
5652f96aef447de781a74ae7d6fb9b3fa9e68e35
[ "MIT" ]
null
null
null
const ColorString = { BLACK: 'Black', DARK_BLUE: 'Dark Blue', DARK_GREEN: 'Dark Green', DARK_AQUA: 'Dark Aqua', DARK_RED: 'Dark Red', DARK_PURPLE: 'Dark Purple', GOLD: 'Gold', GRAY: 'Gray', DARK_GRAY: 'Dark Gray', BLUE: 'Blue', GREEN: 'Green', AQUA: 'Aqua', RED: 'Red', LIGHT_PURPLE: 'Light Purple', YELLOW: 'Yellow', WHITE: 'White' }; const ColorCode = { BLACK: '§0', DARK_BLUE: '§1', DARK_GREEN: '§2', DARK_AQUA: '§3', DARK_RED: '§4', DARK_PURPLE: '§5', GOLD: '§6', GRAY: '§7', DARK_GRAY: '§8', BLUE: '§9', GREEN: '§a', AQUA: '§b', RED: '§c', LIGHT_PURPLE: '§d', YELLOW: '§e', WHITE: '§f' }; const ColorHex = { BLACK: '#000000', DARK_BLUE: '#0000AA', DARK_GREEN: '#008000', DARK_AQUA: '#00AAAA', DARK_RED: '#AA0000', DARK_PURPLE: '#AA00AA', GOLD: '#FFAA00', GRAY: '#AAAAAA', DARK_GRAY: '#555555', BLUE: '#5555FF', GREEN: '#3CE63C', AQUA: '#3CE6E6', RED: '#FF5555', LIGHT_PURPLE: '#FF55FF', YELLOW: '#FFFF55', WHITE: '#FFFFFF' }; module.exports = { ColorString: ColorString, ColorHex: ColorHex, ColorCode: ColorCode };
17.57377
30
0.60541
f6f56df048b886ee95d4a48aa9a28dc0955d92ce
2,875
js
JavaScript
resources/js/store/playlists.module.js
Temurbekjonbtz/spotify
96b2661212798221cf923fc6c7c3630fc812df6f
[ "MIT" ]
1
2021-09-17T10:15:25.000Z
2021-09-17T10:15:25.000Z
resources/js/store/playlists.module.js
Temurbekjonbtz/spotify
96b2661212798221cf923fc6c7c3630fc812df6f
[ "MIT" ]
null
null
null
resources/js/store/playlists.module.js
Temurbekjonbtz/spotify
96b2661212798221cf923fc6c7c3630fc812df6f
[ "MIT" ]
null
null
null
import { CREATE_PLAYLIST, DELETE_PLAYLIST, DELETE_SONG_FROM_PLAYLIST, FETCH_PLAYLIST, FETCH_PLAYLISTS, FETCH_PLAYLIST_SONGS, INSERT_SONG_TO_PLAYLIST } from "./actions.type" import ApiService from "../common/api.service"; import { ADD_PLAYLIST, DELETE_SONG, SET_PLAYLIST, SET_PLAYLISTS, SET_SONGS } from "./mutations.type"; import { GET_PLAYLIST, GET_PLAYLISTS } from "./getters.type"; import Exception from "../common/Exception"; const state={ playlists:[], playlist:null, songs:[] } const actions={ async [CREATE_PLAYLIST](context, playlist){ var newPlaylist={ name:playlist } try{ const data=await ApiService.post('api/playlist',newPlaylist) context.commit(ADD_PLAYLIST,data.data.data) }catch(e){ Exception.handle(e) } }, async [FETCH_PLAYLISTS](context){ try{ const data=await ApiService.get(`api/playlist`) context.commit(SET_PLAYLISTS,data.data.data) }catch(e){ Exception.handle(e) } }, async [FETCH_PLAYLIST](context,id){ try{ const data=await ApiService.get(`api/playlist/${id}`) context.commit(SET_PLAYLIST,data.data.data) } catch(e){ Exception.handle(e) } }, async [FETCH_PLAYLIST_SONGS](context, id){ try{ const data=await ApiService.get(`/api/playlistsongs/${id}`) context.commit(SET_SONGS,data.data.data) } catch(e){ Exception.handle(e) } }, async [INSERT_SONG_TO_PLAYLIST](context,data){ try{ const response=await ApiService.post("/api/playlistsongs",data) if(response.data.response){ alert(response.data.response) } } catch(e){ Exception.handle(e) } }, async [DELETE_SONG_FROM_PLAYLIST](context,data){ var x=data try{ const response=await ApiService.delete("/api/playlistsongs",{data}) context.commit(DELETE_SONG,x.song) if(response.response){ alert(response.response) } } catch(e){ Exception.handle(e) } }, async [DELETE_PLAYLIST](context,id){ try{ await ApiService.delete(`/api/playlist/${id}`) alert("Playlist has been deleted") } catch(e){ Exception.handle(e) } } } const mutations={ [SET_PLAYLISTS](state,data){ state.playlists=data }, [ADD_PLAYLIST](state,data){ state.playlists.push(data) }, [SET_PLAYLIST](state,data){ state.playlist=data }, [SET_SONGS](state, data){ state.songs=data }, [DELETE_SONG](state,id){ var i=0 var index=-1; while(i!==state.songs.length){ if(state.songs[i].id===id){ index=i } ++i } state.songs.splice(index,1) }, } const getters={ [GET_PLAYLIST]:state=>{ return state.playlist }, [GET_PLAYLISTS]:state=>{ return state.playlists } } export default{ state, actions, mutations, getters }
20.390071
172
0.636174
f6f5ca315e30b878d08cd9aedd68102d539c1fa9
5,294
js
JavaScript
specs/models_spec/branch_spec/update_opened_merge_requests_spec.js
brunabxs/gitlab-dashboard
9fce93f5d578991be757e750b7d27c19f664cb31
[ "MIT" ]
18
2017-08-17T12:54:53.000Z
2021-02-11T12:04:01.000Z
specs/models_spec/branch_spec/update_opened_merge_requests_spec.js
brunabxs/gitlab-dashboard
9fce93f5d578991be757e750b7d27c19f664cb31
[ "MIT" ]
13
2017-11-07T16:55:32.000Z
2019-07-18T02:51:10.000Z
specs/models_spec/branch_spec/update_opened_merge_requests_spec.js
brunabxs/gitlab-dashboard
9fce93f5d578991be757e750b7d27c19f664cb31
[ "MIT" ]
2
2018-09-21T19:40:37.000Z
2021-04-12T09:51:30.000Z
var sinon = require('sinon'); var Branch = require('../../../app/models/branch.js'); var MergeRequest = require('../../../app/models/merge_request.js'); var Vcs = require('../../../app/models/vcs.js'); describe('Branch updateOpenedMergeRequests function', function () { var vcs; var getOpenedMergeRequestsStub; var branch; var projectId = 123; var branchId = 'name1'; var expectedError = new Error('error'); var rawMR1 = { id: 123, target_branch: branchId, source_branch: 2, upvotes: 3, downvotes: 4, web_url: 'url' }; var rawMR2 = { id: 456, target_branch: branchId, source_branch: 2, upvotes: 3, downvotes: 4, web_url: 'url' }; var rawMR3 = { id: 789, target_branch: branchId, source_branch: 2, upvotes: 3, downvotes: 4, web_url: 'url' }; var rawMR4 = { id: 999, target_branch: branchId, source_branch: 2, upvotes: 3, downvotes: 4, web_url: 'url' }; var mergeRequest1 = new MergeRequest(vcs, rawMR1.id, rawMR1.target_branch, rawMR1.source_branch, rawMR1.upvotes, rawMR1.downvotes, rawMR1.web_url); var mergeRequest2 = new MergeRequest(vcs, rawMR2.id, rawMR2.target_branch, rawMR2.source_branch, rawMR2.upvotes, rawMR2.downvotes, rawMR2.web_url); var mergeRequest3 = new MergeRequest(vcs, rawMR3.id, rawMR3.target_branch, rawMR3.source_branch, rawMR3.upvotes, rawMR3.downvotes, rawMR3.web_url); var mergeRequest4 = new MergeRequest(vcs, rawMR4.id, rawMR4.target_branch, rawMR4.source_branch, rawMR4.upvotes, rawMR4.downvotes, rawMR4.web_url); beforeEach(function () { vcs = new Vcs(); getOpenedMergeRequestsStub = sinon.stub(vcs, 'getOpenedMergeRequests'); branch = new Branch(vcs, projectId, branchId, 'name1', true); }); it('must only add merge requests that were not added before', function (done) { // Arrange var expected = [mergeRequest4, mergeRequest2, mergeRequest1, mergeRequest3]; branch.openedMergeRequests.add(mergeRequest4); branch.openedMergeRequests.add(mergeRequest2); getOpenedMergeRequestsStub .withArgs(projectId, undefined, branchId) .resolves([rawMR1, rawMR2, rawMR3, rawMR4]); // Act var promise = branch._updateOpenedMergeRequests(); // Assert promise .then(function () { expect(branch.openedMergeRequests.length()).toEqual(expected.length); for (var i = 0; i < expected.length; ++i) { expect(branch.openedMergeRequests.get(i).id).toEqual(expected[i].id); expect(branch.openedMergeRequests.get(i).sourceBranchId).toEqual(expected[i].sourceBranchId); expect(branch.openedMergeRequests.get(i).targetBranchId).toEqual(expected[i].targetBranchId); expect(branch.openedMergeRequests.get(i).upvotes).toEqual(expected[i].upvotes); expect(branch.openedMergeRequests.get(i).downvotes).toEqual(expected[i].downvotes); expect(branch.openedMergeRequests.get(i).url).toEqual(expected[i].url); } }) .catch(function (error) { expect(error).toBeUndefined(); }) .finally(done); }); it('must remove merge requests that were not retrieved', function (done) { // Arrange var expected = [mergeRequest3, mergeRequest1]; branch.openedMergeRequests.add(mergeRequest4); branch.openedMergeRequests.add(mergeRequest3); branch.openedMergeRequests.add(mergeRequest2); branch.openedMergeRequests.add(mergeRequest1); getOpenedMergeRequestsStub .resolves([rawMR1, rawMR3]); // Act var promise = branch._updateOpenedMergeRequests(); // Assert promise .then(function () { expect(branch.openedMergeRequests.length()).toEqual(expected.length); for (var i = 0; i < expected.length; ++i) { expect(branch.openedMergeRequests.get(i).id).toEqual(expected[i].id); expect(branch.openedMergeRequests.get(i).sourceBranchId).toEqual(expected[i].sourceBranchId); expect(branch.openedMergeRequests.get(i).targetBranchId).toEqual(expected[i].targetBranchId); expect(branch.openedMergeRequests.get(i).upvotes).toEqual(expected[i].upvotes); expect(branch.openedMergeRequests.get(i).downvotes).toEqual(expected[i].downvotes); expect(branch.openedMergeRequests.get(i).url).toEqual(expected[i].url); } }) .catch(function (error) { expect(error).toBeUndefined(); }) .finally(done); }); it('must return the error if any occurs when retrieving branches from vcs', function (done) { // Arrange getOpenedMergeRequestsStub .rejects(expectedError); // Act var promise = branch._updateOpenedMergeRequests(); // Assert promise .then(function () { fail('An error was expected'); }) .catch(function (error) { expect(error).toEqual(expectedError); }) .finally(done); }); });
47.267857
151
0.626747
f6f66753d2c48552781ffbda18dc3d2e79d97bfc
2,388
js
JavaScript
html/_lib/focus.js
arthurzenika/zenika-a11y-components
1241fe97fabb8f8989e1f8bdeec9464ce65a5423
[ "Apache-2.0" ]
null
null
null
html/_lib/focus.js
arthurzenika/zenika-a11y-components
1241fe97fabb8f8989e1f8bdeec9464ce65a5423
[ "Apache-2.0" ]
null
null
null
html/_lib/focus.js
arthurzenika/zenika-a11y-components
1241fe97fabb8f8989e1f8bdeec9464ce65a5423
[ "Apache-2.0" ]
null
null
null
// Focus trap state ----------------------------------------------------------- let FOCUS_TRAP = null let FOCUS_DIRECTION = 'first' let FOCUS_FN = null // Get focus direction out of keyboard events --------------------------------- document.addEventListener('keydown', (e) => e.key === 'Tab' && (FOCUS_DIRECTION = (e.shiftKey && 'last') || 'first')) document.addEventListener('keyup', (e) => e.key === 'Tab' && (FOCUS_DIRECTION = 'first')) // Utils ---------------------------------------------------------------------- /** Try to focus a child on a given node. * * @param {HTMLElement} node * The parent where to focus a child * @param {`first`|`last`} firstOrLast * The child to focus, either the first or the last focusable one * @returns {boolean} */ function focusChild(node, firstOrLast) { const children = Array.from(node.children) if (firstOrLast === 'last') { children.reverse() } return children.some((child) => ( FOCUS_FN.call(child) || document.activeElement === child || focusChild(child, firstOrLast) )) } // Main API ------------------------------------------------------------------- /** Release the focus from the current trap * @param {boolean} restoreOriginalFocus */ export function release(restoreOriginalFocus) { FOCUS_TRAP?.(restoreOriginalFocus) // eslint-disable-line new-cap } /** Trap the focus inside a given node * * @param {HTMLElement} node The node where to trap the focus */ export function trap(node) { if (FOCUS_TRAP) { throw new Error('The focus is already trapped, you must release it first') } // Programmatic focus does not trigger focus events, so // we need to make sure it won't mess up with our trap. FOCUS_FN = HTMLElement.prototype.focus HTMLElement.prototype.focus = () => {} const originalFocus = document.activeElement const originalTabIndex = node.tabIndex node.tabIndex = 0 FOCUS_FN.call(node) const focusin = (e) => ( !node.contains(e.target) && (focusChild(node, FOCUS_DIRECTION) || FOCUS_FN.call(node)) ) document.addEventListener('focus', focusin, true) FOCUS_TRAP = (restoreOriginalFocus) => { HTMLElement.prototype.focus = FOCUS_FN node.tabIndex = originalTabIndex document.removeEventListener('focus', focusin, true) if (restoreOriginalFocus) { FOCUS_FN.call(originalFocus) } FOCUS_TRAP = null } }
29.481481
79
0.619765
f6f67c83f729be1ebbce160801117d004dd4691c
3,996
js
JavaScript
src/views/GalleryPage/GalleryPage.js
antarikshray/websiterudra
7043525ac75866c829f065b63645bdd95ae98138
[ "MIT" ]
null
null
null
src/views/GalleryPage/GalleryPage.js
antarikshray/websiterudra
7043525ac75866c829f065b63645bdd95ae98138
[ "MIT" ]
null
null
null
src/views/GalleryPage/GalleryPage.js
antarikshray/websiterudra
7043525ac75866c829f065b63645bdd95ae98138
[ "MIT" ]
null
null
null
import React, { useState, useCallback, useEffect } from "react"; import DelayLink from 'react-delay-link'; // @material-ui/core components import { makeStyles } from "@material-ui/core/styles"; import Gallery from 'react-photo-gallery'; import Carousel, { Modal, ModalGateway } from "react-images"; import photos from "../GalleryPage/components/photo"; import Home from "@material-ui/icons/Home"; const useStyles = makeStyles({ container: { display: 'flex', alignItems: 'center', justifyContent: 'center' }, navBar: { position: 'fixed', top: '0px', left: '0px', height: '6vh', width: '100vw', backgroundColor: 'white', display: 'flex', alignItems: 'center', justifyContent: 'space-around' }, mainCard: { marginTop: '8vh', width: '92vw' }, title: { fontSize: '2em', color: '#fc4267' }, brand: { fontFamily: 'nordi', fontSize: '2em', color: '#fc4267', }, load1: { position: 'fixed', height: '120vh', width: '50vw', backgroundColor: '#bababa', zIndex: '1000000', transition: '2s ease-in-out', }, load2: { position: 'fixed', height: '120vh', width: '50vw', backgroundColor: '#bababa', zIndex: '1000000', transition: '2s ease-in-out', }, load3: { position: 'fixed', height: '120vh', marginLeft: '50vw', width: '50vw', backgroundColor: '#454545', zIndex: '1000000', transition: '2s ease-in-out', }, }); export default function GalleryPage(props) { const classes = useStyles(); const [currentImage, setCurrentImage] = useState(0); const [viewerIsOpen, setViewerIsOpen] = useState(false); const openLightbox = useCallback((event, { photo, index }) => { setCurrentImage(index); setViewerIsOpen(true); }, []); const closeLightbox = () => { setCurrentImage(0); setViewerIsOpen(false); }; useEffect(() => { setTimeout(function () { document.getElementById('load1').style.width = '0px'; document.getElementById('load2').style.height = '0px'; }, 2000); setTimeout(function () { document.getElementById('load3').style.height = '0px'; }, 3000); }); return ( <div> <div id="load1" className={classes.load1}> </div> <div id="load2" className={classes.load2}> </div> <div id="load3" className={classes.load3}> </div> <div className={classes.navBar}> <DelayLink delay={1800} to="/" clickAction={() => { document.getElementById('load1').style.width = '50vw'; document.getElementById('load2').style.height = '120vh'; setTimeout(function () { document.getElementById('load3').style.height = '120vh'; }, 500); }}> <Home style={{ fontSize: '2em', color: "#fc4267" }} /> </DelayLink> <div className={classes.title}> Gallery </div> <DelayLink delay={1800} to="/" clickAction={() => { document.getElementById('load1').style.width = '50vw'; document.getElementById('load2').style.height = '120vh'; setTimeout(function () { document.getElementById('load3').style.height = '120vh'; }, 500); }}> <div className={classes.brand}> rudra </div> </DelayLink> </div> <div className={classes.container}> <div className={classes.mainCard}> <Gallery margin={7} photos={photos} onClick={openLightbox} /> <ModalGateway> {viewerIsOpen ? ( <Modal onClose={closeLightbox}> <Carousel currentIndex={currentImage} views={photos.map(x => ({ ...x, srcset: x.srcSet, caption: x.title }))} /> </Modal> ) : null} </ModalGateway> </div> </div> </div > ); }
26.818792
71
0.554054
f6f6b74a255d4df2e55a04691b0fdce500570136
41,016
js
JavaScript
client/src/views/components/Selectable.js
AlulaLeak/sports-betting-app
643a1af9b89858480af4b1adf398fc56c7a1f98e
[ "MIT" ]
null
null
null
client/src/views/components/Selectable.js
AlulaLeak/sports-betting-app
643a1af9b89858480af4b1adf398fc56c7a1f98e
[ "MIT" ]
null
null
null
client/src/views/components/Selectable.js
AlulaLeak/sports-betting-app
643a1af9b89858480af4b1adf398fc56c7a1f98e
[ "MIT" ]
null
null
null
import React from "react"; import ModalMessage from "./ModalMessage"; import { useState } from "react"; import "../../styles/game.css"; function Selectable(props) { const BET_PLACED = "BET_PLACED"; const SELECTABLE = "SELECTABLE"; const [modalShow, setModalShow] = useState(false); const { awayScore, homeScore, teamsPlaying, currentPeriods, periodTimeRemaining, awayMoneylineOdds, homeMoneylineOdds, awaySpread, homeSpread, awaySpreadOdds, homeSpreadOdds, overOdds, underOdds, pointsForTotalOdds, league, transition, homeTeam, awayTeam, addToBetSlipArray, betSlipArray, gameId, } = props; const awayMl = { odds: awayMoneylineOdds, betOn: "AWAY", teamsPlaying: teamsPlaying, typeOfBet: "moneyline", gameId: gameId, }; const homeMl = { odds: homeMoneylineOdds, betOn: "HOME", teamsPlaying: teamsPlaying, typeOfBet: "moneyline", gameId: gameId, }; const awaySp = { odds: awaySpreadOdds, spread: awaySpread, betOn: "AWAY", teamsPlaying: teamsPlaying, typeOfBet: "spread", gameId: gameId, }; const homeSp = { odds: homeSpreadOdds, spread: homeSpread, betOn: "HOME", teamsPlaying: teamsPlaying, typeOfBet: "spread", gameId: gameId, }; const totalOver = { odds: overOdds, betOn: "OVER", total: pointsForTotalOdds, teamsPlaying: teamsPlaying, typeOfBet: "total", gameId: gameId, }; const totalUnder = { odds: underOdds, total: pointsForTotalOdds, betOn: "UNDER", teamsPlaying: teamsPlaying, typeOfBet: "total", gameId: gameId, }; function confirmBet(betToAdd) { let exists = false; betSlipArray.map((bet) => { if (bet.gameId === betToAdd.gameId) { exists = true; setModalShow(true); } }); if (!exists) { transition(BET_PLACED); addToBetSlipArray(betToAdd); setTimeout(function () { transition(SELECTABLE); }, 4000); } } return ( <div className="fixture-card"> {league === "NBA" && ( <div> <svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" id="body_1" width="24" height="50" > <g transform="matrix(0.08664542 0 0 0.08664542 -0 0.34825283)"> <path d="M0 0L276.991 0L276.991 569.026L0 569.026L0 0z" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> <path d="M197.43 503.7C 197.92699 495.67102 197.762 493.022 196.676 491.71503C 195.85199 490.72104 195.26799 487.62204 195.24399 484.10602C 195.208 478.78003 194.49298 476.79102 188.23799 464.64502C 181.564 451.68002 181.325 450.97202 182.51099 447.69302C 183.61598 444.63303 183.45898 443.605 181.04099 438.02902C 178.62898 432.467 177.54399 431.25504 171.08398 426.89502C 158.55199 418.43802 148.47998 409.81503 131.70699 393.19C 112.98199 374.62302 97.43498 354.208 83.01799 329.253C 78.01199 320.589 77.61999 320.229 73.19799 320.206C 69.87799 320.189 65.89099 317.293 65.90599 314.905C 65.90999 314.213 61.846992 305.263 56.87699 295.019C 43.978992 268.433 42.87599 262.771 46.819992 243.41301C 49.16099 231.93501 49.60099 230.90302 54.482994 225.49802C 59.665993 219.76302 58.852993 218.14801 50.363995 217.30902C 39.022995 216.18602 39.138992 216.25702 36.787994 208.98003C 35.631996 205.40103 34.685993 201.34503 34.685993 199.96703C 34.685993 195.40002 39.871994 180.94702 47.00199 165.64203C 50.86999 157.33603 55.82999 146.00903 58.02299 140.47102C 65.82599 120.76302 76.59099 105.00502 85.28299 100.57002C 88.75799 98.79702 95.51199 97.46402 115.61099 94.581024C 126.798996 92.97602 127.58699 92.163025 129.194 80.567024C 130.129 73.82302 130.036 72.76602 128.27 69.90602C 126.996 67.84602 126.30801 64.93002 126.30801 61.592022C 126.30801 56.89802 126.57101 56.31502 129.32901 54.889023C 131.99501 53.511024 132.35 52.804024 132.35 48.872025C 132.35 39.466026 134.24701 34.229027 139.526 29.095024C 140.78659 27.874973 142.01027 26.617962 143.196 25.325024L143.196 25.325024L74.065 25.325024C 50.583 25.325024 31.545002 44.362022 31.545002 67.845024L31.545002 67.845024L31.545002 501.43103C 31.545002 524.913 50.582 543.952 74.065 543.952L74.065 543.952L200.55 543.952C 200.123 543.01105 199.231 541.487 198.196 539.978C 195.318 535.789 195.35 537.26 197.43 503.7z" stroke="none" fill="#0E499D" fillRule="nonzero" /> <path d="M203.236 25.325L166.62099 25.325C 166.97998 25.752 167.49799 26.211 168.12799 26.624C 172.65599 29.59 179.52399 36.735 180.62 39.618C 182.269 43.959 181.898 49.725 179.56999 55.951C 178.232 59.525 177.66899 62.723 178.047 64.607C 178.759 68.168 175.262 75.717 171.121 79.557C 169.628 80.941 167.51201 83.817 166.419 85.949C 165.326 88.079994 162.613 91.797 160.393 94.207C 158.173 96.617004 156.504 99.359 156.69 100.3C 156.87401 101.242004 159.516 103.353004 162.561 104.992004C 165.608 106.631004 170.167 109.84701 172.696 112.13901C 175.22299 114.43101 180.326 118.451004 184.035 121.07201C 197.362 130.49301 203.757 146.602 203.823 170.92001C 203.852 181.69601 209.108 206.95302 212.873 214.41202C 218.03 224.62802 219.897 230.26001 221.511 240.45502C 223.58301 253.55602 223.646 253.70401 227.812 255.44402C 231.793 257.108 242.105 265.479 242.105 267.048C 242.105 267.588 243.125 269.458 244.37 271.20502L244.37 271.20502L245.76 273.152L245.76 67.844C 245.756 44.361 226.719 25.325 203.236 25.325zM245.122 310.04102C 245.122 310.55103 242.87999 313.42 240.14099 316.41803C 221.03699 337.31802 188.342 332.66202 176.34 307.32803C 173.43599 301.19604 173.133 299.65604 173.133 290.99304C 173.133 282.72205 173.499 280.64804 175.831 275.67004C 179.56 267.71405 186.678 260.42606 194.459 256.59406C 197.999 254.85205 201.105 253.09006 201.357 252.67805C 201.611 252.26706 198.416 245.05505 194.25499 236.64905C 184.672 217.28404 183.53699 213.82104 179.189 190.69005C 177.222 180.23505 175.411 171.11604 175.15999 170.42305C 174.355 168.19405 171.54199 169.06305 164.58499 173.68704L164.58499 173.68704L157.77899 178.21104L151.611 193.83405C 148.21999 202.42505 145.443 210.73204 145.443 212.29105C 145.443 214.04605 146.441 216.05804 148.056 217.56804C 152.087 221.33504 153.175 224.10104 160.007 247.96603C 165.041 265.54602 166.16301 270.68204 165.36101 272.44702C 164.59001 274.135 165.09001 277.84003 167.408 287.618C 170.81601 302.006 172.087 309.631 173.67601 325.224C 175.287 341.053 176.99101 346.068 186.16202 361.974C 192.25902 372.545 194.13101 378.917 198.41202 403.667C 200.37602 415.024 202.35902 425.021 202.82002 425.88098C 203.28203 426.74097 205.27702 429.852 207.25502 432.791C 212.69302 440.874 213.51402 444.593 211.55902 452.37097C 210.66502 455.92398 209.65501 461.27698 209.31302 464.26697C 208.62602 470.25098 210.79202 484.74496 213.25102 490.63196C 214.08202 492.61896 214.53302 495.11395 214.25603 496.17795C 213.97702 497.24194 215.14102 502.55994 216.83902 507.99493C 222.15202 524.9929 221.91702 532.20294 215.79802 539.92993C 214.70203 541.3139 214.11302 542.10095 213.76202 542.63196C 232.15303 537.94794 245.75603 521.27795 245.75603 501.42795L245.75603 501.42795L245.75603 309.186C 245.38702 309.323 245.12202 309.652 245.12202 310.04102z" stroke="none" fill="#D30529" fillRule="nonzero" /> <path d="M46.676 448.242L63.864998 448.242L73.781 492.077L73.947 492.077L73.947 448.242L88.326 448.242L88.326 519.374L71.468 519.374L61.221 475.43903L61.055 475.43903L61.055 519.374L46.676 519.374L46.676 448.242zM95.768 448.242L118.991 448.242C 129.982 448.242 135.105 455.315 135.105 465.974C 135.105 473.545 132.377 480.32098 125.85 481.913L125.85 481.913L125.85 482.112C 133.618 483.008 136.759 490.979 136.759 498.35C 136.759 510.704 131.801 519.37103 118.991005 519.37103L118.991005 519.37103L95.768 519.37103L95.768 448.24203zM111.139 476.137L114.859 476.137C 117.999 476.137 119.735 472.75 119.735 468.964C 119.735 464.979 117.999 461.59198 114.859 461.59198L114.859 461.59198L111.139 461.59198L111.139 476.137zM111.139 506.024L115.437 506.024C 118.246994 506.024 120.891 503.03497 120.891 497.25598C 120.891 491.77698 118.246 488.689 115.437 488.689L115.437 488.689L111.139 488.689L111.139 506.024zM152.057 448.242L171.395 448.242L185.774 519.374L169.41 519.374L167.84 506.92102L155.61 506.92102L154.041 519.374L137.675 519.374L152.057 448.242zM161.807 462.78702L161.643 462.78702L157.42801 492.97403L166.022 492.97403L161.807 462.78702z" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> </g> </svg> </div> )} {league === "NHL" && ( <div> <svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" id="body_1" width="67" height="50" > <defs> <linearGradient transform="matrix(9.913 0 0 9.913 0.883 41.44)" id="1" x1="165.647" y1="0" x2="188.172" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(-0 -28.25 28.25 0 76.92 45.48)" id="240" x1="372.118" y1="0" x2="394.353" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(38.05 0 0 38.05 3.17 77.82)" id="483" x1="170.26701" y1="0" x2="280.00003" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(-45.12 -64.42 64.42 -45.12 63.8 75.89)" id="727" x1="181.81902" y1="0" x2="378.183" y2="0" > <stop stopColor="#949CA1" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(24.95 0 0 24.95 16.27 7.3)" id="980" x1="208.097" y1="0" x2="280.001" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(39.58 0 0 39.58 41.22 68.56)" id="1219" x1="280.001" y1="0" x2="394.355" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(24.95 0 0 24.95 41.22 7.3)" id="1461" x1="280.00006" y1="0" x2="352.19302" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> <linearGradient transform="matrix(15.86 0 0 15.86 1.67 10.54)" id="1705" x1="165.93599" y1="0" x2="211.562" y2="0" > <stop stopColor="#FFFFFF" offset="0%" /> <stop stopColor="#949CA1" offset="100%" /> </linearGradient> </defs> <g transform="matrix(0.119642854 0 0 0.119642854 -0 1.0714295)"> <path d="M173.733 228.444C 173.733 203.899 185.284 194.658 187.594 171.268C 184.418 191.77101 170.845 208.231 170.845 228.444C 170.845 236.241 172 243.171 173.733 249.524C 182.107 277.823 207.519 293.417 231.776 299.77C 194.525 290.241 173.733 258.47598 173.733 228.444zM388.867 228.444C 388.867 215.738 385.402 205.631 381.648 196.39099C 377.028 185.418 372.11902 175.31099 372.11902 162.89398C 372.11902 192.63698 386.269 201.29999 386.269 228.44498C 386.269 258.477 365.76602 290.24197 328.226 299.77097C 362.01202 291.10797 388.868 266.27396 388.868 228.44498z" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> <path d="M376.449 109.471C 368.652 107.161 363.16602 101.385 359.7 92.145004L359.7 92.145004L352.19202 70.776L348.43802 84.348C 355.946 117.557 383.09003 119.867004 383.09003 119.867004L383.09003 119.867004L394.06302 114.66901L376.44803 109.47101L376.449 109.471zM247.658 230.466L233.50801 208.519L217.626 220.359C 217.626 220.359 223.113 220.648 223.113 226.42299L223.113 226.42299L223.113 267.71698L234.375 259.343L234.375 230.17699L247.081 249.81299L258.921 240.861L258.921 189.45999L247.659 197.83398L247.659 230.46498zM293.284 182.53L280.578 192.059L280.578 173L263.54102 185.706C 263.54102 185.706 269.028 185.995 269.028 191.76999L269.028 191.76999L269.028 233.064L280.579 224.401L280.579 205.631L293.285 196.10199L293.285 215.161L304.258 207.075L304.258 155.385L293.285 163.75899L293.285 182.52899zM325.049 177.91L325.049 139.504L308.01202 152.20999C 308.01202 152.20999 313.49902 152.499 313.49902 158.27399L313.49902 158.27399L313.49902 199.568L345.26404 175.59999C 344.68604 167.51399 345.26404 162.605 345.26404 162.605L345.26404 162.605L325.05005 177.91z" stroke="none" fill="#E4E5E6" fillRule="nonzero" /> <path d="M180.086 162.893C 180.086 192.059 165.647 197.83401 165.647 228.444C 165.647 237.685 167.091 246.637 169.979 254.433C 170.845 252.7 172.289 250.679 173.733 249.524C 171.712 243.171 170.845 236.241 170.845 228.444C 170.845 208.519 184.417 191.77 187.594 171.268C 187.883 168.669 187.883 165.781 187.883 162.89401C 188.172 139.50401 176.91 119.86701 176.91 119.86701L176.91 119.86701L165.93701 114.669014L173.445 131.70601C 177.199 140.369 180.087 151.05402 180.087 162.893L180.087 162.893L180.086 162.893z" stroke="none" fill="url(#1)" /> <path d="M372.118 162.893C 372.118 175.31 377.027 185.128 381.647 196.39001L381.647 196.39001L387.711 196.10101C 383.957 186.86002 380.203 177.90802 380.203 162.89201C 380.203 151.05202 383.091 140.36801 386.845 131.70502L386.845 131.70502L394.353 114.668015L383.091 119.86601C 383.091 119.86601 372.118 139.50201 372.118 162.893z" stroke="none" fill="url(#240)" /> <path d="M271.337 308.722C 262.385 305.546 249.968 304.38998 232.06401 299.77C 207.51901 293.706 182.39601 277.823 174.02101 249.52399C 172.57701 250.96799 171.13301 252.69998 170.26701 254.43298C 179.79602 281.577 204.05301 300.636 230.04202 307.567C 246.79102 311.899 254.58702 312.18698 267.00504 315.65298C 268.73804 317.386 280.00003 329.80298 280.00003 329.80298L280.00003 329.80298L280.00003 317.96298C 280.00003 317.96298 272.49203 309.589 271.33704 308.722L271.33704 308.722L271.337 308.722z" stroke="none" fill="url(#483)" /> <path d="M234.086 291.684C 254.011 296.593 267.00598 297.171 275.669 301.50198C 275.669 301.50198 278.845 304.38998 280.001 305.83398C 281.156 304.38998 284.333 301.50198 284.333 301.50198C 292.996 297.16998 305.991 296.593 325.91602 291.684C 351.039 285.331 378.183 263.09598 378.183 228.443C 378.183 203.609 364.03302 194.368 364.03302 162.892C 364.03302 141.523 372.11902 125.063 372.11902 125.063C 372.11902 125.063 353.63803 121.309006 344.975 97.91901C 344.975 97.91901 332.558 109.47001 315.52002 109.47001C 294.15103 109.47001 280.001 94.45401 280.001 94.45401C 280.001 94.45401 265.851 109.47001 244.48201 109.47001C 227.445 109.47001 215.02701 97.91901 215.02701 97.91901C 206.36401 121.309006 187.88301 125.063 187.88301 125.063C 187.88301 125.063 195.96901 141.52301 195.96901 162.892C 195.96901 194.368 181.81902 203.609 181.81902 228.443C 181.81902 263.384 208.96301 285.331 234.08601 291.684L234.08601 291.684L234.086 291.684zM369.22998 228.443C 369.22998 257.89798 345.83997 277.245 323.89297 283.021C 308.011 287.064 288.95197 289.085 282.88797 292.55C 281.44397 293.416 279.99997 295.149 279.99997 295.149C 279.99997 295.149 278.26697 293.416 277.11197 292.55C 271.33698 289.374 251.98897 287.063 236.10696 283.021L236.10696 283.021L234.37396 282.443L358.54495 189.16998C 362.87695 204.18599 369.22894 213.71498 369.22894 228.44298zM360.27798 130.26099C 357.679 137.76898 354.791 149.60898 354.791 162.89198C 354.791 168.37898 355.08 173.57599 355.94598 177.90799L355.94598 177.90799L222.82298 277.822C 206.07397 269.159 191.63599 252.69899 190.76999 230.17499L190.76999 230.17499L343.818 115.24499C 349.305 122.75299 355.369 127.372986 360.27798 130.26099zM205.20898 162.89198C 205.20898 149.31998 202.32098 137.76898 199.72198 130.26099C 205.49698 127.084984 213.00499 121.30899 218.78099 111.49098C 225.13399 114.95598 234.086 118.709984 244.482 118.709984C 260.36398 118.709984 272.781 111.77998 280.001 106.581985C 287.22 111.77998 299.637 118.709984 315.52002 118.709984C 318.11902 118.709984 320.42902 118.42098 322.739 118.13198L322.739 118.13198L192.50401 215.73598C 196.25801 201.00897 205.21 188.87997 205.21 162.89098z" stroke="none" fill="url(#727)" /> <path d="M244.482 101.385C 265.85098 101.385 280.001 83.192 280.001 83.192L280.001 83.192L280.001 71.641L268.739 82.614C 262.96402 88.389 253.723 93.009995 244.48201 93.009995C 237.55202 93.009995 230.91 89.83399 225.423 85.213L225.423 85.213L208.097 70.773994L211.851 84.34599C 211.562 84.34599 228.022 101.382996 244.482 101.382996L244.482 101.382996L244.482 101.385z" stroke="none" fill="url(#980)" /> <path d="M388.867 228.444C 388.867 266.273 362.01102 291.107 327.937 299.77C 310.03302 304.38998 297.61603 305.54498 288.664 308.722C 287.509 309.87698 280.001 317.96298 280.001 317.96298L280.001 317.96298L280.001 329.80298C 280.001 329.80298 291.552 317.386 292.996 315.65298C 305.413 312.188 313.21 311.899 329.959 307.567C 363.74503 298.904 394.355 269.44897 394.355 228.44398C 394.355 213.71698 391.17902 204.76498 387.713 196.10199L387.713 196.10199L381.64902 196.39099C 385.403 205.63199 388.868 215.73898 388.868 228.444L388.868 228.444L388.867 228.444z" stroke="none" fill="url(#1219)" /> <path d="M315.519 101.385C 331.979 101.385 348.43903 84.636 348.43903 84.636L348.43903 84.636L352.19302 70.775L334.86703 85.214005C 329.09204 89.83401 322.73904 93.011 315.80804 93.011C 306.56705 93.011 297.32706 88.391 291.55106 82.615005L291.55106 82.615005L280.28906 71.642006L280.28906 82.90401C 280.00006 83.19301 294.15005 101.38501 315.51907 101.38501L315.51907 101.38501L315.519 101.385z" stroke="none" fill="url(#1461)" /> <path d="M211.562 84.348L208.097 70.776L200.3 92.145004C 196.835 101.386 191.348 107.161 183.551 109.47101L183.551 109.47101L165.93599 114.66901L176.909 119.867004C 176.909 119.867004 204.342 117.55701 211.561 84.34801L211.561 84.34801L211.562 84.348z" stroke="none" fill="url(#1705)" /> <path d="M192.503 215.738L322.738 117.84501C 320.428 118.13401 317.829 118.42301 315.519 118.42301C 299.63702 118.42301 287.22 111.49301 280 106.29501C 272.781 111.49301 260.364 118.42301 244.481 118.42301C 234.085 118.42301 225.133 114.958015 218.78 111.20401C 213.005 121.02201 205.497 126.79801 199.721 129.97401C 202.31999 137.48201 205.208 149.32202 205.208 162.60501C 205.208 188.88301 196.256 201.01102 192.502 215.73901L192.502 215.73901L192.503 215.738zM234.375 282.444L236.108 283.022C 251.99 287.065 271.049 289.086 277.113 292.551C 278.557 293.417 280.001 295.15 280.001 295.15C 280.001 295.15 281.734 293.417 282.889 292.551C 288.664 289.375 308.012 287.064 323.894 283.022C 345.841 277.535 369.23102 258.188 369.23102 228.444C 369.23102 213.717 362.87802 204.187 358.54703 189.171L358.54703 189.171L234.37604 282.444zM176.621 162.893C 176.621 190.904 162.183 197.257 162.183 228.444C 162.183 273.203 196.83499 302.658 229.17801 311.03198C 245.34901 315.07498 250.25801 315.36398 264.98502 318.82898C 266.14 319.98398 280.001 334.99997 280.001 334.99997C 280.001 334.99997 293.862 320.27298 295.017 318.82898C 309.744 315.07498 314.65298 315.07498 330.824 311.03198C 363.16602 302.658 397.819 273.20297 397.819 228.44398C 397.819 197.25699 383.38 190.90399 383.38 162.89297C 383.38 152.78598 385.401 142.67897 389.733 133.14998L389.733 133.14998L398.974 112.35898L377.605 106.294975C 370.963 104.27397 366.34302 99.364975 363.16602 91.27898L363.16602 91.27898L353.63702 65.28998L332.26804 82.904976C 326.78104 87.52498 321.00604 89.83498 315.23105 89.83498C 307.72305 89.83498 299.06006 86.08098 293.57306 80.59398L293.57306 80.59398L280.00107 67.02198L266.42908 80.59398C 260.65408 86.36898 252.27908 89.83498 244.77107 89.83498C 239.28407 89.83498 233.50908 87.52498 227.73407 82.904976L227.73407 82.904976L206.36507 65.00098L196.83606 90.989975C 193.94806 99.07597 189.03906 104.27297 182.39706 106.005974L182.39706 106.005974L161.02806 112.64797L170.26906 133.43896C 174.31206 142.67996 176.62206 152.78696 176.62206 162.89397zM183.551 109.47101C 191.34799 107.16101 196.834 101.38501 200.29999 92.145004L200.29999 92.145004L208.09698 70.776L225.42299 85.215004C 231.19798 89.83501 237.551 93.012 244.482 93.012C 253.72299 93.012 262.96298 88.392 268.73898 82.616L268.73898 82.616L280.00098 71.643L291.26297 82.616C 297.03796 88.391 306.27896 93.01199 315.51996 93.01199C 322.44995 93.01199 329.09195 89.83599 334.57895 85.215L334.57895 85.215L351.90494 70.77599L359.70193 92.14499C 363.16693 101.38599 368.65393 107.16099 376.45093 109.47099L376.45093 109.47099L394.06592 114.66899L386.55792 131.706C 382.80392 140.36899 379.91592 150.765 379.91592 162.89299C 379.91592 177.909 383.66992 186.861 387.42392 196.10199C 390.88892 204.76498 394.06592 213.717 394.06592 228.44398C 394.35492 269.44897 363.74493 298.904 329.95892 307.567C 313.20993 311.899 305.4139 312.18698 292.9959 315.65298C 291.2629 317.386 280.00092 329.80298 280.00092 329.80298C 280.00092 329.80298 268.44992 317.386 267.00592 315.65298C 254.58893 312.188 246.79192 311.899 230.04292 307.567C 204.05392 300.925 179.79692 281.866 170.26791 254.43298C 167.37991 246.34698 165.93591 237.68399 165.93591 228.44398C 165.64691 197.83398 180.0859 192.05899 180.0859 162.89297C 180.0859 151.05298 177.1979 140.36897 173.44391 131.70598L173.44391 131.70598L165.93591 114.668976zM222.82399 277.824L355.947 177.91C 355.369 173.29001 354.792 168.381 354.792 162.894C 354.792 149.32199 357.68 137.771 360.279 130.263C 355.37 127.375 349.017 123.044 343.819 115.536L343.819 115.536L190.771 230.466C 191.637 252.99 206.36499 269.45 222.824 277.824zM325.04898 139.503L325.04898 177.621L345.26297 162.31601C 345.26297 162.31601 344.68497 167.225 345.26297 175.311L345.26297 175.311L313.498 199.279L313.498 158.56201C 313.498 152.78702 308.011 152.49802 308.011 152.49802L308.011 152.49802L325.04797 139.50302zM280.57797 173L280.57797 192.059L293.28397 182.53L293.28397 163.471L304.25696 155.097L304.25696 206.498L293.28397 215.161L293.28397 196.39099L280.57797 205.92L280.57797 224.69L269.02698 233.353L269.02698 192.05899C 269.02698 186.284 263.53998 185.995 263.53998 185.995L263.53998 185.995L280.57697 173zM233.50797 208.519L247.65796 230.466L247.65796 197.835L258.91995 189.46101L258.91995 240.86201L247.07996 249.81401L234.37396 230.17801L234.37396 259.344L223.11197 267.718L223.11197 226.42398C 223.11197 220.64899 217.62497 220.35999 217.62497 220.35999L217.62497 220.35999L233.50697 208.51999zM187.59396 171.268C 185.28397 194.658 173.73297 203.899 173.73297 228.444C 173.73297 258.476 194.52397 290.241 232.06497 299.77C 249.96896 304.38998 262.386 305.54498 271.33798 308.722C 272.49298 309.87698 280.00098 317.96298 280.00098 317.96298C 280.00098 317.96298 287.50897 309.87698 288.66397 308.722C 297.61597 305.546 310.03296 304.38998 327.93698 299.77C 365.766 290.241 386.26898 258.47598 386.26898 228.444C 386.26898 201.011 372.119 192.637 372.119 162.893C 372.119 139.503 383.09198 119.866005 383.09198 119.866005C 383.09198 119.866005 355.65897 117.55601 348.43997 84.347C 348.43997 84.347 331.97998 101.096 315.51996 101.096C 294.15097 101.096 280.00095 82.903 280.00095 82.903C 280.00095 82.903 265.85095 101.096 244.48195 101.096C 228.02194 101.096 211.56195 84.347 211.56195 84.347C 204.34296 117.556 176.90994 119.866 176.90994 119.866C 176.90994 119.866 187.88293 139.502 187.88293 162.893C 188.17194 166.069 187.88293 168.668 187.59393 171.267zM188.17197 125.065C 188.17197 125.065 206.65297 121.311005 215.31596 97.921005C 215.31596 97.921005 227.73297 109.47201 244.77097 109.47201C 266.13995 109.47201 280.28998 94.45601 280.28998 94.45601C 280.28998 94.45601 294.43997 109.47201 315.809 109.47201C 332.84598 109.47201 345.26398 97.921005 345.26398 97.921005C 353.92697 121.311005 372.408 125.065 372.408 125.065C 372.408 125.065 364.322 141.525 364.322 162.894C 364.322 194.37 378.472 203.611 378.472 228.445C 378.472 263.09702 351.32797 285.333 326.205 291.686C 306.28 296.595 293.28497 297.173 284.62198 301.504C 284.62198 301.504 281.44598 304.392 280.28998 305.836C 279.13498 304.392 275.95798 301.504 275.95798 301.504C 267.29498 297.172 254.29997 296.595 234.37497 291.686C 209.25197 285.333 182.10797 263.098 182.10797 228.445C 182.10797 203.61101 196.25797 194.37001 196.25797 162.89401C 195.96896 141.52501 188.17197 125.06502 188.17197 125.06502z" stroke="none" fill="#111111" fillRule="nonzero" /> </g> </svg> </div> )} {league === "MLB" && ( <div> <svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" id="body_1" width="67" height="50" > <g transform="matrix(0.119642854 0 0 0.119642854 -0 1.0714295)"> <path d="M430.041 102.961L130.01599 102.961C 122.06499 102.936 114.41799 106.047 108.74199 111.617C 103.07599 117.293 99.92499 125.013 100.00299 133.032L100.00299 133.032L100.00299 266.914C 99.91499 274.905 103.05799 282.6 108.71499 288.245C 114.36199 293.88998 122.03199 297.05798 130.01599 297.041L130.01599 297.041L430.041 297.041C 446.511 296.96298 460.01498 283.38498 460 266.91397L460 266.91397L460 132.77898C 460 116.50798 446.681 103.085976 430.408 102.962975L430.408 102.962975L430.041 102.962975L430.041 102.961z" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> <path d="M449.462 133.004C 449.586 122.42799 440.98502 113.625 430.411 113.502L430.411 113.502L430.04202 113.5L346.183 113.5L394.29602 193.90399L398.73703 194.46599L401.54703 198.14598L401.54703 201.57597L404.58304 202.19197L407.39304 206.01398L407.39304 209.33098L410.54004 209.89297L413.71503 213.34897L413.71503 220.99397C 417.49802 224.40797 421.75803 227.24898 426.36304 229.42497C 430.60703 231.05397 431.08304 237.85597 433.64105 241.48198C 436.84506 246.76398 441.22906 248.87299 440.30304 251.82298C 438.16605 259.71997 430.07303 273.03998 422.54105 273.659L422.54105 273.659L392.75204 273.659L392.75204 286.418L430.07306 286.418C 440.77307 286.372 449.53806 277.53 449.49307 266.83L449.49307 266.83L449.49106 266.74597L449.49106 133.00397" stroke="none" fill="#BF0D3E" fillRule="nonzero" /> <path d="M244.309 273.856L229.89401 273.856C 229.89401 237.827 242.06201 217.90298 256.647 213.93999C 258.643 213.57498 257.687 203.73898 255.158 200.732L255.158 200.732L246.727 200.732C 245.379 200.732 246.16501 198.20099 246.16501 198.20099L246.16501 198.20099L252.994 183.61598L252.065 179.62598L226.83 179.62598L247.569 165.12497C 248.525 126.87697 287.756 123.897964 311.391 139.83397C 325.442 149.13496 326.511 167.56998 325.442 180.30197C 325.274 181.11597 321.78897 180.58298 321.78897 180.58298C 321.78897 180.58298 319.40097 194.63397 325.63898 194.63397L325.63898 194.63397L353.20798 194.63397C 364.44897 194.18497 375.29797 201.80096 375.29797 201.80096L375.29797 201.80096L377.93997 192.16196L317.54596 113.50095L130.01495 113.50095C 124.829956 113.471954 119.83695 115.49295 116.13195 119.121956C 112.48395 122.81396 110.45995 127.81496 110.51095 133.00496L110.51095 133.00496L110.51095 266.91394C 110.445946 272.09094 112.473946 277.07895 116.13195 280.73993C 119.81395 284.42194 124.80895 286.49594 130.01495 286.50192L130.01495 286.50192L251.75696 286.50192C 248.77696 281.3879 245.37895 275.5689 244.33896 273.85593" stroke="none" fill="#041E42" fillRule="nonzero" /> <path d="M137.547 245.442C 137.547 238.135 143.561 232.123 150.868 232.123C 158.17499 232.123 164.189 238.137 164.189 245.444C 164.189 252.751 158.17499 258.765 150.868 258.765L150.868 258.765L150.75499 258.763L150.728 258.763C 143.507 258.763 137.562 252.831 137.548 245.612L137.548 245.612L137.548 245.442" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> </g> </svg> </div> )} {league === "NFL" && ( <div> <svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" id="body_1" width="67" height="50" > <g transform="matrix(0.119642854 0 0 0.119642854 -0 1.0714295)"> <path d="M373.122 93.87C 364.786 100.122 348.113 108.458 327.273 103.248C 290.454 94.217 280.034 62.609 280.034 62.609C 280.034 62.609 269.544 94.182 232.79599 103.248C 211.64299 108.458 195.28299 100.053 186.599 93.905L186.599 93.905L180 93.905L180 264.103C 180 268.618 181.042 276.955 188.023 285.638C 196.672 296.058 211.26 302.762 231.441 305.67902C 247.76599 308.006 259.576 313.07703 267.912 321.17102C 274.164 327.11102 280.069 337.39203 280.069 337.39203C 280.069 337.39203 286.148 326.90204 292.087 321.17102C 300.492 313.07803 312.407 308.04102 328.558 305.67902C 348.773 302.75803 363.29202 295.954 371.976 285.49802C 378.958 277.023 380 268.513 380 264.24103L380 264.24103L380 94.04303L373.366 94.04303" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> <path d="M373.817 100.469C 373.817 100.469 353.775 116.064 325.53598 109.013C 292.64197 100.781 279.68698 76.155 279.68698 76.155C 279.68698 76.155 266.90497 100.815994 233.83798 109.013C 206.05098 115.96 185.90498 100.329 185.90498 100.329L185.90498 100.329L185.90498 263.928C 185.90799 269.48502 188.23198 293.105 232.44897 299.357C 249.85098 301.875 262.84198 307.44998 272.04596 316.44598C 275.40796 319.66898 277.95096 322.94098 279.89597 325.96298C 281.85196 322.952 284.41098 319.676 287.74597 316.44598C 297.08896 307.44998 310.07996 301.85797 327.34296 299.357C 371.45496 293.001 373.53894 269.38098 373.88696 263.92798L373.88696 263.92798L373.88696 100.32898" stroke="none" fill="#013369" fillRule="nonzero" /> <path d="M280.035 309.674C 280.035 309.674 292.81702 293.905 325.884 288.799C 364.092 282.92902 362.702 265.075 362.702 264.172L362.702 264.172L362.702 178.37799L197.019 178.37799L197.019 264.172C 197.019 265.075 195.894 282.929 233.838 288.799C 267.044 293.93903 279.687 309.674 279.687 309.674" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> <path d="M241.132 241.143L241.126 200.504L236.02 197.638L236.02 187.079L259.327 187.079L259.327 197.638L254.46399 200.504L254.46399 283.51898L242.02899 279.80298L224.03699 226.65898L224.03398 261.74097L229.76498 266.11798L229.76498 276.921L204.79099 270.564L204.79099 261.36L210.52199 259.123L210.52199 200.42198L204.652 197.52199L204.652 186.96298L223.547 186.96298L241.192 241.14798zM284.203 278.309L289.20502 284.283L289.20502 294.84198L264.43903 285.60297L264.43903 276.64096L269.89203 274.40396L269.89203 200.41995L264.47403 197.67195L264.47403 186.97395L307.54404 186.97395L307.54404 208.47495L298.09604 208.47495L295.23404 199.65294L284.29303 199.65294L284.29303 224.52293L292.49002 224.52293L295.72003 219.79893L302.32004 219.79893L302.32004 241.92493L295.72003 241.92493L292.61102 237.44392L284.27502 237.44392L284.27502 278.4309zM311.64304 282.1289L311.64304 271.56992L317.79105 266.53293L317.79105 200.53793L312.54605 197.78993L312.54605 187.09193L337.31204 187.09193L337.31204 197.78993L332.44904 200.53793L332.44904 262.71194L343.11304 259.83295L345.15503 243.57695L355.33203 243.57695L355.33203 270.73895L311.56702 282.40994" stroke="none" fill="#D50A0A" fillRule="nonzero" /> <path d="M201.361 160.907L193.85799 155.28L203.02798 155.28L206.05298 146.596L209.07797 155.28L218.24797 155.28L210.74496 160.942L213.50296 169.764L206.03496 164.51901L198.56696 169.764L201.32495 160.942L201.361 160.907zM233.874 160.872L226.37099 155.245L235.54099 155.245L238.56598 146.56099L241.59097 155.245L250.76097 155.245L243.25797 160.907L246.01596 169.729L238.54796 164.48401L231.07996 169.729L233.83795 160.907zM201.43298 131.65999L193.92998 126.03299L203.09998 126.03299L206.12497 117.34899L209.14996 126.03299L218.31996 126.03299L210.81696 131.69499L213.57495 140.517L206.10695 135.272L198.63895 140.517L201.39694 131.69499zM233.94598 131.62498L226.44298 125.997986L235.61298 125.997986L238.63797 117.31399L241.66296 125.997986L250.83296 125.997986L243.32996 131.65999L246.08795 140.482L238.61995 135.237L231.15195 140.482L233.90994 131.65999zM361.45697 169.44998L353.98898 164.20499L346.521 169.44998L349.279 160.62798L341.776 154.96597L350.946 154.96597L353.971 146.28197L356.996 154.96597L366.16602 154.96597L358.66302 160.62798L361.424 169.44998zM328.83997 169.44998L321.37198 164.20499L313.904 169.44998L316.662 160.62798L309.159 154.96597L318.329 154.96597L321.355 146.28197L324.384 154.96597L333.55402 154.96597L326.05103 160.62798L328.812 169.44998zM361.51797 140.27399L354.05 135.02899L346.582 140.27399L349.34 131.45198L341.837 125.78998L351.00702 125.78998L354.032 117.10598L357.057 125.78998L366.22702 125.78998L358.72403 131.45198L361.48502 140.27399zM328.90097 140.27399L321.43298 135.02899L313.965 140.27399L316.723 131.45198L309.22 125.78998L318.39 125.78998L321.41602 117.10598L324.445 125.78998L333.61502 125.78998L326.11203 131.45198L328.87302 140.27399zM287.248 124.98999C 283.90997 122.23899 280.162 120.47499 276.20297 119.60599C 277.16498 118.695984 278.15097 117.91399 279.01596 117.191986C 283.98297 118.386986 287.31796 120.61298 289.60995 122.50599C 288.79697 123.33899 288.00894 124.15199 287.26196 124.98199L287.26196 124.98199L287.24796 124.98899zM282.41998 130.79099C 279.23798 128.11998 275.369 126.136986 270.99197 125.233986C 271.662 124.36899 272.44696 123.44798 273.201 122.59399C 276.55 123.18799 280.843 124.95199 284.594 128.04698C 283.83 128.96399 283.11398 129.89499 282.44098 130.77998L282.44098 130.77998L282.41998 130.78998zM278.07797 136.86998C 274.64597 134.01099 270.64496 132.24998 266.71997 131.52098C 266.71997 131.52098 267.92496 129.55498 268.60898 128.53699C 273.40298 129.48898 277.29297 131.732 280.037 134.025C 279.336 135.025 278.672 135.984 278.07797 136.866L278.07797 136.866L278.07797 136.869zM300.75897 107.83198C 300.75897 107.83198 296.86896 109.85698 291.44998 115.19598C 292.67297 115.88698 294.04797 116.852974 294.83597 117.50898C 294.01596 118.23498 293.17896 119.01998 292.40097 119.75598C 288.85797 116.84898 285.21097 115.37898 282.36298 114.68498C 283.30798 114.00798 284.31097 113.34098 285.30197 112.694984C 286.83 113.083984 288.30997 113.68498 288.30997 113.68498C 294.42297 109.02998 299.73798 107.01598 299.73798 107.01598C 299.73798 107.01598 299.123 106.71498 297.48697 106.736984C 273.41595 107.04798 251.28998 125.00699 255.45798 155.71198C 255.90598 158.97298 257.17398 164.91597 258.78598 167.52197C 259.32098 162.41597 261.245 151.09198 266.94797 138.93597C 264.96497 138.22397 263.33597 137.93198 263.33597 137.93198C 263.91898 136.70897 264.72897 135.14998 264.72897 135.14998C 268.96698 135.94598 272.68298 137.71298 275.91296 140.29099C 275.13898 141.54498 274.61395 142.361 274.24197 143.00699C 273.11 142.11398 271.96396 141.34698 270.69897 140.64499C 264.27298 151.86398 261.32098 162.458 260.10498 167.98099C 260.17197 168.32298 260.869 168.49799 261.43198 168.42499C 287.79498 165.01099 299.98697 151.54399 303.80798 136.99098C 306.27798 127.43898 305.469 117.43498 302.162 109.27298C 301.93 108.69998 301.478 107.74798 300.71 107.81798" stroke="none" fill="#FFFFFF" fillRule="nonzero" /> </g> </svg> </div> )} <div>{league}</div> <div className="teams-and-scores"> <div className="live-score">{awayScore}</div> <br /> <div className="mobile-teams-playing">{teamsPlaying}</div> <br /> <div className="live-score">{homeScore}</div> </div> <div>period: {currentPeriods}</div> <div>time remaining: {periodTimeRemaining}</div> <div className="fixture-odds"> <div className="odds"> <button type="submit" onClick={() => confirmBet(awayMl)} value={awayMl} className="total-and-spread-alignment" > {awayMoneylineOdds} </button> <div className="total-and-spread-points">moneyline</div> <button type="submit" onClick={() => confirmBet(homeMl)} value={homeMl} className="total-and-spread-alignment" > {homeMoneylineOdds} </button> </div> <div className="odds"> <button type="submit" onClick={() => confirmBet(awaySp)} value={awaySp} className="total-and-spread-alignment" > <div>{awaySpread}</div> <div>{awaySpreadOdds}</div> </button> <div className="total-and-spread-points">spread</div> <button type="submit" onClick={() => confirmBet(homeSp)} value={homeSp} className="total-and-spread-alignment" > <div>{homeSpread}</div> <div>{homeSpreadOdds}</div> </button> </div> <div className="odds"> <button type="submit" onClick={() => confirmBet(totalOver)} value={totalOver} className="total-and-spread-alignment" > <div>O</div> <div>{overOdds}</div> </button> <div className="total-points-bet"> total {pointsForTotalOdds} points </div> <button type="submit" onClick={() => confirmBet(totalUnder)} value={totalUnder} className="total-and-spread-alignment" > <div>U</div> <div>{underOdds}</div> </button> </div> </div> <ModalMessage show={modalShow} onHide={() => setModalShow(false)} type="error" header="Bet duplication" message1="You cannot place bets on the same team, in a single parlay." message2="Finish placing your bet above or add bets from other games before adding another to your bet slip." /> </div> ); } export default Selectable;
86.898305
6,363
0.676053
f6f6d18b20dad53ce8e2410ae43415734599eec6
8,950
js
JavaScript
packages/client/src/components/Post/Post/Content/index.js
Jaren831/Tartarus
0e341ed3f42acdf1bc61e0c7707e458428d00c93
[ "MIT" ]
null
null
null
packages/client/src/components/Post/Post/Content/index.js
Jaren831/Tartarus
0e341ed3f42acdf1bc61e0c7707e458428d00c93
[ "MIT" ]
3
2021-05-11T08:47:51.000Z
2022-01-22T11:18:46.000Z
packages/client/src/components/Post/Post/Content/index.js
JarenL/Tartarus
0e341ed3f42acdf1bc61e0c7707e458428d00c93
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import styled from 'styled-components/macro'; import PostContentTitle from './Title'; import PostContentFullText from './FullText'; import PostActions from './Actions'; import EmbedWidget from '../EmbedWidget'; import LoadingBubble from '../../../shared/LoadingIndicator/Bubble'; import ReactHtmlParser, { processNodes, convertNodeToElement, htmlparser2 } from 'react-html-parser'; import LinkPreview from './LinkPreview'; import TextPreview from './TextPreview'; import PostContentDetail from './Details'; import ReactPlaceholder from 'react-placeholder'; import 'react-placeholder/lib/reactPlaceholder.css'; const isIPFS = require('is-ipfs'); const Wrapper = styled.div` display: flex; flex: 1; flex-direction: column; // border-left: 1px solid ${props => props.theme.border}; padding: 8px; min-width: 0; // min-width: 0; // justify-content: center; // alignitems: center; `; const { isIpfsContent, isTorrent, linkToIpfsParams, ipfsParamsToLink, downloadBlob, getMediaSourceType } = require('./util'); const services = require('../../../../services'); const ipfsGateway = 'https://ipfs.infura.io/ipfs/'; const renderContent = props => { switch (props.type) { case 'link': if (isIPFS.multihash(props.post)) { return ( <LinkPreview onClick={() => window.open(`${ipfsGateway}/${props.post}`)} > {ReactHtmlParser(props.post)} </LinkPreview> ); } else { return ( <LinkPreview onClick={() => window.open(props.post)}> {ReactHtmlParser(props.post)} </LinkPreview> ); } case 'upload': return ( <LinkPreview onClick={() => window.open(`${ipfsGateway}/${props.post}`)} > {ReactHtmlParser(props.post)} </LinkPreview> ); case 'text': if (props.preview) { return <PostContentFullText id={'fullText'} post={props.post} />; } else { return <TextPreview id={'preview'}>{ReactHtmlParser(props.post)}</TextPreview>; } default: break; } }; const renderEmbed = props => { if (props.type === 'link' || props.type === 'upload') { if (isIPFS.multihash(props.post)) { console.log('ipfs'); return <EmbedWidget url={props.link} />; } else { console.log('not ipfs'); return <EmbedWidget url={props.post} />; } } }; class PostContent extends Component { constructor(props) { super(props); this.state = { preview: this.props.showFullPost, link: null, content: null, isDownloading: false, codecsNeeded: false }; } handlePreview = () => { if (this.state.preview) { this.setState({ preview: false }); } else { this.handleIpfsLink(); this.setState({ preview: true }); } }; handleIpfsLink = async () => { if (!isIPFS.multihash(this.props.post)) { return; } const ipfsHash = this.props.post; const fileType = await services.ipfs.getFileTypeFromHash(ipfsHash); const fileMimeType = fileType ? fileType.mime : 'unknown'; const fileExtension = fileType ? `.${fileType.ext}` : ''; if (fileMimeType.match(/image/)) { const image = await services.ipfs.getBase64ImageFromStream( ipfsHash, progressResponse => { const { progressInMbs, killStream } = progressResponse; this.killStream = killStream; if (progressInMbs > 10) { killStream(); this.setState({ link: { download: this.download.bind(this, { ipfsHash, fileExtension }), message: `File type ${fileMimeType} too big to embed.`, downloadMessage: 'Download' } }); } } ); this.setState({ link: image }); } else if (fileMimeType.match(/video|audio/)) { const type = getMediaSourceType(fileMimeType); const mediaSource = { src: `${ipfsGateway}/${ipfsHash}`, type }; this.setState({ link: mediaSource }); } else { this.setState({ link: { download: this.download.bind(this, { ipfsHash, fileExtension }), message: `Cannot embed file type ${fileMimeType}.`, downloadMessage: 'Download' } }); } }; getBlobFromStream = async ({ ipfsHash, fileExtension }) => { this.setState({ link: { download: this.download.bind(this, { ipfsHash, fileExtension }), message: 'Connecting.', downloadMessage: 'Cancel' }, isDownloading: true }); const blob = await services.ipfs.getBlobFromStream(ipfsHash, progress => { this.killStream = progress.killStream; this.setState({ link: { download: this.download.bind(this, { ipfsHash, fileExtension }), message: `${progress.progressInMbs} MB downloaded.`, downloadMessage: 'Cancel' }, isDownloading: true }); }); return blob; }; download = async ({ ipfsHash, fileExtension }) => { const { isDownloading } = this.state; const { post } = this.props; const username = post.username; const postId = post.postId; if (!isDownloading) { this.setState({ isDownloading: true }); const blob = await this.getBlobFromStream({ ipfsHash, fileExtension }); downloadBlob({ blob, fileName: `${username}-${postId}${fileExtension}` }); this.setState({ link: { download: () => downloadBlob({ blob, fileName: `${username}-${postId}${fileExtension}` }), message: 'Download complete.', downloadMessage: 'Save' }, isDownloading: false }); } if (isDownloading) { this.killStream(); this.setState({ link: { download: this.download.bind(this, { ipfsHash, fileExtension }), message: 'Cancelled download.', downloadMessage: 'Try again' }, isDownloading: false }); } }; render() { return ( <Wrapper> <ReactPlaceholder delay={1000} color={this.props.dark ? '#1b1b1b' : '#f4f6f8'} showLoadingAnimation={true} rows={3} ready={!this.props.loading} > <PostContentTitle // url={url} title={this.props.title} postId={this.props.postId} forumName={this.props.forumName} type={this.props.type} post={this.props.post} full={false} /> {renderContent({ preview: this.state.preview, showFullPost: this.props.showFullPost, type: this.props.type, post: this.props.post })} <PostContentDetail time={this.props.time} creator={this.props.creator} creatorHex={this.props.creatorHex} isModerator={this.props.isModerator} isAdmin={this.props.isAdmin} isLocked={this.props.isLocked} forumName={this.props.forumName} canPin={this.props.canPin} canLock={this.props.canLock} handleLock={this.props.handleLock} handleUnlock={this.props.handleUnlock} handlePin={this.props.handlePin} handleUnpin={this.props.handleUnpin} forumPinned={this.props.forumPinned} adminPinned={this.props.adminPinned} /> <PostActions preview={this.state.preview} handlePreview={this.handlePreview} commentCount={this.props.commentCount} time={this.props.time} creator={this.props.creator} forumName={this.props.forumName} postId={this.props.postId} type={this.props.type} canDelete={this.props.canDelete} watched={this.props.watched} handleWatch={this.props.handleWatch} handleUnwatch={this.props.handleUnwatch} saved={this.props.saved} handleSave={this.props.handleSave} handleUnsave={this.props.handleUnsave} handleDelete={this.props.handleDelete} handleReport={this.props.handleReport} canReport={this.props.canReport} canBan={this.props.canBan} handleBan={this.props.handleBan} // handleUnban={this.props.handleUnban} /> {this.state.preview && renderEmbed({ post: this.props.post, type: this.props.type, link: this.state.link, handleIpfsLink: this.handleIpfsLink })} </ReactPlaceholder> </Wrapper> ); } // } } export default PostContent;
28.685897
87
0.567933
f6f6ec889023f071aa81588e9a27289830ffa82d
1,093
js
JavaScript
node_modules/@phosphor/domutils/lib/platform.js
dirac-institute/spark-labextension
50e306e7519dfb9f521ed4b8eff73e3f3ada59e3
[ "Apache-2.0" ]
null
null
null
node_modules/@phosphor/domutils/lib/platform.js
dirac-institute/spark-labextension
50e306e7519dfb9f521ed4b8eff73e3f3ada59e3
[ "Apache-2.0" ]
null
null
null
node_modules/@phosphor/domutils/lib/platform.js
dirac-institute/spark-labextension
50e306e7519dfb9f521ed4b8eff73e3f3ada59e3
[ "Apache-2.0" ]
null
null
null
"use strict"; /*----------------------------------------------------------------------------- | Copyright (c) 2014-2017, PhosphorJS Contributors | | Distributed under the terms of the BSD 3-Clause License. | | The full license is in the file LICENSE, distributed with this software. |----------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); /** * The namespace for platform related utilities. */ var Platform; (function (Platform) { /** * A flag indicating whether the platform is Mac. */ Platform.IS_MAC = !!navigator.platform.match(/Mac/i); /** * A flag indicating whether the platform is Windows. */ Platform.IS_WIN = !!navigator.platform.match(/Win/i); /** * A flag indicating whether the browser is IE. */ Platform.IS_IE = /Trident/.test(navigator.userAgent); /** * A flag indicating whether the browser is Edge. */ Platform.IS_EDGE = /Edge/.test(navigator.userAgent); })(Platform = exports.Platform || (exports.Platform = {}));
34.15625
79
0.568161
f6f7238af660c14594896a163a7cc4e732e08fcb
625
js
JavaScript
services/planCommission.service.js
chhotusow/rd_project
f93a0126e46015a05c087fb363a25ebe64faddde
[ "MIT" ]
null
null
null
services/planCommission.service.js
chhotusow/rd_project
f93a0126e46015a05c087fb363a25ebe64faddde
[ "MIT" ]
null
null
null
services/planCommission.service.js
chhotusow/rd_project
f93a0126e46015a05c087fb363a25ebe64faddde
[ "MIT" ]
null
null
null
const config = require('../config.json'); const jwt = require('jsonwebtoken'); const bcrypt = require('bcryptjs'); const db = require('_helpers/db'); const { request } = require('express'); const model = require('../model/user.model'); module.exports = { getPlanCommissionByPlanId, getPlanCommissionsByPlanIdAndYear }; function getPlanCommissionByPlanId(planId) { const data = db.CommissonPlan.findAll({ where:{planId:planId} }) return data; } function getPlanCommissionsByPlanIdAndYear(planId) { const data = db.CommissonPlan.findAll({ where:{planId:planId} }) return data; }
25
52
0.696
f6f7e585abdbbb782e1a1a73bec6419da8174d9c
256
js
JavaScript
src/themes/fonts.js
rkz98/Enklima-Mobile
f4cf6f0c81b1e53503df6196a24da3b7e3e0bb3b
[ "MIT" ]
null
null
null
src/themes/fonts.js
rkz98/Enklima-Mobile
f4cf6f0c81b1e53503df6196a24da3b7e3e0bb3b
[ "MIT" ]
3
2020-09-06T03:40:32.000Z
2021-05-09T20:53:03.000Z
src/themes/fonts.js
rkz98/Enklima-Mobile
f4cf6f0c81b1e53503df6196a24da3b7e3e0bb3b
[ "MIT" ]
null
null
null
/* eslint-disable linebreak-style */ import { RFValue } from 'react-native-responsive-fontsize'; const sizes = { regular: RFValue(15), regular_2: RFValue(17), big: RFValue(20), middle: RFValue(25), bigger: RFValue(30), }; export default sizes;
19.692308
59
0.691406
f6f949e380800ed55e744ff95d54a3fc0d904f58
2,958
js
JavaScript
backend/index.js
llucifer97/student-management-app
7bb89f0be732bae653739de64c736a3ff95ce231
[ "MIT" ]
null
null
null
backend/index.js
llucifer97/student-management-app
7bb89f0be732bae653739de64c736a3ff95ce231
[ "MIT" ]
null
null
null
backend/index.js
llucifer97/student-management-app
7bb89f0be732bae653739de64c736a3ff95ce231
[ "MIT" ]
null
null
null
const mysql = require('mysql'); const express = require("express"); const bodyParser = require("body-parser"); const cookieParser = require("cookie-parser"); const cors = require("cors"); var app = express(); const port = 5000; //start mysql connections const connection = mysql.createConnection({ host : 'localhost', //mysql database host name user : 'root', //mysql database user name password : 'password', //mysql database password database : 'studentmanagement' //mysql database name }); connection.connect(function(err) { if (err) throw err console.log('You are now connected to the database...') }) //end mysql connection //start body-parser configuratio app.use( bodyParser.json() ); // to support JSON-encoded bodies app.use(bodyParser.urlencoded({ // to support URL-encoded bodie extended: false })); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); //app.use(cors()) app.get('/', (req, res) => { res.send('Hello World!') }) //rest api to get all resul app.get('/students', function (req, res) { connection.query('SELECT * FROM student_details ', function (error, results, fields) { if (error) throw error; res.send(results); //console.log(results.body) }); }); //rest api to get particular student information app.get('/student', function (req, res) { connection.query('SELECT * FROM student_details WHERE student_id = ?',[req.query.id], function (error, results, fields) { if (error) throw error; res.send(results); console.log(req.params.id) }); }); // post route to add new student app.post('/addstudent', function (req, res) { var postData = req.body; // console.log(postData) connection.query('INSERT INTO student_details SET ?', req.body, function (error, results, fields) { if (error) throw error; res.end(JSON.stringify(results)); console.log(results) }); }); // get list of students based on different query app.get('/list', function (req, res) { // console.log(postData) const fname = req.query.fname; const lname = req.query.lname; const city = req.query.city; const email = req.query.email; console.log(req.query) connection.query('SELECT * FROM student_details WHERE fname = ? or city = ?',[fname,city], function (error, results, fields) { if (error) throw error; res.end(JSON.stringify(results)); console.log(results) }); }); // TEST ROUT app.get('/api/users', function(req, res) { console.log(req.query) res.send(req.params); // url : http://localhost:3003/api/users?id=4&token=sdfa3&geo=us }); app.get('/users/:userId/books/:bookId', function(req, res) { const user_id = req.params.userId; const bookId = req.params.bookId; console.log(req.query) res.send(req.params); // url : http://localhost:3003/users/34/books/8989 }); app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) })
22.240602
129
0.668357
f6fa6e2e8674395984a6adc0be2e4559af252115
3,376
js
JavaScript
modules/cms/tpl/assets/js/dashforge.js
aikianapa/wb3
d44e03f51ab7b3e6597493e04a7cdd2b06f1f0d0
[ "MIT" ]
null
null
null
modules/cms/tpl/assets/js/dashforge.js
aikianapa/wb3
d44e03f51ab7b3e6597493e04a7cdd2b06f1f0d0
[ "MIT" ]
null
null
null
modules/cms/tpl/assets/js/dashforge.js
aikianapa/wb3
d44e03f51ab7b3e6597493e04a7cdd2b06f1f0d0
[ "MIT" ]
null
null
null
$(function(){ 'use strict' ////////// NAVBAR ////////// // Initialize PerfectScrollbar of navbar menu for mobile only if($('#navbarMenu').length && window.matchMedia('(max-width: 991px)').matches) { const psNavbar = new PerfectScrollbar('#navbarMenu', { suppressScrollX: true }); } // Showing sub-menu of active menu on navbar when mobile function showNavbarActiveSub() { if(window.matchMedia('(max-width: 991px)').matches) { $('#navbarMenu .active').addClass('show'); } else { $('#navbarMenu .active').removeClass('show'); } } showNavbarActiveSub() $(window).resize(function(){ showNavbarActiveSub() }) // Initialize backdrop for overlay purpose $('body').append('<div class="backdrop"></div>'); // Showing sub menu of navbar menu while hiding other siblings $('.navbar-menu .with-sub .nav-link').on('click', function(e){ e.preventDefault(); $(this).parent().toggleClass('show'); $(this).parent().siblings().removeClass('show'); if(window.matchMedia('(max-width: 991px)').matches) { psNavbar.update(); } }) // Closing dropdown menu of navbar menu $(document).on('click touchstart', function(e){ e.stopPropagation(); // closing nav sub menu of header when clicking outside of it if(window.matchMedia('(min-width: 992px)').matches) { var navTarg = $(e.target).closest('.navbar-menu .nav-item').length; if(!navTarg) { $('.navbar-header .show').removeClass('show'); } } }) $('#mainMenuClose').on('click', function(e){ e.preventDefault(); $('body').removeClass('navbar-nav-show'); }); $('#sidebarMenuOpen').on('click', function(e){ e.preventDefault(); $('body').addClass('sidebar-show'); }) // Navbar Search $('#navbarSearch').on('click', function(e){ e.preventDefault(); $('.navbar-search').addClass('visible'); $('.backdrop').addClass('show'); }) $('#navbarSearchClose').on('click', function(e){ e.preventDefault(); $('.navbar-search').removeClass('visible'); $('.backdrop').removeClass('show'); }) ////////// SIDEBAR ////////// // Initialize PerfectScrollbar for sidebar menu if($('#sidebarMenu').length) { const psSidebar = new PerfectScrollbar('#sidebarMenu', { suppressScrollX: true }); // Showing sub menu in sidebar $('.sidebar-nav .with-sub').on('click', function(e){ e.preventDefault(); $(this).parent().toggleClass('show'); psSidebar.update(); }) } $('#mainMenuOpen').on('click touchstart', function(e){ e.preventDefault(); $('body').addClass('navbar-nav-show'); }) $('#sidebarMenuClose').on('click', function(e){ e.preventDefault(); $('body').removeClass('sidebar-show'); }) // hide sidebar when clicking outside of it $(document).on('click touchstart', function(e){ e.stopPropagation(); // closing of sidebar menu when clicking outside of it if(!$(e.target).closest('.burger-menu').length) { var sb = $(e.target).closest('.sidebar').length; var nb = $(e.target).closest('.navbar-menu-wrapper').length; if(!sb && !nb) { if($('body').hasClass('navbar-nav-show')) { $('body').removeClass('navbar-nav-show'); } else { $('body').removeClass('sidebar-show'); } } } }); })
25.969231
82
0.595675
f6fa8ee490e16fefca712b55e9360fec46062e31
81
js
JavaScript
src/MaterialUI/SVGIcon/Icon/LoupeOutlined.js
matoruru/purescript-react-material-ui-svgicon
e5ea02a5ef5165f5756bea9d21cf056c5f16e635
[ "MIT" ]
null
null
null
src/MaterialUI/SVGIcon/Icon/LoupeOutlined.js
matoruru/purescript-react-material-ui-svgicon
e5ea02a5ef5165f5756bea9d21cf056c5f16e635
[ "MIT" ]
2
2019-07-15T09:55:03.000Z
2019-07-15T10:56:16.000Z
src/MaterialUI/SVGIcon/Icon/LoupeOutlined.js
matoruru/purescript-react-material-ui-svgicon
e5ea02a5ef5165f5756bea9d21cf056c5f16e635
[ "MIT" ]
null
null
null
exports.loupeOutlinedImpl = require('@material-ui/icons/LoupeOutlined').default;
40.5
80
0.814815
f6faceaa6735075320c4497621687f4c82142d1a
34
js
JavaScript
node_modules/polyfill-library/polyfills/__dist/console.markTimeline/min.js
vladermakov12345/Test1
6c228a7f600c44445475218e6c32a7be575d8b33
[ "MIT" ]
1
2019-09-20T08:12:15.000Z
2019-09-20T08:12:15.000Z
node_modules/polyfill-library/polyfills/__dist/console.markTimeline/min.js
vladermakov12345/Test1
6c228a7f600c44445475218e6c32a7be575d8b33
[ "MIT" ]
1
2022-03-02T05:39:38.000Z
2022-03-02T05:39:38.000Z
node_modules/polyfill-library/polyfills/__dist/console.markTimeline/min.js
vladermakov12345/Test1
6c228a7f600c44445475218e6c32a7be575d8b33
[ "MIT" ]
null
null
null
console.markTimeline=function(){};
34
34
0.794118
f6fb35db46552a507214c52b7f4d97a15dd44eeb
560
js
JavaScript
samples/iotdb_contact.js
dpjanes/homestar-smart-things
db5e01f08f6c7ab0fc549f2e00e6374a4ccb0d9b
[ "Apache-2.0" ]
null
null
null
samples/iotdb_contact.js
dpjanes/homestar-smart-things
db5e01f08f6c7ab0fc549f2e00e6374a4ccb0d9b
[ "Apache-2.0" ]
null
null
null
samples/iotdb_contact.js
dpjanes/homestar-smart-things
db5e01f08f6c7ab0fc549f2e00e6374a4ccb0d9b
[ "Apache-2.0" ]
null
null
null
/* * Note: to work, this package must have been installed by 'homestar install' */ var iotdb = require("iotdb"); var _ = iotdb._; var iot = iotdb.iot(); var things = iot.connect("SmartThingsContact"); things.on("istate", function (thing) { console.log("+", "istate\n ", thing.thing_id(), "\n ", thing.state("istate")); }); things.on("meta", function (thing) { console.log("+ meta\n ", thing.thing_id(), thing.state("meta")); }); things.on("thing", function (thing) { console.log("+ discovered\n ", thing.thing_id(), thing.state("meta")); });
29.473684
82
0.633929
f6fb4fd623e0467d55ca325980e5c24f340b7851
2,106
js
JavaScript
src/components/ButtonPanel.js
henatan99/Calculator
a8e6299ef717d1dae2955962508654f44ecd7ad1
[ "MIT" ]
null
null
null
src/components/ButtonPanel.js
henatan99/Calculator
a8e6299ef717d1dae2955962508654f44ecd7ad1
[ "MIT" ]
4
2021-05-25T09:07:50.000Z
2021-06-03T09:53:33.000Z
src/components/ButtonPanel.js
henatan99/Calculator
a8e6299ef717d1dae2955962508654f44ecd7ad1
[ "MIT" ]
null
null
null
import PropTypes from 'prop-types'; import Button from './Button'; function ButtonPanel(props) { const { handleClick } = props; return ( <div className="button-panel"> <div className="group-1"> <Button name="AC" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="+/-" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="%" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="÷" handleClick={handleClick} color="#f5913e" wide="25%" /> </div> <div className="group-2"> <Button name="7" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="8" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="9" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="X" handleClick={handleClick} color="#f5913e" wide="25%" /> </div> <div className="group-3"> <Button name="4" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="5" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="6" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="-" handleClick={handleClick} color="#f5913e" wide="25%" /> </div> <div className="group-4"> <Button name="1" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="2" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="3" handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="+" handleClick={handleClick} color="#f5913e" wide="25%" /> </div> <div className="group-5"> <Button name="0" handleClick={handleClick} color="#e0e0e0" wide="50%" /> <Button name="." handleClick={handleClick} color="#e0e0e0" wide="25%" /> <Button name="=" handleClick={handleClick} color="#f5913e" wide="25%" /> </div> </div> ); } ButtonPanel.propTypes = { handleClick: PropTypes.func, }; ButtonPanel.defaultProps = { handleClick: null, }; export default ButtonPanel;
42.12
82
0.608737
f6fbac5a35568f17faa88771472e29eeecd42c1f
50,276
js
JavaScript
app/components/Exchange/highcharts-plugins/technical-indicators.src.js
axin313/bitshares-ui
0d17ff1c31e9f0247c4dde626154f4e8a45ddc49
[ "MIT" ]
3
2018-07-31T18:30:56.000Z
2019-01-08T08:08:10.000Z
app/components/Exchange/highcharts-plugins/technical-indicators.src.js
axin313/bitshares-ui
0d17ff1c31e9f0247c4dde626154f4e8a45ddc49
[ "MIT" ]
6
2020-07-15T21:15:10.000Z
2022-02-09T23:18:32.000Z
app/components/Exchange/highcharts-plugins/technical-indicators.src.js
axin313/bitshares-ui
0d17ff1c31e9f0247c4dde626154f4e8a45ddc49
[ "MIT" ]
8
2018-07-26T15:41:14.000Z
2022-03-08T09:55:37.000Z
import Highcharts from "highcharts/highstock"; (function (HC) { /*** Each indicator requires mothods: - getDefaultOptions() - returns object with default parameters, like period etc. - getValues(chart, series, options) - returns array of calculated values for indicator - getGraph(chart, series, options) - returns path, or columns as SVG elemnts to add. Doesn't add to chart via renderer! ***/ /*** indicators: [{ id: 'series-id', type: 'sma', params: { period: 'x', n: 'y' }, styles: { lineWidth: 'x', strokeColor: 'y' } }] ***/ var UNDEFINED, Chart = HC.Chart, Axis = HC.Axis, extend = HC.extend, each = HC.each, merge = HC.merge, mathMax = Math.max, NUMBER = "number"; function error(name) { if(window.console){ console.error(name); } } function defined(obj) { return obj !== UNDEFINED && obj !== null; } function forceRedraw(s){ if(s.indicators) { each(s.indicators, function(el, i) { el.isDirtyData = true; }); each(s.chart.yAxis, function(el, i) { el.render(); }); //s.indicators = null; } } HC.isArray = function(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }; HC.isObject = function(obj) { return typeof obj === 'object'; }; HC.splat = function (obj) { return HC.isArray(obj) ? obj : [obj]; }; HC.setOptions({ tooltip: { followPointer: true } }); /*** Wrappers: ***/ /* * Upadte height when height is changed: */ HC.wrap(HC.Chart.prototype, 'setSize', function(p, w, h, a) { p.call(this, w, h, false); if(this.alignAxes) { // #30 this.updateHeightAxes(20, false, false); this.redraw(a); } }); /* * Remove corresponding indicators for series */ HC.wrap(HC.Series.prototype, 'update', function(proceed, redraw, animation) { var tempIndics = [], s = this, tmpAxis, len, el; if(s.indicators) { len = s.indicators.length; while(len--) { // #21 el = s.indicators[len]; tempIndics.push(el.options); el.destroy(); }; proceed.call(this, redraw, animation); s = this; // get series reference back after update len = tempIndics.length; while(len--) { // #21 s.chart.addIndicator(tempIndics[len]); }; } else { proceed.call(this, redraw, animation); } }); /* * Remove corresponding indicators for series */ HC.wrap(HC.Series.prototype, 'remove', function(proceed, redraw, animation) { var s = this, len; if(s.indicators) { len = s.indicators.length; while(len--) { // #21 s.indicators[len].destroy(); }; s.indicators = null; } proceed.call(this, redraw, animation); }); /* * Force redraw for indicator with new data */ HC.wrap(HC.Series.prototype, 'setData', function(proceed, redraw, animation) { forceRedraw(this); /* if(this.chart.alignAxes) { this.chart.updateHeightAxes(20, false); } */ proceed.call(this, redraw, animation); }); /* * Force redraw for indicator when new point is added */ HC.wrap(HC.Series.prototype, 'addPoint', function(proceed, options, redraw, shift, animation) { forceRedraw(this); proceed.call(this, options, redraw, shift, animation); }); /* * Set visibility to true, but disable tooltip when needed. Required for forcing recalculation of values */ HC.wrap(HC.Series.prototype, 'setVisible', function(proceed, vis, redraw) { var newVis = vis === UNDEFINED ? ( this.isVisible === UNDEFINED ? !this.visible : !this.isVisible) : vis, showOrHide = newVis ? 'show' : 'hide', series = this; if(series.indicators) { series.isVisible = newVis; series.hideInTooltip = !newVis; proceed.call(series, true, true); if(series.chart.legend && series.chart.legend.options.enabled) { // #20 series.chart.legend.colorizeItem(this, newVis); } // show or hide elements each(['group', 'dataLabelsGroup', 'markerGroup', 'tracker'], function (key) { if (series[key]) { series[key][showOrHide](); } }); series.visible = true; } else { proceed.call(series, newVis, true); } }); /* * Force redraw for indicator with new point options, like value */ HC.wrap(HC.Point.prototype, 'update', function(proceed, options, redraw) { forceRedraw(this.series); proceed.call(this, options, redraw); }); /* * Force redraw for indicator when one of points is removed */ HC.wrap(HC.Point.prototype, 'remove', function(proceed, options, redraw, animation) { forceRedraw(this.series); proceed.call(this, options, redraw); }); /* * Set flag for hasData when indicator has own axis */ HC.wrap(HC.Axis.prototype, 'render', function(p) { var oldHasData; function manageIndicators() { var hasData = false, indMin = Infinity, indMax = -Infinity; each(this.indicators, function(ind, i) { if(ind.visible) { hasData = true; indMin = Math.min(indMin, ind.options.yAxisMin); indMax = Math.max(indMax, ind.options.yAxisMax); } }); if(hasData && indMax !== Infinity && indMin !== -Infinity ) { this.isDirty = true; this.isDirtyExtremes = true; this.userMax = indMax; this.userMin = indMin; } else { this.userMax = null; this.userMin = null; } return hasData; } if(this.indicators && !this.hasVisibleSeries) { // case 1: axis doesn't have series oldHasData = manageIndicators.call(this); this.hasData = typeof this.hasData == "function" ? function() { return oldHasData; } : oldHasData; // version 4.1.6 vs 4.1.7 if((typeof this.hasData == "function" && this.hasData()) || (typeof this.hasData !== "function" && this.hasData)) { // version 4.1.6 vs 4.1.7 this.setScale(); this.setTickPositions(true); this.chart.getMargins(); // #38 HC.each(this.indicators, function(ind, e) { ind.drawGraph(); }); } } else if(this.indicators) { // case 2: right now all series are 'visible', so we need to check param: isVisible var hasData = false; each(this.series, function(serie, i) { if(serie.isVisible || (serie.isVisible === UNDEFINED && serie.visible)) { hasData = true; } }); if(!hasData) { hasData = manageIndicators.call(this); } else { this.userMax = null; this.userMin = null; } if(hasData) { this.setScale(); this.setTickPositions(true); this.chart.getMargins(); } this.hasData = typeof this.hasData == "function" ? function() { return hasData } : hasData; // version 4.1.6 vs 4.1.7 HC.each(this.indicators, function(ind, e) { ind.drawGraph(); }); } p.call(this); }); /* * Tooltip formatter content */ HC.wrap(HC.Tooltip.prototype, 'defaultFormatter', function (proceed, tooltip) { var items = this.points || HC.splat(this), chart = items[0].series.chart, x = this.x, tooltipOptions = chart.tooltip.options, s; // build the header s = [tooltip.tooltipFooterHeaderFormatter(items[0])]; //#3397: abstraction to enable formatting of footer and header // build the values s = s.concat(tooltip.bodyFormatter(items)); // footer s.push(tooltip.tooltipFooterHeaderFormatter(items[0], true)); //#3397: abstraction to enable formatting of footer and header return s.join(''); }); HC.wrap(HC.Tooltip.prototype, 'bodyFormatter', function (proceed, items) { return HC.map(items, function (item) { var tooltipOptions = item.series.tooltipOptions; return (tooltipOptions.pointFormatter || item.point.tooltipFormatter).call(item.point, tooltipOptions.pointFormat); }); }); /* Tooltip pointFormat */ HC.wrap(HC.Point.prototype, 'tooltipFormatter', function (proceed, pointFormat) { // Insert options for valueDecimals, valuePrefix, and valueSuffix var series = this.series, indicators = series.indicators, seriesTooltipOptions = series.tooltipOptions, tooltipOptions = series.chart.tooltip.options, valueDecimals = HC.pick(seriesTooltipOptions.valueDecimals, ''), valuePrefix = seriesTooltipOptions.valuePrefix || '', valueSuffix = seriesTooltipOptions.valueSuffix || '', x = this.x, graphLen = 0, indLen = 0, indTooltip, indPointFormat, k; // Loop over the point array map and replace unformatted values with sprintf formatting markup HC.each(series.pointArrayMap || ['y'], function (key) { key = '{point.' + key; // without the closing bracket if (valuePrefix || valueSuffix) { pointFormat = pointFormat.replace(key + '}', valuePrefix + key + '}' + valueSuffix); } pointFormat = pointFormat.replace(key + '}', key + ':,.' + valueDecimals + 'f}'); }); if(indicators && indicators !== UNDEFINED && tooltipOptions.enabledIndicators) { // build the values of indicators HC.each(indicators,function(ind,i) { if(typeof(ind.values) === 'undefined' || ind.visible === false) { return; } HC.each(ind.values,function(val, j){ if(val[0] === x) { if(ind.options.tooltip) { indLen = val.length; indTooltip = ind.options.tooltip; indPointFormat = indTooltip.pointFormat; pointFormat += HC.format(indPointFormat, { point: { bottomColor: indLen > 3 ? ind.graph[2].element.attributes.stroke.value : '', bottomLine: HC.numberFormat(val[3],3), x: val[0], y: indLen > 3 ? HC.numberFormat(val[2],3) : HC.numberFormat(val[1],3), color: indLen > 3 ? ind.graph[1].element.attributes.stroke.value : ind.graph[0].element.attributes.stroke.value, topLine: HC.numberFormat(val[1],3), topColor: ind.graph[0].element.attributes.stroke.value }, series:ind }); } else { //default format graphLen = ind.graph.length; for(k = 0; k < graphLen; k++) { pointFormat += '<span style="font-weight:bold;color:' + ind.graph[k].element.attributes.stroke.value + ';">' + HC.splat(ind.options.names || ind.name)[k] + '</span>: ' + HC.numberFormat(val[k+1],3) + '<br/>'; } } } }); }); } return HC.format(pointFormat, { point: this, series: this.series }); }); /*** Add legend items: ***/ /* * Add indicators to legend */ HC.wrap(HC.Legend.prototype, 'getAllItems', function(p) { var allItems = p.call(this), indicators = this.chart.indicators; if(indicators) { HC.each(indicators.allItems, function(e, i) { if(e.options.showInLegend) { allItems.push(e); } }); } return allItems; }); /* * Render indicator */ HC.wrap(HC.Legend.prototype, 'renderItem', function(p, item) { if(item instanceof Indicator) { var series = item.series; item.series = null; item.color = item.options.styles.stroke; p.call(this, item); item.series = series; } else { p.call(this, item); } }); HC.wrap(HC.Point.prototype, 'getLabelConfig', function(proceed, point, mouseEvent) { var point = this; return { x: point.category, y: point.y, indicators: point.indicators, key: point.name || point.category, series: point.series, point: point, percentage: point.percentage, total: point.total || point.stackTotal }; }); HC.wrap(HC.Point.prototype, 'init', function(proceed, series, options, x) { var point = this, colors; point.series = series; point.color = series.color; // #3445 point.applyOptions(options, x); point.pointAttr = {}; point.indicators = {}; if (series.options.colorByPoint) { colors = series.options.colors || series.chart.options.colors; point.color = point.color || colors[series.colorCounter++]; // loop back to zero if (series.colorCounter === colors.length) { series.colorCounter = 0; } } series.chart.pointCount++; return point; }); /* * When hovering legend item, use isVisible instead of visible property */ HC.wrap(HC.Legend.prototype, 'setItemEvents', function(p, item, legendItem, useHTML, itemStyle, itemHiddenStyle) { p.call(this, item, legendItem, useHTML, itemStyle, itemHiddenStyle); (useHTML ? legendItem : item.legendGroup).on('mouseout', function () { var style = item.isVisible === UNDEFINED ? (item.visible ? itemStyle : itemHiddenStyle) : (item.isVisible ? itemStyle : itemHiddenStyle); legendItem.css(style); item.setState(); }) }); /*** Indicator Class: ***/ window.Indicator = function () { this.init.apply(this, arguments); }; Indicator.prototype = { /* * Initialize the indicator */ init: function (chart, options) { // set default params, when not specified in params if(!Indicator.prototype[options.type]) error("Indicator: " + options.type + " not found!"); options.params = merge({}, Indicator.prototype[options.type].getDefaultOptions(), options.params); this.chart = chart; this.options = options; this.series = chart.get(options.id); this.name = options.name === UNDEFINED ? options.type : options.name; this.visible = options.visible === UNDEFINED ? true : options.visible; if(!this.series.indicators) { this.series.indicators = []; } this.series.indicators.push(this); }, /* * Render the indicator */ render: function (redraw) { var indicator = this, chart = this.chart, renderer = chart.renderer, graph = this.graph, group = this.group, options = this.options, series = this.series, clipPath = this.clipPath, visible = options.visible, pointsBeyondExtremes, arrayValues, extremes; if(!indicator.visible) return; if (!group) { indicator.group = group = renderer.g().add(chart.indicators.group); } if(!series) { error('Series not found'); return false; } else if(!graph) { arrayValues = Indicator.prototype[options.type].getValues(chart, { points: [] }, options, [series.xData, series.yData]); if(!arrayValues) { //#6 - create dummy data arrayValues = { values: [[]], xData: [[]], yData: [[]] }; } this.values = this.currentPoints = arrayValues.values; this.xData = arrayValues.xData; this.yData = arrayValues.yData; this.groupPoints(series); this.graph = graph = Indicator.prototype[options.type].getGraph(chart, series, options, this.values); if(graph) { var len = graph.length, i; for(i = 0; i < len ;i++) { graph[i].add(group); } } // indicator has connection to the specific Axis, like RSI or ATR if(indicator.options.Axis) { indicator.options.Axis.indicators = indicator.options.Axis.indicators || []; indicator.options.Axis.indicators.push(indicator); if(indicator.clipPath) indicator.clipPath.destroy(); indicator.clipPath = renderer.clipRect({ x: indicator.options.Axis.left, y: indicator.options.Axis.top, width: indicator.options.Axis.width, height: indicator.options.Axis.height }); group.clip(indicator.clipPath); } } if(chart.legend && chart.legend.options.enabled) { chart.legend.render(); } }, /* * Redraw the indicator */ redraw: function () { var options = this.options, chart = this.chart, series = this.series, graph = this.graph, group = this.group, isDirtyData = this.isDirtyData, visible = options.visible, axis = options.Axis, pointsBeyondExtremes, arrayValues, extremes; if(!this.visible) { // remove extremes options.yAxisMax = null; options.yAxisMin = null; this.values = [[]]; return; } // only after series.setData() or series.addPoint() etc. if(isDirtyData) { arrayValues = Indicator.prototype[options.type].getValues(chart, { points: [] }, options, [series.xData, series.yData]); if(!arrayValues) { //#6 - create dummy data arrayValues = { values: [[]], xData: [[]], yData: [[]] } } this.values = this.currentPoints = arrayValues.values; this.xData = arrayValues.xData; this.yData = arrayValues.yData; } // always check if points should be grouped, like after setExtremes() which doesn't change data this.groupPoints(series); }, /* * Draw graph */ drawGraph: function() { var ind = this, graph = this.graph, len = graph.length, i; if(graph) { for(i = 0; i < len ;i++) { graph[i].destroy(); } } ind.graph = Indicator.prototype[ind.options.type].getGraph(ind.chart, ind.series, ind.options, ind.values); if(ind.graph) { ind.clipPath.attr({ x: ind.options.Axis.left, y: ind.options.Axis.top, width: ind.options.Axis.width, height: ind.options.Axis.height }); for(i = 0; i < len ;i++) { ind.graph[i].add(ind.group); } } }, /* * Group points to allow calculation before extremes */ groupPoints: function(series) { var points = [[], []], start = series.cropStart, end, length = HC.splat(this.options.params.period)[0], //#23 - don't use cropShoulded - it's broken since v1.3.6 minLen = Math.max(0, start - length - 1), // cropping starts from 0 at least maxLen = series.options.data.length, groupedPoints = [], currentData = [], xAxis = series.xAxis, groupIntervalFactor, interval, ex, xMin, xMax, yData, groupPositions, processedXData, processedXDataLength, totalRange, defaultDataGroupingUnits = [[ 'millisecond', // unit name [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples ], [ 'second', [1, 2, 5, 10, 15, 30] ], [ 'minute', [1, 2, 5, 10, 15, 30] ], [ 'hour', [1, 2, 3, 4, 6, 8, 12] ], [ 'day', [1] ], [ 'week', [1] ], [ 'month', [1, 3, 6] ], [ 'year', null ] ]; if(series.currentDataGrouping) { ex = xAxis.getExtremes(); xMin = ex.min; xMax = ex.max; totalRange = series.currentDataGrouping.totalRange; processedXData = series.processedXData.slice(); processedXDataLength = processedXData.length; end = this.getCropEnd(start, xMax, this.xData); groupIntervalFactor = (xAxis.options.ordinal && xAxis.getGroupIntervalFactor(xMin,xMax, series)) || 1; interval = (series.groupPixelWidth * (xMax - xMin) / series.chart.plotSizeX) * groupIntervalFactor; groupPositions = series.xAxis.getTimeTicks( series.currentDataGrouping, xMin, xMax, xAxis.options.startOfWeek, processedXData, series.closestPointRange ); groupedPoints = this.groupData(this.xData.slice(Math.max(0, start - length), end), this.yData.slice(Math.max(0, start - length), end), groupPositions.slice(), this.options.params.approximation); this.processedXData = groupedPoints[0]; this.processedYData = yData = groupedPoints[1]; } else { this.processedXData = this.xData.slice(minLen, maxLen); //copy default data this.processedYData = yData = this.yData.slice(minLen, maxLen); } // merge current points HC.each(this.processedXData, function(p, i){ if(HC.isArray(yData[i])) { currentData.push( [p].concat(yData[i]) ); } else { currentData.push( [p, yData[i]] ); } }); this.options.yAxisMin = Math.min.apply(null, Array.prototype.concat.apply([], this.processedYData)); // new extremes this.options.yAxisMax = Math.max.apply(null, Array.prototype.concat.apply([], this.processedYData)); // new extremes this.values = currentData; this.applyTooltipPoints(); }, /* * Mechanism for goruping points into grouped positions */ groupData: function (xData, yData, groupPositions, approximation) { var ind = this, groupedXData = [], groupedYData = [], groupedY, dataLength = xData.length, pointY, pointX, values = [[], [], [], []], approximationFn = typeof approximation === 'function' ? approximation : HC.approximations[approximation], i; // Start with the first point within the X axis range (#2696) for (i = 0; i <= dataLength; i++) { if (xData[i] >= groupPositions[0]) { break; } } for (; i <= dataLength; i++) { // when a new group is entered, summarize and initiate the previous group while ((groupPositions[1] !== UNDEFINED && xData[i] >= groupPositions[1]) || i === dataLength) { // get the last group // get group x and y pointX = groupPositions.shift(); groupedY = approximationFn.apply(0, values); // push the grouped data if (groupedY !== UNDEFINED) { groupedXData.push(pointX); groupedYData.push(groupedY); } // reset the aggregate arrays values[0] = []; values[1] = []; values[2] = []; values[3] = []; // don't loop beyond the last group if (i === dataLength) { break; } } // break out if (i === dataLength) { break; } pointY = yData[i]; if (pointY === null) { values[0].hasNulls = true; } else if(typeof pointY === NUMBER){ values[0].push(pointY); } else { HC.each(pointY, function(e, i) { values[i].push(e); }); } } return [groupedXData, groupedYData]; }, /* * Apply indicator's value to the grouped, corresponding points */ applyTooltipPoints: function() { var indicator = this, values = indicator.values, vLen = values.length, points = indicator.series.points, pLen = points ? points.length : 0, diff = pLen - vLen, point, i; for(i = diff; i < pLen; i++){ point = points[i]; if(point) { point.indicators[indicator.options.type] = values[i - diff]; } } }, /* * Get right edge of the data actually displayed on the chart. cropStart is stored, but cropEnd we need to find */ getCropEnd: function(start, max, data) { var len = data.length, i = start; while(i < len) { if(data[i] >= max) { break; } i++; } return i + 1; }, /* * Destroy the indicator */ destroy: function (redraw) { var indicator = this, chart = this.chart, allItems = chart.indicators.allItems, index = allItems.indexOf(indicator), Axis = this.options.Axis; // remove from all indicators array if (index > -1) { allItems.splice(index, 1); } // remove from series.indicators index = indicator.series.indicators.indexOf(indicator); if(index > -1) { indicator.series.indicators.splice(index, 1); } // remove from yAxis.indicators index = Axis.indicators.indexOf(indicator); if(index > -1) { Axis.indicators.splice(index, 1); } if(indicator.legendGroup) { indicator.legendGroup.destroy(); if(chart.legend && chart.legend.options.enabled) { chart.legend.render(); } } //remove axis if that was the last one indicator if(Axis && Axis.series.length === 0 && Axis.indicators && Axis.indicators.length === 0) { Axis.remove(); this.options.Axis = UNDEFINED; chart.indicators.haveAxes --; // #18: decrement number of axes to be updated if(chart.alignAxes) { chart.updateHeightAxes(20, false, true); } } // remove group with graph if (indicator.group) { indicator.group.destroy(); indicator.group = null; } // remove points from tooltip #29 each(indicator.series.points, function(p) { if(p && p.indicators && p.indicators[indicator.options.type]){ delete p.indicators[indicator.options.type]; } }); indicator = null; chart.redraw(redraw); }, /* * setState for indicator? */ setState: function(state) { }, /* * Hide or show indicator */ setVisible: function(vis, redraw) { var indicator = this, oldVis = indicator.visible, newVis, method; if(vis === UNDEFINED) { newVis = oldVis ? false : true; method = oldVis ? 'hide' : 'show'; } else { newVis = vis; method = vis ? 'show' : 'hide'; } if (this.options.showInLegend) { this.chart.legend.colorizeItem(this, newVis); } this.visible = newVis; indicator[method](); indicator.redraw(); // hide axis by resetting extremes if(this.options.Axis) { this.options.Axis.render(); } }, /* * Draw symbol in legend - should be simple line */ drawLegendSymbol: function(legend) { var options = this.options, markerOptions = options.marker, radius, legendOptions = legend.options, legendSymbol, symbolWidth = legend.symbolWidth, renderer = this.chart.renderer, legendItemGroup = this.legendGroup, verticalCenter = legend.baseline - Math.round(renderer.fontMetrics(legendOptions.itemStyle.fontSize, this.legendItem).b * 0.3), attr; // Draw the line attr = { 'stroke-width': options.lineWidth || 2 }; if (options.styles && options.styles.dashstyle) { attr.dashstyle = options.styles.dashstyle; } this.legendLine = renderer.path([ 'M', 0, verticalCenter, 'L', symbolWidth, verticalCenter ]) .attr(attr) .add(legendItemGroup); }, /* * Update the indicator with a given options */ update: function (options, redraw) { merge(true, this.options, options); this.redraw(redraw); this.options.Axis.render(); }, /* * Hide the indicator */ hide: function() { this.group.hide(); this.visible = false; }, /* * Show the indicator */ show: function() { this.group.show(); this.visible = true; } }; // Add indicator methods to chart prototype extend(Chart.prototype, { /* * Adding indicator to the chart */ addIndicator: function (options, redraw) { var chart = this, indicators = chart.indicators.allItems, item; item = new Indicator(chart, options); indicators.push(item); item.render(redraw); chart.redraw(redraw); return item; }, /* * Redraw all indicators, method used in chart events */ redrawIndicators: function () { var chart = this; each(chart.indicators.allItems, function (indicator) { indicator.redraw(); }); // we need two loops - one to calculate values and register extremes // and second to draw paths with proper extremes on yAxis each(chart.yAxis, function (axis) { axis.render(); }); }, /* * updates axes and returns new and normalized height for each of them. */ updateHeightAxes: function(topDiff, add, afterRemove) { var chart = this, chYxis = chart.yAxis, len = chYxis.length, calcLen = len, i = 0, sum = chart.chartHeight - chart.plotTop - chart.marginBottom, //workaround until chart.plotHeight will return real value indexWithoutNav = 0, newHeight, top; // #18 - don't update axes when none of indicators have separate axis if(afterRemove !== true && (!chart.indicators || chart.indicators.haveAxes == 0 || chart.indicators.allItems.length === 0)) return; // when we want to remove axis, e.g. after indicator remove // #17 - we need to consider navigator (disabled vs enabled) when calculating height in advance if(!add && chart.options.navigator.enabled) { calcLen--; } else if(add && !chart.options.navigator.enabled){ calcLen++; } newHeight = (sum - (calcLen-1) * topDiff) / calcLen; //update all axis for (;i < len; i++) { var yAxis = chYxis[i]; if(yAxis.options.id !== 'navigator-y-axis') { top = chart.plotTop + indexWithoutNav * (topDiff + newHeight); if(yAxis.top !== top || yAxis.height !== newHeight) { chYxis[i].update({ top: top, height: newHeight }, false); } indexWithoutNav++; } } return newHeight; } }); // Add yAxis as pane extend(Axis.prototype, { /* * When new indicator is added, sometimes we need new pane. * Note: It automatically scales all of other axes unless alignAxes is set to false. */ addAxisPane: function(chart, userOptions) { chart.indicators.haveAxes++; // #18: increment number of axes var topDiff = 20, height, yLen = chart.options.navigator.enabled ? chart.yAxis.length - 1 : chart.yAxis.length, // #17 - don't count navigator defaultOptions, options; if(chart.alignAxes) { height = chart.updateHeightAxes(topDiff, true), defaultOptions = { labels: { align: 'left', x: 2, y: -2 }, offset: chart.alignAxes ? 0 : null, height: height, top: chart.plotTop + yLen * (topDiff + height) , min: 0, max: 100 }; } else { defaultOptions = { min: 0, max: 100 }; } options = merge(defaultOptions,userOptions); //add new axis chart.preventIndicators = true; chart.addAxis(options, false, true, false); chart.preventIndicators = false; return chart.yAxis.length - 1; }, minInArray: function(arr) { return arr.reduce(function(min, arr) { return Math.min(min, arr[1]); }, Infinity); }, maxInArray: function(arr) { return arr.reduce(function(max, arr) { return Math.max(max, arr[1]); }, -Infinity); } }); // Initialize on chart load Chart.prototype.callbacks.push(function (chart) { var options = chart.options.indicators, optionsLen = options ? options.length : 0, i = 0, group, exportingFlag = true; group = chart.renderer.g("indicators"); group.attr({ zIndex: 2 }); group.add(); if(!chart.indicators) chart.indicators = {}; // initialize empty array for indicators if(!chart.indicators.allItems) chart.indicators.allItems = []; // link chart object to indicators chart.indicators.chart = chart; // link indicators group element to the chart chart.indicators.group = group; // counter for axes #18 chart.indicators.haveAxes = 0; chart.alignAxes = defined(chart.options.chart.alignAxes) ? chart.options.chart.alignAxes : true; for(i = 0; i < optionsLen; i++) { chart.addIndicator(options[i], false); if((chart.get(options[i].id).data.length - 1) <= options[i].params.period) // SPLAT? exportingFlag = false; } // update indicators after chart redraw Highcharts.addEvent(chart, 'redraw', function () { if(!chart.preventIndicators) { chart.redrawIndicators(); } chart.preventIndicators = false; }); if(exportingFlag && optionsLen > 0 && chart.series && chart.series.length > 0) { // #16 & #27 chart.isDirtyLegend = true; chart.series[0].isDirty = true; chart.series[0].isDirtyData = true; chart.redraw(false); } }); HC.approximations = { sum: function (arr) { var len = arr.length, ret; // 1. it consists of nulls exclusively if (!len && arr.hasNulls) { ret = null; // 2. it has a length and real values } else if (len) { ret = 0; while (len--) { ret += arr[len]; } } // 3. it has zero length, so just return undefined // => doNothing() return ret; }, average: function (arr) { var len = arr.length, ret = HC.approximations.sum(arr); // If we have a number, return it divided by the length. If not, return // null or undefined based on what the sum method finds. if (typeof ret === NUMBER && len) { ret = ret / len; } return ret; }, open: function (arr) { return arr.length ? arr[0] : (arr.hasNulls ? null : UNDEFINED); }, high: function (arr) { return arr.length ? HC.arrayMax(arr) : (arr.hasNulls ? null : UNDEFINED); }, low: function (arr) { return arr.length ? HC.arrayMin(arr) : (arr.hasNulls ? null : UNDEFINED); }, close: function (arr) { return arr.length ? arr[arr.length - 1] : (arr.hasNulls ? null : UNDEFINED); }, // ohlc and range are special cases where a multidimensional array is input and an array is output ohlc: function (open, high, low, close) { open = HC.approximations.open(open); high = HC.approximations.high(high); low = HC.approximations.low(low); close = HC.approximations.close(close); if (typeof open === NUMBER || typeof high === NUMBER || typeof low === NUMBER || typeof close === NUMBER) { return [open, high, low, close]; } // else, return is undefined }, range: function (low, high) { low = HC.approximations.low(low); high = HC.approximations.high(high); if (typeof low === NUMBER || typeof high === NUMBER) { return [low, high]; } // else, return is undefined } }; })(Highcharts);
39.965024
244
0.401902
f6fcbd7c1b6b5265570dff8fa18d5a2a3853df78
580
js
JavaScript
tests/pages/index.js
sethphillips/ember-dialogs
a1bdb33c7602307efbb3fbc9fc8c31684cb7c0c0
[ "MIT" ]
11
2017-09-17T12:39:53.000Z
2021-06-22T14:30:57.000Z
tests/pages/index.js
sethphillips/ember-dialogs
a1bdb33c7602307efbb3fbc9fc8c31684cb7c0c0
[ "MIT" ]
9
2017-09-20T11:32:53.000Z
2020-02-20T12:29:47.000Z
tests/pages/index.js
sethphillips/ember-dialogs
a1bdb33c7602307efbb3fbc9fc8c31684cb7c0c0
[ "MIT" ]
6
2017-09-20T17:39:35.000Z
2019-01-04T12:21:22.000Z
import { create, visitable, } from 'ember-cli-page-object' import c from 'dummy/tests/pages/components/_component' import { backdrop, dialog, } from 'dummy/tests/pages/components/dialogs' export default create({ visit : visitable('/'), alertValue : c('.route-index-alertValue'), alertTrigger : c('.route-index-alertTrigger'), confirmValue : c('.route-index-confirmValue'), confirmTrigger : c('.route-index-confirmTrigger'), promptValue : c('.route-index-promptValue'), promptTrigger : c('.route-index-promptTrigger'), backdrop, dialog, })
19.333333
55
0.693103
f6fcdd08b6a1cdff2c9b0cb3ae840bc88422b033
1,359
js
JavaScript
extensions/ohif-segmentation-plugin/src/util/getUnsavedRegions.js
benodry/Viewers
e358d2362d1536b2db286b45fdac7d40f6f24c8f
[ "MIT" ]
3
2019-06-26T13:05:54.000Z
2019-06-28T13:36:38.000Z
extensions/ohif-segmentation-plugin/src/util/getUnsavedRegions.js
benodry/Viewers
e358d2362d1536b2db286b45fdac7d40f6f24c8f
[ "MIT" ]
7
2019-06-26T20:02:27.000Z
2021-09-01T07:24:22.000Z
extensions/ohif-segmentation-plugin/src/util/getUnsavedRegions.js
benodry/Viewers
e358d2362d1536b2db286b45fdac7d40f6f24c8f
[ "MIT" ]
5
2019-06-26T13:05:56.000Z
2021-09-15T12:09:51.000Z
import { store } from 'cornerstone-tools'; const modules = store.modules; export default function () { const masks = _getUnsavedMasks(); const contours = _getUnsavedContours(); return { masks, contours, hasUnsavedRegions: !!(masks.length || contours.length) }; } function _getUnsavedContours() { const freehandModule = modules.freehand3D; const getStructureSet = freehandModule.getters.structureSet; const seriesCollection = freehandModule.state.seriesCollection; const unsavedContours = []; seriesCollection.forEach(series => { const seriesInstanceUid = series.uid; const activeStructureSet = getStructureSet(seriesInstanceUid); if (activeStructureSet.ROIContourCollection.length) { unsavedContours.push(seriesInstanceUid); } }); return unsavedContours; } function _getUnsavedMasks() { const brushModule = modules.brush; const segmentationMetadata = brushModule.state.segmentationMetadata; const unsavedMasks = []; Object.keys(segmentationMetadata).forEach(seriesInstanceUid => { const importMetadata = brushModule.getters.importMetadata(seriesInstanceUid); // If the segmentation is "imported" and not "modified", its saved. if (importMetadata && !importMetadata.modified) { return; } unsavedMasks.push(seriesInstanceUid); }); return unsavedMasks; }
25.641509
81
0.736571
f6fce9e82c57b248ee92e02f23d11e04e0706f13
3,699
js
JavaScript
app/javascript/components/Merchant/GenerateForm.js
ittyjose/journal
260095656541bec4ab37246f55478b34a5550914
[ "MIT" ]
null
null
null
app/javascript/components/Merchant/GenerateForm.js
ittyjose/journal
260095656541bec4ab37246f55478b34a5550914
[ "MIT" ]
null
null
null
app/javascript/components/Merchant/GenerateForm.js
ittyjose/journal
260095656541bec4ab37246f55478b34a5550914
[ "MIT" ]
null
null
null
import React, { useState } from "react"; import { useForm } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers"; import * as yup from "yup"; import { useHistory, Route, useRouteMatch } from "react-router-dom"; import Input from "Common/Form/Input"; import LocalBodyForm from "Common/LocalBodyForm"; import Button from "Common/Button"; import { create as merchantCreate } from "Apis/MerchantApi"; import VerifyOtp from "./VerifyOtp"; const schema = yup.object().shape({ name: yup.string().required("Please enter name of shop"), phone_number: yup .string() .trim() .required("Please enter mobile number") .length(10, "Please enter 10 digit mobile number"), address: yup.string().trim().required("Please enter address"), local_body: yup.mixed().required("Please enter local body"), }); function GenerateForm() { const history = useHistory(); const match = useRouteMatch(); const [loading, setLoading] = useState(false); const form = useForm({ resolver: yupResolver(schema), }); const { register, handleSubmit, errors } = form; const handleFormValues = async (formData) => { setLoading(true); const response = await merchantCreate(formData); setLoading(false); history.push(`/merchant/verify-otp?id=${response.data.temp_id}`); }; return ( <div className="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8"> <div className="sm:mx-auto sm:w-full sm:max-w-md"> <h2 className="mt-6 text-center text-3xl leading-9 font-extrabold text-gray-900"> Generate QR Code </h2> <Route exact path={`${match.path}/`}> <p className="mt-2 text-center text-sm leading-5 text-gray-600 max-w"> Filling this form will generate a QR code for your shop/establishment. </p> <div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md"> <div className="bg-white py-6 px-4 shadow sm:rounded-lg sm:px-10"> <form noValidate onSubmit={handleSubmit(handleFormValues)}> <Input name="name" label="Shop Name" required placeholder="Name of the establishment/shop/premises" register={register} errors={errors} /> <Input name="phone_number" label="Mobile number" required placeholder="10 digit mobile number" register={register} errors={errors} /> <Input as="textarea" name="address" rows={6} label="Address" required placeholder="Complete address of the establishment/shop/premises" register={register} errors={errors} /> <LocalBodyForm form={form} /> <div className="mt-6"> <span className="block w-full rounded-md shadow-sm"> <Button htmlType="submit" colorType="primary" sizeType="lg" loading={loading} block > Generate </Button> </span> </div> </form> </div> </div> </Route> <Route path={`${match.path}/verify-otp`}> <VerifyOtp /> </Route> </div> </div> ); } export default GenerateForm;
34.25
96
0.533928
f6fdd5e554c47aebe4993165bbd3c93262fc8c14
1,253
js
JavaScript
test/built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfExpand.js
catamorphism/test262
99b2a70789b27d433f9036b98572a4443d91e01f
[ "BSD-3-Clause" ]
1
2019-07-21T10:06:30.000Z
2019-07-21T10:06:30.000Z
test/built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfExpand.js
romulocintra/test262
53d6cd6d463df461e1c506e0d2be4e36de0ef6fa
[ "BSD-3-Clause" ]
null
null
null
test/built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfExpand.js
romulocintra/test262
53d6cd6d463df461e1c506e0d2be4e36de0ef6fa
[ "BSD-3-Clause" ]
null
null
null
// Copyright (C) 2022 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-temporal.plaintime.prototype.round description: Tests calculations with roundingMode "floor". features: [Temporal] includes: [temporalHelpers.js] ---*/ const plainTime = Temporal.PlainTime.from("13:46:23.123456789"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "hour", roundingMode: "halfExpand" }), 14, 0, 0, 0, 0, 0, "hour"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "minute", roundingMode: "halfExpand" }), 13, 46, 0, 0, 0, 0, "minute"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "second", roundingMode: "halfExpand" }), 13, 46, 23, 0, 0, 0, "second"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "millisecond", roundingMode: "halfExpand" }), 13, 46, 23, 123, 0, 0, "millisecond"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "microsecond", roundingMode: "halfExpand" }), 13, 46, 23, 123, 457, 0, "microsecond"); TemporalHelpers.assertPlainTime( plainTime.round({ smallestUnit: "nanosecond", roundingMode: "halfExpand" }), 13, 46, 23, 123, 456, 789, "nanosecond");
34.805556
79
0.71668
f6fe72c74a7e9c953088299ca68589cb4dbe022b
2,086
js
JavaScript
src/EChart/echartTheme.js
liuderchi/mcs-ui
fef6ae53711ea3916e2d326f47700862661d4fe4
[ "MIT" ]
5
2018-10-19T10:06:53.000Z
2020-09-17T02:29:34.000Z
src/EChart/echartTheme.js
liuderchi/mcs-ui
fef6ae53711ea3916e2d326f47700862661d4fe4
[ "MIT" ]
205
2018-10-19T05:57:30.000Z
2021-04-26T12:42:13.000Z
src/EChart/echartTheme.js
liuderchi/mcs-ui
fef6ae53711ea3916e2d326f47700862661d4fe4
[ "MIT" ]
2
2018-10-22T09:27:56.000Z
2021-02-18T05:36:46.000Z
// @flow import { type Theme } from '../utils/type.flow'; import theme, { fontFamily } from '../utils/theme'; const { color: { grayLight, grayBase, grayDark, warning, primary, success, black, white, }, }: Theme = theme; const axisCommon = { axisLine: { lineStyle: { color: grayBase, }, }, axisTick: { show: false, }, axisLabel: { textStyle: { fontSize: 12, color: grayDark, }, interval: 0, }, splitLine: { show: false, }, splitArea: { show: false, }, nameGap: 15, nameTextStyle: { color: grayDark, }, }; export default { // Note: Global font style textStyle: { color: black, fontSize: 14, fontFamily, }, // Note: SVG container padding grid: { left: '8%', right: '3%', }, color: [warning, primary, success], legend: { textStyle: { padding: [2, 0, 0, 0], }, itemHeight: 14, itemWidth: 14, itemGap: 10, inactiveColor: grayBase, x: 'right', padding: [0, 15, 0, 0], }, dataZoom: { showDataShadow: true, height: 20, handleSize: '100%', backgroundColor: '#F2F2F2', dataBackground: { lineStyle: { color: grayDark, opacity: 0.2, }, areaStyle: { color: grayBase, opacity: 0.2, }, }, fillerColor: 'rgba(53, 54, 48, 0.05)', handleColor: 'rgba(53, 54, 48, 0.2)', borderColor: grayBase, textStyle: { color: grayDark, }, }, tooltip: { trigger: 'axis', backgroundColor: grayLight, borderWidth: 1, borderColor: grayBase, padding: 10, textStyle: { color: black, }, axisPointer: { type: 'line', lineStyle: { color: grayBase, }, label: { backgroundColor: grayDark, color: white, margin: 5, }, }, extraCssText: 'box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.2); border-radius: 3px;', }, timeAxis: axisCommon, logAxis: axisCommon, valueAxis: axisCommon, categoryAxis: axisCommon, };
17.383333
72
0.532119
f6fe85f47fb6a344ba4a91cd9c1d99fbe7f13277
962
js
JavaScript
store/emails/sagas.js
Jovisx/email-checking-admin
98f722df691485a4cd8e2708ea7a2b5250219ec7
[ "MIT" ]
null
null
null
store/emails/sagas.js
Jovisx/email-checking-admin
98f722df691485a4cd8e2708ea7a2b5250219ec7
[ "MIT" ]
null
null
null
store/emails/sagas.js
Jovisx/email-checking-admin
98f722df691485a4cd8e2708ea7a2b5250219ec7
[ "MIT" ]
null
null
null
import { all, put, call, takeLatest } from 'redux-saga/effects'; import * as api from 'utils/api'; import extractErrors from 'utils/error'; import { GET_EMAILS_REQUEST, MOVE_EMAIL_REQUEST, emailsActions, } from './actions'; export function* getEmails({ payload }) { try { const response = yield call(api.getEmails, payload); yield put(emailsActions.getEmailsSuccess(response.data)); } catch (err) { const errors = extractErrors(err); yield put(emailsActions.getEmailsFailure({ errors })); } } export function* moveEmail({ payload }) { try { const response = yield call(api.moveEmail, payload); yield put(emailsActions.moveEmailsSuccess(response.data)); } catch (err) { const errors = extractErrors(err); yield put(emailsActions.moveEmailFailure({ errors })); } } export default function* () { yield all([ takeLatest(GET_EMAILS_REQUEST, getEmails), takeLatest(MOVE_EMAIL_REQUEST, moveEmail) ]); }
26
64
0.700624
f6ff915b064d70a556347d369f2c37a49e4a3357
1,635
js
JavaScript
src/pages/ContactFormPage.js
rodrigoff/react-contact-manager
2a8eca0c526404a9c4f5c6a12f3ea61ce4c69456
[ "MIT" ]
null
null
null
src/pages/ContactFormPage.js
rodrigoff/react-contact-manager
2a8eca0c526404a9c4f5c6a12f3ea61ce4c69456
[ "MIT" ]
null
null
null
src/pages/ContactFormPage.js
rodrigoff/react-contact-manager
2a8eca0c526404a9c4f5c6a12f3ea61ce4c69456
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { Redirect } from "react-router"; import { SubmissionError } from "redux-form"; import { connect } from "react-redux"; import ContactForm from "../components/ContactForm"; import { newContact, saveContact, fetchContact, updateContact } from "../actions/contactActions"; class ContactFormPage extends Component { state = { redirect: false }; componentDidMount() { const { _id } = this.props.match.params; if (_id) { this.props.fetchContact(_id); } else { this.props.newContact(); } } submit = contact => { if (!contact._id) { return this.props .saveContact(contact) .then(response => this.setState({ redirect: true })) .catch(err => { throw new SubmissionError(this.props.errors); }); } else { return this.props .updateContact(contact) .then(response => this.setState({ redirect: true })) .catch(err => { throw new SubmissionError(this.props.errors); }); } }; render() { return ( <div> {this.state.redirect ? ( <Redirect to="/" /> ) : ( <ContactForm contact={this.props.contact} loading={this.props.loading} onSubmit={this.submit} /> )} </div> ); } } function mapStateToProps(state) { return { contact: state.contactStore.contact, errors: state.contactStore.errors }; } export default connect(mapStateToProps, { newContact, saveContact, fetchContact, updateContact })(ContactFormPage);
21.513158
60
0.587156
f6ffa44b4880e457a7856211ff135e2d6d8ece78
528
js
JavaScript
packages/tests-react-native/node-mock/util/index.js
ton-actions/ton-client-js
988d335f8f3f706466d6bc944a5410ec412a7f74
[ "Apache-2.0" ]
60
2019-09-09T17:02:19.000Z
2022-02-08T14:18:16.000Z
packages/tests-react-native/node-mock/util/index.js
ton-actions/ton-client-js
988d335f8f3f706466d6bc944a5410ec412a7f74
[ "Apache-2.0" ]
23
2019-09-15T13:49:54.000Z
2022-02-03T18:41:01.000Z
packages/tests-react-native/node-mock/util/index.js
ton-actions/ton-client-js
988d335f8f3f706466d6bc944a5410ec412a7f74
[ "Apache-2.0" ]
13
2020-02-09T06:52:28.000Z
2022-02-03T20:04:13.000Z
/* * Copyright 2018-2020 TON DEV SOLUTIONS LTD. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific TON DEV software governing permissions and * limitations under the License. * */
33
82
0.75
1000533acbafe253d0a1b9bec18508de0630e4cb
956
js
JavaScript
web/web/static/web/js/controllers/main.js
rcbops/FleetDeploymentReporting
aaab76706c8268d3ff3e87c275baee9dd4714314
[ "Apache-2.0" ]
1
2018-07-11T20:20:21.000Z
2018-07-11T20:20:21.000Z
web/web/static/web/js/controllers/main.js
rcbops/FleetDeploymentReporting
aaab76706c8268d3ff3e87c275baee9dd4714314
[ "Apache-2.0" ]
46
2018-08-08T19:46:15.000Z
2019-02-22T20:33:49.000Z
web/web/static/web/js/controllers/main.js
rcbops/FleetDeploymentReporting
aaab76706c8268d3ff3e87c275baee9dd4714314
[ "Apache-2.0" ]
7
2018-06-26T15:27:55.000Z
2018-12-05T19:41:25.000Z
/** * Main controller. Holds various app wide things. */ angular.module("cloudSnitch").controller("MainController", ["$scope", "$route", "typesService", function($scope, $route, typesService) { $scope.subApp = null; $scope.types = []; $scope.typesService = typesService; $scope.ready = false; function handleRouteChange() { $scope.subApp = $route.current.action || null; } $scope.$watch("typesService.isLoading()", function(isLoading) { if (!isLoading) { $scope.ready = true; } }); $scope.$on("$routeChangeSuccess", handleRouteChange); // @TODO - Remove these operators. They now come from the typesService $scope.operators = [ "=", "<", "<=", ">", ">=", "<>", "CONTAINS", "STARTS WITH", "ENDS WITH" ]; $scope.changeSubApp = function(newApp) { $scope.subApp = newApp; }; }]);
23.9
136
0.547071
10005b87a5c5706432c4d91381c38357fe87e25f
424
js
JavaScript
app/playground.js
Grokling/react-proof-of-concept
fc2e7e67f976729aab0503da6ff6bafb233409e6
[ "CC0-1.0" ]
null
null
null
app/playground.js
Grokling/react-proof-of-concept
fc2e7e67f976729aab0503da6ff6bafb233409e6
[ "CC0-1.0" ]
null
null
null
app/playground.js
Grokling/react-proof-of-concept
fc2e7e67f976729aab0503da6ff6bafb233409e6
[ "CC0-1.0" ]
null
null
null
import { render } from 'react-dom'; import { Provider } from 'react-redux'; import Templates from './templates/component.js'; import configureStore from './configure-store.js'; import documents from './pouch/feed.js'; import React from 'react'; const store = configureStore(); const documentStore = documents(store); render( <Provider store={store}> <Templates /> </Provider>, document.getElementById('root') );
24.941176
50
0.716981
1000f9733fb3b7b4527b01d5512e4872b73ab3e2
2,449
js
JavaScript
local-cli/core/__tests__/ios/findProject.spec.js
keenjus/react-native
da4fcde55a1d83eb7be263876ac20d516751e7dd
[ "BSD-3-Clause" ]
15
2018-03-11T23:50:11.000Z
2021-12-24T08:41:05.000Z
local-cli/core/__tests__/ios/findProject.spec.js
keenjus/react-native
da4fcde55a1d83eb7be263876ac20d516751e7dd
[ "BSD-3-Clause" ]
13
2015-08-15T00:56:51.000Z
2020-09-13T17:42:36.000Z
local-cli/core/__tests__/ios/findProject.spec.js
keenjus/react-native
da4fcde55a1d83eb7be263876ac20d516751e7dd
[ "BSD-3-Clause" ]
8
2015-09-28T22:22:49.000Z
2017-12-22T05:26:01.000Z
/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @format */ 'use strict'; const findProject = require('../../ios/findProject'); const mockFS = require('mock-fs'); const projects = require('../../__fixtures__/projects'); const ios = require('../../__fixtures__/ios'); describe('ios::findProject', () => { it('returns path to xcodeproj if found', () => { mockFS(projects.flat); expect(findProject('')).not.toBeNull(); }); it('returns null if there are no projects', () => { mockFS({testDir: projects}); expect(findProject('')).toBeNull(); }); it('returns ios project regardless of its name', () => { mockFS({ios: ios.validTestName}); expect(findProject('')).not.toBeNull(); }); it('ignores node_modules', () => { mockFS({node_modules: projects.flat}); expect(findProject('')).toBeNull(); }); it('ignores Pods', () => { mockFS({Pods: projects.flat}); expect(findProject('')).toBeNull(); }); it('ignores Pods inside `ios` folder', () => { mockFS({ ios: { Pods: projects.flat, DemoApp: projects.flat.ios, }, }); expect(findProject('')).toBe('ios/DemoApp/demoProject.xcodeproj'); }); it('ignores xcodeproj from example folders', () => { mockFS({ examples: projects.flat, Examples: projects.flat, example: projects.flat, KeychainExample: projects.flat, Zpp: projects.flat, }); expect(findProject('').toLowerCase()).not.toContain('example'); }); it('ignores xcodeproj from sample folders', () => { mockFS({ samples: projects.flat, Samples: projects.flat, sample: projects.flat, KeychainSample: projects.flat, Zpp: projects.flat, }); expect(findProject('').toLowerCase()).not.toContain('sample'); }); it('ignores xcodeproj from test folders at any level', () => { mockFS({ test: projects.flat, IntegrationTests: projects.flat, tests: projects.flat, Zpp: { tests: projects.flat, src: projects.flat, }, }); expect(findProject('').toLowerCase()).not.toContain('test'); }); afterEach(() => { mockFS.restore(); }); });
25.247423
78
0.607595
10011408c45f76147b53598fd26045e05ff3086d
97
js
JavaScript
src/utils/Currency.js
Naess/react-cost-calculator
e69ec5d375cbea259c61ff98375a82b42d668e0e
[ "MIT" ]
null
null
null
src/utils/Currency.js
Naess/react-cost-calculator
e69ec5d375cbea259c61ff98375a82b42d668e0e
[ "MIT" ]
null
null
null
src/utils/Currency.js
Naess/react-cost-calculator
e69ec5d375cbea259c61ff98375a82b42d668e0e
[ "MIT" ]
null
null
null
export function formatDollars(number) { return '$' + Number(number).toLocaleString('en') }
24.25
52
0.690722
10015bd7c02719953572deebbd51015c47f8c8e6
2,587
js
JavaScript
tests/lib/all.js
shuckster/eslint-plugin-big-number-rules
2f79e0d19d402c5f8180936e14705def137fc09d
[ "MIT" ]
3
2021-05-08T21:16:40.000Z
2021-12-30T05:38:18.000Z
tests/lib/all.js
shuckster/eslint-plugin-big-number-rules
2f79e0d19d402c5f8180936e14705def137fc09d
[ "MIT" ]
2
2022-01-23T21:38:42.000Z
2022-01-24T02:12:12.000Z
tests/lib/all.js
shuckster/eslint-plugin-big-number-rules
2f79e0d19d402c5f8180936e14705def137fc09d
[ "MIT" ]
null
null
null
const path = require('path') const RuleTester = require('eslint').RuleTester const { baseEslintSettings, configsPath, getExampleEslintConfigsForOtherLibs, loadJsonFile, bigNumberRules, filter, map, flow, tryCatch } = require('./common') const suites = [ require('./arithmetic'), require('./assignment'), require('./is-nan'), require('./math'), require('./number'), require('./parse-float'), require('./rounding') ] let errorCode = 0 function main() { loadJsonFile(path.join(configsPath, 'default.json')) .then(testAllSuitesAgainstEslintConfig) .then(logWhenDoneWith()) .then(runTestSuitesAgainstCustomEslintConfigs) .finally(() => { console.log(new Date().toTimeString()) process.exit(errorCode) }) } function testAllSuitesAgainstEslintConfig(customEslintSettings) { const eslintSettings = { ...baseEslintSettings, ...customEslintSettings } const ruleTester = new RuleTester(eslintSettings) const config = bigNumberRules(eslintSettings) const suitesOpts = suites .map(({ makeTest }) => makeTest(config)) .map(({ invalidTests: invalid, validTests: valid, ...rest }) => ({ testCases: { valid, invalid }, ...rest })) const ruleTestersToRun = suitesOpts.map(opts => runRuleTester({ ruleTester, config, ...opts }) ) return Promise.allSettled(ruleTestersToRun) .then(filter(result => result.status === 'rejected')) .then(map(result => result.reason)) .then(errors => { if (errors.length) { errorCode = 1 } errors.forEach(console.error) }) } function runRuleTester({ ruleTester, config, name, rule, testCases }) { return new Promise((resolve, reject) => tryCatch(() => ruleTester.run(name, rule, testCases)).fold( flow( error => [error, config.construct, name, JSON.stringify(rule, null, 2)], ([$1, $2, $3, $4]) => `${$1}\n\\_ ${$2} // ${$3}\nrule: ${$4}\n`, reject ), resolve ) ) } function runTestSuitesAgainstCustomEslintConfigs() { return getExampleEslintConfigsForOtherLibs().then(runTestsAgainstAll) function runTestsAgainstAll(configs) { return Promise.all(configs.map(runTestsAgainstThis)) } function runTestsAgainstThis(config) { return testAllSuitesAgainstEslintConfig(config).finally( logWhenDoneWith(config) ) } } function logWhenDoneWith(config) { const { construct = 'DEFAULT' } = config?.settings['big-number-rules'] || {} const message = `Tests finished using: ${construct}` return () => console.log(message) } main()
25.613861
80
0.659838
100200ea5994f1c40f067ec58d60d5e9b8a3725e
2,494
js
JavaScript
assets/js/article/art_pub.js
wu-yiqiang/bigThings
dcb173371ceea6aff938c7895b514fa46b118e70
[ "MIT" ]
null
null
null
assets/js/article/art_pub.js
wu-yiqiang/bigThings
dcb173371ceea6aff938c7895b514fa46b118e70
[ "MIT" ]
null
null
null
assets/js/article/art_pub.js
wu-yiqiang/bigThings
dcb173371ceea6aff938c7895b514fa46b118e70
[ "MIT" ]
null
null
null
$(function() { var layer = layui.layer var form = layui.form initCate() // 初始化富文本编辑器 initEditor() // 定义加载文章分类的方法 function initCate() { $.ajax({ method: 'GET', url: '/my/article/cates', success: function(res) { if (res.status !== 0) { return layer.msg('初始化文章分类失败!') } // 调用模板引擎,渲染分类的下拉菜单 var htmlStr = template('tpl-cate', res) $('[name=cate_id]').html(htmlStr) // 一定要记得调用 form.render() 方法 form.render() } }) } // 1. 初始化图片裁剪器 var $image = $('#image') // 2. 裁剪选项 var options = { aspectRatio: 400 / 280, preview: '.img-preview' } // 3. 初始化裁剪区域 $image.cropper(options) // 为选择封面的按钮,绑定点击事件处理函数 $('#btnChooseImage').on('click', function() { $('#coverFile').click() }) // 监听 coverFile 的 change 事件,获取用户选择的文件列表 $('#coverFile').on('change', function(e) { // 获取到文件的列表数组 var files = e.target.files // 判断用户是否选择了文件 if (files.length === 0) { return } // 根据文件,创建对应的 URL 地址 var newImgURL = URL.createObjectURL(files[0]) // 为裁剪区域重新设置图片 $image .cropper('destroy') // 销毁旧的裁剪区域 .attr('src', newImgURL) // 重新设置图片路径 .cropper(options) // 重新初始化裁剪区域 }) // 定义文章的发布状态 var art_state = '已发布' // 为存为草稿按钮,绑定点击事件处理函数 $('#btnSave2').on('click', function() { art_state = '草稿' }) // 为表单绑定 submit 提交事件 $('#form-pub').on('submit', function(e) { // 1. 阻止表单的默认提交行为 e.preventDefault() // 2. 基于 form 表单,快速创建一个 FormData 对象 var fd = new FormData($(this)[0]) // 3. 将文章的发布状态,存到 fd 中 fd.append('state', art_state) // 4. 将封面裁剪过后的图片,输出为一个文件对象 $image .cropper('getCroppedCanvas', { // 创建一个 Canvas 画布 width: 400, height: 280 }) .toBlob(function(blob) { // 将 Canvas 画布上的内容,转化为文件对象 // 得到文件对象后,进行后续的操作 // 5. 将文件对象,存储到 fd 中 fd.append('cover_img', blob) // 6. 发起 ajax 数据请求 publishArticle(fd) }) }) // 定义一个发布文章的方法 function publishArticle(fd) { $.ajax({ method: 'POST', url: '/my/article/add', data: fd, // 注意:如果向服务器提交的是 FormData 格式的数据, // 必须添加以下两个配置项 contentType: false, processData: false, success: function(res) { if (res.status !== 0) { return layer.msg('发布文章失败!') } layer.msg('发布文章成功!') // 发布文章成功后,跳转到文章列表页面 location.href = '/article/art_list.html' } }) } })
21.686957
49
0.539695
100210a751297f29b1cd792079c67e9bacf507fc
1,907
js
JavaScript
pages/api/parents/index.js
romseguy/elc
035c02c5cbca8e7071d19ba1d41b3f75bb518b5a
[ "MIT" ]
null
null
null
pages/api/parents/index.js
romseguy/elc
035c02c5cbca8e7071d19ba1d41b3f75bb518b5a
[ "MIT" ]
null
null
null
pages/api/parents/index.js
romseguy/elc
035c02c5cbca8e7071d19ba1d41b3f75bb518b5a
[ "MIT" ]
null
null
null
import nextConnect from "next-connect"; import middleware from "middlewares/database"; import { createServerError, databaseErrorCodes } from "middlewares/errors"; import { getSession } from "utils/useAuth"; const handler = nextConnect(); handler.use(middleware); handler.get(async function getParents(req, res) { const session = await getSession({ req }); // if (!session) { // res // .status(403) // .json( // createServerError( // new Error("Vous devez être identifié pour accéder à ce contenu.") // ) // ); // } else { try { const parents = await req.models.Parent.find({}); res.status(200).json({ data: parents }); } catch (error) { res.status(400).json(createServerError(error)); } //} }); handler.post(async function postParent(req, res) { const session = await getSession({ req }); if (!session) { res.send({ error: "Vous devez être identifié pour accéder à ce contenu." }); } else { try { const { firstname, lastname, email, children } = req.body; const parent = await req.models.Parent.create({ firstname, lastname, email, children }); // add reference to the parent to his/her child's profile if (Array.isArray(children)) { for (const _id of children) { const childProfile = await req.models.Profile.findOne({ _id }); childProfile.parents = childProfile.parents.concat([parent._id]); await childProfile.save(); } } res.status(200).json({ data: parent }); } catch (error) { if (error.code && error.code === databaseErrorCodes.DUPLICATE_KEY) { res .status(400) .json({ email: "Un parent avec cette adresse email existe déjà" }); } else { res.status(400).json(createServerError(error)); } } } }); export default handler;
28.462687
80
0.606188
10021e21d749b02218e38361cdda398383fa1d4f
43
js
JavaScript
packages/web/src/components/FooterNavList/index.js
danilucaci/danilucaci.com
c62654cd9a8c1c3a7e0b0d19aa9eaa7110d84b0c
[ "MIT" ]
1
2020-09-07T11:18:34.000Z
2020-09-07T11:18:34.000Z
packages/web/src/components/FooterNavList/index.js
danilucaci/danilucaci.com
c62654cd9a8c1c3a7e0b0d19aa9eaa7110d84b0c
[ "MIT" ]
15
2020-04-13T07:39:43.000Z
2021-02-19T17:01:26.000Z
packages/web/src/components/FooterNavList/index.js
danilucaci/danilucaci.com
c62654cd9a8c1c3a7e0b0d19aa9eaa7110d84b0c
[ "MIT" ]
null
null
null
export { default } from "./FooterNavList";
21.5
42
0.697674
1002844cc699daf9781a29ea2bddf6a341f06f22
3,843
js
JavaScript
plugins/file-open-save-new/core/src/main/javascript/app/components/filebar/filebar.component.js
guofs225/pentaho-kettle
3df41f5f5555ce67d5131eadb25d3c6ce3b2f519
[ "Apache-2.0" ]
3
2017-03-17T16:12:31.000Z
2021-01-06T12:28:00.000Z
plugins/file-open-save-new/core/src/main/javascript/app/components/filebar/filebar.component.js
zty812376/pentaho-kettle
052df1d3f656a418242d6ada965b0d70210c3aaf
[ "Apache-2.0" ]
null
null
null
plugins/file-open-save-new/core/src/main/javascript/app/components/filebar/filebar.component.js
zty812376/pentaho-kettle
052df1d3f656a418242d6ada965b0d70210c3aaf
[ "Apache-2.0" ]
1
2019-12-11T04:03:10.000Z
2019-12-11T04:03:10.000Z
/*! * Copyright 2019 Hitachi Vantara. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The filebar component. * * This provides the component for the filebar functionality. * @module components/filebar/filebar.component * @property {String} name The name of the Angular component. * @property {Object} options The JSON object containing the configurations for this component. **/ define([ "pentaho/i18n-osgi!file-open-save-new.messages", "text!./filebar.html", "css!./filebar.css" ], function (i18n, filebarTemplate) { "use strict"; var options = { bindings: { path: '<', state: "<", filename: "=", onSelectFilter: "&", onOpenClick: "&", onOKClick: "&", onSaveClick: "&", onCancelClick: "&" }, template: filebarTemplate, controllerAs: "vm", controller: filebarController }; filebarController.$inject = ['$timeout']; /** * The filebar Controller. * * This provides the controller for the filebar component. */ function filebarController($timeout) { var vm = this; vm.$onInit = onInit; vm.$onChanges = onChanges; vm.onSelect = onSelect; vm.onChange = onChange; vm.fileFilters = [ { value: "all", label: "All Files" }, { value: "\\.kjb$|\\.ktr$", label: "Kettle Files" }, { value: "\\.csv$", label: "*.csv" }, { value: "\\.txt$", label: "*.txt" }, { value: "\\.json$", label: "*.json" } ]; /** * The $onInit} hook of components lifecycle which is called on each controller * after all the controllers on an element have been constructed and had their * bindings initialized. We use this hook to put initialization code for our controller. */ function onInit() { vm.saveFileNameLabel = i18n.get("file-open-save-plugin.app.save.file-name.label"); vm.openButton = i18n.get("file-open-save-plugin.app.open.button"); vm.cancelButton = i18n.get("file-open-save-plugin.app.cancel.button"); vm.saveButton = i18n.get("file-open-save-plugin.app.save.button"); vm.okButton = i18n.get("file-open-save-plugin.app.ok.button"); vm.confirmButton = i18n.get("file-open-save-plugin.app.save.button"); vm.saveFileNameLabel = i18n.get("file-open-save-plugin.app.save.file-name.label"); vm.fileFilterLabel = i18n.get("file-open-save-plugin.app.save.file-filter.label"); vm.saveFileNameLabel = i18n.get("file-open-save-plugin.app.save.file-name.label"); vm.selectedFilter = vm.fileFilters[0].value; } /** * Called whenever one-way bindings are updated. * * @param {Object} changes - hash whose keys are the names of the bound properties * that have changed, and the values are an object of the form */ function onChanges(changes) { $timeout(function() { _update(); }); } function onSelect(filter) { vm.onSelectFilter({filter: filter}); } function onChange() { _update(); } function _update() { vm.isSaveEnabled = vm.filename === '' || !vm.path; } } return { name: "filebar", options: options }; });
28.679104
95
0.617486
1002e1992ed703d1c070cf9582df4a9326595b8d
365
js
JavaScript
index.js
gusbdev/nodejs-template-rest-api
5a39ce91065a375b22f432b37621bbf4791ebaff
[ "MIT" ]
null
null
null
index.js
gusbdev/nodejs-template-rest-api
5a39ce91065a375b22f432b37621bbf4791ebaff
[ "MIT" ]
null
null
null
index.js
gusbdev/nodejs-template-rest-api
5a39ce91065a375b22f432b37621bbf4791ebaff
[ "MIT" ]
null
null
null
var express = require("express"); var app = express(); var router = require("./routes/routes"); const PORT = 8080; // parse application/x-www-form-urlencoded app.use(express.urlencoded({ extended: false })); // parse application/json app.use(express.json()); app.use("/", router); app.listen(PORT, () => { console.log(`Server is running on port ${PORT}`); })
24.333333
53
0.671233
100306d70ca78077ccbc4914b887c495da2a22cc
183
js
JavaScript
app/collections/profiles.js
madtrick/real.js
edc4118fea278bcf9ee54081d6cfd7ac5db19930
[ "Apache-2.0" ]
null
null
null
app/collections/profiles.js
madtrick/real.js
edc4118fea278bcf9ee54081d6cfd7ac5db19930
[ "Apache-2.0" ]
null
null
null
app/collections/profiles.js
madtrick/real.js
edc4118fea278bcf9ee54081d6cfd7ac5db19930
[ "Apache-2.0" ]
null
null
null
'use strict'; var Backbone = require('backbone-associations'); var Profile = require('../models/profile'); module.exports = Backbone.Collection.extend({ model: Profile });
20.333333
51
0.688525
1003644fba8ab8a8a4efda715dd90ba40479fa51
717
js
JavaScript
test/setup.js
sirhoe/clickatell-sms
09f0197d8a2f0be372f4aa30c62f26dae01ed26c
[ "MIT" ]
null
null
null
test/setup.js
sirhoe/clickatell-sms
09f0197d8a2f0be372f4aa30c62f26dae01ed26c
[ "MIT" ]
null
null
null
test/setup.js
sirhoe/clickatell-sms
09f0197d8a2f0be372f4aa30c62f26dae01ed26c
[ "MIT" ]
null
null
null
'use strict'; const expect = require('chai').expect; const ERRORS = require('../lib/errors'); const Clickatell = require('../lib/index'); describe('Initialization and instantiation', async () => { it(`should thorw \"${ERRORS.API_REQUIRED}\" errro when instantiated without key`, () => { expect(require('../index')).to.throw(ERRORS.API_REQUIRED); }); it('should instantiate a new Clickatell Object when required with apiKey', () => { const target = require('../index')('key'); expect(target).to.be.a('object'); expect(target).to.be.an.instanceOf(Clickatell); expect(target.sendSMS).to.exist; expect(typeof target.sendSMS).to.equal('function'); }); });
37.736842
93
0.635983
100379bb43c0a2f685e85a72f568e6e37bbbc11e
199
js
JavaScript
Doc/html/html/structs_mail_node__t.js
VKM96/MailBox
c139930424faeece13757a73f8184e091b503243
[ "MIT" ]
null
null
null
Doc/html/html/structs_mail_node__t.js
VKM96/MailBox
c139930424faeece13757a73f8184e091b503243
[ "MIT" ]
null
null
null
Doc/html/html/structs_mail_node__t.js
VKM96/MailBox
c139930424faeece13757a73f8184e091b503243
[ "MIT" ]
null
null
null
var structs_mail_node__t = [ [ "msg", "structs_mail_node__t.html#adc525266dacc05e195c3b72d140b6b05", null ], [ "next", "structs_mail_node__t.html#a67cb14019eb48bc46327bcafa0cff740", null ] ];
39.8
83
0.763819
10038c6b34c48104a03f5e964dc4480ddcd7e25d
1,542
js
JavaScript
mixins/helpers.js
antwebstudio/fusioncms-helper-js
eb6e5aa05a6f796c77f31f6ede6ea052db0861a8
[ "MIT" ]
null
null
null
mixins/helpers.js
antwebstudio/fusioncms-helper-js
eb6e5aa05a6f796c77f31f6ede6ea052db0861a8
[ "MIT" ]
null
null
null
mixins/helpers.js
antwebstudio/fusioncms-helper-js
eb6e5aa05a6f796c77f31f6ede6ea052db0861a8
[ "MIT" ]
null
null
null
// import form from 'vuejs-form' export default { data() { return { // form: form(), errorMessages: {} } }, methods: { price(price, defaultValue) { if (price != null && price !== '') return parseFloat(price).toFixed(2) if (!_.isUndefined(defaultValue) && defaultValue != null && defaultValue != '') return price(defaultValue) }, optional(value) { return this.defaultValue(value, {}); }, defaultValue(value, defaultValue) { return (typeof(value) != 'undefined' && value != null) ? value : defaultValue; }, error(name, message) { this.errorMessages = { ...this.errorMessages, [name]: message, } }, getError(name) { return _.first(this.errorMessages[name]) }, isUndefined(value) { return _.isUndefined(value) }, dropdown(items, labelAttribute, valueAttribute) { if (_.isUndefined(items) || items == null) return [] return Object.keys(items).map(key => { var item = items[key] return {label: item[labelAttribute], value: item[valueAttribute]} }) }, clone(object) { return JSON.parse(JSON.stringify(object)) } }, computed: { _() { return _ }, console() { return console }, } }
28.555556
118
0.476005
100392e44a24ceecf79565af3cf3e0671f166b13
1,525
js
JavaScript
src/components/SectionNewsletter/styles.js
rogeriorioli/site_ong_elo_gatsby
f06356b94d95604135d0c55c687fe2653472911f
[ "MIT" ]
null
null
null
src/components/SectionNewsletter/styles.js
rogeriorioli/site_ong_elo_gatsby
f06356b94d95604135d0c55c687fe2653472911f
[ "MIT" ]
75
2020-09-29T08:22:29.000Z
2021-07-28T08:40:02.000Z
src/components/SectionNewsletter/styles.js
rogeriorioli/site_ong_elo_gatsby
f06356b94d95604135d0c55c687fe2653472911f
[ "MIT" ]
null
null
null
import styled from 'styled-components'; export const Container = styled.section` padding : 40px; background :#ff2f5a; h2 { color : #fff; &:after { background : #fff; } } p{ color : #fff; text-align : center; font-size : 18px; } .row { margin : 40px 0; width : 100%; display : flow-root; } .col { width : 48%; margin : 1%; display : inline-block; vertical-align : top; } .msg-alert{ p{ color : #fff !important; } } input { background : transparent ; position : relative; border-top : none; border-left : none; border-right : none; border-bottom : 1px solid #fff; outline : none; display : block; margin : auto; padding : 15px; width : 300px; color : #fff; font-size : 16px; &:focus { outline : none; } &::placeholder{ color : #fff; } } button { color : #fff; text-transform : uppercase; font-weight : 500; background : transparent; display : block; padding : 15px; text-align: center; border : 1px solid #fff; width : 200px; margin : 20px auto; &:disabled{ opacity : .3; } } `
21.785714
40
0.426885
10045727ae42d9ce2a418b48b0d848e9094d8b35
1,901
js
JavaScript
ui/src/api/build.js
yinfxs/drone-client
cf53fece37dddf313ee9d11b41e076de2eb7b7a2
[ "Apache-2.0" ]
null
null
null
ui/src/api/build.js
yinfxs/drone-client
cf53fece37dddf313ee9d11b41e076de2eb7b7a2
[ "Apache-2.0" ]
null
null
null
ui/src/api/build.js
yinfxs/drone-client
cf53fece37dddf313ee9d11b41e076de2eb7b7a2
[ "Apache-2.0" ]
null
null
null
import request from '@/utils/request' /** * Build List * Returns recent builds for the repository based on name. Please note this api requires read access to the repository. * @param owner * @param repo */ export function getReposBuilds (owner, repo) { return request({ url: `/api/drone/repos/${owner}/${repo}/builds`, method: 'get' }) } /** * Build Info * Returns the specified repository build. Please note this api requires read access to the repository and the request parameter {build} is not the build id but the build number. * @param owner * @param repo * @param build */ export function getReposBuildInfo (owner, repo, build) { return request({ url: `/api/drone/repos/${owner}/${repo}/builds/${build}`, method: 'get' }) } /** * Build Logs * Please note this api requires read access to the repository. * @param owner * @param repo * @param build * @param pid */ export function getReposBuildInfoLogs (owner, repo, build, pid) { return request({ url: `/api/drone/repos/${owner}/${repo}/logs/${build}/${pid}`, method: 'get' }) } /** * Build Start * Restart the specified build. Please note this api requires read and write access to the repository and the request parameter {build} is not the build id but the build number. * @param owner * @param repo * @param build */ export function postReposBuilds (owner, repo, build) { return request({ url: `/api/drone/repos/${owner}/${repo}/builds/${build}`, method: 'post' }) } /** * Build Stop * Stop the specified build. Please note this api requires administrative privileges and the request parameter {build} is not the build id but the build number. * @param owner * @param repo * @param build */ export function deleteReposBuilds (owner, repo, build) { return request({ url: `/api/drone/repos/${owner}/${repo}/builds/${build}`, method: 'delete' }) }
26.402778
178
0.678064
1004983e819b97e14060b6d4b51406ce224e6556
2,194
js
JavaScript
KafkaApp/node_modules/kafkajs/src/consumer/assignerProtocol.js
matthewlai93/KafkaSentinel
6f8ae637fbed4bfcfd02135821f06f7f68b911e0
[ "MIT" ]
2,542
2017-10-15T18:03:05.000Z
2022-03-30T01:33:48.000Z
KafkaApp/node_modules/kafkajs/src/consumer/assignerProtocol.js
matthewlai93/KafkaSentinel
6f8ae637fbed4bfcfd02135821f06f7f68b911e0
[ "MIT" ]
1,006
2017-11-06T21:15:31.000Z
2022-03-31T16:24:09.000Z
KafkaApp/node_modules/kafkajs/src/consumer/assignerProtocol.js
matthewlai93/KafkaSentinel
6f8ae637fbed4bfcfd02135821f06f7f68b911e0
[ "MIT" ]
411
2017-10-15T04:31:19.000Z
2022-03-30T08:43:47.000Z
const Encoder = require('../protocol/encoder') const Decoder = require('../protocol/decoder') const MemberMetadata = { /** * @param {Object} metadata * @param {number} metadata.version * @param {Array<string>} metadata.topics * @param {Buffer} [metadata.userData=Buffer.alloc(0)] * * @returns Buffer */ encode({ version, topics, userData = Buffer.alloc(0) }) { return new Encoder() .writeInt16(version) .writeArray(topics) .writeBytes(userData).buffer }, /** * @param {Buffer} buffer * @returns {Object} */ decode(buffer) { const decoder = new Decoder(buffer) return { version: decoder.readInt16(), topics: decoder.readArray(d => d.readString()), userData: decoder.readBytes(), } }, } const MemberAssignment = { /** * @param {number} version * @param {Object<String,Array>} assignment, example: * { * 'topic-A': [0, 2, 4, 6], * 'topic-B': [0, 2], * } * @param {Buffer} [userData=Buffer.alloc(0)] * * @returns Buffer */ encode({ version, assignment, userData = Buffer.alloc(0) }) { return new Encoder() .writeInt16(version) .writeArray( Object.keys(assignment).map(topic => new Encoder().writeString(topic).writeArray(assignment[topic]) ) ) .writeBytes(userData).buffer }, /** * @param {Buffer} buffer * @returns {Object|null} */ decode(buffer) { const decoder = new Decoder(buffer) const decodePartitions = d => d.readInt32() const decodeAssignment = d => ({ topic: d.readString(), partitions: d.readArray(decodePartitions), }) const indexAssignment = (obj, { topic, partitions }) => Object.assign(obj, { [topic]: partitions }) if (!decoder.canReadInt16()) { return null } return { version: decoder.readInt16(), assignment: decoder.readArray(decodeAssignment).reduce(indexAssignment, {}), userData: decoder.readBytes(), } }, } module.exports = { MemberMetadata, MemberAssignment, }
25.218391
82
0.569736
1004ad0316153250ba7cc0a2b14c90cc4c314efa
60,907
js
JavaScript
src/sap.ui.layout/test/sap/ui/layout/qunit/form/ResponsiveGridLayout.qunit.js
yanaki/openui5
34a438a1bcd42ae4cd1e070388de2fd61618ac1f
[ "Apache-2.0" ]
null
null
null
src/sap.ui.layout/test/sap/ui/layout/qunit/form/ResponsiveGridLayout.qunit.js
yanaki/openui5
34a438a1bcd42ae4cd1e070388de2fd61618ac1f
[ "Apache-2.0" ]
null
null
null
src/sap.ui.layout/test/sap/ui/layout/qunit/form/ResponsiveGridLayout.qunit.js
yanaki/openui5
34a438a1bcd42ae4cd1e070388de2fd61618ac1f
[ "Apache-2.0" ]
null
null
null
/* global QUnit */ // Test only the things relevant for ResponsiveGridLayout. The basic Form functionality // is tested in Form, FormContainer and FormElement qUnit tests. sap.ui.define([ "sap/ui/thirdparty/jquery", "sap/ui/qunit/QUnitUtils", "sap/base/util/each", "sap/ui/layout/form/Form", "sap/ui/layout/form/ResponsiveGridLayout", "sap/ui/layout/form/FormContainer", "sap/ui/layout/form/FormElement", "sap/ui/layout/GridData", "sap/ui/core/VariantLayoutData", "sap/ui/core/Title", "sap/m/Toolbar", "sap/m/Label", "sap/m/Input", "sap/m/Text", "sap/m/Link" ], function( jQuery, qutils, each, Form, ResponsiveGridLayout, FormContainer, FormElement, GridData, VariantLayoutData, Title, Toolbar, Label, Input, Text, Link ) { "use strict"; var oForm; var oResponsiveGridLayout; var oFormContainer1; var oFormContainer2; var oFormElement1; var oFormElement2; var oFormElement3; var oFormElement4; var oLabel1; var oLabel2; var oLabel3; var oLabel4; var oField1; var oField2; var oField3; var oField4; var oTitle; // if some test breaks internal controls of test may not destroyed // what leads to duplicate ID errors in next test function cleanupControl(oControl) { if (oControl && !oControl._bIsBeingDestroyed) { oControl.destroy(); } oControl = undefined; } function initForm(bOneContainer) { oResponsiveGridLayout = new ResponsiveGridLayout("RGL1"); oLabel1 = new Label("L1", {text: "Label 1"}); oLabel2 = new Label("L2", {text: "Label 2"}); oField1 = new Input("I1"); oField2 = new Input("I2"); oFormElement1 = new FormElement("FE1",{ label: oLabel1, fields: [oField1] }); oFormElement2 = new FormElement("FE2",{ label: oLabel2, fields: [oField2] }); oFormContainer1 = new FormContainer("FC1",{ formElements: [ oFormElement1, oFormElement2 ] }); var aFormContainers = [oFormContainer1]; if (!bOneContainer) { oLabel3 = new Label("L3", {text: "Label 3"}); oLabel4 = new Label("L4", {text: "Label 4"}); oField3 = new Input("I3"); oField4 = new Input("I4"); oFormElement3 = new FormElement("FE3",{ label: oLabel3, fields: [oField3] }); oFormElement4 = new FormElement("FE4",{ label: oLabel4, fields: [oField4] }); oTitle = new Title("T2", {text: "Test"}); oFormContainer2 = new FormContainer("FC2",{ title: oTitle, tooltip: "Test", expandable: true, formElements: [ oFormElement3, oFormElement4 ] }); aFormContainers.push(oFormContainer2); } oForm = new Form("F1", { layout: oResponsiveGridLayout, editable: true, formContainers: aFormContainers }).placeAt("qunit-fixture"); sap.ui.getCore().applyChanges(); } function initTestOneContainer() { initForm(true); } function initTestTwoContainers() { initForm(false); } function afterTest(bOneContainer) { if (oForm) { oForm.destroy(); oForm = undefined; cleanupControl(oResponsiveGridLayout); cleanupControl(oLabel1); cleanupControl(oLabel2); cleanupControl(oLabel3); cleanupControl(oLabel4); cleanupControl(oField1); cleanupControl(oField2); cleanupControl(oField3); cleanupControl(oField4); cleanupControl(oFormElement1); cleanupControl(oFormElement2); cleanupControl(oFormElement3); cleanupControl(oFormElement4); cleanupControl(oFormContainer1); cleanupControl(oFormContainer2); cleanupControl(oTitle); } } QUnit.module("Form", { beforeEach: initTestOneContainer, afterEach: afterTest }); QUnit.test("Shall be instantiable", function(assert) { assert.ok(oForm, "Form is created"); assert.ok(oResponsiveGridLayout, "ResponsiveGridLayout is created"); assert.equal(oForm.getLayout().getId(), "RGL1", "getLayout() returns layout."); }); QUnit.test("one container specific things", function(assert) { assert.notOk(sap.ui.getCore().byId("F1--Grid"), "no Main Grid"); }); QUnit.module("inner Grid", { beforeEach: initTestTwoContainers, afterEach: afterTest }); QUnit.test("content of Grid", function(assert) { var oGrid = sap.ui.getCore().byId("FC1--Grid"); var aContent = oGrid.getContent(); assert.equal(aContent.length, 4, "Grid has 4 Elements"); assert.equal(aContent[0].getId(), "L1", "Label1 is 1. element"); assert.equal(aContent[1].getId(), "I1", "Field1 is 2. element"); assert.equal(aContent[2].getId(), "L2", "Label2 is 3. element"); assert.equal(aContent[3].getId(), "I2", "Field2 is 4. element"); assert.equal(aContent[0].getParent().getId(), "FE1", "FormElement is still parent of label"); assert.equal(aContent[1].getParent().getId(), "FE1", "FormElement is still parent of field"); assert.equal(aContent[2].getParent().getId(), "FE2", "FormElement is still parent of label"); assert.equal(aContent[3].getParent().getId(), "FE2", "FormElement is still parent of field"); }); QUnit.test("Panel", function(assert) { var oPanel = sap.ui.getCore().byId("FC1---Panel"); assert.notOk(oPanel, "no panel created for first container"); oPanel = sap.ui.getCore().byId("FC2---Panel"); assert.ok(oPanel, "panel created for second container"); assert.equal(oTitle.getParent().getId(), "FC2", "FormContainer is still parent of Title"); assert.equal(oPanel.getContent().getId(), "FC2--Grid", "Grid is inside Panel"); assert.ok(window.document.getElementById("T2"), "Title rendered"); assert.ok(window.document.getElementById("FC2--Exp"), "Expander rendered"); assert.equal(jQuery("#FC2---Panel").attr("title"), "Test", "tooltip set on panel"); }); QUnit.test("aria", function(assert) { assert.notOk(jQuery("#FC1--Grid").attr("role"), "role \"form\" not set on grid"); assert.notOk(jQuery("#FC1--Grid").attr("aria-labelledby"), "aria-labelledby not set on grid"); assert.equal(jQuery("#FC2---Panel").attr("role"), "form", "role \"form\" set on panel"); assert.equal(jQuery("#FC2---Panel").attr("aria-labelledby"), "T2", "aria-labelledby set on panel"); oFormContainer1.addAriaLabelledBy("XXX"); oFormContainer2.addAriaLabelledBy("YYY"); sap.ui.getCore().applyChanges(); assert.equal(jQuery("#FC1--Grid").attr("role"), "form", "role \"form\" set on grid"); assert.equal(jQuery("#FC1--Grid").attr("aria-labelledby"), "XXX", "aria-labelledby set on grid"); assert.equal(jQuery("#FC2---Panel").attr("aria-labelledby"), "YYY T2", "aria-labelledby set on panel"); }); QUnit.test("Toolbar", function(assert) { var oToolbar = new Toolbar("TB1"); oFormContainer2.setToolbar(oToolbar); sap.ui.getCore().applyChanges(); assert.notOk(window.document.getElementById("T2"), "Title not rendered"); assert.notOk(window.document.getElementById("FC2--Exp"), "Expander not rendered"); assert.ok(window.document.getElementById("TB1"), "Toolbar rendered"); assert.ok(jQuery("#FC2---Panel").attr("aria-labelledby"), "TB1", "aria-labelledby set on panel"); }); QUnit.test("main Grid", function(assert) { var oGrid = sap.ui.getCore().byId("F1--Grid"); var aContent = oGrid.getContent(); assert.equal(aContent.length, 2, "Grid has 2 Elements"); assert.equal(aContent[0].getId(), "FC1--Grid", "Grid1 is 1. element"); assert.equal(aContent[1].getId(), "FC2---Panel", "Panel is 2. element"); }); QUnit.test("add/remove fields", function(assert) { var oGrid = sap.ui.getCore().byId("FC2--Grid"); var oNewField = new Input("I5"); oFormElement4.insertField(oNewField, 0); var aContent = oGrid.getContent(); assert.equal(aContent.length, 5, "Grid has 5 Elements"); assert.equal(aContent[3].getId(), "I5", "new field is 4. element"); oFormElement4.removeField(oNewField); aContent = oGrid.getContent(); assert.equal(aContent.length, 4, "Grid has 4 Elements"); assert.equal(aContent[3].getId(), "I4", "Field4 is 4. element"); oNewField.destroy(); }); QUnit.test("add/remove FormElement", function(assert) { var oGrid = sap.ui.getCore().byId("FC2--Grid"); var oNewLabel = new Label("L5", {text: "Label 5"}); var oNewField = new Input("I5"); var oNewFormElement = new FormElement("FE5",{ label: oNewLabel, fields: [oNewField] }); oFormContainer2.insertFormElement(oNewFormElement, 1); var aContent = oGrid.getContent(); assert.equal(aContent.length, 6, "Grid has 6 Elements"); assert.equal(aContent[2].getId(), "L5", "new Label is 3. element"); assert.equal(aContent[3].getId(), "I5", "new Field is 4. element"); oFormContainer2.removeFormElement(oNewFormElement); aContent = oGrid.getContent(); assert.equal(aContent.length, 4, "Grid has 4 Elements"); assert.equal(aContent[3].getId(), "I4", "Field4 is 4. element"); oNewFormElement.destroy(); }); QUnit.test("visibility of FormElement", function(assert) { var oGrid = sap.ui.getCore().byId("FC2--Grid"); var oNewLabel = new Label("L5", {text: "Label 5"}); var oNewField = new Input("I5"); var oNewFormElement = new FormElement("FE5",{ visible: false, label: oNewLabel, fields: [oNewField] }); oFormContainer2.insertFormElement(oNewFormElement, 1); var aContent = oGrid.getContent(); assert.equal(aContent.length, 4, "Grid has 4 Elements, as invisible FormElemnt is not rendered"); oNewFormElement.setVisible(true); aContent = oGrid.getContent(); assert.equal(aContent.length, 6, "Grid has 6 Elements"); assert.equal(aContent[2].getId(), "L5", "new Label is 3. element"); assert.equal(aContent[3].getId(), "I5", "new Field is 4. element"); }); QUnit.test("add/remove FormContainer", function(assert) { var oGrid = sap.ui.getCore().byId("F1--Grid"); var oNewFormContainer = new FormContainer("FC3",{ title: "Test"}); oForm.insertFormContainer(oNewFormContainer, 1); sap.ui.getCore().applyChanges(); var aContent = oGrid.getContent(); assert.equal(aContent.length, 3, "Grid has 3 Elements"); assert.equal(aContent[1].getId(), "FC3---Panel", "new Panel is 2. element"); oForm.removeFormContainer(oNewFormContainer); sap.ui.getCore().applyChanges(); aContent = oGrid.getContent(); assert.equal(aContent.length, 2, "Grid has 2 Elements"); assert.equal(aContent[1].getId(), "FC2---Panel", "Panel is 2. element"); oForm.removeFormContainer(oFormContainer1); sap.ui.getCore().applyChanges(); aContent = oGrid.getContent(); assert.notOk(window.document.getElementById("F1--Grid"), "Main grid not rendered"); assert.ok(window.document.getElementById("FC2---Panel"), "container panel rendered"); oNewFormContainer.destroy(); oFormContainer1.destroy(); }); QUnit.test("remove Panel", function(assert) { oFormContainer2.destroyTitle(); oFormContainer2.setExpandable(false); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("F1--Grid"); var aContent = oGrid.getContent(); var oPanel = sap.ui.getCore().byId("FC2---Panel"); assert.notOk(oPanel, "no panel created for container"); assert.equal(aContent.length, 2, "Grid has 2 Elements"); assert.equal(aContent[1].getId(), "FC2--Grid", "Grid is 2. element"); oFormContainer2.setTitle("Test"); sap.ui.getCore().applyChanges(); aContent = oGrid.getContent(); oPanel = sap.ui.getCore().byId("FC2---Panel"); assert.ok(oPanel, "panel created for container"); assert.equal(aContent.length, 2, "Grid has 2 Elements"); assert.equal(aContent[1].getId(), "FC2---Panel", "Panel is 2. element"); }); QUnit.test("visibility of FormContainer", function(assert) { var oGrid = sap.ui.getCore().byId("F1--Grid"); var oNewFormContainer = new FormContainer("FC3",{ title: "Test", visible: false}); oForm.insertFormContainer(oNewFormContainer, 1); sap.ui.getCore().applyChanges(); var aContent = oGrid.getContent(); assert.equal(aContent.length, 2, "Grid has 2 Elements, as invisible FormContainer is not rendered"); oNewFormContainer.setVisible(true); sap.ui.getCore().applyChanges(); aContent = oGrid.getContent(); assert.equal(aContent.length, 3, "Grid has 3 Elements"); assert.equal(aContent[1].getId(), "FC3---Panel", "new Panel is 2. element"); }); QUnit.module("LayoutData", { beforeEach: initTestTwoContainers, afterEach: afterTest }); QUnit.test("default on FormContainer", function(assert) { var oGrid = sap.ui.getCore().byId("F1--Grid"); assert.equal(oGrid.getDefaultSpan(), "L6 M12 S12", "Main Grid default span"); oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid.getLayoutData(); assert.equal(oLayoutData.getId(), "FC1--Grid--LD", "Grid has calculated LayoutData"); assert.ok(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.ok(oLayoutData.isPropertyInitial("linebreakXL"), "no LinebreakXL set"); var oParent = jQuery("#FC1--Grid").parent(); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); var oPanel = sap.ui.getCore().byId("FC2---Panel"); oLayoutData = oPanel.getLayoutData(); assert.equal(oLayoutData.getId(), "FC2---Panel--LD", "Panel has calculated LayoutData"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.ok(oLayoutData.isPropertyInitial("linebreakXL"), "no LinebreakXL set"); oParent = jQuery("#FC2---Panel").parent(); assert.ok(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM set"); }); QUnit.test("custom LayoutData on FormContainer", function(assert) { var oLayoutData = new GridData("GD1", {linebreak: true}); oFormContainer2.setLayoutData(oLayoutData); sap.ui.getCore().applyChanges(); var oPanel = sap.ui.getCore().byId("FC2---Panel"); assert.equal(oPanel.getLayoutData().getId(), "GD1", "Original LayoutData returned"); assert.equal(oLayoutData.getParent().getId(), "FC2", "Parent of LayoutData is still FormContainer"); var oParent = jQuery("#FC1--Grid").parent(); assert.ok(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); }); QUnit.test("columns", function(assert) { var oFormContainer3 = new FormContainer("FC3"); var oFormContainer4 = new FormContainer("FC4"); var oFormContainer5 = new FormContainer("FC5"); var oFormContainer6 = new FormContainer("FC6"); var oFormContainer7 = new FormContainer("FC7"); var oFormContainer8 = new FormContainer("FC8"); var oFormContainer9 = new FormContainer("FC9"); oForm.addFormContainer(oFormContainer3); oForm.addFormContainer(oFormContainer4); oForm.addFormContainer(oFormContainer5); oForm.addFormContainer(oFormContainer6); oForm.addFormContainer(oFormContainer7); oForm.addFormContainer(oFormContainer8); oForm.addFormContainer(oFormContainer9); oResponsiveGridLayout.setColumnsXL(4); oResponsiveGridLayout.setColumnsL(3); oResponsiveGridLayout.setColumnsM(2); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("F1--Grid"); assert.equal(oGrid.getDefaultSpan(), "XL3 L4 M6 S12", "Main Grid default span"); oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid.getLayoutData(); var oParent = jQuery("#FC1--Grid").parent(); assert.ok(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL set"); assert.ok(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL set"); assert.ok(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM not set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); var oPanel = sap.ui.getCore().byId("FC2---Panel"); oLayoutData = oPanel.getLayoutData(); oParent = jQuery("#FC2---Panel").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC3--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC3--Grid").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.ok(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM not set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC4--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC4--Grid").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.ok(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.ok(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC5--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC5--Grid").parent(); assert.ok(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.ok(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC6--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC6--Grid").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC7--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC7--Grid").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.ok(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL set"); assert.ok(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC8--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC8--Grid").parent(); assert.notOk(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM not set"); oGrid = sap.ui.getCore().byId("FC9--Grid"); oLayoutData = oGrid.getLayoutData(); oParent = jQuery("#FC9--Grid").parent(); assert.ok(oLayoutData.getLinebreakXL(), "calculated LayoutData linebreakXL set"); assert.notOk(oLayoutData.getLinebreakL(), "calculated LayoutData linebreakL not set"); assert.ok(oLayoutData.getLinebreakM(), "calculated LayoutData linebreakM set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContXL"), "class sapUiFormResGridLastContXL not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastContL"), "class sapUiFormResGridLastContL set"); assert.notOk(oParent.hasClass("sapUiFormResGridLastContM"), "class sapUiFormResGridLastContM not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowXL"), "class sapUiFormResGridFirstRowXL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowL"), "class sapUiFormResGridFirstRowL not set"); assert.notOk(oParent.hasClass("sapUiFormResGridFirstRowM"), "class sapUiFormResGridFirstRowM not set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowXL"), "class sapUiFormResGridLastRowXL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowL"), "class sapUiFormResGridLastRowL set"); assert.ok(oParent.hasClass("sapUiFormResGridLastRowM"), "class sapUiFormResGridLastRowM set"); }); QUnit.test("default on Labels and Fields", function(assert) { var oNewField = new Input("I5"); oFormElement2.addField(oNewField); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oLabel1); var oParent = jQuery("#L1").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M2 S12", "Span on Label"); assert.ok(oLayoutData.getLinebreak(), "LayoutData linebreak set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Label"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Label"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Label"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Label"); assert.ok(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl set on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); oParent = jQuery("#I1").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL8 L8 M10 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oField2); oParent = jQuery("#I2").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M5 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField); oParent = jQuery("#I6").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M5 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("default multiline Fields", function(assert) { var oNewField1 = new Input("I5"); oFormElement4.addField(oNewField1); var oNewField2 = new Input("I6"); oFormElement4.addField(oNewField2); var oNewField3 = new Input("I7"); oFormElement4.addField(oNewField3); var oNewField4 = new Input("I8"); oFormElement4.addField(oNewField4); var oNewField5 = new Input("I9"); oFormElement4.addField(oNewField5); var oNewField6 = new Input("I10"); oFormElement4.addField(oNewField6); var oNewField7 = new Input("I11"); oFormElement4.addField(oNewField7); var oNewField8 = new Input("I12"); oFormElement4.addField(oNewField8); var oNewField9 = new Input("I13"); oFormElement4.addField(oNewField9); var oNewField10 = new Input("I14"); oFormElement4.addField(oNewField10); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC2--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oField4); var oParent = jQuery("#I4").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL1 L1 M1 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField1); oParent = jQuery("#I5").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL1 L1 M1 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField8); oParent = jQuery("#I12").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M1 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.ok(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL set"); assert.ok(oLayoutData.getLinebreakL(), "LayoutData linebreakL set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 4, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 4, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField9); oParent = jQuery("#I13").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL2 L2 M1 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField10); oParent = jQuery("#I14").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL2 L2 M10 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.ok(oLayoutData.getLinebreakM(), "LayoutData linebreakM set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 2, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("default on Fields without Label", function(assert) { oFormElement2.destroyLabel(); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oField2); var oParent = jQuery("#I2").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL12 L12 M12 S12", "Span on Field"); assert.ok(oLayoutData.getLinebreak(), "LayoutData linebreak set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("custom Layout Data on Label", function(assert) { var oLayoutData = new GridData("GD1", {span: "XL3 L3 M3 S3"}); var oVariantlayoutData = new VariantLayoutData("VD1", {multipleLayoutData: [oLayoutData]}); oLabel2.setLayoutData(oVariantlayoutData); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); oLayoutData = oGrid._getLayoutDataForControl(oLabel2); var oParent = jQuery("#L2").parent(); assert.equal(oLayoutData.getId(), "GD1", "custom LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL3 L3 M3 S3", "Span on Label"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Label"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Label"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Label"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Label"); assert.ok(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl set on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField2); oParent = jQuery("#I2").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL9 L9 M9 S9", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("custom Layout Data on Field", function(assert) { var oLayoutData = new GridData("GD1", {span: "XL3 L3 M3 S3"}); var oNewField = new Input("I5", {layoutData: oLayoutData}); oFormElement2.addField(oNewField); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); oLayoutData = oGrid._getLayoutDataForControl(oField2); var oParent = jQuery("#I2").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL5 L5 M7 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField); oParent = jQuery("#I5").parent(); assert.equal(oLayoutData.getId(), "GD1", "custom LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL3 L3 M3 S3", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("custom layout data on multiline Fields", function(assert) { var oLayoutData = new GridData("GD1", {span: "L7 M9 S1"}); var oNewField1 = new Input("I5", {layoutData: oLayoutData}); oFormElement4.addField(oNewField1); var oNewField2 = new Input("I6"); oFormElement4.addField(oNewField2); var oNewField3 = new Input("I7"); oFormElement4.addField(oNewField3); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC2--Grid"); oLayoutData = oGrid._getLayoutDataForControl(oField4); var oParent = jQuery("#I4").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL1 L1 M1 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField1); oParent = jQuery("#I5").parent(); assert.equal(oLayoutData.getId(), "GD1", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "L7 M9 S1", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField2); oParent = jQuery("#I6").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M5 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.ok(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL set"); assert.ok(oLayoutData.getLinebreakL(), "LayoutData linebreakL set"); assert.ok(oLayoutData.getLinebreakM(), "LayoutData linebreakM set"); assert.equal(oLayoutData.getIndentXL(), 4, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 4, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 2, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField3); oParent = jQuery("#I7").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL4 L4 M5 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("change custom Layout Data on Field", function(assert) { var oLayoutData = new GridData("GD1", {span: "XL3 L3 M3 S3"}); var oNewField = new Input("I5", {layoutData: oLayoutData}); oFormElement2.addField(oNewField); sap.ui.getCore().applyChanges(); oLayoutData.setSpan("L2 M2 S2"); var oGrid = sap.ui.getCore().byId("FC1--Grid"); oLayoutData = oGrid._getLayoutDataForControl(oField2); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL6 L6 M8 S12", "Span on Field"); oLayoutData = oGrid._getLayoutDataForControl(oNewField); assert.equal(oLayoutData.getId(), "GD1", "custom LayoutData used"); assert.equal(oLayoutData.getSpan(), "L2 M2 S2", "Span on Field"); }); QUnit.test("LabelSpan", function(assert) { oResponsiveGridLayout.setLabelSpanL(5); oResponsiveGridLayout.setLabelSpanM(4); oResponsiveGridLayout.setLabelSpanS(3); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL5 L5 M4 S3", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL7 L7 M8 S9", "Span on Field"); oResponsiveGridLayout.setLabelSpanXL(6); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL6 L5 M4 S3", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL6 L7 M8 S9", "Span on Field"); }); QUnit.test("adjustLabelSpan", function(assert) { oResponsiveGridLayout.setColumnsM(2); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL4 L4 M4 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL8 L8 M8 S12", "Span on Field"); oResponsiveGridLayout.setAdjustLabelSpan(false); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL4 L4 M2 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL8 L8 M10 S12", "Span on Field"); oResponsiveGridLayout.setColumnsM(1); oResponsiveGridLayout.setColumnsL(1); oResponsiveGridLayout.setAdjustLabelSpan(true); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL2 L2 M2 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL10 L10 M10 S12", "Span on Field"); oResponsiveGridLayout.setColumnsL(2); oLayoutData = new GridData("GD1", {spanL: 12}); oFormContainer1.setLayoutData(oLayoutData); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL2 L2 M2 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL10 L10 M10 S12", "Span on Field"); }); QUnit.test("EmptySpan", function(assert) { oResponsiveGridLayout.setEmptySpanL(2); oResponsiveGridLayout.setEmptySpanM(3); oResponsiveGridLayout.setEmptySpanS(4); oResponsiveGridLayout.setLabelSpanS(3); // emptySpan only works in S for labelspan > 12 sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL6 L6 M7 S5", "Span on Field"); oResponsiveGridLayout.setEmptySpanXL(1); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL7 L6 M7 S5", "Span on Field"); }); QUnit.test("breakpoint", function(assert) { oResponsiveGridLayout.setBreakpointXL(1500); oResponsiveGridLayout.setBreakpointL(1000); oResponsiveGridLayout.setBreakpointM(500); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("F1--Grid"); assert.equal(oGrid._iBreakPointLargeDesktop, "1500", "BreapointXL on Main Grid"); assert.equal(oGrid._iBreakPointDesktop, "1000", "BreapointL on Main Grid"); assert.equal(oGrid._iBreakPointTablet, "500", "BreapointM on Main Grid"); }); QUnit.test("getLayoutDataForDelimiter", function(assert) { var oLayoutData = oResponsiveGridLayout.getLayoutDataForDelimiter(); assert.ok(oLayoutData, "LayoutData returned"); assert.ok(oLayoutData && oLayoutData.isA("sap.ui.layout.GridData"), "GridData returned"); assert.equal(oLayoutData.getSpanS(), 1, "spanS"); assert.equal(oLayoutData.getSpanM(), 1, "spanM"); assert.equal(oLayoutData.getSpanL(), 1, "spanL"); assert.equal(oLayoutData.getSpanXL(), 1, "spanXL"); }); QUnit.test("getLayoutDataForSemanticField", function(assert) { var oLayoutData = oResponsiveGridLayout.getLayoutDataForSemanticField(2, 1); assert.ok(oLayoutData, "LayoutData returned"); assert.ok(oLayoutData && oLayoutData.isA("sap.ui.layout.GridData"), "GridData returned"); assert.equal(oLayoutData.getSpanS(), 11, "spanS"); assert.equal(oLayoutData.getSpanM(), 3, "spanM"); assert.equal(oLayoutData.getSpanL(), 3, "spanL"); assert.equal(oLayoutData.getSpanXL(), 3, "spanXL"); var oLayoutData2 = oResponsiveGridLayout.getLayoutDataForSemanticField(2, 2); assert.ok(oLayoutData2, "LayoutData returned"); assert.ok(oLayoutData2 && oLayoutData.isA("sap.ui.layout.GridData"), "GridData returned"); assert.equal(oLayoutData2.getSpanS(), 11, "spanS"); assert.equal(oLayoutData2.getSpanM(), 4, "spanM"); assert.equal(oLayoutData2.getSpanL(), 4, "spanL"); assert.equal(oLayoutData2.getSpanXL(), 4, "spanXL"); assert.equal(oLayoutData2, oLayoutData2, "LayoutData just updated, no new instance"); oLayoutData.destroy(); oLayoutData2.destroy(); }); QUnit.module("LayoutData one Container", { beforeEach: initTestOneContainer, afterEach: afterTest }); QUnit.test("singleContainerFullSize", function(assert) { oResponsiveGridLayout.setSingleContainerFullSize(false); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("F1--Grid"); assert.ok(oGrid, "Main grid used"); var aContent = oGrid.getContent(); assert.equal(aContent.length, 1, "Grid has 1 Elements"); assert.equal(aContent[0].getId(), "FC1--Grid", "Grid1 is 1. element"); }); QUnit.test("default on Fields and Label", function(assert) { oFormElement2.destroyLabel(); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oLabel1); var oParent = jQuery("#L1").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL2 L2 M2 S12", "Span on Label"); assert.ok(oLayoutData.getLinebreak(), "LayoutData linebreak set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Label"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Label"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Label"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Label"); assert.ok(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl set on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); oParent = jQuery("#I1").parent(); assert.equal(oLayoutData.getId(), "RGL1--Dummy", "calculated LayoutData used"); assert.equal(oLayoutData.getSpan(), "XL10 L10 M10 S12", "Span on Field"); assert.notOk(oLayoutData.getLinebreak(), "LayoutData linebreak not set"); assert.notOk(oLayoutData.getLinebreakXL(), "LayoutData linebreakXL not set"); assert.notOk(oLayoutData.getLinebreakL(), "LayoutData linebreakL not set"); assert.notOk(oLayoutData.getLinebreakM(), "LayoutData linebreakM not set"); assert.equal(oLayoutData.getIndentXL(), 0, "IndentXL on Field"); assert.equal(oLayoutData.getIndentL(), 0, "IndentL on Field"); assert.equal(oLayoutData.getIndentM(), 0, "IndentM on Field"); assert.equal(oLayoutData.getIndentS(), 0, "IndentS on Field"); assert.notOk(oParent.hasClass("sapUiFormElementLbl"), "class sapUiFormElementLbl not set on Field"); }); QUnit.test("adjustLabelSpan", function(assert) { sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); var oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL2 L2 M2 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL10 L10 M10 S12", "Span on Field"); oResponsiveGridLayout.setAdjustLabelSpan(false); sap.ui.getCore().applyChanges(); oLayoutData = oGrid._getLayoutDataForControl(oLabel1); assert.equal(oLayoutData.getSpan(), "XL4 L4 M2 S12", "Span on Label"); oLayoutData = oGrid._getLayoutDataForControl(oField1); assert.equal(oLayoutData.getSpan(), "XL8 L8 M10 S12", "Span on Field"); }); QUnit.test("breakpoint", function(assert) { oResponsiveGridLayout.setBreakpointXL(1500); oResponsiveGridLayout.setBreakpointL(1000); oResponsiveGridLayout.setBreakpointM(500); sap.ui.getCore().applyChanges(); var oGrid = sap.ui.getCore().byId("FC1--Grid"); assert.equal(oGrid._iBreakPointLargeDesktop, "1500", "BreapointXL on Main Grid"); assert.equal(oGrid._iBreakPointDesktop, "1000", "BreapointL on Main Grid"); assert.equal(oGrid._iBreakPointTablet, "500", "BreapointM on Main Grid"); }); QUnit.module("Content", { beforeEach: initTestTwoContainers, afterEach: afterTest }); QUnit.test("Field width", function(assert) { var oText = new Text("T1", {text: "Test"}); oFormElement2.addField(oText); var oLink = new Link("Li1", {text: "Test", href: "http://www.sap.com"}); oFormElement2.addField(oLink); sap.ui.getCore().applyChanges(); assert.ok(jQuery("#T1").attr("style").indexOf("100%") > 0, "Text width set to 100%"); assert.ok(!jQuery("#Li1").attr("style") || jQuery("#Li1").attr("style").indexOf("100%") < 0, "Link width not set to 100%"); }); QUnit.test("Expand", function(assert) { assert.notOk(jQuery("#FC2---Panel").hasClass("sapUiRGLContainerColl"), "Panel not collapsed"); oFormContainer2.setExpanded(false); assert.ok(jQuery("#FC2---Panel").hasClass("sapUiRGLContainerColl"), "Panel is collapsed"); oForm.invalidate(); // to test in Renderer sap.ui.getCore().applyChanges(); assert.ok(jQuery("#FC2---Panel").hasClass("sapUiRGLContainerColl"), "Panel is collapsed"); oFormContainer2.setExpanded(true); assert.notOk(jQuery("#FC2---Panel").hasClass("sapUiRGLContainerColl"), "Panel not collapsed"); }); QUnit.test("destroy layout", function(assert) { var iLength = 0; if (!Object.keys) { each(oResponsiveGridLayout.mContainers, function(){iLength++;}); } else { iLength = Object.keys(oResponsiveGridLayout.mContainers).length; } assert.equal(iLength, 2, "Layout control data exits"); oForm.setLayout(null); oResponsiveGridLayout.destroy(); iLength = 0; if (!Object.keys) { each(oResponsiveGridLayout.mContainers, function(){iLength++;}); } else { iLength = Object.keys(oResponsiveGridLayout.mContainers).length; } assert.equal(iLength, 0, "Layout control data cleared"); assert.notOk(sap.ui.getCore().byId("FC1--Grid"), "Container Grid destroyed"); assert.notOk(sap.ui.getCore().byId("FC2---Panel"), "Panel destroyed"); }); QUnit.test("getContainerRenderedDomRef", function(assert) { var oDom = oResponsiveGridLayout.getContainerRenderedDomRef(oFormContainer1); assert.ok(oDom, "Dom for container1 returned"); assert.equal(oDom.id, "FC1--Grid", "Grid is representation of container1"); oDom = oResponsiveGridLayout.getContainerRenderedDomRef(oFormContainer2); assert.ok(oDom, "Dom for container2 returned"); assert.equal(oDom.id, "FC2---Panel", "Panel is representation of container2"); oForm.setVisible(false); sap.ui.getCore().applyChanges(); oDom = oResponsiveGridLayout.getContainerRenderedDomRef(oFormContainer2); assert.notOk(oDom, "no Dom for container2 returned if invisible Form"); }); QUnit.test("getElementRenderedDomRef", function(assert) { var oDom = oResponsiveGridLayout.getElementRenderedDomRef(oFormElement1); assert.notOk(oDom, "no Dom for FormElement returned"); }); });
50.925585
125
0.744561
1004e035c89517bcc22143067ae9df5b71ef1f13
1,507
js
JavaScript
src/MultiOption.js
wvbe/ask-nicely
57b8335634e01168caaa4fe7b79112f55d25c1a0
[ "Unlicense" ]
5
2016-03-07T12:19:11.000Z
2021-06-14T10:43:20.000Z
src/MultiOption.js
wvbe/ask-nicely
57b8335634e01168caaa4fe7b79112f55d25c1a0
[ "Unlicense" ]
2
2020-01-10T10:24:33.000Z
2021-05-07T15:23:57.000Z
src/MultiOption.js
wvbe/ask-nicely
57b8335634e01168caaa4fe7b79112f55d25c1a0
[ "Unlicense" ]
2
2018-04-21T13:04:09.000Z
2020-01-08T10:54:28.000Z
'use strict'; import symbols from './symbols'; import Option from './Option'; const breakPartsOnPart = Symbol(); const breakPartsDefaultPattern = /^[-.*]/; export default class MultiOption extends Option { constructor(name) { super(name); this.isInfinite(); } // @todo: infinite arg as a callback // @amazement 4 years later: what the actual did i mean? 'isInfinite'(infinite) { this[breakPartsOnPart] = infinite ? part => false : part => part.charAt(0) === '-'; return this; } [breakPartsOnPart](part) { return part.match(breakPartsDefaultPattern); } [symbols.spliceInputFromParts](parts) { if (this.short && parts[0].charAt(1) === this.short) { parts[0] = '-' + parts[0].substr(2); if (parts[0] !== '-') return []; } parts.shift(); const input = []; do { if (parts[0] === '-') { parts.shift(); break; } if (!parts[0] || this[breakPartsOnPart](parts[0])) break; input.push(parts.shift()); } while (parts.length > 0); return input; } [symbols.applyDefault](value, isUndefined) { if (value === undefined || !value.length) { if (this.useDefaultIfFlagMissing || !isUndefined) { value = this.cloneDefault() || []; } } if (this.required && (isUndefined || !value || !value.length)) return undefined; return value || []; } [symbols.createContributionToRequestObject](accumulated, value, isUndefined) { return { options: { [this.name]: (accumulated?.options?.[this.name] || []).concat(value) } }; } }
21.225352
85
0.624419
10053ad4946166af93a102fe4842de81b9ebea84
117
js
JavaScript
public/script.js
TopTravel-Project/TopTravel.
038cfba008e7ba293dfc2583af94297b614d81a6
[ "MIT" ]
null
null
null
public/script.js
TopTravel-Project/TopTravel.
038cfba008e7ba293dfc2583af94297b614d81a6
[ "MIT" ]
4
2022-02-20T17:54:28.000Z
2022-02-28T16:04:13.000Z
public/script.js
TopTravel-Project/TopTravel.
038cfba008e7ba293dfc2583af94297b614d81a6
[ "MIT" ]
11
2022-02-03T20:46:21.000Z
2022-02-28T16:03:57.000Z
/* functionality, I want to do in the future... all js file will be here, and then html get one js for getting all */
58.5
69
0.717949
7de9435e2c314d60fbc5da78339a314b9d912e90
2,284
js
JavaScript
src/pages/kidok.js
hansvertriest/Orbit-DevStudio
9a035876233149597338c5f4417509c12c594407
[ "0BSD" ]
null
null
null
src/pages/kidok.js
hansvertriest/Orbit-DevStudio
9a035876233149597338c5f4417509c12c594407
[ "0BSD" ]
null
null
null
src/pages/kidok.js
hansvertriest/Orbit-DevStudio
9a035876233149597338c5f4417509c12c594407
[ "0BSD" ]
null
null
null
import React from "react" import { Helmet } from "react-helmet" import Layout from "../components/layout" import img0 from '../images/screenshots/connus-banner.png' import img1 from '../images/screenshots/connus-1.png' import img2 from '../images/screenshots/connus-2.png' import img3 from '../images/screenshots/connus-3.png' const IndexPage = () => ( <Layout> <Helmet> <meta charSet="utf-8" /> <title>Orbit DevStudio | KidOk-kit</title> <meta name="description" content="Datavisualisatie voor Vlugmoor UGent."/> <meta name="keywords" content="web, development, webdesign, website, freelance, app, application, datavisualisatie, data" /> <meta name="author" content="Hans Vertriest" /> </Helmet> <div className="project-container"> <div className="container"> <a href="/#projects">Terug naar overzicht</a> <h1>Mijn projecten</h1> <h2>KidOk-kit</h2> </div> <div className="container"> <div className="row"> <div className="col-12 col-md-6"> <h3>Project</h3> <p>Open Poortje is een opvang voor kinderen die om eender welke reden thuis niet meer terecht kunnen. Zij gebruiken de KidOk-kit: een papieren bundel fiches die worden ingevuld samen met het kind om zijn/haar proces in Open Poortje op te volgen. Onze briefing was het ontwikkelen van een digitale versie van de KidOk-kit met een focus op animatie en interactiviteit. Design door Marthe Bulcke, Stijn Stevens en Jeroen Vervaeck. Animatie door Stijn Stevens. Front-end door Jeroen Vervaeck, Jérôme Laroy en Hans Vertriest. Backend door Hans Vertriest.</p> </div> <div className="col-12 col-md-6"> <h3>Technologieën</h3> <p>ReactJS, Express, Mongoose, MongoDB</p> <h3>Eigen inbreng</h3> <p>Backend en integratie ervan in de frontend</p> </div> <div className="col-12 col-md-6"> <iframe width="560" height="315" src="https://www.youtube.com/embed/Sr36fT4X8Yw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> </div> </div> </div> </Layout> ) export default IndexPage
45.68
563
0.672942
7de9a6b150184275cdbb6a124920ce35a727cf1e
603
js
JavaScript
src/script/RequireConfig.js
leader22/mk8-kart-customizer
91dac5af3cf17bff0cad4a0b76eaa1747ddd7812
[ "MIT" ]
2
2015-05-06T06:36:11.000Z
2015-06-03T00:07:05.000Z
src/script/RequireConfig.js
leader22/mk8-kart-customizer
91dac5af3cf17bff0cad4a0b76eaa1747ddd7812
[ "MIT" ]
null
null
null
src/script/RequireConfig.js
leader22/mk8-kart-customizer
91dac5af3cf17bff0cad4a0b76eaa1747ddd7812
[ "MIT" ]
null
null
null
(function(global) { let require = { urlArgs: '_=' + (new Date()).getTime(), baseUrl: 'dist/script', waitSeconds: 120, paths: { 'react': 'vendor/react/react-with-addons', 'react-router': 'vendor/react-router/build/umd/ReactRouter' }, shim: { } }; let _inNode = 'process' in global; let _inBrowser = 'document' in global; if (_inNode) { module.exports = require; } else if (_inBrowser) { global.require = require; } })(typeof global !== 'undefined' ? global : window);
25.125
70
0.524046
7dea25ce3e653550e986b6f2b99da673f9dc96ad
1,732
js
JavaScript
src/components/SiteNav/SiteNav.js
lizbryson/the-halsey-wedding
b6defc16493cd23b81c33cef753aff8bd1759e54
[ "MIT" ]
null
null
null
src/components/SiteNav/SiteNav.js
lizbryson/the-halsey-wedding
b6defc16493cd23b81c33cef753aff8bd1759e54
[ "MIT" ]
null
null
null
src/components/SiteNav/SiteNav.js
lizbryson/the-halsey-wedding
b6defc16493cd23b81c33cef753aff8bd1759e54
[ "MIT" ]
null
null
null
import * as React from "react"; import { Link } from "gatsby"; import Logo from "../../svg/Logo"; import "./SiteNav.css"; import { StaticImage } from "gatsby-plugin-image"; const SiteNav = () => { return ( <header className="siteHeader"> <div className="siteLogo"> <Logo /> </div> <nav className="siteNav"> <ul className="siteNav__inner"> <li className="siteNav__li"> <Link to="/rsvp">RSVP</Link> </li> <li className="siteNav__li"> <a href="#hotels">Hotels</a> </li> <li className="siteNav__li"> <a href="#transport">Transport</a> </li> <li className="siteNav__li"> <a href="https://www.zola.com/registry/thehalseywedding" target="_blank" rel="noopener noreferrer" > Registry </a> </li> </ul> </nav> <div className="siteScroll"> <span className="siteScroll__text">Scroll</span> <div className="siteScroll__icon"></div> </div> <div id="photoOne" className="photo-float is-bottom-left"> <StaticImage src="../../images/lizryan1.jpeg" alt="Liz + Ryan Portrait" /> </div> <div id="photoTwo" className="photo-float is-top-right"> <StaticImage src="../../images/lizryan4.jpeg" alt="Liz + Ryan Portrait" /> </div> <div id="photoThree" className="photo-float is-bottom-right"> <StaticImage src="../../images/lizryan2.jpeg" alt="Liz + Ryan Portrait" /> </div> </header> ); }; export default SiteNav;
27.935484
67
0.514434
7dea6720f89d369918a2ab80182f8b681ea9f055
2,315
js
JavaScript
packages/@lwc/rollup-plugin/src/__tests__/fixtures/expected_default_config_simple_app_css_resolver.js
YamYamYamlFml/lwc
7c2a7f6b7580f5c5cb4c035cdc4214e12efe8daf
[ "MIT" ]
1
2020-02-11T21:01:50.000Z
2020-02-11T21:01:50.000Z
packages/@lwc/rollup-plugin/src/__tests__/fixtures/expected_default_config_simple_app_css_resolver.js
YamYamYamlFml/lwc
7c2a7f6b7580f5c5cb4c035cdc4214e12efe8daf
[ "MIT" ]
31
2020-02-11T14:19:08.000Z
2022-03-26T04:01:40.000Z
packages/@lwc/rollup-plugin/src/__tests__/fixtures/expected_default_config_simple_app_css_resolver.js
YamYamYamlFml/lwc
7c2a7f6b7580f5c5cb4c035cdc4214e12efe8daf
[ "MIT" ]
null
null
null
(function(lwc, varResolver) { 'use strict'; varResolver = varResolver && varResolver.hasOwnProperty("default") ? varResolver["default"] : varResolver; function stylesheet(hostSelector, shadowSelector, nativeShadow) { return ( "\n" + (nativeShadow ? ":host {color: " + varResolver("--lwc-my-color") + ";}" : hostSelector + " {color: " + varResolver("--lwc-my-color") + ";}") + "\n" ); } var _implicitStylesheets = [stylesheet]; function tmpl($api, $cmp, $slotset, $ctx) { const { d: api_dynamic, h: api_element } = $api; return [api_element("div", { key: 0 }, [api_dynamic($cmp.x)])]; } var _tmpl = lwc.registerTemplate(tmpl); tmpl.stylesheets = []; if (_implicitStylesheets) { tmpl.stylesheets.push.apply(tmpl.stylesheets, _implicitStylesheets); } tmpl.stylesheetTokens = { hostAttribute: "x-foo_foo-host", shadowAttribute: "x-foo_foo" }; class Foo extends lwc.LightningElement { constructor(...args) { super(...args); this.x = void 0; } } lwc.registerDecorators(Foo, { publicProps: { x: { config: 0 } } }); var _xFoo = lwc.registerComponent(Foo, { tmpl: _tmpl }); function tmpl$1($api, $cmp, $slotset, $ctx) { const { c: api_custom_element, h: api_element } = $api; return [api_element("div", { classMap: { "container": true }, key: 1 }, [api_custom_element("x-foo", _xFoo, { props: { "x": "1" }, key: 0 }, [])])]; } var _tmpl$1 = lwc.registerTemplate(tmpl$1); tmpl$1.stylesheets = []; tmpl$1.stylesheetTokens = { hostAttribute: "x-app_app-host", shadowAttribute: "x-app_app" }; class App extends lwc.LightningElement { constructor() { super(); this.list = []; } } var App$1 = lwc.registerComponent(App, { tmpl: _tmpl$1 }); const container = document.getElementById('main'); const element = lwc.createElement('x-app', { is: App$1 }); container.appendChild(element); })(LWC, resolveCss);
22.047619
79
0.52743
7dea9886cc908154b545eb4666497373f4543dde
2,124
js
JavaScript
style/js/Bloqueos/Bloqueos.js
dilearmo/administracion-cancha
7d6826ba9348c60b03fb2a599d65cce19ce08c3d
[ "MIT" ]
null
null
null
style/js/Bloqueos/Bloqueos.js
dilearmo/administracion-cancha
7d6826ba9348c60b03fb2a599d65cce19ce08c3d
[ "MIT" ]
null
null
null
style/js/Bloqueos/Bloqueos.js
dilearmo/administracion-cancha
7d6826ba9348c60b03fb2a599d65cce19ce08c3d
[ "MIT" ]
null
null
null
/* global $ */ /* global location */ var contador = 0; $(document).ready(function() { return llenarPrecios(); }); function llenarPrecios() { $(function() { $.ajax({ type: 'GET', url: 'https://cancha-la-primavera-dilearmo.c9users.io/index.php/WsBloqueo/bloqueo', dataType: 'jsonp', contentType: 'application/json; charset=utf-8', success: function(response) { for (var i = 0; i < response.length; i++ ) { llenar(response[i]); } }, error: function(error) { alert('no hay horas en la base de datos'); } }); }); } function llenar (dato) { var $tr = $("<tr>"); var $fecha = $("<td>"); var $Hora = $("<td>"); var $dia = $("<td>"); var $cancelar = $("<td>", {"class":" center-align"}); var $boton = $("<button>", {id:dato.id, "class": "btn-floating btn-large waves-effect waves-light red", "type": "button", "value": "Cancelar", "onclick": "eliminar(this.id)"}); var iconoEditar = $("<i>", {"class":"material-icons"}); iconoEditar.html("delete_forever"); $boton.append(iconoEditar); $fecha.html(dato.Fecha); $Hora.html(dato.Hora +":00"); $dia.html(dato.NombreDia); $cancelar.append($boton); $tr.append($Hora); $tr.append($fecha); $tr.append($dia); $tr.append($cancelar); $( "#tabla" ).append($tr); } function eliminar(i) { $(function() { $.ajax({ type: 'GET', url: 'https://cancha-la-primavera-dilearmo.c9users.io/index.php/WsBloqueo/eliminar?id='+i, dataType: 'jsonp', timeout: 10000, success: function(response) { //alert(response); location.reload(); }, error: function(error) { alert('no hay horas en la base de datos'); } }); }); }
21.673469
183
0.464218
7dead49617c3e6f560309d224e1e689bc7c91794
3,932
js
JavaScript
src/babel-compile.js
helinjiang/babel-d
12e05f8702f850f7427416489097c50b93093abb
[ "MIT" ]
null
null
null
src/babel-compile.js
helinjiang/babel-d
12e05f8702f850f7427416489097c50b93093abb
[ "MIT" ]
6
2017-07-12T01:55:47.000Z
2018-05-11T12:46:22.000Z
src/babel-compile.js
helinjiang/babel-d
12e05f8702f850f7427416489097c50b93093abb
[ "MIT" ]
null
null
null
const fs = require('fs'); const path = require('path'); const fse = require('fs-extra'); const fileUtil = require('./file'); //babel not export default property //so can not use `import babel from 'babel-core'` const babel = require('babel-core'); let allowFileExt = ['.js']; /** * store compiled files last mtime * @type {Object} */ let compiledMtime = {}; /** * compiled error files * @type {Array} */ let compiledErrorFiles = []; /** * compile files * * @param {String} srcPath * @param {String} outPath * @param {Object} [options] * @param {String} [options.debug] only for debug */ export function compile(srcPath, outPath, options = {}) { if (options.debug) { console.log('\nBegin compile...', srcPath, outPath, options); } let files = getFiles(srcPath, true); let changedFiles = []; if (options.debug) { console.log('all files:', files); } files.forEach(file => { let srcFullPath = path.join(srcPath, file); let saveOutFullPathpath = path.join(outPath, file); let extname = path.extname(file); if (options.debug) { console.log(`[${extname}] ${srcFullPath} => ${saveOutFullPathpath}`); } //if is not js file, only copy if (allowFileExt.indexOf(extname) === -1) { compileFile(srcFullPath, saveOutFullPathpath, true, options); return; } let mTime = fs.statSync(srcFullPath).mtime.getTime(); if (fileUtil.isFile(saveOutFullPathpath)) { let outmTime = fs.statSync(saveOutFullPathpath).mtime.getTime(); // if compiled file mtime is later than source file, // it means source file not modified, so there is no necessary to compile. if (outmTime >= mTime) { return; } } if (!compiledMtime[file] || mTime > compiledMtime[file]) { let ret = compileFile(srcFullPath, saveOutFullPathpath, false, options); if (ret) { changedFiles.push(saveOutFullPathpath); } compiledMtime[file] = mTime; let index = compiledErrorFiles.indexOf(file); if (ret) { if (index > -1) { compiledErrorFiles.splice(index, 1); } } else if (ret === false) { if (index === -1) { compiledErrorFiles.push(file); } } } }); // console.error(compiledErrorFiles) } /** * compile single file * * @param {String} srcFullPath * @param {String} saveOutFullPath * @param {Boolean} [onlyCopy] * @param {Object} [options] * @param {String} [options.debug] only for debug */ export function compileFile(srcFullPath, saveOutFullPath, onlyCopy, options = {}) { let content = fs.readFileSync(srcFullPath, 'utf8'); //when get file content empty, maybe file is locked if (!content) { return; } // only copy file content if (onlyCopy) { fse.copySync(srcFullPath, saveOutFullPath); return; } try { let startTime = Date.now(); let data = compileByBabel(content, { filename: srcFullPath // sourceMaps: true, // sourceFileName: relativePath }); let endTime = Date.now(); if (options.debug) { console.log(`Compile file ${srcFullPath}`, `Babel cost ${endTime - startTime} ms`); } // save file fse.outputFileSync(saveOutFullPath, data.code); return true; } catch (e) { console.error(`compile file ${srcFullPath} error`, e); } return false; } /** * babel compile * https://babeljs.io/docs/core-packages/#babeltransformcode-string-options-object * @return {{code,map,ast}} */ export function compileByBabel(content, options) { return babel.transform(content, Object.assign({ presets: ['env', 'stage-0'] }, options)); } /** * get all files * @param paths */ export function getFiles(paths) { let result = fileUtil.getAllFiles(paths); let files = result.map((item) => { return item.relativePath; // return path.join(item.basePath, item.relativePath); }); return files; }
22.860465
89
0.630722
7deb60de67c6bfa3d1222b996a4ca2a4d57b2040
757
js
JavaScript
build/es6/faceFeatureExtractor/extractParamsFromWeigthMap.js
fhiguera/face-api.js
514c0ec2c4191fd177edd5ff5b745ddf30e3cebc
[ "MIT" ]
11
2019-07-08T19:48:34.000Z
2022-01-04T07:04:23.000Z
build/es6/faceFeatureExtractor/extractParamsFromWeigthMap.js
fhiguera/face-api.js
514c0ec2c4191fd177edd5ff5b745ddf30e3cebc
[ "MIT" ]
8
2020-07-17T22:47:52.000Z
2022-03-02T05:01:16.000Z
build/es6/faceFeatureExtractor/extractParamsFromWeigthMap.js
fhiguera/face-api.js
514c0ec2c4191fd177edd5ff5b745ddf30e3cebc
[ "MIT" ]
10
2019-05-24T18:49:38.000Z
2021-11-07T14:39:54.000Z
import { TfjsImageRecognitionBase } from 'tfjs-image-recognition-base'; import { loadParamsFactory } from './loadParamsFactory'; export function extractParamsFromWeigthMap(weightMap) { var paramMappings = []; var extractDenseBlock4Params = loadParamsFactory(weightMap, paramMappings).extractDenseBlock4Params; var params = { dense0: extractDenseBlock4Params('dense0', true), dense1: extractDenseBlock4Params('dense1'), dense2: extractDenseBlock4Params('dense2'), dense3: extractDenseBlock4Params('dense3') }; TfjsImageRecognitionBase.disposeUnusedWeightTensors(weightMap, paramMappings); return { params: params, paramMappings: paramMappings }; } //# sourceMappingURL=extractParamsFromWeigthMap.js.map
50.466667
104
0.762219
7deb8de33a0029640824ef3518eb478d2f803a72
25,550
js
JavaScript
test/httpClient.test.js
ryhinchey/autocannon
d1fc9eb8cea2f239ea1baddaa9c84e9e2f767fae
[ "MIT" ]
null
null
null
test/httpClient.test.js
ryhinchey/autocannon
d1fc9eb8cea2f239ea1baddaa9c84e9e2f767fae
[ "MIT" ]
null
null
null
test/httpClient.test.js
ryhinchey/autocannon
d1fc9eb8cea2f239ea1baddaa9c84e9e2f767fae
[ "MIT" ]
null
null
null
'use strict' const os = require('os') const http = require('http') const path = require('path') const test = require('tap').test const Client = require('../lib/httpClient') const helper = require('./helper') const server = helper.startServer() const timeoutServer = helper.startTimeoutServer() const httpsServer = helper.startHttpsServer() const tlsServer = helper.startTlsServer() const trailerServer = helper.startTrailerServer() const bl = require('bl') const fs = require('fs') const makeResponseFromBody = ({ server, method, body, headers = {} }) => { const sentHeaders = { Connection: 'keep-alive', ...headers } if (!sentHeaders['Content-Length'] && body) { sentHeaders['Content-Length'] = body.length } return `${method} / HTTP/1.1\r\nHost: localhost:${ server.address().port }\r\n${ Object.keys(sentHeaders).map(name => `${name}: ${sentHeaders[name]}`).join('\r\n') }\r\n${ body ? `\r\n${body}` : '\r\n' }` } test('client calls a server twice', (t) => { t.plan(4) const client = new Client(server.address()) let count = 0 client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') if (count++ > 0) { client.destroy() } }) }) test('client calls a https server twice', (t) => { t.plan(4) const opts = httpsServer.address() opts.protocol = 'https:' const client = new Client(opts) let count = 0 client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') if (count++ > 0) { client.destroy() } }) }) test('client calculates correct duration when using pipelining', (t) => { t.plan(4) const lazyServer = helper.startServer({ delayResponse: 500 }) const opts = lazyServer.address() opts.pipelining = 2 const client = new Client(opts) let count = 0 client.on('response', (statusCode, length, duration) => { t.equal(statusCode, 200, 'status code matches') t.ok(duration > 500 && duration < 800) if (++count === 2) { client.destroy() } }) }) test('client calls a tls server without SNI servername twice', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', '', 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client calls a tls server with SNI servername twice', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.servername = 'example.com' const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', opts.servername, 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client uses SNI servername from URL hostname by default', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.hostname = 'localhost' const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', opts.hostname, 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client prefers SNI servername from opts over URL hostname', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.hostname = 'localhost' opts.servername = 'example.com' const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', opts.servername, 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client ignores IP address in hostname-derived SNI servername', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.hostname = opts.address const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', '', 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client ignores falsy SNI servername', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.servername = '' const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', '', 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('client passes through tlsOptions to connect', (t) => { t.plan(4) const opts = tlsServer.address() opts.protocol = 'https:' opts.tlsOptions = { key: fs.readFileSync(path.join(__dirname, '/key.pem')), cert: fs.readFileSync(path.join(__dirname, '/cert.pem')), passphrase: 'test' } const client = new Client(opts) let count = 0 client.on('headers', (response) => { t.equal(response.statusCode, 200, 'status code matches') t.deepEqual(response.headers, ['X-servername', '', 'X-email', 'tes@test.com', 'Content-Length', '0']) if (count++ > 0) { client.destroy() } }) }) test('http client automatically reconnects', (t) => { t.plan(4) const client = new Client(server.address()) let count = 0 client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') if (count++ > 0) { client.destroy() } }) server.once('request', function (req, res) { setImmediate(() => { req.socket.destroy() }) }) }) test('http clients should have a different body', (t) => { t.plan(3) let clientCnt = 0 const clients = [] const reqArray = ['John', 'Gabriel', 'Jason'] const opts = server.address() opts.setupClient = (client) => { client.setBody(JSON.stringify({ name: reqArray[clientCnt] })) clientCnt++ } for (let i = 0; i < 3; i++) { const client = new Client(opts) clients.push(client) } for (let i = 0; i < clients.length; i++) { const client = clients[i] const body = JSON.parse(client.requestIterator.currentRequest.body) t.equal(body.name, reqArray[i], 'body match') client.destroy() } }) test('client supports custom headers', (t) => { t.plan(3) const opts = server.address() opts.headers = { hello: 'world' } const client = new Client(opts) server.once('request', (req, res) => { t.equal(req.headers.hello, 'world', 'custom header matches') }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') client.destroy() }) }) test('client supports host custom header', (t) => { t.plan(2) const opts = server.address() opts.headers = { host: 'www.autocannon.com' } const client = new Client(opts) server.once('request', (req, res) => { t.equal(req.headers.host, 'www.autocannon.com', 'host header matches') }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') client.destroy() }) }) test('client supports response trailers', (t) => { t.plan(3) const client = new Client(trailerServer.address()) let n = 0 client.on('body', (raw) => { if (++n === 1) { // trailer value t.ok(/7895bf4b8828b55ceaf47747b4bca667/.test(raw.toString())) } }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') client.destroy() }) }) ; [ 'DELETE', 'POST', 'PUT' ].forEach((method) => { test(`client supports ${method}`, (t) => { t.plan(3) const opts = server.address() opts.method = method const client = new Client(opts) server.once('request', (req, res) => { t.equal(req.method, method, 'custom method matches') }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') client.destroy() }) }) }) test('client supports sending a body', (t) => { t.plan(4) const opts = server.address() opts.method = 'POST' opts.body = Buffer.from('hello world') const client = new Client(opts) server.once('request', (req, res) => { req.pipe(bl((err, body) => { t.error(err) t.deepEqual(body.toString(), opts.body.toString(), 'body matches') })) }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') client.destroy() }) }) test('client supports sending a body which is a string', (t) => { t.plan(4) const opts = server.address() opts.method = 'POST' opts.body = 'hello world' const client = new Client(opts) server.once('request', (req, res) => { req.pipe(bl((err, body) => { t.error(err) t.deepEqual(body.toString(), opts.body, 'body matches') })) }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') client.destroy() }) }) test('client supports changing the body', (t) => { t.plan(2) const opts = server.address() opts.method = 'POST' opts.body = 'hello world' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') const body = 'modified' client.setBody(body) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts, body }), 'body changes updated request') client.destroy() }) test('client supports changing the headers', (t) => { t.plan(2) const opts = server.address() opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') const headers = { header: 'modified' } client.setHeaders(headers) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts, headers }), 'header changes updated request') client.destroy() }) test('client supports changing the headers and body', (t) => { t.plan(2) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') const body = 'modified' const headers = { header: 'modifiedHeader' } client.setBody(body) client.setHeaders(headers) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts, headers, body }), 'changes updated request') client.destroy() }) test('client supports changing the headers and body together', (t) => { t.plan(2) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') const body = 'modified' const headers = { header: 'modifiedHeader' } client.setHeadersAndBody(headers, body) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts, headers, body }), 'changes updated request') client.destroy() }) test('client supports changing the headers and body with null values', (t) => { t.plan(2) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') client.setBody(null) client.setHeaders(null) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'POST' }), 'changes updated request') client.destroy() }) test('client supports changing the headers and body together with null values', (t) => { t.plan(2) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') client.setHeadersAndBody(null, null) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'POST' }), 'changes updated request') client.destroy() }) test('client supports updating the current request object', (t) => { t.plan(2) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'request is okay before modifying') const newReq = { headers: { header: 'modifiedHeader' }, body: 'modified', method: 'GET' } client.setRequest(newReq) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...newReq }), 'changes updated request') client.destroy() }) test('client customiseRequest function overwrites the headers and body', (t) => { t.plan(5) const opts = server.address() opts.body = 'hello world' opts.method = 'POST' const body = 'modified' const headers = { header: 'modifiedHeader' } opts.setupClient = (client) => { t.ok(client.setHeadersAndBody, 'client had setHeadersAndBody method') t.ok(client.setHeaders, 'client had setHeaders method') t.ok(client.setBody, 'client had setBody method') client.setHeadersAndBody(headers, body) } const client = new Client(opts) t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts, headers, body }), 'changes updated request') t.notSame(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts }), 'changes updated request') client.destroy() }) test('client should throw when attempting to modify the request with a pipelining greater than 1', (t) => { t.plan(1) const opts = server.address() opts.pipelining = 10 const client = new Client(opts) t.throws(() => client.setHeaders({})) client.destroy() }) test('client resData length should equal pipelining when greater than 1', (t) => { t.plan(1) const opts = server.address() opts.pipelining = 10 const client = new Client(opts) t.equal(client.resData.length, client.opts.pipelining) client.destroy() }) test('client should emit a timeout when no response is received', (t) => { t.plan(1) const opts = timeoutServer.address() opts.timeout = 1 const client = new Client(opts) client.on('timeout', () => { t.ok(1, 'timeout should have happened') }) setTimeout(() => client.destroy(), 1800) }) test('client should emit 2 timeouts when no responses are received', (t) => { t.plan(2) const opts = timeoutServer.address() opts.timeout = 1 const client = new Client(opts) client.on('timeout', () => { t.ok(1, 'timeout should have happened') }) setTimeout(() => client.destroy(), 2800) }) test('client should have 2 different requests it iterates over', (t) => { t.plan(3) const server = helper.startServer() const opts = server.address() const requests = [ { method: 'POST', body: 'hello world again' }, { method: 'GET', body: 'modified' } ] const client = new Client(opts) let number = 0 client.setRequests(requests) client.on('response', (statusCode, length) => { number++ switch (number) { case 1: case 3: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...requests[0] }), 'request was okay') break case 2: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...requests[1] }), 'body changes updated request') break case 4: client.destroy() t.end() break } }) }) test('client should emit reset when request iterator has reset', (t) => { t.plan(1) const server = helper.startServer() const opts = server.address() const requests = [ { method: 'POST', body: 'hello world again' }, { method: 'POST', body: 'modified', // falsey result will reset setupRequest: () => {} }, { method: 'POST', body: 'never used' } ] const client = new Client(opts) client.setRequests(requests) client.on('reset', () => { client.destroy() t.end() }) client.on('response', () => { t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...requests[0] }), 'first request was okay') }) }) test('client should stop when first setupRequest() fails', (t) => { t.plan(1) const server = helper.startServer() const opts = server.address() const client = new Client(opts) t.throws( () => client.setRequests([{ method: 'GET', setupRequest: () => {} }]), 'First setupRequest() failed did not returned valid request. Stopping' ) client.destroy() t.end() }) test('client exposes response bodies and statuses', (t) => { const server = helper.startServer({ body: ({ method }) => method === 'POST' ? 'hello!' : 'world!' }) const opts = server.address() opts.requests = [ { method: 'POST', body: 'hello world!', onResponse: (status, body) => responses.push({ status, body }) }, { method: 'POST', body: 'hello world again' }, { method: 'GET', onResponse: (status, body) => responses.push({ status, body }) } ] const responses = [] const client = new Client(opts) let number = 0 client.on('response', (statusCode, length) => { number++ switch (number) { case 1: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts.requests[0] }), 'first request') t.deepEqual(responses, [{ status: 200, body: 'hello!' }]) break case 2: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts.requests[1] }), 'second request') t.deepEqual(responses, [{ status: 200, body: 'hello!' }]) break case 3: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts.requests[2] }), 'third request') t.deepEqual(responses, [{ status: 200, body: 'hello!' }, { status: 200, body: 'world!' }]) break case 4: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts.requests[0] }), 'first request') t.deepEqual(responses, [{ status: 200, body: 'hello!' }, { status: 200, body: 'world!' }, { status: 200, body: 'hello!' }]) client.destroy() t.end() break } }) }) test('client keeps context and reset it when looping on requests', (t) => { const server = helper.startServer() const opts = server.address() let number = 0 const expectedResponse = 'hello world' opts.requests = [ { method: 'POST', body: 'hello world again', onResponse: (status, body, context) => { if (number < 3) { t.deepEqual(context, {}, 'context was supposed to be null') context.previousRes = body } } }, { method: 'PUT', setupRequest: (req, context) => { if (number < 3) { t.deepEqual(context, { previousRes: expectedResponse }, 'context was supposed to contain previous response') } return Object.assign({}, req, { body: context.previousRes }) } } ] const client = new Client(opts) client.on('response', (statusCode, length) => { number++ switch (number) { case 1: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, ...opts.requests[0] }), 'hard-coded body') break case 2: t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'PUT', body: expectedResponse }), 'dynamic body') client.destroy() t.end() break } }) }) test('client supports http basic authentication', (t) => { t.plan(2) const server = helper.startServer() const opts = server.address() opts.auth = 'username:password' const client = new Client(opts) server.once('request', (req, res) => { t.equal(req.headers.authorization, 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=', 'authorization header matches') }) client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') client.destroy() t.end() }) }) test('should return client instance', (t) => { t.plan(1) const caller = {} const opts = server.address() opts.auth = 'username:password' const client = Client.call(caller, opts) t.type(client, Client) client.destroy() }) test('client calls twice using socket on secure server', (t) => { t.plan(4) const socketPath = process.platform === 'win32' ? path.join('\\\\?\\pipe', process.cwd(), 'autocannon-' + Date.now()) : path.join(os.tmpdir(), 'autocannon-' + Date.now() + '.sock') helper.startHttpsServer({ socketPath }) const client = new Client({ url: 'localhost', protocol: 'https:', socketPath, connections: 1 }) let count = 0 client.on('response', (statusCode, length) => { t.equal(statusCode, 200, 'status code matches') t.ok(length > 'hello world'.length, 'length includes the headers') if (count++ > 0) { client.destroy() t.end() } }) }) test('client emits mistmatch when expectBody doesn\'t match actual body', (t) => { const responses = ['hello...', 'world!'] const server = helper.startServer({ body: ({ method }) => responses[method === 'POST' ? 0 : 1] }) const opts = server.address() opts.requests = [ { method: 'POST', body: 'hi there!' }, { method: 'GET' } ] opts.expectBody = responses[0] const client = new Client(opts) client.on('mismatch', (body) => { // we expect body mismatch on second request t.same(body, responses[1]) client.destroy() t.end() }) }) test('client invokes appropriate onResponse when using pipelining', (t) => { const server = helper.startServer({ body: ({ method }) => method }) const opts = server.address() opts.pipelining = 2 const responses = [] const onResponse = (status, body) => responses.push(body) opts.requests = [ { method: 'POST', onResponse }, { method: 'GET', onResponse }, { method: 'PUT', onResponse } ] const client = new Client(opts) let number = 0 client.on('response', (statusCode, length) => { number++ switch (number) { case 1: // 1st & 2nd were sent, receiving 1st t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'GET' }), 'current should be second request') t.deepEqual(responses, ['POST']) break case 2: // 3rd was sent as 1st is finished, receiving 2nd t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'PUT' }), 'current should be third request') t.deepEqual(responses, ['POST', 'GET']) break case 3: // 1st was resent, receiving 3rd t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'POST' }), 'current should be first request') t.deepEqual(responses, ['POST', 'GET', 'PUT']) break case 4: // 2nd was resent, receiving 1st t.same(client.getRequestBuffer().toString(), makeResponseFromBody({ server, method: 'GET' }), 'current should be second request') t.deepEqual(responses, ['POST', 'GET', 'PUT', 'POST']) client.destroy() t.end() break } }) }) test('client supports receiving large response body', (t) => { t.plan(2) const mockBody = Array.from({ length: 1024 * 10 }, (_, i) => `str-${i}`).join('\n') const server = http.createServer((req, res) => { res.end(mockBody) }) server.listen(0) server.unref() let onResponseCalled = 0 const opts = server.address() opts.method = 'POST' opts.body = Buffer.from('hello world') opts.requests = [ { path: '/', method: 'GET', onResponse: (...args) => { onResponseCalled++ } } ] const client = new Client(opts) client.on('response', (statusCode, length) => { t.equal(onResponseCalled, 1, 'onResponse should be called only once') t.equal(statusCode, 200, 'status code matches') client.destroy() }) })
26.476684
141
0.620548
7debfb63df9d06296ec189b1622700a871da4abc
448
js
JavaScript
test/helpers/config-test.js
sznowicki/ubbthreads-cherrypick-exporter
b56a70ce04438a49c5646004068425a935c6daab
[ "MIT" ]
null
null
null
test/helpers/config-test.js
sznowicki/ubbthreads-cherrypick-exporter
b56a70ce04438a49c5646004068425a935c6daab
[ "MIT" ]
null
null
null
test/helpers/config-test.js
sznowicki/ubbthreads-cherrypick-exporter
b56a70ce04438a49c5646004068425a935c6daab
[ "MIT" ]
null
null
null
const chai = require('chai'); const should = chai.should(); const config = require('../../app/helpers/config'); describe('Mysql config test', function() { it('Should give all required properties for mysql', function() { const keyToCheck = [ 'host', 'dbname', 'username', 'password', 'prefix' ]; keyToCheck.forEach(val => { config.getSetting(`mysql.${val}`).should.be.a('string'); }); }); });
24.888889
66
0.582589
7decfd2600c8b14ce870ca875c176de592bb2d87
1,422
js
JavaScript
webpack/webpack.config-dev.js
vitalybe/react-json-view
5f87710f97e5de686d1785e0eef2d7aef06836a3
[ "MIT" ]
2
2020-09-04T09:58:12.000Z
2020-11-16T20:57:26.000Z
webpack/webpack.config-dev.js
vitalybe/react-json-view
5f87710f97e5de686d1785e0eef2d7aef06836a3
[ "MIT" ]
1
2021-03-01T04:39:19.000Z
2021-03-01T04:39:44.000Z
webpack/webpack.config-dev.js
vitalybe/react-json-view
5f87710f97e5de686d1785e0eef2d7aef06836a3
[ "MIT" ]
3
2019-11-29T18:10:18.000Z
2021-03-01T04:32:58.000Z
const path = require("path") const webpack = require("webpack") const PATHS = { src: path.join(__dirname, "..", "src"), js: path.join(__dirname, "..", "src", "js"), style: path.join(__dirname, "..", "src", "style"), build: path.join(__dirname, "..", "dev-server", "dist"), devServer: path.join(__dirname, "..", "dev-server") } const config = { entry: [PATHS.devServer + "/src/index.js"], externals: { react: "React", "react-dom": "ReactDOM" }, devServer: { host: "localhost", port: 2000, hot: true, inline: true, historyApiFallback: true, contentBase: PATHS.build }, output: { path: PATHS.build, filename: "main.js", library: "reactJsonView", libraryTarget: "umd" }, plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.optimize.UglifyJsPlugin() ], resolve: { extensions: [".js", ".json", ".css", ".scss"] }, devtool: "eval-source-map", module: { rules: [ { test: /\.jsx?$/, use: [ { loader: "babel-loader" } ], include: [PATHS.js, PATHS.devServer] }, { test: /\.s?css$/, use: [ { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" } ] } ] } } module.exports = config
20.314286
58
0.497187
7ded079b6aa371c07606f67444b78be90176ddbc
1,620
js
JavaScript
server/main.js
danielesteban/blocks-editor-examples
3ef32cc0aced4e52138fd0d203ac628b5e72f8b8
[ "MIT" ]
10
2020-10-26T22:08:22.000Z
2021-11-09T11:41:50.000Z
server/main.js
danielesteban/blocks-editor-examples
3ef32cc0aced4e52138fd0d203ac628b5e72f8b8
[ "MIT" ]
null
null
null
server/main.js
danielesteban/blocks-editor-examples
3ef32cc0aced4e52138fd0d203ac628b5e72f8b8
[ "MIT" ]
1
2021-06-05T07:14:19.000Z
2021-06-05T07:14:19.000Z
const cors = require('cors'); const express = require('express'); const expressWS = require('express-ws'); const helmet = require('helmet'); const nocache = require('nocache'); const Game = require('./game'); const Room = require('./room'); const allowedOrigins = process.env.ALLOWED_ORIGINS ? process.env.ALLOWED_ORIGINS.split(',') : false; const allowedRooms = process.env.ALLOWED_ROOMS ? process.env.ALLOWED_ROOMS.split(',') : false; const server = express(); server.use(helmet()); expressWS(server, null, { clientTracking: false }); const rooms = new Map(); rooms.set('Game', new Game({ dimensions: { width: 10, height: 20 }, players: 4, })); server.ws('/:room', (client, req) => { if (allowedOrigins && allowedOrigins.indexOf(req.headers.origin) === -1) { client.send(JSON.stringify({ type: 'ERROR', data: 'Origin not allowed.', }), () => {}); client.terminate(); return; } const { room: id } = req.params; if (allowedRooms && allowedRooms.indexOf(id) === -1) { client.send(JSON.stringify({ type: 'ERROR', data: 'Room not allowed.', }), () => {}); client.terminate(); return; } let room = rooms.get(id); if (!room) { room = new Room(id); rooms.set(id, room); } room.onClient(client); }); server.get('/peers', cors({ origin: allowedOrigins || true }), nocache(), (req, res) => { const peers = {}; rooms.forEach(({ id, clients }) => { if (clients.length) { peers[id] = clients.length; } }); res.json(peers); }); server.use((req, res) => res.status(404).end()); server.listen(process.env.PORT || 3000);
26.557377
100
0.612963
7ded8e24bac1d6270858ef5813bb5d07b46a9918
16,805
js
JavaScript
pyfiddleproj/pyfiddleweb/static/js/main.js
priyankcommits/pyfiddleio
e54713e97cb65dd20989d971f9507d346f32972f
[ "MIT" ]
29
2017-07-13T14:30:19.000Z
2021-11-08T23:55:58.000Z
pyfiddleproj/pyfiddleweb/static/js/main.js
priyankcommits/pyfiddleio
e54713e97cb65dd20989d971f9507d346f32972f
[ "MIT" ]
5
2018-06-14T17:02:36.000Z
2021-06-10T19:58:45.000Z
pyfiddleproj/static/js/main.js
priyankcommits/pyfiddleio
e54713e97cb65dd20989d971f9507d346f32972f
[ "MIT" ]
12
2018-03-07T19:49:02.000Z
2022-02-11T14:11:46.000Z
var height = $(window).height(); var width = $(window).width(); var loader = $('#loader-div'); var spinner = $('#spinner-div'); var canRun = true; var canReset = true; var canSave = true; var canShowNotification = true; var editor; var date = new Date(); /* pre ajax call setup */ var csrftoken = $.cookie('csrftoken'); function csrfSafeMethod(method) { return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $.ajaxSetup({ beforeSend: function(xhr, settings) { if (!csrfSafeMethod(settings.type) && !this.crossDomain) { xhr.setRequestHeader('X-CSRFToken', csrftoken); } } }); /* ajax form submit */ function submit_ajax_form(action, data_to_send) { spinner.show(); editor.save(); var options = { statusCode: { 500: function() { canSave = true; canReset = true; canRun = true; toaster("Uknown Error Occured", 4000); }, 504: function() { canSave = true; canReset = true; canRun = true; toaster("Uknown Error Occured", 4000); }, }, dataType: 'json', data: data_to_send, url: "/" + action + "/", success: function(data, textStatus, jqXHR) { /* Execute callbacks */ if (action == "run") { exec_run(data); } if (action == "save") { exec_save(data); } if (action == "star") { exec_star(data); } if (action == "share") { exec_share(data); } if (action == "delete") { exec_delete(data); } if (action == "upload") { exec_upload(data); } if (action == "file_delete") { exec_file_delete(data, data_to_send.file_id); } if (action == "collaborate") { exec_collaborate(data); } if (action == "collaborator_delete") { exec_collaborator_delete(data); } spinner.hide(); }, error: function(jqXHR, textStatus, errorThrown) { if (textStatus == "timeout") { toaster("Exceeded computation limit", 4000); } else { toaster(errorThrown, 4000); } spinner.hide(); }, timeout: 300000 }; $('#fiddle_form').ajaxSubmit(options); } function exec_run(data) { canRun = true; if (data.error != undefined) { toaster(data.error, 4000); } else { if (data.statusCode != 200) { toaster("Uknown Error Occured", 4000); } if (data.statusCode == 200) { $(".shell-result").animate({ scrollTop: $('.shell-result').prop("scrollHeight") }, 1000); $("#shell_output").html($("#shell_output").html() + ''); $('.bash-output').last().text($('.bash-output').text() + "\n" + atob(data.output)); toaster("Successfully ran Fiddle", 4000); } } } function exec_save(data) { canSave = true; if (data.errors != undefined) { $.each(JSON.parse(data.errors), function(err, val) { toaster(err + " : " + val[0].message, 4000); }); } if (data.fiddle_id != undefined) { window.location = '/fiddle/' + data.fiddle_id + '/?m=' + data.message; } else { toaster(data.message, 4000); } } function exec_star(data) { toaster(data.message, 4000); } function exec_share(data) { if (data.errors != undefined) { $.each(JSON.parse(data.errors), function(err, val) { toaster(err + " : " + val[0].message, 4000); }); } else { if (data.fiddle_id != undefined) { share_modal_open(data.fiddle_id); } toaster(data.message, 4000); } } function exec_delete(data) { if (data.status == 0) { toaster(data.message, 4000); } if (data.status == 1) { window.location = '/?m="' + data.message + '"'; } } $("#email_form_button").on('click', function(e) { e.preventDefault(); submit_email_ajax_form(this.id); }); function exec_upload(data) { if (data.fiddle_id != undefined) { window.location = '/fiddle/' + data.fiddle_id + '/?m=Uploaded file(s)'; } if (data.status == true) { files = $("#file-list").empty(); files.append( '<div class="item">' + '<i class="file icon"></i>' + '<div class="content">' + '<div class="header">main.py ( now editing .. )</div></div>' ); $.each(data.files, function(key, value) { files.append( '<div class="item">' + '<i class="file icon"></i>' + '<div class="content">' + '<div class="header">' + value.name + '<span id="' + value.id + '" name="file_to_delete" class="file_to_delete pointer fa fa-minus-circle fa-1x" value="' + value.name + '">' + '</span></div></div>' ); }); toaster("Uploaded files", 4000); } else { toaster("One or more files could not be uploaded", 4000); } } function exec_file_delete(data, file_id) { if (data.status == 1) { toaster("File Deleted", 4000); $("#" + file_id).remove(); } if (data.status == 2) { toaster("Not your fiddle to delete", 4000); } if (data.status == 0) { toaster("Could not delete file", 4000); } } function exec_collaborate(data) { toaster(data.message, 4000); } function exec_collaborator_delete(data) { if ( data.collaborator_email != undefined ){ $.each(data.collaborator_email, function(key, value) { $(".collaborator_"+value).remove(); }); } toaster(data.message, 4000); } function submit_email_ajax_form(form_name) { $('#email_form_error_message').text(email_form_error_message); var options = { dataType: 'json', url: '/prod/email/', success: function(data, textStatus, jqXHR) { toaster(data.message, 4000); $(".ui.feedback-form.modal").modal('hide'); $("#email_form")[0].reset(); spinner.hide(); }, error: function(jqXHR, textStatus, errorThrown) { if (textStatus == "timeout") { toaster("Exceeded computation limit", 4000); } else { toaster(errorThrown, 4000); } $(".ui.feedback-form.modal").modal('hide'); spinner.hide(); }, timeout: 300000 }; var canSubmit = true; var email_form_from = $('#email_form_from').val().trim(); var email_form_subject = $('#email_form_subject').val(); var email_form_message = $('#email_form_message').val().trim(); var email_form_error_message = ''; if (email_form_from == '' || email_form_from == undefined) { canSubmit = false; email_form_error_message = 'Email is required.'; } else if (email_form_subject == '' || email_form_subject == undefined || email_form_subject == 'Select subject') { canSubmit = false; email_form_error_message = 'Subject is required.'; } else if (email_form_message == '' || email_form_message == undefined ) { canSubmit = false; email_form_error_message = 'Message is required'; } if (canSubmit) { spinner.show(); $('#' + form_name).ajaxSubmit(options); } else { $('#email_form_error_message').text(email_form_error_message); } } function share_modal_open(fiddle_id) { var url_to_display = $.url(document.URL).attr().base; $(".ui.share-content.modal").modal({ "inverted": true }).modal('show'); $("#url_to_display_text").val(url_to_display + "/fiddle/" + fiddle_id + "/?i=true"); $("#url_to_display_text").select(); $("#button_copy_url").on("click", function() { $("#url_to_display_text").select(); document.execCommand("copy"); toaster("Copied Link", 4000); }); $("#button_copy_url").trigger("click"); } function collaborate_modal_open(fiddle_id) { $(".ui.collaborate-content.modal").modal({ "inverted": true }).modal('show'); } function upload_file() { var action = "upload"; var data = {}; var fiddle_id = document.URL.split("/")[4]; data.fiddle_id = fiddle_id; submit_ajax_form(action, data); } function delete_file(file_element) { var action = "file_delete"; var data = {}; var fiddle_id = document.URL.split("/")[4]; var file_name = file_element.attr("value"); data.fiddle_id = fiddle_id; data.file_name = file_name; data.file_id = file_element.attr("value"); submit_ajax_form(action, data); } function collaborator_delete(collaborator_element) { var action = "collaborator_delete"; var data = {}; var fiddle_id = document.URL.split("/")[4]; var collaborator_email = collaborator_element.attr("value"); data.fiddle_id = fiddle_id; data.collaborator_email = collaborator_email; submit_ajax_form(action, data); } function resize() { height = $(window).height(); width = $(window).width(); $("#code-div").height(height - $("#code-div").offset().top); $(".shell-result").height(height - $("#code-div").offset().top); editor.setSize(null, height - $("#code-div").offset().top - 20); } function toggle_notification() { canShowNotification = !canShowNotification; } function toaster(message, time) { if (canShowNotification == true) { $(".toast-message").append( "<div class='ui visible message' style='background-color: #2885CD'>" + "<p style='color: #FFFFFF'>" + message + "</p>" + "</div>" ); var delay = (function() { var timer = 0; return function(callback, ms) { clearTimeout(timer); timer = setTimeout(callback, ms); }; })(); delay(function() { $('.message').remove(); }, time); } } function create_help_cookie() { date.setTime(date.getTime() + (1440 * 60 * 1000 * 10)); $.cookie("i", "true", { expires: date }); } function trigger_help() { if ($.url(document.URL).param().i == "true") { $('#help').trigger("click"); } } function check_for_mobile_view() { if (height <= 400 || width <= 800) { $("#desktop-view").hide(); $("#desktop-header").hide(); $("#mobile-view").show(); } else { $("#desktop-view").show(); $("#desktop-header").show(); $("#mobile-view").hide(); } } /* Window ready */ $(document).ready(function() { loader.show(); spinner.hide(); /* semantic js */ $('.ui.dropdown').dropdown(); $('.ui.accordion').accordion(); $(".help.button").click(function() { $('.ui.help-content.modal').modal('show'); }); $(".api.button").click(function() { $('.ui.api-content.modal').modal('show'); }); $('.menu .item').tab(); $('.feedback .button').click(function() { $('.ui.feedback-form.modal').modal('show'); }); $('.message .close').on('click', function() { $(this).closest('.message').transition('fade'); }); editor = CodeMirror.fromTextArea(id_code, { mode: 'python', lineNumbers: true, lineWrapping: true, theme: 'solarized', tabSize: 4, indentUnit: 4, autofocus: true, }); editor.setSize(null, height - $("#code-div").offset().top - 20); var change_count = 0; editor.on('change', function(editor) { change_count += 1; if (change_count == 50) { change_count = 0; toaster("Considerable amount of code change detected, consider saving by clicking save button", 4000); } }); var fiddle_id = document.URL.split("/")[4]; var defaultCode = "# Print Your code here\nprint('Hello in console window')"; if (fiddle_id == undefined || fiddle_id == "" || fiddle_id == null) { editor.setValue(defaultCode); } if ($.cookie("script") == "true" || $.cookie("script") == true) { if ($.cookie("code") == undefined) { editor.setValue(defaultCode); } else { editor.setValue($.cookie("code")); } $.cookie("script", "false"); } resize(); /* Toggle Notification */ $("#id_notification").click(function() { canShowNotification = !canShowNotification; }); /* Clear Console Window */ $("#clear_bash_output").click(function() { $(".bash-output").text(""); toaster('Cleared console', 4000); }); /* Call Editor, Shell resizer */ $("input[value='General']").parent().find("span").each(function() { $(this).addClass("run"); }); /* Button Actions */ $(".btn-action").on('click', function(e) { e.preventDefault(); var action = $(this).val(); var data = {}; var fiddle_id = document.URL.split("/")[4]; if (fiddle_id != undefined) { data.fiddle_id = fiddle_id; } if (action == "run") { submit_ajax_form(action, data); } if (action == "save") { submit_ajax_form(action, data); } if (action == "star") { submit_ajax_form(action, data); } if (action == "delete") { submit_ajax_form(action, data); } if (action == "share") { if (fiddle_id != undefined) { share_modal_open(fiddle_id); } else { submit_ajax_form(action, data); } } if (action == "collaborate-modal") { if (fiddle_id != undefined) { collaborate_modal_open(fiddle_id); } } if (action == "collaborate") { var user = $("#collaborate-user").val(); submit_ajax_form(action, data); } }); /* Upload File */ $("#file").on('change', function(e) { e.preventDefault(); upload_file(); }); /* Delete File */ $(document).on('click', '.file_to_delete', function() { delete_file($(this)); }); /* Delete Collaborator */ $(document).on('click', '.collaborator_delete', function() { collaborator_delete($(this)); }); /* Toasting any url encoded messages */ var message_url = $.url(document.URL).param().m; if (message_url != undefined && message_url != "") { toaster(message_url, 4000); } /* Send Feedback */ $("#email_form").submit(function(e) { e.preventDefault(); submit_email_ajax_form('email_form'); }); $("#email_form_mobile").submit(function(e) { e.preventDefault(); submit_email_ajax_form('email_form_mobile'); }); /* Expanding popular fiddles */ $("#popular").trigger("click"); check_for_mobile_view(); /* Login */ $(".login-button").one("click", function(e) { e.preventDefault(); date.setTime(date.getTime() + (1440 * 60 * 1000)); $.cookie("script", "true", { expires: date }); $.cookie("code", editor.getValue(), { expires: date }); window.location = $(this).attr('href'); }); }); /* Window on load */ $(window).load(function() { trigger_help(); create_help_cookie(); loader.hide(); /* Window Resize */ $(window).resize(function() { editor.setSize(null, height - $("#code-div").offset().top - 20); height = $(window).height(); width = $(window).width(); resize(); check_for_mobile_view(); }); document.addEventListener("keydown", function(zEvent) { /* Run */ if (((zEvent.ctrlKey == true || zEvent.metaKey == true) && zEvent.key == "Enter") && canRun == true) { canRun = false; $("#run").trigger("click"); } /* Save */ if (((zEvent.ctrlKey == true || zEvent.metaKey == true) && zEvent.key == "s") && canSave == true) { zEvent.preventDefault(); canSave = false; $("#save").trigger("click"); } /* Reset */ if (((zEvent.ctrlKey == true || zEvent.metaKey == true) && zEvent.key == "Backspace") && canReset == true) { zEvent.preventDefault(); $("#shell_output").text(""); } }); });
30.948435
157
0.524308
7dee62cb801784dd2aa95c56b27e8321bee68bf0
1,013
js
JavaScript
packages/Dashboard/lib/routers/api/chat.js
glkwhr/Server
12fcdb23d710ca0fb6e6fae5814101c525ff65ce
[ "MIT" ]
14
2020-04-08T16:01:13.000Z
2021-07-10T02:25:42.000Z
packages/Dashboard/lib/routers/api/chat.js
glkwhr/Server
12fcdb23d710ca0fb6e6fae5814101c525ff65ce
[ "MIT" ]
23
2019-11-29T01:57:01.000Z
2022-01-15T16:14:32.000Z
packages/Dashboard/lib/routers/api/chat.js
glkwhr/Server
12fcdb23d710ca0fb6e6fae5814101c525ff65ce
[ "MIT" ]
10
2019-10-12T11:15:30.000Z
2022-01-22T11:29:51.000Z
const Router = require('koa-router'); const router = new Router(); const isUUID = require('is-uuid'); router.post('/_save', async (ctx, next) => { // ctx.router available await ctx.trpgapp.chat.saveChatLogAsync(); ctx.body = { result: true, }; }); router.get('/_log', async (ctx, next) => { let { page, limit } = ctx.request.query; page = Number(page) || 1; limit = Number(limit) || 10; let count = await ctx.trpgapp.chat.getChatLogSumAsync(); let data = await ctx.trpgapp.chat.getChatLogAsync(page, limit); ctx.body = { code: 0, msg: '', count: count, data: data }; }); router.post('/_sendSystemMsg', async (ctx, next) => { // ctx.router available let { to_uuid, type, title, content } = ctx.request.body; if (!isUUID.v1(to_uuid)) { ctx.body = { result: false, msg: '玩家uuid不合法', }; return; } // TODO 检查uuid是否存在 ctx.trpgapp.chat.sendSystemMsg(to_uuid, type, title, content, {}); ctx.body = { result: true, }; }); module.exports = router;
23.55814
68
0.619941
7def371d0a377134243f9361caa11b98d23b43a7
9,695
js
JavaScript
test/server.js
uber/multitransport-jsonrpc
8ad9bdb8121d872fc41f139cc411e77df2603489
[ "MIT", "Unlicense" ]
79
2015-01-06T20:17:13.000Z
2017-09-24T02:48:13.000Z
test/server.js
uber-archive/multitransport-jsonrpc
8ad9bdb8121d872fc41f139cc411e77df2603489
[ "MIT", "Unlicense" ]
18
2015-01-07T01:27:03.000Z
2017-09-15T20:24:35.000Z
test/server.js
uber/multitransport-jsonrpc
8ad9bdb8121d872fc41f139cc411e77df2603489
[ "MIT", "Unlicense" ]
19
2015-02-26T08:52:26.000Z
2017-09-18T03:32:44.000Z
var jsonrpc = require('../lib/index'); var HttpTransport = jsonrpc.transports.server.http; var TcpTransport = jsonrpc.transports.server.tcp; var shared = require('../lib/transports/shared/tcp'); var JSONRPCserver = jsonrpc.server; var ErrorCode = jsonrpc.errorcode; var http = require('http'); var net = require('net'); exports.loopbackHttp = function(test) { test.expect(4); var jsonRpcServer = new JSONRPCserver(new HttpTransport(65432), { loopback: function(arg1, callback) { callback(null, arg1); } }); var testJSON = JSON.stringify({ id: 1, method: 'loopback', params: [{ hello: 'world' }] }); var req = http.request({ hostname: 'localhost', port: 65432, path: '/', method: 'POST' }, function(res) { res.setEncoding('utf8'); var resultString = ''; res.on('data', function(data) { resultString += data; }); res.on('end', function() { test.equal(200, res.statusCode, 'The http transport provided an OK status code'); var resultObj; try { resultObj = JSON.parse(resultString); } catch(e) { // Do nothing, test will fail } test.equal(resultObj.id, 1, 'The JSON-RPC server sent back the same ID'); test.equal(resultObj.result.hello, 'world', 'The loopback method worked as expected'); test.ok(resultObj.error === undefined, 'The error property is not defined on success'); test.done(); jsonRpcServer.transport.server.close(); }); }); req.write(testJSON); req.end(); }; exports.loopbackHttp = function(test) { test.expect(5); var jsonRpcServer = new JSONRPCserver(new HttpTransport(65432), { loopback: function(arg1, callback) { callback(null, arg1); } }); var testJSON = JSON.stringify({ jsonrpc: "2.0", id: 1, method: 'loopback', params: [{ hello: 'world' }] }); var req = http.request({ hostname: 'localhost', port: 65432, path: '/', method: 'POST' }, function(res) { res.setEncoding('utf8'); var resultString = ''; res.on('data', function(data) { resultString += data; }); res.on('end', function() { test.equal(200, res.statusCode, 'The http transport provided an OK status code'); var resultObj; try { resultObj = JSON.parse(resultString); } catch(e) { // Do nothing, test will fail } test.equal(resultObj.jsonrpc, "2.0", 'The JSON-RPC server sent back the same jsonrpc version'); test.equal(resultObj.id, 1, 'The JSON-RPC server sent back the same ID'); test.equal(resultObj.result.hello, 'world', 'The loopback method worked as expected'); test.ok(resultObj.error === undefined, 'The error property is not defined on success'); test.done(); jsonRpcServer.transport.server.close(); }); }); req.write(testJSON); req.end(); }; exports.loopbackHttpBatch = function(test) { test.expect(11); var jsonRpcServer = new JSONRPCserver(new HttpTransport(65123), { loopback: function(arg1, callback) { callback(null, arg1); } }); var testJSON = JSON.stringify([ { id: 1, method: 'loopback', params: [{ hello: 'world' }] }, { id: 2, method: 'noexists', params: [{ hello: 'world' }] }, { id: 3, method: 'loopback', params: [{ hello: 'batch world' }] } ]); var req = http.request({ hostname: 'localhost', port: 65123, path: '/', method: 'POST' }, function(res) { res.setEncoding('utf8'); var resultString = ''; res.on('data', function(data) { resultString += data; }); res.on('end', function() { test.equal(200, res.statusCode, 'The http transport provided an OK status code'); var resultObj; try { resultObj = JSON.parse(resultString); } catch(e) { // Do nothing, test will fail } test.equal(Array.isArray(resultObj), true, 'The batch response is array'); var obj; { obj = resultObj[0]; test.equal(obj.id, 1, 'The JSON-RPC server sent back the same ID'); test.equal(obj.result.hello, 'world', 'The loopback method worked as expected'); test.ok(resultObj.error === undefined, 'The error property is not defined on success'); } { obj = resultObj[1]; test.equal(obj.id, 2, 'The JSON-RPC server sent back the same ID'); test.equal(obj.error.code, -32601, 'The method is not found'); test.ok(obj.result === undefined, 'The result property is not defined on error response'); } { obj = resultObj[2]; test.equal(obj.id, 3, 'The JSON-RPC server sent back the same ID'); test.equal(obj.result.hello, 'batch world', 'The loopback method worked as expected'); test.ok(resultObj.error === undefined, 'The error property is not defined on success'); } test.done(); jsonRpcServer.transport.server.close(); }); }); req.write(testJSON); req.end(); }; exports.failureTcp = function(test) { test.expect(4); var jsonRpcServer = new JSONRPCserver(new TcpTransport(64863), { failure: function(arg1, callback) { callback(new Error("I have no idea what I'm doing")); } }); var con = net.connect({ port: 64863, host: 'localhost' }, function() { con.write(shared.formatMessage({ id: 1, method: 'failure', params: [{ hello: 'world' }] })); }); var buffers = [], bufferLen = 0, messageLen = 0; con.on('data', function(data) { buffers.push(data); bufferLen += data.length; if(messageLen === 0) messageLen = shared.getMessageLen(buffers); if(bufferLen === messageLen + 4) con.end(); }); con.on('end', function() { try { var res = shared.parseBuffer(buffers, messageLen); test.equal(res[1].id, 1, 'The JSON-RPC server sent back the same ID'); test.equal(res[1].error.code, ErrorCode.internalError); test.equal(res[1].error.message, "I have no idea what I'm doing", 'Returns the error as an error'); test.ok(res[1].result === undefined, 'The result property is not defined on error response'); } catch(e) { // Do nothing } jsonRpcServer.transport.server.close(); test.done(); }); }; exports.nonexistentMethod = function(test) { test.expect(4); var jsonRpcServer = new JSONRPCserver(new HttpTransport(65111), {}); var testJSON = JSON.stringify({ id: 25, method: 'nonexistent', params: [] }); var req = http.request({ hostname: 'localhost', port: 65111, path: '/', method: 'POST' }, function(res) { res.setEncoding('utf8'); var resultString = ''; res.on('data', function(data) { resultString += data; }); res.on('end', function() { var resultObj; try { resultObj = JSON.parse(resultString); } catch(e) { // Do nothing, test will fail } test.equal(resultObj.id, 25, 'The JSON-RPC server sent back the correct ID'); test.equal(resultObj.error.code, ErrorCode.methodNotFound); test.equal(resultObj.error.message, 'Requested method does not exist.', 'The JSON-RPC server returned the expected error message.'); test.ok(resultObj.result === undefined, 'The result property is not defined on error response'); jsonRpcServer.shutdown(test.done.bind(test)); }); }); req.write(testJSON); req.end(); }; exports.noncompliantJSON = function(test) { test.expect(4); var jsonRpcServer = new JSONRPCserver(new HttpTransport(64123), {}); var testJSON = JSON.stringify({ hello: 'world' }); var req = http.request({ hostname: 'localhost', port: 64123, path: '/', method: 'POST' }, function(res) { res.setEncoding('utf8'); var resultString = ''; res.on('data', function(data) { resultString += data; }); res.on('end', function() { var resultObj; try { resultObj = JSON.parse(resultString); } catch(e) { // Do nothing, test will fail } test.equal(resultObj.id, null, 'The JSON-RPC server sent back the correct ID'); test.equal(resultObj.error.code, ErrorCode.invalidRequest); test.equal(resultObj.error.message, 'Did not receive valid JSON-RPC data.', 'The JSON-RPC server returned the expected error message.'); test.ok(resultObj.result === undefined, 'The result property is not defined on error response'); jsonRpcServer.shutdown(test.done.bind(test)); }); }); req.write(testJSON); req.end(); };
35.254545
148
0.539969
7df01bea3650be35811fe8152b131db730e2ffec
65,082
js
JavaScript
server.js
dibend/blast_web_server
2f7d4e118ff38b00248c50ee8f2643ab89e6ed30
[ "Apache-2.0" ]
null
null
null
server.js
dibend/blast_web_server
2f7d4e118ff38b00248c50ee8f2643ab89e6ed30
[ "Apache-2.0" ]
null
null
null
server.js
dibend/blast_web_server
2f7d4e118ff38b00248c50ee8f2643ab89e6ed30
[ "Apache-2.0" ]
null
null
null
'use strict'; var fs = require('fs'); var express = require('express'); var cors = require('cors'); var http = require('http'); var https = require('https'); var compression = require('compression'); var path = require('path'); var crypto = require('crypto'); var emailValidator = require('email-validator'); var nodemailer = require('nodemailer'); var smtpTransport = require('nodemailer-smtp-transport'); var mysql = require('mysql'); var frameguard = require('frameguard'); var config = require('./config'); var mailer = nodemailer.createTransport(smtpTransport({ host: config.ses_host, secureConnection: true, port: 465, auth: { user: config.ses_user, pass: config.ses_pass } })); var db = mysql.createPool({ connectionLimit: 10, host: config.mysql_host, user: config.mysql_user, password: config.mysql_pass, database: config.mysql_db }); var sslKey = fs.readFileSync('letsencrypt/privkey.pem', 'utf8'); var sslCert = fs.readFileSync('letsencrypt/cert.pem', 'utf8'); var ca = [ fs.readFileSync('letsencrypt/chain.pem', 'utf8'), fs.readFileSync('letsencrypt/fullchain.pem', 'utf8') ]; var creds = { key: sslKey, cert: sslCert, ca: ca }; var app = express(); app.use(cors()); app.use(compression()); app.use(frameguard({action: 'deny'})); app.use(express.static('public', {extensions: ['html']})); function getIP(request) { return (request.headers['x-forwarded-for'] || request.connection.remoteAddress || request.socket.remoteAddress || request.connection.socket.remoteAddress).split(",")[0]; } app.get('/view', function(request, response) { var ip = getIP(request); console.log(ip + ' loaded view ' + request.query.url + ' from ' + request.query.src + ' at ' + (new Date().toUTCString())); fs.readFile('public/view1.html', 'utf8', function(err, data) { if (err) throw err; var titleSplit = data.split('{{ title }}'); if(request.query.title) { data = titleSplit[0] + request.query.title + titleSplit[1]; } else { data = titleSplit[0] + 'Blast Notifications' + titleSplit[1]; } var linkSplit = data.split('{{ link }}'); if(request.query.url) { data = linkSplit[0] + 'https://blastnotifications.com/view?url=' + request.query.url + '&title=' + request.query.title + linkSplit[1]; } else { data = linkSplit[0] + 'https://blastnotifications.com' + linkSplit[1]; } response.send(data); }); }); app.get('/track.png', function(request, response) { var ip = getIP(request); console.log(ip + ' ' + request.query.email + ' loaded ' + request.query.blast + ' blast at ' + (new Date().toUTCString())); response.send(); }); app.get('/redir', function(request, response) { if(/globesold\.com|robinhood\.com|renaissancecapital\.com|nasdaq\.com|currenciesdirect\.com|bittrex\.com|yahoo\.com|whitehouse\.gov|worldstarhiphop\.com|metacritic\.com|cnn\.com|cnet\.com|theverge\.com|zerohedge\.com|thezenofinvesting\.com/.test(request.query.url)) { var ip = getIP(request); console.log(ip + ' opened ' + request.query.url + ' at ' + (new Date().toUTCString())); response.redirect(request.query.url); } else { response.redirect('/'); } }); var ws_confirmEmailQuery = {}; app.get('/signup_ws', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); ws_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Worldstar Blast Notification', text: 'Visit https://blastnotifications.com/confirm_ws?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_ws', function(request, response) { var secret = request.query.secret; if(secret in ws_confirmEmailQuery) { var email = ws_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO worldstar SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete ws_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var daily_funder_confirmEmailQuery = {}; app.get('/signup_daily_funder', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); daily_funder_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Daily Funder Blast Notification', text: 'Visit https://blastnotifications.com/confirm_daily_funder?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_daily_funder', function(request, response) { var secret = request.query.secret; if(secret in daily_funder_confirmEmailQuery) { var email = daily_funder_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO daily_funder SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete daily_funder_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var fedbiz_confirmEmailQuery = {}; app.get('/signup_fedbiz', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); fedbiz_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm FedBizOpps Blast Notification', text: 'Visit https://blastnotifications.com/confirm_fedbiz?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_fedbiz', function(request, response) { var secret = request.query.secret; if(secret in fedbiz_confirmEmailQuery) { var email = fedbiz_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO fedbiz SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete fedbiz_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var coin_removals_confirmEmailQuery = {}; app.get('/signup_coin_removals', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); coin_removals_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Bittrex Coin Removal Blast Notification', text: 'Visit https://blastnotifications.com/confirm_coin_removals?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_coin_removals', function(request, response) { var secret = request.query.secret; if(secret in coin_removals_confirmEmailQuery) { var email = coin_removals_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO coin_removals SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete coin_removals_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var zerohedge_confirmEmailQuery = {}; app.get('/signup_zerohedge', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); zerohedge_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Zero Hedge News Blast Notification', text: 'Visit https://blastnotifications.com/confirm_zerohedge?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_zerohedge', function(request, response) { var secret = request.query.secret; if(secret in zerohedge_confirmEmailQuery) { var email = zerohedge_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO zerohedge SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete zerohedge_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var bloomberg_stock_confirmEmailQuery = {}; app.get('/signup_bloomberg_stock', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); bloomberg_stock_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Bloomberg Stocks Blast Notification', text: 'Visit https://blastnotifications.com/confirm_bloomberg_stock?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_bloomberg_stock', function(request, response) { var secret = request.query.secret; if(secret in bloomberg_stock_confirmEmailQuery) { var email = bloomberg_stock_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO bloomberg_stock SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete bloomberg_stock_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var bloomberg_currency_confirmEmailQuery = {}; app.get('/signup_bloomberg_currency', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); bloomberg_currency_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Bloomberg Currency Blast Notification', text: 'Visit https://blastnotifications.com/confirm_bloomberg_currency?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_bloomberg_currency', function(request, response) { var secret = request.query.secret; if(secret in bloomberg_currency_confirmEmailQuery) { var email = bloomberg_currency_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO bloomberg_currency SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete bloomberg_currency_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var bloomberg_startup_confirmEmailQuery = {}; app.get('/signup_bloomberg_startup', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); bloomberg_startup_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Bloomberg Startup Blast Notification', text: 'Visit https://blastnotifications.com/confirm_bloomberg_startup?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_bloomberg_startup', function(request, response) { var secret = request.query.secret; if(secret in bloomberg_startup_confirmEmailQuery) { var email = bloomberg_startup_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO bloomberg_startup SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete bloomberg_startup_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var reuters_business_confirmEmailQuery = {}; app.get('/signup_reuters_business', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); reuters_business_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Reuters Business Blast Notification', text: 'Visit https://blastnotifications.com/confirm_reuters_business?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_reuters_business', function(request, response) { var secret = request.query.secret; if(secret in reuters_business_confirmEmailQuery) { var email = reuters_business_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO reuters_business SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete reuters_business_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var therealreal_chanel_bags_confirmEmailQuery = {}; app.get('/signup_therealreal_chanel_bags', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); therealreal_chanel_bags_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm The RealReal Chanel Bags Blast Notification', text: 'Visit https://blastnotifications.com/confirm_therealreal_chanel_bags?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_therealreal_chanel_bags', function(request, response) { var secret = request.query.secret; if(secret in therealreal_chanel_bags_confirmEmailQuery) { var email = therealreal_chanel_bags_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO therealreal_chanel_bags SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete therealreal_chanel_bags_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var gomovies_confirmEmailQuery = {}; app.get('/signup_gomovies', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); gomovies_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Go Movies Blast Notification', text: 'Visit https://blastnotifications.com/confirm_gomovies?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_gomovies', function(request, response) { var secret = request.query.secret; if(secret in gomovies_confirmEmailQuery) { var email = gomovies_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO gomovies SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete gomovies_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var yahoo_nfl_confirmEmailQuery = {}; app.get('/signup_yahoo_nfl', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); yahoo_nfl_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Yahoo NFL Blast Notification', text: 'Visit https://blastnotifications.com/confirm_yahoo_nfl?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_yahoo_nfl', function(request, response) { var secret = request.query.secret; if(secret in yahoo_nfl_confirmEmailQuery) { var email = yahoo_nfl_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO yahoo_nfl SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete yahoo_nfl_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var yahoo_nba_confirmEmailQuery = {}; app.get('/signup_yahoo_nba', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); yahoo_nba_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Yahoo NBA Blast Notification', text: 'Visit https://blastnotifications.com/confirm_yahoo_nba?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_yahoo_nba', function(request, response) { var secret = request.query.secret; if(secret in yahoo_nba_confirmEmailQuery) { var email = yahoo_nba_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO yahoo_nba SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete yahoo_nba_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var monster_it_sales_confirmEmailQuery = {}; app.get('/signup_monster_it_sales', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); monster_it_sales_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Monster IT Sales Jobs Notifications', text: 'Visit https://blastnotifications.com/confirm_monster_it_sales?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_monster_it_sales', function(request, response) { var secret = request.query.secret; if(secret in monster_it_sales_confirmEmailQuery) { var email = monster_it_sales_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO monster_it_sales SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete monster_it_sales_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var datpiff_confirmEmailQuery = {}; app.get('/signup_datpiff', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); datpiff_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm DatPiff Mixtape Notifications', text: 'Visit https://blastnotifications.com/confirm_datpiff?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_datpiff', function(request, response) { var secret = request.query.secret; if(secret in datpiff_confirmEmailQuery) { var email = datpiff_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO datpiff SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete datpiff_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var nasdaq_headlines_confirmEmailQuery = {}; app.get('/signup_nasdaq_headlines', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); nasdaq_headlines_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Nasdaq Market Headlines Blast Notification', text: 'Visit https://blastnotifications.com/confirm_nasdaq_headlines?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_nasdaq_headlines', function(request, response) { var secret = request.query.secret; if(secret in nasdaq_headlines_confirmEmailQuery) { var email = nasdaq_headlines_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO nasdaq_headlines SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete nasdaq_headlines_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var nasdaq_earnings_surprise_confirmEmailQuery = {}; app.get('/signup_nasdaq_earnings_surprise', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); nasdaq_earnings_surprise_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Nasdaq Earnings Surprise Notifications', text: 'Visit https://blastnotifications.com/confirm_nasdaq_earnings_surprise?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_nasdaq_earnings_surprise', function(request, response) { var secret = request.query.secret; if(secret in nasdaq_earnings_surprise_confirmEmailQuery) { var email = nasdaq_earnings_surprise_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO nasdaq_earnings_surprise SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete nasdaq_earnings_surprise_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var nasdaq_upcoming_ipo_confirmEmailQuery = {}; app.get('/signup_nasdaq_upcoming_ipo', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); nasdaq_upcoming_ipo_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Nasdaq Upcoming IPOs Blast Notification', text: 'Visit https://blastnotifications.com/confirm_nasdaq_upcoming_ipo?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_nasdaq_upcoming_ipo', function(request, response) { var secret = request.query.secret; if(secret in nasdaq_upcoming_ipo_confirmEmailQuery) { var email = nasdaq_upcoming_ipo_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO nasdaq_upcoming_ipo SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete nasdaq_upcoming_ipo_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var eb_manhattan_parties_confirmEmailQuery = {}; app.get('/signup_eb_manhattan_parties', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); eb_manhattan_parties_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Eventbrite Manhattan Parties Blast Notification', text: 'Visit https://blastnotifications.com/confirm_eb_manhattan_parties?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_eb_manhattan_parties', function(request, response) { var secret = request.query.secret; if(secret in eb_manhattan_parties_confirmEmailQuery) { var email = eb_manhattan_parties_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO eb_manhattan_parties SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete eb_manhattan_parties_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var executive_orders_confirmEmailQuery = {}; app.get('/signup_executive_orders', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); executive_orders_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm White House Executive Orders Blast Notification', text: 'Visit https://blastnotifications.com/confirm_executive_orders?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_executive_orders', function(request, response) { var secret = request.query.secret; if(secret in executive_orders_confirmEmailQuery) { var email = executive_orders_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO executive_orders SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete executive_orders_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var forex_factory_confirmEmailQuery = {}; app.get('/signup_forex_factory', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); forex_factory_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Forex Factory Blast Notification', text: 'Visit https://blastnotifications.com/confirm_forex_factory?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_forex_factory', function(request, response) { var secret = request.query.secret; if(secret in forex_factory_confirmEmailQuery) { var email = forex_factory_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO forex_factory SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete forex_factory_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var eb_la_parties_confirmEmailQuery = {}; app.get('/signup_eb_la_parties', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); eb_la_parties_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Eventbrite LA Parties Blast Notification', text: 'Visit https://blastnotifications.com/confirm_eb_la_parties?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_eb_la_parties', function(request, response) { var secret = request.query.secret; if(secret in eb_la_parties_confirmEmailQuery) { var email = eb_la_parties_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO eb_la_parties SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete eb_la_parties_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var metacritic_xboxone_confirmEmailQuery = {}; app.get('/signup_metacritic_xboxone', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); metacritic_xboxone_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Metacritic Xbox One Games Blast Notification', text: 'Visit https://blastnotifications.com/confirm_metacritic_xboxone?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_metacritic_xboxone', function(request, response) { var secret = request.query.secret; if(secret in metacritic_xboxone_confirmEmailQuery) { var email = metacritic_xboxone_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO metacritic_xboxone SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete metacritic_xboxone_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var metacritic_ps4_confirmEmailQuery = {}; app.get('/signup_metacritic_ps4', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); metacritic_ps4_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Metacritic PS4 Games Blast Notification', text: 'Visit https://blastnotifications.com/confirm_metacritic_ps4?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_metacritic_ps4', function(request, response) { var secret = request.query.secret; if(secret in metacritic_ps4_confirmEmailQuery) { var email = metacritic_ps4_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO metacritic_ps4 SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete metacritic_ps4_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var fox_news_videos_confirmEmailQuery = {}; app.get('/signup_fox_news_videos', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); fox_news_videos_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Fox News Videos Blast Notification', text: 'Visit https://blastnotifications.com/confirm_fox_news_videos?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_fox_news_videos', function(request, response) { var secret = request.query.secret; if(secret in fox_news_videos_confirmEmailQuery) { var email = fox_news_videos_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO fox_news_videos SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete fox_news_videos_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var metacritic_movies_confirmEmailQuery = {}; app.get('/signup_metacritic_movies', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); metacritic_movies_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Metacritic Movie Releases Blast Notification', text: 'Visit https://blastnotifications.com/confirm_metacritic_movies?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_metacritic_movies', function(request, response) { var secret = request.query.secret; if(secret in metacritic_movies_confirmEmailQuery) { var email = metacritic_movies_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO metacritic_movies SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete metacritic_movies_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var cnn_news_videos_confirmEmailQuery = {}; app.get('/signup_cnn_news_videos', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); cnn_news_videos_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm CNN News Videos Blast Notification', text: 'Visit https://blastnotifications.com/confirm_cnn_news_videos?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_cnn_news_videos', function(request, response) { var secret = request.query.secret; if(secret in cnn_news_videos_confirmEmailQuery) { var email = cnn_news_videos_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO cnn_news_videos SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete cnn_news_videos_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var msnbc_news_videos_confirmEmailQuery = {}; app.get('/signup_msnbc_news_videos', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); msnbc_news_videos_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm MSNBC News Videos Blast Notification', text: 'Visit https://blastnotifications.com/confirm_msnbc_news_videos?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_msnbc_news_videos', function(request, response) { var secret = request.query.secret; if(secret in msnbc_news_videos_confirmEmailQuery) { var email = msnbc_news_videos_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO msnbc_news_videos SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete msnbc_news_videos_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var reuters_tech_confirmEmailQuery = {}; app.get('/signup_reuters_tech', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); reuters_tech_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Reuters Tech News Blast Notification', text: 'Visit https://blastnotifications.com/confirm_reuters_tech?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_reuters_tech', function(request, response) { var secret = request.query.secret; if(secret in reuters_tech_confirmEmailQuery) { var email = reuters_tech_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO reuters_tech SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete reuters_tech_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var cnet_confirmEmailQuery = {}; app.get('/signup_cnet', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); cnet_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm CNET News Blast Notification', text: 'Visit https://blastnotifications.com/confirm_cnet?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_cnet', function(request, response) { var secret = request.query.secret; if(secret in cnet_confirmEmailQuery) { var email = cnet_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO cnet SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete cnet_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var the_verge_confirmEmailQuery = {}; app.get('/signup_the_verge', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); the_verge_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm The Verge Articles Blast Notification', text: 'Visit https://blastnotifications.com/confirm_the_verge?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_the_verge', function(request, response) { var secret = request.query.secret; if(secret in the_verge_confirmEmailQuery) { var email = the_verge_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO the_verge SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete the_verge_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var currency_direct_confirmEmailQuery = {}; app.get('/signup_currency_direct', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); currency_direct_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Currencies Direct News Blast Notification', text: 'Visit https://blastnotifications.com/confirm_currency_direct?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_currency_direct', function(request, response) { var secret = request.query.secret; if(secret in currency_direct_confirmEmailQuery) { var email = currency_direct_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO currency_direct SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete currency_direct_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var itunes_songs_confirmEmailQuery = {}; app.get('/signup_itunes_songs', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); itunes_songs_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm iTunes Songs Blast Notification', text: 'Visit https://blastnotifications.com/confirm_itunes_songs?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_itunes_songs', function(request, response) { var secret = request.query.secret; if(secret in itunes_songs_confirmEmailQuery) { var email = itunes_songs_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO itunes_songs SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete itunes_songs_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var itunes_albums_confirmEmailQuery = {}; app.get('/signup_itunes_albums', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); itunes_albums_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm iTunes Albums Blast Notification', text: 'Visit https://blastnotifications.com/confirm_itunes_albums?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_itunes_albums', function(request, response) { var secret = request.query.secret; if(secret in itunes_albums_confirmEmailQuery) { var email = itunes_albums_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO itunes_albums SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete itunes_albums_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var itunes_free_apps_confirmEmailQuery = {}; app.get('/signup_itunes_free_apps', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); itunes_free_apps_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm iTunes Free Apps Blast Notification', text: 'Visit https://blastnotifications.com/confirm_itunes_free_apps?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_itunes_free_apps', function(request, response) { var secret = request.query.secret; if(secret in itunes_free_apps_confirmEmailQuery) { var email = itunes_free_apps_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO itunes_free_apps SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete itunes_free_apps_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var itunes_paid_apps_confirmEmailQuery = {}; app.get('/signup_itunes_paid_apps', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); itunes_paid_apps_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm iTunes Paid Apps Blast Notification', text: 'Visit https://blastnotifications.com/confirm_itunes_paid_apps?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_itunes_paid_apps', function(request, response) { var secret = request.query.secret; if(secret in itunes_paid_apps_confirmEmailQuery) { var email = itunes_paid_apps_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO itunes_paid_apps SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete itunes_paid_apps_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var spinoffs_confirmEmailQuery = {}; app.get('/signup_spinoffs', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); spinoffs_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm Upcoming Spinoffs Blast Notification', text: 'Visit https://blastnotifications.com/confirm_spinoffs?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_spinoffs', function(request, response) { var secret = request.query.secret; if(secret in spinoffs_confirmEmailQuery) { var email = spinoffs_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO spinoffs SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' ' + email + ' confirmed at ' + (new Date().toUTCString())); delete spinoffs_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); var pc_games_confirmEmailQuery = {}; app.get('/signup_pc_games', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var secret = crypto.randomBytes(64).toString('hex'); pc_games_confirmEmailQuery[secret] = email; var mailOptions = { from: config.from, to: email, subject: 'Confirm New PC Games Blast Notification', text: 'Visit https://blastnotifications.com/confirm_pc_games?secret=' + secret + ' to verify your subscription!' }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); console.log(getIP(request) + ' PC Games ' + email + ' confirmation sent at ' + (new Date().toUTCString())); response.redirect('/confirm.html'); } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/confirm_pc_games', function(request, response) { var secret = request.query.secret; if(secret in pc_games_confirmEmailQuery) { var email = pc_games_confirmEmailQuery[secret]; db.query('INSERT IGNORE INTO pc_games SET ?', {email: email}, function (error) { if (error) { console.log(error); } }); response.redirect('/confirmed.html'); console.log(getIP(request) + ' PC Games ' + email + ' confirmed at ' + (new Date().toUTCString())); delete pc_games_confirmEmailQuery[secret]; } else { response.status(404); response.sendFile(path.join(__dirname+'/public/404.html')); } }); app.get('/signup_np_real_estate', function(request, response) { var email = request.query.email; if (emailValidator.validate(email)) { var mailOptions = { from: config.from, to: 'david.d@bhhsnj.com', subject: 'New Providence Real Estate Lead', text: email }; mailer.sendMail(mailOptions, function(err, res) { if(err) { console.log(err); } mailer.close(); }); }; response.redirect('https://np.micheled.com/new-providence-real-estate-market-report.pdf'); }); app.get('*', function(request, response) { response.redirect('/'); }); http.createServer(function (req, res) { res.writeHead(301, { 'Location': 'https://' + req.headers['host'] + req.url }); res.end(); }).listen(8080); https.createServer(creds, app).listen(8443);
33.307062
269
0.660613
7df0793054e6f285563b612a684569cb4c6e75af
544
js
JavaScript
test/test_doxylua.js
dreamlover/DoxyLua
9969f10396fe0671755cff087e68557c6eec4a1e
[ "MIT" ]
2
2018-04-19T10:05:24.000Z
2020-09-22T03:51:35.000Z
test/test_doxylua.js
dreamlover/DoxyLua
9969f10396fe0671755cff087e68557c6eec4a1e
[ "MIT" ]
null
null
null
test/test_doxylua.js
dreamlover/DoxyLua
9969f10396fe0671755cff087e68557c6eec4a1e
[ "MIT" ]
null
null
null
process.chdir('./test'); var doxylua = require('../lib/doxylua.js'), fs = require('fs'); function _runTest(test, file) { test.equal( doxylua(file + '.lua'), fs.readFileSync(file + '.h').toString().replace(/(\r\n|\r|\n)/g, '\n'), file); } exports['runAllTests'] = function (test) { var files = fs.readdirSync('./'); for (var i = 0; i < files.length; ++i) { var fn = files[i].match(/(.+)\.lua$/); if (fn != null) _runTest(test, fn[1]); } test.done(); }
24.727273
80
0.494485
7df1302387574da3d39b51d51811a1347a4d2db7
221
js
JavaScript
src/test.js
CrystalAngelLee/vue-webpack-demo
0467095fd822ea9b50808f22a84272d225f0f372
[ "MIT" ]
null
null
null
src/test.js
CrystalAngelLee/vue-webpack-demo
0467095fd822ea9b50808f22a84272d225f0f372
[ "MIT" ]
null
null
null
src/test.js
CrystalAngelLee/vue-webpack-demo
0467095fd822ea9b50808f22a84272d225f0f372
[ "MIT" ]
null
null
null
export default () => { const element = document.createElement("h2"); element.textContent = "Hello world"; element.addEventListener("click", () => { alert("Hello webpack"); }); return element; };
20.090909
48
0.606335
7df172133421b60e6d55a213ac1db4e641f278af
159
js
JavaScript
app/components/FormItem/index.js
ricsam/firestore-search
ce441a0cf5d7e5f4c24675683d8e20d17e4418e9
[ "MIT" ]
null
null
null
app/components/FormItem/index.js
ricsam/firestore-search
ce441a0cf5d7e5f4c24675683d8e20d17e4418e9
[ "MIT" ]
null
null
null
app/components/FormItem/index.js
ricsam/firestore-search
ce441a0cf5d7e5f4c24675683d8e20d17e4418e9
[ "MIT" ]
null
null
null
/** * * FormItem * */ export default ` border: 1px solid black; padding: 0.5rem 0.25rem; background-color: white; margin: 0.15rem 0.15rem; `;
12.230769
28
0.603774
7df298de3459dbacf8c779a502356c50c744aa74
704
js
JavaScript
mobile/common-mobile/common/code-help/create-user/create-user-dotnet.js
Granjow/bullet-train-frontend
92552b359c93031f139b085fdaae87e965317909
[ "BSD-3-Clause" ]
null
null
null
mobile/common-mobile/common/code-help/create-user/create-user-dotnet.js
Granjow/bullet-train-frontend
92552b359c93031f139b085fdaae87e965317909
[ "BSD-3-Clause" ]
null
null
null
mobile/common-mobile/common/code-help/create-user/create-user-dotnet.js
Granjow/bullet-train-frontend
92552b359c93031f139b085fdaae87e965317909
[ "BSD-3-Clause" ]
1
2020-07-31T15:01:56.000Z
2020-07-31T15:01:56.000Z
module.exports = (envId, {LIB_NAME, USER_ID, LIB_NAME_JAVA, FEATURE_NAME, FEATURE_FUNCTION, FEATURE_NAME_ALT, FEATURE_NAME_ALT_VALUE, NPM_CLIENT}, userId) => { return `${LIB_NAME_JAVA} ${LIB_NAME} = new ${LIB_NAME_JAVA}() { environmentKey = "${envId}" }; bool featureEnabled = await ${LIB_NAME}.HasFeatureFlag("${FEATURE_NAME}", ${USER_ID}); if (featureEnabled) { // Run the code to execute enabled feature } else { // Run the code if feature switched off } string myRemoteConfig = await ${LIB_NAME}.getFeatureValue("${FEATURE_NAME_ALT}", ${USER_ID}); if (myRemoteConfig != null) { // Run the code to use remote config value } else { // Run the code without remote config } ` }
33.52381
159
0.700284
7df2e4429c557c9ffe37e45bffb7d76dacdbde0c
1,927
js
JavaScript
User/UserController.js
wangming-0215/learn-jwt
6c2643f35a8f7fbca47dff26f204e3f5b1734f38
[ "MIT" ]
null
null
null
User/UserController.js
wangming-0215/learn-jwt
6c2643f35a8f7fbca47dff26f204e3f5b1734f38
[ "MIT" ]
null
null
null
User/UserController.js
wangming-0215/learn-jwt
6c2643f35a8f7fbca47dff26f204e3f5b1734f38
[ "MIT" ]
null
null
null
const router = require('express').Router(); const bcrypt = require('bcryptjs'); const User = require('./User'); // 创建一个用户 router.post('/create', (req, res) => { const { username, password = '123456' } = req.body; const hashedPwd = bcrypt.hashSync(password, 8); User.create({ name: username, password: hashedPwd }, (err, user) => { if (err) return res.status(500).json({ success: false, message: err.message }); res.status(200).json({ success: true, data: user }); }); }); // 获取所有用户 router.get('/', (req, res) => { User.find({}, { password: 0 }, (err, users) => { if (err) return res.status(500).json({ success: false, message: err.message }); res.status(200).json({ success: true, data: users }); }); }); // 获取某个用户(id) router.get('/:id', (req, res) => { const { id } = req.params; User.findById(id, { password: 0 }, (err, user) => { if (err) return res.status(500).json({ success: false, message: err.message }); if (!user) return res .status(404) .json({ success: false, message: 'No user found.' }); res.status(200).json({ success: true, data: user }); }); }); // 删除用户 router.delete('/:id', (req, res) => { const { id } = req.params; User.findByIdAndRemove(id, (err, user) => { if (err) return res.status(500).json({ success: false, message: err.message }); res .status(200) .json({ success: true, message: `User: ${user.name} has been deleted.` }); }); }); // 更新用户 router.put('/:id', (req, res) => { const { id } = req.params; // { new: true } // true to return the modified document rather than the original. // defaults to false User.findByIdAndUpdate(id, req.body, { new: true }, (err, user) => { if (err) return res.status(500).json({ success: false, message: err.message }); res.status(200).json({ success: true, data: user }); }); }); module.exports = router;
26.763889
80
0.582252
7df2f86d448f2f9a4da31d92e89b06a391147acf
988
js
JavaScript
src/modules/knowledgeBase/components/category/CategoryList.js
wsmd/erxes
f206adeb1b7342b8b38d975d5c0f6b7892b083be
[ "MIT" ]
1
2018-08-14T03:06:07.000Z
2018-08-14T03:06:07.000Z
src/modules/knowledgeBase/components/category/CategoryList.js
Togtuunbayar/erxes
4f30588238eb72e604b4fe782efa0b06996dc24a
[ "MIT" ]
null
null
null
src/modules/knowledgeBase/components/category/CategoryList.js
Togtuunbayar/erxes
4f30588238eb72e604b4fe782efa0b06996dc24a
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { CategoryRow } from './'; import { Categories } from './styles'; const propTypes = { currentCategoryId: PropTypes.string, topicIds: PropTypes.string, categories: PropTypes.array.isRequired, articlesCount: PropTypes.number.isRequired, remove: PropTypes.func.isRequired }; class CategoryList extends Component { render() { const { categories, remove, currentCategoryId, topicIds, articlesCount } = this.props; return ( <Categories> {categories.map(category => ( <CategoryRow key={category._id} isActive={currentCategoryId === category._id} articlesCount={articlesCount} topicIds={topicIds} category={category} remove={remove} /> ))} </Categories> ); } } CategoryList.propTypes = propTypes; export default CategoryList;
22.454545
57
0.621457
7df2f98b34cb53285feed984ea77505df45fd823
7,989
js
JavaScript
specialpurpose/ofbiztools/deploysystem/config1/themes/ofcbusiness/webapp/ofcbusiness/js/application.js
wolfer0515/quzou
67a383bd0fb1fff714000394f7b7e6734a9adffa
[ "Apache-2.0" ]
1
2019-01-02T10:00:36.000Z
2019-01-02T10:00:36.000Z
specialpurpose/ofbiztools/deploysystem/config1/themes/ofcbusiness/webapp/ofcbusiness/js/application.js
wolfer0515/quzou
67a383bd0fb1fff714000394f7b7e6734a9adffa
[ "Apache-2.0" ]
1
2020-11-16T09:17:39.000Z
2020-11-16T09:17:39.000Z
specialpurpose/ofbiztools/deploysystem/config1/themes/ofcbusiness/webapp/ofcbusiness/js/application.js
wolfer0515/quzou
67a383bd0fb1fff714000394f7b7e6734a9adffa
[ "Apache-2.0" ]
3
2017-03-25T12:51:21.000Z
2020-11-16T09:14:03.000Z
/*********************************************** APACHE OPEN FOR BUSINESS Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ***********************************************/ //GLOBAL NAMESPACE var OFBIZ = window.OFBIZ || {}; /************************************************** LAYOUT AND NAVIGATION builds main-nav/preferences dropdowns and adds functionality to style layout elements **************************************************/ //ADD CLEARFIX STYLING TO MAIN CONTENT AREA OFBIZ.clearFix = function(){ if(jQuery('.contentarea')){ jQuery('.contentarea').each(function(elm) { jQuery(this).addClass('clearfix'); }); } } //GLOBAL FUNCTION FOR APP DROP-DROWN SECTIONS OFBIZ.initExpansion = function() { if(jQuery('.contracted')){ jQuery('.contracted').each(function(elm) { jQuery(this).next().css({'display': 'none'}); }); } if(jQuery('.expanded, .contracted')) { jQuery('.expanded, .contracted').each(function(elm) { var menu = jQuery(this); menu.click( function() { menu.next().toggle( function () { if(menu.next().is(':visible')) { menu.removeClass('contracted'); menu.addClass('expanded'); } else { menu.removeClass('expanded'); menu.addClass('contracted'); } }); }); }); }; } OFBIZ.hideExpanded = function() { if(jQuery('.expanded').length) { jQuery('.expanded').each(function(elm) { var menu = jQuery(this); if(menu.next().is(':visible')) { menu.removeClass('expanded'); menu.addClass('contracted'); menu.next().fadeOut('fast'); } }); }; } /***************************************************** FORM FOCUS AND BLUR javascript solution to make form focus style consistent cross browser form platforms that don't support input:focus (cough, cough, IE, cough) *****************************************************/ jQuery('document').ready(function () { var fields = jQuery("input, textarea"); for (var i = 0; i < fields.length; i++) { if (!fields[i].style.visibility == 'hidden') { fields[i].focus (function() {this.className += ' focused';}); fields[i].blur (function() {this.className = this.className.replace('focused', '');}); } } }); /******************************************************** HUMANIZED MESSAGES displays success and error messages in modal window. message automatically fades on keypress, click mousemove (ala growl/system tray notices) ********************************************************/ //SUCCESS AND ERROR MESSAGE NOTIFICATIONS var humanMsg = { setup: function(appendTo, msgOpacity) { humanMsg.msgID = 'humanMsg'; appendTo = appendTo || jQuery('body')[0]; humanMsg.msgOpacity = 0.5; if (msgOpacity !== undefined) { humanMsg.msgOpacity = parseFloat(msgOpacity); } /*var myTemplate = new Template( '<div id="#{msgID}" class="humanMsg" style="display:none;">'+ '<div></div>'+ '</div> '); var show = {msgID: humanMsg.msgID};*/ jQuery('<div id="' + humanMsg.msgID + '" class="humanMsg" style="display:none;"><div></div></div>').appendTo(appendTo); }, displayMsg: function(msg) { if (msg === '') { return; } clearTimeout(humanMsg.t2); // Inject message var msgElement = jQuery("#" + humanMsg.msgID);; msgElement.find('div:first').html(msg); msgElement.fadeIn('slow'); msgElement.click(humanMsg.removeMsg); }, // Remove message if mouse is moved or key is pressed bindEvents: function() { jQuery(document).mousemove(humanMsg.removeMsg) .click(humanMsg.removeMsg) .keypress(humanMsg.removeMsg); }, // Unbind mouse & keyboard removeMsg: function() { jQuery(document).unbind('mousemove', humanMsg.removeMsg) .unbind('click', humanMsg.removeMsg) .unbind('keypress', humanMsg.removeMsg); jQuery("#" + humanMsg.msgID).fadeOut('slow'); } }; /************************************************** MODAL WINDOWS displays preferences (language, theme, timezone) in modal window instead of popup/new window **************************************************/ ModalWindow = function(){}; ModalWindow.openModalWindow = function(url, dialogId, width, height) { // if element doesn't exists create otherwise just open if (!document.getElementById('dialog-container_' + dialogId)) { var modalContainer = jQuery("<div id='dialog-container_" + dialogId + "' style='display:none'></div>"); jQuery('body').append(modalContainer); modalContainer = jQuery('#dialog-container_' + dialogId) modalContainer.dialog({ modal: true, zIndex: 10000, height: height, width: width, open: function() { modalContainer.append(jQuery("<img id='dialog-ajax-spinner' src='/ofcbusiness/images/ajax-loader.gif'/>")); modalContainer.load(url, function () {jQuery("#dialog-ajax-spinner").remove();}); // make sure the other possible opened dialogs will be closed ModalWindow.closeOtherModalWindows(dialogId); // close the open menu OFBIZ.hideExpanded(); } }); } else { jQuery('#dialog-container_' + dialogId).dialog('open'); } } ModalWindow.closeOtherModalWindows = function(currentOpen) { if (currentOpen == 'listLanguage') { jQuery('#dialog-container_listTheme').dialog('close'); jQuery('#dialog-container_listTimezone').dialog('close'); } else if (currentOpen == 'listTheme') { jQuery('#dialog-container_listTimezone').dialog('close'); jQuery('#dialog-container_listLanguage').dialog('close'); } else if (currentOpen == 'listTimezone') { jQuery('#dialog-container_listTheme').dialog('close'); jQuery('#dialog-container_listLanguage').dialog('close'); } } //LOAD MODAL PREFERENCE WINDOWS jQuery('document').ready (function () { jQuery("#language").click (function(e) { var url = this.href; this.href = "javascript:void(0);" ModalWindow.openModalWindow(url, 'listLanguage', 340, 400); }); jQuery("#theme").click (function(e) { var url = this.href; this.href = "javascript:void(0);" ModalWindow.openModalWindow(url, 'listTheme', 600, 400); }); jQuery("#timezone").click (function(e) { var url = this.href; this.href = "javascript:void(0);" ModalWindow.openModalWindow(url, 'listTimezone', 430, 400); }); }); /************************************************** LOAD 'EM UP **************************************************/ //LOAD GLOBAL APP FUNCTIONS jQuery('document').ready(function () { OFBIZ.clearFix(); OFBIZ.initExpansion(); humanMsg.setup(); });
36.646789
127
0.556515
7df320349ec275bef0c5c565280bb9dfa39b0780
5,874
js
JavaScript
dist/node/index.js
alexboisselle-rd/json-url
73461dcd22227f64fd5565e68ad103c53af35bd2
[ "MIT" ]
null
null
null
dist/node/index.js
alexboisselle-rd/json-url
73461dcd22227f64fd5565e68ad103c53af35bd2
[ "MIT" ]
null
null
null
dist/node/index.js
alexboisselle-rd/json-url
73461dcd22227f64fd5565e68ad103c53af35bd2
[ "MIT" ]
null
null
null
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = createClient; var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); var _codecs = _interopRequireDefault(require("./codecs")); var _loaders = _interopRequireDefault(require("./loaders")); var twoDigitPercentage = function twoDigitPercentage(val) { return Math.floor(val * 10000) / 10000; }; function createClient(algorithm) { if (!Object.prototype.hasOwnProperty.call(_codecs["default"], algorithm)) throw new Error("No such algorithm ".concat(algorithm)); var _ALGORITHMS$algorithm = _codecs["default"][algorithm], pack = _ALGORITHMS$algorithm.pack, encode = _ALGORITHMS$algorithm.encode; function compress(_x) { return _compress.apply(this, arguments); } function _compress() { _compress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/ _regenerator["default"].mark(function _callee(json) { var packed, compressed, encoded; return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (!pack) { _context.next = 7; break; } _context.next = 3; return _loaders["default"].msgpack(); case 3: _context.t1 = json; _context.t0 = _context.sent.encode(_context.t1); _context.next = 8; break; case 7: _context.t0 = JSON.stringify(json); case 8: packed = _context.t0; _context.next = 11; return _codecs["default"][algorithm].compress(packed); case 11: compressed = _context.sent; if (!encode) { _context.next = 19; break; } _context.next = 15; return _loaders["default"].safe64(); case 15: _context.t3 = compressed; _context.t2 = _context.sent.encode(_context.t3); _context.next = 20; break; case 19: _context.t2 = compressed; case 20: encoded = _context.t2; return _context.abrupt("return", encoded); case 22: case "end": return _context.stop(); } } }, _callee); })); return _compress.apply(this, arguments); } function decompress(_x2) { return _decompress.apply(this, arguments); } function _decompress() { _decompress = (0, _asyncToGenerator2["default"])( /*#__PURE__*/ _regenerator["default"].mark(function _callee2(string) { var decoded, decompressed, unpacked; return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: if (!encode) { _context2.next = 7; break; } _context2.next = 3; return _loaders["default"].safe64(); case 3: _context2.t1 = string; _context2.t0 = _context2.sent.decode(_context2.t1); _context2.next = 8; break; case 7: _context2.t0 = string; case 8: decoded = _context2.t0; _context2.next = 11; return _codecs["default"][algorithm].decompress(decoded); case 11: decompressed = _context2.sent; if (!pack) { _context2.next = 19; break; } _context2.next = 15; return _loaders["default"].msgpack(); case 15: _context2.t3 = decompressed; _context2.t2 = _context2.sent.decode(_context2.t3); _context2.next = 20; break; case 19: _context2.t2 = JSON.parse(decompressed); case 20: unpacked = _context2.t2; return _context2.abrupt("return", unpacked); case 22: case "end": return _context2.stop(); } } }, _callee2); })); return _decompress.apply(this, arguments); } function stats(_x3) { return _stats.apply(this, arguments); } function _stats() { _stats = (0, _asyncToGenerator2["default"])( /*#__PURE__*/ _regenerator["default"].mark(function _callee3(json) { var raw, rawencoded, compressed; return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: raw = JSON.stringify(json); rawencoded = encodeURIComponent(raw); _context3.next = 4; return compress(json); case 4: compressed = _context3.sent; return _context3.abrupt("return", { raw: raw.length, rawencoded: rawencoded.length, compressedencoded: compressed.length, compression: twoDigitPercentage(rawencoded.length / compressed.length) }); case 6: case "end": return _context3.stop(); } } }, _callee3); })); return _stats.apply(this, arguments); } return { compress: compress, decompress: decompress, stats: stats }; } module.exports = exports["default"];
27.971429
132
0.537964
7df3967d22d4c8fca144b224f71d42c6a6f57f11
1,653
js
JavaScript
lib/cinema.js
imperodesign/impero-movie-uk
6b24cc737d526b4d65414739c1a9c92b45b1167e
[ "MIT" ]
null
null
null
lib/cinema.js
imperodesign/impero-movie-uk
6b24cc737d526b4d65414739c1a9c92b45b1167e
[ "MIT" ]
null
null
null
lib/cinema.js
imperodesign/impero-movie-uk
6b24cc737d526b4d65414739c1a9c92b45b1167e
[ "MIT" ]
null
null
null
'use strict' const request = require('request') function createHttpError (msg, body) { const httpErr = new Error(msg) httpErr.code = 'HTTP_ERROR' httpErr.body = body return httpErr } module.exports = { findByPostcode (postcode) { return new Promise((resolve, reject) => { const apiBaseUrl = process.env.FINDANYFILM_API_BASE_URL request(`${apiBaseUrl}/cinemas/find-by-postcode/${postcode}`, (err, res, body) => { if (err) return reject(err) if (res.statusCode > 399) { const httpErr = new Error(`Server returned ${res.statusCode}`) httpErr.code = 'HTTP_ERROR' httpErr.body = body return reject(httpErr) } resolve(JSON.parse(body)) }) }) }, findByMovieDatePostcode (movie, date, postcode) { return new Promise((resolve, reject) => { const apiBaseUrl = process.env.FINDANYFILM_API_BASE_URL const apiUrl = `${apiBaseUrl}/cinemas/find-by-movie-date-postcode/${movie}/${date}/${postcode}` request(apiUrl, (err, res, body) => { if (err) return reject(err) if (res.statusCode === 404) { return reject(createHttpError('Sorry but I couldn\'t find any results for your query', body)) } else if (res.statusCode >= 500) { return reject(createHttpError(`Sorry but something went wrong (${res.statusCode})`, body)) } resolve(JSON.parse(body)) }) }) .then((cinemas) => { if (cinemas && cinemas.result === 'alternatives') { throw new Error('Sorry but this movie is not avaiable at the time request') } return cinemas[0] }) } }
33.06
103
0.61464
7df3c9d659c76e74629f2b571f8f8139bb3d4341
205
js
JavaScript
04/js/app.js
liuxuanhai/react-book-examples
6b44ffc3d71aad8fbf014800a7961b8014b0c7f7
[ "MIT" ]
811
2016-10-08T02:39:28.000Z
2022-03-31T11:32:55.000Z
04/js/app.js
470043830/react-book-examples
7e98506b07b839a1f131eae97ec4ad7848c71b3d
[ "MIT" ]
49
2016-11-21T13:24:32.000Z
2021-04-20T03:40:56.000Z
04/js/app.js
470043830/react-book-examples
7e98506b07b839a1f131eae97ec4ad7848c71b3d
[ "MIT" ]
347
2016-11-20T12:43:54.000Z
2021-12-27T14:13:38.000Z
import ReactDOM from 'react-dom'; import React from 'react'; import CommentBox from './components/CommentBox'; import '../css/style.css'; ReactDOM.render(<CommentBox />, document.getElementById('root'));
29.285714
65
0.746341
7df3f1dfabbeed83ec99bc756fb3b5134cba6de1
2,634
js
JavaScript
src-cordova/www/js/3.cf18f3021ea4b2e2b82a.js
maxprog/ckpe-songbook
dd7b0c895b880af1d1d44b7a58c2310c9bcd8790
[ "MIT" ]
null
null
null
src-cordova/www/js/3.cf18f3021ea4b2e2b82a.js
maxprog/ckpe-songbook
dd7b0c895b880af1d1d44b7a58c2310c9bcd8790
[ "MIT" ]
null
null
null
src-cordova/www/js/3.cf18f3021ea4b2e2b82a.js
maxprog/ckpe-songbook
dd7b0c895b880af1d1d44b7a58c2310c9bcd8790
[ "MIT" ]
null
null
null
webpackJsonp([3],{EIwa:function(t,a,n){(t.exports=n("lcwS")(!1)).push([t.i,"\n.page-showcase img {\n width: 100px;\n height: 100px;\n margin-bottom: 15px;\n}\n.page-showcase .showcase-top {\n margin-bottom: 35px;\n}\n.page-showcase .showcase-top .q-alert {\n max-width: 500px;\n}\n.page-showcase .card {\n cursor: pointer;\n position: relative;\n padding: 16px;\n}\n.page-showcase .card .q-icon {\n font-size: 56px;\n}\n.page-showcase .card p {\n color: rgba(0,0,0,0.87);\n margin: 15px 0 0 0 !important;\n}\n.page-showcase .card:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: 2px;\n opacity: 0;\n transition: opacity 0.2s;\n background: currentColor;\n}\n.page-showcase .card:hover:before {\n opacity: 0.4;\n}\n",""])},cvka:function(t,a,n){var s=n("EIwa");"string"==typeof s&&(s=[[t.i,s,""]]),s.locals&&(t.exports=s.locals);(0,n("X/Wc").default)("4baa040e",s,!1,{})},lNuB:function(t,a,n){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var s=n("T4f3"),e=n.n(s),o=n("bR6b"),i=n("aKwh"),c={data:function(){return{category:!1,hash:""}},computed:e()({list:function(){return this.category||[].concat(o.a[0].features,o.a[1])}},Object(i.b)("showcase",["pageMeta"])),methods:{show:function(t){if(this.link=t,t.features)return this.category=t.features,void(this.hash=t.hash);this.$router.push((t.tabs?t.parent_hash:this.hash)+"/"+t.hash)}}},r=function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("q-page",{staticClass:"page-showcase",attrs:{padding:""}},[n("div",{staticClass:"showcase-top text-center"},[n("p",{staticClass:"caption"},[t._v("\n Witamy w aplikacji Śpiewniki\n "),n("br")])]),t._v(" "),n("div",{staticClass:"row justify-center"},[n("div",{staticClass:"row",staticStyle:{width:"850px","max-width":"90vw"}},t._l(t.list,function(a){return n("div",{key:a.hash,staticClass:"col-xs-6 col-sm-4 col-lg-3"},[n("div",{staticClass:"card text-center category-link text-primary",on:{click:function(n){t.show(a)}}},[n("q-icon",{attrs:{name:a.icon}}),t._v(" "),n("p",{staticClass:"caption"},[t._v(t._s(a.title))])],1)])}))]),t._v(" "),n("q-page-sticky",{directives:[{name:"show",rawName:"v-show",value:t.category,expression:"category"}],attrs:{position:"bottom-right",offset:[18,18]}},[n("q-btn",{staticClass:"animate-pop",attrs:{round:"",color:"secondary"},on:{click:function(a){t.category=!1}}},[n("q-icon",{attrs:{name:"ion-reply"}})],1)],1)],1)},p=[];r._withStripped=!0;var h=n("xRi5"),l=!1;var u=function(t){l||n("cvka")},d=Object(h.a)(c,r,p,!1,u,null,null);d.options.__file="src/pages/index.vue";a.default=d.exports}});
2,634
2,634
0.656416
7df3f2937bbe0e458c9d7ed0c27bbef57be4a9b4
884
js
JavaScript
test/ImprovedProcessor.js
ShipyardDAO/exam_processor
995d8650640b3cf6df0620b8a4dbadf26c4eab94
[ "MIT" ]
null
null
null
test/ImprovedProcessor.js
ShipyardDAO/exam_processor
995d8650640b3cf6df0620b8a4dbadf26c4eab94
[ "MIT" ]
null
null
null
test/ImprovedProcessor.js
ShipyardDAO/exam_processor
995d8650640b3cf6df0620b8a4dbadf26c4eab94
[ "MIT" ]
null
null
null
const { expect } = require("chai") const examResults = require("../test/examResults.json") describe("ImprovedProcessor contract", function () { const numTestRepetitions = 10; beforeEach(async function () { improvedProcessorFactory = await ethers.getContractFactory("ImprovedProcessor") improvedProcessor = await improvedProcessorFactory.deploy() await improvedProcessor.deployed() }) it("should process exam data", async function () { for (let i = 0; i < numTestRepetitions; i++) { await improvedProcessor.process(examResults) } expect(await examResultProcessor.totalScore(1)).to.equal(2540); expect(await examResultProcessor.totalScore(17)).to.equal(1560); expect(await examResultProcessor.subjectsPassed(1, "Physics")).to.equal(true); expect(await examResultProcessor.subjectsPassed(30, "Chemistry")).to.equal(false); }) })
36.833333
86
0.728507
7df412f2828a091baeca45cea84b0be42e2af1d8
829
js
JavaScript
sitemap-builder.js
rahmankhalid/khal.dev-Website
dcd8086f83e85e8fb05e110856de219c9c7e2458
[ "MIT" ]
null
null
null
sitemap-builder.js
rahmankhalid/khal.dev-Website
dcd8086f83e85e8fb05e110856de219c9c7e2458
[ "MIT" ]
null
null
null
sitemap-builder.js
rahmankhalid/khal.dev-Website
dcd8086f83e85e8fb05e110856de219c9c7e2458
[ "MIT" ]
null
null
null
require("@babel/register")({ presets: ["@babel/preset-env", "@babel/preset-react"], plugins: [ [ require.resolve('babel-plugin-module-resolver'), { root: ["./src/"], } ] ] }); const router = require('./src/App').default; const Sitemap = require('react-router-sitemap').default; class UniqueSitemap extends Sitemap { constructor(router) { super(router); this.paths = this.paths.reduce( (acc, curr) => { if (!acc.includes(curr)) { acc.push(curr); } return acc; }, [] ); } } ( new UniqueSitemap(router()) .build('https://khaldev.netlify.app') .save('./public/sitemap-index.xml') );
21.815789
60
0.466828
7df4b4e2537dbec3f43330e63ca9ad548c7718ea
16,345
js
JavaScript
packages/atom-ide-ui/modules/atom-ide-ui/pkg/atom-ide-diagnostics-ui/lib/ui/DiagnosticsTable.js
reactjsguru/atom-settings
da494561aa20ef1ddfaa557b6eba8af6e57deb8c
[ "MIT" ]
null
null
null
packages/atom-ide-ui/modules/atom-ide-ui/pkg/atom-ide-diagnostics-ui/lib/ui/DiagnosticsTable.js
reactjsguru/atom-settings
da494561aa20ef1ddfaa557b6eba8af6e57deb8c
[ "MIT" ]
null
null
null
packages/atom-ide-ui/modules/atom-ide-ui/pkg/atom-ide-diagnostics-ui/lib/ui/DiagnosticsTable.js
reactjsguru/atom-settings
da494561aa20ef1ddfaa557b6eba8af6e57deb8c
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _classnames; function _load_classnames() { return _classnames = _interopRequireDefault(require('classnames')); } var _idx; function _load_idx() { return _idx = _interopRequireDefault(require('idx')); } var _memoizeUntilChanged; function _load_memoizeUntilChanged() { return _memoizeUntilChanged = _interopRequireDefault(require('nuclide-commons/memoizeUntilChanged')); } var _humanizePath; function _load_humanizePath() { return _humanizePath = _interopRequireDefault(require('nuclide-commons-atom/humanizePath')); } var _collection; function _load_collection() { return _collection = require('nuclide-commons/collection'); } var _react = _interopRequireWildcard(require('react')); var _nuclideUri; function _load_nuclideUri() { return _nuclideUri = _interopRequireDefault(require('nuclide-commons/nuclideUri')); } var _goToLocation; function _load_goToLocation() { return _goToLocation = require('nuclide-commons-atom/go-to-location'); } var _Table; function _load_Table() { return _Table = require('nuclide-commons-ui/Table'); } var _sortDiagnostics; function _load_sortDiagnostics() { return _sortDiagnostics = _interopRequireDefault(require('../sortDiagnostics')); } var _DiagnosticsMessage; function _load_DiagnosticsMessage() { return _DiagnosticsMessage = require('./DiagnosticsMessage'); } var _DiagnosticsMessageText; function _load_DiagnosticsMessageText() { return _DiagnosticsMessageText = require('./DiagnosticsMessageText'); } var _Icon; function _load_Icon() { return _Icon = require('nuclide-commons-ui/Icon'); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const DIAGNOSTICS_TO_ROWS_TRACES_MAP = new WeakMap(); /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * * @format */ const DIAGNOSTICS_TO_ROWS_NO_TRACES_MAP = new WeakMap(); // text is always used for sorting, while we render the element. // Maximum number of results to render in the table before truncating and displaying a "Max results // reached" message. const MAX_RESULTS_COUNT = 1000; class DiagnosticsTable extends _react.PureComponent { constructor(props) { super(props); // Memoize `_getRows()` _initialiseProps.call(this); this._getRows = (0, (_memoizeUntilChanged || _load_memoizeUntilChanged()).default)(this._getRows, (diagnostics, showTraces) => ({ diagnostics, showTraces }), (a, b) => a.showTraces === b.showTraces && (0, (_collection || _load_collection()).arrayEqual)(a.diagnostics, b.diagnostics)); this.state = { sortDescending: true, sortedColumn: 'classification' }; } _getColumns() { const { showFileName, showDirectoryColumn } = this.props; // These need to add up to 1. // TODO: Update the Table component so that we can have more control over this (and provide // explicit pixel widths) const TYPE_WIDTH = 0; const SOURCE_WIDTH = 0; const FILENAME_WIDTH = 0.3; const DIR_WIDTH = 0.15; const LINE_NUMBER_WIDTH = 0; const filePathColumns = []; let descriptionWidth = 1 - (TYPE_WIDTH + SOURCE_WIDTH); if (showFileName) { if (showDirectoryColumn) { filePathColumns.push({ component: DirComponent, key: 'dir', title: 'Path', width: DIR_WIDTH, shouldRightAlign: true, cellClassName: 'nuclide-diagnostics-ui-cell-dir' }); descriptionWidth -= DIR_WIDTH; } filePathColumns.push({ component: FilenameComponent, key: 'location', title: 'File Name', width: FILENAME_WIDTH, cellClassName: 'nuclide-diagnostics-ui-cell-filename' }); descriptionWidth -= FILENAME_WIDTH; } else { // Not showing the filename? Then we need a separate column for the line number. filePathColumns.push({ component: LineNumberComponent, key: 'line', title: 'Line', shouldRightAlign: true, width: LINE_NUMBER_WIDTH, minWidth: 60 }); descriptionWidth -= LINE_NUMBER_WIDTH; } return [{ component: TypeComponent, key: 'classification', title: 'Type', width: TYPE_WIDTH, minWidth: 55, cellClassName: 'nuclide-diagnostics-ui-cell-classification' }, { key: 'providerName', title: 'Source', width: SOURCE_WIDTH, minWidth: 100 }, { component: this._renderDescription, key: 'description', title: 'Description', width: descriptionWidth, cellClassName: 'nuclide-diagnostics-ui-cell-description' }, ...filePathColumns]; } // False positive for this lint rule? // eslint-disable-next-line react/no-unused-prop-types _getSortOptions(columns) { // If the column the user sorted by has been removed, return the default sorting. We do this // (instead of updating the state) so that if the column gets added back we can return to // sorting by that. const columnKeys = columns.map(column => column.key); if (!columnKeys.includes(this.state.sortedColumn)) { return { sortedColumn: 'classification', sortDescending: true }; } // Otherwise, return the sorting they've chosen. return { sortedColumn: this.state.sortedColumn, sortDescending: this.state.sortDescending }; } render() { const { diagnostics, selectedMessage, showTraces } = this.props; const columns = this._getColumns(); const { sortedColumn, sortDescending } = this._getSortOptions(columns); const diagnosticRows = this._getRows(diagnostics, showTraces); let sortedRows = this._sortRows(diagnosticRows, sortedColumn, sortDescending); let maxResultsMessage; if (sortedRows.length > MAX_RESULTS_COUNT) { sortedRows = sortedRows.slice(0, MAX_RESULTS_COUNT); maxResultsMessage = _react.createElement( 'div', { className: 'highlight-warning diagnostics-ui-table-message' }, 'Max results (', MAX_RESULTS_COUNT, ') reached. Fix diagnostics or show only diagnostics for the current file to view more.' ); } const selectedIndex = this._findSelectedIndex(selectedMessage, sortedRows); return _react.createElement( 'div', { className: (0, (_classnames || _load_classnames()).default)({ 'diagnostics-ui-table-container': true, 'diagnostics-ui-table-container-empty': sortedRows.length === 0 }) }, _react.createElement((_Table || _load_Table()).Table, { ref: table => { this._table = table; }, collapsable: true, columns: columns, emptyComponent: EmptyComponent, fixedHeader: true, maxBodyHeight: '99999px', rows: sortedRows, sortable: true, onSort: this._handleSort, sortedColumn: sortedColumn, sortDescending: sortDescending, selectable: true, selectedIndex: selectedIndex, onSelect: this._handleSelectTableRow, onConfirm: this._handleConfirmTableRow, enableKeyboardNavigation: true }), maxResultsMessage ); } focus() { if (this._table != null) { this._table.focus(); } } _findSelectedIndex(selectedMessage, rows) { if (selectedMessage == null) { return -1; } let bestRank = -1; let bestRankedIndex = -1; // Look for the closest match, starting with the previously selected index. for (const [row, i] of (0, (_collection || _load_collection()).insideOut)(rows, this._previousSelectedIndex)) { const { diagnostic } = row.data.description; if (diagnostic === selectedMessage) { bestRankedIndex = i; break; } const rank = compareMessages(diagnostic, selectedMessage); if (rank != null && rank > bestRank) { bestRank = rank; bestRankedIndex = i; } } if (bestRankedIndex === -1) { bestRankedIndex = Math.min(this._previousSelectedIndex, rows.length - 1); } this._previousSelectedIndex = bestRankedIndex; return bestRankedIndex; } _getRows(diagnostics, showTraces) { const diagnosticsToRows = showTraces ? DIAGNOSTICS_TO_ROWS_TRACES_MAP : DIAGNOSTICS_TO_ROWS_NO_TRACES_MAP; return diagnostics.map(diagnostic => { let row = diagnosticsToRows.get(diagnostic); if (row == null) { var _ref, _ref2; const { dir, location } = getLocation(diagnostic); row = { data: { classification: { kind: diagnostic.kind || 'lint', severity: diagnostic.type }, providerName: diagnostic.providerName, description: Object.assign({ showTraces, diagnostic }, getMessageContent(diagnostic, showTraces)), dir, location, diagnostic, line: (_ref = location) != null ? (_ref2 = _ref.locationInFile) != null ? _ref2.line : _ref2 : _ref } }; diagnosticsToRows.set(diagnostic, row); } return row; }); } // TODO: Memoize this so we don't recompute unnecessarily. _sortRows(rows, sortedColumn, descending) { return (0, (_sortDiagnostics || _load_sortDiagnostics()).default)(rows, sortedColumn, descending); } } exports.default = DiagnosticsTable; var _initialiseProps = function () { this._previousSelectedIndex = -1; this._handleSort = (sortedColumn, sortDescending) => { this.setState({ sortedColumn, sortDescending }); }; this._handleSelectTableRow = (item, index, event) => { this.props.selectMessage(item.diagnostic); // Users navigating with the keyboard may just be moving through items on their way to another. // If they have pending pane items enabled, it's not a big deal if we open the editor anyway. // But if they don't, we could wind up opening a ton of files they didn't even care about so, // to be safe, we won't do anything in that case. if (event.type !== 'click' && !atom.config.get('core.allowPendingPaneItems')) { return; } this.props.gotoMessageLocation(item.diagnostic, { focusEditor: false }); }; this._handleConfirmTableRow = item => { this.props.gotoMessageLocation(item.diagnostic, { focusEditor: true }); }; this._renderDescription = props => { const { showTraces, diagnostic, text, isPlainText } = props.data; return showTraces ? (0, (_DiagnosticsMessage || _load_DiagnosticsMessage()).DiagnosticsMessageNoHeader)({ message: diagnostic, goToLocation: (file, line) => (0, (_goToLocation || _load_goToLocation()).goToLocation)(file, { line }), fixer: () => {} }) : (0, (_DiagnosticsMessageText || _load_DiagnosticsMessageText()).DiagnosticsMessageText)({ preserveNewlines: showTraces, message: { text, html: isPlainText ? undefined : text } }); }; }; const EmptyComponent = () => _react.createElement( 'div', { className: 'diagnostics-ui-empty-component' }, 'No diagnostic messages' ); function TypeComponent(props) { const classification = props.data; const iconName = getIconName(classification); return _react.createElement((_Icon || _load_Icon()).Icon, { icon: iconName }); } function getIconName(classification) { const { kind, severity } = classification; if (kind === 'review') { return 'nuclicon-comment-discussion'; } if (!(severity !== 'Hint')) { throw new Error('Invariant violation: "severity !== \'Hint\'"'); } switch (severity) { case 'Warning': return 'nuclicon-warning'; case 'Error': return 'nuclicon-error'; case 'Info': return 'info'; default: severity; throw new Error(`Invalid severity: ${severity}`); } } function getMessageContent(diagnostic, showTraces) { let text = ''; let isPlainText = true; const traces = diagnostic.trace || []; const allMessages = [diagnostic, ...traces]; for (const message of allMessages) { // TODO: A mix of html and text diagnostics will yield a wonky sort ordering. if (message.html != null) { text += message.html + ' '; isPlainText = false; } else if (message.text != null) { text += message.text + ' '; } else { throw new Error('Neither text nor html property defined on message'); } } return { text: text.trim(), isPlainText }; } function DirComponent(props) { return ( // We're abusing `direction: rtl` here so we need the LRM to keep the slash on the right. _react.createElement( 'div', { className: 'nuclide-diagnostics-ui-dir-cell-contents' }, '\u200E', (_nuclideUri || _load_nuclideUri()).default.normalizeDir(props.data), '\u200E' ) ); } function FilenameComponent(props) { const locationInFile = props.data && props.data.locationInFile; if (locationInFile == null) { // This is a project diagnostic. return _react.createElement( 'span', null, DASH ); } const { basename, line } = locationInFile; return _react.createElement( 'span', null, basename, _react.createElement( 'span', { className: 'nuclide-diagnostics-ui-line-number' }, ':', line ) ); } function LineNumberComponent(props) { const line = props.data; // Show a dash if this is a project diagnostic. return _react.createElement( 'span', null, line == null ? DASH : line ); } function getLocation(diagnostic) { const { filePath, range } = diagnostic; const line = range ? range.start.row + 1 : 0; const humanized = (0, (_humanizePath || _load_humanizePath()).default)(filePath); if ((_nuclideUri || _load_nuclideUri()).default.endsWithSeparator(humanized)) { // It's a directory. return { dir: humanized, location: { fullPath: filePath, locationInFile: null } }; } const { dir, base: basename } = (_nuclideUri || _load_nuclideUri()).default.parsePath(humanized); return { dir, location: { fullPath: filePath, locationInFile: { basename, line } } }; } /** * Compute a number indicating the relative similarity of two messages. The smaller the number, the * more similar. (`null` indicates not at all similar.) */ function compareMessages(a, b) { const aKind = a.kind || 'lint'; const bKind = b.kind || 'lint'; const aFilePath = a.filePath; const bFilePath = b.filePath; if (aKind !== bKind || a.providerName !== b.providerName || a.type !== b.type || aFilePath !== bFilePath) { return null; } const aRange = a.range; const bRange = b.range; if (Boolean(aRange) !== Boolean(bRange)) { return null; } // Neither has a range, but they have the same text and they're for the same file. if (aRange == null || bRange == null) { return 0; } // TODO: This could be better if we also took into account the column and end start and column, // but it's probably good enough. (How likely are messages with the same text starting on the same // row?) return Math.abs(aRange.start.row - bRange.start.row); } const DASH = '\u2014';
30.551402
288
0.632976
7df57a2521902986c2cf746b0f10e7515b24f51d
422
js
JavaScript
src/js/lib/eadmin.tag.js
finove/eadmin
3bd5d720d06680319669bb0d2f002e6d3052a1a5
[ "MIT" ]
1
2022-01-17T04:01:51.000Z
2022-01-17T04:01:51.000Z
src/js/lib/eadmin.tag.js
finove/eadmin
3bd5d720d06680319669bb0d2f002e6d3052a1a5
[ "MIT" ]
null
null
null
src/js/lib/eadmin.tag.js
finove/eadmin
3bd5d720d06680319669bb0d2f002e6d3052a1a5
[ "MIT" ]
null
null
null
/** * eadmin 标签组件 */ class Tag{ static run(dom = null){ dom = dom == null ? body : $(dom); let tag = dom.find('[data-tag]'); if (tag.length == 0) return; tag.each(function(){ let [_this, v] = [$(this), { html : '' }]; v.tag = _.words(_this.data('tag')); _.each(v.tag, (val, key) => { v.html += `<span class="tag color-${key + 1}">${val}</span>`; }); _this.html(v.html); }); } }
18.347826
65
0.485782
7df5813692428bdf194e3410de4d1fd77e52085a
94,706
js
JavaScript
images.js
adnan-i/cue-combine
5afa7201019ec5d1ca1c8461777685e95476559d
[ "MIT" ]
null
null
null
images.js
adnan-i/cue-combine
5afa7201019ec5d1ca1c8461777685e95476559d
[ "MIT" ]
null
null
null
images.js
adnan-i/cue-combine
5afa7201019ec5d1ca1c8461777685e95476559d
[ "MIT" ]
null
null
null
module.exports = [ 'http://vail.net/sites/vail.net/files/website/559EagleDr.jpg', 'http://blog.paradizo.com/wp-content/uploads/2010/09/rocky-mountain-vacation-rentals-colorado.jpg', 'http://virtualcities.com/vacation/co/t/cot5hv1b.jpg', 'http://www.riverridgerentals.com/images/sm/799/220-Timbertrail-Breckenridge-Front.jpg', 'http://secondhomesecondchance.com/wp/wp-content/uploads/2013/12/mountains_nature_snow_forest_photography_hills_colorado_reatest-images_2013_beautiful_wallpaper_greatatmosphere-1-940x350.jpg', 'https://troutfitters.com/images/uploads/misc/MOUNTAIN-HOME-RENTALS-HOUSE.jpg', 'http://blog.paradizo.com/wp-content/uploads/2011/02/exterior.jpg', 'https://www.vacationrentals.com/info/files/live/sites/vr/files/shared/mountains/top-10-cabin-vacations/Rocky-Mountains.jpg', 'http://www.lakegeorge.com/commonimages/business/6100/2010/4/50-6100-100407100334-7690-li.jpg', 'https://www.greatsmokies.com/images/NantaGetaway-1240.jpg', 'http://www.realadventures.com/listingimages/1020/1020429/m_1020429a.jpg', 'http://www.vallecrucis.com/wp-content/uploads/2010/08/brvc_680px.jpg', 'http://www.realadventures.com/listingimages/1128/1128494/m_1128494a.jpg', 'http://www.ashevillecabins.com/images/Larrys.dining.jpg', 'http://www.monarchcabins.com/images/Forest-winter-night-mod.jpg', 'http://cdn.cstatic.net/images/gridfs/565e8cd2f92ea178c7004da7/d3facf13-6422-4cfa-be24-d327cc289695.1.10.jpeg', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Hotel-Exterior-1-RTS.jpg', 'https://www.vacationrentals.com/info/files/live/sites/vr/files/shared/mountains/top-10-cabin-vacations/Georgia-Mountains.jpg', 'http://www.winterparkresort.com/~/media/4cec97e602b549edaf54a465a90536b6.jpg?h=236&w=756', 'http://www.townsendviewcabinrentals.com/images/main_image.jpg', 'http://cdn.shopify.com/s/files/1/0671/5055/collections/rawsonville-flagship-store_bb125d15-03c5-4015-bd58-b52b4f0db2b1_large.jpg?v=1439566070', 'http://www.vacationinasheville.com/images/cabins-vistaa.jpg', 'http://media.travelnetsolutions.com/66790c5f2845d74c7eb6f002c0f30582/large.jpg', 'http://web.vail.net/news/wp-content/uploads/2013/02/406_Mountain_View1-804x420.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Homes-Winter-Exterior-2.img?image=488197&thumb&large', 'http://imagesus.homeaway.com/mda01/ebd73d2ceb073c20d88e6c75de50bbb55721490e', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Celebrity-Mountain-Vacation-Rentals-11_1000.jpg', 'https://a0.muscache.com/im/pictures/39474108/fc1cbb32_original.jpg?aki_policy=x_medium', 'http://usmsswimages.s3.amazonaws.com/5302/29850/6.jpg?1444330092', 'https://mychaletfinder.com/images/home/lm-home.png', 'http://www.rentcarolinacabins.com/cabin-trout-retreat2.jpg', 'https://s3-media2.fl.yelpcdn.com/bphoto/BKYFYffX8qPCdpDYa0PVQg/180s.jpg', 'https://a1.muscache.com/im/pictures/4d26e417-be08-4bae-b19c-d07205adbdb7.jpg?aki_policy=x_medium', 'http://directory.ac/files/dumblists/products/colorado-vacation-mountain-log-home.jpg', 'http://coolplacedestinations.co/wp-content/uploads/2015/10/mammoth-mountain-vacation-rentals-yaawr6h7c.jpg', 'https://cloud.canadastays.com/assets/images/regions/271_w.jpg', 'http://www.visitsmokies.org/images/stories/smoky-mountain-travel/vacation-rentals.jpg', 'http://www.coloradovacationrentals.com/propertyphoto/3401_3500/3420_m_290177ee1182dd43.jpg', 'http://myheritagecabin.com/wp-content/uploads/2015/09/Renwed-Spirit-one-of-our-Great-Smoky-Mountain-vacation-rentals-in-the-fall.jpg', 'https://s0.trippng.com/attachments/a8851fe5a27c5b7de713cb2f91bfc5f0b1d92611/store/fill/400/275/c2c1d10999fde6bcf0ad7e27a4cae9769ea38d66fc64d525015cc1ca0040/media.jpeg', 'http://tahoesouth.com/wp-content/uploads/2014/12/lakeland-lakeview-townhome405.jpg', 'http://www.emeraldmtn.com/xmasofc.jpg', 'https://s3-media4.fl.yelpcdn.com/bphoto/65LR4s8ziXJV73w1KTdAbA/ls.jpg', 'http://venuelust.com/wp-content/uploads/2012/08/rsz_rocky-mountain-vacation-rentals-colorado.jpg', 'https://a1.muscache.com/im/pictures/ea3cc805-1182-483d-9368-c1ebe9e76ef6.jpg?aki_policy=x_medium', 'https://assets-edge.vacationhomerentals.com/assets/properties/2011/08/06/38969/thumb4_exterior_with_wall_by_peggy_3_for_vac_rental.jpg', 'http://www.vacationhomerentals.com/get_property_image-36765.jpg', 'http://cdn.shopify.com/s/files/1/0671/5055/collections/stratton-store_large.jpg?v=1439566058', 'http://www.smokymountainretreat.com/home01.jpg', 'http://www.foscoerentals.com/Uploads/carousel/slide4.jpg', 'http://www.reviewresorts.com/images/Tall-Pines-Vail-Vacation-Rental-Home.jpg', 'http://i1225.photobucket.com/albums/ee387/jaustinliverezcom/mountainlake.jpg', 'http://www.highmountaincabinrentals.com/Uploads/long-range-views.jpg', 'https://a0.muscache.com/im/pictures/62974449/fa986e95_original.jpg?aki_policy=x_medium', 'https://a0.muscache.com/im/pictures/57d22990-8df5-4963-88d5-7dcdd834a8d6.jpg?aki_policy=x_medium', 'https://s3-media4.fl.yelpcdn.com/bphoto/40H-jHhEyLdLHfAOggGSmg/180s.jpg', 'http://www.lakeaway.com/images/mountain_preserve_if_aerial_3.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-197434.jpg', 'http://www.goremountainlodging.com/treetops/home.jpg', 'https://imagesus-ssl.homeaway.com/mda01/3d739c9e-d086-4b44-bdcd-7a603f574d37.1.10', 'https://a2.muscache.com/im/pictures/101852954/df2b0b78_original.jpg?aki_policy=x_medium', 'http://constellationatnorthstar.com/sites/default/files/vacation-rentals.jpg', 'http://cdn.liverez.com/5/11210/1/42067/550/2.jpg?v=7/21/2014%205:20:33%20PM', 'http://www.insideedgerentals.com/wp/wp-content/uploads/2014/08/DSCN1301-e1416357253499.jpg', 'http://www.cuvee.com/wp-content/uploads/2015/07/Cuvee_HiRes14v2-e1436207568586-1024x384.jpg', 'https://mychaletfinder.com/resorts/mammoth-lakes/headers/mammoth-mountain-village.jpg', 'http://cdn.cstatic.net/images/gridfs/565e8591f92ea13197008e68/7bdabe5a-026f-4d78-95d2-41384e335d92.1.10.jpeg', 'http://www.coloradovacationrentals.com/images/city/breckenridge.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/97/d1/26/97d12609e034c15bc3c37646849728e2.jpg', 'http://cdn.cstatic.net/images/gridfs/565e8a83f92ea10cbf000bdc/7b18ce10-4366-4b0d-996b-1c18802ebd68.1.10.jpeg', 'http://www.emeraldmtn.com/Rentals/dorothy/dorothys.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/531a1b1ba87c0-modern_vacation_rentals_austria_3.jpg', 'http://www.realadventures.com/listingimages/1020/1020429/m_1020429f.jpg', 'https://a1.muscache.com/im/pictures/74296725/2860ac63_original.jpg?aki_policy=x_medium', 'http://www.wyndhamvacationrentals.com/propimages/complex/summit/brkrmlentry.jpg', 'http://blog.trekaroo.com/wp-content/uploads/2016/01/Charlie%E2%80%99s-Beech-Mountain-Vacation-Rentals.jpg', 'http://exp.cdn-hotels.com/hotels/1000000/30000/28400/28357/28357_109_z.jpg', 'http://dx577khz83dc.cloudfront.net/1733/706bd9e5-23b5-4073-95c6-23f3f0e82fef.jpg', 'https://static.tripping.com/partners/vrbo/images/vrbo-780447-1328385/6987b808ec84861af2a271e3a8331898_icon_large.jpg', 'https://a0.muscache.com/im/pictures/a8a64b94-c5a7-452a-9c58-a66cfdab8537.jpg?aki_policy=x_medium', 'http://cdn.liverez.com/5/11357/1/95798/550/1.jpg?v=11/11/2015', 'https://pictures.escapia.com/GRYBRD/7608660347.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-3-valloire-france/modern_vacation_rentals_valloire_france_0581.jpg', 'http://gobeech.com/communities/1/000/002/008/461//images/11872689.png', 'https://a0.muscache.com/im/pictures/54330001/98676bf6_original.jpg?aki_policy=x_medium', 'https://a2.muscache.com/im/pictures/93734373/f5fe3415_original.jpg?aki_policy=x_medium', 'http://raft1.com/wp-content/uploads/2011/03/SCCR_Hawks_Ridge_4.jpg', 'http://www.gayeurekasprings.com/sites/default/files/events/stonehouse9.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/20953/01.JPG', 'https://a0.muscache.com/im/pictures/76389221/17bc8bfa_original.jpg?aki_policy=x_medium', 'http://www.realadventures.com/listingimages/1125/1125299/m_1125299a.jpg', 'http://www.skicamelback.com/images/vacation_rentals.jpg', 'http://www.coloradodirectory.com/buckeyescabin/images/BuckeyesCabinOutLG.jpg', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2013/10/four-seasons-resort-residences-vail-636x4311-300x203.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/box2-1.png', 'https://www.vacationhomerentals.com/get_property_thumb4-75373.jpg', 'http://virtualcities.com/vacation/nc/v/ncv61v1a.jpg', 'https://a0.muscache.com/im/pictures/01602218-aa14-46b1-9c20-679d5e672a67.jpg?aki_policy=x_medium', 'https://a2.muscache.com/im/pictures/100390661/a5df9dc6_original.jpg?aki_policy=x_medium', 'http://backtosuccessnow.com/highlands/wp-content/uploads/2011/03/100_0439.jpg', 'http://www.mammothlakes-vacationrentals.com/custimages/slide4.jpg', 'https://s-media-cache-ak0.pinimg.com/564x/63/85/8d/63858d8cdb5d642ca3dbd83c84de7352.jpg', 'http://www.wyndhamvacationrentals.com/propimages/complex/summit/brk-rml-sign.jpg', 'http://www.yourcabin.com/wp-content/uploads/2015/08/Fall-hiking-trail-near-our-Great-Smoky-Mountain-vacation-rentals.jpg', 'http://highcountryproperties.com/images/uploads/9/private_homes_winter_(4)_reszied_1000__large.jpg', 'http://www.yourcabin.com/wp-content/uploads/2015/08/Fall-colors-in-the-trees-near-our-Great-Smoky-Mountain-vacation-rentals.jpg', 'http://www.gmvrentals.com/back/rentals/photo_7.jpg', 'https://a2.muscache.com/im/pictures/90692552/7ec0f900_original.jpg?aki_policy=x_medium', 'http://rockymountainvacationrentals.com/_assets/Luxury_Rentals_Banner_2.png', 'http://www.whitemountaincabinrentals.com/wp-content/uploads/2013/04/Pinetop-Cabin-Rental-Pinetop-Arizona.1.jpg', 'https://a1.muscache.com/im/pictures/102298296/6568ac91_original.jpg?aki_policy=x_medium', 'https://cdn0.vox-cdn.com/thumbor/Dsx8IJOSZUyID282AQKYjDIUf_c=/0x600/cdn0.vox-cdn.com/uploads/chorus_asset/file/4355755/17e83117-8b16-484b-a973-f2fef9c699a2.1.10.0.jpeg', 'http://www.fairmontcreek.ca/wp-content/uploads/2015/11/IMG_1027.jpg', 'http://www.emeraldmtn.com/Rentals/dorothy/ybr1.jpg', 'https://cdn-co.milespartnership.com/sites/default/master/files/styles/524_height/public/zzdata-12810_720x480.jpg?itok=9tKQ0Cbs', 'http://www.amazingviewscabinrentals.com/wp-content/uploads/2016/01/Happy-family-of-three-enjoying-the-snow-outside-of-our-Great-Smoky-Mountain-vacation-rentals-1000x576.jpg', 'http://www.looncondoconnection.com/rentals/wp-content/uploads/2015/11/zip1-resized.jpg', 'http://www.almostparadiselodging.com/photos/side-rainier-rental-cabin.jpg', 'http://cloud.vacasarentals.com/images/960/144235.jpg', 'https://res.cloudinary.com/roadtrippers/image/upload/c_fill,h_316,w_520/v1438211460/mountain-vacation-at-white-stone-vacation-rentals-.jpg', 'http://www.vacationhomerentals.com/get_property_image-1778.jpg', 'http://highlandscondos.com/wp-content/uploads/2015/05/Scniec-photo-of-our-Gatlinburg-luxury-condos.jpg', 'http://www.yourcabin.com/wp-content/uploads/2015/08/Amazing-autumn-view-near-our-Great-Smoky-Mountain-vacation-rentals-1000x500.jpg', 'http://www.villageofcheshire.com/wp-content/uploads/2014/05/TheAppalachianMain.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Celebrity-Mountain-Vacation-Rentals-1_1000.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-26299.jpg', 'http://cdn.liverez.com/5/13035/1/105196/550/1.jpg?v=8/27/2015%202:35:14%20PM', 'http://images.mtnres.com/Repository/destinations/vr/homepage/150925_BestLodgingDeals_938x397.jpg', 'http://www.insideedgerentals.com/wp/wp-content/uploads/2015/05/DSCN3020-940x350.jpg', 'http://cdn.shopify.com/s/files/1/0937/8310/files/winter-rentals.jpg?6668234529224282204', 'https://a1.muscache.com/im/pictures/9098514/9a47b093_original.jpg?aki_policy=x_medium', 'http://www.therivermountainlodge.com/images/featured/featured-3.jpg', 'http://bigskyresort.com/assets/images/Plan%20A%20Trip/LodgingHead_13_CK_NMountainVillage.jpg', 'http://www.coppercoloradocondos.com/images/uploads/CQ_bldg_pools_snow.JPG', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac442c.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Photo-Gallery/Celebrity-Mountain-Vacation-Rentals-6_1000.jpg', 'https://a2.muscache.com/im/pictures/103560874/398b4ea8_original.jpg?aki_policy=x_medium', 'http://www.auntiebelhams.com/blog/wp-content/uploads/2015/08/a-river-and-fall-foliage-in-the-Great-Smoky-Mountains.jpg', 'http://images.locanto.com/1107965504/Smokey-Mountain-Vacation-Rentals-in-Pigeon-Forge-Tn_1.jpg', 'http://blog.paradizo.com/wp-content/uploads/2011/03/SnowCloudCondo.jpg', 'http://www.vacationhomerentals.com/get_property_image-53806.jpg', 'https://a0.muscache.com/im/pictures/76265785/2076e0db_original.jpg?aki_policy=x_medium', 'http://summitatgoremountain.com/assets/images/Winter%20Scene-%20Summit%20Ridge.jpg', 'https://a1.muscache.com/im/pictures/79964391/a64c44c5_original.jpg?aki_policy=x_medium', 'https://zaranga.files.wordpress.com/2013/04/bigbearlake.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Celebrity-Mountain-Vacation-Rentals-9_1000.jpg', 'http://chambermaster.blob.core.windows.net/images/customers/470/members/6212/photos/GALLERY_MAIN/co_11.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-768876-1316814/ef697b5011c0369957d6c66adb1fe946_icon_large.jpg', 'http://www.realadventures.com/listingimages/1125/1125306/m_1125306a.jpg', 'https://a2.muscache.com/im/pictures/69361050/abb8b56a_original.jpg?aki_policy=x_medium', 'https://imagesus-ssl.homeaway.com/mda01/48771640-9104-4666-ba27-d5546a31ed94.1.10/Bear-Mountain-Chalet-Breckenridge-Home-Vacation-Rentals.jpg', 'https://s-media-cache-ak0.pinimg.com/736x/a9/dc/68/a9dc68f557f7dc41cae4f352250b286a.jpg', 'http://www.goremountain.com/files/styles/max-200_listing/public/pauls_cabin_interior_0.jpg?itok=EJeI07Ua', 'http://www.archersinn.com/wp-content/uploads/2014/02/2-Bedroom-Cabin.jpg', 'http://3wzjx02lrz0n4eo49o21sufks5j.wpengine.netdna-cdn.com/wp-content/uploads/2015/10/Smoky-Serenity-Exterior_274x217_acf_cropped.jpg', 'https://s0.trippng.com/attachments/66f3c78d823ae28a685a483729e58c26f6802771/store/fill/400/275/c8f293eed9787a75c47d7c9ca9b1ae8a52347fd035f6f8bc44f2545fd8d9/media.jpeg', 'http://www.mountainlodgerealty.com/custimages/LazyRiverCabinSofa.jpg', 'http://www.atthecottage.com/forrent/bluemountain03/blue-mountain-vacation-rentals-13.jpg', 'https://static.tripping.com/partners/homeawayinstabook/images/vrbo-772484-1320422/7c63f278c91f05ba71895d46363fa30e_icon_large.jpg', 'http://www.lakegeorge.com/commonimages/business/16775/2015/2/Outside-li.jpg', 'http://www.peakpropertyrentals.com/Portals/_peakpropertyrentals/images/default/Homepage_rotator_5.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/3f/43/56/3f43561b070079f69e8d959058250df8.jpg', 'https://www.restinthemountains.com/images/theme/slides/slide4.jpg', 'http://cdn.liverez.com/5/11357/1/58278/550/1.jpg?v=11/9/2015', 'http://www.fotothing.com/photos/9e8/9e80a003f258bc3ec18bf1491b75ad21.jpg', 'http://www.blueridgecabinsonline.com/wp-content/uploads/2014/05/header4.jpg', 'https://a1.muscache.com/im/pictures/c3a47e52-71e0-409b-b099-5ddf15ff2c19.jpg?aki_policy=x_medium', 'https://www.vacationhomerentals.com/get_property_thumb4-2209.jpg', 'http://i.nuseek.com/images/template/360x318/hk_20080207_vacation-001.jpg', 'https://a0.muscache.com/im/pictures/54217918/7aee4d4c_original.jpg?aki_policy=x_medium', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/7052/1-IMG_8250.JPG', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2014/10/back-of-lodge.jpeg', 'http://imagesus.homeaway.com/mda01/ea9d5994ea8d5898c2866e67cc6589999f547a61', 'http://gobeech.com/communities/1/000/002/008/461//images/11872840.png', 'http://www.sandpointvacationrentals.com/2010/wp-content/uploads/et_temp/SchweitzerFeature-102028_954x289.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-2-valloire-france/modern_vacation_rentals_valloire_france_014-165x110.jpg', 'http://dx577khz83dc.cloudfront.net/1733/2b2af35e-171b-441b-a401-4a3043bded3c.jpg', 'http://cloud.vacasarentals.com/images/960/145693.jpg', 'http://myheritagecabin.com/wp-content/uploads/2015/09/Fall-colors-in-the-Great-Smoky-Mountains.jpg', 'https://s0.trippng.com/attachments/550684ea5a0650e584ec1598453c5a75c49087e9/store/fill/400/275/0997ce714d82c724ebb6ae3aaf779a02d3647bc6a8c91c1aa387fe14c89e/media.jpeg', 'http://blog.paradizo.com/wp-content/uploads/2011/01/Telluride_Bonnaire_Living_Room_Large_640px_409px.jpg', 'http://www.arizonavacationrentals.com/vacation-rentals/wp-content/uploads/2013/10/Mountain-Views-Arizona-Vacation-Rentals-Scottsdale.jpg', 'http://www.vacationhomerentals.com/get_property_image-55386.jpg', 'http://exp.cdn-hotels.com/hotels/1000000/30000/28400/28357/28357_91_z.jpg', 'http://cdn.liverez.com/5/13035/1/113632/250/1.jpg', 'https://s-media-cache-ak0.pinimg.com/736x/3f/17/92/3f1792a41f889fdeaf86b61f559c0930.jpg', 'http://www.camelbackmountainadventures.com/images/header-vacation-rentals.jpg', 'http://www.goremountainlodging.com/lookout/home.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2014/06/12/49317/thumb4_dsc02487.jpg', 'http://2.bp.blogspot.com/-xyqrY8GB0Wc/Uo5gzL3AdfI/AAAAAAAAAU0/lnqttxvPSvc/s1600/Nov+21+Ski+Town+Condos.JPG', 'http://www.realadventures.com/listingimages/1025/1025650/m_1025650a.jpg', 'http://www.ownerdirect.com/images/1091389-listing.jpg', 'http://www.cashiersnc.com/wp-content/themes/thesis_18/custom/images/home01.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Photo-Gallery/Celebrity-Mountain-Vacation-Rentals-10_1000.jpg', 'http://www.lookvacationrentals.com/img/imagecache/r_298.051948052_225_14072.jpg', 'https://s3-media1.fl.yelpcdn.com/bphoto/A5RLw_DB3lbMxvESCcjlgA/180s.jpg', 'http://static.wixstatic.com/media/a7c121_6179b21d016994c797b87fef06fc4b3e.jpg/v1/fill/w_376,h_211,al_c,q_80,usm_0.66_1.00_0.01/a7c121_6179b21d016994c797b87fef06fc4b3e.jpg', 'https://s0.trippng.com/attachments/17f0d45f8335ff81ca816c88759af56348e32dbb/store/fill/400/275/fca4cb6be9353553f2234fe71ba825eb657f82332d3840f2e256063aebb3/media.jpeg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/ba/b1/78/summer-in-breckenridge.jpg', 'https://static.tripping.com/partners/vrbo/images/vrbo-798139-1346077/efe4aebea5e78e5b0dc059c27f9a6fcf_icon_large.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-77331.jpg', 'http://images.10kvacationrentals.com/Horstman-House---HH208/1.jpg', 'http://www.pinemountainsports.com/wp-content/uploads/2010/12/SkisFPO-1024x560.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Celebrity-Mountain-Vacation-Rentals-3_1000.jpg', 'https://s0.trippng.com/attachments/c88513bb3f9dea69b3de10d067d842b3b302c1cd/store/fill/400/275/268c5febba97a2bafefe2b9f51fd4c1e00024ea0d1c9b11fc90e1433d23c/media.jpeg', 'https://s3-media3.fl.yelpcdn.com/bphoto/f_k5sqUm35f67Wi7qewmCA/ls.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-2-valloire-france/modern_vacation_rentals_valloire_france_012-165x110.jpg', 'https://mychaletfinder.com/resorts/copper-mountain/headers/copper-mountain-village-night-mychaletfinder.jpg', 'http://weekendoasis.net/wp-content/uploads/2015/05/POES_LODGE1-e1431089177513.jpg', 'http://www.nyvacationrentals.com/propertyphoto/8101_8200/8138_m_5c557d05a7aae71a.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-391241-391241/9a66b270a06580b93769da49f93fbf5f_icon_large.jpg', 'http://blog1.fkimg.com/wp-content/uploads/2016/01/Usery-Mountain-photo-credit-Visit-Mesa.jpg', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/logwood001.jpg', 'https://a1.muscache.com/im/pictures/29107810/08e393eb_original.jpg?aki_policy=x_medium', 'https://www.vacationhomerentals.com/get_property_thumb4-76185.jpg', 'http://www.scenicrentals.com/images/img4da6225b90f18.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-761267-1309205/38e5f755ae20d95a3daf6ad10358a2b3_icon_large.jpg', 'https://a1.muscache.com/im/pictures/19176457/10d6ed85_original.jpg?aki_policy=x_medium', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2016/01/front-1.jpg', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Blue-Mountain-Villas-Rentals-8369308.jpg?width=600&height=550&scale=canvas', 'http://cdn.boutique-homes.com/wp-content/uploads/5319630385e42-modern_vacation_rentals_austria_38-165x110.jpg', 'http://1.bp.blogspot.com/-McUGBxC2dSQ/VqOxRC6xt5I/AAAAAAAARLc/UKh05dWpUcc/s1600/Brown_Log_Cabin_In_Maggie_Valley_NC.jpg', 'http://www.sugarmountainlodging.com/SMLgraphics/crestview-360/crestview-360_300_3_SML-homepage.jpg', 'https://a0.muscache.com/im/pictures/101122748/d6bdfb03_original.jpg?aki_policy=x_medium', 'https://s0.trippng.com/attachments/10b71ad9f33e5b6239fbc68cd4b27643317636be/store/fill/400/275/af7907499460ca4a58c5fbe6271ec6f949c745faecc62c848b5ac5ea2b17/media.jpeg', 'http://www.broderickrealestate.com/myshitassskis.jpg', 'https://s0.trippng.com/attachments/a04347ebd3ccd555a1c86e5cf2e645f632731c82/store/fill/400/275/a405df940a8d9475400b7d7e8549ce1939c076d0d786bf2085410576a52d/media.jpeg', 'http://www.romanticasheville.com/sites/default/files/styles/gallery_600x400_/public/images/listing/greybeard.jpg?itok=CoyZYWk9', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2015/10/four-seasons-costa-rica-miramar-suite-pool-view-1400x580.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/5a/79/38/5a793884dee7455432ce7d02beac8ba4.jpg', 'http://www.red-river-nm.com/custimages/Timber-Crest-Retreat-RedRiv.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-66046.jpg', 'http://allmountainrentals.com/custimages/Owls%20Nest%20Golf.jpeg', 'https://a0.muscache.com/im/pictures/d4ebe0a2-dd0f-4363-9e5a-414a489979d1.jpg?aki_policy=x_medium', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2014/10/catawba-falls-lodge.jpeg', 'http://www.atthecottage.com/forrent/bluemountain02/blue-mountain-chalets-for-rent-03.jpg', 'https://distinctivemtnlodging.com/images/slides-index/01-Welcome-to-Mountain-Laurel-Lodge.jpg', 'http://static1.businessinsider.com/image/5665eee684307655008b817b-1200/marmotte-mountain-libellule-is-located-in-chamonix-france-and-offers-breathtaking-views-of-the-mont-blanc-mountain-range-from-its-living-room-and-solarium.jpg', 'http://www.petfriendlymammoth.com/images/white-mountain-lodge-pet-friendly-mammoth-lakes-cali.JPG', 'http://www.casa-vale.net/Bilder/Home/09-villa-crina-karpaten-ferienhaus-in-rum%C3%A4nien.jpg', 'https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url=https://imagesus-ssl.homeaway.com/mda01/e25c63f3-d9f0-42aa-a38b-ddee3fc17c88.1.10&container=focus&resize_w=700&refresh=31536000&no_expand=1&rewriteMime=image/', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/05/17/76411/thumb4_ha___game__a_.jpg', 'https://s-media-cache-ak0.pinimg.com/564x/be/01/73/be0173d1e072de0b152d6af779809c21.jpg', 'http://photos.vamoose.com/photos/view?file=TLXZDYH32DA46TBBR2XY.jpg', 'http://romanticcabin.com/cabins/lake-memory/alm-smokey-mountain-vacation-home-front-view-250-2.jpg', 'http://www.nyvacationrentals.com/propertyphoto/4501_4600/4529_t_e1a3d077005d2fe0.jpg', 'http://www.coloradomountainrealestate.com/wp-content/uploads/2014/07/Breck-Winter.jpg', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2014/10/front.jpeg', 'http://rockymountainvacationrentals.com/images/46d90-Keystone_Header_Image_Looking_Off_Keystone.png', 'https://a0.muscache.com/im/pictures/c9e59c86-f133-4743-b6b7-319744e790dc.jpg?aki_policy=x_medium', 'http://www.armelleblog.com/wp-content/uploads/2016/02/IMG_5639.jpg', 'http://www.renthelen.com/custimages/Helen_GA_in_summer.jpg', 'http://imagesus.homeaway.com/mda01/bff2992a-5c01-4250-bba9-79188cdcf826.1.6', 'http://deepcreek.com/wp-content/uploads/2014/11/1mini4-1024x759.jpg', 'http://www.myourayvacation.com/images/about_ouray_header.jpg', 'http://pictures.escapia.com/MKFRBO/4861040649.jpg', 'http://tac.wynw1.vdsys.com/pdfdocs/SMKSMCbrandcanned.jpg', 'http://coolplacedestinations.co/wp-content/uploads/2015/10/mountain-home-vacation-rentals-uqkzs0ofc.jpg', 'http://cloud.vacasarentals.com/images/960/219072.jpg', 'http://summitrentals.com/sites/default/files/styles/homepage_slideshow_adp_medium__1024x360_/public/slides/sunset_snow_slide.jpg?itok=IXbp7f49', 'http://www.control4.com/files/large/3154959dd61dff2', 'http://www.foscoerentals.com/Uploads/carousel/slide1.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/545a6f105d75c-5459979ab9f9amodern_vacation_rentals_verbier_switzerland_008.jpg', 'http://3wzjx02lrz0n4eo49o21sufks5j.wpengine.netdna-cdn.com/wp-content/uploads/2014/09/Mountain-Majesty-7.jpg', 'http://www.mountaincondorentals.com/wp-content/uploads/2012/07/Town.jpg', 'http://www.10kvacationrentals.com/FrenchmansPond29252/preview_1.jpg', 'https://a0.muscache.com/im/pictures/102382493/95a59dee_original.jpg?aki_policy=x_medium', 'http://www.realadventures.com/listingimages/1020/1020690/m_1020690j.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-776654-1324592/846e810218d49ce9dc82a9e6320d5297_icon_large.jpg', 'http://highlandscondos.com/wp-content/uploads/2013/02/regular-nightly-rate.jpg', 'http://i1202.photobucket.com/albums/bb378/LiveRez/marinerslanding1.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/greece/mountain-house-folegandros-greece/modern_vacation_rentals_folegandros_greece_002.jpg', 'http://files.usmre.com/5206/fireplace_mug.png', 'http://www.archersinn.com/wp-content/uploads/2014/02/The-Hunt-Cabin.jpg', 'https://a1.muscache.com/im/pictures/fc308935-cb2e-4950-a95e-c595b2a1772f.jpg?aki_policy=x_medium', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-3-valloire-france/modern_vacation_rentals_valloire_france_002-165x110.jpg', 'http://www.firesidechalets.com/300/300head3.gif', 'http://www.angelfire.com/super2/greece/kreta/kreta-winter11.JPG', 'http://www.cabincreeklodge.com/images/cabincreeklodgeentrance.jpg/@@images/d887ec8c-eac7-4726-a32b-a60565635e80.jpeg', 'https://s-media-cache-ak0.pinimg.com/236x/cc/8d/a6/cc8da6225d15b3fbc6a73b9a7e3da9ae.jpg', 'https://s-media-cache-ak0.pinimg.com/564x/24/8c/72/248c72a7409319cab9fdaaa9a8c2f346.jpg', 'https://noogacms.s3.amazonaws.com/assets/_/6ac2bc4fb9dfa64fa21358c800f4b1bf62417_large.jpg', 'http://www.realadventures.com/listingimages/1025/1025650/m_1025650b.jpg', 'https://www.skibluemt.com/media/1519/bluemountainbungalow.jpg?crop=0,0.26666666666666666,0,0.325&cropmode=percentage&width=800&height=245&rnd=130614020950000000', 'http://www.armelleblog.com/wp-content/uploads/2016/02/IMG_5124.jpg', 'http://www.mountain-home.com/images/content/home/logoleft.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/0a/96/04/0a9604f683be8a41d693b08d363fd41a.jpg', 'http://www.allmountainrentals.com/custimages/WatervilleEstatesPool.jpg', 'http://www.cottages-canada.ca/cottages-canada/PhotoChalets/7572-1-vacation-rentals-102.jpg', 'https://s-media-cache-ak0.pinimg.com/736x/29/81/67/2981675f4671851b5221bf01f4f606ab.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/1c/e5/f9/1ce5f943ea49f937efc24b681b95eade.jpg', 'http://photos.vamoose.com/photos/view?file=MDUXABHVW7EUKUN93WVT.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2010/03/19/49507/thumb4_cabin2_front.jpg', 'https://a0.muscache.com/im/pictures/7518672/809580ca_original.jpg?aki_policy=x_medium', 'https://a2.muscache.com/im/pictures/65695745/6431b4fb_original.jpg?aki_policy=x_medium', 'https://s3-media1.fl.yelpcdn.com/bphoto/vQNylaes3D5YyksaFVtXpQ/ls.jpg', 'https://a0.muscache.com/im/pictures/105795860/12b054b3_original.jpg?aki_policy=x_medium', 'https://a0.muscache.com/im/pictures/dce1f253-796a-4bf8-a801-72a47d14b6d6.jpg?aki_policy=x_medium', 'http://www.gmvrentals.com/back/rentals/photo_50.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Celebrity-Mountain-Vacation-Rentals-15_1000.jpg', 'https://imagesus-ssl.homeaway.com/mda01/dc3b2083-5510-4c06-8069-b6a7218b6ae7.1.10/Bear-Mountain-Chalet-Dining-Breckenridge-Vacation-Rentals.jpg', 'https://a2.muscache.com/im/pictures/56326455/ab0d689c_original.jpg?aki_policy=x_medium', 'http://www.wyndhamvacationrentals.com/images/callout-video-castle-SMK-C.jpg', 'https://www.greatsmokies.com/images/members/280.jpg', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Blue-Mountain-Villas-Rentals-8369303.jpg?width=450&height=413&scale=canvas', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/rockwood001.jpg', 'http://4-mammoth-lodging.com/4-mammoth-mountain-winter.jpg', 'http://www.findvacationrentals.com/Rentals/12160/121602.jpg', 'https://a1.muscache.com/im/pictures/98448532/d2ef5dd0_original.jpg?aki_policy=x_medium', 'http://visitsandpoint.com/wp-content/uploads/2014/03/SMR_winter2014-photo.jpg', 'http://www.riverridgerentals.com/images/sm/836/952-Beeler-Copper-Mountain-CO-large-016-16-Dining-Room-1500x999-72dpi.jpeg', 'http://blog.paradizo.com/wp-content/uploads/2011/01/one-willow-bridge-road.jpg', 'http://www.snowshoevacationrentals.com/custimages/slide5.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/00/1c/18/44/big-sky-montana.jpg', 'http://www.vacationhomerentals.com/get_property_image-47565.jpg', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2015/08/kitchen.jpg', 'http://cdn.liverez.com/5/13035/1/103852/550/1.jpg?v=5/25/2015%209:20:59%20AM', 'https://s0.trippng.com/attachments/1bb39c91a50f0329b807487739809635eddc6c74/store/fill/400/275/1c13dce995b3b779731505d5056f77b7605e9979229c5fb896adf4dcd168/media.jpeg', 'https://www.vacationhomerentals.com/get_property_thumb4-21748.jpg', 'http://www.whistlerplatinum.com/images/heroes/kadenood-whistler-4.jpg', 'http://www.maggiemountainvacations.com/images/rental2.jpg', 'http://blueridgetravelguide.com/wp-content/uploads/2011/11/WNCCabinsAndVacationRentals.jpg', 'http://www.friorivervacationrentals.com/images/lodging/mountain_ridge/mountain_ridge_307.jpg', 'http://res.cloudinary.com/simpleview/image/upload/v1426964698/clients/roanoke15/Big_Pine_Trout_Farm_597a60a1-05cd-41b5-a8ad-be487cc456cd.jpg', 'http://www.findvacationrentals.com/Rentals/11962/119622.jpg', 'https://imagesus-ssl.homeaway.com/mda01/d4248cf0-9b0a-455d-9b24-9b4768e83a72.1.10/Bear-Mountain-Chalet-Kitchen-Breckenridge-Vacation-Rentals.jpg', 'http://www.vacationcabinsblueridge.com/wp-content/uploads/slider2.png', 'http://www.visitnc.com/contents/imgcrop/11303/800/449.45454545455', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/04/23/211485/thumb3_21.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/ec/f7/47/ecf747bbd864433bf41e87aaf1d39b97.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/10/28/232221/thumb3_e637210a_35de_4574_9fd2_b34e1f2dc43e_1.jpg', 'http://www.cabinsofthesmokies.com/cots-new-look-2013.jpg', 'http://www.cottages-canada.ca/cottages-canada/PhotoChalets/7574-1-vacation-rentals-1115.jpg', 'http://www.emeraldmtn.com/Rentals/dorothy/Drthys071.JPG', 'https://assets-edge.vacationhomerentals.com/assets/properties/2014/09/11/38686/thumb4_side_view_villa_9_14.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Homes-Summer-Exterior.img?image=488194&thumb&large', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/05/15/220171/thumb4_dsc00505.jpg', 'http://www.cometobreck.com/files/8614/3905/4166/2015-07-24_0061.jpg', 'https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url=https://imagesus-ssl.homeaway.com/mda01/d0ea011d-8b5c-4f3f-b4bf-3dfe2b15a58d.1.10&container=focus&resize_w=700&refresh=31536000&no_expand=1&rewriteMime=image/', 'https://cdn-co.milespartnership.com/sites/default/master/files/styles/524_height/public/zzdata-2671_700x224.jpg?itok=ZEcIkt8H', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/233443.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-2-valloire-france/modern_vacation_rentals_valloire_france_0061.jpg', 'http://pictures.escapia.com/CPM/3711250613.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/52054973e33a4-vacation-rentals_modern-mountain-chalet_maribel-france_int4.jpg', 'https://www.acervacations.com/wp-content/uploads/2015/05/MS23-JR150713-034.jpg', 'https://a2.muscache.com/im/pictures/76604644/861d00e6_original.jpg?aki_policy=x_medium', 'http://www.cupotico.com/images/hermosa%20vacation%20rental.jpg', 'https://s-media-cache-ak0.pinimg.com/736x/38/73/d2/3873d2926b9e47b6864b572e396ed259.jpg', 'http://www.gmvrentals.com/back/slides/photo_1.jpg', 'https://s0.trippng.com/attachments/2c359b76f949ab40f2ce776c1548de5e22164dd7/store/fill/400/275/52c3c39209514729ec2dfae92c4b4a404c015aea9917ada1c78a92b67495/media.jpeg', 'http://4-mammoth-lodging.com/sunstone/5-sunstone-summer-front-view.jpg', 'http://www.beckwithrentals.com/images/general/Front/2014/winter/hiddenValley_w1.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/81/0b/04/810b049d738b6ffbce662d64b15bdeef.jpg', 'https://a1.muscache.com/im/pictures/c37c4488-e60e-4838-9414-ecb0d1edce13.jpg?aki_policy=x_medium', 'http://www.snowshoevacationrentals.com/custimages/slide4.jpg', 'https://a2.muscache.com/im/pictures/37126468/59820021_original.jpg?aki_policy=x_medium', 'http://www.myourayvacation.com/images/vacation_rental_header.jpg', 'http://www.wyndhamvacationrentals.com/images/callout-video-SMK.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/af/b1/e8/afb1e8c5ebccf4faf2bd48b0d3b98d59.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/45/65/c2/maroon-bells-aspen-colorado.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/46/77/9f/vail.jpg', 'https://a1.muscache.com/im/pictures/86afe37a-177c-469f-b24e-f299711e1960.jpg?aki_policy=x_medium', 'https://mychaletfinder.com/resorts/big-bear-lake/headers/big-bear-lake.jpg', 'http://www.vacationhomerentals.com/get_property_image-36998.jpg', 'https://imagesus-ssl.homeaway.com/mda01/97a984cf-a67d-44ed-9142-b1a6497b7a4d.1.10/Bear-Mountain-Chalet-Kitchen-Breckenridge-Vacation-Rentals.jpg', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Photo-Gallery/Celebrity-Mountain-Vacation-Rentals-4_1000.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/03/e7/83/d7/gunlock-lake-overflowing.jpg', 'https://s0.trippng.com/attachments/0191d1bdfce069813517500dd7bcd77c7d932b97/store/fill/400/275/fd13d8ec9e61f94e0e007ef15be49189faa84674576215a9936a30162b56/media.jpeg', 'http://pictures.escapia.com/VR365L/8687040505.jpg', 'http://www.adventuretravelshop.co.uk/wp-content/uploads/2014/12/colorado_winter.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-3-valloire-france/modern_vacation_rentals_valloire_france_001-165x110.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/531963137c55b-modern_vacation_rentals_austria_42-165x110.jpg', 'http://pictures.escapia.com/FMRP/3384420152.jpg', 'https://s3.amazonaws.com/nresweb/S109/AMR_Home_Hero_1280x410.jpg', 'http://cdn.liverez.com/5/13035/1/104966/550/1.jpg?v=7/5/2015%207:20:02%20PM', 'http://www.coloradovacationrentals.com/propertyphoto/3401_3500/3464_m_f72fd9d721562343.jpg', 'http://images.locanto.com/1107965508/Smokey-Mountain-Vacation-Rentals-in-Pigeon-Forge-Tn_5.jpg', 'http://cdn.liverez.com/5/11357/1/60457/550/1.jpg?v=11/12/2015', 'http://cdn.liverez.com/5/11652/1/52829/550/1.jpg?v=10/8/2014', 'http://pictures.escapia.com/MONTAN/5337200211.jpg', 'http://www.carolinacorner.com/static/newext.jpg', 'http://images.locanto.com/1107965505/Smokey-Mountain-Vacation-Rentals-in-Pigeon-Forge-Tn_2.jpg', 'http://maui-vacationrentals.com/home/wp-content/uploads/lookout/view-lookout-frontelevation.jpg', 'https://s0.trippng.com/attachments/de2a188478c753f6f86b227b3049211bc816e917/store/fill/400/275/b468135a97c8013ebac9b050088a95db45ba5963d60369bb79fb94a6f31b/media.jpeg', 'http://www.myourayvacation.com/images/album14_exterior_lg.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2012/02/23/34878/thumb3_dsc02510.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/53196309cb121-modern_vacation_rentals_austria_39-165x110.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-42374.jpg', 'http://www.luxurymountainvacationrentals.com/media/27576b.jpg', 'https://troutfitters.com/images/uploads/misc/MOUNTAIN-HOME-RENTALS-HOUSE-3.jpg', 'https://a2.muscache.com/im/pictures/21697011/3dcac364_original.jpg?aki_policy=x_medium', 'http://www.sugarmountainlodging.com/SMLgraphics/sugartop/sugar_top_winter_300.jpg', 'http://www.control4.com/files/large/ec5b57469df4c84', 'http://www.auntiebelhams.com/blog/wp-content/uploads/2015/08/fall-colors-in-the-Greast-Smoky-Mountains.jpg', 'http://www.gatewayreservations.com/wp-content/uploads/2014/07/496110-19.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-234737.jpg', 'http://www.coppercoloradocondos.com/images/uploads/Copper_Mountain_vacation_rentals.jpg', 'http://www.mountainmemoriesvacationrentals.com/uploads/2/1/6/5/21650778/194586.jpg?372', 'http://ghk.h-cdn.co/assets/15/20/980x490/landscape-1431378113-carolina-hobbit-house-index.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-55803-55803/41e0685b548dd2cc4dc2d4ef0287677b_icon_large.jpg', 'https://s-media-cache-ak0.pinimg.com/564x/3c/ba/04/3cba0470ccf9adb2c59342b0734c0334.jpg', 'http://smithmountainlakehouseboats.com/Smith-Mountai-%20Lake-houseboats.jpg', 'http://www.mountain-home.com/images/content/home/logoright.jpg', 'https://a0.muscache.com/im/pictures/faa059c5-4c8e-4d3d-9a1c-99ac16c93f77.jpg?aki_policy=x_medium', 'https://a2.muscache.com/im/pictures/108609270/ddd6c711_original.jpg?aki_policy=x_medium', 'https://www.propertiesincostarica.com/properties/Images/_vacationrentalhomeinescazuwithstaggering/e-Housefront.jpg', 'https://images.trvl-media.com/hotels/9000000/8470000/8467100/8467067/8467067_1_b.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/03/23/207216/thumb3_24.jpg', 'http://mountain-realty-guide.com/rentals/ga-vacation-cabin-rentals/blairsville-ga-mountain-lake-vacation-cabin-homes-for-rent/butternut_creek-garentalcabins.jpg', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Lobby-1-RTS.jpg', 'http://www.mountainvistarealestate.com/sites/default/files/imagecache/640X280/photos/600x333/Condos%20at%20Vistoso%20Resized%20with%20Golf.jpg', 'http://static.wixstatic.com/media/a7c121_90d3fe37bc15e5b619e95c36aba03244.png/v1/fill/w_543,h_298,al_c/a7c121_90d3fe37bc15e5b619e95c36aba03244.png', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4434.jpg', 'http://www.coppercoloradocondos.com/images/uploads/copper_mountain_cirque_pool.JPG', 'http://static.wixstatic.com/media/a7c121_f5727a48ca0046e4ac87ea8ae977f56e.jpg_srz_416_215_85_22_0.50_1.20_0.00_jpg_srz', 'https://i.vimeocdn.com/video/536294716.jpg?mw=1920&mh=1080&q=70', 'http://cdn.securem2.com/commonimages/business/15712/2014/2/18609-15712-140224101350-28017-display.jpg', 'https://www.ownerdirect.com/images/silver-star-mountain-vacation-rentals-kw-1077959-full.jpg', 'https://a1.muscache.com/im/pictures/59890392/7b64f5dc_original.jpg?aki_policy=x_medium', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Photo-Gallery/Celebrity-Mountain-Vacation-Rentals-2_1000.jpg', 'http://www.realtywebsites.com/northcarolina/images/vacation-rentals-nc-mountains-1.jpg', 'http://www.glacier-lodge.com/images/template/whistler-accommodation-rentals.jpg', 'http://www.cashiersnc.com/wp-content/themes/thesis_18/custom/images/home02.jpg', 'http://www.nyvacationrentals.com/propertyphoto/601_700/671_m_2dc7fa88c73df830.jpg', 'http://blog.paradizo.com/wp-content/uploads/2010/11/rocky-mountain-aspen-square-apartment.jpg', 'http://cdn.liverez.com/5/11357/1/45518/550/1.jpg?v=1/21/2016', 'http://www.camelbackmountainadventures.com/images/plan-to-stay-while-you-play.jpg', 'http://www.smokymountainretreat.com/fader6.jpg', 'https://www.whistlerdeluxe.com/images/salmonbake.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-12370.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/chalet-chamonix-servoz-france/modern_vacation_rentals_france_061.jpg', 'http://www.mammothsierraonline.com/rotatingpics/homepic2.jpg', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_4244/13_large.jpg', 'http://www.greatsmokyscabinrentals.com/custimages/Specials/Tom%20Branch%20Falls.png', 'https://assets-edge.vacationhomerentals.com/assets/properties/2008/05/09/35513/thumb4_sugarloaf2190_adams_mountain.jpg', 'http://www.durangolove.com/images/SS_mountains_close.jpg', 'http://www.gmvrentals.com/back/slides/photo_7.jpg', 'http://www.rmrm.net/wp-content/uploads/2011/12/copper_slide_1.png', 'http://www.realtywebsites.com/northcarolina/images/north-carolina-blue-ridge-parkway.jpg', 'https://a0.muscache.com/im/pictures/109428601/032ae8af_original.jpg?aki_policy=x_medium', 'https://static.tripping.com/partners/vrbo/images/vrbo-782285-1330223/ed971e089e653277411af0782d0a6354_icon_large.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2014/11/07/79655/thumb3_2.jpg', 'http://www.vrentals.net/Houses/NY/h276.jpg', 'http://www.alpinechaletrentals.com/files/cache/c90eff0613f95510e238a4bc5bbc8cb0_f19.jpg', 'http://cdn.liverez.com/5/13035/1/95557/250/1.jpg', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2014/08/four-seasons-vail-residence-interior-1400x580.jpg', 'http://www.myourayvacation.com/images/album25_living_lg.jpg', 'http://www.smith-mountain-lake-visitor-center.com/Ads_Smith_Mountain_Lake_Vacation_Rentals/smith_mountain_lake_vacation_rentals.jpg', 'https://a2.muscache.com/im/pictures/17425590/3f597d58_original.jpg?aki_policy=x_medium', 'http://www.gmvrentals.com/back/rentals/photo_44.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/54a427ac815f7-modern_vacation_rentals_guanacaste_costa_rica_003.jpg', 'http://www.gmvrentals.com/back/home/photo_3.jpg', 'http://4.bp.blogspot.com/_HbFppH7TK5I/SvOgREj-L1I/AAAAAAAAAoY/4LQkOtHIAdo/S269/Burnsville_NC_Vavation_Rentals_Mount_Mitchell_Vacation_rentals.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/6a/eb/05/6aeb05c32661655cdfb365625ad82ba4.jpg', 'https://mychaletfinder.com/resorts/mammoth-lakes/headers/mammoth-lakes.JPG', 'https://a2.muscache.com/im/pictures/103217799/e8b0c468_original.jpg?aki_policy=x_medium', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Hotel-Exterior-3-RTS.jpg', 'http://www.northtahoerental.com/images/1058.1.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/20427/01.JPG', 'https://static.tripping.com/partners/homeawayinstabook/images/vrbo-772471-1320409/4f15a070934a2cbc44ae5f89360fac80_icon_large.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-2-valloire-france/modern_vacation_rentals_valloire_france_0131-165x110.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/6945/01.JPG', 'http://www.staysugarmountain.com/sites/default/files/styles/property_teaser/http/secure.instantsoftwareonline.com/StayUSA/PropertyImages/0213/RSC126/L22.jpg?itok=QEFsWj6Z', 'http://www.nyvacationrentals.com/propertyphoto/7701_7800/7725_m_56db166913b62d91.jpg', 'http://s3-media4.fl.yelpcdn.com/bphoto/4iCurB8EupjQd-llCtyzGg/180s.jpg', 'http://www.laurelmountaincabins.net/mountains.jpg', 'http://cdn.liverez.com/5/11357/1/34017/550/1.jpg?v=11/13/2015', 'http://cdn.liverez.com/5/11357/1/66919/550/1.jpg?v=11/23/2015', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4449.jpg', 'http://www.myourayvacation.com/images/album23_bedroom_lg.jpg', 'http://www.allmountainrentals.com/custimages/396.JPG', 'http://cdn.boutique-homes.com/wp-content/uploads/5319631e165ed-modern_vacation_rentals_austria-165x110.jpg', 'http://pictures.escapia.com/FMRP/0201440430.jpg', 'http://www.vacationhomerentals.com/get_property_image-22621.jpg', 'https://a2.muscache.com/im/pictures/f5b5c278-a102-4402-8cc7-8ac53045246b.jpg?aki_policy=x_medium', 'http://tac.wynw1.vdsys.com/pdfdocs/SMKMMVbrandcanned.jpg', 'http://www.camelbackmountainadventures.com/images/promos/Promo_20150112154001.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-778461-1326399/cb4bc7ef757d478ec0e60e2f009180f5_icon_large.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-167210-167210/51785e22f20b6f2dacce410e20afacd3_icon_large.jpg', 'https://a0.muscache.com/im/pictures/fd477227-872a-44a6-865a-e02c9369e0c6.jpg?aki_policy=x_medium', 'https://static.tripping.com/partners/vrbo/images/vrbo-780683-1328621/82e065b29ceb073bd98b25851b875f83_icon_large.jpg', 'http://www.vacationnc.com/images/p-001.jpg', 'http://www.findbnb.com/images/propertyImages/5523/standard_vrs_1_House_c.jpg', 'http://www.sandybottomtrailrides.net/wp-content/uploads/2010/12/CarolinaMornings-Doolittle.jpg', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/1-redfish.jpg', 'http://pocono-vacationrentals.com/admin2/pics/33.455.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_67.jpg', 'http://ellasvacationrentals.com/wp-content/uploads/2015/10/North-Carolina-Smokey-Mountain-vacation-rentals-1030x705.jpg', 'http://romanticcabin.com/cabins/lake-memory/alm-smokey-mountain-vacation-cabins-rent-loft-br-right.jpg', 'https://a0.muscache.com/im/pictures/41402557/81774320_original.jpg?aki_policy=x_medium', 'https://assets-edge.vacationhomerentals.com/assets/properties/2014/05/19/76412/thumb3_24.jpg', 'http://q-ec.bstatic.com/images/hotel/max500/120/12051983.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/00/19/e2/58/marroon-bells.jpg', 'https://a1.muscache.com/im/pictures/c501e313-0fca-4ac9-bdd4-2842e7092dc1.jpg?aki_policy=x_medium', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/mountainwood001.jpg', 'http://www.yourcabin.com/wp-content/uploads/2015/08/The-Dollywood-theme-park-near-our-Great-Smoky-Mountain-vacation-rentals.jpg', 'http://imganuncios.mitula.net/ski_whiteface_mountain_vacation_rentals_lake_placidwhiteface_mountain_5160071453407617504.jpg', 'http://www.visitmysmokies.com/wp-content/uploads/2015/05/Incredible-view-from-Smoky-Mountain-vacation-cabin.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/slider1-1.png', 'http://www.vacationcabinsblueridge.com/wp-content/uploads/slider1.png', 'https://s-media-cache-ak0.pinimg.com/236x/43/c9/b4/43c9b4789e5fb0b8b41843eeef24c35b.jpg', 'http://i1225.photobucket.com/albums/ee387/jaustinliverezcom/yellowstonelake.jpg', 'https://agent.barefoot.com/LNF/vre/v3clnfmtnva1/images/properties/6893/1.jpg', 'http://cdn.securem2.com/commonimages/business/912/2010/5/669-912-100512084226-8077-display.jpg', 'http://pocono-vacationrentals.com/admin2/pics/2.16.jpg', 'https://getaway-vacations.com/wp-content/uploads/2013/06/7-12-12-vt-011_compressed-300x199.jpg', 'http://www.yosemiteregionresorts.com/yosemiteregionresorts010007.jpg', 'https://mychaletfinder.com/regions/california/vacations/big-sur.jpg', 'http://images.exoticestates.com/files/presets/propertypreview/property/179/gallery/colony_153_01.jpg', 'https://www.bluegreenowner.com/MS/resortimages/12_01.jpg', 'http://sugartoprentals.com/wp-content/uploads/2014/01/balcony-view.jpg', 'http://www.alakecabin4u.com/images/view_from_porch-307.jpg', 'https://mychaletfinder.com/countries/united-states/new-pics/ski-america-summer-holidays-mychaletfinder-c2-jack-affleck.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2008/06/25/36269/thumb4_first_floor.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-773715-1321653/b12318cf655856de6e263304fdb39a1e_icon_large.jpg', 'http://cdn.liverez.com/5/11357/1/38091/550/1.jpg?v=11/11/2015', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Hotel-Exterior-2-RTS.jpg', 'https://a1.muscache.com/im/pictures/107197265/74d96ba9_original.jpg?aki_policy=x_medium', 'https://static.tripping.com/partners/vrbo/images/vrbo-792804-1340742/3e7c5c4ef4d777bdf3fa8aa9255a6c62_icon_large.jpg', 'http://mccrnow.com/wp-content/uploads/2015/06/The-deck-of-one-of-our-Murphy-North-Carolina-vacation-rentals.jpg', 'https://a2.muscache.com/im/pictures/110792345/5e015093_original.jpg?aki_policy=x_medium', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_2680/jump_off_rock_lake_joe_4_large.jpg', 'http://imagesus.homeaway.com/mda01/a5f3cfe4-0aee-4a62-8078-ec640d5cdda0.1.6', 'http://masterdiamondvacationrentals.com/wp-content/uploads/2015/08/home.jpg', 'https://imagesus-ssl.homeaway.com/mda01/bdfa1a25-dbce-491c-a4a6-2057374f4352.1.6', 'https://mychaletfinder.com/resorts/big-sky/headers/lone-mountain-mychaletfinder.jpg', 'http://village-properties.com/wp-content/uploads/2016/01/5-Quartz-Front-6.jpg', 'https://static.tripping.com/partners/homeawayinstabook/images/vrbo-779436-1327374/76ebc9a81007a961249801ef5f90acbe_icon_large.jpg', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/102697.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/00/12/8f/ce/top-of-bald-mountain.jpg', 'http://www.myourayvacation.com/images/album22_exterior_lg.jpg', 'http://cdn.liverez.com/5/11357/1/46972/550/1.jpg?v=11/11/2015', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_4244/1_large.jpg', 'http://www.coloradodirectory.com/pioneerridge/images/Pioneer-Ridge-IS-LG.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4442.jpg', 'http://imagesus.homeaway.com/mda01/8ced2212-4bc8-493f-b31c-87b6002c4a6f.1.6', 'http://www.angelfire.com/super2/greece/kreta/kreta-winter12.JPG', 'http://smokymtndreams.com/blog/wp-content/uploads/2013/09/CP-Sept-1-News.jpg', 'http://cdn.liverez.com/5/11357/1/99942/550/1.jpg?v=11/10/2015', 'http://www.ownerdirect.com/images/925187-listing.jpg', 'http://q-ec.bstatic.com/images/hotel/max400/318/31803842.jpg', 'http://franconiarentals.com/Portals/_franconiares/images/default/Naturals/Cannon%20Mountain%201.JPG', 'http://thumbs.dreamstime.com/t/mountain-cabin-rentals-area-around-lake-toxaway-have-many-cabins-rent-all-year-long-which-big-business-area-50444203.jpg', 'http://www.wyndhamvacationrentals.com/images/logo-rq4.png', 'http://www.visitnc.com/contents/imgcrop/10232/1200/630', 'http://lakesideatloonlake.com/Images/house_building2.jpg', 'https://s0.trippng.com/attachments/43702c298ef2c63fb89c0693978580f82df34e42/store/fill/400/275/f26cf79992f6b52a421f8876d3ff1df2b2beebaead989d2ed8e3c251778b/media.jpeg', 'http://www.discovering-east-tennessee.com/images/roan-mountain-vacation-rental.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-498061-1081242/1c96531538e8aac0172e8f812f843512_icon_large.jpg', 'http://www.smith-mountainlakerentals.com/data/1004/image-2-1108.jpg', 'http://lonvacationbyowner.tk/images/Hunter_Mount_inhhwgnfwq6.jpg', 'http://www.yosemiteregionresorts.com/yosemiteregionresorts010001.jpg', 'http://www.cottages-canada.ca/cottages-canada/PhotoChalets/7574-2-vacation-rentals-1127.jpg', 'http://www.jacksonholeproperties.net/images/content/vacation-rentals-1.jpg', 'http://www.petfriendlybanff.com/images/banff-rocky-mountain-resort-pet-friendly-by-owner-vacation-rentals.PNG', 'http://erainthesmokies.com/SMVRmast720x250.jpg', 'http://mountain-realty-guide.com/rentals/ga-vacation-cabin-rentals/blairsville-ga-mountain-lake-vacation-cabin-homes-for-rent/ga-rental-cabin.jpg', 'https://sites.google.com/site/skihouseathuntermountain/_/rsrc/1290296845798/home/winter%20-%20house.JPG?height=212&width=320', 'https://s3-media1.fl.yelpcdn.com/bphoto/_fJSjI5BIg3TKDf45dEi_g/ls.jpg', 'https://s3.amazonaws.com/nresweb/S109/AMR_Home_Intro_640x360.jpg', 'https://www.ownerdirect.com/images/big-white-mountain-vacation-rentals-kw-864517-full.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/00/18/56/18/looking-up-the-mountain.jpg', 'http://nebula.wsimg.com/7154ecb594cd914e32786e91ecc3d97c?AccessKeyId=ACA18B3DA4E3494B4921&disposition=0&alloworigin=1', 'http://cdn1.buuteeq.com/upload/2736/pine-mountain-lake.jpg.1340x450_0_256_17986.jpg', 'https://mychaletfinder.com/resorts/lake-arrowhead/headers/lake-arrowhead-summer.jpg', 'https://www.flipkey.com/img/property_thumb.png', 'http://www.nyvacationrentals.com/propertyphoto/8101_8200/8158_m_6a6d7840ea7b13be.jpg', 'http://www.hrvacations.com/hrvr2012/wp-content/uploads/2014/11/mthouse1.jpg', 'http://www.snowcreekresort.com/resources/features/jpg/SUB_4_0.png', 'http://pictures.escapia.com/MKFRBO/3679350833.jpg', 'http://ellasvacationrentals.com/wp-content/uploads/2016/01/mauintain-view-rentals-1030x352.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/6967/01-IMG_8803.JPG', 'http://www.foscoerentals.com/image.asp?prop_id=540', 'http://www.carolinacabinrentals.com/custimages/BML-BeechMtnSlopemapAdjSize.jpg', 'http://www.maggiemountainvacations.com/images/rental1.jpg', 'https://images.micazu.nl/_images/house/11931/images/avenida_mountain_resort-1.jpg?&width=450&height=300&mode=crop&scale=both', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Guest-Room-1-RTS.jpg', 'http://www.sterlingresorts.com/media/5082b.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-642490-1190271/3c71f9a56823f8d93a5cc3216acf7d63_icon_large.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac443e.jpg', 'http://cdn.securem2.com/commonimages/business/350/2015/1/Townhouses-display.jpg', 'http://www.cottages-canada.ca/cottages-canada/PhotoChalets/7572-2-vacation-rentals-1037.jpg', 'http://cdn.liverez.com/5/11357/1/50207/550/1.jpg?v=11/13/2015', 'http://www.sugarmountainlodging.com/SMLgraphics/sugartop/sugar_top_winter_175.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/1e/81/c8/blackwater-falls.jpg', 'http://www.ncmountainretreats.com/wp-content/uploads/2015/05/VIEW1.jpg', 'http://www.stayvacationrentals.com/resources/listings/pphoto_163607031111_8.jpg', 'http://theindiatravelguide.org/images/2015/7/vermont-vacation-rentals-homes-more_2.jpg', 'http://www.visitnantahalanc.com/images/members/368.jpg', 'http://www.renthelen.com/custimages/helen_ga_waterfall.jpg', 'http://www.emeraldmtn.com/office.jpg', 'http://www.wyndhamvacationrentals.com/pdfdocs/MtnColl_ASP.jpg', 'http://winterparkskilodging.com/images/229_TM2-SE_Outside-ClassicMountainStyle.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-1-valloire-france/modern_vacation_rentals_valloire_france_0012.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4431.jpg', 'https://bsvrblog.files.wordpress.com/2015/02/bigsky-cowboyheaven-cabin.jpg', 'http://www.greatsmokyscabinrentals.com/custimages/Specials/dragon-two-bikes-CS.jpg', 'http://www.lakeretreat.com/images/Lake%20pics/smith_mountain_lake.jpg', 'https://s0.trippng.com/attachments/32f8df1a780eda78a4b1fd99e29dcd0533412de8/store/fill/400/275/371c93196625f6e51b443577e05f15be8929c1ffea893e419343a14be836/media.jpeg', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/creekwood001.jpg', 'http://www.insideedgerentals.com/wp/wp-content/uploads/2014/09/photo-91-940x350.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Home-7-Happy-Trails-Big-Sky-Montana.img?image=487905&thumb&large', 'https://a1.muscache.com/im/pictures/84908087/06d2f392_original.jpg?aki_policy=x_medium', 'http://www.fourseasons.com/content/dam/fourseasons/images/web/VAR/VAR_018_aspect16x9.jpg/jcr:content/renditions/cq5dam.web.468.263.jpeg', 'https://s0.trippng.com/attachments/5ab4ff37e14c2d6e80d943269cbaa6247c337f30/store/fill/400/275/5cd1c318674385cdc10711cfbd165755f86d487713968f4af767b6b4f087/media.jpeg', 'https://s0.trippng.com/attachments/ed885cab80bcfa3b5a67a445b6e60a37f8364c55/store/fill/400/275/544622d4b1b81d9e31af6973e3b8c15862c75ee89f0cc7df4f4a86275a7b/media.jpeg', 'http://beenseen.wpengine.netdna-cdn.com/wp-content/uploads/homes-mosaic-570-01-510.jpg', 'http://photos.vamoose.com/photos/view?file=7AZJV4BVSYZ532PB4H5B.jpg', 'http://cabinsinmissouri.com/images/rooms-rates-top.jpg', 'https://mychaletfinder.com/countries/home-page/destinations/lake-tahoe-cabin-rentals.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Home-7-Mountain-Home-Big-Sky-Montana.img?image=509451&thumb&large', 'https://www.restinthemountains.com/images/theme/slidebg.png', 'https://taosrentalhouse.files.wordpress.com/2014/07/cropped-vacation-rentals-taos-new-mexico1.jpg', 'http://imagesus.homeaway.com/mda01/458da881-9ec3-464f-962d-6c2d43149830.1.6', 'http://images.10kvacationrentals.com/CaineyHollowLogCabin29250/1.jpg', 'http://www.nhliving.com/includes/images/NH_whitemountain_region.jpg', 'http://www.lakegeorge.com/commonimages/business/21214/2016/1/Outside-li.JPG', 'http://photos.vamoose.com/photos/view?file=E5V4H2G9ZLXLESD9X82E.jpg', 'http://www.atthecottage.com/forrent/bluemountain03/blue-mountain-vacation-rentals-01.jpg', 'http://summitatgoremountain.com/assets/images/pages1.jpg', 'https://bc38672f3daa2de33f74-ea9e6325c690d34de3bc32cb75ca35cb.ssl.cf2.rackcdn.com/ff455b0e-6b11-417c-957c-45fbee3a466c.jpg', 'http://mammothvacationrentalsca.com/wp-content/uploads/2014/12/IMG_3214.jpg&w=auto&h=600', 'http://www.brightscreek.com/myimages/staywithus_header.jpg', 'http://www.friorivervacationrentals.com/images/lodging/mountain_ridge/mountain_ridge_311.jpg', 'http://www.vacationrentalsinbend.com/images/mt-bachelor-kids-ski-free.jpg', 'http://imganuncios.mitula.net/ski_whiteface_mountain_vacation_rentals_lake_placidwhiteface_mountain_1260068452457973768.jpg', 'https://imagesus-ssl.homeaway.com/mda01/f9b44d8d-81fe-4cc9-8541-ccd86c2631cc.1.10', 'http://www.bookbigsky.com/custimages/slide4.jpg', 'http://keystone.skyrun.com/media/com_hotproperty/images/std/33_arial%20mountain%20house%20left.jpg', 'http://www.coppercanyoninsider.com/images/copper-canyon-vacation-rental.jpg', 'https://a2.muscache.com/im/pictures/97026230/66cadbd7_original.jpg?aki_policy=x_medium', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/146757.jpg', 'http://carolinalakecabins.com/wp-content/uploads/2014/09/IMG_4545-resized.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/vacation-rentals/europa/france/mountain-apartment-3-valloire-france/modern_vacation_rentals_valloire_france_054-165x110.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2012/09/02/66704/thumb4_img_8283.jpg', 'http://thumbs.dreamstime.com/z/mountain-vacation-rentals-covered-snow-fog-61743322.jpg', 'http://dfjmbylqew68v.cloudfront.net/wp-content/uploads/2015/09/5805600419-614x409.jpg', 'https://cdn1.vox-cdn.com/thumbor/vA1BK3Z8UxsykF8hIWeTVORAeCg=/0x600/cdn0.vox-cdn.com/uploads/chorus_asset/file/4355759/89f738b6-46ea-482c-a3f3-55663f89ffe8.1.10.0.jpeg', 'http://www.luxurymountainvacationrentals.com/media/8220.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/service1.png', 'http://www.sandybottomtrailrides.net/wp-content/uploads/2010/12/asheville-swiss1.jpg', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/81615.jpg', 'http://www.gmvrentals.com/back/home/photo_2.jpg', 'http://www.looncondoconnection.com/rentals/wp-content/uploads/2015/11/bec-loon-resized.jpg', 'http://dx577khz83dc.cloudfront.net/1733/dd609fc4-e8e7-4421-9a1b-e5dfa468021c.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/6957/6-IMG_7941.JPG', 'http://blueridgetravelguide.com/wp-content/uploads/2013/01/ExclusiveMountainProperties.jpg', 'http://www.atthecottage.com/forrent/bluemountain03/blue-mountain-vacation-rentals-12.jpg', 'http://www.vacationhomerentals.com/get_property_image-52128.jpg', 'http://www.wyndhamvacationrentals.com/pdfdocs/CampaignMountainCollection.jpg', 'http://www.myourayvacation.com/images/album3_exterior_lg.jpg', 'http://www.southernresorts.com/bre/uploads/complexes/45/original/Adagio%20Complex.jpg', 'https://assets-edge.vacationhomerentals.com/assets/guidebooks/285/thumb1_huntermountain.jpg', 'http://www.broderickrealestate.com/untitled%20(5).png', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/19527/IMG_6743.JPG', 'http://www.discovering-east-tennessee.com/images/roan-mountain-vacation-rentals.jpg', 'http://www.coloradovacationrentals.com/propertyphoto/3401_3500/3432_t_11374cbfe7e56ed2.jpg', 'http://q-ec.bstatic.com/images/hotel/max400/317/31795033.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/0a/3d/45/bb/deerfield-lodge-at-heavenly.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac444a.jpg', 'http://www.atthecottage.com/forrent/bluemountain02/blue-mountain-chalets-for-rent-04.jpg', 'http://village-properties.com/wp-content/uploads/2016/01/5-Quartz-Living-Room-6.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/43/69/63/steamboat-springs.jpg', 'http://pictures.escapia.com/MKFRBO/0922420093.jpg', 'http://www.realadventures.com/listingimages/1184/1184698/m_1184698a.jpg', 'http://dfjmbylqew68v.cloudfront.net/wp-content/uploads/2015/09/0581450914-614x345.jpg', 'http://www.realadventures.com/listingimages/1021/1021531/m_1021531b.jpg', 'http://www.mountainvistarealestate.com/sites/default/files/imagecache/640X280/photos/600x333/1003.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Home-7-Mountain-Home-Big-Sky-Montana.img?image=509452&thumb&large', 'http://www.sterlingeliteproperties.com/wp-content/uploads/2014/02/slide4-1040x420.jpg', 'http://www.lakealmanorvacation.info/wp-content/uploads/2014/12/Fishing-Man-River-Boots-Photoxpress_7543580.jpg', 'https://s-media-cache-ak0.pinimg.com/236x/e3/fd/34/e3fd346f3cf86c37911390653b2750c0.jpg', 'https://s0.trippng.com/attachments/fbebc218c31d0f422ebf43f4868d7f88ebc4ad25/store/fill/400/275/132e2e279855321fae426e2a2aea5067dfa1e49badaedb7a812ef8127d86/media.jpeg', 'https://imagesus-ssl.homeaway.com/mda01/e1848833-d36b-4b5f-b1e2-13ef28fb5995.1.10', 'http://3wzjx02lrz0n4eo49o21sufks5j.wpengine.netdna-cdn.com/wp-content/uploads/2015/12/Tucked-Away-Galtinburg-Cabin-23_616x440_acf_cropped_274x217_acf_cropped.jpg', 'https://www.ownerdirect.com/images/big-white-mountain-vacation-rentals-kw-864506-full.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_394.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_69.jpg', 'https://s0.trippng.com/attachments/a4451663828486fba4b614b2eb325a29f9ba3bba/store/fill/400/275/0dda0d482a55472e37991999f5c8713b869a1a26058f9d46b91b3022e201/media.jpeg', 'http://www.coppercoloradocondos.com/images/uploads/vacation_rentals_copper_mountain_1.jpg', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Guest-Room-9-DEF.jpg', 'http://st1.itrip.net/upload/360/vail_2.1335576458.jpg', 'http://cdn.liverez.com/5/11357/1/41284/550/1.jpg?v=4/12/2014', 'https://a1.muscache.com/im/pictures/d069e1a1-9976-4733-ab46-4175e1329908.jpg?aki_policy=x_medium', 'https://assets-edge.vacationhomerentals.com/assets/properties/2015/04/09/210305/thumb3_13.jpg', 'https://a1.muscache.com/im/pictures/84410544/2fe54db7_original.jpg?aki_policy=x_medium', 'http://nebula.wsimg.com/b9a5c189fdec2bafc321623d78cfa087?AccessKeyId=4874914F69F49B3767F1&disposition=0&alloworigin=1', 'http://www.realadventures.com/listingimages/1184/1184040/m_1184040a.jpg', 'https://cloud.canadastays.com/photos/sz/940/d44bc8cc6a12045a1a6f1ba012a2b8e3.jpg', 'http://www.rockymountaindreamweddings.com/wp-content/uploads/2014/02/headerlogo1.png', 'http://www.seventhmountain.com/images/img-one-bedroom.jpg', 'http://cdn.liverez.com/5/11357/1/84344/550/1.jpg?v=4/12/2014', 'http://www.summitdaily.com/csp/mediapool/sites/dt.common.streams.StreamServer.cls?STREAMOID=Dz5a_uOqE9DT9sudbKOzWs$daE2N3K4ZzOUsqbU5sYt0ieaIhPoX_$VgV3Um6O$UWCsjLu883Ygn4B49Lvm9bPe2QeMKQdVeZmXF$9l$4uCZ8QDXhaHEp3rvzXRJFdy0KqPHLoMevcTLo3h8xh70Y6N_U_CryOsw6FTOdKL_jpQ-&CONTENTTYPE=image/jpeg', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2015/04/four-seasons-jackson-hole-three-bedroom-resort-residence-with-loft-636x431-300x203.jpg', 'http://usmsswimages.s3.amazonaws.com/5302/29850/3.jpg?1431529719', 'http://pictures.escapia.com/MKFRBO/8884810528.jpg', 'http://www.vacationshouse.com/FILESYSTEM/120411/propertiesFiles/14599/images/IMG_3713.jpg', 'https://secure.instantsoftwareonline.com/StayUSA/PropertyImages/1090/HF300/1.jpg', 'http://www.nyvacationrentals.com/propertyphoto/8001_8100/8039_m_ba6a3403b3d35792.jpg', 'http://how2vacation.com/uploads/image/offers/hp_photo_winter_4.jpg', 'http://cdn.liverez.com/5/11652/1/50850/550/1.jpg?v=10/9/2014', 'http://www.catskillhouserental.com/images-catskillshome/009-11/5873-exterior.jpg', 'http://goremountainrealty.com/img/summit-logo-dark.png', 'http://pictures.escapia.com/MKFRBO/5673830239.jpg', 'https://s0.trippng.com/attachments/8f5e820d3a1f3f78374306778839bb5444012835/store/fill/400/275/e6d6cdb7d05d9713f1d0c7615b656061d0111a308961193a80d999f3a734/media.jpeg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/7003/01.JPG', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_2680/fish_school_02_web_large.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Home-7-Happy-Trails-Big-Sky-Montana.img?image=487906&thumb&large', 'http://carolinalakecabins.com/wp-content/uploads/2014/09/IMG_04501-resized.jpg', 'https://mychaletfinder.com/resorts/cayuga-lake/headers/cayuga-lakesunset-f.jpg', 'http://secure.instantsoftwareonline.com/StayUSA/PropertyImages/2345/Mountain%20Splash%20Lodge/1.jpg', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/foxwood001.jpg', 'http://www.mammothsierraonline.com/rotatingpics/homepic7.jpg', 'http://skisaltlake.com/skiimages/snowbird.snowboarding.jpg', 'http://cdn.securem2.com/commonimages/business/11794/2012/5/14408-11794-120524124200-20432-display.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-221056.jpg', 'http://village-properties.com/wp-content/uploads/2016/01/5-Quartz-Living-Room-2.jpg', 'http://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i14566&2i114371&2e2&3u10&4m2&1u700&2u450&5m5&1e3&5sen-US&6sus&10b1&12b1&token=86534', 'https://a2.muscache.com/im/pictures/101594615/7e8a481d_original.jpg?aki_policy=x_medium', 'http://images1.americanlisted.com/nlarge/300-4000ft-memory-mountain-vacation-rentals-americanlisted_34479623.jpg', 'http://keystone.skyrun.com/media/com_hotproperty/images/std/33_a_DSC03292.jpg', 'http://www.vacationbigsky.com/Moonlight-Mountain-Home-7-Mountain-Home-Big-Sky-Montana.img?image=509450&thumb&large', 'http://static.wixstatic.com/media/73b01f_a6bb3b19bdb440ad8b20b4e36bac959e.png/v1/fill/w_288,h_399,al_c,usm_0.66_1.00_0.01/73b01f_a6bb3b19bdb440ad8b20b4e36bac959e.png', 'http://fresh-structures-news.com/wp-content/uploads/2012/09/Gingerbread-House-inside.jpg', 'http://www.realtywebsites.com/northcarolina/images/sugar-mountain-nc-vacation-rentals-2.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/box1-1.png', 'https://s0.trippng.com/attachments/64873a09920753cab859a8b2bba01e1b68bf02d1/store/fill/400/275/cd5a2acddeaf6b0add01e71fac15a9e759de5b03de35032ad51eed8275a1/media.jpeg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/7039/1-IMG_8681.JPG', 'http://images.locanto.com/1107965507/Smokey-Mountain-Vacation-Rentals-in-Pigeon-Forge-Tn_4.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2013/09/03/72044/thumb4_img_2796.jpg', 'http://www.archersinn.com/wp-content/uploads/2014/02/Pine-Ridge-House-225x100_c.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4437.jpg', 'http://www.mountaintoprentals.net/custimages/Dolly-Sods.jpg', 'http://www.gmvrentals.com/back/rentals/photo_5.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_393.jpg', 'https://static.tripping.com/partners/vrbo/images/vrbo-777608-1325546/654da246072fdc25a1a4b16714fa980b_icon_large.jpg', 'http://pictures.escapia.com/MKFRBO/5684620104.jpg', 'https://media.licdn.com/mpr/mpr/shrink_200_200/AAEAAQAAAAAAAAaUAAAAJGFiZjUzZmM3LTJiOWItNDY4ZS05Y2RmLThlNTA4YTBmYWJhNg.png', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/88520.jpg', 'https://static.tripping.com/partners/homeaway/images/vrbo-474162-1057333/f2251eeece4bce2ede3d5a6fbf07837f_icon_large.jpg', 'http://www.aandwrentals.com/fader9.jpg', 'http://steamboat1.com/wp-content/uploads/2014/04/Ski_Sport_7.jpg', 'http://romanticcabin.com/images/romatic-cabin-logo-570-120.jpg', 'https://a2.muscache.com/im/pictures/103809393/e0c5f7ee_original.jpg?aki_policy=x_medium', 'https://www.acervacations.com/wp-content/themes/rezengine-simple/images/placeholder.jpg', 'http://www.rentalsinthepoconos.com/Houses/h648.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i142687&2i205222&2e1&3u11&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=95466', 'http://pictures.escapia.com/SUCOMR/9678740677.jpg', 'http://sugartoprentals.com/wp-content/uploads/2014/01/Sugar-Top-Condos-for-Rent-300x219.jpg', 'http://imagesus.homeaway.com/mda01/6664878a-9d82-498e-b819-0974b4e2da81.1.6', 'http://maggievacations.com/custimages/Raven%20Roost/DSC_0385.JPG', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2015/04/four-seasons-nevis-residence-villa-1412-pool-golf-course-636x431-300x203.jpg', 'http://www.yosemitegoldvacations.com/Portals/_yosemitegoldvacations/images/default/Yosemite_featuer1.jpg', 'https://www.vacationhomerentals.com/get_property_thumb4-76734.jpg', 'https://troutfitters.com/images/uploads/misc/MOUNTAIN-HOME-RENTALS-HOUSE-4.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/6938/gln51lrb.jpg', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Guest-Room-3-DEF.jpg', 'http://www.cabincreeklodge.com/logo.jpg', 'https://www.smokymountaincabinrentals.com/wp-content/uploads/Happy-couple-on-the-deck-of-one-of-our-Smoky-Mountain-vacation-rentals-629x240.jpg', 'http://www.findvacationrentals.com/Rentals/6058/605812.jpg', 'https://s0.trippng.com/attachments/6d276daf40cf58f381a24a407675df0d1b0a4b42/store/fill/400/275/319e7684b09132a73abb99a8d4ebc28d02c5b8c3ccc10fbe421313fa5807/media.jpeg', 'https://a2.muscache.com/im/pictures/edc7d049-8f4f-4aed-9b9d-8c3efd6ab2ca.jpg?aki_policy=x_medium', 'https://cdn-www.trails.com/imagecache/articles/295x195/cabin-rentals-crystal-mountain-greenwater-295x195.png', 'http://village-properties.com/wp-content/uploads/2016/01/5-Quartz-Living-Room-7.jpg', 'http://images.familyvacationcritic.com/rentals/thumb_c4d33a55d423d201336bc6c516fe5149.jpg', 'https://a1.muscache.com/im/pictures/9269378/8431769c_original.jpg?aki_policy=x_medium', 'http://mediafront2.alwaysonvacation.com/LSS/images/1731843/14306795659521813263848.jpg', 'http://www.crestmont-inn.com/images/image-top-chase.jpg', 'http://i.ebayimg.com/00/s/MTk5WDMwMA==/z/5eEAAOSw~OVWz29I/$_35.JPG', 'http://www.discovering-east-tennessee.com/images/Roan-Mountain-House.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/05/ee/7e/05/hillcrest-lodge.jpg', 'https://s3-media1.fl.yelpcdn.com/bphoto/4g3s4D9GykccL4kwCYx-Dw/ls.jpg', 'http://www.springcreekvacations.com/images/pic_suites.jpg', 'http://usmsswimages.s3.amazonaws.com/5398/35193/4.jpg?1443198509', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i315428&2i380887&2e1&3u12&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=34086', 'http://dfjmbylqew68v.cloudfront.net/wp-content/uploads/2015/09/72124507271-614x409.jpg', 'http://www.basinviewlodging.com/custimages/slide5.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_1073.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_39.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2016/01/05/234758/thumb3_11.jpg', 'http://www.smithmountainlakerentals.com/custimages/DSC00047small.jpg', 'http://dunerec.com/wp-content/uploads/2013/12/community-alys-beach.jpg', 'https://i.ytimg.com/vi/6yBuc7DMn5M/maxresdefault.jpg', 'http://www.vacationinasheville.com/images/cabins-vistaf.jpg', 'http://www.alwaysonvacation.com/LSS/images/1074631/Mammoth-Lakes4BedroomsSleeps0_13134314491171.jpg', 'http://www.rentalsinthepoconos.com/Houses/h614.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/slider2-1.png', 'http://www.ownerdirect.com/images/1082024-listing.jpg', 'http://images.familyvacationcritic.com/rentals/dfb70f51c0b293055c86b9181ac36681.jpg', 'https://imagesus-ssl.homeaway.com/mda01/3c8490ac-6e2a-4f7e-9dcc-3fa42850ed81.1.10/Bear-Mountain-Chalet-Rec-Room-Breckenridge-Vacation-Rentals.jpg', 'https://assets-edge.vacationhomerentals.com/assets/properties/2016/01/15/45335/thumb4_0a240977_2325_401f_8763_dd36c5e4f81b_1_10.jpg', 'https://imagesus-ssl.homeaway.com/mda01/a8deb9f5-cd8e-4823-827e-5b413f3671b7.1.10', 'http://98.129.89.114/tahoe/55/site/graphics/mountain.jpg', 'http://www.renthighlandsnc.com/images/site/logo.gif', 'http://www.bigbearlake.net/Celebrity-Mountain-Vacation-Rentals/images/Photo-Gallery/Celebrity-Mountain-Vacation-Rentals-13_1000.jpg', 'http://village-properties.com/wp-content/uploads/2016/01/5-Quartz-Kitchen.jpg', 'http://lodging4vacations.com/five-star-vacation-rentals/1-puerto-vallarta4.jpg', 'https://imagesus-ssl.homeaway.com/mda01/e37f7f14-2cbc-4e5d-b64b-6beab7b474df.1.10', 'http://www.holidayislandlodging.com/images/sunsets.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/7071/ss26lrb.JPG', 'http://www.tnetnoc.com/hotelphotos/447/301447/2241284-River-Mountain-Lodge-by-Wyndham-Vacation-Rentals-Guest-Room-4-DEF.jpg', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2015/04/four-seasons-nevis-residence-villa-2001-living-area-view-636x431.jpg', 'http://www.vacationrentalssmithmountainlake.com/App_SiteStyles/images/sml_overlay.png', 'http://images.mtnres.com/Repository/promos/co-op/promo/BluebirdDays16/012216_BluebirdDays_980x380.jpg', 'http://www.vrentals.net/Houses/PA/h265.jpg', 'http://www.atthecottage.com/forrent/bluemountain03/blue-mountain-vacation-rentals-11.jpg', 'http://www.greatsmokyscabinrentals.com/custimages/Specials/Fishing-Boat-LittleTsmall.jpg', 'http://www.rockymountainvacationrentals.com/_images/maps/States/map-colorado.jpg', 'https://bc38672f3daa2de33f74-ea9e6325c690d34de3bc32cb75ca35cb.ssl.cf2.rackcdn.com/224dc1f1-5102-4859-8656-878ed8b7c4f2.jpg', 'http://www.yoursmokymountaincabin.com/wp-content/uploads/2014/09/Pic6-Explore-Your-Smoky-Mountain-Cabin.png', 'http://www.mountainlodges.com/images/mountain_vacation_rental_2.jpg', 'http://www.fernmountain.com/images/809_horsback_riding.JPG', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2015/04/four-seasons-nevis-residence-woman-view-636x431-300x203.jpg', 'http://mountaingetawaysvacationrentals.com/rentals.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_352.jpg', 'http://www.vacationinasheville.com/images/cabins-vistad.jpg', 'http://us.vacationrentalslist.com/img/mountain-vacation-rental-home-145128.jpg', 'https://imagesus-ssl.homeaway.com/mda01/8cd8b19b-708d-41a1-85c2-5b0db180bad0.1.10', 'http://cdn1.buuteeq.com/upload/2736/img-6283-2.JPG.420x210_0_74_2712.JPG', 'http://www.gmvrentals.com/back/rentals_photos/photo_199.jpg', 'http://www.forrentinthemountains.com/img/For-Rent-Map.png', 'http://www.killingtongroup.com/wp-content/uploads/2015/06/Killington-mountain-vacation-rentals-ski-snowboard-5.jpg', 'http://www.trvacationrentals.com/images/rentals/mountainHome.jpg', 'http://keystone.skyrun.com/media/com_hotproperty/images/std/35_mountain%20house%20from%20lifts.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i430012&2i797519&2e1&3u13&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=80453', 'http://photos.vamoose.com/photos/view?file=XQEJER4ZWM3PF8U54765.jpg', 'http://photos.vamoose.com/photos/view?file=NZ26BQWRT6B43PU4XQ86.jpg', 'http://www.findvacationrentals.com/Rentals/12564/e_lumberjck_couch.jpg', 'http://www.norgesbooking.com/Temp/dd445033ae9099c829cde0f1646ff732_8b076510fa4949efa771f227773b98ed.jpg', 'http://www.rentmeavacation.com//vacation-rental-photos/rental_2347/winter-park-mountain_large.jpg', 'http://nebula.wsimg.com/7fa5b264636f402f81df8e01bff7780b?AccessKeyId=ACA18B3DA4E3494B4921&disposition=0&alloworigin=1', 'https://mychaletfinder.com/resorts/copper-mountain/headers/copper-village-header2.jpg', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Beach-Rentals-at-Blue-Mountain-Beach-8363353.jpg?width=185', 'https://www.ownerdirect.com/images/big-white-mountain-vacation-rentals-kw-1024263-full.jpg', 'http://images.locanto.com/1107965506/Smokey-Mountain-Vacation-Rentals-in-Pigeon-Forge-Tn_3.jpg', 'http://www.wyndhamvacationrentals.com/pdfdocs/141676WVRSkiSurveyInfographic_FINAL.jpg', 'http://2.bp.blogspot.com/-6xbOKAnzqpU/VLV_ng9r9II/AAAAAAAAAJA/qm1LmILM4XE/s1600/WVR-Ski-Trends-Report-Cover_282x333.jpg', 'http://www.4seasonsvacations.com/images/logo.jpg', 'http://cdn.boutique-homes.com/wp-content/uploads/modern-vacation-rentals-greece-STYLE.jpg', 'http://www.sandpointvacationrentals.com/2010/wp-content/uploads/2010/09/DSCF2167-300x225.jpg', 'http://li4.cdbcdn.com/oh/a17bd060-6a4c-4b12-8221-528b28045b00.jpg?w=230&h=172&f=20', 'http://www.northcarolinamountaincabin.com/images/fallcreek.gif', 'http://www.coloradovacationrentals.com/propertyphoto/3401_3500/3468_m_ef342eb6510671f3.jpg', 'http://www.awaybe.com/wp-content/uploads/2014/09/d685d0e8-220b-4c4c-8e49-ee35852e6da9.1.10', 'http://www.lakeaway.com/images/kayakcandj.jpg', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/73603.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4444.jpg', 'http://www.vacationcabinsblairsville.com/wp-content/uploads/box3-1.png', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2013/10/skiing-vail-mountain-636x4311-300x203.jpg', 'http://www.coppercoloradocondos.com/images/uploads/-Copper_mountain_snow.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_1070.jpg', 'http://lonvacationbyowner.tk/images/Vacation_R_bzkkokkhhg5.jpg', 'http://li5.cdbcdn.com/oh/b2e099d3-8bce-48e9-8c40-2f508569781b.jpg?w=230&h=172&f=20', 'http://www.ownerdirect.com/images/1057149-listing.jpg', 'http://telluridemountainvillagerentals.com/wp-content/uploads/2015/07/little_wolf_condo_bedroom_three_tn-700x480.jpg', 'http://lodging4vacations.com/mammothjetliving/1-mammoth-mountain.jpg', 'http://imagesus.homeaway.com/mda01/5eca64cb5e0a65c70a40611afb72b764f39d51f1', 'https://maps.googleapis.com/maps/api/staticmap?channel=fk.desktop&sensor=false&language=en_US&center=37.075996,-79.645386&size=195x157&maptype=roadmap&icon=http://s1.fkimg.com/img/maps/marker_property_default.png&markers=icon:http://s1.fkimg.com/img/maps/marker_property_default.png%7C37.099293,-79.632909%7C37.163506,-79.704254%7C37.099214,-79.63272%7C37.056061,-79.607213%7C37.069065,-79.544861%7C37.088505,-79.564362%7C37.055181,-79.540984%7C37.154755,-79.67334%7C37.043201,-79.598534%7C36.942936,-79.520126%7', 'http://www.nyvacationrentals.com/propertyphoto/1801_1900/1866_m_2f650ec8a7d8a1de.jpg', 'http://reservations.golfviewvacationrentals.com/PropertyPictures/3208%20Mountain%20Retreat3208-hillcrest-HR-5520.jpg', 'http://photos.vamoose.com/photos/view?file=6UDQSPMKHQZWBU8UZ3SX.jpg', 'http://media-cdn.tripadvisor.com/media/photo-o/03/96/4c/16/arbor-house-of-black.jpg', 'http://pictures.escapia.com/NOMICH/4502160325.jpg', 'http://myhighlandsncrental.com/wp-content/uploads/2011/03/header-spring1.jpg', 'http://www.30aescapes.com/custimages/blue-mountain-beach-rentals.jpg', 'http://romanticcabin.com/cabins/lake-memory/alm-lake-nantahala-nc-log-cabin-jacuzzi-hot-tub-for-rent-600.jpg', 'http://imagesus.homeaway.com/mda01/fafddeb4fa0ddfb86e6067c5cb43e19adef9103f', 'http://myislandbungalow.com/images/09/high-res/kauai-mountain-rainbow-over-beach-house-rental.jpg', 'http://reservations.golfviewvacationrentals.com/PropertyPictures/3208%20Mountain%20Retreat3208-hillcrest-HR-5526.jpg', 'http://www.smokymtngetaways.net/images/rentals.png', 'http://mammothvacationrentalsca.com/wp-content/uploads/2015/05/mammoth-logo-large-final.png', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/6960/Chestnut_Ridge_and_Misc_324.JPG', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Blue-Mountain-Villas-Rentals-8369310.jpg?width=450&height=413&scale=canvas', 'http://mtshastavacationrentals.com/wp/wp-content/uploads/2014/12/mountain-5-940x350.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_404.jpg', 'http://www.mammothsierraonline.com/Mapfiles/map-blank.png', 'http://rentals.deepcreek.com/wp-content/uploads/2015/03/logoweb.jpg', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac443a.jpg', 'http://i734.photobucket.com/albums/ww348/Theresa4sixsuit/mountain-vacation-rentals_zpse8aaf06a.jpg', 'http://www.shenandoahvalleyweb.com/images/shadowmountain.jpg', 'http://www.rentittoday.com/cmsAdmin/uploads/thumb/edgewood001.jpg', 'http://keystone.skyrun.com/media/com_hotproperty/images/std/33_ksmap.jpg', 'http://www.franconianotch.org/library/images/headers/vacation-rentals.gif', 'http://pictures.escapia.com/AMREPR/1819606381.JPG', 'https://www.ownerdirect.com/images/canmore-mountain-vacation-rentals-kw-885582-full.jpg', 'http://www.drivethetop10.com/var/site/storage/images/the-drives/yellowstone-grand-teton-loop/activities-featured-tours/mountain-home-montana-vacation-rentals/6798-1-eng-US/Mountain-Home-Montana-Vacation-Rentals_large.jpg', 'http://i.rentalo.com/images/Snowshoe-Vacation-Rentals-p_356_4283694l.jpg', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Blue-Mountain-Villas-Rentals-8369307.jpg?width=450&height=413&scale=canvas', 'http://media-cdn.tripadvisor.com/media/photo-s/00/1b/bd/f6/killington-mountain.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/46/1d/bf/st-barts.jpg', 'http://photos.vamoose.com/photos/view?file=RD6RDC3S4B2GXHT95W5B.jpg', 'http://www.wyndhamvacationrentals.com/specials/images/steamboat-springs-soccer-tournament-header.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/a5/jamaica.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/3f/6b/e9/big-bear-lake.jpg', 'https://maps.googleapis.com/maps/api/staticmap?channel=fk.desktop&sensor=false&language=en_US&center=50.369446,-119.063614&size=195x157&maptype=roadmap&icon=http://s1.fkimg.com/img/maps/marker_property_default.png&markers=icon:http://s1.fkimg.com/img/maps/marker_property_default.png%7C50.356327,-119.057977%7C50.357977,-119.065749%7C50.359888,-119.072292%7C50.357468,-119.058357%7C50.359837,-119.06103%7C50.357914,-119.064817%7C50.35179,-119.061533%7C50.35143,-119.061641%7C50.361351,-119.060187%7C50.357977,-11', 'https://www.ownerdirect.com/images/kootenay-bc-rockies-riverside-mountain-village-vacation-rentals-kw-899306-full.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/03/9b/30/36/st-martin-st-maarten.jpg', 'http://www.gmvrentals.com/back/rentals_photos/photo_353.jpg', 'https://imagesus-ssl.homeaway.com/mda01/f9f3065d-1ce4-4461-a43e-de2313bb504c.1.10', 'http://mobilepics.luxuryretreats.com/mediastock/med/600x352/1/117/116925_turksandcaicos_bluemountainvillas6_01.jpg', 'http://www.welcometotelluride.com/bg-1-141469.jpeg?u=3815696729', 'http://imagesus.homeaway.com/mda01/abce1459-09f2-407a-a423-c5e2144af105.1.6', 'https://summit.skyrun.com/images/stories/thumbnails/thumb_LakeDillon_Boats-2.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i91759&2i208766&2e1&3u11&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=120376', 'http://www.gmvrentals.com/back/rentals_photos/photo_405.jpg', 'http://mountain-realty-guide.com/rentals/ga-vacation-cabin-rentals/blairsville-ga-mountain-lake-vacation-cabin-homes-for-rent/ga-rental-chalet.jpg', 'http://www.beachguide.com/Highway-30-A-Vacation-Rentals-Bella-Vita---Rentals-8362581.jpg?width=450&height=413&scale=canvas', 'http://images.10kvacationrentals.com/MountainPlazaCO/7.jpg', 'http://www.batescabins.com/batescabinpagelogo3sm.gif', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i1116297&2i1678031&2e1&3u14&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=113127', 'http://us.vacationrentalslist.com/img/loon-mountain-vacation-home-145066.jpg', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_2680/chattooga-bull_sluce-april_07-closeupweb_large.jpg', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_2680/leap_of_faith_large.jpg', 'https://mychaletfinder.com/resorts/copper-mountain/headers/copper-mountain-snow-boarding-mychaletfinder.jpg', 'http://www.coppercoloradocondos.com/images/uploads/Pools.JPG', 'http://www.atthecottage.com/forrent/bluemountain03/blue-mountain-vacation-rentals-09.jpg', 'https://venturesports.files.wordpress.com/2010/07/staff-at-vail-village-rocky-mountain-vacation-rentals-300x195.jpg?w=640', 'http://media-cdn.tripadvisor.com/media/photo-s/01/05/05/f3/coucher-de-soleil-a-grand.jpg', 'http://www.realtywebsites.com/northcarolina/images/sugar-mountain-nc-vacation-rentals-1.jpg', 'https://www.ownerdirect.com/images/red-mountain-accommodations-rossland-cabin-condo-vacation-rentals-kw-1048895-full.jpg', 'http://d1pdyfnmzhu191.cloudfront.net/images/default-source/winter/Deals-Packages-Homepage/juniper_330.jpg?sfvrsn=0&size=400', 'http://www.sml-vacations.com/index.2.jpg', 'http://i.rentalo.com/images/beech-mountain-vacation-rentals-p_33519_625520l.jpg', 'http://www.monarchcabins.com/images/logo2-trans.gif', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4439.jpg', 'http://www.climbeverymountain.com/Florida\'s_Carolina_Connection-1.gif', 'http://www.broderickrealestate.com/DSC09635.JPG', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i107616&2i199290&2e1&3u11&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=38062', 'https://s3-media1.fl.yelpcdn.com/bphoto/yfr1uCtHWDSuyNWVb1X2tw/ls.jpg', 'http://media-cdn.tripadvisor.com/media/photo-s/01/c7/8a/35/worthing-or-near-in-christ.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i140265&2i206080&2e1&3u11&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=80155', 'https://venturesports.files.wordpress.com/2010/07/vail-pass-rocky-mountain-vacation-rentals-225x300.jpg?w=640', 'http://q-ec.bstatic.com/images/hotel/max400/317/31796211.jpg', 'http://images.10kvacationrentals.com/images/adThumbs/25816.jpg', 'http://d1xejl9xcsndu9.cloudfront.net/wp-content/uploads/2013/10/skiing-jackson-hole-mountain-636x4311-300x203.jpg', 'http://www.destinationresortsvail.com/images/inset/perfect-vail-condo.jpg', 'http://usmsswimages.s3.amazonaws.com/5398/35193/2.jpg?1443198508', 'http://cdn.allrockymountain.com/images/cligfx/210908_20140401.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i184435&2i362599&2e1&3u12&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=64099', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i8860173&2i12049232&2e1&3u17&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=56665', 'https://images.ixigo.com/image/upload/t_large,f_auto/draper-south-mountain-vacation-homes-by-utahs-best-vacation-rentals-draper-image-53ab56a6e4b0016844ac4443.jpg', 'http://agent.barefoot.com/DSM/vre/v3cdsm0527/images/properties/20127/sc623lrb.jpg', 'http://seesugar.com/images/logo.jpg', 'http://www.realadventures.com/listingimages/1225/1225203/m_1225203n.jpg', 'http://lonvacationbyowner.tk/images/Montalcino_V_fbuidvzzjj3.jpg', 'http://usmsswimages.s3.amazonaws.com/5398/35193/1.jpg?1441378123', 'http://www.helenga.org/images/imageloading.png?Action=thumbnail&Width=750&Height=335&algorithm=fill_proportional', 'http://www.luxurytucsoncondos.com/wp-content/uploads/2015/10/20131222035541411535000000-o.jpg', 'http://dtsmokies2.com/_shopping/smoky-mountain-vacation-rentals-and-realty-wears-valley-tn.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i183243&2i349465&2e1&3u12&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=72294', 'http://static.tacdn.com/img2/vacationrentals/nifty_fifty/tahoe_california_map.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i215579&2i398298&2e1&3u12&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=4674', 'http://www.seejh.com/wp-content/uploads/2015/02/Rendezvous-Mountain-Rentals1.jpg&w=300&h=200', 'http://www.cherrymountaincottages.com/wp-content/uploads/2014/10/Seating-Area-header.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i4867172&2i6245079&2e1&3u16&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=114722', 'http://images.10kvacationrentals.com/images/adThumbs/21604.jpg', 'https://d13yacurqjgara.cloudfront.net/users/213829/screenshots/2301789/lookout_1x.png', 'http://www.nhliving.com/ean/tripadvisor-rentals-300.gif', 'http://www.4seasonsvacations.com/images/SliderHome5.jpg', 'http://www.foscoerentals.com/Uploads/aiden.jpg', 'https://resources.vrbo.com/resources/44072/images/VRBO_Map_CO_Breck_BaldyMtn.gif', 'http://www.mountainlodges.com/images/mountain_vacation_rental_3.jpg', 'http://seal-chattanooga.bbb.org/seals/blue-seal-150-110-mountainlaurelcabinrentals-40056493.png', 'http://images.longandfoster.com/images/LFVacationRentals-Logo.jpg', 'http://www.sunburstbeachvacations.com/vacation/common/displaythumb.ashx?PropertyId=232', 'http://globalfinance.zenfs.com/images/US_AFTP_MarketWire_XHTML/141676WVR_Ski_Survey_Infographic_FINAL-620333243316_original.jpg', 'https://d33zkqzv7i9ae0.cloudfront.net/images/500/89437.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i362166&2i719288&2e1&3u13&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=44280', 'http://www.welcometotelluride.com/bg-2b-141469.jpeg?u=1705069759', 'http://www.rpmbigsky.com/images/location-mountain-rentals.png', 'http://www.rentmeavacation.com/vacation-rental-photos/rental_2680/lakejo07-05c_large.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i44711&2i104460&2e1&3u10&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=37415', 'http://d1pdyfnmzhu191.cloudfront.net/images/default-source/winter/Homepage-Headlines/trail_map_360.jpg?sfvrsn=0&size=480', 'http://www.mammothsierraonline.com/homepics-overlay2.png', 'http://q-ec.bstatic.com/images/hotel/max400/317/31795041.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i550965&2i831408&2e1&3u13&4m2&1u327&2u470&5m5&1e0&5sen&6sus&10b1&12b1&token=3440', 'https://irp-cdn.multiscreensite.com/8a105185/dms3rep/multi/tablet/vrbo2-363x312.jpg', 'https://cms.homeaway.com/files/live/sites/hub/files/contributed/homepage/marketing/HA_TVC_END_FRAME_US.jpg', 'http://i.ebayimg.com/00/s/NDgwWDY0MA==/z/tSkAAOSwWTRWyxAn/$_35.JPG', 'http://static.tacdn.com/img2/vacationrentals/nifty_fifty/big_bear_lake_map.jpg', 'http://d1pdyfnmzhu191.cloudfront.net/images/default-source/winter/Homepage-Headlines/rentals_360.jpg?sfvrsn=0&size=480', 'http://static.tacdn.com/img2/arrows/white-drawn-arrow-right.png', 'http://d1pdyfnmzhu191.cloudfront.net/images/default-source/winter/winter-activities/scenic_gondola_winter_new_330.jpg?sfvrsn=0&size=400', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i36069&2i55705&2e1&3u9&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=96032', 'http://d1pdyfnmzhu191.cloudfront.net/images/default-source/winter/Homepage-Rotators/rentals_web_rotator_1500x530.jpg?sfvrsn=0&size=1100', 'http://www.elkriverinnandrestaurant.com/top.jpg', 'http://www.myourayvacation.com/images/book%20online.jpg', 'https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&1i8834&2i13831&2e1&3u7&4m2&1u320&2u400&5m5&1e0&5sen&6sus&10b1&12b1&token=81847', 'http://d1pdyfnmzhu191.cloudfront.net/images/librariesprovider4/Photo-Video-Gallery/2014-04-06_june-mountain-family_915_1000px.jpg?sfvrsn=0', ];
95.469758
517
0.798492
7df5e6d236809512525c285005a663e7c3bd890f
3,232
js
JavaScript
src/screens/UserEntry.js
MeanBoyCousin/beer-compare
de03bb33598895204623cc09a7b7646167e40be5
[ "MIT" ]
null
null
null
src/screens/UserEntry.js
MeanBoyCousin/beer-compare
de03bb33598895204623cc09a7b7646167e40be5
[ "MIT" ]
null
null
null
src/screens/UserEntry.js
MeanBoyCousin/beer-compare
de03bb33598895204623cc09a7b7646167e40be5
[ "MIT" ]
null
null
null
import React, { useState } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Link } from 'react-router-dom' import { container } from '../motion/variants' import { BeerEntryCard } from '../components/UserEntry/BeerEntryCard' const UserEntry = ({ drinksState: { drinks, setDrinks }, lightMode }) => { const [currentDrink, setCurrentDrink] = useState(1) return ( <motion.div key="UserEntryContainer" className="container" variants={container} initial="hidden" animate="animate" exit="exit" > <h1 className="text-3xl w-4/5">Beer Compare</h1> <h2 className="text-sm pb-2 w-4/5"> Compare your beers, cut those calories! </h2> <hr className={ lightMode ? 'border-primary-dark opacity-disabled mt-2 mb-4 w-full' : 'border-darkmode-primary-dark opacity-disabled mt-2 mb-4 w-full' } /> <AnimatePresence initial={false} exitBeforeEnter> {currentDrink === 1 ? ( <BeerEntryCard key={`BeerEntryCard${currentDrink}`} drinksState={{ drinks, setDrinks }} currentDrink={currentDrink} objectRef="drinkOne" lightMode={lightMode} /> ) : ( <BeerEntryCard key={`BeerEntryCard${currentDrink}`} drinksState={{ drinks, setDrinks }} currentDrink={currentDrink} objectRef="drinkTwo" lightMode={lightMode} /> )} </AnimatePresence> <div className="flex justify-evenly w-4/5 mt-4 mb-8 flex-none"> <button className={ currentDrink === 1 ? lightMode ? 'disabled-btn' : 'disabled-btn-dark' : lightMode ? 'active-btn' : 'active-btn-dark' } onClick={() => { setCurrentDrink(1) }} > Prev Beer </button> {currentDrink === 1 ? ( <button className={lightMode ? 'active-btn' : 'active-btn-dark'} onClick={() => { setCurrentDrink(2) }} > Next Beer </button> ) : ( <Link className={lightMode ? 'active-btn' : 'active-btn-dark'} to="/pick" > Compare </Link> )} </div> </motion.div> ) } export { UserEntry }
35.911111
90
0.393255
7df6545877476d0b4941539e550f56d24661e60e
479
js
JavaScript
doczrc.js
vikasmagar512/react-structured-query-search-with-suggestions
d3d27e07775c756ca0b6c0a398ee8bb8a7cf2d22
[ "MIT" ]
null
null
null
doczrc.js
vikasmagar512/react-structured-query-search-with-suggestions
d3d27e07775c756ca0b6c0a398ee8bb8a7cf2d22
[ "MIT" ]
null
null
null
doczrc.js
vikasmagar512/react-structured-query-search-with-suggestions
d3d27e07775c756ca0b6c0a398ee8bb8a7cf2d22
[ "MIT" ]
null
null
null
module.exports = { title: "React Structured Query Search With Suggestions", themeConfig: { showPlaygroundEditor: true }, base: "/react-structured-query-search-with-suggestions/", menu: ["Introduction", "Getting Started", "Props"], onCreateWebpackChain: (config) => { // Allow CSS imports config.module .rule('scss') .test(/\.css|scss|sass$/) .use('style') .loader('style-loader') .end() .use('css') .loader('css-loader') .end(); }, };
23.95
58
0.63048