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
8eecefa54246992c384c489ee006933f39e53fe7
242
js
JavaScript
a03/src/medium/data/stats_helpers.js
adamalston/comp426
0de9ee1fe104f89607be398c11d42d4a5acc774e
[ "MIT" ]
null
null
null
a03/src/medium/data/stats_helpers.js
adamalston/comp426
0de9ee1fe104f89607be398c11d42d4a5acc774e
[ "MIT" ]
null
null
null
a03/src/medium/data/stats_helpers.js
adamalston/comp426
0de9ee1fe104f89607be398c11d42d4a5acc774e
[ "MIT" ]
null
null
null
export function variance(array, mean) { return array.map(function (sample) { return Math.pow(mean - sample, 2); }) .reduce(function sum(m, v) { m += v; return m; }, 0) / array.length; }
24.2
42
0.508264
8eee5c2a1b9124a7d24ce391110ca56ccf888cae
1,349
js
JavaScript
Jeeel/String/Hash/Base64/Encode.js
DonutsNeJp/Jeeel
bd793d81b396a487561675c046e6e7efddb29f79
[ "MIT-0", "MIT" ]
1
2020-06-01T21:58:10.000Z
2020-06-01T21:58:10.000Z
Jeeel/String/Hash/Base64/Encode.js
DonutsNeJp/Jeeel
bd793d81b396a487561675c046e6e7efddb29f79
[ "MIT-0", "MIT" ]
null
null
null
Jeeel/String/Hash/Base64/Encode.js
DonutsNeJp/Jeeel
bd793d81b396a487561675c046e6e7efddb29f79
[ "MIT-0", "MIT" ]
null
null
null
/** * 指定した文字列に対してbsse64エンコードを行う * * @param {String} str エンコード対象文字列 * @return {String} bsse64文字列 */ Jeeel.String.Hash.Base64.encode = function (str) { str = '' + str; var out, i, len; var c1, c2, c3; len = str.length; i = 0; out = []; while(i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { out[out.length] = this.ENCODE_CHARS.charAt(c1 >> 2); out[out.length] = this.ENCODE_CHARS.charAt((c1 & 0x3) << 4); out[out.length] = "=="; break; } c2 = str.charCodeAt(i++); if (i == len) { out[out.length] = this.ENCODE_CHARS.charAt(c1 >> 2); out[out.length] = this.ENCODE_CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); out[out.length] = this.ENCODE_CHARS.charAt((c2 & 0xF) << 2); out[out.length] = "="; break; } c3 = str.charCodeAt(i++); out[out.length] = this.ENCODE_CHARS.charAt(c1 >> 2); out[out.length] = this.ENCODE_CHARS.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); out[out.length] = this.ENCODE_CHARS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)); out[out.length] = this.ENCODE_CHARS.charAt(c3 & 0x3F); } return out.join(''); };
27.530612
94
0.475908
8eef41926f414c4a8f8896d430511f04b480a57b
5,900
js
JavaScript
js/controllers/videoTexture.js
googlevr/tabel
845ebcea4fb745c5d329b164fa4678cf3bab5748
[ "Apache-2.0" ]
null
null
null
js/controllers/videoTexture.js
googlevr/tabel
845ebcea4fb745c5d329b164fa4678cf3bab5748
[ "Apache-2.0" ]
null
null
null
js/controllers/videoTexture.js
googlevr/tabel
845ebcea4fb745c5d329b164fa4678cf3bab5748
[ "Apache-2.0" ]
2
2018-04-19T11:29:04.000Z
2022-01-13T11:23:48.000Z
/** * Copyright 2016 Google Inc. 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. */ import { bindAll } from "mout/object"; import { vent } from "../vent"; import { get } from "../model"; import { Texture, RepeatWrapping, MeshBasicMaterial, DoubleSide, Mesh, LinearFilter } from "three"; export class CostumEvent { constructor( type ) { this.type = type; } } export class VideoMesh extends Mesh { constructor( geometry, videoTexture ) { const material = new MeshBasicMaterial( { side: DoubleSide, map: videoTexture } ); super( geometry, material ); this.videoTexture = videoTexture; const forwardEvent = this.dispatchEvent.bind( this ); videoTexture.addEventListener( "playing", forwardEvent ); videoTexture.addEventListener( "ready", forwardEvent ); videoTexture.addEventListener( "pause", forwardEvent ); } load() { this.videoTexture.loadVideo(); } update() { this.videoTexture.update(); } play() { this.videoTexture.play(); } pause() { this.videoTexture.pause(); } resume() { this.videoTexture.play(); } stop() { this.videoTexture.stop(); } seek( percent ) { return this.videoTexture.seek( percent ); } get progress() { return this.videoTexture.progress; } get time() { return this.videoTexture.time; } set time( value ) { this.videoTexture.time = value; } get isPlaying() { return this.videoTexture.isPlaying; } } export class VideoTexture extends Texture { constructor( modelName, width, height, progressEventName, flip = false ) { const video = document.createElement( "video" ); video.crossOrigin = "anonymous"; video.width = width; video.height = height; video.volume = 0; super( video ); bindAll( this, "onLoadProgress", "onCanPlayThrough", "onVideoReady", "onPlaying", "onPause" ); this.eventName = progressEventName; this.video = video; this.lastUpdate = 0; this.magFilter = LinearFilter; this.minFilter = LinearFilter; if ( flip ) { this.wrapS = RepeatWrapping; this.repeat.x = - 1; } this.appendSourceTags( modelName ); } appendSourceTags( modelName ) { const object = get( modelName ); let source; // We need to make sure that MP4 is tried first [ "mp4", "webm" ].forEach( ( key ) => { source = document.createElement( "source" ); source.setAttribute( "type", "video/" + object[ key ].split( "." ).pop() ); source.setAttribute( "src", object[ key ] ); this.video.appendChild( source ); } ); } loadVideo() { this.video.load(); this.video.play(); this.video.addEventListener( "progress", this.onLoadProgress ); // if no progress is indicated after 0.5 minutes, we go ahead // and play anyway. this.timeout = setTimeout( () => { vent.emit( this.eventName, 1 ); this.sendReadyUpdate(); }, 30000 ); } sendReadyUpdate() { this.video.removeEventListener( "progress", this.onLoadProgress ); this.video.removeEventListener( "canplaythrough", this.onCanPlayThrough ); this.video.addEventListener( "playing", this.onPlaying ); this.video.addEventListener( "pause", this.onPause ); this.dispatchEvent( new CostumEvent( "ready" ) ); } onLoadProgress() { let percent; try { percent = this.video.buffered.end( 0 ) / this.video.duration; clearTimeout( this.timeout ); } catch ( exception ) { percent = ( this.video.currentTime / this.video.duration ) || 0 ; } const goal = 0.05; const goalPercent = percent / goal; vent.emit( this.eventName, Math.min( goalPercent, 1 ) ); if ( percent >= goal) { this.video.removeEventListener( "progress", this.onLoadProgress ); this.video.pause(); this.video.currentTime = 0; clearTimeout( this.timeout ); setTimeout( this.sendReadyUpdate.bind( this ), 100 ); } } onPlaying() { this.dispatchEvent( new CostumEvent( "playing" ) ); } onPause() { this.dispatchEvent( new CostumEvent( "pause" ) ); } update() { this.needsUpdate = true; } play() { this.video.volume = 1; this.video.play(); } pause() { this.video.pause(); } stop() { this.video.pause(); this.video.currentTime = 0; } seek( percent ) { this.video.pause(); this.video.currentTime = percent * this.video.duration; setTimeout( () => { this.video.play(); } ); } get progress() { return this.video.currentTime / this.video.duration; } get time() { return this.video.currentTime; } set time( value ) { this.video.currentTime = value; } get isPlaying() { return ! this.video.paused; } }
23.694779
90
0.571186
8eefef530db7f4b9497d404bf94b6e962da74b7e
2,503
js
JavaScript
src/integration.js
rreusser/spacetime.js
7388039094051ff0a485ed0923d81acef2246f99
[ "MIT" ]
13
2015-04-24T19:30:17.000Z
2017-04-21T02:55:32.000Z
src/integration.js
rreusser/spacetime.js
7388039094051ff0a485ed0923d81acef2246f99
[ "MIT" ]
1
2015-04-25T02:26:28.000Z
2016-02-04T19:24:29.000Z
src/integration.js
rreusser/spacetime.js
7388039094051ff0a485ed0923d81acef2246f99
[ "MIT" ]
null
null
null
window.Spacetime = window.Spacetime || {}; window.Spacetime.Integration = (function(Spacetime, Math) { 'use strict'; var FunctionIntegrators = { trapezoidal: function() { var h = this.h; var sum = 0; sum += this.f(this.a,this.data) * 0.5; sum += this.f(this.b,this.data) * 0.5; for(var i=1; i<this.bins; i++) { sum += this.f( this.a + i*h, this.data ); } return sum * h; }, simpson: function(integrator) { if( this.bins %2 !== 0 || this.bins < 2 ) { throw new RangeError("Simpson Integrator: Invalid number of bins ("+this.bins+"). Bins must be even."); } var h = this.h; var sum = 0; sum += this.f(this.a, this.data); sum += this.f(this.b, this.data); for(var i=1; i<this.bins; i++) { sum += (i%2===0 ? 2 : 4 ) * this.f( this.a + i*h, this.data ); } return sum * h / 3; }, }; var addMethod = function(method) { FunctionIntegrators[method] = function() { // The initial condition is zero since the integral from x=a to x=a // is zero: var y = [0]; // Integrating functions of a single variable is a special case of // integrating an ODE, so take the more general ODE integrators and // specialize them to function integration: var integrand = function(dydt,y,t,data) { dydt[0] = this.f(t, data); }.bind(this); var i = new Spacetime.ODE.Integrator(integrand, y, { method: method, dt: this.h, t: this.a }); i.steps(this.bins); return y[0]; }; }; addMethod('euler'); addMethod('rk2'); addMethod('rk4'); FunctionIntegrators.midpoint = FunctionIntegrators.rk2; var Integrator = function Integrator( f, a, b, options ) { this.f = f; this.a = a; this.b = b; var defaults = { bins: 100, method: 'simpson' }; Spacetime.Utils.extend(this, defaults, options); this.integrator = FunctionIntegrators[this.method].bind(this); }; Object.defineProperties( Integrator.prototype, { h: { get: function() { return (this.b - this.a) / this.bins; } } }); Integrator.prototype.integrate = function(method) { return this.integrator(this); }; var Integrate = function Integrate( f, a, b, options ) { return (new Integrator(f,a,b,options)).integrate(); }; return { Integrator: Integrator, Integrate: Integrate }; }(window.Spacetime, Math));
25.03
111
0.570515
8ef01608eec60d1b3d076e63c1ee8ee2f7f8926e
3,762
js
JavaScript
client/src/containers/requester/Packs.js
knagware9/sawtooth-next-directory
be80852e08d2b27e105d964c727509f2a974002d
[ "Apache-2.0" ]
null
null
null
client/src/containers/requester/Packs.js
knagware9/sawtooth-next-directory
be80852e08d2b27e105d964c727509f2a974002d
[ "Apache-2.0" ]
null
null
null
client/src/containers/requester/Packs.js
knagware9/sawtooth-next-directory
be80852e08d2b27e105d964c727509f2a974002d
[ "Apache-2.0" ]
1
2018-12-07T10:55:08.000Z
2018-12-07T10:55:08.000Z
/* Copyright 2018 Contributors to Hyperledger Sawtooth 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. ----------------------------------------------------------------------------- */ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Container, Grid, Label } from 'semantic-ui-react'; import PropTypes from 'prop-types'; import { RequesterSelectors } from '../../redux/RequesterRedux'; import Chat from '../../components/chat/Chat'; import TrackHeader from '../../components/layouts/TrackHeader'; import ApprovalCard from '../../components/layouts/ApprovalCard'; import RolesList from '../../components/layouts/RolesList'; import './Packs.css'; import glyph from '../../images/header-glyph-pack.png'; /** * * @class Packs * @description Packs component * * */ export class Packs extends Component { static propTypes = { getRole: PropTypes.func, }; /** * Entry point to perform tasks required to render * component. Get detailed info for current pack and if the * role is in approval state, get proposal info. */ componentDidMount () { const { getPack, packId } = this.props; packId && !this.pack && getPack(packId); } /** * Called whenever Redux state changes. If pack or proposal state * changes, update info. * @param {object} prevProps Props before update * @returns {undefined} */ componentDidUpdate (prevProps) { const { getPack, packId } = this.props; if (prevProps.packId !== packId) !this.pack && getPack(packId); } /** * Render entrypoint * @returns {JSX} */ render () { const { packId, packFromId } = this.props; this.pack = packFromId(packId); if (!this.pack) return null; return ( <Grid id='next-requester-grid'> <Grid.Column id='next-requester-grid-track-column' width={11}> <TrackHeader glyph={glyph} waves title={this.pack.name} {...this.props}/> <div id='next-requester-packs-content'> { this.request && this.request.status === 'OPEN' && <ApprovalCard request={this.request} {...this.props}/> } <Container id='next-requester-packs-description-container'> <Label>Description</Label> <div id='next-requester-packs-description'> {this.pack.description} </div> </Container> <Label>Roles</Label> <RolesList activePack={this.pack} {...this.props}/> </div> </Grid.Column> <Grid.Column id='next-requester-grid-converse-column' width={5}> <Chat type={0} title={this.pack.name + ' Conversations'} activeRole={this.pack} {...this.props}/> </Grid.Column> </Grid> ); } } const mapStateToProps = (state, ownProps) => { const { params } = ownProps.match; const { packs } = state.requester; return { packId: RequesterSelectors.idFromSlug(state, packs, params.id), }; }; const mapDispatchToProps = (dispatch) => { return {}; }; export default connect(mapStateToProps, mapDispatchToProps)(Packs);
27.26087
80
0.605529
8ef1ba8060cba3b8da9c2c46ee3e05dc3efb9ed5
496
js
JavaScript
frontend/src/components/assortment/LabelList.js
StichtingIAPC/swipe
d1ea35a40813d2d5e9cf9edde33148c0a825efc4
[ "BSD-3-Clause-Clear" ]
null
null
null
frontend/src/components/assortment/LabelList.js
StichtingIAPC/swipe
d1ea35a40813d2d5e9cf9edde33148c0a825efc4
[ "BSD-3-Clause-Clear" ]
null
null
null
frontend/src/components/assortment/LabelList.js
StichtingIAPC/swipe
d1ea35a40813d2d5e9cf9edde33148c0a825efc4
[ "BSD-3-Clause-Clear" ]
null
null
null
import React from 'react'; import AssortmentLabel from './AssortmentLabel'; export default function LabelList({ labels, insert, ...rest }) { const Insert = insert; return <div {...rest}> {[].concat(Object.entries(labels).map(([ ltID, values ]) => values.map( lValue => ( <AssortmentLabel key={`${ltID}-${lValue}`} labelTypeID={Number(ltID)} labelValue={lValue}> {Insert ? <Insert value={lValue} typeID={ltID} /> : null} </AssortmentLabel> ) ) ))} </div>; }
26.105263
95
0.622984
8ef293a12e9d2d899c2eab89cd29faf063c0898d
631
js
JavaScript
packages/hoc/src/withWhiteSpace/index.js
wjmcg/govuk-react
09a08d91a0fa17f93a760b4f5bd1e85333d9107b
[ "MIT" ]
1
2021-01-28T08:29:57.000Z
2021-01-28T08:29:57.000Z
packages/hoc/src/withWhiteSpace/index.js
wjmcg/govuk-react
09a08d91a0fa17f93a760b4f5bd1e85333d9107b
[ "MIT" ]
null
null
null
packages/hoc/src/withWhiteSpace/index.js
wjmcg/govuk-react
09a08d91a0fa17f93a760b4f5bd1e85333d9107b
[ "MIT" ]
null
null
null
import styled from 'styled-components'; import { spacing } from '@govuk-react/lib'; import deprecate from '../deprecate'; // NB withWhiteSpace HOC is DEPRECATED // Please use `spacing.withWhiteSpace(config)` instead in styled components const withWhiteSpace = config => Component => { const StyledHoc = styled( deprecate( Component, '(use of withWhiteSpace HOC - Please use `spacing.withWhiteSpace(config)` instead in styled components)' ) )(spacing.withWhiteSpace(config)); StyledHoc.propTypes = { ...spacing.withWhiteSpace.propTypes, }; return StyledHoc; }; export default withWhiteSpace;
25.24
110
0.719493
8ef2ea198e43ab874386438ef77da4531038e3b8
1,024
js
JavaScript
resources/js/components/ShowBerita.js
Abanx/websitebankaceh
3e4cb5f15aab462975eb99e73a9c6f5121a7ea93
[ "MIT" ]
null
null
null
resources/js/components/ShowBerita.js
Abanx/websitebankaceh
3e4cb5f15aab462975eb99e73a9c6f5121a7ea93
[ "MIT" ]
null
null
null
resources/js/components/ShowBerita.js
Abanx/websitebankaceh
3e4cb5f15aab462975eb99e73a9c6f5121a7ea93
[ "MIT" ]
null
null
null
import React from 'react'; import ReactDOM from 'react-dom'; import {Button, CssBaseline, Grid, makeStyles} from '@material-ui/core'; import Navbar from './include/Navbar'; import Footer from './include/Footer'; import BeritaPage from './berita/BeritaPage'; export default function ShowBerita(props) { const useStyles = makeStyles((theme) => ({ root: { backgroundColor: "white" } })); const classes = useStyles(); return ( <Grid container xs={12} justify="center" spacing={0}> <CssBaseline/> {/* Navbar Menu Segmen */} <Grid item xs={12}> <Navbar/> </Grid> <Grid item xs={12} style={{minHeight:350}}> <BeritaPage/> </Grid> <Grid item xs={12}> <Footer/> </Grid> </Grid> ) } if (document.getElementById('show_berita_div')) { ReactDOM.render(<ShowBerita />, document.getElementById('show_berita_div')); }
28.444444
80
0.553711
8ef31cf4382aa940beb377f471bd72613f2eedfd
549
js
JavaScript
react/router-demo/src/component/nav.js
liushuiyuan001/learn-vue
16da252e140b39d0c86c6f41a52612520ed7204d
[ "MIT" ]
null
null
null
react/router-demo/src/component/nav.js
liushuiyuan001/learn-vue
16da252e140b39d0c86c6f41a52612520ed7204d
[ "MIT" ]
null
null
null
react/router-demo/src/component/nav.js
liushuiyuan001/learn-vue
16da252e140b39d0c86c6f41a52612520ed7204d
[ "MIT" ]
null
null
null
import React, { Fragment } from 'react' import { navs } from '../router/router' import { NavLink, useLocation } from 'react-router-dom' export default function Nav() { let { pathname } = useLocation() return ( <div> <span>|</span> { navs.map(item => { return <Fragment key={item.to}> <NavLink to={item.to} exact={item.exact} isActive={item.isActive ? () => { return item.isActive(pathname) } : null} > {item.title} </NavLink> </Fragment> }) } </div> ) }
20.333333
55
0.544627
8ef656952c9190631d8ff55b921f7a2ea444239f
759
js
JavaScript
addon/-private/functions.js
sandstrom/ember-could-get-used-to-this
bae59452ee8ee867107bcf4f0d73605a0dc3ff3c
[ "MIT" ]
39
2020-10-26T02:42:25.000Z
2021-09-15T23:11:59.000Z
addon/-private/functions.js
pzuraq/ember-resource
1a387e9034810074aa244747b31cc5435a5871ef
[ "MIT" ]
27
2020-10-29T04:46:35.000Z
2021-10-02T22:00:50.000Z
addon/-private/functions.js
pzuraq/ember-resource
1a387e9034810074aa244747b31cc5435a5871ef
[ "MIT" ]
7
2020-10-27T16:32:18.000Z
2021-06-11T00:28:10.000Z
import { setHelperManager, capabilities as helperCapabilities, } from '@ember/helper'; import { assert } from '@ember/debug'; class FunctionalHelperManager { capabilities = helperCapabilities('3.23', { hasValue: true, }); createHelper(fn, args) { return { fn, args }; } getValue({ fn, args }) { assert( `Functional helpers cannot receive hash parameters. \`${this.getDebugName(fn)}\` received ${Object.keys(args.named)}`, Object.keys(args.named).length === 0 ); return fn(...args.positional); } getDebugName(fn) { return fn.name || '(anonymous function)'; } } const FUNCTIONAL_HELPER_MANAGER = new FunctionalHelperManager(); setHelperManager(() => FUNCTIONAL_HELPER_MANAGER, Function.prototype);
23
124
0.674572
8efa6c1f1a3177781fa4c02ffcb3ce2c24ff3c3f
3,381
js
JavaScript
lambda/handlers/StartGameIntentHandler.js
dadeke/alexa-skill-jogo-tabuada
367c2b25a681072231a694f63e0cf73044e1c5fe
[ "MIT" ]
6
2019-10-27T16:44:09.000Z
2020-06-16T21:18:13.000Z
lambda/handlers/StartGameIntentHandler.js
dadeke/alexa-skill-jogo-tabuada
367c2b25a681072231a694f63e0cf73044e1c5fe
[ "MIT" ]
null
null
null
lambda/handlers/StartGameIntentHandler.js
dadeke/alexa-skill-jogo-tabuada
367c2b25a681072231a694f63e0cf73044e1c5fe
[ "MIT" ]
1
2020-07-14T17:42:44.000Z
2020-07-14T17:42:44.000Z
const Alexa = require('ask-sdk-core'); const { speaks, b200ms, cardLineBreak } = require('../speakStrings'); const SetAnswerIntentHandler = require('./SetAnswerIntentHandler'); const NoUnderstand = require('../responses/NoUnderstandResponse'); const StartGameIntentHandler = { canHandle(handlerInput) { return ( Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' && Alexa.getIntentName(handlerInput.requestEnvelope) === 'StartGame' ); }, async handle(handlerInput) { const { attributesManager } = handlerInput; const sessionAttributes = attributesManager.getSessionAttributes(); try { const lastIntent = Object.prototype.hasOwnProperty.call( sessionAttributes, 'last_intent', ) ? sessionAttributes.last_intent : false; const questionCount = Object.prototype.hasOwnProperty.call( sessionAttributes, 'question_count', ) ? sessionAttributes.question_count : false; const firstPlayer = Object.prototype.hasOwnProperty.call( sessionAttributes, 'first_player', ) ? sessionAttributes.first_player : false; // Continuar a partida anterior. if (lastIntent === 'LaunchRequest' && questionCount !== false) { sessionAttributes.last_intent = 'ResumeGame'; attributesManager.setSessionAttributes(sessionAttributes); const response = await SetAnswerIntentHandler.handle(handlerInput); return response; } // Verifica se o jogo já está rodando. if (questionCount !== false) { throw new Error( 'The game is already running. Do not enter here at this time.', ); } attributesManager.setSessionAttributes({ last_intent: 'StartGame', question_count: false, }); // Criar uma nova partida. let speakOutput = speaks.ASK_PLAYER_NAME1; let speakOutputCard = speaks.ASK_PLAYER_NAME1; if (lastIntent === 'AMAZON.StopIntent') { // Limpar os dados da persistência. attributesManager.setPersistentAttributes({}); await attributesManager.savePersistentAttributes(); speakOutput = speaks.NEW_GAME + b200ms + speaks.ASK_PLAYER_NAME1; speakOutputCard = speaks.NEW_GAME + cardLineBreak + speaks.ASK_PLAYER_NAME1; } // Pergunta o nome do primeiro jogador. if (firstPlayer === false) { return handlerInput.responseBuilder .speak(speakOutput) .withSimpleCard(speaks.SKILL_NAME, speakOutputCard) .reprompt( speaks.SORRY_NOT_UNDERSTAND + speaks.REPEAT_PLEASE + speaks.ASK_PLAYER_NAME1, ) .getResponse(); } // Pergunta o nome do segundo jogador. return handlerInput.responseBuilder .speak(speaks.ASK_PLAYER_NAME2) .withSimpleCard(speaks.SKILL_NAME, speaks.ASK_PLAYER_NAME2) .reprompt( speaks.SORRY_NOT_UNDERSTAND + speaks.REPEAT_PLEASE + speaks.ASK_PLAYER_NAME2, ) .getResponse(); } catch (error) { const response = await NoUnderstand.getResponse( handlerInput, 'StartGameIntentHandler', error, ); return response; } }, }; module.exports = StartGameIntentHandler;
31.018349
79
0.642709
8efb19b2c50dd7276b3c58db7bf90a0be672686f
556
js
JavaScript
src/node_modules/elasticsearch/aggs/nested.todo.js
nestauk/dapsboard
e36737c2610cf899162bfa379132e7728239d6ab
[ "MIT" ]
1
2020-05-27T09:03:41.000Z
2020-05-27T09:03:41.000Z
src/node_modules/elasticsearch/aggs/nested.todo.js
nestauk/dapsboard
e36737c2610cf899162bfa379132e7728239d6ab
[ "MIT" ]
155
2020-05-12T16:03:38.000Z
2021-02-23T19:32:07.000Z
src/node_modules/elasticsearch/aggs/nested.todo.js
nestauk/dapsboard
e36737c2610cf899162bfa379132e7728239d6ab
[ "MIT" ]
2
2020-05-19T03:14:43.000Z
2020-05-19T03:17:49.000Z
import {esSearchableField} from 'elasticsearch/aggs/ref/typeGroups'; import {string} from 'types'; export default { id: 'nested', availability: { from: '1.3' }, docPath: '/search-aggregations-bucket-nested-aggregation.html', docs: 'A special single bucket aggregation that enables aggregating nested documents.', fieldType: esSearchableField, label: 'Nested', request: { // TODO Check: no `field`, no `missing` path: string }, requestDoc: { path: 'Path of the nested documents within the top level documents.', }, tag: 'bucketing', };
25.272727
88
0.71223
8efc19614487a65c3040a7bfdb06bd456b133880
315
js
JavaScript
js-test-suite/testsuite/b6de5dbf7527ab7bcceca25fd43fbc7b.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
16
2020-03-23T12:53:10.000Z
2021-10-11T02:31:50.000Z
js-test-suite/testsuite/b6de5dbf7527ab7bcceca25fd43fbc7b.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
null
null
null
js-test-suite/testsuite/b6de5dbf7527ab7bcceca25fd43fbc7b.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
1
2020-08-17T14:06:59.000Z
2020-08-17T14:06:59.000Z
load("201224b0d1c296b45befd2285e95dd42.js"); // |jit-test| --ion-eager load("19d7bc83becec11ee32c3a85fbc4d93d.js"); [1, "", true, Symbol(), undefined].forEach(props => { assertEq(Object.getPrototypeOf(Object.create(null, props)), null); }); assertThrowsInstanceOf(() => Object.create(null, null), TypeError);
31.5
70
0.720635
8efe84d64647d06fcf63782f59e01c563bca1468
277
js
JavaScript
src/store/reducers/activeProduct.js
NashatAlzaatreh/storefront
5b27dedd00cabee8fb278fcb61bffc7c79daeba4
[ "MIT" ]
null
null
null
src/store/reducers/activeProduct.js
NashatAlzaatreh/storefront
5b27dedd00cabee8fb278fcb61bffc7c79daeba4
[ "MIT" ]
3
2021-12-20T23:52:06.000Z
2021-12-22T20:29:49.000Z
src/store/reducers/activeProduct.js
NashatAlzaatreh/storefront
5b27dedd00cabee8fb278fcb61bffc7c79daeba4
[ "MIT" ]
null
null
null
const initialState = {}; const activeProductReducer = (state = initialState, action) => { const { type, payload } = action; switch (type) { case "ADD_ACTIVE_PRODUCT": return payload; default: return state; } }; export default activeProductReducer;
18.466667
64
0.66065
f1025a548d1819e7dac888f6e15e37fdf51f8c8b
1,664
js
JavaScript
src/reducers/index.js
BernardTolosajr/mrt-ninja-redux
1e2c976d4406d44bce9be033bf05050f14d73ba3
[ "MIT" ]
null
null
null
src/reducers/index.js
BernardTolosajr/mrt-ninja-redux
1e2c976d4406d44bce9be033bf05050f14d73ba3
[ "MIT" ]
null
null
null
src/reducers/index.js
BernardTolosajr/mrt-ninja-redux
1e2c976d4406d44bce9be033bf05050f14d73ba3
[ "MIT" ]
null
null
null
import { combineReducers } from 'redux' const updateStatus = (state, snapshot) => { return state.map((station) => { if (station.name === snapshot.station) { station.status = snapshot.status } return station }) } const stations = (state = [], action) => { switch(action.type) { case 'LOAD_STATIONS': return action.stations case 'FIREBASE_CHILD_ADDED': return updateStatus(state, action.snapshot) default: return state } } const incident = (state = {}, action) => { switch(action.type) { case 'REPORT_INCIDENT': let { payload } = action return { payload, created: false } case 'REPORT_INCIDENT_SUCCESS': return { ...state, created: true } default: return state; } } const selectedIncident = (state = 'Crowded', action) => { switch(action.type) { case 'SELECTED_INCIDENT': return action.incident default: return state } } const selectedStation = (state = '', action) => { switch(action.type) { case 'SELECT_STATION': return action.name default: return state } } const selectedBound = (state = 'South', action) => { switch(action.type) { case 'SELECT_BOUND': return action.name default: return state } } const rootReducer = combineReducers({ stations, selectedIncident, incident, selectedBound, selectedStation }) export default rootReducer export const getSelectedIncident = (state) => { return state.selectedIncident } export const getSelectedStation = (state) => { return state.selectedStation } export const getSelectedBound = (state) => { return state.selectedBound }
20.048193
57
0.647837
f1026430bb143d842d73975d8cbb37fba5799534
1,633
js
JavaScript
app/controllers/build.js
kcguo/travis-web
e3120f395b756c26f56f8c073084138842498dfa
[ "MIT" ]
1
2021-01-13T15:39:43.000Z
2021-01-13T15:39:43.000Z
app/controllers/build.js
kcguo/travis-web
e3120f395b756c26f56f8c073084138842498dfa
[ "MIT" ]
null
null
null
app/controllers/build.js
kcguo/travis-web
e3120f395b756c26f56f8c073084138842498dfa
[ "MIT" ]
null
null
null
import Ember from 'ember'; import Polling from 'travis/mixins/polling'; import GithubUrlProperties from 'travis/mixins/github-url-properties'; import Visibility from 'npm:visibilityjs'; import config from 'travis/config/environment'; const { service, controller } = Ember.inject; const { alias } = Ember.computed; export default Ember.Controller.extend(GithubUrlProperties, Polling, { auth: service(), repoController: controller('repo'), repo: alias('repoController.repo'), currentUser: alias('auth.currentUser'), tab: alias('repoController.tab'), sendFaviconStateChanges: true, updateTimesService: service('updateTimes'), updateTimes() { this.get('updateTimesService').push(this.get('build.stages')); }, init() { this._super(...arguments); if (!Ember.testing) { return Visibility.every(config.intervals.updateTimes, this.updateTimes.bind(this)); } }, noJobsError: Ember.computed('build.jobs', function () { if (this.get('build.jobs.length') === 0) { return true; } }), jobsLoaded: Ember.computed('build.jobs.@each.config', function () { let jobs = this.get('build.jobs'); if (jobs) { return jobs.isEvery('config'); } }), loading: Ember.computed('build.isLoading', function () { return this.get('build.isLoading'); }), buildStateDidChange: Ember.observer('build.state', function () { if (this.get('sendFaviconStateChanges')) { return this.send('faviconStateDidChange', this.get('build.state')); } }), buildStagesSort: ['number'], sortedBuildStages: Ember.computed.sort('build.stages', 'buildStagesSort') });
28.155172
89
0.68463
f103e8198404cd984b0e8488a3713bcb76e2362f
571
js
JavaScript
fuzzer_output/interesting/sample_1554102655792.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554102655792.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554102655792.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
function main() { function v0(v1,v2,v3,v4) { let v9 = "undefined"; const v12 = {max:Function,setPrototypeOf:1337}; const v15 = [13.37,13.37,13.37,13.37]; let v18 = 9007199254740991; do { for (const v19 in v15) { } const v20 = v18 + 1; v18 = v20; } while (v18 < 6); let v23 = 0; do { const v24 = v23 + 1; v23 = v24; } while (v23 < 5); } const v30 = [1337]; for (let v34 = 0; v34 < 100; v34++) { const v35 = v0(10,Function,1337,v30,Function); } } %NeverOptimizeFunction(main); main();
21.961538
51
0.530648
f10419860657878561194deb7876fd17c1238e67
5,384
js
JavaScript
gradview/frontend/src/Component/Catalogue/CatalogueSelectBar/CatalogueSelectBar.js
RNMaximo/GradView
b195522d2355c8f5cf802a2a658d476e3a53c525
[ "MIT" ]
null
null
null
gradview/frontend/src/Component/Catalogue/CatalogueSelectBar/CatalogueSelectBar.js
RNMaximo/GradView
b195522d2355c8f5cf802a2a658d476e3a53c525
[ "MIT" ]
null
null
null
gradview/frontend/src/Component/Catalogue/CatalogueSelectBar/CatalogueSelectBar.js
RNMaximo/GradView
b195522d2355c8f5cf802a2a658d476e3a53c525
[ "MIT" ]
null
null
null
import React from "react"; import Select from "react-select"; import './CatalogueSelectBar.css'; import Button from "@material-ui/core/Button"; import { findIndexByCatalogueLabel, findIndexByValue, firstCourseToLoad, getCatalogueCourseOptionsByYear, getCatalogueYearOptions, getModalitiesOptionsByYearAndCourse } from "../../../Functions/Catalogues/cataloguesFunctions"; class CatalogueSelectBar extends React.Component { state = { catalogueYear: null, catalogueCourse: null, catalogueOpt: null, }; componentDidMount() { this.initializeOptions(); } createOptions = () => { this.yearsOptions = getCatalogueYearOptions(); this.cataloguesOptions = getCatalogueCourseOptionsByYear(); this.optionsByYearAndCourse = getModalitiesOptionsByYearAndCourse(); }; // Inicia com o último ano cadastrado, o curso com número 'firstCourseToLoad' e sua primeira modalidade. initializeOptions = () => { const initialYearOpt = this.yearsOptions[this.yearsOptions.length-1]; this.currentYear = initialYearOpt.value; const courseIndex = findIndexByValue(this.cataloguesOptions[this.currentYear], firstCourseToLoad); const initialCourseOpt = this.cataloguesOptions[this.currentYear][courseIndex]; this.currentCourse = initialCourseOpt.value; const initialCatalogueOpt = this.optionsByYearAndCourse[this.currentYear][this.currentCourse][0]; this.handleChangeCatalogueYear(initialYearOpt); //this.handleChangeCatalogueCourse(initialCourseOpt); //this.handleChangeCatalogue(initialCatalogueOpt); this.handleConfirmCatalogue(initialCatalogueOpt) }; handleChangeCatalogueYear = (catalogueYear) => { this.setState({catalogueYear: catalogueYear}); this.currentYear = catalogueYear.value; const courseIndex = findIndexByValue(this.cataloguesOptions[this.currentYear], this.currentCourse); this.handleChangeCatalogueCourse(this.cataloguesOptions[this.currentYear][courseIndex]) }; handleChangeCatalogueCourse = (selectedOption) => { this.setState({catalogueCourse: selectedOption}); this.currentCourse = selectedOption.value; const catalogueIndex = findIndexByCatalogueLabel(this.optionsByYearAndCourse[this.currentYear][this.currentCourse], this.currentCatalogueLabel); this.handleChangeCatalogue(this.optionsByYearAndCourse[this.currentYear][this.currentCourse][catalogueIndex]) }; handleChangeCatalogue = (selectedOption) => { this.currentCatalogueLabel = selectedOption.label; this.setState({catalogueOpt: selectedOption}); }; handleConfirmCatalogue = (catalogue) => { const selectedCatalogue = catalogue ? catalogue : this.state.catalogueOpt; if (! selectedCatalogue) { this.props.handleSearchCatalogue(selectedCatalogue, null); } else { this.selectedCatalogue = {year: this.currentYear, course: this.currentCourse, catalogue: this.currentCatalogueLabel}; this.props.handleSearchCatalogue(selectedCatalogue, this.selectedCatalogue); } }; noOptionsMessage = () => { return "Nenhuma opção encontrada" }; render() { this.createOptions(); const currentCataloguesYear = this.state.catalogueYear ? this.state.catalogueYear.value : null; const currentCataloguesCourse = this.state.catalogueCourse ? this.state.catalogueCourse.value : null; const aux = this.optionsByYearAndCourse[currentCataloguesYear] const yearsOptions = this.yearsOptions; const coursesOptions = this.cataloguesOptions[currentCataloguesYear]; const modalitiesOptions = aux ? aux[currentCataloguesCourse] : null; return ( <div className={"course-select-bar"} > <div className={"bar-content"} style={ { justifyContent: 'space-between', display: "inline-flex", margin: "auto", } }> <Select value={this.state.catalogueYear} className={"year-select"} onChange={this.handleChangeCatalogueYear} options={yearsOptions} placeholder={"Ano"} isSearchable={true} isDisabled={!yearsOptions || yearsOptions.length <= 1} noOptionsMessage={this.noOptionsMessage} /> <Select value={this.state.catalogueCourse} className={"course-select"} onChange={this.handleChangeCatalogueCourse} options={coursesOptions} placeholder={"Curso"} isSearchable={true} isDisabled={!coursesOptions || coursesOptions.length <= 1} noOptionsMessage={this.noOptionsMessage} /> <Select value={this.state.catalogueOpt} className={"course-select"} onChange={this.handleChangeCatalogue} options={modalitiesOptions} placeholder={"Modalidade"} isSearchable={true} isDisabled={!modalitiesOptions || modalitiesOptions.length <= 1} noOptionsMessage={this.noOptionsMessage} /> <Button className={"white-button"} variant="contained" color="default" onClick={() => this.handleConfirmCatalogue()} > Confirmar </Button> </div> </div> ); } } export default CatalogueSelectBar;
36.134228
148
0.683692
f104c48358e3b97a857b80508e75cd7791542669
187
js
JavaScript
src/api/mic/chart.js
neko374/shuiLic
da7bc785c2719cb805168c8c6fa0e44dc6b27c61
[ "MIT" ]
null
null
null
src/api/mic/chart.js
neko374/shuiLic
da7bc785c2719cb805168c8c6fa0e44dc6b27c61
[ "MIT" ]
null
null
null
src/api/mic/chart.js
neko374/shuiLic
da7bc785c2719cb805168c8c6fa0e44dc6b27c61
[ "MIT" ]
null
null
null
import request from '@/utils/request' export function micRunData(data) { return request({ baseURL: MicrogridIp, url: '/sys/chart/runData', method: 'post', data }) }
15.583333
37
0.641711
f10565a3f00d250f7ae5db78ad93dea716d9880b
2,601
js
JavaScript
ee/spec/frontend/security_configuration/components/app_spec.js
fxiao/gitlab
899798758025f2618b6524a0509098f554132776
[ "MIT" ]
null
null
null
ee/spec/frontend/security_configuration/components/app_spec.js
fxiao/gitlab
899798758025f2618b6524a0509098f554132776
[ "MIT" ]
6
2021-03-30T13:55:11.000Z
2022-02-26T10:18:56.000Z
ee/spec/frontend/security_configuration/components/app_spec.js
fxiao/gitlab
899798758025f2618b6524a0509098f554132776
[ "MIT" ]
4
2020-11-04T05:30:03.000Z
2021-07-12T23:32:36.000Z
import { mount } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; import SecurityConfigurationApp from 'ee/security_configuration/components/app.vue'; import stubChildren from 'helpers/stub_children'; describe('Security Configuration App', () => { let wrapper; const createComponent = (props = {}) => { wrapper = mount(SecurityConfigurationApp, { stubs: { ...stubChildren(SecurityConfigurationApp), GlTable: false, GlSprintf: false, }, propsData: { features: [], autoDevopsEnabled: false, latestPipelinePath: 'http://latestPipelinePath', autoDevopsHelpPagePath: 'http://autoDevopsHelpPagePath', helpPagePath: 'http://helpPagePath', autoFixSettingsProps: {}, ...props, }, }); }; afterEach(() => { wrapper.destroy(); }); const generateFeatures = n => { return [...Array(n).keys()].map(i => ({ name: `name-feature-${i}`, description: `description-feature-${i}`, link: `link-feature-${i}`, configured: i % 2 === 0, })); }; const getPipelinesLink = () => wrapper.find({ ref: 'pipelinesLink' }); const getFeaturesTable = () => wrapper.find({ ref: 'securityControlTable' }); describe('header', () => { it.each` autoDevopsEnabled | expectedUrl ${true} | ${'http://autoDevopsHelpPagePath'} ${false} | ${'http://latestPipelinePath'} `( 'displays a link to "$expectedUrl" when autoDevops is "$autoDevopsEnabled"', ({ autoDevopsEnabled, expectedUrl }) => { createComponent({ autoDevopsEnabled }); expect(getPipelinesLink().attributes('href')).toBe(expectedUrl); expect(getPipelinesLink().attributes('target')).toBe('_blank'); }, ); }); describe('features table', () => { it('passes the expected data to the GlTable', () => { const features = generateFeatures(5); createComponent({ features }); expect(getFeaturesTable().classes('b-table-stacked-md')).toBeTruthy(); const rows = getFeaturesTable().findAll('tbody tr'); expect(rows).toHaveLength(5); for (let i = 0; i < features.length; i += 1) { const [feature, status] = rows.at(i).findAll('td').wrappers; expect(feature.text()).toMatch(features[i].name); expect(feature.text()).toMatch(features[i].description); expect(feature.find(GlLink).attributes('href')).toBe(features[i].link); expect(status.text()).toMatch(features[i].configured ? 'Enabled' : 'Not yet enabled'); } }); }); });
32.924051
94
0.604383
f105b49e8dce2f1713341d3c75aadf98a7232290
9,189
js
JavaScript
dist/react-flexible-switch.min.js
IFTTT/react-flexible-switch
8f8c387605e0375c936682f0a386375b430ed57f
[ "MIT" ]
5
2017-05-20T23:21:56.000Z
2021-09-10T21:55:13.000Z
dist/react-flexible-switch.min.js
IFTTT/react-flexible-switch
8f8c387605e0375c936682f0a386375b430ed57f
[ "MIT" ]
null
null
null
dist/react-flexible-switch.min.js
IFTTT/react-flexible-switch
8f8c387605e0375c936682f0a386375b430ed57f
[ "MIT" ]
3
2017-05-31T13:19:41.000Z
2022-03-27T05:58:20.000Z
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Switch=e()}}(function(){return function e(t,n,o){function r(s,l){if(!n[s]){if(!t[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return r(n?n:e)},c,c.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,t,n){(function(o){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=function(e,t,n){for(var o=!0;o;){var r=e,i=t,s=n;o=!1,null===r&&(r=Function.prototype);var l=Object.getOwnPropertyDescriptor(r,i);if(void 0!==l){if("value"in l)return l.value;var a=l.get;if(void 0===a)return;return a.call(s)}var u=Object.getPrototypeOf(r);if(null===u)return;e=u,t=i,n=s,o=!0,l=u=void 0}},u="undefined"!=typeof window?window.React:"undefined"!=typeof o?o.React:null,c=r(u),f=e("./utils"),d=function(e){function t(){i(this,t),a(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return s(t,e),l(t,[{key:"styles",value:function(){var e=this.props.active?{left:"20% "}:{right:"20%"};return(0,f.merge)({position:"absolute",top:"50%",transform:"translateY(-50%)",pointerEvents:"none"},e)}},{key:"render",value:function(){return c["default"].createElement("span",{style:this.styles(),className:"label"},this.props.active?this.props.labels.on:this.props.labels.off)}}]),t}(c["default"].Component);n["default"]=d,d.propTypes={active:c["default"].PropTypes.bool,labels:c["default"].PropTypes.shape({on:c["default"].PropTypes.string,off:c["default"].PropTypes.string})},t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":3}],2:[function(e,t,n){(function(o){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=function(e,t,n){for(var o=!0;o;){var r=e,i=t,s=n;o=!1,null===r&&(r=Function.prototype);var l=Object.getOwnPropertyDescriptor(r,i);if(void 0!==l){if("value"in l)return l.value;var a=l.get;if(void 0===a)return;return a.call(s)}var u=Object.getPrototypeOf(r);if(null===u)return;e=u,t=i,n=s,o=!0,l=u=void 0}},u="undefined"!=typeof window?window.React:"undefined"!=typeof o?o.React:null,c=r(u),f=e("classnames"),d=r(f),p=e("./Label"),v=r(p),h=e("./utils"),y=function(e){function t(e){i(this,t),a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.onSlideEnd=this.onSlideEnd.bind(this),this.onSlideStart=this.onSlideStart.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.isTouchDevice=void 0!==window.ontouchstart,this.state={sliding:!1,value:this.props.value}}return s(t,e),l(t,[{key:"componentDidMount",value:function(){this.addListener()}},{key:"componentWillReceiveProps",value:function(e){void 0!==e.value&&e.value!==this.state.value&&this.setState({value:e.value})}},{key:"componentDidUpdate",value:function(e,t){this.state.value!=t.value&&this.props.onChange(this.state.value)}},{key:"componentWillUnmount",value:function(){this.removeListener()}},{key:"addListener",value:function(){this.isTouchDevice?(document.addEventListener(h.events.touch.start,this.onSlideStart,!1),document.addEventListener(h.events.touch.stop,this.onSlideEnd,!1)):(document.addEventListener(h.events.mouse.start,this.onSlideStart,!1),document.addEventListener(h.events.mouse.stop,this.onSlideEnd,!1))}},{key:"removeListener",value:function(){this.isTouchDevice?(document.removeEventListener(h.events.touch.start,this.onSlideStart,!1),document.removeEventListener(h.events.touch.stop,this.onSlideEnd,!1)):(document.removeEventListener(h.events.mouse.start,this.onSlideStart,!1),document.removeEventListener(h.events.mouse.stop,this.onSlideEnd,!1))}},{key:"onSlideEnd",value:function(){this.props.locked||this.state.sliding&&(this.setState({sliding:!1,value:!this.state.value}),(0,h.reEnableScroll)())}},{key:"onSlideStart",value:function(e){this.props.locked||e.target!=this.refs.circle&&e.target!=this.refs["switch"]||(this.setState({sliding:!0}),(0,h.disableScroll)())}},{key:"onMouseLeave",value:function(e){this.onSlideEnd(e)}},{key:"classes",value:function(){return(0,d["default"])("switch",{sliding:this.state.sliding},{active:this.state.value},{inactive:!this.state.value})}},{key:"switchStyles",value:function n(){var n=this.switchStylesProps();return(0,h.merge)({borderRadius:n.width/2},n)}},{key:"translationStyle",value:function(){var e=this.circleStylesProps(),t=this.switchStyles(),n=t.width-e.diameter,o=this.state.value?n:0;return this.state.sliding&&this.state.value&&(o-=e.diameter/4+t.padding/4),{transform:"translateX("+o+"px)"}}},{key:"backgroundStyle",value:function(){var e=this.circleStylesProps(),t=this.state.value?e.onColor:e.offColor;return{backgroundColor:t}}},{key:"circleStylesProps",value:function(){return(0,h.merge)(b,this.props.circleStyles)}},{key:"switchStylesProps",value:function(){return(0,h.merge)(m,this.props.switchStyles)}},{key:"circleDimensionsStyle",value:function(){var e=(this.switchStyles(),this.circleStylesProps()),t=this.state.sliding?e.diameter+e.diameter/4:e.diameter;return{width:t,height:e.diameter}}},{key:"circleStyles",value:function(){return(0,h.merge)(this.circleDimensionsStyle(),this.backgroundStyle(),this.translationStyle(),this.circleStylesProps())}},{key:"render",value:function(){return c["default"].createElement("span",{style:this.switchStyles(),className:this.classes(),ref:"switch",onMouseLeave:this.onMouseLeave},c["default"].createElement(v["default"],{active:this.state.value,labels:this.props.labels,ref:"label"}),c["default"].createElement("span",{style:this.circleStyles(),className:"circle",ref:"circle"}))}}]),t}(c["default"].Component),m={width:80,padding:4,border:"1px solid #CFCFCF",display:"flex",position:"relative",backgroundColor:"white",boxSizing:"content-box"},b={diameter:35,borderRadius:35,display:"block",transition:"transform 200ms, width 200ms, background-color 200ms",onColor:"#70D600",offColor:"#CFCFCF"};y.propTypes={value:c["default"].PropTypes.bool,circleStyles:c["default"].PropTypes.shape({onColor:c["default"].PropTypes.string,offColor:c["default"].PropTypes.string,diameter:c["default"].PropTypes.number}),labels:c["default"].PropTypes.shape({on:c["default"].PropTypes.string,off:c["default"].PropTypes.string}),locked:c["default"].PropTypes.bool,onChange:c["default"].PropTypes.func,switchStyles:c["default"].PropTypes.shape({width:c["default"].PropTypes.number})},y.defaultProps={onChange:function(){},circleStyles:b,switchStyles:m,labels:{on:"",off:""},locked:!1},n["default"]=y,t.exports=n["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Label":1,"./utils":3,classnames:void 0}],3:[function(e,t,n){"use strict";function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.apply(void 0,[{}].concat(t))}function r(){document.addEventListener(a.touch.move,s,!1)}function i(){document.removeEventListener(a.touch.move,s,!1)}function s(e){e.preventDefault()}Object.defineProperty(n,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};n.merge=o,n.disableScroll=r,n.reEnableScroll=i;var a={touch:{start:"touchstart",stop:"touchend",move:"touchmove"},mouse:{start:"mousedown",stop:"mouseup"}};n.events=a},{}]},{},[2])(2)});
9,189
9,189
0.733703
f106f7a8a760736ab8f8105ad7836d92ca96d147
1,899
js
JavaScript
packages/types/test/Exception.test.js
inceptjs/incept.js
e3ea1da9752962ff5a84e3447e3ffee07678a7c7
[ "MIT" ]
null
null
null
packages/types/test/Exception.test.js
inceptjs/incept.js
e3ea1da9752962ff5a84e3447e3ffee07678a7c7
[ "MIT" ]
2
2021-10-15T04:50:39.000Z
2021-10-15T15:08:35.000Z
packages/types/test/Exception.test.js
inceptjs/incept.js
e3ea1da9752962ff5a84e3447e3ffee07678a7c7
[ "MIT" ]
null
null
null
const { expect } = require('chai') const { Exception } = require('../dist') class TestExeption extends Exception {} describe('Exception', () => { it('Should throw alot of errors', () => { try { throw TestExeption.for('Something good is bad') } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something good is bad') expect(e.code).to.equal(500) } try { throw TestExeption.for('Something good is bad').withCode(599) } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something good is bad') expect(e.code).to.equal(599) } try { throw TestExeption.for('Something good is bad', 'good', 'bad') } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something good is bad') expect(e.code).to.equal(500) } try { throw TestExeption.for('Something %s is %s', 'good', 'bad') } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something good is bad') expect(e.code).to.equal(500) } try { throw TestExeption.for('Something %s is %s', 1, [1]) } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something 1 is 1') expect(e.code).to.equal(500) } try { throw TestExeption.forErrorsFound({key: 'value'}) } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Invalid Parameters') expect(e.errors.key).to.equal('value') expect(e.code).to.equal(500) } try { TestExeption.require(false, 'Something %s is %s', 'good', 'bad') } catch(e) { expect(e.name).to.equal('TestExeption') expect(e.message).to.equal('Something good is bad') expect(e.code).to.equal(500) } }) })
29.215385
70
0.59347
f1092d432e10242a07958af694dddbc7b653eadb
13,126
js
JavaScript
server.js
kaephas/languagelab
d3e908bacf45a45479d1ba27e5ff7dca756904dc
[ "MIT" ]
1
2020-06-09T20:52:05.000Z
2020-06-09T20:52:05.000Z
server.js
kaephas/languagelab
d3e908bacf45a45479d1ba27e5ff7dca756904dc
[ "MIT" ]
4
2020-07-06T03:41:13.000Z
2022-02-19T04:36:41.000Z
server.js
jason-engelbrecht/language-lab
d7f06964d4e170c4cb12c3133b3846e157b2d2db
[ "MIT" ]
null
null
null
import express from 'express'; import fileUpload from 'express-fileupload'; import cookieParser from 'cookie-parser'; import fs from 'fs'; import excelToJson from 'convert-excel-to-json'; import {ProficiencyModel, UploadModel} from './src/server/database'; import router from './src/server/api'; import crypto from 'crypto'; const path = require('path'); const server = express(); //serve public files statically and enable file uploads on server server.use(express.static('public'), fileUpload()); server.use(express.urlencoded({ extended: true })); server.use(express.json()); server.use(cookieParser()); //bring in the api router server.use('/api', router); //base routes server.get(['/', '/dashboard', '/uploads', '/users', '/login', '/register'], (req, res) => { res.sendFile(path.join(__dirname, 'public/index.html')); }); //maybe move to api server.post('/upload/lab', (req, res) => { // console.log("crypto1: " + hash.update('123456789')); // console.log("crypto2: " + hash.update('123456789')); if(req.files === null) { return res.status(400).json({ msg: "No file uploaded" }); } console.log("req: " + JSON.stringify(req.body)); let quarter = req.body.quarter; let year = req.body.year; let language = ''; let staffing = ''; if(req.body.language) { language = req.body.language; } if(req.body.support) { staffing = req.body.support; } let file = req.files.file; // get file extension to verify excel document let extension = file.name.split('.').pop(); let excel = false; if(extension === 'xlsx' || extension === 'xls') { excel = true; } console.log("Here?"); const path = `${__dirname}/uploads/${file.name}`; // attempt to move the file to active directory / uploads / file.mv(path, err => { if (err) { console.error(err); return res.status(500).send(err); } // return an error if somehow it got past client authentication for extension if(!excel) { console.error("improper file type, must be excel"); // return res.status(415).send; return res.status(415).json({'msg':'File type must be xls or xlsx.'}); } //convert excel upload to json object const result = excelToJson({ sourceFile: `${__dirname}/uploads/${file.name}`, //1st row is header - don't include header: { rows: 2 }, //column header as keys columnToKey: { // '*': '{{columnHeader}}' 'B': '{{B1}}', 'C': '{{C1}}', 'D': '{{D1}}', 'F': '{{F1}}' }, // TODO: make sheet names consistent from quarter to quarter and adjust this sheets: ['Language Lab Usage Summary'] }); // console.log("sheet2: " + result[sheet2]); // let count = 0; let studentData = []; for(let prop in result) { if(result.hasOwnProperty(prop)) { // console.log("prop " + count + ": " + prop + " => " + result[prop]); // count++; studentData.push(result[prop]); } } // only one property (0) => retrieve that data studentData = studentData[0]; for (let i = 0; i < studentData.length; i++) { // ignore empty rows if(studentData[i]['Student ID#']) { // add new property names for mongoDB const hash = crypto.createHash('SHA3-512'); const sid = studentData[i]['Student ID#'].toString().trim(); hash.update(sid); studentData[i].sid = hash.digest('hex'); // studentData[i].first_name = studentData[i]['Student First Name']; // studentData[i].last_name = studentData[i]['Student Last Name']; studentData[i].hours = studentData[i]['Hours in the Lab']; // remove the old property names delete studentData[i]['Student ID#']; delete studentData[i]['Student First Name']; delete studentData[i]['Student Last Name']; delete studentData[i]['Hours in the Lab']; } } //add file name to result object and add result data const uploadData = { filename: file.name, quarter: quarter, year: year, language: language, staffing: staffing, data: studentData }; // console.log(uploadData); //new upload object with data const upload = new UploadModel(uploadData); //upload to db and meow async function showUploaded() { await upload.save().then(() => console.log('uploaded...meow')); // query the db for the data just uploaded let q = UploadModel.find().sort({'date' : -1}).limit(1); q.exec(function(err, doc) { // get array of all "students" // let data = doc[0].data; // for (let i = 0; i < data.length; i++) { // console.log(data[i]); // } if(err) { console.error("Error: " + err); } }); } showUploaded(); //testing // TODO remove after confirmation of functionality //find uploaded document - this doesn't actually return the last uploaded doc? // UploadModel.findOne({}, {}, { sort: { 'date' : -1 } }, function (err, doc) { // console.log(doc); // }); // // UploadModel.find({}, { sort : { 'date' : -1 }}, { limit : 1 }, function (err, doc) { // console.log("Second statement works?"); // console.log(doc); // }); // Delete file after using the data TODO: using input stream somehow might be better? try{ fs.unlinkSync(path); } catch (err) { console.error(err); } res.json({ filename: file.name, filePath: `/uploads/${file.name}`}); }) }); //maybe move to api server.post('/upload/proficiency', (req, res) => { if(req.files === null) { return res.status(400).json({ msg: "No file uploaded" }); } // console.log("req: " + JSON.stringify(req.body)); let quarter = req.body.quarter; let year = req.body.year; let file = req.files.file; // get file extension to verify excel document let extension = file.name.split('.').pop(); let excel = false; if(extension === 'xlsx' || extension === 'xls') { excel = true; } // console.log("Here?"); const path = `${__dirname}/uploads/${file.name}`; // attempt to move the file to active directory / uploads / file.mv(path, err => { if (err) { console.error(err); return res.status(500).send(err); } // return an error if somehow it got past client authentication for extension if(!excel) { console.error("improper file type, must be excel"); // return res.status(415).send; return res.status(415).json({'msg':'File type must be xls or xlsx.'}); } //convert excel upload to json object const result = excelToJson({ sourceFile: `${__dirname}/uploads/${file.name}`, sheets:[ { // ClassID, ItemNumber?, CourseID (level) name: 'dbo.Class Dummy Data', columnToKey: { // 'B': '{{B1}}', 'C': '{{C1}}', 'D': '{{D1}}' }, header: { rows: 1 } }, { // SID, FullName name: 'dbo.Student', columnToKey: { 'A': '{{A1}}', 'B': '{{B1}}' }, header: { rows: 1 } }, { // Language, ItemNumber, SID, SPEAKING, WRITING, LISTENING, READING name: 'tbl.ACTFLScores', columnToKey: { 'B': "{{B1}}", 'C': "{{C1}}", 'D': "{{D1}}", 'E': "{{E1}}", 'F': "{{F1}}", 'G': "{{G1}}", 'H': "{{H1}}" }, header: { rows: 1 } } ] }); // console.log("sheet2: " + result[sheet2]); // let count = 0; // let studentData = []; // for(let prop in result) { // if(result.hasOwnProperty(prop)) { // console.log("prop " + ": " + prop); // // studentData.push(result[prop]); // } // } let classDummy = []; for(let prop in result['dbo.Class Dummy Data']) { classDummy.push(result['dbo.Class Dummy Data'][prop]); } let students = []; for(let prop in result['dbo.Student']) { students.push(result['dbo.Student'][prop]); } let scores = []; let actfl = result['tbl.ACTFLScores']; for(let item in actfl) { if(actfl.hasOwnProperty(item)) { if(actfl[item]['SPEAKING'] && actfl[item]['SPEAKING'] !== '') { let studentData = {}; studentData.language = actfl[item]['Language']; studentData.itemNumber = actfl[item]['ItemNumber']; // encrypt SID const hash = crypto.createHash('SHA3-512'); const sid = actfl[item]['SID'].toString().trim(); hash.update(sid); studentData.sid = hash.digest('hex'); // find the matching encrypted SID let student = students.find(student => student['SID'].toString().trim() === sid); // let name = student['FullName']; // let fullName = name.split(' '); let currentClass = classDummy. find(level => level['ItemNumber'] === actfl[item]['ItemNumber']); studentData.current_class = currentClass['CourseID']; // studentData.first_name = fullName[0]; studentData.speaking = actfl[item]['SPEAKING']; studentData.writing = actfl[item]['WRITING']; studentData.listening = actfl[item]['LISTENING']; studentData.reading = actfl[item]['READING']; scores.push(studentData); } } } // Language, ItemNumber, SID, SPEAKING, WRITING, LISTENING, READING //add file name to result object and add result data const uploadData = { filename: file.name, quarter: quarter, year: year, data: scores }; // console.log(uploadData); //new upload object with data const upload = new ProficiencyModel(uploadData); //upload to db and meow async function showUploaded() { await upload.save().then(() => console.log('uploaded...woof')); // query the db for the data just uploaded let q = UploadModel.find().sort({'date' : -1}).limit(1); q.exec(function(error, doc) { // get array of all "students" // let data = doc[0].data; // for (let i = 0; i < data.length; i++) { // console.log(data[i]); // } if(err) { console.error("Error: " + err); } }); } showUploaded(); //testing // TODO remove after confirmation of functionality //find uploaded document - this doesn't actually return the last uploaded doc? // UploadModel.findOne({}, {}, { sort: { 'date' : -1 } }, function (err, doc) { // console.log(doc); // }); // // UploadModel.find({}, { sort : { 'date' : -1 }}, { limit : 1 }, function (err, doc) { // console.log("Second statement works?"); // console.log(doc); // }); // Delete file after using the data TODO: using input stream somehow might be better? try{ fs.unlinkSync(path); } catch (err) { console.error(err); } res.json({ filename: file.name, filePath: `/uploads/${file.name}`}); }) }); server.listen(process.env.PORT || 8080, () => console.log(`Listening on port ${process.env.PORT || 8080}!`));
36.259669
109
0.479659
f10a4699313ef478ed53789bdb9052fc31d42d62
1,835
js
JavaScript
pages/docs/navigation/navbars.js
GabrielFemi/choc-ui
bbe276c3e1dca3d3865c0bea617a9c6c47bb723c
[ "MIT" ]
null
null
null
pages/docs/navigation/navbars.js
GabrielFemi/choc-ui
bbe276c3e1dca3d3865c0bea617a9c6c47bb723c
[ "MIT" ]
null
null
null
pages/docs/navigation/navbars.js
GabrielFemi/choc-ui
bbe276c3e1dca3d3865c0bea617a9c6c47bb723c
[ "MIT" ]
null
null
null
import React from "react"; import PageHead from "~/components/head"; import { PageHeader, Section } from "~/components/docs"; import ComponentDemo from "@/component-demo"; import DocsLayout from "~/components/layouts/docs/index"; const Navbars = () => { return ( <DocsLayout> <PageHead title="Navbars" /> <PageHeader>Navbars</PageHeader> <Section> <Section.Header> <Section.a target="_blank" rel="noopener" href="https://kutty.netlify.app/components/headers/" > Guest Simple Links Right </Section.a> </Section.Header> <Section.Content> <Section.p> <ComponentDemo path="navbars/gslr" file="index" multiple={[]} /> </Section.p> </Section.Content> </Section> <Section> <Section.Header> <Section.a target="_blank" rel="noopener" href="https://kutty.netlify.app/components/headers/" > Dashboard Simple Links Left </Section.a> </Section.Header> <Section.Content> <Section.p> <ComponentDemo path="navbars/dsll" file="index" multiple={[]} /> </Section.p> </Section.Content> </Section> <Section> <Section.Header> <Section.a target="_blank" rel="noopener" href="https://kutty.netlify.app/components/headers/" > Dashboard Sub-Navigation Links </Section.a> </Section.Header> <Section.Content> <Section.p> <ComponentDemo path="navbars/dsnl" file="index" multiple={[]} /> </Section.p> </Section.Content> </Section> </DocsLayout> ); }; export default Navbars;
27.38806
76
0.533515
f10bc7ce1ac0f783318d2116e95e0610bac76eaf
899
js
JavaScript
public/js/hide-show.js
gabrielgomes94/Sociedade-Participativa
6239455927cce15ea2c1af080ea0d01558a80b43
[ "MIT" ]
null
null
null
public/js/hide-show.js
gabrielgomes94/Sociedade-Participativa
6239455927cce15ea2c1af080ea0d01558a80b43
[ "MIT" ]
null
null
null
public/js/hide-show.js
gabrielgomes94/Sociedade-Participativa
6239455927cce15ea2c1af080ea0d01558a80b43
[ "MIT" ]
null
null
null
$(document).ready(function(){ $(".btn-hide-show").click(function(){ var target = $(this); var type = target.data("value"); if($(this).children().attr("class") == "glyphicon glyphicon-chevron-up"){ var classTarget = type + '-box'; $('.' + classTarget).slideUp(); $(this).children().remove(); $(this).append("<span class='glyphicon glyphicon-chevron-down'> </span>"); } else if($(this).children().attr("class") == "glyphicon glyphicon-chevron-down"){ var classTarget = type + '-box'; $("." + classTarget).slideDown(); $(this).children().remove(); $(this).append("<span class='glyphicon glyphicon-chevron-up'> </span>"); } }); });
49.944444
147
0.449388
f10d0cecab2d1801afaaa06e4209fea7a37bfb95
771
js
JavaScript
Albion.Network.Electron/src/NetHandler/JoinOperationHandler.js
orracosta/Albion-radar-2.0
cbf5ae5fe043fc12e08e7ceb14446cde4da80771
[ "MIT" ]
null
null
null
Albion.Network.Electron/src/NetHandler/JoinOperationHandler.js
orracosta/Albion-radar-2.0
cbf5ae5fe043fc12e08e7ceb14446cde4da80771
[ "MIT" ]
null
null
null
Albion.Network.Electron/src/NetHandler/JoinOperationHandler.js
orracosta/Albion-radar-2.0
cbf5ae5fe043fc12e08e7ceb14446cde4da80771
[ "MIT" ]
null
null
null
class JoinOperationHandler { constructor(app, game) { this.app = app; this.game = game; } listen(_connection) { const _app = this.app; const _game = this.game; _connection.on('NetHandler.JoinOperation', function (data) { _game.localPlayer.id = data.id; _game.localPlayer.name = data.name; _game.localPlayer.guildName = data.guildName; _game.localPlayer.allianceName = data.allianceName; _game.localPlayer.position = data.position; _game.localPlayer.faction = data.faction; // Communicate to IPC Renderer _app.mainWindow.webContents.send('Map.Local.JoinLocal', { position: data.position, game: _game, }); }); } } exports.JoinOperationHandler = JoinOperationHandler;
26.586207
64
0.666667
f10ec6f24278511effa3e9ca56808609622dbdc1
2,396
js
JavaScript
tree-printer/main.js
bhatiasiddharth/Compiler
01fdc04b3ab7dd9c9b1583536cb73fe85b7d4eed
[ "MIT" ]
1
2021-03-16T15:22:13.000Z
2021-03-16T15:22:13.000Z
tree-printer/main.js
bhatiasiddharth/Compiler
01fdc04b3ab7dd9c9b1583536cb73fe85b7d4eed
[ "MIT" ]
null
null
null
tree-printer/main.js
bhatiasiddharth/Compiler
01fdc04b3ab7dd9c9b1583536cb73fe85b7d4eed
[ "MIT" ]
null
null
null
var fs = require("fs"); var textToTree = require("./textToTree"); var treeToDiagram = require("./treetodiagram"); var jsdom = require("node-jsdom").jsdom; function clear(node) { while (node.childNodes.length > 0) node.removeChild(node.childNodes[0]); } var options = { "flipXY": 0, "width": 1000, "height": 650, "labelLineSpacing": 12, "cornerRounding": 0, "labelPadding": 2, "arrowHeadSize": 4, "arrowsUp": 0, "siblingGap": 0.05, "idealSiblingGap": 0.3, "minimumCousinGap": 0.2, "idealCousinGap": 1.5, "levelsGap": 1, "minimumDepth": 6, "minimumBreadth": 6, "drawRoot": false }; var styles = 'text {\n'+ 'text-anchor: middle;\n'+ 'font-size: x-small;\n'+ '}\n'+ 'rect {\n'+ 'fill: aliceblue;\n'+ 'stroke: black;\n'+ 'opacity: 1;\n'+ 'stroke-width: 0.4;\n'+ 'stroke-dasharray: 4, 1;\n'+ '}\n'+ 'line {\n'+ 'stroke: black;\n'+ 'opacity: 0.30;\n'+ 'stroke-width: 1;\n'+ '}\n'; var doc = '<svg id="diagramSvg" xmlns="http://www.w3.org/2000/svg">\n'+ '<style id="stylesheet"> </style>\n'+ '<defs>\n'+ '<marker id="arrowHead" viewBox="-10 -5 10 10"\n'+ 'markerUnits="strokeWidth" markerWidth="6" markerHeight="5"\n'+ 'orient="auto">\n'+ '<path d="M -10 -5 L 0 0 L -10 5 z"></path>\n'+ '</marker>\n'+ '</defs>\n'+ '<g id="diagramGroup"></g>\n'+ '</svg>\n'; function draw(treeInputFile, errors, window) { var doc = window.document; var treeInput = fs.readFileSync(treeInputFile, {encoding: 'utf8'}); var tree = textToTree(treeInput); var diagramGroup = doc.getElementById('diagramGroup'); var diagramSvg = doc.getElementById('diagramSvg'); var arrowHead = doc.getElementById('arrowHead'); var styleSheet = doc.getElementById("stylesheet"); var treeOutputFile = treeInputFile.split('.')[0] + '.svg'; clear(styleSheet); styleSheet.appendChild(doc.createTextNode(styles)); // diagramSvg.style = {}; clear(diagramGroup); treeToDiagram(doc, tree, diagramSvg, diagramGroup, options); fs.writeFileSync(treeOutputFile, '<svg id="diagramSvg" xmlns="http://www.w3.org/2000/svg">' + window.document.querySelector('#diagramSvg').innerHTML + '</svg>'); } jsdom.env({ html : doc, done : function(errors, window) { for (var i = 2; i < process.argv.length; i++) { draw(process.argv[i], errors, window); }; } });
26.622222
96
0.613105
f10faee13dd2c6fc0945e2331605045da86812a5
1,391
js
JavaScript
experimental/src/app.js
0bLondon/VizFinal
316240e12fc04b269274b53a3bd0a3412886dccf
[ "MIT" ]
null
null
null
experimental/src/app.js
0bLondon/VizFinal
316240e12fc04b269274b53a3bd0a3412886dccf
[ "MIT" ]
null
null
null
experimental/src/app.js
0bLondon/VizFinal
316240e12fc04b269274b53a3bd0a3412886dccf
[ "MIT" ]
1
2021-01-05T21:40:03.000Z
2021-01-05T21:40:03.000Z
import React, {Component} from 'react'; import {connect} from 'react-redux'; import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer'; import KeplerGl from 'kepler.gl'; import {createAction} from 'redux-actions'; import {processKeplerglJSON} from 'kepler.gl/processors'; import {addDataToMap, wrapTo} from 'kepler.gl/actions'; import meteorite from './data/meteorite'; const MAPBOX_TOKEN = process.env.MapboxAccessToken; const hideAndShowSidePanel = createAction('HIDE_AND_SHOW_SIDE_PANEL'); class App extends Component { componentDidMount() { this.props.dispatch( wrapTo( 'map1', addDataToMap(processKeplerglJSON(meteorite)) ) ); } _toggleSidePanelVisibility = () => { this.props.dispatch(wrapTo('map1', hideAndShowSidePanel())); }; render() { return ( <div style={{position: 'absolute', width: '100%', height: '100%'}}> <button onClick={this._toggleSidePanelVisibility} style={{position: 'absolute', zIndex: 100}}> Toggle Menus</button> <AutoSizer> {({height, width}) => ( <KeplerGl mapboxApiAccessToken={MAPBOX_TOKEN} id="map1" width={width} height={height} /> )} </AutoSizer> </div> ); } } const mapStateToProps = state => state; const dispatchToProps = dispatch => ({dispatch}); export default connect(mapStateToProps, dispatchToProps)(App);
30.23913
124
0.677211
f1101267940ad648f4bdb92996ee22d5c2a11020
4,088
js
JavaScript
src/components/Homepage/AboutMe/AboutMe.js
Developerayo/shodipoayomide.com
b9e405b566b0103aaa0cc080df65226a7faa03a4
[ "MIT" ]
91
2019-03-14T09:47:35.000Z
2022-03-23T18:56:58.000Z
src/components/Homepage/AboutMe/AboutMe.js
Developerayo/shodipoayomide.com
b9e405b566b0103aaa0cc080df65226a7faa03a4
[ "MIT" ]
102
2019-03-07T01:26:56.000Z
2022-03-31T08:39:27.000Z
src/components/Homepage/AboutMe/AboutMe.js
Developerayo/shodipoayomide.com
b9e405b566b0103aaa0cc080df65226a7faa03a4
[ "MIT" ]
4
2019-04-10T09:33:14.000Z
2020-10-20T23:02:10.000Z
import React from "react"; import "./_aboutMe.scss"; import aboutImg from "../../../assets/images/about.svg"; import contact from "../../../assets/images/contact.png"; import { Link } from "react-router-dom"; import * as routes from "../../../routePaths"; const AboutMe = props => ( <section id="aboutMe" className="aboutMe container-fluid section-spacing"> <div className="container"> <div className="row"> <div className="col-12 col-lg-5 about-text-col"> <div className="section-heading"> <h4 className="about-me-heading">About Me</h4> </div> <div className="about-text"> <p className="description" style={{color: "#969696"}}> Hi, I'm Shodipo Ayomide a Dev. Relations Manager at Stack Overflow with 9 years of experience in Technology and a track record in Web & Mobile Engineering, Community Management, and Product Design on a global scale.< br/> < br/> I have given talks/workshops at developer conferences around the globe at React Atlanta, FutureSync Conference, VueJS Amsterdam, VueJS Toronto, APIDAYS Hong Kong, Frontend Love Conference Amsterdam, FOSSASIA among many, I organizer/co-organize, Developer Circles Lagos from Facebook, unStack Africa, Open-Source Community Africa, and various other communities empowering Africa and the world in Technology. Also, I am an Expert and Instructor at egghead.io. < br/> < br/> Among my latest topics we can find: Progressive Imaging & Handling: React + WebPack, Fast and Furious with VueJS & WebPack, Getting up to Speed With Deno, Automating Workflow Processes Using GitHub Actions, Design from the Realm of Open-Source, Technical Principles to Developer Experience and others. < br/> < br/> </p> </div> {/* <div className="row ml-0 about-lists-row"> <ul className="col-12 col-lg-6 about-list"> <li className="description">Developer Relations</li> <p>I have Lead DevRel teams & Managed high scale programs in DevRel acorss Africa, positioning a product at a point of a unique developer onboarding experience.</p> </ul> <ul className="col-12 col-lg-6 about-list"> <li className="description">Program Manager</li> <p>I have managed highscale programs for companies based on contract, my goal was to come up with a program that would help onboard more developers into a cool new program.</p> </ul> <ul className="col-12 col-lg-6 about-list"> <li className="description">Engineering </li> <p>Over 8 years experience building complex systems from the web to mobile and desktop side of engineering, and as a Developer Advocate, working acoross many technologies. </p> </ul> <ul className="col-12 col-lg-6 about-list"> <li className="description">Community Manager</li> <p>Starting, building and scaling communities is exciting, organizing conferences or meetups to empower the people in the community with technology has always been exciting to me.</p> </ul> </div> */} <div className="contact-me-wrapper"> <Link to={`${routes.homepage}#contactUs`} className="nav-link"> <button className="primary-btn"> <img src={contact} alt="contact" /> Send an Email </button> </Link> <a href="https://www.notion.so/developerayo/Shodipo-Ayomide-Press-Kit-Presenter-Terms-dbc63437aa6e4bd1882dfb4de5223a10" target="_blank" rel="noopener noreferrer"> <button className="primary-btn" style={{marginLeft: "15px"}}> <img src={contact} alt="contact" /> Press Kit </button></a> </div> </div> <div className="col-12 col-lg-7 about-img-col"> <img className="img-fluid" src={aboutImg} alt="about-me" style={{width: "500px"}} /> </div> </div> </div> </section> ); export default AboutMe;
61.014925
483
0.642123
f11054d5c0ff0322c1dd484d6d4c882cd543b536
1,491
js
JavaScript
src/model/sound/ecs/SoundEmitter.spec.js
jellehak/meep
caea7d510c8bea1f70f7713c03c12a139baea129
[ "MIT" ]
150
2019-10-09T09:46:21.000Z
2022-03-24T17:30:39.000Z
src/model/sound/ecs/SoundEmitter.spec.js
jellehak/meep
caea7d510c8bea1f70f7713c03c12a139baea129
[ "MIT" ]
5
2019-10-30T04:01:04.000Z
2022-03-18T19:15:11.000Z
src/model/sound/ecs/SoundEmitter.spec.js
jellehak/meep
caea7d510c8bea1f70f7713c03c12a139baea129
[ "MIT" ]
26
2019-10-10T09:24:58.000Z
2022-03-18T07:48:24.000Z
import { BinaryBuffer } from "../../core/binary/BinaryBuffer.js"; import { SoundEmitter, SoundEmitterSerializationAdapter, SoundTrack } from "./SoundEmitter.js"; test('binary serialization consistency', () => { const buffer = new BinaryBuffer(); const emitter0 = new SoundEmitter(); emitter0.channel = 'hello kitty'; emitter0.isPositioned = true; emitter0.distanceMin = 3.1; emitter0.distanceMax = 7.5; emitter0.distanceRolloff = 11.6; emitter0.volume.set(0.89); const soundTrack = new SoundTrack(); soundTrack.startWhenReady = true; soundTrack.playing = false; soundTrack.channel = "trek"; soundTrack.time = 13.1; soundTrack.loop = false; soundTrack.url = "wow://such/path/much.slash"; emitter0.tracks.add(soundTrack); const adapter = new SoundEmitterSerializationAdapter(); adapter.initialize(); adapter.serialize(buffer, emitter0); buffer.position = 0; const emitter1 = new SoundEmitter(); adapter.deserialize(buffer, emitter1); expect(emitter1.channel).toEqual(emitter0.channel); expect(emitter1.isPositioned).toEqual(emitter0.isPositioned); expect(emitter1.distanceMin).toEqual(emitter0.distanceMin); expect(emitter1.distanceMax).toEqual(emitter0.distanceMax); expect(emitter1.distanceRolloff).toEqual(emitter0.distanceRolloff); expect(emitter1.volume.getValue()).toEqual(emitter0.volume.getValue()); expect(emitter1.tracks.equals(emitter0.tracks)); });
29.82
95
0.715627
f110c2d9af98c590c905145a2ff16792c7c299cd
2,838
js
JavaScript
src/app/ripple.js
ho4040/water_effect
741c79845469b7a1ca5999dee0d6d346b25d1908
[ "MIT" ]
1
2018-02-28T10:01:35.000Z
2018-02-28T10:01:35.000Z
src/app/ripple.js
ho4040/water_effect
741c79845469b7a1ca5999dee0d6d346b25d1908
[ "MIT" ]
null
null
null
src/app/ripple.js
ho4040/water_effect
741c79845469b7a1ca5999dee0d6d346b25d1908
[ "MIT" ]
null
null
null
var PIXI = require('pixi.js'); // You can use either `new PIXI.WebGLRenderer`, `new PIXI.CanvasRenderer`, or `PIXI.autoDetectRenderer` // which will try to choose the best renderer for the environment you are in. var renderer = new PIXI.WebGLRenderer(800, 600); // The renderer will create a canvas element for you that you can then insert into the DOM. document.body.appendChild(renderer.view); var tile_size = 10; var width = 80; var height = 60; var newSurface = function(){ var surface = []; for(var y=0;y<height;y++){ var row = []; for(var i=0;i<width;i++) row[i] = 0; surface.push(row); } return surface; } var current_surface = newSurface(); var previous_surface = newSurface(); var getV = function(surface, x, y){ if(x >= 0 && x < width && y >= 0 && y < height) return surface[y][x]; return 0; } var setV = function(surface, x, y, v){ if(x >= 0 && x < width && y >= 0 && y < height){ surface[y][x] = v; return true; } return false; } var calcNewV = function(x,y){ var damp = 0.95; var num = 0; var t=0; var k = 1; for(var i=-k;i<=k;i++){ for(var j=-k;j<=k;j++){ if(i==0 && j == 0) continue; num++; var dist = Math.sqrt(Math.pow(i, 2) + Math.pow(j, 2)); t += (getV(current_surface, x+i, y+j))/dist; } } var avgHeight = (t/num); //Blur 하기 위해서 평균높이를 구한다 var velocity = -getV(previous_surface, x, y); //두프레임 전의 높이를 운동량으로 이용한다. var newHeight = (avgHeight*2 + velocity)*damp; // 2? return newHeight; } var step = function(){ var next_surface = [] for(var y=0;y<height;y++) { var row = []; for(var x=0;x<width;x++) row.push(calcNewV(x, y)); next_surface.push(row); } previous_surface = current_surface; current_surface = next_surface; } var stage = new PIXI.Container(); var graphics = new PIXI.Graphics(); stage.addChild(graphics); graphics.interactive = true; graphics.buttonMode = true; graphics.on('pointermove', (e)=>{ var p = e.data.getLocalPosition(graphics); x = Math.floor(p.x/tile_size); y = Math.floor(p.y/tile_size); setV(current_surface, x, y, -5.5) }) function animate() { step(); //Draw graphics.clear() graphics.lineStyle(1, 0x00, 0); for(var y=0;y<height;y++) for(var x=0;x<width;x++) { var v = getV(current_surface, x, y); graphics.beginFill(0x8888FF, 0.5+v); graphics.drawRect(x*tile_size, y*tile_size, tile_size, tile_size); } graphics.endFill(); // this is the main render call that makes pixi draw your container and its children. renderer.render(stage); } // start the timer for the animation loop setInterval(animate, 30)
24.894737
103
0.586328
f1118156a68d2b284a82095b9dc24654fc4f92fa
2,864
js
JavaScript
app/scripts/main.js
XDATA-Year-3/sitar-lite
eb7e121983187e0d2d5fd551d7a9c427d7c6cee4
[ "Apache-2.0" ]
1
2015-11-11T19:17:30.000Z
2015-11-11T19:17:30.000Z
dist/scripts/main.js
XDATA-Year-3/sitar-lite
eb7e121983187e0d2d5fd551d7a9c427d7c6cee4
[ "Apache-2.0" ]
1
2015-07-31T17:04:25.000Z
2015-07-31T17:04:25.000Z
dist/scripts/main.js
XDATA-Year-3/sitar-lite
eb7e121983187e0d2d5fd551d7a9c427d7c6cee4
[ "Apache-2.0" ]
null
null
null
(function ($, Backbone, d3, vg) { 'use strict'; var router = new Backbone.Router(); function renderVega(data) { var vegaFile = data.files['vega.json'], that = this, spec; if (vegaFile) { spec = JSON.parse(vegaFile.content); if (spec.data) { spec.data.forEach(function (d) { if (data.files[d.url]) { d.values = JSON.parse(data.files[d.url].content); delete d.url; } }); } vg.parse.spec(spec, function (chart) { chart({el: that}).update(); }); } } function renderGist(user, gist) { var breadcrumb = d3.select('.navigation'); breadcrumb.selectAll('*').remove(); breadcrumb.append('a') .text(user) .attr('href', '#' + user); breadcrumb.append('span').text(' / '); breadcrumb.append('span').text(gist); breadcrumb.append('span').text(' '); breadcrumb.append('small').append('a') .text('source') .attr('href', 'https://gist.github.com/' + user + '/' + gist); d3.json('gist/' + gist, function (error, data) { var gistDiv = d3.select('.vis').append('div'); gistDiv.append('h2').text(data.description); gistDiv.append('div').data([data]).each(renderVega); gistDiv.append('hr'); $.each(data.files, function (name, file) { var fileDiv = d3.select('.vis').append('div'); fileDiv.append('h2').text(name); fileDiv.append('pre').text(file.content); fileDiv.append('hr'); }); }); } function renderUser(user) { var breadcrumb = d3.select('.navigation'); breadcrumb.selectAll('*').remove(); breadcrumb.append('span') .text(user); d3.json('user/' + user, function (error, data) { var gistDivs = d3.select('.vis').selectAll('div') .data(data).enter().append('div'); gistDivs.append('a').attr('href', function (d) { return '#' + user + '/' + d.id; }) .append('h2').text(function (d) { return d.description; }); gistDivs.append('div').each(renderVega); gistDivs.append('hr'); }); } router.route(':user', 'user', function (user) { d3.select('.vis').selectAll('div').remove(); renderUser(user); }); router.route(':user/:gist', 'user', function (user, gist) { d3.select('.vis').selectAll('div').remove(); renderGist(user, gist); }); Backbone.history.start(); }(window.$, window.Backbone, window.d3, window.vg));
33.694118
74
0.481145
f1124049648b27073b802213f55b074d2ecee68c
385
js
JavaScript
day1/http-client/07_agent_false.js
xiaolozhang/node_training
bf6d148e5d98a316ef71b918c09ca1a21e4b77f0
[ "MIT" ]
4
2017-08-17T11:31:54.000Z
2020-03-28T06:54:54.000Z
day1/http-client/07_agent_false.js
xiaolozhang/node_training
bf6d148e5d98a316ef71b918c09ca1a21e4b77f0
[ "MIT" ]
null
null
null
day1/http-client/07_agent_false.js
xiaolozhang/node_training
bf6d148e5d98a316ef71b918c09ca1a21e4b77f0
[ "MIT" ]
null
null
null
var http = require('http'); var url = require('url'); var count = Number(process.argv[2]) || 10; var options = url.parse('http://localhost:8081'); options.agent = false; for (var i=0; i < count; i++) { get(i); } function get(i) { http.get(options, function(res) { res.on('data', function (data) { console.log(i + ' ' + data); }) }).on('error', console.error); }
20.263158
49
0.584416
f1126d0a761da89afdd9994001b4b540866e3f7e
178
js
JavaScript
disabled_plugins/SetId/lang/ja.js
ryumaru/xinha4ryuzine
6d746b8786bc3662b371099305d177d80fc6a2a8
[ "BSD-3-Clause" ]
2
2015-09-26T15:07:29.000Z
2016-07-01T14:26:54.000Z
disabled_plugins/SetId/lang/ja.js
ryumaru/xinha4ryuzine
6d746b8786bc3662b371099305d177d80fc6a2a8
[ "BSD-3-Clause" ]
null
null
null
disabled_plugins/SetId/lang/ja.js
ryumaru/xinha4ryuzine
6d746b8786bc3662b371099305d177d80fc6a2a8
[ "BSD-3-Clause" ]
2
2016-07-01T14:27:09.000Z
2021-02-21T08:24:54.000Z
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Set Id and Name": "IDと名前の設定", "Name/Id": "名前/ID", "Delete": "削除", "Set ID/Name": "IDと名前の設定", "ID/Name:": "ID/名前:" };
19.777778
32
0.539326
f113b41fc67e25ecda7301857725b59542b2e817
1,188
js
JavaScript
11/1.js
aidenfoxx/aoc-2020
241f76d6d7fd8f17ad41db833e73e0e314a0b50b
[ "MIT" ]
1
2020-12-03T11:24:51.000Z
2020-12-03T11:24:51.000Z
11/1.js
aidenfoxx/aoc2020
241f76d6d7fd8f17ad41db833e73e0e314a0b50b
[ "MIT" ]
null
null
null
11/1.js
aidenfoxx/aoc2020
241f76d6d7fd8f17ad41db833e73e0e314a0b50b
[ "MIT" ]
null
null
null
let prevState = []; let nextState = require('fs').readFileSync('data.txt', 'utf8').trim().split('\n').map((row) => row.split(''));; const adjacentsOccupied = (startX, startY) => { let collisions = 0; for (let offsetX = -1; offsetX <= 1; offsetX++) { for (let offsetY = -1; offsetY <= 1; offsetY++) { if (!offsetX && !offsetY) { continue; } if (prevState[startX + offsetX] && prevState[startX + offsetX][startY + offsetY] === '#') { collisions++; } } } return collisions; }; while (JSON.stringify(prevState) !== JSON.stringify(nextState)) { prevState = nextState.map((row) => [...row]); for (let x = 0; x < nextState.length; x++) { for (let y = 0; y < nextState[x].length; y++) { if (nextState[x][y] === '.') { continue; } let collisions = adjacentsOccupied(x, y); if (nextState[x][y] === 'L' && !collisions) { nextState[x][y] = '#' } else if (nextState[x][y] === '#' && collisions > 3) { nextState[x][y] = 'L' } } } } console.log('Ocupied seats:', nextState.reduce((acc, row) => acc + row.reduce((acc, seat) => seat === '#' ? acc + 1: acc, 0), 0));
27.627907
130
0.526094
f11498bc90ffaf30f01dd7a704f9bb261df34929
4,681
js
JavaScript
src/js/components/VolumeTable.js
zhe-sun/dcos-ui
7fbc51578f517a28b981d8652a29fa7ee24622e6
[ "Apache-2.0" ]
null
null
null
src/js/components/VolumeTable.js
zhe-sun/dcos-ui
7fbc51578f517a28b981d8652a29fa7ee24622e6
[ "Apache-2.0" ]
null
null
null
src/js/components/VolumeTable.js
zhe-sun/dcos-ui
7fbc51578f517a28b981d8652a29fa7ee24622e6
[ "Apache-2.0" ]
null
null
null
import classNames from 'classnames'; import {Link} from 'react-router'; import React from 'react'; import {Table} from 'reactjs-components'; import Volume from '../structs/Volume'; import VolumeStatus from '../constants/VolumeStatus'; const METHODS_TO_BIND = ['renderIDColumn']; class VolumeTable extends React.Component { constructor() { super(); METHODS_TO_BIND.forEach((method) => { this[method] = this[method].bind(this); }); } getData(volumes) { return volumes.map(function (volume) { return { id: volume.getId(), host: volume.getHost(), type: volume.getType(), path: volume.getContainerPath(), size: volume.getSize(), mode: volume.getMode(), status: volume.getStatus() }; }); } getColGroup() { return ( <colgroup> <col style={{width: '30%'}} /> <col style={{width: '10%'}} /> <col style={{width: '10%'}} /> <col style={{width: '10%'}} /> <col style={{width: '10%'}} /> <col style={{width: '5%'}} /> <col style={{width: '10%'}} /> </colgroup> ); } getColumnClassName(prop, sortBy, row) { return classNames({ 'highlight': prop === sortBy.prop, 'clickable': row == null }); } getColumnHeading(prop, order, sortBy) { let caretClassNames = classNames( 'caret', { [`caret--${order}`]: order != null, 'caret--visible': prop === sortBy.prop } ); let headingStrings = { id: 'ID', host: 'HOST', type: 'TYPE', path: 'PATH', size: 'SIZE', mode: 'MODE', status: 'STATUS' }; return ( <span> {headingStrings[prop]} <span className={caretClassNames}></span> </span> ); } getColumns() { return [ { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'id', render: this.renderIDColumn, sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'host', sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'type', sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'path', sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'size', sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'mode', sortable: true }, { className: this.getColumnClassName, heading: this.getColumnHeading, prop: 'status', render: this.renderStatusColumn, sortable: true } ]; } renderIDColumn(prop, row) { let id = row[prop]; let params = {volumeID: global.encodeURIComponent(id)}; let routes = this.context.router.getCurrentRoutes(); let currentRouteName = routes[routes.length - 1].name; let routeName = null; if (currentRouteName === 'services-detail') { routeName = 'service-volume-details'; params.id = this.props.params.id; } else if (currentRouteName === 'services-task-details-volumes') { routeName = 'service-task-details-volume-details'; params.id = this.props.params.id; params.taskID = this.props.params.taskID; } else if (currentRouteName === 'nodes-task-details-volumes') { routeName = 'item-volume-detail'; params.nodeID = this.props.params.nodeID; params.taskID = this.props.params.taskID; } return <Link to={routeName} params={params}>{id}</Link>; } renderStatusColumn(prop, row) { let value = row[prop]; let classes = classNames({ 'text-danger': value === VolumeStatus.DETACHED, 'text-success': value === VolumeStatus.ATTACHED }); return ( <span className={classes}> {row[prop]} </span> ); } render() { return ( <Table className="table inverse table-borderless-outer table-borderless-inner-columns flush-bottom" columns={this.getColumns()} colGroup={this.getColGroup()} data={this.getData(this.props.service.getVolumes().getItems())} sortBy={{ prop: 'id', order: 'asc' }} /> ); } } VolumeTable.propTypes = { volumes: React.PropTypes.arrayOf(React.PropTypes.instanceOf(Volume)) }; VolumeTable.contextTypes = { router: React.PropTypes.func }; module.exports = VolumeTable;
24.636842
100
0.575091
f114cd6cac96c647e20d17b46470efadce8a6e9a
289
js
JavaScript
frontend/app/auth-page/SysMsg.js
gurland/SIGame_web
e8e5a90b21dd7bcd4af2306c4329aa6f7a8ee4f5
[ "MIT" ]
6
2018-07-26T04:05:49.000Z
2020-06-10T23:39:56.000Z
frontend/app/auth-page/SysMsg.js
gurland/SIGame_web
e8e5a90b21dd7bcd4af2306c4329aa6f7a8ee4f5
[ "MIT" ]
19
2018-06-13T12:45:57.000Z
2020-04-25T14:17:42.000Z
frontend/app/auth-page/SysMsg.js
gurland/SIGame_web
e8e5a90b21dd7bcd4af2306c4329aa6f7a8ee4f5
[ "MIT" ]
2
2018-06-18T18:49:46.000Z
2020-04-19T06:31:09.000Z
import {Component} from "react"; import React from "react"; import './SysMsg.css' export default class SysMsg extends Component{ render() { return ( <div id={'warnings-block'}> <span>Error message here!</span> </div> ); } }
20.642857
48
0.539792
f115016403f9dcbef630adc83726b0ad8616b163
278
js
JavaScript
packages/nidle-spa/config/defaultSettings.js
hanrenguang/nidle-test
f9ded8e3dad030d28c4a0dcb32d1d5593b1fe28f
[ "MIT" ]
null
null
null
packages/nidle-spa/config/defaultSettings.js
hanrenguang/nidle-test
f9ded8e3dad030d28c4a0dcb32d1d5593b1fe28f
[ "MIT" ]
null
null
null
packages/nidle-spa/config/defaultSettings.js
hanrenguang/nidle-test
f9ded8e3dad030d28c4a0dcb32d1d5593b1fe28f
[ "MIT" ]
1
2022-03-23T01:22:13.000Z
2022-03-23T01:22:13.000Z
const Settings = { navTheme: 'light', // 拂晓蓝 primaryColor: '#96cb87', layout: 'mix', contentWidth: 'Fluid', fixedHeader: false, fixSiderbar: true, colorWeak: false, title: 'Nidle', pwa: false, logo: '/logo.png', iconfontUrl: '' } export default Settings
17.375
26
0.643885
f1158175dc26630b3f4a32ee9c03a5856a393f55
9,757
js
JavaScript
src/pages/gameboard.js
onurcelikeng/Evant_Mobile
4d274214a1fe21dc15c537a4cd3f23d7ef4cbdba
[ "MIT" ]
3
2018-06-02T14:10:47.000Z
2019-04-16T11:17:16.000Z
src/pages/gameboard.js
onurcelikeng/Evant_Mobile
4d274214a1fe21dc15c537a4cd3f23d7ef4cbdba
[ "MIT" ]
6
2018-06-03T08:16:27.000Z
2021-05-06T22:07:42.000Z
src/pages/gameboard.js
onurcelikeng/Evant_Mobile
4d274214a1fe21dc15c537a4cd3f23d7ef4cbdba
[ "MIT" ]
1
2018-06-02T14:10:43.000Z
2018-06-02T14:10:43.000Z
import React from 'react'; import { ListView, View, Image, TouchableOpacity, TouchableHighlight, RefreshControl, Dimensions, ScrollView, StyleSheet, ActivityIndicator } from 'react-native'; import { RkStyleSheet, RkText, RkTextInput, RkTabView } from 'react-native-ui-kitten'; import {Actions} from 'react-native-router-flux'; import {data} from '../data'; import {Avatar} from '../components/avatar'; import {FontAwesome} from '../assets/icon'; import * as gameboardProvider from '../providers/gameboard'; import Login from './login'; import {strings} from '../locales/i18n' const {width} = Dimensions.get('window'); export default class Gameboard extends React.Component { constructor(props) { super(props); this.users = data.getUsers(); let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); this.state = { isLoading: true, isRefreshing: false, selectedIndex: 1 }; this.index = 0; this.setData = this._setData.bind(this); this.renderRow = this._renderRow.bind(this); this.handleChangeTab = this._handleChangeTab.bind(this); } componentDidMount() { this.getGameboard(this.state.selectedIndex).then(() => { this.setState({isLoading: false}); }); } getGameboard(type) { return gameboardProvider.getGameboard(type) .then((responseJson) => { if(responseJson.isSuccess) { console.log(responseJson); this.index = 0; this.setData(responseJson.data, type); } }).catch((err) => {console.log(err)}); } _handleChangeTab(current) { this.index = 0; this.getGameboard(current).then(() => this.setState({selectedIndex:current})); } _setData(data, type) { this.index = 0; let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); if(type == 0) { this.setState({ dailyData: ds.cloneWithRows(data) }) } else if(type == 1) { this.setState({ weeklyData: ds.cloneWithRows(data) }) } else if(type == 2) { this.setState({ monthlyData: ds.cloneWithRows(data) }) } } _onRefresh() { this.index = 0; this.setState({isRefreshing: true}); this.getGameboard(this.state.selectedIndex).then(() => { this.setState({isRefreshing: false}); }); } _renderRow(row) { let name = `${row.firstName} ${row.lastName}`; if(!this.state.isRefreshing) this.index += 1; return ( <TouchableOpacity onPress={() => {if(row.userId != Login.getCurrentUser().userId) Actions.otherProfile({id: row.userId}); else Actions.profile();}}> { row.userId == Login.getCurrentUser().userId ? <View style={[styles.container, {backgroundColor: "#f5ea92"}]}> <RkText style={{marginLeft: 16, marginRight: 16, alignItems: 'center', flexDirection: 'row'}}>{this.index + "."}</RkText> <Avatar img={row.photoUrl} rkType='circle'/> <RkText style={{marginLeft: 16, alignItems: 'center', flexDirection: 'row'}}>{name}</RkText> <View style={{flex: 1}}> </View> <RkText style={{alignItems: 'flex-end', flexDirection: 'row'}}>{row.score + " puan"}</RkText> </View> : <View style={styles.container}> <RkText style={{marginLeft: 16, marginRight: 16, alignItems: 'center', flexDirection: 'row'}}>{this.index + "."}</RkText> <Avatar img={row.photoUrl} rkType='circle'/> <RkText style={{marginLeft: 16, alignItems: 'center', flexDirection: 'row'}}>{name}</RkText> <View style={{flex: 1}}> </View> <RkText style={{alignItems: 'flex-end', flexDirection: 'row'}}>{row.score + " puan"}</RkText> </View> } </TouchableOpacity> ) } renderSeparator(sectionID, rowID) { return ( <View style={styles.separator}/> ) } _keyExtractor(post, index) { return index; } render() { if(this.state.isLoading) { const animating = this.state.isLoading; return ( <View style = {styles.indContainer}> <ActivityIndicator animating = {animating} color = '#bc2b78' size = "large" style = {styles.activityIndicator}/> </View> ); } else { this.index = 0; return ( <RkTabView index={this.state.selectedIndex} rkType='rounded' maxVisibleTabs={3} onTabChanged={(index) => this.handleChangeTab(index)} style={{borderColor: "#ffffff", backgroundColor: '#da6954'}}> <RkTabView.Tab title={strings("gameboard.daily")} style={{backgroundColor: '#da6954'}}> { this.state.dailyData != null ? <ListView style={styles.root} dataSource={this.state.dailyData} keyExtractor={this._keyExtractor} renderRow={this.renderRow} renderSeparator={this.renderSeparator} automaticallyAdjustContentInsets={false} refreshControl={ <RefreshControl refreshing={this.state.isRefreshing} onRefresh={this._onRefresh.bind(this)} /> } enableEmptySections={true}/> : <View style={[styles.root, {flex:1}]}></View> } </RkTabView.Tab> <RkTabView.Tab title={strings("gameboard.weekly")} style={{backgroundColor: '#da6954'}}> { this.state.weeklyData != null ? <ListView style={styles.root} dataSource={this.state.weeklyData} keyExtractor={this._keyExtractor} renderRow={this.renderRow} renderSeparator={this.renderSeparator} automaticallyAdjustContentInsets={false} refreshControl={ <RefreshControl refreshing={this.state.isRefreshing} onRefresh={this._onRefresh.bind(this)} /> } enableEmptySections={true}/> : <View style={[styles.root, {flex:1}]}></View> } </RkTabView.Tab> <RkTabView.Tab title={strings("gameboard.monthly")} style={{backgroundColor: '#da6954'}}> { this.state.monthlyData != null ? <ListView style={styles.root} dataSource={this.state.monthlyData} keyExtractor={this._keyExtractor} renderRow={this.renderRow} renderSeparator={this.renderSeparator} automaticallyAdjustContentInsets={false} refreshControl={ <RefreshControl refreshing={this.state.isRefreshing} onRefresh={this._onRefresh.bind(this)} /> } enableEmptySections={true}/> : <View style={[styles.root, {flex:1}]}></View> } </RkTabView.Tab> </RkTabView> ) } } } let styles = RkStyleSheet.create(theme => ({ root: { backgroundColor: theme.colors.screen.base }, searchContainer: { backgroundColor: theme.colors.screen.bold, paddingHorizontal: 16, paddingVertical: 10, height: 60, alignItems: 'center' }, container: { flexDirection: 'row', paddingVertical: 8, paddingHorizontal: 16, alignItems: 'center' }, avatar: { marginRight: 16 }, separator: { flex: 1, height: StyleSheet.hairlineWidth, backgroundColor: theme.colors.border.base }, circle: { borderRadius: 20, width: 40, height: 40, alignItems: 'center', flexDirection: 'row', marginRight: 16 }, activityIndicator: { flex: 1, justifyContent: 'center', alignItems: 'center', height: 30 }, indContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', marginTop: 70 }, navbar: { width: width, backgroundColor: theme.colors.screen.nav, padding: 10, flexDirection: 'row', alignItems: 'center', borderBottomColor: 'grey', borderBottomWidth: 0.7 }, backButton: { color: theme.colors.text.nav, fontSize: 20 } }));
36.271375
212
0.48683
f1165c60e7ff776704ed4c5144393fc598718dbb
79
js
JavaScript
src/details-screen/index.js
alexjinchina/game-tools
66c90f3a06921557df8d0c892d002559f1ab7b18
[ "MIT" ]
null
null
null
src/details-screen/index.js
alexjinchina/game-tools
66c90f3a06921557df8d0c892d002559f1ab7b18
[ "MIT" ]
null
null
null
src/details-screen/index.js
alexjinchina/game-tools
66c90f3a06921557df8d0c892d002559f1ab7b18
[ "MIT" ]
null
null
null
import DetailesScreen from "./details-screen"; export default DetailesScreen;
19.75
46
0.810127
f116873d637491f22ed64faa75a75427a435acd8
280
js
JavaScript
mongo/mongo.js
MISTCLICK/999DispatcherBot
0ca1c60c80bad75d1ecd3f128bc573889034d181
[ "MIT" ]
null
null
null
mongo/mongo.js
MISTCLICK/999DispatcherBot
0ca1c60c80bad75d1ecd3f128bc573889034d181
[ "MIT" ]
null
null
null
mongo/mongo.js
MISTCLICK/999DispatcherBot
0ca1c60c80bad75d1ecd3f128bc573889034d181
[ "MIT" ]
null
null
null
const mongoose = require('mongoose'); const { mongoURI } = require('../config.json'); //Function that lets you connect to the DB module.exports = async () => { await mongoose.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true }); return mongoose; }
25.454545
47
0.685714
f118dc08c52ae0bada075cd9ae940244e30927c3
928
js
JavaScript
fmt/index.js
popperized/terraform-action
fedb052692f52d7f70a556e64c346ee732e6356a
[ "MIT" ]
1
2019-09-23T00:51:44.000Z
2019-09-23T00:51:44.000Z
fmt/index.js
popperized/terraform-action
fedb052692f52d7f70a556e64c346ee732e6356a
[ "MIT" ]
null
null
null
fmt/index.js
popperized/terraform-action
fedb052692f52d7f70a556e64c346ee732e6356a
[ "MIT" ]
null
null
null
const { Toolkit } = require('actions-toolkit') Toolkit.run(async tools => { await tools.runInWorkspace('git', ['config', '--global', 'user.email', 'actions@github.com']) await tools.runInWorkspace('git', ['config', '--global', 'user.name', 'GitHub Actions']) const { code, stderr } = await tools.runInWorkspace('terraform', ['fmt', '-check', '-recursive'], { reject: false }) switch (code) { case 0: tools.exit.success() case 2: tools.exit.failure(stderr) case 3: await tools.runInWorkspace('terraform', ['fmt', '-write', '-recursive']) await tools.runInWorkspace('git', ['add', '*.tf']) await tools.runInWorkspace('git', ['commit', '-m', 'terraform fmt']) await tools.runInWorkspace('git', ['push', '-u', 'origin', tools.context.payload.pull_request.head.ref]) } }, { event: ['pull_request.opened', 'pull_request.rerequested', 'pull_request.synchronize'] })
38.666667
118
0.634698
f11b73995b3877e65c0fe51b0a20847c172ae318
3,620
js
JavaScript
controllers/annotation_controller.js
INRokh/waldo-experiment
3230a9cd3ac76cebcf151928afefb6cb4da49702
[ "Apache-2.0" ]
1
2020-01-20T00:26:10.000Z
2020-01-20T00:26:10.000Z
controllers/annotation_controller.js
INRokh/waldo-experiment
3230a9cd3ac76cebcf151928afefb6cb4da49702
[ "Apache-2.0" ]
1
2020-02-01T09:52:37.000Z
2020-02-01T09:52:37.000Z
controllers/annotation_controller.js
INRokh/waldo-experiment
3230a9cd3ac76cebcf151928afefb6cb4da49702
[ "Apache-2.0" ]
1
2020-02-07T09:18:37.000Z
2020-02-07T09:18:37.000Z
const AnnotationModel = require("../database/models/annotation_model"); const UserModel = require('../database/models/user_model'); const ImageModel = require('../database/models/image_model'); // show assigned annotations to user async function index(req, res) { // If admin, show all annotations, // if user apply restriction, showing only assigned annotations. let filter = null; if (!req.user.is_admin) { filter = {user_id: req.user._id}; } AnnotationModel.find(filter) .sort('status') .populate('image_id') .then(annotations => res.json(annotations)) .catch(err => res.status(500).send(err)); }; // show annotation by id function showAnnotation(req, res) { AnnotationModel .findById(req.params.id) .populate(['image_id', 'user_id', 'marks.tag_id']) .catch( err => res.status(500).send(err)) .then( annotation => res.json(annotation)); }; // create annotation async function create(req, res){ // only admin can assign annotation if (req.user.is_admin !== true){ return res.status(403) .send("need admin privilege"); } const {image_id, user_id} = req.body; // check if image and user exists in database await ImageModel.findById(image_id) .catch(err => res.status(404).send("image not found" + err)) await UserModel.findById(user_id) .catch(err => res.status(404).send("user not found" + err)) const annotation = await AnnotationModel.create({image_id, user_id}) .catch(err => res.status(500).send(err)) res.send(annotation); } // update marks in annotation async function rewriteMarks(req, res){ let annotation = await AnnotationModel.findById(req.params.id) .catch(err => res.status(404).send("annotation not found" + err)) // mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html // check user if(!req.user._id.equals(annotation.user_id)){ return res.status(403).send("acsess denied for current user") } // check annotation status if(annotation.status !== "NEW" && annotation.status !== "IN_PROGRESS"){ return res.status(403).send("changes can't be made") } const {marks} = req.body; let markObjs = []; for (let i in marks) { let markObj = { tag_id: marks[i].tag_id, coordinates: [] }; for (let j in marks[i].coordinates) { markObj.coordinates.push({ x: marks[i].coordinates[j].x, y: marks[i].coordinates[j].y }); } markObjs.push(markObj); } annotation.marks = markObjs; if(annotation.status === "NEW"){ annotation.status = "IN_PROGRESS" } await annotation.save() .catch(err => res.status(500).send(err)); res.send(annotation.marks) } async function approve(req, res) { const annotation = await AnnotationModel.findById(req.params.id) .catch(err => res.status(500).send(err)); annotation.status = "COMPLETED" await annotation.save() .catch(err => res.status(500).send(err)); res.json(annotation); }; async function reject(req, res) { const annotation = await AnnotationModel.findById(req.params.id) .catch(err => res.status(500).send(err)); annotation.status = "IN_PROGRESS" await annotation.save() .catch(err => res.status(500).send(err)); res.json(annotation); }; async function review(req, res) { const annotation = await AnnotationModel.findById(req.params.id) .catch(err => res.status(500).send(err)); annotation.status = "REVIEW" await annotation.save() .catch(err => res.status(500).send(err)); res.json(annotation); }; module.exports = { index, create, rewriteMarks, showAnnotation, approve, reject, review };
29.430894
75
0.672652
f11bbc59919a19bc3d35251347f10e31bd955b14
269
js
JavaScript
webpack.config.js
LucasIcarus/DataProcessor
cf3903ca096862edd33a0165110e7f096c51bc27
[ "MIT" ]
null
null
null
webpack.config.js
LucasIcarus/DataProcessor
cf3903ca096862edd33a0165110e7f096c51bc27
[ "MIT" ]
null
null
null
webpack.config.js
LucasIcarus/DataProcessor
cf3903ca096862edd33a0165110e7f096c51bc27
[ "MIT" ]
null
null
null
const webpack = require('webpack') module.exports = { entry: 'app.js', module: { rules: [ { test: /\.json$/, use: { loader: 'json-loader' } } ] } }
16.8125
41
0.32342
f11c0709a1f8aa49bc2206a7ae3e94b2f0790adf
187
js
JavaScript
Regular Expressions/31.js
LahkLeKey/FCC-JavaScript-Algorithms-and-Data-Structures-Certification
74fda0671027fe71aad230fbb1b0eba7f72d9fe2
[ "MIT" ]
null
null
null
Regular Expressions/31.js
LahkLeKey/FCC-JavaScript-Algorithms-and-Data-Structures-Certification
74fda0671027fe71aad230fbb1b0eba7f72d9fe2
[ "MIT" ]
null
null
null
Regular Expressions/31.js
LahkLeKey/FCC-JavaScript-Algorithms-and-Data-Structures-Certification
74fda0671027fe71aad230fbb1b0eba7f72d9fe2
[ "MIT" ]
null
null
null
/* FCC Version - 7.0 Reuse Patterns Using Capture Groups Task - 31 / 33 */ let repeatNum = "42 42 42"; let reRegex = /^(\d+)\s\1\s\1$/; let result = reRegex.test(repeatNum);
18.7
39
0.604278
f11cae2516ecb7585046eb9ef1a366c538ced81d
953
js
JavaScript
resources/assets/js/app.js
programando/balquimia-prd
68f5fbb24721d69fd6f34bfce4e59025b39e972e
[ "MIT" ]
null
null
null
resources/assets/js/app.js
programando/balquimia-prd
68f5fbb24721d69fd6f34bfce4e59025b39e972e
[ "MIT" ]
null
null
null
resources/assets/js/app.js
programando/balquimia-prd
68f5fbb24721d69fd6f34bfce4e59025b39e972e
[ "MIT" ]
null
null
null
Vue.config.devtools = true; $(document).ready(function() { $("html , .side-navbar").niceScroll({ cursorcolor:"#47bc6a", cursorwidth:"8px", }); $('.summernote').summernote({ height: 300, width: 1070, }); }); function BuscarEnTabla( Tabla, InputBusqueda ) { // Declare variables var input, filter, table, tr, td, i; input = document.getElementById(InputBusqueda); filter = input.value.toUpperCase(); table = document.getElementById(Tabla); tr = table.getElementsByTagName("tr"); // Loop through all table rows, and hide those who don't match the search query for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } }
22.690476
84
0.551941
f11cdd5603dd1d5a7ee60b9984b7b762b6401262
13,519
js
JavaScript
old/src/ol/expr/parser.js
twpayne/ol3
189ba34955029280ba348a65540e5e36539477f9
[ "BSD-3-Clause", "BSD-2-Clause-FreeBSD", "Apache-2.0", "MIT" ]
1
2022-02-10T17:56:27.000Z
2022-02-10T17:56:27.000Z
old/src/ol/expr/parser.js
ywkwon0812/ol3
0b21c6bea76ccc5de73eee651aaf0449c4f78729
[ "BSD-3-Clause", "BSD-2-Clause-FreeBSD", "Apache-2.0", "MIT" ]
null
null
null
old/src/ol/expr/parser.js
ywkwon0812/ol3
0b21c6bea76ccc5de73eee651aaf0449c4f78729
[ "BSD-3-Clause", "BSD-2-Clause-FreeBSD", "Apache-2.0", "MIT" ]
null
null
null
/** * The logic and naming of methods here are inspired by Esprima (BSD Licensed). * Esprima (http://esprima.org) includes the following copyright notices: * * Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> * Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> * Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> * Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> * Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> * Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> * Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> * Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> * Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> */ goog.provide('ol.expr.Parser'); goog.require('goog.asserts'); goog.require('ol.expr.Call'); goog.require('ol.expr.Comparison'); goog.require('ol.expr.ComparisonOp'); goog.require('ol.expr.Expression'); goog.require('ol.expr.Identifier'); goog.require('ol.expr.Lexer'); goog.require('ol.expr.Literal'); goog.require('ol.expr.Logical'); goog.require('ol.expr.LogicalOp'); goog.require('ol.expr.Math'); goog.require('ol.expr.MathOp'); goog.require('ol.expr.Member'); goog.require('ol.expr.Not'); goog.require('ol.expr.Token'); goog.require('ol.expr.TokenType'); goog.require('ol.expr.UnexpectedToken'); /** * Instances of ol.expr.Parser parse a very limited set of ECMAScript * expressions (http://www.ecma-international.org/ecma-262/5.1/#sec-11). * * - Primary Expression (11.1): * - Identifier (e.g. `foo`) * - Literal (e.g. `"some string"` or `42`) * - Grouped (e.g. `(foo)`) * - Left-Hand-Side Expression (11.2): * - Property Accessors * - Dot notation only * - Function Calls * - Identifier with arguments only (e.g. `foo(bar, 42)`) * - Unary Operators (11.4) * - Logical Not (e.g. `!foo`) * - Multiplicitave Operators (11.5) * - Additive Operators (11.6) * - Relational Operators (11.8) * - <, >, <=, and >= only * - Equality Operators (11.9) * - Binary Logical Operators (11.11) * * @constructor */ ol.expr.Parser = function() { }; /** * Determine the precedence for the given token. * * @param {ol.expr.Token} token A token. * @return {number} The precedence for the given token. Higher gets more * precedence. * @private */ ol.expr.Parser.prototype.binaryPrecedence_ = function(token) { var precedence = 0; if (token.type !== ol.expr.TokenType.PUNCTUATOR) { return precedence; } switch (token.value) { case ol.expr.LogicalOp.OR: precedence = 1; break; case ol.expr.LogicalOp.AND: precedence = 2; break; case ol.expr.ComparisonOp.EQ: case ol.expr.ComparisonOp.NEQ: case ol.expr.ComparisonOp.STRICT_EQ: case ol.expr.ComparisonOp.STRICT_NEQ: precedence = 3; break; case ol.expr.ComparisonOp.GT: case ol.expr.ComparisonOp.LT: case ol.expr.ComparisonOp.GTE: case ol.expr.ComparisonOp.LTE: precedence = 4; break; case ol.expr.MathOp.ADD: case ol.expr.MathOp.SUBTRACT: precedence = 5; break; case ol.expr.MathOp.MULTIPLY: case ol.expr.MathOp.DIVIDE: case ol.expr.MathOp.MOD: precedence = 6; break; default: // punctuator is not a supported binary operator, that's fine break; } return precedence; }; /** * Create a binary expression. * * @param {string} operator Operator. * @param {ol.expr.Expression} left Left expression. * @param {ol.expr.Expression} right Right expression. * @return {ol.expr.Expression} The expression. * @private */ ol.expr.Parser.prototype.createBinaryExpression_ = function(operator, left, right) { var expr; if (ol.expr.Comparison.isValidOp(operator)) { expr = new ol.expr.Comparison( /** @type {ol.expr.ComparisonOp.<string>} */ (operator), left, right); } else if (ol.expr.Logical.isValidOp(operator)) { expr = new ol.expr.Logical( /** @type {ol.expr.LogicalOp.<string>} */ (operator), left, right); } else if (ol.expr.Math.isValidOp(operator)) { expr = new ol.expr.Math( /** @type {ol.expr.MathOp.<string>} */ (operator), left, right); } else { throw new Error('Unsupported binary operator: ' + operator); } return expr; }; /** * Create a call expression. * * @param {ol.expr.Expression} callee Expression for function. * @param {Array.<ol.expr.Expression>} args Arguments array. * @return {ol.expr.Call} Call expression. * @private */ ol.expr.Parser.prototype.createCallExpression_ = function(callee, args) { return new ol.expr.Call(callee, args); }; /** * Create an identifier expression. * * @param {string} name Identifier name. * @return {ol.expr.Identifier} Identifier expression. * @private */ ol.expr.Parser.prototype.createIdentifier_ = function(name) { return new ol.expr.Identifier(name); }; /** * Create a literal expression. * * @param {string|number|boolean|null} value Literal value. * @return {ol.expr.Literal} The literal expression. * @private */ ol.expr.Parser.prototype.createLiteral_ = function(value) { return new ol.expr.Literal(value); }; /** * Create a member expression. * * // TODO: make exp {ol.expr.Member|ol.expr.Identifier} * @param {ol.expr.Expression} object Expression. * @param {ol.expr.Identifier} property Member name. * @return {ol.expr.Member} The member expression. * @private */ ol.expr.Parser.prototype.createMemberExpression_ = function(object, property) { return new ol.expr.Member(object, property); }; /** * Create a unary expression. The only true unary operator supported here is * "!". For +/-, we apply the operator to literal expressions and return * another literal. * * @param {ol.expr.Token} op Operator. * @param {ol.expr.Expression} argument Expression. * @return {ol.expr.Expression} The unary expression. * @private */ ol.expr.Parser.prototype.createUnaryExpression_ = function(op, argument) { goog.asserts.assert(op.value === '!' || op.value === '+' || op.value === '-'); var expr; if (op.value === '!') { expr = new ol.expr.Not(argument); } else if (!(argument instanceof ol.expr.Literal)) { throw new ol.expr.UnexpectedToken(op); } else { // we've got +/- literal if (op.value === '+') { expr = this.createLiteral_( + /** @type {number|string|boolean|null} */ (argument.evaluate())); } else { expr = this.createLiteral_( - /** @type {number|string|boolean|null} */ (argument.evaluate())); } } return expr; }; /** * Parse an expression. * * @param {string} source Expression source. * @return {ol.expr.Expression} Expression. */ ol.expr.Parser.prototype.parse = function(source) { var lexer = new ol.expr.Lexer(source); var expr = this.parseExpression_(lexer); var token = lexer.peek(); if (token.type !== ol.expr.TokenType.EOF) { throw new ol.expr.UnexpectedToken(token); } return expr; }; /** * Parse call arguments * http://www.ecma-international.org/ecma-262/5.1/#sec-11.2.4 * * @param {ol.expr.Lexer} lexer Lexer. * @return {Array.<ol.expr.Expression>} Arguments. * @private */ ol.expr.Parser.prototype.parseArguments_ = function(lexer) { var args = []; lexer.expect('('); if (!lexer.match(')')) { while (true) { args.push(this.parseBinaryExpression_(lexer)); if (lexer.match(')')) { break; } lexer.expect(','); } } lexer.skip(); return args; }; /** * Parse a binary expression. Supported binary expressions: * * - Multiplicative Operators (`*`, `/`, `%`) * http://www.ecma-international.org/ecma-262/5.1/#sec-11.5 * - Additive Operators (`+`, `-`) * http://www.ecma-international.org/ecma-262/5.1/#sec-11.6 * * - Relational Operators (`<`, `>`, `<=`, `>=`) * http://www.ecma-international.org/ecma-262/5.1/#sec-11.8 * * - Equality Operators (`==`, `!=`, `===`, `!==`) * http://www.ecma-international.org/ecma-262/5.1/#sec-11.9 * * - Binary Logical Operators (`&&`, `||`) * http://www.ecma-international.org/ecma-262/5.1/#sec-11.11 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parseBinaryExpression_ = function(lexer) { var left = this.parseUnaryExpression_(lexer); var operator = lexer.peek(); var precedence = this.binaryPrecedence_(operator); if (precedence === 0) { // not a supported binary operator return left; } lexer.skip(); var right = this.parseUnaryExpression_(lexer); var stack = [left, operator, right]; precedence = this.binaryPrecedence_(lexer.peek()); while (precedence > 0) { // TODO: cache operator precedence in stack while (stack.length > 2 && (precedence <= this.binaryPrecedence_(stack[stack.length - 2]))) { right = stack.pop(); operator = stack.pop(); left = stack.pop(); stack.push(this.createBinaryExpression_(operator.value, left, right)); } stack.push(lexer.next()); stack.push(this.parseUnaryExpression_(lexer)); precedence = this.binaryPrecedence_(lexer.peek()); } var i = stack.length - 1; var expr = stack[i]; while (i > 1) { expr = this.createBinaryExpression_(stack[i - 1].value, stack[i - 2], expr); i -= 2; } return expr; }; /** * Parse a group expression. * http://www.ecma-international.org/ecma-262/5.1/#sec-11.1.6 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parseGroupExpression_ = function(lexer) { lexer.expect('('); var expr = this.parseExpression_(lexer); lexer.expect(')'); return expr; }; /** * Parse left-hand-side expression. Limited to Member Expressions * and Call Expressions. * http://www.ecma-international.org/ecma-262/5.1/#sec-11.2 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parseLeftHandSideExpression_ = function(lexer) { var expr = this.parsePrimaryExpression_(lexer); var token = lexer.peek(); if (token.value === '(') { // only allow calls on identifiers (e.g. `foo()` not `foo.bar()`) if (!(expr instanceof ol.expr.Identifier)) { // TODO: more helpful error messages for restricted syntax throw new ol.expr.UnexpectedToken(token); } var args = this.parseArguments_(lexer); expr = this.createCallExpression_(expr, args); } else { // TODO: throw if not Identifier while (token.value === '.') { var property = this.parseNonComputedMember_(lexer); expr = this.createMemberExpression_(expr, property); token = lexer.peek(); } } return expr; }; /** * Parse non-computed member. * http://www.ecma-international.org/ecma-262/5.1/#sec-11.2 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Identifier} Expression. * @private */ ol.expr.Parser.prototype.parseNonComputedMember_ = function(lexer) { lexer.expect('.'); var token = lexer.next(); if (token.type !== ol.expr.TokenType.IDENTIFIER && token.type !== ol.expr.TokenType.KEYWORD && token.type !== ol.expr.TokenType.BOOLEAN_LITERAL && token.type !== ol.expr.TokenType.NULL_LITERAL) { throw new ol.expr.UnexpectedToken(token); } return this.createIdentifier_(String(token.value)); }; /** * Parse primary expression. * http://www.ecma-international.org/ecma-262/5.1/#sec-11.1 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parsePrimaryExpression_ = function(lexer) { var token = lexer.peek(); if (token.value === '(') { return this.parseGroupExpression_(lexer); } lexer.skip(); var expr; var type = token.type; if (type === ol.expr.TokenType.IDENTIFIER) { expr = this.createIdentifier_(/** @type {string} */ (token.value)); } else if (type === ol.expr.TokenType.STRING_LITERAL || type === ol.expr.TokenType.NUMERIC_LITERAL) { // numeric and string literals are already the correct type expr = this.createLiteral_(token.value); } else if (type === ol.expr.TokenType.BOOLEAN_LITERAL) { // because booleans are valid member properties, tokens are still string expr = this.createLiteral_(token.value === 'true'); } else if (type === ol.expr.TokenType.NULL_LITERAL) { expr = this.createLiteral_(null); } else { throw new ol.expr.UnexpectedToken(token); } return expr; }; /** * Parse expression with a unary operator. Limited to logical not operator. * http://www.ecma-international.org/ecma-262/5.1/#sec-11.4 * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parseUnaryExpression_ = function(lexer) { var expr; var operator = lexer.peek(); if (operator.type !== ol.expr.TokenType.PUNCTUATOR) { expr = this.parseLeftHandSideExpression_(lexer); } else if (operator.value === '!' || operator.value === '-' || operator.value === '+') { lexer.skip(); expr = this.parseUnaryExpression_(lexer); expr = this.createUnaryExpression_(operator, expr); } else { expr = this.parseLeftHandSideExpression_(lexer); } return expr; }; /** * Parse an expression. * * @param {ol.expr.Lexer} lexer Lexer. * @return {ol.expr.Expression} Expression. * @private */ ol.expr.Parser.prototype.parseExpression_ = function(lexer) { return this.parseBinaryExpression_(lexer); };
28.223382
80
0.656705
f11d20a7b9bf4f61999faf3d42427e6d66179955
116
js
JavaScript
ui/constants/notifications.js
sanabhass/lbry-desktop
5918aaa5fe5d5189aebd51d30f74e3999258cdca
[ "MIT" ]
null
null
null
ui/constants/notifications.js
sanabhass/lbry-desktop
5918aaa5fe5d5189aebd51d30f74e3999258cdca
[ "MIT" ]
null
null
null
ui/constants/notifications.js
sanabhass/lbry-desktop
5918aaa5fe5d5189aebd51d30f74e3999258cdca
[ "MIT" ]
null
null
null
export const NOTIFICATION_CREATOR_SUBSCRIBER = 'creator_subscriber'; export const NOTIFICATION_COMMENT = 'comment';
38.666667
68
0.844828
f11ec456eaece6c4fcd9d17da02aa82f5b7706a5
180
js
JavaScript
client/src/countdown.js
ViduusEntertainment/synceddb
a04355fba90b298064e4d0d1d78bdf14cff22188
[ "MIT" ]
427
2015-01-28T15:47:01.000Z
2022-03-26T01:04:31.000Z
client/src/countdown.js
ViduusEntertainment/synceddb
a04355fba90b298064e4d0d1d78bdf14cff22188
[ "MIT" ]
43
2015-02-18T08:47:47.000Z
2021-01-03T07:41:39.000Z
client/src/countdown.js
ViduusEntertainment/synceddb
a04355fba90b298064e4d0d1d78bdf14cff22188
[ "MIT" ]
44
2015-02-08T09:32:24.000Z
2022-01-09T20:15:15.000Z
class Countdown { constructor(initial) { this.val = initial || 0; } add(n) { this.val += n; if (this.val === 0) this.onZero(); } } module.exports = Countdown;
15
38
0.561111
f11eebc738778f0eda1c4f959968385027bf88a8
1,176
js
JavaScript
public_html/js/admin/view_news_categories.js
Asynctive/AsynctiveWeb
13cea0253cede835f7316bab79e9f6f2eb19d5d1
[ "MIT" ]
null
null
null
public_html/js/admin/view_news_categories.js
Asynctive/AsynctiveWeb
13cea0253cede835f7316bab79e9f6f2eb19d5d1
[ "MIT" ]
1
2015-07-14T07:06:54.000Z
2015-07-14T07:06:54.000Z
public_html/js/admin/view_news_categories.js
Asynctive/AsynctiveWeb
13cea0253cede835f7316bab79e9f6f2eb19d5d1
[ "MIT" ]
null
null
null
/* * Asynctive Web View News Categories Script * Author: Andy Deveaux */ $('document').ready(function() { $("button[id^='createCategory']").click(function() { window.location.href = '/admin/news/categories/create'; }); $("button[id^='deleteCategories']").click(function() { var ids = []; $("input:checkbox[id='chk-delete']:checked").each(function() { ids.push(this.value); }); if (ids.length == 0 || !confirm('Are you sure you want to delete these categories?')) return; $("p[id='error-msg']").hide(); console.log('Delete categories: ' + ids); $.post('/admin/news/categories/delete', {'category_ids[]': ids}) .done(function(data) { console.log(data); var json = $.parseJSON(data); if (json.success) { // Delete rows $.each(ids, function(index, value) { $("table tr[id='row-" + value + "']").remove(); }); } else { $("p[id='error-msg']").html(json.message); $("p[id='error-msg']").show(); } }); }); $("button[id^='btn-edit-']").click(function() { var id = this.id.split('-')[2]; if (id !== null) window.location.href = '/admin/news/categories/edit/' + id; }); });
25.021277
87
0.568878
f1205e3ed7d716d5a1392b2dd9d5d802a3e5b746
689
js
JavaScript
facia-tool/public/js/utils/sanitize-api-query.js
thisismana/frontend
fd38c2e932454ee994f90e1d2d842d0120802f9a
[ "Apache-2.0" ]
null
null
null
facia-tool/public/js/utils/sanitize-api-query.js
thisismana/frontend
fd38c2e932454ee994f90e1d2d842d0120802f9a
[ "Apache-2.0" ]
null
null
null
facia-tool/public/js/utils/sanitize-api-query.js
thisismana/frontend
fd38c2e932454ee994f90e1d2d842d0120802f9a
[ "Apache-2.0" ]
null
null
null
define([ 'underscore', 'utils/parse-query-params', 'utils/identity' ], function( _, parseQueryParams, identity ) { return function (url) { var bits = (url + '').split('?'); if (bits.length <= 1) { return url; } else { return _.initial(bits).concat( _.map( parseQueryParams(url, { predicateKey: function(key) { return key !== 'api-key'; }, predicateVal: identity }), function(val, key) { return key + '=' + val; } ).join('&') ).join('?'); } }; });
23.758621
82
0.406386
f1206f1b4a116453512c56eb893293d6c7a61913
1,069
js
JavaScript
bin/auth.js
snakazawa/slack2youtube-playlist
b3f0cea94d09a3ecf2550e12db7b849501120fce
[ "MIT" ]
null
null
null
bin/auth.js
snakazawa/slack2youtube-playlist
b3f0cea94d09a3ecf2550e12db7b849501120fce
[ "MIT" ]
1
2017-07-04T21:09:38.000Z
2017-07-04T21:09:38.000Z
bin/auth.js
snakazawa/slack2youtube-playlist
b3f0cea94d09a3ecf2550e12db7b849501120fce
[ "MIT" ]
null
null
null
require('dotenv').config(); const readline = require('readline'); const YoutubeApi = require('../lib/youtube_api'); const api = new YoutubeApi(); (async () => { const res = await authorize(); console.log(res); const info = await api.requestInfo(res.access_token); console.log('Access token info:'); console.log(info); console.log(`Please set "${res.refresh_token}" to YOUTUBE_REFRESH_TOKEN on .env`); })() .then(res => console.log(res)) .catch(e => console.error(e)); async function authorize () { console.log('Authorize this app by visiting this url: ', api.authUrl); const code = await question('Enter the code from that page here: '); const res = await api.requestAccessToken(code); return JSON.parse(res); } async function question (text) { return new Promise(resolve => { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question(text, res => { rl.close(); resolve(res); }); }); }
27.410256
86
0.614593
f12072ce7e58a569429a6ae188e0f216fb354f79
10,726
js
JavaScript
samples/akamai/amp/ais/Ais.js
newrelic/video-akamai-js
6dd2946904ebbfeda141d25e73da6db5e5942154
[ "Apache-2.0" ]
null
null
null
samples/akamai/amp/ais/Ais.js
newrelic/video-akamai-js
6dd2946904ebbfeda141d25e73da6db5e5942154
[ "Apache-2.0" ]
null
null
null
samples/akamai/amp/ais/Ais.js
newrelic/video-akamai-js
6dd2946904ebbfeda141d25e73da6db5e5942154
[ "Apache-2.0" ]
null
null
null
(function (exports) { 'use strict'; var AISEvents = { CHOOSE_PROVIDER: "chooseprovider", AUTHENTICATED: "authenticated", AUTHENTICATION_FAILED: "authenticationfailed", AUTHORIZED: "authorized", AUTHORIZATION_FAILED: "authorizationfailed" }; var Chooser = function Chooser(plugin, response) { babelHelpers.classCallCheck(this, Chooser); var create = akamai.amp.Utils.createElement; var chooser = create("amp-ais-chooser", chooser); var title = create("amp-ais-chooser-title", chooser, "Choose your provider"); var grid = create("amp-ais-chooser-grid", chooser); var menu = create("amp-ais-chooser-menu", chooser); var label = create("amp-ais-chooser-label", menu, "Providers: "); var select = create("amp-ais-chooser-select", menu, null, "select"); var login = create("amp-ais-chooser-login", menu, "Login", "button"); login.onclick = function (event) { var idpId = select.options[select.selectedIndex].value; plugin.login(idpId); }; // create thumbnail grid var idps = response.possible_idps; var groups = response.grouped_idps; var logos = plugin.config.logos || {}; var base = logos.base || ""; if (groups != null && logos.group != null) { var featuredGroup = groups.filter(function (group) { return group.name === logos.group; })[0]; if (featuredGroup != null) { featuredGroup.members.forEach(function (member) { var idp = idps[member]; var div = create("amp-ais-chooser-grid-item", grid); div.onclick = plugin.login.bind(plugin, member); if (idps[member].logos && idps[member].logos[logos.key]) { var img = create("amp-ais-chooser-grid-cell-img", div, null, "img"); var src = idp.logos[logos.key]; img.src = src.indexOf("http") === -1 ? base + src : src; img.alt = idp.display_name; } var span = create("amp-ais-chooser-grid-cell-label", div, idp.display_name, "span"); }); } } if (grid.innerHTML) { chooser.classList.add("amp-ais-chooser-featured"); label.textContent = "Other "; } // populate select menu var options = select.options; var footprints = response.footprints || []; footprints.forEach(function (key) { select.add(new Option("" + idps[key].display_name, key)); }); for (var key in idps) { select.add(new Option("" + idps[key].display_name, key)); } // add the chooser to the player's UI plugin.player.container.appendChild(chooser); }; var AIS = function (_akamai$amp$Plugin) { babelHelpers.inherits(AIS, _akamai$amp$Plugin); function AIS(player, config) { babelHelpers.classCallCheck(this, AIS); var _this = babelHelpers.possibleConstructorReturn(this, (AIS.__proto__ || Object.getPrototypeOf(AIS)).call(this, player, config)); _this.feature = "auth"; _this.client = window.ais_client; _this.client.setLogging(_this.debug); // Enable AIS logging, log to console.log _this.client.setPlatformId(_this.config.platformId); // Set AIS platform_id _this.client.setUseCache(_this.config.useCache === true); // setup media transform if (_this.config.transform !== false) { _this.player.addTransform(akamai.amp.TransformType.MEDIA, { transform: _this.mediaTransform.bind(_this), priority: 1 }); } return _this; } babelHelpers.createClass(AIS, [{ key: "mediaTransform", value: function mediaTransform(media) { var _this2 = this; var status = media.status; if (this.player.security.authorized === true) return media; this.player.busy = true; return this.authenticate().then(function () { _this2.logger.log("[AMP AIS] Authenticated"); return _this2.authorize(); }).then(function (authorization) { _this2.logger.log("[AMP AIS] Authorized"); media.authorization = authorization; _this2.player.busy = false; return media; }); } }, { key: "request", value: function request(type) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } var _this3 = this; var event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : type; return new Promise(function (resolve, reject) { try { _this3.client.assignhandler(event, function (type, resp) { resolve(resp); }); _this3.client[type].apply(_this3.client, args); } catch (error) { reject(error); } }); } }, { key: "bounce", value: function bounce() { return this.request("bounce"); } }, { key: "init", value: function init() { return this.request("init"); } }, { key: "chooser", value: function chooser() { var _this4 = this; return this.request("chooser").then(function (response) { _this4.idps = response.possible_idps = _this4.sort(response.possible_idps, "value", "display_name"); _this4.player.busy = false; return new Promise(function (resolve, reject) { _this4.chooser = new Chooser(_this4, response); _this4.dispatch(AISEvents.CHOOSE_PROVIDER, response); }); }); } }, { key: "identity", value: function identity() { return this.request("identity"); } }, { key: "resourceAccess", value: function resourceAccess(resourceId) { return this.request("resourceAccess", "authz_query", resourceId); } }, { key: "canPreview", value: function canPreview() { var preview = this.data.preview; return preview && typeof preview.duration == "number"; } }, { key: "preview", value: function preview() { return Promise.reject(); } }, { key: "fail", value: function fail() { if (this.canPreview()) { return this.preview(); } else { return this.chooser(); } } }, { key: "authenticate", value: function authenticate() { var _this5 = this; return this.bounce().then(function (response) { if (response.authenticated === true) { return _this5.init().then(function (response) { var key = Object.keys(response.idps)[0]; _this5.idps = Object.assign({ key: key }, response.idps[key]); if (_this5.config.logos && _this5.idps.logos) { _this5.idps.logo = _this5.config.logos.base + _this5.idps.logos[_this5.config.logos.key]; } // logout can be triggered by the server, so add the // listener here instead of waiting for the logout API call _this5.client.assignhandler('logout_result', function () { // Reload experience to restart workflow, could be returned in AuthZ top.location.href = top.location.href; }); _this5.dispatch(AISEvents.AUTHENTICATED, _this5.idps); }); } else { _this5.dispatch(AISEvents.AUTHENTICATION_FAILED, response); return _this5.fail(); } }); } }, { key: "authorize", value: function authorize() { var _this6 = this; var resourceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.config.resourceId; return this.resourceAccess(resourceId).then(function (response) { if (response.authorization === true) { _this6.viewerId = _this6.client.aisuid; var auth = { key: _this6.config.query || "hdnts", token: response.security_token }; _this6.dispatch(AISEvents.AUTHORIZED, auth); return auth; } else { _this6.dispatch(AISEvents.AUTHORIZATION_FAILED, response); return _this6.fail(); } }); } }, { key: "sort", value: function sort(obj, sortType, valueName) { // Object sorter, used for chooser data var returnObj = {}; var data = []; var index = 0; for (var key in obj) { data[index] = { key: key, value: obj[key][valueName] || "" }; index++; } data.sort(function (a, b) { var valueA = sortType === "value" ? a.value.toLowerCase() : a.key.toLowercase(); var valueB = sortType === "value" ? b.value.toLowerCase() : b.key.toLowercase(); if (valueA < valueB) { // sort string ascending return -1; } else if (valueA > valueB) { return 1; } else { return 0; // default return value (no sorting) } }); // Build new object based on sorted array return data.reduce(function (map, item) { map[item.key] = obj[item.key]; return map; }, {}); } }, { key: "getTarget", value: function getTarget() { var method = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "redirect"; return this.config.responseTargets[method]; } }, { key: "setRedirect", value: function setRedirect(method) { try { var devToken = /\/dev\./; var loc = window.top.location.href || window.top.location; var domain = devToken.test(loc) ? loc.replace(devToken, "/") : null; akamai.amp.Cookies.setCookie(this.getTarget(method), loc, 1, "/", domain); } catch (error) {} } }, { key: "launchIdp", value: function launchIdp(idp_platform_id) { var idp = idp_platform_id != null ? this.idps[idp_platform_id] : this.idps; var display = idp.window_display || {}; var method = display.method != null ? display.method : "redirect"; var target = this.getTarget(method); var format = idp_platform_id != null ? this.client.loginFormat(idp_platform_id, target) : this.client.logoutFormat(target); this.setRedirect(method); switch (method) { case "redirect": window.open(format, "_top"); // Full page redirect break; case "popup": //method = display.method || "popup" var width = display.width || 320; var height = display.height || 240; window.open(format, "ais_popup", "width=" + width + ",height=" + height); } } }, { key: "login", value: function login(idp_platform_id) { this.launchIdp(idp_platform_id); } }, { key: "logout", value: function logout() { this.launchIdp(); } }]); return AIS; }(akamai.amp.Plugin); akamai.amp.AMP.registerPlugin("ais", akamai.amp.Plugin.createFactory(AIS)); exports.AIS = AIS; exports.AISEvents = AISEvents; }((this.akamai.amp.ais = this.akamai.amp.ais || {}))); //# sourceMappingURL=Ais.js.map
31.733728
135
0.599851
f12091df905e56faf5f222c01f1bd6a879299287
1,248
js
JavaScript
public/js/frontend/owlcarousel.js
yacinebest/laravel-hwshop
b9831430419a8f0ef490bec70ad80cc97085b690
[ "MIT" ]
null
null
null
public/js/frontend/owlcarousel.js
yacinebest/laravel-hwshop
b9831430419a8f0ef490bec70ad80cc97085b690
[ "MIT" ]
null
null
null
public/js/frontend/owlcarousel.js
yacinebest/laravel-hwshop
b9831430419a8f0ef490bec70ad80cc97085b690
[ "MIT" ]
null
null
null
$("#product-tabs a").click(function(e) { e.preventDefault(); $(this).tab("show"); }); $(document).ready(function() { $(".zoom-gallery").magnificPopup({ delegate: "a", type: "image", closeOnContentClick: false, closeBtnInside: false, mainClass: "mfp-with-zoom mfp-img-mobile", image: { verticalFit: true, titleSrc: function(item) { return ( item.el.attr("title") + ' &middot; <a class="image-source-link" href="' + item.el.attr("data-source") + '" target="_blank">image source</a>' ); } }, gallery: { enabled: true }, zoom: { enabled: true, duration: 300, // don't foget to change the duration also in CSS opener: function(element) { return element.find("img"); } } }); }); $('.owl-carousel').owlCarousel({ loop: true, margin: 10, nav: true, responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 5 } } })
24
76
0.423878
f121ea066b065fd9069573a21b80f9aba9112cca
286
js
JavaScript
dist/index.js
akamuraasai/xmpp-muc-read-marker
3b34cbdb6dcde72c899d3cb00c763dbcace733ec
[ "MIT" ]
null
null
null
dist/index.js
akamuraasai/xmpp-muc-read-marker
3b34cbdb6dcde72c899d3cb00c763dbcace733ec
[ "MIT" ]
null
null
null
dist/index.js
akamuraasai/xmpp-muc-read-marker
3b34cbdb6dcde72c899d3cb00c763dbcace733ec
[ "MIT" ]
null
null
null
'use strict';module.exports=function(client,stanzas,configs){var NS='urn:xmpp:receipts';var readAttribute=stanzas.define({name:'read',element:'read',namespace:NS,fields:{id:stanzas.utils.attribute('id')}});stanzas.withMessage(function(Message){stanzas.extend(Message,readAttribute)})};
143
285
0.79021
f1226e41b321a424eab32dc1ce1e111dd4c47e95
232
js
JavaScript
rotas-avancadas/src/routes/index.js
mrmelem/nodejs
ac21faf24e744e401fa546c29def0109065a19f5
[ "MIT" ]
null
null
null
rotas-avancadas/src/routes/index.js
mrmelem/nodejs
ac21faf24e744e401fa546c29def0109065a19f5
[ "MIT" ]
null
null
null
rotas-avancadas/src/routes/index.js
mrmelem/nodejs
ac21faf24e744e401fa546c29def0109065a19f5
[ "MIT" ]
null
null
null
const app = require('express')(); const Public = require('./public'); app.use(Public); const Auth = require('../middlewares/authRoute'); const Private = require('./private'); app.use(Auth); app.use(Private); module.exports = app;
21.090909
49
0.685345
f122ffaec2ab551c6ceb7f4f84b0242a90fb79c2
291
js
JavaScript
web/client/views/process/loglist/entry.js
cinderblock/guvnor
2dd914c6ed2b7010a297add0750a3b40963e9c63
[ "MIT" ]
453
2015-02-23T17:52:19.000Z
2022-03-16T07:27:20.000Z
web/client/views/process/loglist/entry.js
cinderblock/guvnor
2dd914c6ed2b7010a297add0750a3b40963e9c63
[ "MIT" ]
74
2015-02-20T11:26:27.000Z
2019-02-01T19:04:15.000Z
web/client/views/process/loglist/entry.js
cinderblock/guvnor
2dd914c6ed2b7010a297add0750a3b40963e9c63
[ "MIT" ]
47
2015-02-20T14:37:38.000Z
2022-02-22T08:49:05.000Z
var View = require('ampersand-view') var templates = require('../../../templates') module.exports = View.extend({ template: templates.includes.process.loglist.entry, bindings: { 'model.visible': { type: 'booleanClass', selector: 'li', name: 'visible' } } })
20.785714
53
0.61512
f12317964d68593bc20c10a156fb8a945b0fa113
2,037
js
JavaScript
src/features/articlesfeat/articlesSlice.js
Samk13/react-redux-sim-sam-app
1db4f5caade7f9094d501123694a68a7d85f28c0
[ "MIT" ]
null
null
null
src/features/articlesfeat/articlesSlice.js
Samk13/react-redux-sim-sam-app
1db4f5caade7f9094d501123694a68a7d85f28c0
[ "MIT" ]
null
null
null
src/features/articlesfeat/articlesSlice.js
Samk13/react-redux-sim-sam-app
1db4f5caade7f9094d501123694a68a7d85f28c0
[ "MIT" ]
null
null
null
import { createSlice } from '@reduxjs/toolkit' import { v1 as uuid } from 'uuid' import { setInitialState, SetState, setItem, getItem } from '../../Service/LocalStorage' import { articleInitialState } from '../../app/data' const LOCALSTATE = 'stateSession' export const articleSlice = createSlice({ name: 'articles', initialState: setInitialState(LOCALSTATE, articleInitialState), reducers: { create: { reducer: (state, { payload }) => { SetState(LOCALSTATE, payload) state.push(payload) }, prepare: ({ body, author, type }) => ({ payload: { id: `article_${uuid()}`, createdAt: new Date().toISOString(), imgUrl: 'https://picsum.photos/200/300', lastEdited: '', body, author, type, seen: false } }) }, edit: (state, action) => { const articleEdit = state.find((article) => article.id === action.payload.id) articleEdit.body = action.payload.body articleEdit.author = action.payload.author articleEdit.type = action.payload.type articleEdit.lastEdited = action.payload.lastEdited setItem(LOCALSTATE, state) }, remove: (_, { payload }) => { let _state = getItem(LOCALSTATE) for (let i = 0; i < _state.length; i++) { let article = _state[i] if (article.id === payload) { _state.splice(i, 1) } } setItem(LOCALSTATE, _state) return _state }, toggleSeen: (_, { payload }) => { let _state = getItem(LOCALSTATE) const getSelectedArticle = _state.find((article) => article.id === payload) if (getSelectedArticle) { getSelectedArticle.seen = !getSelectedArticle.seen setItem(LOCALSTATE, _state) return _state } } } }) export const { create, edit, remove, toggleSeen } = articleSlice.actions export const getArticles = ({ articles }) => { return [...Array.from(articles).reverse()] } export default articleSlice.reducer
30.863636
88
0.600393
f1242db1343fa73ad78f196520096305e672292f
264
js
JavaScript
akb48teamsh/fileadmin/templates/v2/public/js/index.js
liurenjie520/backupwww
6989716901922dee3e6824f4de9a7773b9dcab83
[ "Apache-2.0" ]
null
null
null
akb48teamsh/fileadmin/templates/v2/public/js/index.js
liurenjie520/backupwww
6989716901922dee3e6824f4de9a7773b9dcab83
[ "Apache-2.0" ]
null
null
null
akb48teamsh/fileadmin/templates/v2/public/js/index.js
liurenjie520/backupwww
6989716901922dee3e6824f4de9a7773b9dcab83
[ "Apache-2.0" ]
null
null
null
var mySwiper = new Swiper('.banner-swiper', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', }, }); $('#mymember').carousel({ interval:3000, wrap:true, pause:'hover' });
15.529412
45
0.606061
f12494b78706c35891984ff9defa34ab9555f196
8,270
js
JavaScript
packages/node-opcua-basic-types/src/nodeid.js
hschmidtchen/node-opcua
425821c6e800b0f7a002c6281ecfa691c1b1c355
[ "MIT" ]
null
null
null
packages/node-opcua-basic-types/src/nodeid.js
hschmidtchen/node-opcua
425821c6e800b0f7a002c6281ecfa691c1b1c355
[ "MIT" ]
1
2018-03-23T12:42:01.000Z
2018-03-23T12:42:01.000Z
packages/node-opcua-basic-types/src/nodeid.js
bruegth/node-opcua
2df4170f4f1d283257e4af48b5659abdfa71d482
[ "MIT" ]
null
null
null
"use strict"; var Enum = require("node-opcua-enum"); var assert = require("node-opcua-assert"); var makeNodeId = exports.makeNodeId = require("node-opcua-nodeid").makeNodeId; var NodeIdType = exports.NodeIdType = require("node-opcua-nodeid").NodeIdType; var NodeId = require("node-opcua-nodeid").NodeId; var ExpandedNodeId = require("node-opcua-nodeid/src/expanded_nodeid").ExpandedNodeId; var set_flag = require("node-opcua-utils").set_flag; var check_flag = require("node-opcua-utils").check_flag; var isValidGuid= require("./guid").isValidGuid; var decodeGuid= require("./guid").decodeGuid; var decodeString = require("./string").decodeString; var decodeByteString = require("./byte_string").decodeByteString; var decodeUInt32 = require("./integers").decodeUInt32; var encodeGuid= require("./guid").encodeGuid; var encodeString = require("./string").encodeString; var encodeByteString = require("./byte_string").encodeByteString; var encodeUInt32 = require("./integers").encodeUInt32; var getRandomInt = require("./utils").getRandomInt; var EnumNodeIdEncoding = new Enum({ TwoBytes: 0x00, // A numeric value that fits into the two byte representation. FourBytes: 0x01, // A numeric value that fits into the four byte representation. Numeric: 0x02, // A numeric value that does not fit into the two or four byte representations. String: 0x03, // A String value. Guid: 0x04, // A Guid value. ByteString: 0x05, // An opaque (ByteString) value. NamespaceUriFlag: 0x80, // NamespaceUriFlag on ExpandedNodeId is present ServerIndexFlag: 0x40 // NamespaceUriFlag on ExpandedNodeId is present }); function is_uint8(value) { return value >= 0 && value <= 0xFF; } function is_uint16(value) { return value >= 0 && value <= 0xFFFF; } function nodeID_encodingByte(nodeId) { if (!nodeId) { return 0; } assert(nodeId.hasOwnProperty("identifierType")); var encodingByte = 0; if (nodeId.identifierType.is(NodeIdType.NUMERIC)) { if (is_uint8(nodeId.value) && (!nodeId.namespace) && !nodeId.namespaceUri && !nodeId.serverIndex) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.TwoBytes); } else if (is_uint16(nodeId.value) && is_uint8(nodeId.namespace) && !nodeId.namespaceUri && !nodeId.serverIndex) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.FourBytes); } else { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.Numeric); } } else if (nodeId.identifierType.is(NodeIdType.STRING)) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.String); } else if (nodeId.identifierType.is(NodeIdType.BYTESTRING)) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.ByteString); } else if (nodeId.identifierType.is(NodeIdType.GUID)) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.Guid); } if (nodeId.hasOwnProperty("namespaceUri") && nodeId.namespaceUri) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.NamespaceUriFlag); } if (nodeId.hasOwnProperty("serverIndex") && nodeId.serverIndex) { encodingByte = set_flag(encodingByte, EnumNodeIdEncoding.ServerIndexFlag); } return encodingByte; } exports.isValidNodeId = function (nodeId) { if (nodeId === null || nodeId === void 0) { return false; } return nodeId.hasOwnProperty("identifierType") ; }; exports.randomNodeId = function () { var value = getRandomInt(0, 0xFFFFF); var namespace = getRandomInt(0, 3); return makeNodeId(value, namespace); }; function _encodeNodeId(encoding_byte, nodeId, stream) { stream.writeUInt8(encoding_byte);// encoding byte /*jslint bitwise: true */ encoding_byte &= 0x3F; switch (encoding_byte) { case EnumNodeIdEncoding.TwoBytes.value: stream.writeUInt8(nodeId ? nodeId.value : 0); break; case EnumNodeIdEncoding.FourBytes.value: stream.writeUInt8(nodeId.namespace); stream.writeUInt16(nodeId.value); break; case EnumNodeIdEncoding.Numeric.value: stream.writeUInt16(nodeId.namespace); stream.writeUInt32(nodeId.value); break; case EnumNodeIdEncoding.String.value: stream.writeUInt16(nodeId.namespace); encodeString(nodeId.value, stream); break; case EnumNodeIdEncoding.ByteString.value: stream.writeUInt16(nodeId.namespace); encodeByteString(nodeId.value, stream); break; default: assert(encoding_byte === EnumNodeIdEncoding.Guid.value); stream.writeUInt16(nodeId.namespace); encodeGuid(nodeId.value, stream); break; } } exports.encodeNodeId = function (nodeId, stream) { var encoding_byte = nodeID_encodingByte(nodeId); /*jslint bitwise: true */ encoding_byte &= 0x3F; _encodeNodeId(encoding_byte, nodeId, stream); }; exports.encodeExpandedNodeId = function (expandedNodeId, stream) { assert(expandedNodeId,"encodeExpandedNodeId: must provide a valid expandedNodeId"); var encodingByte = nodeID_encodingByte(expandedNodeId); _encodeNodeId(encodingByte, expandedNodeId, stream); if (check_flag(encodingByte, EnumNodeIdEncoding.NamespaceUriFlag)) { encodeString(expandedNodeId.namespaceUri, stream); } if (check_flag(encodingByte, EnumNodeIdEncoding.ServerIndexFlag)) { encodeUInt32(expandedNodeId.serverIndex, stream); } }; var _decodeNodeId = function (encoding_byte, stream) { var value, namespace, nodeIdType; /*jslint bitwise: true */ encoding_byte &= 0x3F; switch (encoding_byte) { case EnumNodeIdEncoding.TwoBytes.value: value = stream.readUInt8(); nodeIdType = NodeIdType.NUMERIC; break; case EnumNodeIdEncoding.FourBytes.value: namespace = stream.readUInt8(); value = stream.readUInt16(); nodeIdType = NodeIdType.NUMERIC; break; case EnumNodeIdEncoding.Numeric.value: namespace = stream.readUInt16(); value = stream.readUInt32(stream); nodeIdType = NodeIdType.NUMERIC; break; case EnumNodeIdEncoding.String.value: namespace = stream.readUInt16(); value = decodeString(stream); nodeIdType = NodeIdType.STRING; break; case EnumNodeIdEncoding.ByteString.value: namespace = stream.readUInt16(); value = decodeByteString(stream); nodeIdType = NodeIdType.BYTESTRING; break; default: if (encoding_byte !== EnumNodeIdEncoding.Guid.value) { /*jslint bitwise: true */ console.log(" encoding_byte = " + encoding_byte.toString(16), encoding_byte, encoding_byte & 0x3F); throw new Error(" encoding_byte = " + encoding_byte.toString(16)); } namespace = stream.readUInt16(); value = decodeGuid(stream); nodeIdType = NodeIdType.GUID; assert(isValidGuid(value)); break; } return new NodeId(nodeIdType, value, namespace); }; exports.decodeNodeId = function (stream) { var encoding_byte = stream.readUInt8(); return _decodeNodeId(encoding_byte, stream); }; exports.decodeExpandedNodeId = function (stream) { var encoding_byte = stream.readUInt8(); var expandedNodeId = _decodeNodeId(encoding_byte, stream); expandedNodeId.namespaceUri = null; expandedNodeId.serverIndex = 0; if (check_flag(encoding_byte, EnumNodeIdEncoding.NamespaceUriFlag)) { expandedNodeId.namespaceUri = decodeString(stream); } if (check_flag(encoding_byte, EnumNodeIdEncoding.ServerIndexFlag)) { expandedNodeId.serverIndex = decodeUInt32(stream); } var e = expandedNodeId; return new ExpandedNodeId( e.identifierType, e.value,e.namespace, e.namespaceUri, e.serverIndex); }; exports.coerceNodeId = require("node-opcua-nodeid").coerceNodeId; exports.coerceExpandedNodeId = require("node-opcua-nodeid/src/expanded_nodeid").coerceExpandedNodeId;
35.191489
122
0.676058
f1284abd54c12cf319633c6afd2790ae3726b3b6
78
js
JavaScript
doc/html/search/files_1.js
hugobarreiro/ea872-dictionary
79bc687dea358b1ae0928106efd2779f5f9b3beb
[ "MIT" ]
null
null
null
doc/html/search/files_1.js
hugobarreiro/ea872-dictionary
79bc687dea358b1ae0928106efd2779f5f9b3beb
[ "MIT" ]
null
null
null
doc/html/search/files_1.js
hugobarreiro/ea872-dictionary
79bc687dea358b1ae0928106efd2779f5f9b3beb
[ "MIT" ]
null
null
null
var searchData= [ ['logger_2ec',['logger.c',['../logger_8c.html',1,'']]] ];
15.6
56
0.564103
f12a475ce28cbe16dde33ee960c2184b84ac2a09
9,089
js
JavaScript
src/states/Travel.js
mikkpr/LD38
5c5751ebd0f8676ca76a943117b4460310877ded
[ "MIT" ]
null
null
null
src/states/Travel.js
mikkpr/LD38
5c5751ebd0f8676ca76a943117b4460310877ded
[ "MIT" ]
1
2017-04-28T06:56:34.000Z
2017-04-28T06:56:34.000Z
src/states/Travel.js
mikkpr/LD38
5c5751ebd0f8676ca76a943117b4460310877ded
[ "MIT" ]
null
null
null
import Phaser from 'phaser' import Player from '../sprites/Player' import Turret from '../sprites/Turret' import { enableMusicForState } from '../utils.js' export default class extends Phaser.State { init (tilemap) { this.tilemap = tilemap this.game.tilemap = tilemap } create () { this.disableMusic = enableMusicForState(this) this.game.world.enableBody = true this.game.physics.startSystem(Phaser.Physics.ARCADE) this.game.curve.setPoints([50, 0, 0, 0, 50]) this.map = this.game.add.tilemap(this.tilemap) switch (this.tilemap) { case 'mars_travel': this.map.addTilesetImage('lofi_scifi_ships_2_4x', 'tiles_ships_2') // fallthrough case 'earth_travel': this.map.addTilesetImage('lofi_environment_4x', 'tiles_lofi_environment') this.map.addTilesetImage('lofi_scifi_stations_4x', 'tiles_lofi_stations') this.map.addTilesetImage('lofi_scifi_stations_2_4x', 'tiles_lofi_stations_2') this.map.addTilesetImage('lofi_scifi_stations_3_4x', 'tiles_lofi_stations_3') this.map.addTilesetImage('lofi_scifi_items_4x', 'tiles_lofi_items') this.map.addTilesetImage('lofi_interface_4x', 'tiles_interface') } // Add both the background and ground layers. this.background = this.game.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, this.tilemap === 'earth_travel' ? 'bg1' : 'bg2' ) this.map.createLayer('backgroundlayer').resizeWorld() this.groundLayer = this.map.createLayer('groundlayer') this.map.setCollisionBetween(1, 1000, true, 'groundlayer') // Add the sprite to the game and enable arcade physics on it this.player = new Player(this.game, 100, 256) this.world.add(this.player) // Player physics in this state. this.maxVelocity = 800 // Default max velocity, can be overridden by dashing. this.player.body.maxVelocity.x = this.maxVelocityX this.player.body.gravity.x = 1800 this.player.body.collideWorldBounds = true this.player.body.onWorldBounds = new Phaser.Signal() this.player.body.onWorldBounds.add(this.hitWorldBounds, this) // Add turrets. this.turretGroup = this.game.add.group() switch (this.tilemap) { case 'earth_travel': const turretSheetEarth = 'scifi_monsters_large' const bulletSheetEarth = 'environment_sprites' new Array( // Use new Array instead of [] so webpack does not get confused. [ 600, 100, 18, 164, {target: this.player, bullets: 5, rate: 300, cone: 0}], [ 7600, 100, 18, 164, {bullets: 10, rate: 50, speed: 250}], [ 9600, 100, 18, 164, {target: this.player, bullets: 10, rate: 50, speed: 400, cone: 0}], [10560, 300, 18, 164, {target: this.player, bullets: 10, rate: 50, speed: 400, cone: 0}], [11200, 200, 18, 164, {target: this.player, bullets: 10, rate: 50}], [11900, 366, 18, 164], [11900, 32, 18, 164], [14720, 100, 18, 164], [20672, 270, 18, 164, {target: this.player, bullets: 12, rate: 40, homing: true}] ).forEach(([x, y, turretFrame, bulletFrame, options]) => { this.turretGroup.add(new Turret(this.game, x, y, turretSheetEarth, turretFrame, bulletSheetEarth, bulletFrame, options)) }) setTimeout(() => { this.player.say("... And that number is about to go down.", () => {}) }, 300) break case 'mars_travel': const turretSheetMars = 'ships_2_large' const bulletSheetMars = 'environment_sprites' new Array( // Use new Array instead of [] so webpack does not get confused. [ 500, 90, 44, 160, {target: this.player, bullets: 4, rate: 20, cone: 0}], [ 3264, 160, 55, 161, {bullets: 10, rate: 200, speed: 100}], [ 3800, 160, 55, 162, {bullets: 10, rate: 200, speed: 100}], [ 4200, 160, 55, 163, {bullets: 10, rate: 200, speed: 100}], [ 4600, 160, 55, 161, {bullets: 10, rate: 200, speed: 100}], [ 5536, 32, 53, 161, {target: this.player, bullets: 4, rate: 20, cone: 20, speed: 400}], [ 5536, 128, 53, 161, {target: this.player, bullets: 4, rate: 20, cone: 20, speed: 400}], [ 6000, 186, 53, 162, {target: this.player, bullets: 4, rate: 20, cone: 20, speed: 400}], [ 9600, 100, 55, 162, {target: this.player, bullets: 10, rate: 50, speed: 400, cone: 0}], [11200, 200, 55, 163, {target: this.player, bullets: 10, rate: 50}], [11900, 366, 55, 161, {rate: 400, cone: 0, speed: 80}], [11900, 32, 55, 162, {rate: 400, cone: 0, speed: 80}], [18720, 280, 55, 162, {target:this.player, bullets: 10, rate: 200, cone: 0, speed: 400}], [20672, 256, 42, 160, {target: this.player, bullets: 12, rate: 40}], [24864, 160, 44, 160, {target: this.player, bullets: 12, rate: 40}], [24992, 160, 44, 160, {target: this.player, bullets: 12, rate: 40}] ).forEach(([x, y, turretFrame, bulletFrame, options]) => { this.turretGroup.add(new Turret(this.game, x, y, turretSheetMars, turretFrame, bulletSheetMars, bulletFrame, options)) }) setTimeout(() => { this.player.say("I hear hookers are 50% better here", () => {}) }, 300) } // Full-screen pulse effect alpha. this.pulse = this.game.add.graphics() this.pulseAlpha = 0 this.game.add.tween(this).to({ pulseAlpha: 0.3 }, 200, null, true, 0, -1, true) // Make the camera follow the sprite this.game.camera.follow(this.player, null, 0.5, 0) this.game.camera.deadzone = new Phaser.Rectangle(this.game.camera.width / 3, 0, 10, this.game.camera.height) this.game.scale.pageAlignHorizontally = true this.game.scale.pageAlignVertically = true this.game.scale.refresh() this.game.time.advancedTiming = true const world = this.tilemap === 'earth_travel' ? 'earth' : 'mars' this.game.levelTimes[world].start = +(new Date()) } updateTime () { const world = this.tilemap === 'earth_travel' ? 'earth' : 'mars' this.game.levelTimes[world].stop = +(new Date()) } render () { // Draw full-screen pulse effect. this.pulse.clear() this.pulse.beginFill(0xd61b7f, this.pulseAlpha) this.pulse.drawRect(this.game.camera.x, this.game.camera.y, this.game.width, this.game.height) this.pulse.endFill() const world = this.tilemap === 'earth_travel' ? 'earth' : 'mars' this.game.debug.text(this.time.fps, 10, 20, '#00ff00') this.game.debug.text((this.game.levelTimes[world].stop - this.game.levelTimes[world].start) / 1000.0, 10, 50, '#00ff00') this.game.debug.text(`Alternate dimensions where you could have died: ${this.game.deathCounter}`, 500, 20, '#00ff00') } update () { this.updateTime() this.background.position.x = this.game.camera.position.x this.background.position.y = this.game.camera.position.y this.background.tilePosition.x -= this.player.body.velocity.x / 1500.0 // Player collides with ground and turrets. this.game.physics.arcade.collide(this.player, this.groundLayer, this.player.resetWithAnimation, null, this.player) this.game.physics.arcade.collide(this.player, this.turretGroup, this.player.resetWithAnimation, null, this.player) // Bullets collide with player, ground, and turrets. this.turretGroup.forEach((turret) => { turret.weapon.forEach((bullet) => { // Fuck it, we are running out of time. const kill = this.game.physics.arcade.collide(bullet, this.player, this.player.resetWithAnimation, null, this.player) if (kill) { bullet.kill() if (turret.target === this.player) { turret.deaggro() } } this.game.physics.arcade.collide(bullet, this.groundLayer, bullet.kill, null, bullet) this.game.physics.arcade.collide(bullet, this.turretGroup, bullet.kill, null, bullet) }) }) // Vertical movement is instant. const accY = 350 if (this.player.isMovingUp()) { this.player.body.velocity.y = -accY } else if (this.player.isMovingDown()) { this.player.body.velocity.y = accY } else { this.player.body.velocity.y = 0 // Vertical movement has to be precise } // Horizontal dashing is almost instant, braking takes time. const accX = 360 if (this.player.isMovingRight()) { this.player.body.maxVelocity.x = this.maxVelocity + accX this.player.body.velocity.x += accX } else if (this.player.isMovingLeft()) { this.player.body.maxVelocity.x = this.maxVelocity - accX this.player.body.velocity.x -= accX / 6 } else { this.player.body.maxVelocity.x = this.maxVelocity } } shutdown () { const world = this.tilemap === 'earth_travel' ? 'earth' : 'mars' this.game.levelTimes[world].stop = +(new Date()) this.disableMusic() } hitWorldBounds (sprite, up, down, left, right) { if (sprite === this.player && right === true) { this.game.nextState() } } }
41.692661
125
0.634173
f12be86d903203d801c35f93ea9576f448893fb4
68,099
js
JavaScript
build/kissy-nodejs-min.js
zhaozexin/kissy
e276722b92bd434d399a15fbd4f4fac0424a5ac2
[ "MIT" ]
null
null
null
build/kissy-nodejs-min.js
zhaozexin/kissy
e276722b92bd434d399a15fbd4f4fac0424a5ac2
[ "MIT" ]
null
null
null
build/kissy-nodejs-min.js
zhaozexin/kissy
e276722b92bd434d399a15fbd4f4fac0424a5ac2
[ "MIT" ]
1
2020-08-14T06:24:01.000Z
2020-08-14T06:24:01.000Z
/* Copyright 2011, KISSY UI Library v1.20dev MIT Licensed build time: ${build.time} */ (function(){var c=require("jsdom").jsdom;document=c("<html><head></head><body></body></html>");window=document.createWindow();location=window.location;navigator=window.navigator;KISSY={__HOST:window};exports.KISSY=window.KISSY=KISSY})(); (function(c){function e(d){for(var a=0;a<d.length;a++)if(d[a].match(/\/$/))d[a]+="index";return d}function r(d,a){if(!a)return a;if(c.isArray(a)){for(var b=0;b<a.length;b++)a[b]=r(d,a[b]);return a}if(a.lastIndexOf("../",0)==0||a.lastIndexOf("./",0)==0){b="";var h;if((h=d.lastIndexOf("/"))!=-1)b=d.substring(0,h+1);return i.normalize(b+a)}else return a.indexOf("./")!=-1||a.indexOf("../")!=-1?i.normalize(a):a}var i=require("path");c.Env={};c.Env.mods={};var f=c.Env.mods;(function(d,a){for(var b in a)if(a.hasOwnProperty(b))d[b]= a[b]})(c,{Config:{base:__filename.replace(/[^/]*$/i,"")},add:function(d,a,b){if(c.isFunction(d)){b=a;a=d;d=this.currentModName}f[d]={name:d,fn:a};c.mix(f[d],b)},_packages:function(d){var a;a=this.__packages=this.__packages||{};for(var b=0;b<d.length;b++){var h=d[b];a[h.name]=h;if(h.path&&!h.path.match(/\/$/))h.path+="/"}},_getPath:function(d){var a=this.__packages=this.__packages||{},b="",h;for(h in a)if(a.hasOwnProperty(h))if(d.lastIndexOf(h,0)==0)if(h.length>b)b=h;return(a[b]&&a[b].path||this.Config.base)+ d},_combine:function(d,a){var b=this,h;if(c.isObject(d))c.each(d,function(l,m){c.each(l,function(q){b._combine(q,m)})});else{h=b.__combines=b.__combines||{};if(a)h[d]=a;else return h[d]||d}},require:function(d){d=f[d];var a=this.onRequire&&this.onRequire(d);if(a!==undefined)return a;return d&&d.value},_attach:function(d){var a=this._getPath(this._combine(d)),b=f[d];if(!b){this.currentModName=d;require(a)}b=f[d];if(!b.attached){b.requires=b.requires||[];a=b.requires;r(d,a);d=[this];for(var h=0;h<a.length;h++){this._attach(a[h]); d.push(this.require(a[h]))}b.value=b.fn.apply(null,d);b.attached=true}},use:function(d,a){d=d.replace(/\s+/g,"").split(",");e(d);var b=this,h=[this];c.each(d,function(l){b._attach(l);h.push(b.require(l))});a&&a.apply(null,h)}})})(KISSY); (function(c,e){var r=this,i={mix:function(a,b,h,l){if(!b||!a)return a;if(h===e)h=true;var m,q,t;if(l&&(t=l.length))for(m=0;m<t;m++){q=l[m];if(q in b)if(h||!(q in a))a[q]=b[q]}else for(q in b)if(h||!(q in a))a[q]=b[q];return a}},f=r&&r[c]||{},d=0;r=f.__HOST||(f.__HOST=r||{});c=r[c]=i.mix(f,i,false);c.mix(c,{__APP_MEMBERS:["namespace"],__APP_INIT_METHODS:["__init"],version:"1.20dev",buildTime:"20110526132528",merge:function(){var a={},b,h=arguments.length;for(b=0;b<h;b++)c.mix(a,arguments[b]);return a}, augment:function(){var a=c.makeArray(arguments),b=a.length-2,h=a[0],l=a[b],m=a[b+1],q=1;if(!c.isArray(m)){l=m;m=e;b++}if(!c.isBoolean(l)){l=e;b++}for(;q<b;q++)c.mix(h.prototype,a[q].prototype||a[q],l,m);return h},extend:function(a,b,h,l){if(!b||!a)return a;var m=Object.create?function(A,p){return Object.create(A,{constructor:{value:p}})}:function(A,p){function v(){}v.prototype=A;var u=new v;u.constructor=p;return u},q=b.prototype,t;t=m(q,a);a.prototype=c.mix(t,a.prototype);a.superclass=m(q,b);h&& c.mix(t,h);l&&c.mix(a,l);return a},__init:function(){this.Config=this.Config||{};this.Env=this.Env||{};this.Config.debug=""},namespace:function(){var a=c.makeArray(arguments),b=a.length,h=null,l,m,q,t=a[b-1]===true&&b--;for(l=0;l<b;l++){q=(""+a[l]).split(".");h=t?r:this;for(m=r[q[0]]===h?1:0;m<q.length;++m)h=h[q[m]]=h[q[m]]||{}}return h},app:function(a,b){var h=c.isString(a),l=h?r[a]||{}:a,m=0,q=c.__APP_INIT_METHODS.length;for(c.mix(l,this,true,c.__APP_MEMBERS);m<q;m++)c[c.__APP_INIT_METHODS[m]].call(l); c.mix(l,c.isFunction(b)?b():b);h&&(r[a]=l);return l},config:function(a){for(var b in a)this["_"+b]&&this["_"+b](a[b])},log:function(a,b,h){if(c.Config.debug){if(h)a=h+": "+a;if(r.console!==e&&console.log)console[b&&console[b]?b:"log"](a)}},error:function(a){if(c.Config.debug)throw a;},guid:function(a){return(a||"")+d++}});c.__init();return c})("KISSY"); (function(c,e){function r(){if(x)return x;var k=p;c.each(j,function(n){k+=n+"|"});k=k.slice(0,-1);return x=RegExp(k,"g")}function i(){if(B)return B;var k=p;c.each(s,function(n){k+=n+"|"});k+="&#(\\d{1,5});";return B=RegExp(k,"g")}function f(k){var n=typeof k;return k===null||n!=="object"&&n!=="function"}var d=c.__HOST,a=Object.prototype,b=a.toString,h=a.hasOwnProperty;a=Array.prototype;var l=a.indexOf,m=a.lastIndexOf,q=a.filter,t=String.prototype.trim,A=a.map,p="",v=/^\s+|\s+$/g,u=encodeURIComponent, o=decodeURIComponent,g={},j={"&amp;":"&","&gt;":">","&lt;":"<","&quot;":'"'},s={},x,B,y;for(y in j)s[j[y]]=y;c.mix(c,{type:function(k){return k==null?String(k):g[b.call(k)]||"object"},isNull:function(k){return k===null},isUndefined:function(k){return k===e},isEmptyObject:function(k){for(var n in k)if(n!==e)return false;return true},isPlainObject:function(k){return k&&b.call(k)==="[object Object]"&&"isPrototypeOf"in k},clone:function(k,n,w){var z=k,C,D,E=w||{};if(k&&((C=c.isArray(k))||c.isPlainObject(k))){if(k["__~ks_cloned"])return E[k["__~ks_cloned"]]; k["__~ks_cloned"]=z=c.guid();E[z]=k;if(C)z=n?c.filter(k,n):k.concat();else{z={};for(D in k)if(D!=="__~ks_cloned"&&k.hasOwnProperty(D)&&(!n||n.call(k,k[D],D,k)!==false))z[D]=c.clone(k[D],n,E)}}if(!w){c.each(E,function(G){if(G["__~ks_cloned"])try{delete G["__~ks_cloned"]}catch(F){G["__~ks_cloned"]=e}});E=e}return z},trim:t?function(k){return k==e?p:t.call(k)}:function(k){return k==e?p:k.toString().replace(v,p)},substitute:function(k,n,w){if(!c.isString(k)||!c.isPlainObject(n))return k;return k.replace(w|| /\\?\{([^{}]+)\}/g,function(z,C){if(z.charAt(0)==="\\")return z.slice(1);return n[C]!==e?n[C]:p})},each:function(k,n,w){var z,C=0,D=k&&k.length,E=D===e||c.type(k)==="function";w=w||d;if(E)for(z in k){if(n.call(w,k[z],z,k)===false)break}else for(z=k[0];C<D&&n.call(w,z,C,k)!==false;z=k[++C]);return k},indexOf:l?function(k,n){return l.call(n,k)}:function(k,n){for(var w=0,z=n.length;w<z;++w)if(n[w]===k)return w;return-1},lastIndexOf:m?function(k,n){return m.call(n,k)}:function(k,n){for(var w=n.length- 1;w>=0;w--)if(n[w]===k)break;return w},unique:function(k,n){var w=k.slice();n&&w.reverse();for(var z=0,C,D;z<w.length;){for(D=w[z];(C=c.lastIndexOf(D,w))!==z;)w.splice(C,1);z+=1}n&&w.reverse();return w},inArray:function(k,n){return c.indexOf(k,n)>-1},filter:q?function(k,n,w){return q.call(k,n,w||this)}:function(k,n,w){var z=[];c.each(k,function(C,D,E){if(n.call(w||this,C,D,E))z.push(C)});return z},map:A?function(k,n,w){return A.call(k,n,w||this)}:function(k,n,w){for(var z=k.length,C=Array(z),D=0;D< z;D++){var E=c.isString(k)?k.charAt(D):k[D];if(E||D in k)C[D]=n.call(w||this,E,D,k)}return C},reduce:function(k,n){var w=k.length;if(typeof n!=="function")throw new TypeError;if(w==0&&arguments.length==2)throw new TypeError;var z=0,C;if(arguments.length>=3)C=arguments[2];else{do{if(z in k){C=k[z++];break}if(++z>=w)throw new TypeError;}while(1)}for(;z<w;){if(z in k)C=n.call(e,C,k[z],z,k);z++}return C},now:function(){return(new Date).getTime()},fromUnicode:function(k){return k.replace(/\\u([a-f\d]{4})/ig, function(n,w){return String.fromCharCode(parseInt(w,16))})},escapeHTML:function(k){return k.replace(r(),function(n){return s[n]})},unEscapeHTML:function(k){return k.replace(i(),function(n,w){return j[n]||String.fromCharCode(+w)})},makeArray:function(k){if(k===null||k===e)return[];if(c.isArray(k))return k;if(typeof k.length!=="number"||c.isString(k)||c.isFunction(k))return[k];for(var n=[],w=0,z=k.length;w<z;w++)n[w]=k[w];return n},param:function(k,n,w,z){if(!c.isPlainObject(k))return p;n=n||"&";w= w||"=";if(c.isUndefined(z))z=true;var C=[],D,E;for(D in k){E=k[D];D=u(D);if(f(E))C.push(D,w,u(E+p),n);else if(c.isArray(E)&&E.length)for(var G=0,F=E.length;G<F;++G)if(f(E[G]))C.push(D,z?u("[]"):p,w,u(E[G]+p),n)}C.pop();return C.join(p)},unparam:function(k,n,w){if(typeof k!=="string"||(k=c.trim(k)).length===0)return{};n=n||"&";w=w||"=";var z={};k=k.split(n);for(var C,D,E=0,G=k.length;E<G;++E){n=k[E].split(w);C=o(n[0]);try{D=o(n[1]||p)}catch(F){D=n[1]||p}if(c.endsWith(C,"[]"))C=C.substring(0,C.length- 2);if(h.call(z,C))if(c.isArray(z[C]))z[C].push(D);else z[C]=[z[C],D];else z[C]=D}return z},later:function(k,n,w,z,C){n=n||0;z=z||{};var D=k,E=c.makeArray(C),G;if(c.isString(k))D=z[k];D||c.error("method undefined");k=function(){D.apply(z,E)};G=w?setInterval(k,n):setTimeout(k,n);return{id:G,interval:w,cancel:function(){this.interval?clearInterval(G):clearTimeout(G)}}},startsWith:function(k,n){return k.lastIndexOf(n,0)==0},endsWith:function(k,n){var w=k.length-n.length;return k.indexOf(n,w)==w}});c.mix(c, {isBoolean:f,isNumber:f,isString:f,isFunction:f,isArray:f,isDate:f,isRegExp:f,isObject:f});c.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(k,n){g["[object "+k+"]"]=n=k.toLowerCase();c["is"+k]=function(w){return c.type(w)==n}})})(KISSY);(function(c){if(!("require"in this)){c.__loader={};c.__loaderUtils={};c.__loaderData={}}})(KISSY);(function(c,e){"require"in this||c.mix(e,{LOADING:1,LOADED:2,ERROR:3,ATTACHED:4})})(KISSY,KISSY.__loaderData); (function(c,e,r){if(!c.use){c.mix(r,{isWebKit:!!navigator.userAgent.match(/AppleWebKit/),IE:!!navigator.userAgent.match(/MSIE/),isCss:function(d){return/\.css(?:\?|$)/i.test(d)},isLinkNode:function(d){return d.nodeName.toLowerCase()=="link"},normalizePath:function(d){d=d.split("/");for(var a=[],b,h=0;h<d.length;h++){b=d[h];if(b!=".")b==".."?a.pop():a.push(b)}return a.join("/")},normalDepModuleName:function d(a,b){if(!b)return b;if(c.isArray(b)){for(var h=0;h<b.length;h++)b[h]=d(a,b[h]);return b}if(i(b, "../")||i(b,"./")){h="";var l;if((l=a.lastIndexOf("/"))!=-1)h=a.substring(0,l+1);return f(h+b)}else return b.indexOf("./")!=-1||b.indexOf("../")!=-1?f(b):b},removePostfix:function(d){return d.replace(/(-min)?\.js[^/]*$/i,"")},normalBasePath:function(d){if(d.charAt(d.length-1)!="/")d+="/";d=c.trim(d);if(!d.match(/^(http(s)?)|(file):/i)&&!i(d,"/"))d=e.__pagePath+d;return f(d)},indexMapping:function(d){for(var a=0;a<d.length;a++)if(d[a].match(/\/$/))d[a]+="index";return d}});var i=c.startsWith,f=r.normalizePath}})(KISSY, KISSY.__loader,KISSY.__loaderUtils); (function(c,e){function r(){var a=true,b;for(b in d){var h=d[b],l=h.node;h=h.callbacks;var m=false;if(i){if(l.sheet)m=true}else if(l.sheet)try{if(l.sheet.cssRules)m=true}catch(q){if(q.name==="NS_ERROR_DOM_SECURITY_ERR")m=true}if(m){c.each(h,function(t){t.call(l)});delete d[b]}else a=false}f=a?null:setTimeout(r,100)}if(!c.use){var i=e.isWebKit,f=null,d={};c.mix(e,{scriptOnload:document.addEventListener?function(a,b){if(e.isLinkNode(a))return e.styleOnload(a,b);a.addEventListener("load",b,false)}:function(a, b){if(e.isLinkNode(a))return e.styleOnload(a,b);var h=a.onreadystatechange;a.onreadystatechange=function(){if(/loaded|complete/i.test(a.readyState)){a.onreadystatechange=null;h&&h();b.call(this)}}},styleOnload:window.attachEvent?function(a,b){function h(){a.detachEvent("onload",h);b.call(a)}a.attachEvent("onload",h)}:function(a,b){var h=a.href;if(d[h])d[h].callbacks.push(b);else d[h]={node:a,callbacks:[b]};f||r()}})}})(KISSY,KISSY.__loaderUtils); (function(c,e){if(!("require"in this)){var r=e.scriptOnload;c.mix(c,{getStyle:function(i,f,d){var a=document,b=a.getElementsByTagName("head")[0];a=a.createElement("link");var h=f;if(c.isPlainObject(h)){f=h.success;d=h.charset}a.href=i;a.rel="stylesheet";if(d)a.charset=d;f&&e.scriptOnload(a,f);b.appendChild(a);return a},getScript:function(i,f,d){if(e.isCss(i))return c.getStyle(i,f,d);var a=document,b=a.getElementsByTagName("head")[0],h=a.createElement("script"),l=f,m,q,t;if(c.isPlainObject(l)){f=l.success; m=l.error;q=l.timeout;d=l.charset}h.src=i;h.async=true;if(d)h.charset=d;if(f||m){r(h,function(){if(t){t.cancel();t=undefined}c.isFunction(f)&&f.call(h)});if(c.isFunction(m)){a.addEventListener&&h.addEventListener("error",function(){if(t){t.cancel();t=undefined}m.call(h)},false);t=c.later(function(){t=undefined;m()},(q||this.Config.timeout)*1E3)}}b.insertBefore(h,b.firstChild);return h}})}})(KISSY,KISSY.__loaderUtils); (function(c,e,r){if(!("require"in this)){var i=r.IE;c.__HOST.document.getElementsByTagName("head");var f=c.mix;c.mix(e,{add:function(d,a,b){var h=this.Env.mods,l;if(c.isString(d)&&!b&&c.isPlainObject(a)){l={};l[d]=a;d=l}if(c.isPlainObject(d)){c.each(d,function(q,t){q.name=t;h[t]&&f(q,h[t],false)});f(h,d);return this}if(c.isString(d)){var m;if(b&&(m=b.host)){d=h[m];if(!d)return this;if(this.__isAttached(m))a.call(this,this);else{d.fns=d.fns||[];d.fns.push(a)}return this}this.__registerModule(d,a,b); if(b&&b.attach===false)return this;a=h[d];d=r.normalDepModuleName(d,a.requires);if(this.__isAttached(d))this.__attachMod(a);else if(this.Config.debug&&!a)for(d=c.makeArray(d).length-1;d>=0;d--);return this}if(c.isFunction(d)){b=a;a=d;if(i){d=this.__findModuleNameByInteractive();this.__registerModule(d,a,b);this.__startLoadModuleName=null;this.__startLoadTime=0}else this.__currentModule={def:a,config:b};return this}return this}})}})(KISSY,KISSY.__loader,KISSY.__loaderUtils,KISSY.__loaderData); (function(c,e,r,i){"require"in this||c.mix(e,{__buildPath:function(f,d){function a(h,l){if(!f[h]&&f[l]){f[l]=r.normalDepModuleName(f.name,f[l]);f[h]=(d||b.base)+f[l]}if(f[h]&&b.debug)f[h]=f[h].replace(/-min/ig,"");if(f[h]&&!f[h].match(/\?t=/)&&f.tag)f[h]+="?t="+f.tag}var b=this.Config;a("fullpath","path");f.cssfullpath!==i.LOADED&&a("cssfullpath","csspath")}})})(KISSY,KISSY.__loader,KISSY.__loaderUtils,KISSY.__loaderData); (function(c,e){"require"in this||c.mix(e,{__mixMods:function(r){var i=this.Env.mods,f=r.Env.mods,d;for(d in f)this.__mixMod(i,f,d,r)},__mixMod:function(r,i,f,d){var a=r[f]||{},b=a.status;c.mix(a,c.clone(i[f]));if(b)a.status=b;d&&this.__buildPath(a,d.Config.base);r[f]=a}})})(KISSY,KISSY.__loader,KISSY.__loaderUtils); (function(c,e,r){"require"in this||c.mix(e,{__findModuleNameByInteractive:function(){for(var i=document.getElementsByTagName("script"),f,d,a=0;a<i.length;a++){d=i[a];if(d.readyState=="interactive"){f=d;break}}if(!f)return this.__startLoadModuleName;i=f.src;if(i.lastIndexOf(this.Config.base,0)==0)return r.removePostfix(i.substring(this.Config.base.length));f=this.__packages;for(var b in f){d=f[b].path;if(f.hasOwnProperty(b)&&i.lastIndexOf(d,0)==0)return r.removePostfix(i.substring(d.length))}}})})(KISSY, KISSY.__loader,KISSY.__loaderUtils); (function(c,e,r,i){if(!("require"in this)){var f=r.IE;c.__HOST.document.getElementsByTagName("head");var d=i.LOADING,a=i.LOADED,b=i.ERROR,h=i.ATTACHED;c.mix(e,{__load:function(l,m,q){function t(){u[p]=a;if(l.status!==b){if(l.status!==h)l.status=a;m()}}var A=this,p=l.fullpath,v=r.isCss(p),u=A.Env._loadQueue,o=u[p];l.status=l.status||0;if(l.status<d&&o)l.status=o.nodeName?d:a;if(c.isString(l.cssfullpath)){c.getScript(l.cssfullpath);l.cssfullpath=l.csspath=a}if(l.status<d&&p){l.status=d;if(f&&!v){A.__startLoadModuleName= l.name;A.__startLoadTime=Number(+new Date)}o=c.getScript(p,{success:function(){if(!v){if(A.__currentModule){A.__registerModule(l.name,A.__currentModule.def,A.__currentModule.config);A.__currentModule=null}q.global&&A.__mixMod(A.Env.mods,q.global.Env.mods,l.name,q.global);if(!(l.fns&&l.fns.length>0))l.status=b}t()},error:function(){l.status=b;t()},charset:l.charset});u[p]=o}else l.status===d?r.scriptOnload(o,t):m()}})}})(KISSY,KISSY.__loader,KISSY.__loaderUtils,KISSY.__loaderData); (function(c,e,r){if(!("require"in this)){c.__HOST.document.getElementsByTagName("head");var i=r.ATTACHED;r=c.mix;r(e,{__pagePath:location.href.replace(/[^/]*$/i,""),__currentModule:null,__startLoadTime:0,__startLoadModuleName:null,__isAttached:function(f){var d=this.Env.mods,a=true;c.each(f,function(b){b=d[b];if(!b||b.status!==i)return a=false});return a}})}})(KISSY,KISSY.__loader,KISSY.__loaderData); (function(c,e,r){if(!("require"in this)){c.__HOST.document.getElementsByTagName("head");var i=encodeURIComponent(c.buildTime);c.mix(e,{_packages:function(f){var d;d=this.__packages=this.__packages||{};c.each(f,function(a){d[a.name]=a;if(a.path)a.path=r.normalBasePath(a.path);if(a.tag)a.tag=encodeURIComponent(a.tag)})},__getPackagePath:function(f){if(f.packagepath)return f.packagepath;var d=this._combine(f.name),a=this.__packages||{},b="",h;for(h in a)if(a.hasOwnProperty(h)&&c.startsWith(d,h)&&h.length> b)b=h;a=(d=a[b])&&d.path||this.Config.base;if(d&&d.charset)f.charset=d.charset;f.tag=d?d.tag:i;return f.packagepath=a},_combine:function(f,d){var a=this,b;if(c.isObject(f))c.each(f,function(h,l){c.each(h,function(m){a._combine(m,l)})});else{b=a.__combines=a.__combines||{};if(d)b[f]=d;else return b[f]||f}}})}})(KISSY,KISSY.__loader,KISSY.__loaderUtils); (function(c,e,r){if(!c.use){c.__HOST.document.getElementsByTagName("head");var i=r.LOADED,f=c.mix;c.mix(e,{__registerModule:function(d,a,b){b=b||{};var h=this.Env.mods,l=h[d]||{};f(l,{name:d,status:i});l.fns=l.fns||[];l.fns.push(a);f(h[d]=l,b)}})}})(KISSY,KISSY.__loader,KISSY.__loaderData); (function(c,e,r,i){if(!("require"in this)){c.__HOST.document.getElementsByTagName("head");var f=i.LOADED,d=i.ATTACHED;c.mix(e,{use:function(a,b,h){a=a.replace(/\s+/g,"").split(",");r.indexMapping(a);h=h||{};var l=this,m;h.global&&l.__mixMods(h.global);if(l.__isAttached(a)){var q=l.__getModules(a);b&&b.apply(l,q)}else{c.each(a,function(t){l.__attachModByName(t,function(){if(!m&&l.__isAttached(a)){m=true;var A=l.__getModules(a);b&&b.apply(l,A)}},h)});return l}},__getModules:function(a){var b=this,h= [b];c.each(a,function(l){r.isCss(l)||h.push(b.require(l))});return h},require:function(a){a=this.Env.mods[a];var b=this.onRequire&&this.onRequire(a);if(b!==undefined)return b;return a&&a.value},__attachModByName:function(a,b,h){var l=this.Env.mods,m=l[a];if(!m){m=this.Config.componentJsName||function(q){var t="js";if(/(.+)\.(js|css)$/i.test(q)){t=RegExp.$2;q=RegExp.$1}return q+"-min."+t};m={path:c.isFunction(m)?m(this._combine(a)):m,charset:"utf-8"};l[a]=m}m.name=a;m&&m.status===d||this.__attach(m, b,h)},__attach:function(a,b,h){function l(){if(!A&&m.__isAttached(a.requires)){a.status===f&&m.__attachMod(a);if(a.status===d){A=true;b()}}}var m=this,q=m.Env.mods,t=(a.requires||[]).concat();a.requires=t;c.each(t,function(p,v,u){p=u[v]=r.normalDepModuleName(a.name,p);(v=q[p])&&v.status===d||m.__attachModByName(p,l,h)});m.__buildPath(a,m.__getPackagePath(a));m.__load(a,function(){a.requires=a.requires||[];c.each(a.requires,function(p,v,u){p=u[v]=r.normalDepModuleName(a.name,p);v=q[p];u=c.inArray(p, t);v&&v.status===d||u||m.__attachModByName(p,l,h)});l()},h);var A=false},__attachMod:function(a){var b=this,h=a.fns;h&&c.each(h,function(l){l=c.isFunction(l)?l.apply(b,b.__getModules(a.requires)):l;a.value=a.value||l});a.status=d}})}})(KISSY,KISSY.__loader,KISSY.__loaderUtils,KISSY.__loaderData); (function(c,e,r){function i(b){var h=b.src,l=b.getAttribute("data-combo-prefix")||"??";b=b.getAttribute("data-combo-sep")||",";b=h.split(b);var m,q=b[0];l=q.indexOf(l);if(l==-1)m=h.replace(f,"$1");else{m=q.substring(0,l);h=q.substring(l+2,q.length);if(h.match(d))m+=h.replace(f,"$1");else c.each(b,function(t){if(t.match(d)){m+=t.replace(f,"$1");return false}})}if(!m.match(/^(http(s)?)|(file):/i)&&!c.startsWith(m,"/"))m=a+m;return m}if(!("require"in this)){c.mix(c,e);var f=/^(.*)(seed|kissy)(-min)?\.js[^/]*/i, d=/(seed|kissy)(-min)?\.js/i,a=c.__pagePath;c.__initLoader=function(){this.Env.mods=this.Env.mods||{};this.Env._loadQueue={}};c.__initLoader();(function(){var b=document.getElementsByTagName("script");b=i(b[b.length-1]);c.Config.base=r.normalBasePath(b);c.Config.timeout=10})();c.each(e,function(b,h){c.__APP_MEMBERS.push(h)});c.__APP_INIT_METHODS.push("__initLoader")}})(KISSY,KISSY.__loader,KISSY.__loaderUtils); (function(c){function e(){var q=f.documentElement.doScroll,t=q?"onreadystatechange":"DOMContentLoaded",A=function(){r()};h=true;if(f.readyState==="complete")r();else{if(f.addEventListener){var p=function(){f.removeEventListener(t,p,false);r()};f.addEventListener(t,p,false);i.addEventListener("load",A,false)}else{var v=function(){if(f.readyState==="complete"){f.detachEvent(t,v);r()}};f.attachEvent(t,v);i.attachEvent("onload",A);A=false;try{A=i.frameElement==null}catch(u){}if(q&&A){var o=function(){try{q("left"); r()}catch(g){setTimeout(o,50)}};o()}}return 0}}function r(){if(!a){a=true;if(b){for(var q,t=0;q=b[t++];)q.call(i,c);b=null}}}var i=c.__HOST,f=i.document,d=f.documentElement,a=false,b=[],h=false,l=/^#?([\w-]+)$/,m=/\S/;c.mix(c,{isWindow:function(q){return c.type(q)==="object"&&"setInterval"in q&&"document"in q&&q.document.nodeType==9},globalEval:function(q){if(q&&m.test(q)){var t=f.getElementsByTagName("head")[0]||d,A=f.createElement("script");A.text=q;t.insertBefore(A,t.firstChild);t.removeChild(A)}}, ready:function(q){h||e();a?q.call(i,this):b.push(q);return this},available:function(q,t){if((q=(q+"").match(l)[1])&&c.isFunction(t))var A=1,p=c.later(function(){if(f.getElementById(q)&&(t()||1)||++A>500)p.cancel()},40,true)}});if(location&&(location.search||"").indexOf("ks-debug")!==-1)c.Config.debug=true})(KISSY);(function(c){c.config({combine:{core:["dom","ua","event","node","json","ajax","anim","base","cookie"]}})})(KISSY); KISSY.add("ua/base",function(){var c=navigator.userAgent,e="",r="",i,f={},d=function(a){var b=0;return parseFloat(a.replace(/\./g,function(){return b++===0?".":""}))};if((i=c.match(/AppleWebKit\/([\d.]*)/))&&i[1]){f[e="webkit"]=d(i[1]);if((i=c.match(/Chrome\/([\d.]*)/))&&i[1])f[r="chrome"]=d(i[1]);else if((i=c.match(/\/([\d.]*) Safari/))&&i[1])f[r="safari"]=d(i[1]);if(/ Mobile\//.test(c))f.mobile="apple";else if(i=c.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/))f.mobile=i[0].toLowerCase()}else if((i= c.match(/Presto\/([\d.]*)/))&&i[1]){f[e="presto"]=d(i[1]);if((i=c.match(/Opera\/([\d.]*)/))&&i[1]){f[r="opera"]=d(i[1]);if((i=c.match(/Opera\/.* Version\/([\d.]*)/))&&i[1])f[r]=d(i[1]);if((i=c.match(/Opera Mini[^;]*/))&&i)f.mobile=i[0].toLowerCase();else if((i=c.match(/Opera Mobi[^;]*/))&&i)f.mobile=i[0]}}else if((i=c.match(/MSIE\s([^;]*)/))&&i[1]){f[e="trident"]=0.1;f[r="ie"]=d(i[1]);if((i=c.match(/Trident\/([\d.]*)/))&&i[1])f[e]=d(i[1])}else if(i=c.match(/Gecko/)){f[e="gecko"]=0.1;if((i=c.match(/rv:([\d.]*)/))&& i[1])f[e]=d(i[1]);if((i=c.match(/Firefox\/([\d.]*)/))&&i[1])f[r="firefox"]=d(i[1])}f.core=e;f.shell=r;f._numberify=d;return f}); KISSY.add("ua/extra",function(c,e){var r=navigator.userAgent,i,f,d={},a=e._numberify;if(r.match(/360SE/))d[f="se360"]=3;else if(r.match(/Maxthon/)&&(i=window.external)){f="maxthon";try{d[f]=a(i.max_version)}catch(b){d[f]=0.1}}else if(i=r.match(/TencentTraveler\s([\d.]*)/))d[f="tt"]=i[1]?a(i[1]):0.1;else if(r.match(/TheWorld/))d[f="theworld"]=3;else if(i=r.match(/SE\s([\d.]*)/))d[f="sougou"]=i[1]?a(i[1]):0.1;f&&(d.shell=f);c.mix(e,d);return e},{requires:["ua/base"]}); KISSY.add("ua",function(c,e){return e},{requires:["ua/extra"]});KISSY.add("dom/base",function(c,e){function r(i,f){return i&&i.nodeType===f}return{_isElementNode:function(i){return r(i,1)},_getWin:function(i){return i&&"scrollTo"in i&&i.document?i:r(i,9)?i.defaultView||i.parentWindow:i==e?window:false},_nodeTypeIs:r,_isNodeList:function(i){return i&&!i.nodeType&&i.item&&!i.setTimeout}}}); KISSY.add("dom/attr",function(c,e,r,i){function f(o){if(c.isArray(o)){for(var g=0;g<o.length;g++)o[g]=f(o[g]);return o}else return o+h}var d=document.documentElement,a=!d.hasAttribute,b=d.textContent!==i?"textContent":"innerText",h="",l=e._isElementNode,m=/^(?:href|src|style)/,q=/^(?:href|src|colspan|rowspan)/,t=/\r/g,A=/^(?:radio|checkbox)/,p={readonly:"readOnly"},v={val:1,css:1,html:1,text:1,data:1,width:1,height:1,offset:1};a&&c.mix(p,{"for":"htmlFor","class":"className"});var u={tabindex:{getter:function(o){return o.tabIndex}, setter:function(o,g){if(isNaN(parseInt(g))){o.removeAttribute("tabindex");o.removeAttribute("tabIndex")}else o.tabIndex=g}},style:{getter:function(o){return o.style.cssText},setter:function(o,g){o.style.cssText=g}},checked:{setter:function(o,g){o.checked=!!g}},disabled:{setter:function(o,g){o.disabled=!!g}}};c.mix(e,{attr:function(o,g,j,s){if(c.isPlainObject(g)){s=j;for(var x in g)e.attr(o,x,g[x],s)}else if(g=c.trim(g)){g=g.toLowerCase();if(s&&v[g])return e[g](o,j);g=p[g]||g;var B=u[g];if(j===i){o= e.get(o);if(!l(o))return null;if(B&&B.getter)return B.getter(o);var y;m.test(g)||(y=o[g]);if(y===i)y=o.getAttribute(g);if(a)if(q.test(g))y=o.getAttribute(g,2);return y===i?null:y}else c.each(e.query(o),function(k){if(l(k))B&&B.setter?B.setter(k,j):k.setAttribute(g,h+j)})}},removeAttr:function(o,g){g=g.toLowerCase();c.each(e.query(o),function(j){if(l(j)){e.attr(j,g,h);j.removeAttribute(g)}})},hasAttr:a?function(o,g){g=g.toLowerCase();var j=e.get(o).getAttributeNode(g);return!!(j&&j.specified)}:function(o, g){g=g.toLowerCase();return e.get(o).hasAttribute(g)},val:function(o,g){if(g===i){var j=e.get(o);if(!l(j))return null;if(j&&j.nodeName.toUpperCase()==="option".toUpperCase())return(j.attributes.value||{}).specified?j.value:j.text;if(j&&j.nodeName.toUpperCase()==="select".toUpperCase()){var s=j.selectedIndex,x=j.options;if(s<0)return null;else if(j.type==="select-one")return e.val(x[s]);j=[];for(var B=0,y=x.length;B<y;++B)x[B].selected&&j.push(e.val(x[B]));return j}if(r.webkit&&A.test(j.type))return j.getAttribute("value")=== null?"on":j.value;return(j.value||h).replace(t,h)}c.each(e.query(o),function(k){if(k&&k.nodeName.toUpperCase()==="select".toUpperCase()){g=f(g);var n=c.makeArray(g),w=k.options,z;B=0;for(y=w.length;B<y;++B){z=w[B];z.selected=c.inArray(e.val(z),n)}if(!n.length)k.selectedIndex=-1}else if(l(k))k.value=g})},text:function(o,g){if(g===i){var j=e.get(o);if(l(j))return j[b]||h;else if(e._nodeTypeIs(j,3))return j.nodeValue;return null}else c.each(e.query(o),function(s){if(l(s))s[b]=g;else if(e._nodeTypeIs(s, 3))s.nodeValue=g})}});return e},{requires:["dom/base","ua"]}); KISSY.add("dom/class",function(c,e,r){function i(a,b,h,l){if(!(b=c.trim(b)))return l?false:r;a=e.query(a);var m=0,q=a.length,t=b.split(f);for(b=[];m<t.length;m++){var A=c.trim(t[m]);A&&b.push(A)}for(m=0;m<q;m++){t=a[m];if(e._isElementNode(t)){t=h(t,b,b.length);if(t!==r)return t}}if(l)return false;return r}var f=/[\.\s]\s*\.?/,d=/[\n\t]/g;c.mix(e,{hasClass:function(a,b){return i(a,b,function(h,l,m){if(h=h.className){h=" "+h+" ";for(var q=0,t=true;q<m;q++)if(h.indexOf(" "+l[q]+" ")<0){t=false;break}if(t)return true}}, true)},addClass:function(a,b){i(a,b,function(h,l,m){var q=h.className;if(q){var t=" "+q+" ";q=q;for(var A=0;A<m;A++)if(t.indexOf(" "+l[A]+" ")<0)q+=" "+l[A];h.className=c.trim(q)}else h.className=b},r)},removeClass:function(a,b){i(a,b,function(h,l,m){var q=h.className;if(q)if(m){q=(" "+q+" ").replace(d," ");for(var t=0,A;t<m;t++)for(A=" "+l[t]+" ";q.indexOf(A)>=0;)q=q.replace(A," ");h.className=c.trim(q)}else h.className=""},r)},replaceClass:function(a,b,h){e.removeClass(a,b);e.addClass(a,h)},toggleClass:function(a, b,h){var l=c.isBoolean(h),m;i(a,b,function(q,t,A){for(var p=0,v;p<A;p++){v=t[p];m=l?!h:e.hasClass(q,v);e[m?"removeClass":"addClass"](q,v)}},r)}});return e},{requires:["dom/base"]}); KISSY.add("dom/create",function(c,e,r,i){function f(y,k){if(c.isPlainObject(k))if(q(y))e.attr(y,k,true);else y.nodeType==11&&c.each(y.childNodes,function(n){e.attr(n,k,true)});return y}function d(y,k){var n=null,w,z;if(y&&(y.push||y.item)&&y[0]){k=k||y[0].ownerDocument;n=k.createDocumentFragment();if(y.item)y=c.makeArray(y);w=0;for(z=y.length;w<z;w++)n.appendChild(y[w])}return n}function a(y,k,n,w){if(n){var z=c.guid("ks-tmp-"),C=RegExp(p);k+='<span id="'+z+'"></span>';c.available(z,function(){var D= e.get("head"),E,G,F,J,K,I;for(C.lastIndex=0;E=C.exec(k);)if((F=(G=E[1])?G.match(u):false)&&F[2]){E=h.createElement("script");E.src=F[2];if((J=G.match(o))&&J[2])E.charset=J[2];E.async=true;D.appendChild(E)}else if((I=E[2])&&I.length>0)c.globalEval(I);(K=h.getElementById(z))&&e.remove(K);c.isFunction(w)&&w()});b(y,k)}else{b(y,k);c.isFunction(w)&&w()}}function b(y,k){k=(k+"").replace(p,"");try{y.innerHTML=k}catch(n){for(;y.firstChild;)y.removeChild(y.firstChild);k&&y.appendChild(e.create(k))}}var h= document,l=r.ie,m=e._nodeTypeIs,q=e._isElementNode,t=h.createElement("div"),A=/<(\w+)/,p=/<script([^>]*)>([^<]*(?:(?!<\/script>)<[^<]*)*)<\/script>/ig,v=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,u=/\ssrc=(['"])(.*?)\1/i,o=/\scharset=(['"])(.*?)\1/i;c.mix(e,{create:function(y,k,n){if(m(y,1)||m(y,3)){k=y;n=k.cloneNode(true);if(r.ie<8)n.innerHTML=k.innerHTML;return n}if(!(y=c.trim(y)))return null;var w=null;w=e._creators;var z,C="div",D;if(z=v.exec(y))w=(n||h).createElement(z[1]);else{if((z=A.exec(y))&&(D=z[1])&& c.isFunction(w[D=D.toLowerCase()]))C=D;y=w[C](y,n).childNodes;w=y.length===1?y[0].parentNode.removeChild(y[0]):d(y,n||h)}return f(w,k)},_creators:{div:function(y,k){var n=k?k.createElement("div"):t;n.innerHTML=y;return n}},html:function(y,k,n,w){if(k===i){y=e.get(y);if(q(y))return y.innerHTML;return null}else c.each(e.query(y),function(z){q(z)&&a(z,k,n,w)})},remove:function(y){c.each(e.query(y),function(k){k.parentNode&&k.parentNode.removeChild(k)})},_nl2frag:d});if(l||r.gecko||r.webkit){var g=e._creators, j=e.create,s=/(?:\/(?:thead|tfoot|caption|col|colgroup)>)+\s*<tbody/,x={option:"select",td:"tr",tr:"tbody",tbody:"table",col:"colgroup",legend:"fieldset"},B;for(B in x)(function(y){g[B]=function(k,n){return j("<"+y+">"+k+"</"+y+">",null,n)}})(x[B]);if(l){g.script=function(y,k){var n=k?k.createElement("div"):t;n.innerHTML="-"+y;n.removeChild(n.firstChild);return n};if(l<8)g.tbody=function(y,k){var n=j("<table>"+y+"</table>",null,k),w=n.children.tags("tbody")[0];n.children.length>1&&w&&!s.test(y)&& w.parentNode.removeChild(w);return n}}c.mix(g,{optgroup:g.option,th:g.td,thead:g.tbody,tfoot:g.tbody,caption:g.tbody,colgroup:g.tbody})}return e},{requires:["./base","ua"]}); KISSY.add("dom/data",function(c,e,r){var i=window,f="_ks_data_"+c.now(),d={},a={},b={};b.applet=1;b.object=1;b.embed=1;c.mix(e,{hasData:function(h,l){var m=e.get(h),q;if(!m||m.nodeName&&b[m.nodeName.toLowerCase()])return false;if(m==i)m=a;q=m&&m.nodeType;if(m=(q?d:m)[q?m[f]:f])if(l!==r){if(l in m)return true}else return true;return false},data:function(h,l,m){if(c.isPlainObject(l))for(var q in l)e.data(h,q,l[q]);else if(m===r){h=e.get(h);if(!h||h.nodeName&&b[h.nodeName.toLowerCase()])return null; if(h==i)h=a;q=h&&h.nodeType;q=h=(q?d:h)[q?h[f]:f];if(c.isString(l)&&h)q=h[l];return q===r?null:q}else e.query(h).each(function(t){if(!(!t||t.nodeName&&b[t.nodeName.toLowerCase()])){if(t==i)t=a;var A=d,p;if(t&&t.nodeType){if(!(p=t[f]))p=t[f]=c.guid()}else{p=f;A=t}if(l&&m!==r){A[p]||(A[p]={});A[p][l]=m}}})},removeData:function(h,l){e.query(h).each(function(m){if(m){if(m==i)m=a;var q,t=d,A,p=m&&m.nodeType;if(p)q=m[f];else{t=m;q=f}if(q){A=t[q];if(l){if(A){delete A[l];c.isEmptyObject(A)&&e.removeData(m)}}else{if(p)m.removeAttribute&& m.removeAttribute(f);else try{delete m[f]}catch(v){}p&&delete t[q]}}}})}});return e},{requires:["dom/base"]}); KISSY.add("dom/insertion",function(c,e){function r(f,d,a){f=e.query(f);d=e.query(d);if(f=i(f)){var b;if(d.length>1)b=f.cloneNode(true);for(var h=0;h<d.length;h++){var l=d[h],m=h>0?b.cloneNode(true):f;a(m,l)}}}var i=e._nl2frag;c.mix(e,{insertBefore:function(f,d){r(f,d,function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b)})},insertAfter:function(f,d){r(f,d,function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b.nextSibling)})},append:function(f,d){r(f,d,function(a,b){b.appendChild(a)})},prepend:function(f, d){r(f,d,function(a,b){b.insertBefore(a,b.firstChild)})}});e.prependTo=e.prepend;e.appendTo=e.append;return e},{requires:["dom/base"]}); KISSY.add("dom/offset",function(c,e,r,i){function f(g){var j=0,s=0,x=h(g[t]);if(g[o]){g=g[o]();j=g[A];s=g[p];if(r.mobile!=="apple"){j+=e[v](x);s+=e[u](x)}}return{left:j,top:s}}var d=window,a=e._isElementNode,b=e._nodeTypeIs,h=e._getWin,l=document.compatMode==="CSS1Compat",m=Math.max,q=parseInt,t="ownerDocument",A="left",p="top",v="scrollLeft",u="scrollTop",o="getBoundingClientRect";c.mix(e,{offset:function(g,j){if(!(g=e.get(g))||!g[t])return null;if(j===i)return f(g);var s=g;if(e.css(s,"position")=== "static")s.style.position="relative";var x=f(s),B={},y,k;for(k in j){y=q(e.css(s,k),10)||0;B[k]=y+j[k]-x[k]}e.css(s,B)},scrollIntoView:function(g,j,s,x){if((g=e.get(g))&&g[t]){x=x===i?true:!!x;s=s===i?true:!!s;if(!j||j===d)g.scrollIntoView(s);else{j=e.get(j);if(b(j,9))j=h(j);var B=!!h(j),y=e.offset(g),k=B?{left:e.scrollLeft(j),top:e.scrollTop(j)}:e.offset(j),n={left:y[A]-k[A],top:y[p]-k[p]};y=B?e.viewportHeight(j):j.clientHeight;B=B?e.viewportWidth(j):j.clientWidth;k=e[v](j);var w=e[u](j),z=k+B,C= w+y,D=g.offsetHeight;g=g.offsetWidth;var E=n.left+k-(q(e.css(j,"borderLeftWidth"))||0);n=n.top+w-(q(e.css(j,"borderTopWidth"))||0);var G=E+g,F=n+D,J,K;if(D>y||n<w||s)J=n;else if(F>C)J=F-y;if(x)if(g>B||E<k||s)K=E;else if(G>z)K=G-B;e[u](j,J);e[v](j,K)}}},docWidth:0,docHeight:0,viewportHeight:0,viewportWidth:0});c.each(["Left","Top"],function(g,j){var s="scroll"+g;e[s]=function(x,B){if(c.isNumber(x))arguments.callee(d,x);else{x=e.get(x);var y=0,k=h(x);if(k){if(B!==i){y=g=="Left"?B:e.scrollLeft(k);var n= g=="Top"?B:e.scrollTop(k);k.scrollTo(y,n)}y=k.document;y=k[j?"pageYOffset":"pageXOffset"]||y.documentElement[s]||y.body[s]}else if(a(x=e.get(x)))y=B!==i?x[s]=B:x[s];return B===i?y:i}}});c.each(["Width","Height"],function(g){e["doc"+g]=function(j){j=e.get(j);j=h(j).document;return m(l?j.documentElement["scroll"+g]:j.body["scroll"+g],e["viewport"+g](j))};e["viewport"+g]=function(j){j=e.get(j);var s="inner"+g;j=h(j);var x=j.document;return s in j?j[s]:l?x.documentElement["client"+g]:x.body["client"+ g]}});return e},{requires:["./base","ua"]}); KISSY.add("dom/style",function(c,e,r,i){function f(o,g){var j=e.get(o);if(c.isWindow(j))return g==h?e.viewportWidth(j):e.viewportHeight(j);else if(j.nodeType==9)return g==h?e.docWidth(j):e.docHeight(j);var s=g===h?j.offsetWidth:j.offsetHeight;c.each(g===h?["Left","Right"]:["Top","Bottom"],function(x){s-=parseFloat(e._getComputedStyle(j,"padding"+x))||0;s-=parseFloat(e._getComputedStyle(j,"border"+x+"Width"))||0});return s}function d(o,g,j){var s=j;if(j===l&&q.test(g)){s=0;if(c.inArray(e.css(o,"position"), ["absolute","fixed"])){j=o[g==="left"?"offsetLeft":"offsetTop"];if(r.ie===8||r.opera)j-=m(e.css(o.offsetParent,"border-"+g+"-width"))||0;s=j-(m(e.css(o,"margin-"+g))||0)}}return s}var a=document,b=a.documentElement,h="width",l="auto",m=parseInt,q=/^(?:left|top)/,t=/^(?:width|height|top|left|right|bottom|margin|padding)/i,A=/-([a-z])/ig,p=function(o,g){return g.toUpperCase()},v={},u={};c.mix(e,{_CUSTOM_STYLES:v,_getComputedStyle:function(o,g){var j="",s=o.ownerDocument;if(o.style)j=s.defaultView.getComputedStyle(o, null)[g];return j},css:function(o,g,j){if(c.isPlainObject(g))for(var s in g)e.css(o,s,g[s]);else{if(g.indexOf("-")>0)g=g.replace(A,p);s=g;g=v[g]||g;if(j===i){o=e.get(o);var x="";if(o&&o.style){x=g.get?g.get(o,s):o.style[g];if(x===""&&!g.get)x=d(o,g,e._getComputedStyle(o,g))}return x===i?"":x}else{if(j===null||j==="")j="";else if(!isNaN(new Number(j))&&t.test(g))j+="px";(g===h||g==="height")&&parseFloat(j)<0||c.each(e.query(o),function(B){if(B&&B.style){g.set?g.set(B,j):B.style[g]=j;if(j==="")B.style.cssText|| B.removeAttribute("style")}})}}},width:function(o,g){if(g===i)return f(o,h);else e.css(o,h,g)},height:function(o,g){if(g===i)return f(o,"height");else e.css(o,"height",g)},show:function(o){e.query(o).each(function(g){if(g){g.style.display=e.data(g,"display")||"";if(e.css(g,"display")==="none"){var j=g.tagName,s=u[j],x;if(!s){x=a.createElement(j);a.body.appendChild(x);s=e.css(x,"display");e.remove(x);u[j]=s}e.data(g,"display",s);g.style.display=s}}})},hide:function(o){e.query(o).each(function(g){if(g){var j= g.style,s=j.display;if(s!=="none"){s&&e.data(g,"display",s);j.display="none"}}})},toggle:function(o){e.query(o).each(function(g){if(g)e.css(g,"display")==="none"?e.show(g):e.hide(g)})},addStyleSheet:function(o,g,j){if(c.isString(o)){j=g;g=o;o=window}o=e.get(o);o=e._getWin(o).document;var s;if(j&&(j=j.replace("#","")))s=e.get("#"+j,o);if(!s){s=e.create("<style>",{id:j},o);e.get("head",o).appendChild(s);if(s.styleSheet)s.styleSheet.cssText=g;else s.appendChild(o.createTextNode(g))}},unselectable:function(o){e.query(o).each(function(g){if(g)if(r.gecko)g.style.MozUserSelect= "none";else if(r.webkit)g.style.KhtmlUserSelect="none";else if(r.ie||r.opera){var j=0,s=g.getElementsByTagName("*");for(g.setAttribute("unselectable","on");g=s[j++];)switch(g.tagName.toLowerCase()){case "iframe":case "textarea":case "input":case "select":break;default:g.setAttribute("unselectable","on")}}})}});if(b.style.cssFloat!==i)v["float"]="cssFloat";else if(b.style.styleFloat!==i)v["float"]="styleFloat";return e},{requires:["dom/base","ua"]}); KISSY.add("dom/selector",function(c,e,r){function i(p,v){var u,o,g=[],j;o=c.require("sizzle");v=f(v);if(c.isString(p))if(p.indexOf(",")!=-1){u=p.split(",");c.each(u,function(s){g.push.apply(g,c.makeArray(i(s,v)))})}else{p=c.trim(p);if(q.test(p)){if(o=d(p.slice(1),v))g=[o]}else if(u=t.exec(String(p))){o=u[1];j=u[2];u=u[3];if(v=o?d(o,v):v)if(u)if(!o||p.indexOf(m)!==-1)g=c.makeArray(A(u,j,v));else{if((o=d(o,v))&&e.hasClass(o,u))g=[o]}else if(j)g=a(j,v)}else if(o)g=o(p,v);else b(p)}else if(p&&(c.isArray(p)|| l(p)))g=p;else if(p)g=[p];if(l(g))g=c.makeArray(g);g.each=function(s,x){return c.each(g,s,x)};return g}function f(p){if(p===r)p=h;else if(c.isString(p)&&q.test(p))p=d(p.slice(1),h);else if(c.isArray(p)||l(p))p=p[0]||null;else if(p&&p.nodeType!==1&&p.nodeType!==9)p=null;return p}function d(p,v){if(!v)return null;if(v.nodeType!==9)v=v.ownerDocument;return v.getElementById(p)}function a(p,v){return v.getElementsByTagName(p)}function b(p){c.error("Unsupported selector: "+p)}var h=document,l=e._isNodeList, m=" ",q=/^#[\w-]+$/,t=/^(?:#([\w-]+))?\s*([\w-]+|\*)?\.?([\w-]+)?$/;(function(){var p=h.createElement("div");p.appendChild(h.createComment(""));if(p.getElementsByTagName("*").length>0)a=function(v,u){var o=c.makeArray(u.getElementsByTagName(v));if(v==="*"){for(var g=[],j=0,s=0,x;x=o[j++];)if(x.nodeType===1)g[s++]=x;o=g}return o}})();var A=h.getElementsByClassName?function(p,v,u){u=p=c.makeArray(u.getElementsByClassName(p));var o=0,g=0,j=p.length,s;if(v&&v!=="*"){u=[];for(v=v.toUpperCase();o<j;++o){s= p[o];if(s.tagName===v)u[g++]=s}}return u}:h.querySelectorAll?function(p,v,u){return u.querySelectorAll((v?v:"")+"."+p)}:function(p,v,u){v=u.getElementsByTagName(v||"*");u=[];var o=0,g=0,j=v.length,s,x;for(p=m+p+m;o<j;++o){s=v[o];if((x=s.className)&&(m+x+m).indexOf(p)>-1)u[g++]=s}return u};c.mix(e,{query:i,get:function(p,v){return i(p,v)[0]||null},filter:function(p,v,u){var o=i(p,u),g=c.require("sizzle"),j,s,x,B=[];if(c.isString(v)&&(j=t.exec(v))&&!j[1]){s=j[2];x=j[3];v=function(y){return!(s&&y.tagName.toLowerCase()!== s.toLowerCase()||x&&!e.hasClass(y,x))}}if(c.isFunction(v))B=c.filter(o,v);else if(v&&g)B=g._filter(p,v,u);else b(v);return B},test:function(p,v,u){p=i(p,u);return p.length&&e.filter(p,v,u).length===p.length}});return e},{requires:["dom/base"]}); KISSY.add("dom/style-ie",function(c,e,r,i,f){if(!r.ie)return e;i=document;var d=i.documentElement,a=e._CUSTOM_STYLES,b=/^-?\d+(?:px)?$/i,h=/^-?\d/,l=/^(?:width|height)$/;try{if(d.style.opacity==f&&d.filters)a.opacity={get:function(A){var p=100;try{p=A.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(v){try{p=A.filters("alpha").opacity}catch(u){if(A=((A.currentStyle||0).filter||"").match(/alpha\(opacity[=:]([^)]+)\)/))p=parseInt(c.trim(A[1]))}}return p/100+""},set:function(A,p){var v=A.style, u=(A.currentStyle||0).filter||"";v.zoom=1;if(u)u=c.trim(u.replace(/alpha\(opacity[=:][^)]+\),?/ig,""));if(u&&p!=1)u+=", ";v.filter=u+(p!=1?"alpha(opacity="+p*100+")":"")}}}catch(m){}r=r.ie==8;var q={},t={get:function(A,p){var v=A.currentStyle[p]+"";if(v.indexOf("px")<0)v=q[v]?q[v]:0;return v}};q.thin=r?"1px":"2px";q.medium=r?"3px":"4px";q.thick=r?"5px":"6px";c.each(["","Top","Left","Right","Bottom"],function(A){a["border"+A+"Width"]=t});if(!(i.defaultView||{}).getComputedStyle&&d.currentStyle)e._getComputedStyle= function(A,p){var v=A.style,u=A.currentStyle[p];if(l.test(p))u=e[p](A)+"px";else if(!b.test(u)&&h.test(u)){var o=v.left,g=A.runtimeStyle.left;A.runtimeStyle.left=A.currentStyle.left;v.left=p==="fontSize"?"1em":u||0;u=v.pixelLeft+"px";v.left=o;A.runtimeStyle.left=g}return u};return e},{requires:["./base","ua","./style"]}); KISSY.add("dom/traversal",function(c,e,r){function i(a,b,h,l){if(!(a=e.get(a)))return null;if(b===r)b=1;var m=null,q,t;if(c.isNumber(b)&&b>=0){if(b===0)return a;q=0;t=b;b=function(){return++q===t}}for(;a=a[h];)if(d(a)&&(!b||e.test(a,b))&&(!l||l(a))){m=a;break}return m}function f(a,b,h){var l=[];var m=a=e.get(a);if(a&&h)m=a.parentNode;if(m){h=0;for(m=m.firstChild;m;m=m.nextSibling)if(d(m)&&m!==a&&(!b||e.test(m,b)))l[h++]=m}return l}var d=e._isElementNode;c.mix(e,{parent:function(a,b){return i(a,b, "parentNode",function(h){return h.nodeType!=11})},next:function(a,b){return i(a,b,"nextSibling",r)},prev:function(a,b){return i(a,b,"previousSibling",r)},siblings:function(a,b){return f(a,b,true)},children:function(a,b){return f(a,b,r)},contains:function(a,b){var h=false;if((a=e.get(a))&&(b=e.get(b)))if(a.contains){if(b.nodeType===3){b=b.parentNode;if(b===a)return true}if(b)return a.contains(b)}else if(a.compareDocumentPosition)return!!(a.compareDocumentPosition(b)&16);else for(;!h&&(b=b.parentNode);)h= b==a;return h},equals:function(a,b){a=c.query(a);b=c.query(b);if(a.length!=b.length)return false;for(var h=a.length;h>=0;h--)if(a[h]!=b[h])return false;return true}});return e},{requires:["./base"]});KISSY.add("dom",function(c,e){return e},{requires:["dom/attr","dom/class","dom/create","dom/data","dom/insertion","dom/offset","dom/style","dom/selector","dom/style-ie","dom/traversal"]}); KISSY.add("event/object",function(c,e){function r(d,a,b){this.currentTarget=d;this.originalEvent=a||{};if(a){this.type=a.type;this._fix()}else{this.type=b;this.target=d}this.currentTarget=d;this.fixed=true}var i=document,f="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "); c.augment(r,{_fix:function(){var d=this.originalEvent,a=f.length,b,h=this.currentTarget;for(h=h.nodeType===9?h:h.ownerDocument||i;a;){b=f[--a];this[b]=d[b]}if(!this.target)this.target=this.srcElement||i;if(this.target.nodeType===3)this.target=this.target.parentNode;if(!this.relatedTarget&&this.fromElement)this.relatedTarget=this.fromElement===this.target?this.toElement:this.fromElement;if(this.pageX===e&&this.clientX!==e){d=h.documentElement;a=h.body;this.pageX=this.clientX+(d&&d.scrollLeft||a&&a.scrollLeft|| 0)-(d&&d.clientLeft||a&&a.clientLeft||0);this.pageY=this.clientY+(d&&d.scrollTop||a&&a.scrollTop||0)-(d&&d.clientTop||a&&a.clientTop||0)}if(this.which===e)this.which=this.charCode!==e?this.charCode:this.keyCode;if(this.metaKey===e)this.metaKey=this.ctrlKey;if(!this.which&&this.button!==e)this.which=this.button&1?1:this.button&2?3:this.button&4?2:0},preventDefault:function(){var d=this.originalEvent;if(d.preventDefault)d.preventDefault();else d.returnValue=false;this.isDefaultPrevented=true},stopPropagation:function(){var d= this.originalEvent;if(d.stopPropagation)d.stopPropagation();else d.cancelBubble=true;this.isPropagationStopped=true},stopImmediatePropagation:function(){var d=this.originalEvent;d.stopImmediatePropagation?d.stopImmediatePropagation():this.stopPropagation();this.isImmediatePropagationStopped=true},halt:function(d){d?this.stopImmediatePropagation():this.stopPropagation();this.preventDefault()}});return r}); KISSY.add("event/base",function(c,e,r,i){function f(u,o,g,j,s){if(c.isString(o))o=e.query(o);if(c.isArray(o)||h(o)){c.each(o,function(x){v[u](x,g,j,s)});return true}if((g=c.trim(g))&&g.indexOf(t)>0){c.each(g.split(t),function(x){v[u](o,x,j,s)});return true}return i}function d(u){return u&&u.nodeType!==3&&u.nodeType!==8?e.data(u,q):-1}function a(u,o){u&&u.nodeType!==3&&u.nodeType!==8&&e.data(u,q,o)}var b=document,h=e._isNodeList,l=b.addEventListener?function(u,o,g,j){u.addEventListener&&u.addEventListener(o, g,!!j)}:function(u,o,g){u.attachEvent&&u.attachEvent("on"+o,g)},m=b.removeEventListener?function(u,o,g,j){u.removeEventListener&&u.removeEventListener(o,g,!!j)}:function(u,o,g){u.detachEvent&&u.detachEvent("on"+o,g)},q="ksEventTargetId",t=" ",A=c.now(),p={},v={EVENT_GUID:q,special:{},add:function(u,o,g,j){if(!f("add",u,o,g,j)){var s=d(u),x,B,y,k,n;if(!(s===-1||!o||!c.isFunction(g))){if(!s){a(u,s=A++);p[s]={target:u,events:{}}}B=p[s].events;if(!B[o]){x=(s=!u.isCustomEventTarget)&&v.special[o]||{}; y=function(w,z){if(!w||!w.fixed)w=new r(u,w,o);if(c.isPlainObject(z)){var C=w.type;c.mix(w,z);w.type=C}x.setup&&x.setup(w);return(x.handle||v._handle)(u,w)};B[o]={handle:y,listeners:[]};k=x.fix||o;n=x.capture;x.init&&x.init.apply(null,c.makeArray(arguments));s&&x.fix!==false&&l(u,k,y,n)}B[o].listeners.push({fn:g,scope:j||u})}}},__getListeners:function(u,o){var g,j=[];if(g=(v.__getEvents(u)||{})[o])j=g.listeners;return j},__getEvents:function(u){var o=d(u),g;if(o!==-1)if(o&&(g=p[o]))if(g.target=== u)return g.events||{}},remove:function(u,o,g,j){if(!f("remove",u,o,g,j)){var s=v.__getEvents(u),x=d(u),B,y,k,n,w,z,C=!u.isCustomEventTarget&&v.special[o]||{};if(s!==i){j=j||u;if(B=s[o]){y=B.listeners;k=y.length;if(c.isFunction(g)&&k){w=n=0;for(z=[];n<k;++n)if(g!==y[n].fn||j!==y[n].scope)z[w++]=y[n];B.listeners=z;k=z.length}if(g===i||k===0){if(!u.isCustomEventTarget){C=v.special[o]||{};if(C.fix!==false)m(u,C.fix||o,B.handle)}delete s[o]}}C.destroy&&C.destroy.apply(null,c.makeArray(arguments));if(o=== i||c.isEmptyObject(s)){for(o in s)v.remove(u,o);delete p[x];e.removeData(u,q)}}}},_handle:function(u,o){var g=v.__getListeners(u,o.type);g=g.slice(0);for(var j,s,x=0,B=g.length;x<B;++x){j=g[x];j=j.fn.call(j.scope,o);if(s!==false)s=j;j!==i&&j===false&&o.halt();if(o.isImmediatePropagationStopped)break}return s},_getCache:function(u){return p[u]},__getID:d,_simpleAdd:l,_simpleRemove:m};v.on=v.add;v.detach=v.remove;return v},{requires:["dom","event/object"]}); KISSY.add("event/target",function(c,e,r,i){return{isCustomEventTarget:true,fire:function(f,d){var a=r.data(this,e.EVENT_GUID)||-1;if((a=((e._getCache(a)||{}).events||{})[f])&&c.isFunction(a.handle))return a.handle(i,d)},on:function(f,d,a){e.add(this,f,d,a);return this},detach:function(f,d,a){e.remove(this,f,d,a);return this}}},{requires:["event/base","dom"]}); KISSY.add("event/focusin",function(c,e){document.addEventListener&&c.each([{name:"focusin",fix:"focus"},{name:"focusout",fix:"blur"}],function(r){e.special[r.name]={fix:r.fix,capture:true,setup:function(i){i.type=r.name}}})},{requires:["event/base"]}); KISSY.add("event/mouseenter",function(c,e,r,i){i.ie||c.each([{name:"mouseenter",fix:"mouseover"},{name:"mouseleave",fix:"mouseout"}],function(f){e.special[f.name]={fix:f.fix,setup:function(d){d.type=f.name},handle:function(d,a){var b=a.relatedTarget;try{for(;b&&b!==d;)b=b.parentNode;b!==d&&e._handle(d,a)}catch(h){}}}})},{requires:["event/base","dom","ua"]});KISSY.add("event",function(c,e,r){e.Target=r;return e},{requires:["event/base","event/target","event/object","event/focusin","event/mouseenter"]}); KISSY.add("node/base",function(c,e,r,i){function f(b,h,l){if(!(this instanceof f))return new f(b,h,l);if(b)if(c.isString(b)){b=e.create(b,h,l);if(b.nodeType===11){d.push.apply(this,c.makeArray(b.childNodes));return i}}else if(c.isArray(b)||a(b)){d.push.apply(this,c.makeArray(b));return i}else b=b;else return i;this[0]=b;this.length=1;return i}var d=Array.prototype,a=e._isNodeList;c.augment(f,r.Target,{isCustomEventTarget:false,fire:null,length:0,item:function(b){if(c.isNumber(b)){if(b>=this.length)return null; return new f(this[b],i,i)}else return new f(b,i,i)},getDOMNodes:function(){return d.slice.call(this)},each:function(b,h){var l=this.length,m=0,q;for(q=new f(this[0],i,i);m<l&&b.call(h||q,q,m,this)!==false;q=new f(this[++m],i,i));return this},getDOMNode:function(){return this[0]},all:function(b){if(this.length>0)return f.all(b,this[0]);return new f(i,i,i)}});f.prototype.one=function(b){b=this.all(b);return b.length?b:null};f.all=function(b,h){if(c.isString(b)&&(b=c.trim(b))&&b.length>=3&&c.startsWith(b, "<")&&c.endsWith(b,">")){if(h){if(h.getDOMNode)h=h.getDOMNode();if(h.ownerDocument)h=h.ownerDocument}return new f(b,i,h)}return new f(e.query(b,h),i,i)};f.one=function(b,h){var l=f.all(b,h);return l.length?l:null};return f.List=f},{requires:["dom","event"]}); KISSY.add("node/attach",function(c,e,r,i,f){var d=i.prototype,a=e._isNodeList;i.addMethod=function(h,l,m,q){d[h]=function(){var t=c.makeArray(arguments);t.unshift(this);t=l.apply(m||this,t);if(t===f)t=this;else if(t===null)t=null;else if(q&&(t.nodeType||a(t)||c.isArray(t)))t=new i(t);return t}};var b=["_isElementNode","_getWin","_getComputedStyle","_isNodeList","_nodeTypeIs","_nl2frag","create","get","query","data","viewportHeight","viewportWidth","docHeight","docWidth"];c.each(e,function(h,l){e.hasOwnProperty(l)&& c.isFunction(h)&&!c.inArray(l,b)&&i.addMethod(l,h,e,true)});i.addMethod("data",e.data,e)},{requires:["dom","event","./base"]});KISSY.add("node/override",function(c,e,r,i){c.each(["append","prepend"],function(f){i.addMethod(f,function(d,a){var b=a;if(c.isString(b))b=e.create(b);e[f](b,d)},undefined,true)})},{requires:["dom","event","./base","./attach"]});KISSY.add("node",function(c,e){return e},{requires:["node/base","node/attach","node/override"]}); KISSY.add("json/json2",function(){function c(q){return q<10?"0"+q:q}function e(q){a.lastIndex=0;return a.test(q)?'"'+q.replace(a,function(t){var A=l[t];return typeof A==="string"?A:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+q+'"'}function r(q,t){var A,p,v,u,o=b,g,j=t[q];if(j&&typeof j==="object"&&typeof j.toJSON==="function")j=j.toJSON(q);if(typeof m==="function")j=m.call(t,q,j);switch(typeof j){case "string":return e(j);case "number":return isFinite(j)?String(j):"null";case "boolean":case "null":return String(j); case "object":if(!j)return"null";b+=h;g=[];if(Object.prototype.toString.apply(j)==="[object Array]"){u=j.length;for(A=0;A<u;A+=1)g[A]=r(A,j)||"null";v=g.length===0?"[]":b?"[\n"+b+g.join(",\n"+b)+"\n"+o+"]":"["+g.join(",")+"]";b=o;return v}if(m&&typeof m==="object"){u=m.length;for(A=0;A<u;A+=1){p=m[A];if(typeof p==="string")if(v=r(p,j))g.push(e(p)+(b?": ":":")+v)}}else for(p in j)if(Object.hasOwnProperty.call(j,p))if(v=r(p,j))g.push(e(p)+(b?": ":":")+v);v=g.length===0?"{}":b?"{\n"+b+g.join(",\n"+b)+ "\n"+o+"}":"{"+g.join(",")+"}";b=o;return v}}var i=window,f=i.JSON;if(!f)f=i.JSON={};if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,b,h,l={"":"\\b","\t":"\\t","\n":"\\n"," ":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},m;if(typeof f.stringify!=="function")f.stringify=function(q,t,A){var p;h=b="";if(typeof A==="number")for(p=0;p<A;p+=1)h+=" ";else if(typeof A==="string")h=A;if((m=t)&&typeof t!=="function"&&(typeof t!=="object"||typeof t.length!=="number"))throw Error("JSON.stringify");return r("",{"":q})};if(typeof f.parse!== "function")f.parse=function(q,t){function A(v,u){var o,g,j=v[u];if(j&&typeof j==="object")for(o in j)if(Object.hasOwnProperty.call(j,o)){g=A(j,o);if(g!==undefined)j[o]=g;else delete j[o]}return t.call(v,u,j)}var p;q=String(q);d.lastIndex=0;if(d.test(q))q=q.replace(d,function(v){return"\\u"+("0000"+v.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(q.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))){p=eval("("+q+")");return typeof t==="function"?A({"":p},""):p}throw new SyntaxError("JSON.parse");};return f});KISSY.add("json",function(c,e){return{parse:function(r){if(r==null||r==="")return null;return e.parse(r)},stringify:e.stringify}},{requires:["json/json2"]}); KISSY.add("ajax/impl",function(c,e,r,i){function f(n){n=c.merge(k,n);if(!n.url)return i;if(n.data&&!c.isString(n.data))n.data=c.param(n.data);n.context=n.context||n;var w,z=j,C,D=n.type.toUpperCase();if(n.dataType===A){w=n.jsonpCallback||c.guid(A);n.url=n.url+(n.url.indexOf("?")===-1?"?":"&")+(n.jsonp+"="+w);n.dataType=p;var E=b[w];b[w]=function(I){if(c.isFunction(E))E(I);else{b[w]=i;try{delete b[w]}catch(H){}}d([j,s],I,z,F,n)}}if(n.data&&D===l)n.url=n.url+(n.url.indexOf("?")===-1?"?":"&")+n.data; if(n.dataType===p){a(u,n);D=c.getScript(n.url,w?null:function(){d([j,s],v,z,F,n)});a(o,n);return D}var G=false,F=n.xhr();a(u,n);F.open(D,n.url,n.async);try{if(n.data||n.contentType)F.setRequestHeader(q,n.contentType);F.setRequestHeader("Accept",n.dataType&&n.accepts[n.dataType]?n.accepts[n.dataType]+", */*; q=0.01":n.accepts._default)}catch(J){}F.onreadystatechange=function(I){if(!F||F.readyState===0||I==="abort"){G||d(s,null,x,F,n);G=true;if(F)F.onreadystatechange=h}else if(!G&&F&&(F.readyState=== 4||I===B)){G=true;F.onreadystatechange=h;var H;if(I===B)H=B;else{a:{try{H=F.status>=200&&F.status<300||F.status===304||F.status===1223;break a}catch(P){}H=false}H=H?j:x}z=H;try{H=F;var M=n.dataType,N=v,O,L=H;if(!c.isString(L)){N=H.getResponseHeader(q)||v;L=(O=M==="xml"||!M&&N.indexOf("xml")>=0)?H.responseXML:H.responseText;if(O&&L.documentElement.nodeName===y)throw y;}if(c.isString(L))if(M===t||!M&&N.indexOf(t)>=0)L=r.parse(L);C=L}catch(Q){z=y}d([z===j?j:x,s],C,z,F,n);if(I===B){F.abort();a(g,n)}if(n.async)F= null}};a(o,n);try{F.send(D===m?n.data:null)}catch(K){d([x,s],C,x,F,n)}n.async||a(s,n);return F}function d(n,w,z,C,D){if(c.isArray(n))c.each(n,function(E){d(E,w,z,C,D)});else{z===n&&D[n]&&D[n].call(D.context,w,z,C);a(n,D)}}function a(n,w){f.fire(n,{ajaxConfig:w})}var b=window,h=function(){},l="GET",m="POST",q="Content-Type",t="json",A=t+"p",p="script",v="",u="start",o="send",g="stop",j="success",s="complete",x="error",B="timeout",y="parsererror",k={type:l,url:v,contentType:"application/x-www-form-urlencoded", async:true,data:null,xhr:b.ActiveXObject?function(){if(b.XmlHttpRequest)try{return new b.XMLHttpRequest}catch(n){}try{return new b.ActiveXObject("Microsoft.XMLHTTP")}catch(w){}}:function(){return new b.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"},jsonp:"callback"};c.mix(f,e.Target);c.mix(f,{get:function(n,w,z,C,D){if(c.isFunction(w)){C=z;z=w}return f({type:D|| l,url:n,data:w,success:function(E,G,F){z&&z.call(this,E,G,F)},dataType:C})},post:function(n,w,z,C){if(c.isFunction(w)){C=z;z=w;w=i}return f.get(n,w,z,C,m)},jsonp:function(n,w,z){if(c.isFunction(w)){z=w;w=null}return f.get(n,w,z,A)}});return f},{requires:["event","json"]});KISSY.add("ajax",function(c,e){return e},{requires:["ajax/impl"]}); KISSY.add("anim/easing",function(){var c=Math,e=c.PI,r=c.pow,i=c.sin,f=1.70158,d={easeNone:function(a){return a},easeIn:function(a){return a*a},easeOut:function(a){return(2-a)*a},easeBoth:function(a){return(a*=2)<1?0.5*a*a:0.5*(1- --a*(a-2))},easeInStrong:function(a){return a*a*a*a},easeOutStrong:function(a){return 1- --a*a*a*a},easeBothStrong:function(a){return(a*=2)<1?0.5*a*a*a*a:0.5*(2-(a-=2)*a*a*a)},elasticIn:function(a){if(a===0||a===1)return a;return-(r(2,10*(a-=1))*i((a-0.075)*2*e/0.3))},elasticOut:function(a){if(a=== 0||a===1)return a;return r(2,-10*a)*i((a-0.075)*2*e/0.3)+1},elasticBoth:function(a){if(a===0||(a*=2)===2)return a;if(a<1)return-0.5*r(2,10*(a-=1))*i((a-0.1125)*2*e/0.45);return r(2,-10*(a-=1))*i((a-0.1125)*2*e/0.45)*0.5+1},backIn:function(a){if(a===1)a-=0.0010;return a*a*((f+1)*a-f)},backOut:function(a){return(a-=1)*a*((f+1)*a+f)+1},backBoth:function(a){if((a*=2)<1)return 0.5*a*a*(((f*=1.525)+1)*a-f);return 0.5*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)},bounceIn:function(a){return 1-d.bounceOut(1-a)},bounceOut:function(a){return a< 1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},bounceBoth:function(a){if(a<0.5)return d.bounceIn(a*2)*0.5;return d.bounceOut(a*2-1)*0.5+0.5}};d.NativeTimeFunction={easeNone:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeBoth:"ease-in-out",easeInStrong:"cubic-bezier(0.9, 0.0, 0.9, 0.5)",easeOutStrong:"cubic-bezier(0.1, 0.5, 0.1, 1.0)",easeBothStrong:"cubic-bezier(0.9, 0.0, 0.1, 1.0)"};return d}); KISSY.add("anim/manager",function(c){function e(i){i[r]=i[r]||c.guid("anim-");return i[r]}var r=c.guid("anim-");return{interval:20,runnings:{},timer:null,start:function(i){var f=e(i);if(!this.runnings[f]){this.runnings[f]=i;this.startTimer()}},stop:function(i){this.notRun(i)},notRun:function(i){delete this.runnings[e(i)];c.isEmptyObject(this.runnings)&&this.stopTimer()},pause:function(i){this.notRun(i)},resume:function(i){this.start(i)},startTimer:function(){var i=this;if(!i.timer)i.timer=setTimeout(function(){if(i.runFrames())i.stopTimer(); else{i.timer=null;i.startTimer()}},i.interval)},stopTimer:function(){var i=this.timer;if(i){clearTimeout(i);this.timer=null}},runFrames:function(){var i=true,f=this.runnings,d;for(d in f)if(f.hasOwnProperty(d)){i=false;f[d]._runFrame()}return i}}}); KISSY.add("anim/base",function(c,e,r,i,f,d,a){function b(g,j,s,x,B,y){if(g=e.get(g)){if(!(this instanceof b))return new b(g,j,s,x,B,y);var k=c.isPlainObject(s);j=j;this.domEl=g;if(c.isPlainObject(j))j=String(c.param(j,";")).replace(/=/g,":").replace(/%23/g,"#").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();var n=j,w=g;g={};var z=q.length,C=w.cloneNode(true);e.insertAfter(C,w);w=C.style;for(l(C,n);z--;){var D=q[z];if(w[D])g[D]=(u[D]||u["*"]).getter(C,D)}n=m(n);for(var E in n)g[E]=(u[E]||u["*"]).getter(C, E);e.remove(C);this.props=g;this.targetStyle=j;if(k)k=c.merge(p,s);else{k=c.clone(p);if(s)k.duration=parseFloat(s)||1;if(c.isString(x)||c.isFunction(x))k.easing=x;if(c.isFunction(B))k.complete=B;if(y!==a)k.nativeSupport=y}if(!c.isEmptyObject(m(j)))k.nativeSupport=false;this.config=k;if(k.nativeSupport&&o()&&c.isString(x=k.easing))if(/cubic-bezier\([\s\d.,]+\)/.test(x)||(x=i.NativeTimeFunction[x])){k.easing=x;this.transitionName=o()}if(c.isFunction(B))this.callback=B}}function h(g,j){return j}function l(g, j){if(f.ie&&j.indexOf(A)>-1){var s=j.match(/opacity\s*:\s*([^;]+)(;|$)/);s&&e.css(g,A,parseFloat(s[1]))}g.style.cssText+=";"+j;s=m(j);for(var x in s)g[x]=s[x]}function m(g){for(var j={},s=0;s<t.length;s++){var x=t[s].replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();if(x=g.match(RegExp(x+"\\s*:([^;]+)(;|$)")))j[t[s]]=c.trim(x[1])}return j}var q,t,A,p,v;r=r.Target;q="borderBottomWidth borderBottomStyle borderLeftWidth borderLeftStyle borderRightWidth borderRightStyle borderSpacing borderTopWidth borderTopStyle bottom fontFamily fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop maxHeight maxWidth minHeight minWidth opacity outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex".split(" "); t=[];A="opacity";p={duration:1,easing:"easeNone",nativeSupport:true};b.PROPS=q;b.CUSTOM_ATTRS=t;b.PROP_OPS={"*":{getter:function(g,j){var s=e.css(g,j),x=parseFloat(s);s=(s+"").replace(/^[-\d.]+/,"");if(isNaN(x))return{v:s,u:"",f:h};return{v:x,u:s,f:this.interpolate}},setter:function(g,j,s){return e.css(g,j,s)},interpolate:function(g,j,s){return(g+(j-g)*s).toFixed(3)},eq:function(g,j){return g.v==j.v&&g.u==j.u}}};var u=b.PROP_OPS;c.augment(b,r,{isRunning:false,elapsedTime:0,start:0,finish:0,duration:0, run:function(){var g=this.config,j=this.domEl,s,x=this.props,B={},y;if(!this.isRunning)if(this.fire("start")!==false){this.stop();this.duration=s=g.duration*1E3;if(this.transitionName)this._nativeRun();else{for(y in x)B[y]=(u[y]||u["*"]).getter(j,y);this.source=B;j=c.now();s=j+s;g=g.easing;if(c.isString(g))g=i[g]||i.easeNone;this.start=j;this.finish=s;this.easing=g;d.start(this)}this.isRunning=true;return this}},_complete:function(){this.fire("complete");this.callback&&this.callback()},_runFrame:function(){var g= this.domEl,j=this.finish,s=this.start,x=this.duration,B=c.now(),y=this.source,k=this.easing,n=this.props,w;s=B-s;x=B>j?1:s/x;var z,C;this.elapsedTime=s;for(w in n){s=y[w];z=n[w];var D;D=z;var E=s,G=u[w];D=G&&G.eq?G.eq(D,E):u["*"].eq(D,E);if(!D){if(z.v==0)z.u=s.u;if(s.u!==z.u){s.v=0;s.u=z.u}D=z.f(s.v,z.v,k(x))+z.u;(u[w]||u["*"]).setter(g,w,D);if(z.f==h){s.v=z.v;s.u=z.u}}}if(this.fire("step")===false||(C=B>j)){this.stop();C&&this._complete()}},_nativeRun:function(){var g=this,j=g.domEl,s=g.duration, x=g.config.easing,B=g.transitionName,y={};y[B+"Property"]="all";y[B+"Duration"]=s+"ms";y[B+"TimingFunction"]=x;e.css(j,y);c.later(function(){l(j,g.targetStyle)},0);c.later(function(){g.stop(true)},s)},stop:function(g){if(this.isRunning){if(this.transitionName)this._nativeStop(g);else{if(g){l(this.domEl,this.targetStyle);this._complete()}d.stop(this)}this.isRunning=false;return this}},_nativeStop:function(g){var j=this.domEl,s=this.transitionName,x=this.props,B;if(g){e.css(j,s+"Property","none");this._complete()}else{for(B in x)e.css(j, B,e._getComputedStyle(j,B));e.css(j,s+"Property","none")}}});b.supportTransition=function(){if(v)return v;var g="transition",j,s=document.body;if(s.style[g]!==a)j=g;else c.each(["Webkit","Moz","O"],function(x){if(s.style[g=x+"Transition"]!==a){j=g;return false}});return v=j};var o=b.supportTransition;return b},{requires:["dom","event","./easing","ua","./manager"]}); KISSY.add("anim/node-plugin",function(c,e,r,i,f){function d(p,v,u,o,g,j,s){if(v==="toggle"){g=e.css(p,a)===b?1:0;v="show"}if(g)e.css(p,a,e.data(p,a)||"");var x={},B={};c.each(A[v],function(y){if(y===h){x[h]=e.css(p,h);e.css(p,h,l)}else if(y===m){x[m]=e.css(p,m);B.opacity=g?1:0;g&&e.css(p,m,0)}else if(y===q){x[q]=e.css(p,q);B.height=g?e.css(p,q)||p.naturalHeight:0;g&&e.css(p,q,0)}else if(y===t){x[t]=e.css(p,t);B.width=g?e.css(p,t)||p.naturalWidth:0;g&&e.css(p,t,0)}});return(new r(p,B,u,j||"easeOut", function(){if(!g){var y=p.style,k=y[a];if(k!==b){k&&e.data(p,a,k);y[a]=b}x[q]&&e.css(p,{height:x[q]});x[t]&&e.css(p,{width:x[t]});x[m]&&e.css(p,{opacity:x[m]});x[h]&&e.css(p,{overflow:x[h]})}o&&c.isFunction(o)&&o()},s)).run()}var a="display",b="none",h="overflow",l="hidden",m="opacity",q="height",t="width",A={show:[h,m,q,t],fade:[m],slide:[h,q]};(function(p){p.animate=function(){var v=this,u=c.makeArray(arguments);v.__anims=v.__anims||[];c.each(this,function(o){v.__anims.push(r.apply(f,[o].concat(u)).run())}); return this};p.stop=function(v){c.each(this.__anims,function(u){u.stop(v)});this.__anims=[]};c.each({show:["show",1],hide:["show",0],toggle:["toggle"],fadeIn:["fade",1],fadeOut:["fade",0],slideDown:["slide",1],slideUp:["slide",0]},function(v,u){p[u]=function(o,g,j,s){var x=this;x.__anims=x.__anims||[];e[u]&&arguments.length===0?e[u](this):c.each(this,function(B){x.__anims.push(d(B,v[0],o,g,v[1],j,s))});return this}})})(i.List.prototype)},{requires:["dom","anim/base","node"]}); KISSY.add("anim/color",function(c,e,r){function i(l){l=l.toLowerCase();var m;if(m=l.match(d))return[parseInt(m[1]),parseInt(m[2]),parseInt(m[3])];else if(m=l.match(a)){for(l=1;l<m.length;l++)if(m[l].length<2)m[l]+=m[l];return[parseInt(m[1],16),parseInt(m[2],16),parseInt(m[3],16)]}if(f[l])return f[l];return[255,255,255]}var f={black:[0,0,0],silver:[192,192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0], olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255]},d=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,a=/^#?([0-9A-F]{1,2})([0-9A-F]{1,2})([0-9A-F]{1,2})$/i,b="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color outlineColor".split(" "),h=r.PROP_OPS;r=r.PROPS;r.push.apply(r,b);h.color={getter:function(l,m){return{v:i(e.css(l,m)),u:"",f:this.interpolate}},setter:h["*"].setter,interpolate:function(l,m,q){var t= h["*"].interpolate;return"rgb("+[Math.floor(t(l[0],m[0],q)),Math.floor(t(l[1],m[1],q)),Math.floor(t(l[2],m[2],q))].join(", ")+")"},eq:function(l,m){return l.v+""==m.v+""}};c.each(b,function(l){h[l]=h.color})},{requires:["dom","./base"]});KISSY.add("anim/scroll",function(c,e,r){var i=r.PROP_OPS;r.CUSTOM_ATTRS.push("scrollLeft","scrollTop");i.scrollLeft=i.scrollTop={getter:function(f,d){return{v:f[d],u:"",f:i["*"].interpolate}},setter:function(f,d,a){f[d]=a}}},{requires:["dom","./base"]}); KISSY.add("anim",function(c,e,r){e.Easing=r;return e},{requires:["anim/base","anim/easing","anim/node-plugin","anim/color","anim/scroll"]}); KISSY.add("base/attribute",function(c,e){function r(){this.__attrs={};this.__attrVals={}}function i(f){f+="";return f.charAt(0).toUpperCase()+f.substring(1)}c.augment(r,{__getDefAttrs:function(){return c.clone(this.__attrs)},addAttr:function(f,d,a){if(this.__attrs[f])c.mix(this.__attrs[f],d,a);else this.__attrs[f]=c.clone(d||{});return this},hasAttr:function(f){return f&&this.__attrs.hasOwnProperty(f)},removeAttr:function(f){if(this.hasAttr(f)){delete this.__attrs[f];delete this.__attrVals[f]}return this}, set:function(f,d){var a=this.get(f);if(a!==d)if(false!==this.__fireAttrChange("before",f,a,d)){this.__set(f,d);this.__fireAttrChange("after",f,a,this.__attrVals[f]);return this}},__fireAttrChange:function(f,d,a,b){return this.fire(f+i(d)+"Change",{attrName:d,prevVal:a,newVal:b})},__set:function(f,d){var a,b=this.__attrs[f];if(b=b&&b.setter)a=b.call(this,d);if(a!==e)d=a;this.__attrVals[f]=d},get:function(f){var d;d=(d=this.__attrs[f])&&d.getter;f=f in this.__attrVals?this.__attrVals[f]:this.__getDefAttrVal(f); if(d)f=d.call(this,f);return f},__getDefAttrVal:function(f){f=this.__attrs[f];var d;if(f){if(d=f.valueFn){d=d.call(this);if(d!==e)f.value=d;delete f.valueFn}return f.value}},reset:function(f){if(this.hasAttr(f))return this.set(f,this.__getDefAttrVal(f));for(f in this.__attrs)this.hasAttr(f)&&this.reset(f);return this}});r.__capitalFirst=i;return r}); KISSY.add("base/base",function(c,e,r){function i(f){e.call(this);for(var d=this.constructor;d;){var a=d.ATTRS;if(a){var b=void 0;for(b in a)a.hasOwnProperty(b)&&this.addAttr(b,a[b],false)}d=d.superclass?d.superclass.constructor:null}if(f)for(var h in f)f.hasOwnProperty(h)&&this.__set(h,f[h])}c.augment(i,r.Target,e);return i},{requires:["./attribute","event"]});KISSY.add("base",function(c,e){return e},{requires:["base/base"]}); KISSY.add("cookie/base",function(c){var e=document,r=encodeURIComponent,i=decodeURIComponent;return{get:function(f){var d;if(c.isString(f)&&f!=="")if(f=String(e.cookie).match(RegExp("(?:^| )"+f+"(?:(?:=([^;]*))|;|$)")))d=f[1]?i(f[1]):"";return d},set:function(f,d,a,b,h,l){d=String(r(d));var m=a;if(typeof m==="number"){m=new Date;m.setTime(m.getTime()+a*864E5)}if(m instanceof Date)d+="; expires="+m.toUTCString();if(c.isString(b)&&b!=="")d+="; domain="+b;if(c.isString(h)&&h!=="")d+="; path="+h;if(l)d+= "; secure";e.cookie=f+"="+d},remove:function(f,d,a,b){this.set(f,"",0,d,a,b)}}});KISSY.add("cookie",function(c,e){return e},{requires:["cookie/base"]}); KISSY.add("core",function(c,e,r,i,f,d,a,b,h,l){a.getScript=c.getScript;e={UA:e,DOM:r,Event:i,EventTarget:i.Target,Node:f,NodeList:f.List,JSON:d,Ajax:a,IO:a,ajax:a,io:a,jsonp:a.jsonp,Anim:b,Easing:b.Easing,Base:h,Cookie:l,one:f.one,all:f.List.all,get:r.get,query:r.query};c.mix(c,e);return e},{requires:["ua","dom","event","node","json","ajax","anim","base","cookie"]});KISSY.use("core");
436.532051
816
0.662389
f12ccd4ab903e7f900df630521b75e2ef5ca3d87
1,327
js
JavaScript
.eslintrc.js
jaypeng2015/decision-maker
91f1692b2148b53ef2b104a93125a54968ff9884
[ "MIT" ]
2
2018-11-22T19:03:23.000Z
2019-07-27T03:26:50.000Z
.eslintrc.js
jaypeng2015/decision-maker
91f1692b2148b53ef2b104a93125a54968ff9884
[ "MIT" ]
644
2018-07-24T03:29:42.000Z
2021-01-21T15:31:15.000Z
.eslintrc.js
jaypeng2015/decision-maker
91f1692b2148b53ef2b104a93125a54968ff9884
[ "MIT" ]
null
null
null
module.exports = { env: { es6: true, node: true, jest: true, }, extends: [ 'eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript', 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. ], parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', sourceType: 'module', }, plugins: ['@typescript-eslint', 'jest'], rules: { '@typescript-eslint/camelcase': 'off', '@typescript-eslint/no-non-null-assertion': 'off', 'import/order': [ 'error', { groups: [ ['builtin', 'external'], ['parent', 'sibling', 'index'], ], 'newlines-between': 'always', }, ], }, settings: { 'import/core-modules': ['aws-lambda'], }, };
32.365854
218
0.64431
f12e0eb953062f3b5347157eb337111606971bc6
350
js
JavaScript
src/modules/contact.js
Ceci007/restaurant-page
a74684c244dbd3bdbb695462dd29a584634257b0
[ "MIT" ]
2
2020-12-05T03:03:15.000Z
2021-01-28T22:48:37.000Z
src/modules/contact.js
Ceci007/restaurant-page
a74684c244dbd3bdbb695462dd29a584634257b0
[ "MIT" ]
null
null
null
src/modules/contact.js
Ceci007/restaurant-page
a74684c244dbd3bdbb695462dd29a584634257b0
[ "MIT" ]
null
null
null
/* eslint-disable import/prefer-default-export */ import { createList } from './helper'; const contact = { renderAreaId: 'contContainer', render: (location) => { createList(location, 'Contact me at:', 'GitHub: https://github.com/Ceci007', 'Linkedin: www.linkedin.com/in/cecilia-benítez', '+595981-123-456-arf!'); }, }; export { contact };
31.818182
154
0.677143
f12ed4faf5d0daf5e775627b79870b5ff172565d
6,191
js
JavaScript
src/app/common/components/icons/icons.stories.js
AurelienGasser/substra-frontend
ba033bf70587a41011283e26fc814a72c8216437
[ "Apache-2.0" ]
17
2019-10-25T13:35:15.000Z
2021-03-23T21:17:59.000Z
src/app/common/components/icons/icons.stories.js
AurelienGasser/substra-frontend
ba033bf70587a41011283e26fc814a72c8216437
[ "Apache-2.0" ]
37
2019-10-31T12:51:41.000Z
2020-11-05T14:14:21.000Z
src/app/common/components/icons/icons.stories.js
dino0633/substrafrontend
a8226aac1fd548d53df3d9296953cb5c5d03ab25
[ "Apache-2.0" ]
11
2019-10-25T13:46:54.000Z
2021-06-03T11:47:38.000Z
import React from 'react'; import {storiesOf} from '@storybook/react'; import {withKnobs, color, number} from '@storybook/addon-knobs/react'; import styled from '@emotion/styled'; import { Alert, Algo, Book, Check, ClearIcon, Clipboard, Collapse, CopyDrop, CopySimple, Dataset, DownloadDrop, DownloadSimple, Expand, FilterUp, Folder, Model, MoreVertical, OwkestraLogo, Permission, Search, SignOut, SubstraLogo, } from './index'; import {slate, tealish} from '../../../../../assets/css/variables/colors'; import {spacingSmall} from '../../../../../assets/css/variables/spacing'; const Dl = styled.dl` display: grid; grid-template-columns: 50px auto; grid-gap: ${spacingSmall}; `; const Dt = styled.dt` grid-column: 1; width: 50px; `; const Dd = styled.dd` grid-column: 2; margin: 0; `; storiesOf('Icons', module) .addDecorator(withKnobs) .add('default', () => { const colorKnob = color('color', slate); const secondaryColorKnob = color('secondaryColor', tealish); const heightKnob = number('height', 24); const widthKnob = number('width', 24); return ( <> <Dl> <Dt> <Alert color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Alert </Dd> <Dt> <Algo color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Algo </Dd> <Dt> <Book color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Book </Dd> <Dt> <Check color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Check </Dd> <Dt> <ClearIcon color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> ClearIcon </Dd> <Dt> <Clipboard color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Clipboard </Dd> <Dt> <Collapse color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Collapse </Dd> <Dt> <CopyDrop color={colorKnob} secondaryColor={secondaryColorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> CopyDrop </Dd> <Dt> <CopySimple color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> CopySimple </Dd> <Dt> <Dataset color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Dataset </Dd> <Dt> <DownloadDrop color={colorKnob} secondaryColor={secondaryColorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> DownloadDrop </Dd> <Dt> <DownloadSimple color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> DownloadSimple </Dd> <Dt> <Expand color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Expand </Dd> <Dt> <FilterUp color={colorKnob} secondaryColor={secondaryColorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> FilterUp </Dd> <Dt> <Folder color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Folder </Dd> <Dt> <Model color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Model </Dd> <Dt> <MoreVertical color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> MoreVertical </Dd> <Dt> <Permission color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Permission </Dd> <Dt> <Search color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> Search </Dd> <Dt> <SignOut color={colorKnob} height={heightKnob} width={widthKnob} /> </Dt> <Dd> SignOut </Dd> </Dl> </> ); }) .add('logos', () => ( <> <div> <SubstraLogo width={200} /> </div> <div> <OwkestraLogo width={200} /> </div> </> ));
32.07772
132
0.365369
f12ed6a8d22e39088b5a9c9cfb5752bb657d0e4f
606
js
JavaScript
assets/js/IpsumListener.js
Steven24K/lorum-ipsum-generator
d81d0b429e176dc94ea460cd12b3cdf33240328c
[ "MIT" ]
10
2017-04-15T05:46:36.000Z
2021-02-23T14:30:59.000Z
assets/js/IpsumListener.js
Steven24K/lorum-ipsum-generator
d81d0b429e176dc94ea460cd12b3cdf33240328c
[ "MIT" ]
21
2017-01-09T22:29:31.000Z
2017-01-30T00:30:22.000Z
assets/js/IpsumListener.js
Steven24K/lorum-ipsum-generator
d81d0b429e176dc94ea460cd12b3cdf33240328c
[ "MIT" ]
3
2017-10-28T23:40:31.000Z
2021-02-23T14:31:12.000Z
"use strict" var IpsumListener = (function (_doc, _ipsumGen) { var _formGenerator = _doc.getElementById('form-generate'), _paragNumInput = _doc.getElementById('paragraph-number-input'), _startWith = _doc.getElementById('start-with'); /** * Add all the listeners here */ _formGenerator.addEventListener("submit", onSubmit, false); function onSubmit(e) { e.preventDefault(); var start = _startWith && _startWith.checked ? _startWith.value : undefined; _ipsumGen.genIpsum(_paragNumInput.value, start); } })(document, IpsumGenerator);
28.857143
84
0.671617
f12f1c46b4b0c119214920afbc2b871ca665a03d
34
js
JavaScript
src/MenuCard/index.js
ox2/ui
583a132aa7c050cd987d7b6367e2a8837d56c91f
[ "MIT" ]
null
null
null
src/MenuCard/index.js
ox2/ui
583a132aa7c050cd987d7b6367e2a8837d56c91f
[ "MIT" ]
null
null
null
src/MenuCard/index.js
ox2/ui
583a132aa7c050cd987d7b6367e2a8837d56c91f
[ "MIT" ]
null
null
null
export default from './MenuCard';
17
33
0.735294
f12fb37601bc652b959e989c1825595056e3b963
447
js
JavaScript
backend/web/js/ajax.js
abedghr/selling-vehicles
dedd17d267029a4aa63f5674c0ce15de837965a2
[ "BSD-3-Clause" ]
null
null
null
backend/web/js/ajax.js
abedghr/selling-vehicles
dedd17d267029a4aa63f5674c0ce15de837965a2
[ "BSD-3-Clause" ]
null
null
null
backend/web/js/ajax.js
abedghr/selling-vehicles
dedd17d267029a4aa63f5674c0ce15de837965a2
[ "BSD-3-Clause" ]
null
null
null
$('document').ready(function () { $('.featureCheckBox').change(function () { var make_id = $(this).val(); var featured_type = $(this).attr('attribute'); $.ajax({ url: base_url + "/ajax/feature/", type: "POST", dataType: 'json', data: {'make_id': make_id,'featured_type':featured_type}, }).done(function (response) { }); return false; }); });
27.9375
69
0.494407
f12fc487a1c7b6e0a9b5be13dd3b358c52826685
1,478
js
JavaScript
Serverless/simple_crud/src/handlers/updateBook.js
jugaldb/Simple-CRUD
243091cdc2f9f6b4181c0ca5a4e154254e746dd0
[ "MIT" ]
9
2020-11-02T05:45:27.000Z
2021-09-18T16:19:37.000Z
Serverless/simple_crud/src/handlers/updateBook.js
jugaldb/Simple-CRUD
243091cdc2f9f6b4181c0ca5a4e154254e746dd0
[ "MIT" ]
1
2020-11-14T11:42:50.000Z
2020-11-24T06:59:46.000Z
Serverless/simple_crud/src/handlers/updateBook.js
jugaldb/Simple-CRUD
243091cdc2f9f6b4181c0ca5a4e154254e746dd0
[ "MIT" ]
5
2020-11-02T05:45:52.000Z
2020-12-29T07:57:29.000Z
import AWS from 'aws-sdk'; /// import middy from '@middy/core'; import httpJsonBodyParser from '@middy/http-json-body-parser'; import httpEventNormalizer from '@middy/http-event-normalizer'; import httpErrorHandler from '@middy/http-error-handler'; import createError from 'http-errors' /// const dynamodb = new AWS.DynamoDB.DocumentClient(); async function updateBook(event, context) { //JSON.parse(event.body) const { author, title } = event.body; let book; const { id } = event.pathParameters; var params = { TableName: process.env.CRUD_TABLE_NAME, Key: { id }, UpdateExpression: "set author = :a, title = :t", ExpressionAttributeValues: { ":a": author, ":t": title, }, ReturnValues: "UPDATED_NEW" }; try { await dynamodb.update( params, function (err, data) { if (err) { console.error("Unable to update item. Error JSON:", JSON.stringify(err, null, 2)); } else { console.log("UpdateItem succeeded:", JSON.stringify(data, null, 2)); } } ).promise(); } catch (error) { console.log(error) throw new createError.InternalServerError(error) } return { statusCode: 200, body: "updated", }; } //export const handler = updateBook; export const handler = middy(updateBook) .use(httpJsonBodyParser()) // automatically parse .use(httpEventNormalizer()) //saves us from room for errors , searches params .use(httpErrorHandler());
24.229508
92
0.652909
f12fcec66dcc8805c25b45381438ddc540ab5483
1,507
js
JavaScript
index.js
ArtifexYT/JSON-Constructor
137987813dbd0b0bad286fda5a814ffbb8200c48
[ "MIT" ]
null
null
null
index.js
ArtifexYT/JSON-Constructor
137987813dbd0b0bad286fda5a814ffbb8200c48
[ "MIT" ]
null
null
null
index.js
ArtifexYT/JSON-Constructor
137987813dbd0b0bad286fda5a814ffbb8200c48
[ "MIT" ]
null
null
null
const path = require("path"); const fs = require("fs-extra"); class JSONMaker { constructor(path) { this.json = {}; if (path) this.load(path); } addField(title, data) { if (this.json[title]) return "This value already exists in the file."; this.json[title] = data; return this; } removeField(title) { if (!this.json[title]) return "This value doesn't exist in the file."; delete this.json[title]; return this; } exists(title) { return !!this.json[title]; } write(path) { return fs.writeFile(path, JSON.stringify(this.json, null, 4)); } _verifyJSON(data) { return new Promise((resolve, reject) => { try { JSON.parse(data); return resolve(); } catch (e) { return reject(e); } }); } load(path) { return new Promise((resolve, reject) => { fs.readFile(path, "utf8", (err, data) => { if (err) return reject(err); this._verifyJSON(data).then(() => { this.json = JSON.parse(data); return resolve(); }).catch(err2 => reject(err2)); }); }); } clear() { this.json = {}; } get(title) { return this.json[title] || null; } } module.exports = JSONMaker;
23.920635
79
0.4572
f130d84968939bcb6f33589f271b1f33c2a32280
8,155
js
JavaScript
client/templates/set-night-out/map.js
JoeKarlsson/night-out
4db965a878a18300224141f1543e59372467f9be
[ "MIT" ]
1
2021-09-27T11:58:08.000Z
2021-09-27T11:58:08.000Z
client/templates/set-night-out/map.js
JoeKarlsson1/night-out
4db965a878a18300224141f1543e59372467f9be
[ "MIT" ]
1
2019-01-11T03:07:16.000Z
2019-01-11T03:14:18.000Z
client/templates/set-night-out/map.js
JoeKarlsson1/night-out
4db965a878a18300224141f1543e59372467f9be
[ "MIT" ]
null
null
null
//Global variable for setting default zoom in google maps var MAP_ZOOM = 14; var results; //When app starts load google maps Meteor.startup(function() { GoogleMaps.load({ v : '3', key : 'AIzaSyAG_bYopvQf3H2lrQBNfKJyo4fic2ETdFI', libraries : 'geometry,places' }); }); //Pull latitude and longitude from google maps api and return location zoom Template.map.helpers({ //If there is an error finding the current users geoloaction - spit out error to the DOM geolocationError : function() { var error = Geolocation.error(); return error && error.message; }, //Set out map options mapOptions : function() { var latLng = Geolocation.latLng(); Session.set('latLng', latLng); //Initialize the map once we have the latLng. if (GoogleMaps.loaded() && latLng) { return { center : new google.maps.LatLng(latLng.lat, latLng.lng), zoom : MAP_ZOOM, // This is where you would paste any style found on Snazzy Maps. styles: [{"featureType":"all","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"administrative.country","elementType":"geometry.stroke","stylers":[{"visibility":"off"}]},{"featureType":"administrative.province","elementType":"geometry.stroke","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"visibility":"on"},{"color":"#e3e3e3"}]},{"featureType":"landscape","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"saturation":"0"},{"lightness":"6"},{"weight":"0.90"}]},{"featureType":"landscape.man_made","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"},{"lightness":"0"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"visibility":"simplified"}]},{"featureType":"poi","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.attraction","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"poi.attraction","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"poi.attraction","elementType":"geometry.fill","stylers":[{"visibility":"simplified"}]},{"featureType":"poi.attraction","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.government","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"poi.government","elementType":"geometry","stylers":[{"visibility":"off"}]},{"featureType":"poi.government","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"poi.medical","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#e6f0d7"}]},{"featureType":"poi.place_of_worship","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi.school","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi.sports_complex","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"color":"#cccccc"}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"on"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"saturation":"0"},{"lightness":"30"}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"visibility":"on"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"transit.station","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"transit.station.airport","elementType":"geometry","stylers":[{"visibility":"off"}]},{"featureType":"transit.station.airport","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#FFFFFF"}]},{"featureType":"water","elementType":"geometry.fill","stylers":[{"lightness":"-28"},{"saturation":"33"},{"color":"#f2f8fd"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"off"}]}] }; } }, allTargets : function () { return Session.get('allTargets'); } }); //Create google maps marker for current location Template.map.onCreated(function() { var self = this; GoogleMaps.ready('map', function(map) { //get lat and long from current location //IDEA: after getting the current location - save to a session variable so we can use and reuse it. var latLng = Geolocation.latLng(); //variable within scope that sets current location var currentPost = new google.maps.LatLng(latLng.lat, latLng.lng); //variable that creates a new instance of marker information display var infowindow = new google.maps.InfoWindow(); //Gold star SVG to mark current location var goldStar = { path: 'M 125,5 155,90 245,90 175,145 200,230 125,180 50,230 75,145 5,90 95,90 z', fillColor: 'yellow', fillOpacity: 0.8, scale: .25, strokeColor: 'gold', strokeWeight: 5 }; //drop marker on current location var marker = new google.maps.Marker({ position : currentPost, map : map.instance, icon: goldStar, animation : google.maps.Animation.DROP }); var infoWindowContent = '<h5>You are here</h5>'; //event listener that loads resturant information into infowindow. google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(infoWindowContent); infowindow.open(map.instance, this); }); //get surrounding restaurants within radius //call on the document of food which is an array of objects var service = new google.maps.places.PlacesService(map.instance); service.nearbySearch({ location : currentPost, radius : 2600, types : ['bar', 'brewery'] }, callback); //Error checking to check for status of query function callback(results, status) { if (status === google.maps.places.PlacesServiceStatus.OK) { var targets = results.map(function (target) { createMarker(target); var targetDetail = { name : target.name, placeId : target.place_id, include : false, location : target.geometry.location, icon : target.icon, vicinity : target.vicinity, rating : target.rating, votes : 0, currentLocation : latLng, planId : 0 }; return targetDetail; }); Session.set('allTargets', targets); } } //create marker for all restaurant locations within radius function createMarker(place) { var placeLoc = place.geometry.location; var marker = new google.maps.Marker({ map : map.instance, position : placeLoc, draggable : false, icon : place.icon, animation : google.maps.Animation.DROP }); var infoWindowContent = '<h5>' + place.name + '</h5>'; //event listener that loads resturant information into infowindow. google.maps.event.addListener(marker, 'click', function() { if (marker.getAnimation() !== null) { marker.setAnimation(null); } else { marker.setAnimation(google.maps.Animation.BOUNCE); } infowindow.setContent(infoWindowContent); infowindow.open(map.instance, this); }); return marker; } }); });
57.429577
3,794
0.653096
f130eb76f134533353d09da7a6454c303c8ad0d7
343
js
JavaScript
node_modules/packet/t/parser/length-encoded.t.js
caleby117/TallyArbiter
29b3e14c4ae88a8cecbc1286ae93d764344359aa
[ "MIT" ]
null
null
null
node_modules/packet/t/parser/length-encoded.t.js
caleby117/TallyArbiter
29b3e14c4ae88a8cecbc1286ae93d764344359aa
[ "MIT" ]
null
null
null
node_modules/packet/t/parser/length-encoded.t.js
caleby117/TallyArbiter
29b3e14c4ae88a8cecbc1286ae93d764344359aa
[ "MIT" ]
null
null
null
#!/usr/bin/env node require('./proof')(6, function (parseEqual) { var bytes = [ 0x00, 0x03, 0x02, 0x03, 0x04 ]; var field = bytes.slice(2); parseEqual("b16/b8", bytes, 5, field, "read a length encoded array of bytes"); parseEqual("b16/b8 => array", bytes, 5, { array: field }, "read a named length encoded array of bytes"); });
34.3
80
0.635569
f131da40e347006e2f3f8093c02abd25c48938dd
150
js
JavaScript
src/ExpansionPanel/index.js
RayJune/san-mui
98580dbb1c66df7eb49916b1e0f25173f9febbfc
[ "MIT" ]
96
2017-01-23T06:59:09.000Z
2021-12-02T08:44:12.000Z
src/ExpansionPanel/index.js
RayJune/san-mui
98580dbb1c66df7eb49916b1e0f25173f9febbfc
[ "MIT" ]
71
2017-02-13T06:28:23.000Z
2020-02-18T07:01:57.000Z
src/ExpansionPanel/index.js
RayJune/san-mui
98580dbb1c66df7eb49916b1e0f25173f9febbfc
[ "MIT" ]
44
2017-04-17T05:05:59.000Z
2020-06-11T06:35:09.000Z
/** * @file Expansion Panel * @author leon <ludafa@outlook.com> */ import ExpansionPanel from './ExpansionPanel'; export default ExpansionPanel;
16.666667
46
0.726667
f13205bb70c5ff599ca4a63bacc6da4b6dd019d2
2,327
js
JavaScript
src/controllers/users.js
halkeand/poller-fcc
960ffcd99231d73b1b5ec114a1b362d15bd9725e
[ "MIT" ]
null
null
null
src/controllers/users.js
halkeand/poller-fcc
960ffcd99231d73b1b5ec114a1b362d15bd9725e
[ "MIT" ]
null
null
null
src/controllers/users.js
halkeand/poller-fcc
960ffcd99231d73b1b5ec114a1b362d15bd9725e
[ "MIT" ]
null
null
null
const to = require('await-to-js').to, User = require('../models/User'), { json400, json403, json200, allowFields, getMessages, rejectKeys } = require('../utils') // When we receive a json body, the only fields which can be // Updated on the User model are the following const extractFieldsFrom = allowFields([ 'nickname', 'password', 'passwordConfirm' ]) module.exports = { getAll: async (req, res, next) => { ;[e, users] = await to(User.find()) e || users === null ? json400(res, { errror: 'Could not retrieve all users' }) : json200(res, users.map(u => rejectKeys('password')(u._doc))) }, getOne: async ({ params }, res, next) => { const { id } = params ;[e, user] = await to(User.findById(id)) e || user === null ? json400(res, { errror: `Could not retrieve user with id : ${id}` }) : json200(res, rejectKeys('password')(user._doc)) }, addOne: async ({ body }, res, next) => { console.log(body) const data = extractFieldsFrom(body) ;[e, user] = await to(new User(data).save()) e ? json400(res, { error: getMessages(e.errors) }) : json200(res, rejectKeys('password')(user._doc)) }, updateOne: async (req, res, next) => { const { body, params: { id }, token } = req if (token.id !== id) json403(res, { errror: `Operation denied` }) else { const data = extractFieldsFrom(body) ;[findError, user] = await to(User.findById(id)) if (findError || user === null) json400(res, { errror: `User ${id} does not exist` }) else { for (let field in data) { user[field] = data[field] } ;[e, updatedUser] = await to(user.save()) e ? json400(res, { error: getMessages(e.errors) }) : json200(res, updatedUser) } } }, deleteOne: async (req, res, next) => { const { body, params: { id }, token } = req if (token.id !== id) json403(res, { error: `Operation denied` }) else { ;[e, user] = await to(User.findById(id).remove()) e ? json400(res, { errror: 'An error occured while deleteing your account' }) : user.n === 0 ? json400(res, `User ${id}, does not exist`) : json200(res, `User ${id} deleted`) } } }
27.702381
75
0.554362
f1325248f0005330dcf8f60156631b34b5b7898e
313
js
JavaScript
packages/service/src/serverless/util/callbackOnWarmup.js
fossabot/me-1
71aff052c6cd66e0891f6648e0f599d7ba229bc4
[ "MIT" ]
6
2018-07-19T05:59:05.000Z
2021-12-29T21:07:18.000Z
packages/service/src/serverless/util/callbackOnWarmup.js
fossabot/me-1
71aff052c6cd66e0891f6648e0f599d7ba229bc4
[ "MIT" ]
526
2018-08-03T04:58:27.000Z
2020-11-29T16:21:09.000Z
packages/service/src/serverless/util/callbackOnWarmup.js
fossabot/me-1
71aff052c6cd66e0891f6648e0f599d7ba229bc4
[ "MIT" ]
3
2020-01-04T19:37:31.000Z
2020-07-15T18:48:33.000Z
import logger from "../logger"; export const callbackOnWarmup = (event, context, callback) => { logger.debug("%s@%s warmed up request %s", context.functionName, context.functionVersion, context.awsRequestId, event, context); return callback(null, "Lambda is warm!"); }; export default callbackOnWarmup;
34.777778
132
0.731629
f13372925d5437828837337ddd62e6a0596e0b14
135
js
JavaScript
lib/utils/index.js
devanp92/combinatorics.js
c29f81a3dda64227ac49b9d0354cd385109b4316
[ "MIT" ]
177
2015-08-29T17:48:04.000Z
2020-10-21T11:56:58.000Z
lib/utils/index.js
devanp92/combinatorics.js
c29f81a3dda64227ac49b9d0354cd385109b4316
[ "MIT" ]
1
2017-10-30T07:12:33.000Z
2019-07-17T14:51:53.000Z
lib/utils/index.js
devanp92/combinatorics.js
c29f81a3dda64227ac49b9d0354cd385109b4316
[ "MIT" ]
9
2015-08-29T23:59:26.000Z
2021-12-29T21:38:38.000Z
module.exports = [ require('./combinations'), require('./isInteger'), require('./object'), require('./enumerative') ];
19.285714
30
0.585185
f133da17be6e94df729f9db6036dab072c5ba005
264
js
JavaScript
migrations/2_deploy_contracts.js
The-Poolz/Locked-pools
155f02de944195f18319f7f22c9ad0746c058ad3
[ "MIT" ]
null
null
null
migrations/2_deploy_contracts.js
The-Poolz/Locked-pools
155f02de944195f18319f7f22c9ad0746c058ad3
[ "MIT" ]
11
2021-03-18T12:34:21.000Z
2022-02-23T10:43:37.000Z
migrations/2_deploy_contracts.js
The-Poolz/Locked-pools
155f02de944195f18319f7f22c9ad0746c058ad3
[ "MIT" ]
3
2021-01-22T09:37:13.000Z
2021-05-04T13:44:17.000Z
const LockedDeal = artifacts.require("LockedDeal"); const TestToken = artifacts.require("Token"); module.exports = function(deployer) { deployer.deploy(LockedDeal); // deployer.link(LockedDeal, TestToken); deployer.deploy(TestToken, 'TestToken', 'TEST'); };
33
51
0.742424
f13498d536a5d7cdd751a7d23ebdd22cb290076b
834
js
JavaScript
src/pages/react/components/Language/getPackage.js
13462652275/react-laboratory
7f609b87507c256cd91c72c4307f54a704b998f2
[ "MIT" ]
null
null
null
src/pages/react/components/Language/getPackage.js
13462652275/react-laboratory
7f609b87507c256cd91c72c4307f54a704b998f2
[ "MIT" ]
2
2022-02-14T13:37:15.000Z
2022-02-27T17:32:04.000Z
src/pages/react/components/Language/getPackage.js
liuzane/react-laboratory
aaf26ea498c76344ede4e0caf92a9dfbc47f26ed
[ "MIT" ]
null
null
null
// 方法 import { getStorage, setStorage } from '@/utils/local-storage'; // 检索搜索值是否为 key 子字符串 const isMatch = function (searchKey, object) { const keys = Object.keys(object); return keys.find(key => key.search(searchKey) !== -1); }; export default function (packages, language) { const packageKey = (getStorage('language') || language || navigator.language); let baseLanguage = packageKey.replace(/_.{2}/, ''); let languagePackage = {}; // 优雅降级 if (packages[packageKey]) { languagePackage = packages[packageKey]; } else if (isMatch(baseLanguage, packages)) { languagePackage = packages[isMatch(baseLanguage, packages)]; } else { languagePackage = packages['en-US']; } // 保存语言选项 if (languagePackage.language) { setStorage('language', languagePackage.language); } return languagePackage; }
26.903226
80
0.684652
f134c018ed2cf7a279fe0b5a1a1aa3ff324139c5
1,000
js
JavaScript
dist-mdi/mdi/robot-confused.js
maciejg-git/vue-bootstrap-icons
bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec
[ "MIT", "CC-BY-4.0", "MIT-0" ]
null
null
null
dist-mdi/mdi/robot-confused.js
maciejg-git/vue-bootstrap-icons
bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec
[ "MIT", "CC-BY-4.0", "MIT-0" ]
null
null
null
dist-mdi/mdi/robot-confused.js
maciejg-git/vue-bootstrap-icons
bc60cf77193e15cc72ec7eb7f9949ed8b552e7ec
[ "MIT", "CC-BY-4.0", "MIT-0" ]
null
null
null
import { h } from 'vue' export default { name: "RobotConfused", vendor: "Mdi", type: "", tags: ["robot","confused"], render() { return h( "svg", {"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-robot-confused","innerHTML":"<path d='M20 4H18V3H20.5C20.78 3 21 3.22 21 3.5V5.5C21 5.78 20.78 6 20.5 6H20V7H19V5H20V4M19 9H20V8H19V9M17 3H16V7H17V3M23 15V18C23 18.55 22.55 19 22 19H21V20C21 21.11 20.11 22 19 22H5C3.9 22 3 21.11 3 20V19H2C1.45 19 1 18.55 1 18V15C1 14.45 1.45 14 2 14H3C3 10.13 6.13 7 10 7H11V5.73C10.4 5.39 10 4.74 10 4C10 2.9 10.9 2 12 2S14 2.9 14 4C14 4.74 13.6 5.39 13 5.73V7H14C14.34 7 14.67 7.03 15 7.08V10H19.74C20.53 11.13 21 12.5 21 14H22C22.55 14 23 14.45 23 15M10 15.5C10 14.12 8.88 13 7.5 13S5 14.12 5 15.5 6.12 18 7.5 18 10 16.88 10 15.5M19 15.5C19 14.12 17.88 13 16.5 13S14 14.12 14 15.5 15.12 18 16.5 18 19 16.88 19 15.5M17 8H16V9H17V8Z' />"}, ) } }
76.923077
823
0.662
f134ff9106cadba8ba6dbfc0e1634534f95bc3e6
1,557
js
JavaScript
frontend/src/tests/unit/epics/startGame.spec.js
ilkka-rautiainen/e-getkanban
28d4f6c5174f266f297fa0783380f04cbe769eca
[ "MIT" ]
null
null
null
frontend/src/tests/unit/epics/startGame.spec.js
ilkka-rautiainen/e-getkanban
28d4f6c5174f266f297fa0783380f04cbe769eca
[ "MIT" ]
null
null
null
frontend/src/tests/unit/epics/startGame.spec.js
ilkka-rautiainen/e-getkanban
28d4f6c5174f266f297fa0783380f04cbe769eca
[ "MIT" ]
2
2017-06-01T07:37:02.000Z
2017-06-01T07:39:20.000Z
import { ActionsObservable } from 'redux-observable'; import { Observable } from 'rxjs/Observable'; import { START_GAME, SET_GAME_DATA } from '../../../actions/actionTypes'; import { startGame } from '../../../actions/index'; import startGameEpic from '../../../epics/startGame'; import game from "../../resources/initialData"; describe('startGameEpic', () => { it('should emit a SET_GAME_DATA action with different game objects in action payload', () => { const mockResponse = {response: game}; const dependencies = { ajaxPost: () => Observable.of(mockResponse) }; const payload = { playerName: "player", difficultyLevel: "NORMAL"}; const actions$ = ActionsObservable.of(startGame(payload.playerName, payload.difficultyLevel)); //this is an example how to inject mocked response into epic for testing purposes return startGameEpic(actions$, null, dependencies).toPromise() .then((actionReceived) => { expect(actionReceived.type).toBe(SET_GAME_DATA); expect(actionReceived.payload).toHaveProperty('board'); expect(actionReceived.payload).toHaveProperty('phases'); expect(actionReceived.payload).toHaveProperty('columns'); expect(actionReceived.payload).toHaveProperty('cards'); expect(actionReceived.payload).toHaveProperty('phasePoints'); expect(actionReceived.payload).toHaveProperty('wipLimits'); expect(actionReceived.payload).toHaveProperty('cfdData'); expect(actionReceived.payload).toHaveProperty('cfdConfig'); }) }) })
43.25
98
0.700064
f1358cc1c77417ce375ca9c6e34d68547801bc4a
223
js
JavaScript
data/minors/concussive-trap.js
Crowcaine/crowfall-data
ae6b3356a342389ab5634563dc445e3e93dbdd4a
[ "MIT" ]
1
2021-08-09T01:25:38.000Z
2021-08-09T01:25:38.000Z
data/minors/concussive-trap.js
filaraujo/crowfall-data
ae6b3356a342389ab5634563dc445e3e93dbdd4a
[ "MIT" ]
16
2021-02-07T21:27:57.000Z
2021-04-15T00:25:02.000Z
data/minors/concussive-trap.js
Crowcaine/crowfall-data
ae6b3356a342389ab5634563dc445e3e93dbdd4a
[ "MIT" ]
2
2021-06-17T21:13:41.000Z
2021-08-31T13:20:21.000Z
export default { description: '', id: 'concussive-trap', name: 'Concussive Trap', powers: ['concussive-trap'], requirements: ['domain:dark'], stats: { health: 500 }, type: 'minor', version: '6.540' };
17.153846
32
0.600897
f136df71334d778c65186dfe8b3e5aa0bfa54761
498
js
JavaScript
src/carbon-dating.js
ukulya/basic-js
ed54fc9b39af8e9a7e9e615fbe3d8819190b0c1b
[ "MIT" ]
null
null
null
src/carbon-dating.js
ukulya/basic-js
ed54fc9b39af8e9a7e9e615fbe3d8819190b0c1b
[ "MIT" ]
null
null
null
src/carbon-dating.js
ukulya/basic-js
ed54fc9b39af8e9a7e9e615fbe3d8819190b0c1b
[ "MIT" ]
null
null
null
//const CustomError = require("../extensions/custom-error"); module.exports = function dateSample(/* sampleActivity */) { //throw new CustomError('Not implemented'); // remove line with error and write your code here const MODERN_ACTIVITY = 15; const HALF_LIFE_PERIOD = 0.693/5730; const dateSample = function (sampleActivity){ if (isNaN(parseInt(sampleActivity))) return false return parseInt(Math.ceil(Math.log((MODERN_ACTIVITY / sampleActivity)) / HALF_LIFE_PERIOD)); } };
38.307692
97
0.728916
f1370721b3593fba699e6194d72d738342ee9edc
617
js
JavaScript
Documentation/HElib/html/search/classes_0.js
iruAiweapps/fhe-toolkit-macos
9011dfad573aef83b3f2182f5e0e3e5453d842dc
[ "MIT" ]
348
2020-05-23T22:40:29.000Z
2022-03-06T09:54:36.000Z
Documentation/HElib/html/search/classes_0.js
iruAiweapps/fhe-toolkit-macos
9011dfad573aef83b3f2182f5e0e3e5453d842dc
[ "MIT" ]
38
2020-05-18T11:35:18.000Z
2021-11-23T21:44:50.000Z
Documentation/HElib/html/search/classes_0.js
iruAiweapps/fhe-toolkit-macos
9011dfad573aef83b3f2182f5e0e3e5453d842dc
[ "MIT" ]
40
2020-06-05T17:47:10.000Z
2022-03-13T14:41:24.000Z
var searchData= [ ['add_5fpa_5fimpl_630',['add_pa_impl',['../classhelib_1_1add__pa__impl.html',1,'helib']]], ['adddag_631',['AddDAG',['../classhelib_1_1_add_d_a_g.html',1,'helib']]], ['aligned_5fallocator_632',['aligned_allocator',['../classhelib_1_1_p_g_f_f_t_1_1aligned__allocator.html',1,'helib::PGFFT']]], ['applyperm_5fpa_5fimpl_633',['applyPerm_pa_impl',['../classhelib_1_1apply_perm__pa__impl.html',1,'helib']]], ['argmap_634',['ArgMap',['../classhelib_1_1_arg_map.html',1,'helib']]], ['argprocessor_635',['ArgProcessor',['../structhelib_1_1_arg_map_1_1_arg_processor.html',1,'helib::ArgMap']]] ];
61.7
128
0.729335
f137a2a8edb1df51d9e385b99ba54df426d8ffa0
5,438
js
JavaScript
backend/api/routes/status.js
logan-life/penn_pals
5bfa816856a04af457a4a8ddd8d886d1d0f927ea
[ "MIT" ]
null
null
null
backend/api/routes/status.js
logan-life/penn_pals
5bfa816856a04af457a4a8ddd8d886d1d0f927ea
[ "MIT" ]
null
null
null
backend/api/routes/status.js
logan-life/penn_pals
5bfa816856a04af457a4a8ddd8d886d1d0f927ea
[ "MIT" ]
null
null
null
const express = require('express'); const router = express.Router(); const authenticate = require("../middleware/authenticate.js"); const upload = require("../middleware/upload.js"); const singleUpload = upload.single('image') const User = require('../../schemas/User.js'); // @route PUT api/status // @desc Upload user status router.put('/', authenticate, async (req, res) => { const userid = req.user; try { const user = await User.findById(userid.id); const upload_time = Date.now(); let statusObject; singleUpload(req, res, function(err) { if (req.fileValidationError) { return res.status(400).send(req.fileValidationError); } else if (err) { try { const error_tt = err.code; if (error_tt == "LIMIT_FILE_SIZE") return res.status(413).send(err.message); return res.status(400).send(err); } catch (error) { return res.status(551).send(err); } } else if (!req.file) { if (req.body.type === 'image') return res.status(400).send('Please select an image to upload'); else { statusObject = { username:user.username, firstname:user.firstname, lastname:user.lastname, type:req.body.type, text:req.body.text, image:"", url:req.body.url, upload_time:upload_time }; user.status = statusObject; user.save(); return res.status(200).send('Successful upload'); } } statusObject = { username:user.username, firstname:user.firstname, lastname:user.lastname, type:req.body.type, text:"", image:req.file.location, url:"", upload_time:upload_time }; user.status = statusObject; user.save(); return res.status(200).send('Successful upload'); }); } catch (err) { console.error(err); res.status(500).send('Server Error'); } }) // @desc set status seen to true // @route POST api/status // @access Private router.post("/", authenticate, async (req, res) => { const userid = req.user; try { let user = await User.findById(userid.id); const { contact_username, status_id} = req.body; const currentUserContactElement = user.contacts .filter(function (contacts) { return contacts.username === contact_username; }) .pop(); if (currentUserContactElement.status_id===status_id){ currentUserContactElement.status_seen = true; } user.save(); res.status(200).json("Status_seen updated"); } catch (err) { console.error(err); res.status(500).send("Server Error"); } }); // @desc get list of statuses to display // @route GET api/status // @access Private router.get("/", authenticate, async (req, res) => { const userid = req.user; try { let user = await User.findById(userid.id); let contact_obj = new Array(); contact_obj = user.contacts; let status_array = new Array(); let contactUserDocument; let currentUserContactElement; //extract the username from the contact objects, and look up their status object for (let i = 0; i < contact_obj.length; i++) { currentUserContactElement = user.contacts .filter(function (contacts) { return contacts.username === contact_obj[i].username; }) .pop(); contactUserDocument = await User.findOne({ username:contact_obj[i].username}); if(currentUserContactElement.hidden===false && contactUserDocument.active_status===true){ if(contactUserDocument.status){ if(contactUserDocument.status.id === currentUserContactElement.status_id){ if (currentUserContactElement.status_seen === false){ status_array.push(contactUserDocument.status); } } else { currentUserContactElement.status_id = contactUserDocument.status.id; currentUserContactElement.status_seen = false; status_array.push(contactUserDocument.status); } } } } user.save(); status_array = status_array.sort((a, b) => { let time_a = a.upload_time, time_b = b.upload_time; if (time_a < time_b) { return 1; } if (time_a > time_b) { return -1; } return 0; }); res.status(200).json(status_array); } catch (err) { console.error(err); res.status(500).send("Server Error"); } }); module.exports = router;
36.496644
111
0.506804
f13ab6149fc13a5401c448b5acf9209f51693b11
192
js
JavaScript
aprendendo-html-css/WEBII-IFMG/revisao-js/ex05.js
ArthurTerozendi/html-css
bfc56edabbbdb863af03543b36481373ebb74408
[ "MIT" ]
null
null
null
aprendendo-html-css/WEBII-IFMG/revisao-js/ex05.js
ArthurTerozendi/html-css
bfc56edabbbdb863af03543b36481373ebb74408
[ "MIT" ]
null
null
null
aprendendo-html-css/WEBII-IFMG/revisao-js/ex05.js
ArthurTerozendi/html-css
bfc56edabbbdb863af03543b36481373ebb74408
[ "MIT" ]
null
null
null
removerPropriedade({a: 1, b: 20}, "b"); function removerPropriedade(obj, propriedade) { let newObj = obj; delete newObj[propriedade]; window.alert(JSON.stringify(newObj)); }
21.333333
47
0.671875
f13c16fe1bb88c3bbb49ef4f346e2ffaffb6f358
4,428
js
JavaScript
routes/Statistics.js
d0minYk/the-open-data-map
64f6abc09c1ad0a56201ef4efcc8eac54b0080c0
[ "MIT" ]
null
null
null
routes/Statistics.js
d0minYk/the-open-data-map
64f6abc09c1ad0a56201ef4efcc8eac54b0080c0
[ "MIT" ]
null
null
null
routes/Statistics.js
d0minYk/the-open-data-map
64f6abc09c1ad0a56201ef4efcc8eac54b0080c0
[ "MIT" ]
null
null
null
const router = require('express').Router(); const auth = require('./Auth'); const Keys = require('../config/Keys.js'); const Statistics = require('../models/Statistics.js'); const Utilities = require('../Utilities.js'); const { Client } = require('pg'); router.get('/', auth.optional, (req, res, next) => { return new Promise(async function(resolve, reject) { let stats = await Statistics.get().catch(e => { console.error("Failed to get stats", e) }); let formatted = {}; for (let key in stats) { let stat = stats[key]; formatted[stat.key] = stat.value } resolve(formatted); }).then(function(data) { res.json(data) }).catch(function(error) { if ( (error) && (!error.code) ) console.error("Unexpected Error", error); res.status((error && error.code) ? error.code : 500).json({ error: (error && error.msg) ? error.msg : "Unexpected Error" }) }) }) router.get('/leaderboards', auth.optional, (req, res, next) => { return new Promise(async function(resolve, reject) { const client = new Client(Keys.postgres); client.connect(); let leaderboards = { cities: [], countries: [], users: [], organizations: [], tags: [], features: [], } let users = await client.query(`SELECT id, points, username, users.picture as "userPhoto" FROM USERS WHERE type='user' AND points > 0 ORDER BY points DESC LIMIT 15`, []).catch(e => { console.error("Failed to get like count ", e) }) leaderboards.users = users && users.rows ? users.rows: []; leaderboards.users.map(item => { item.points = Utilities.nFormatter(item.points, 1); return item; }) let organizations = await client.query(`SELECT id, points, username, users.picture as "userPhoto" FROM USERS WHERE type='org' AND points > 0 ORDER BY points DESC LIMIT 15`, []).catch(e => { console.error("Failed to get like count ", e) }) leaderboards.organizations = organizations && organizations.rows ? organizations.rows: []; leaderboards.organizations.map(item => { item.points = Utilities.nFormatter(item.points, 1); return item; }) let cities = await client.query(` SELECT cities.id as "cityId", cities.name as "cityName", countries.id as "countryId", countries.name as "countryName", SUM("activityLog"."pointsEarnt") as "totalPoints" FROM "activityLog" INNER JOIN "cities" ON "activityLog"."entityCityId" = cities.id INNER JOIN "countries" ON cities."countryId" = countries.id GROUP BY 1, 2, 3, "entityCityId" ORDER BY "totalPoints" DESC LIMIT 15 `, []).catch(e => { console.error("Failed to get like count ", e) }) leaderboards.cities = cities && cities.rows ? cities.rows: []; let countries = await client.query(` SELECT countries.id as "countryId", countries.name as "countryName", SUM("activityLog"."pointsEarnt") as "totalPoints" FROM "activityLog" INNER JOIN "countries" ON "activityLog"."entityCountryId" = countries.id GROUP BY 1, 2, "entityCountryId" ORDER BY "totalPoints" DESC LIMIT 15 `, []).catch(e => { console.error("Failed to get like count ", e) }) leaderboards.countries = countries && countries.rows ? countries.rows: []; let tags = await client.query(` SELECT type, name, SUM(count) as "totalCount" FROM tags GROUP BY name, type ORDER BY "totalCount" DESC `, []).catch(e => { console.error("Failed to get like count ", e) }) if (tags && tags.rows) { leaderboards.features = tags.rows.filter(item => item.type === "feature"); leaderboards.categories = tags.rows.filter(item => item.type === "category"); } client.end(); resolve(leaderboards); }).then(function(data) { res.json(data) }).catch(function(error) { if ( (error) && (!error.code) ) console.error("Unexpected Error", error); res.status((error && error.code) ? error.code : 500).json({ error: (error && error.msg) ? error.msg : "Unexpected Error" }) }) }) module.exports = router;
39.891892
246
0.581301
f13db770ca0af8ecfa81e8fe65b8ff0e9f2bfc7e
8,144
js
JavaScript
resources/react/pages/Register/Upload.js
wolvecode/frsc
407cc17332887902a94c975b95c5e08f686a19b4
[ "MIT" ]
null
null
null
resources/react/pages/Register/Upload.js
wolvecode/frsc
407cc17332887902a94c975b95c5e08f686a19b4
[ "MIT" ]
null
null
null
resources/react/pages/Register/Upload.js
wolvecode/frsc
407cc17332887902a94c975b95c5e08f686a19b4
[ "MIT" ]
null
null
null
import React, { useState, useEffect } from "react"; import { FaArrowAltCircleUp, FaFingerprint, FaTrashAlt } from "react-icons/fa"; import { AiOutlineScan } from "react-icons/ai"; import { Link, useHistory, useRouteMatch } from "react-router-dom"; import Camera from "react-html5-camera-photo"; import WebCam from "./components/WebCam"; import FingerPrint from "./components/FingerPrint"; import user from "../../assest/image/userDone.png"; import Webcam from "react-webcam"; import axios from "axios"; // import 'react-html5-camera-photo/build/css/index.css'; // import ImageCropper from "../../components/ImageCropper"; const Upload = () => { const history = useHistory(); const [uploadPic, setUploadPic] = useState(false); const [webCam, setWebCam] = useState(false); const [pic, setPic] = useState(""); const [finger, setFinger] = useState(false); const [checkLeft, SetCheckLeft] = useState(false); const [checkRight, SetCheckRight] = useState(false); const [preview, setPreview] = useState(false); const { url } = useRouteMatch(); const handleUploadPic = () => { setUploadPic(!uploadPic); }; const handleWeb = () => { setWebCam(true); }; const handlePic = (e) => { setPic(e.target.value); console.log(pic); }; const handleFinger = () => { setFinger(!finger); }; const handlePreview = () => { setWebCam(true); // setPreview(true); }; const handleCheckLeft = () => { SetCheckLeft(true); setFinger(!finger); }; const handleCheckRight = () => { SetCheckRight(true); setFinger(!finger); }; const handleSubmit = (e) => { e.preventDefault(); axios .post("/home/register/upload", { left_thumb: "dhdhd", right_thumb: "dgdgd", driver_id: localStorage.getItem("created_id"), passport: localStorage.getItem("image"), }) .then((res) => { alert("picure uploaded"); localStorage.clear(); history.push("/home/register"); }) .catch((err) => err); }; const image = localStorage.getItem("image"); return ( <div> {finger ? ( <FingerPrint setFinger={setFinger} finger={finger} /> ) : ( <form className="user"> <div className="webcam"> {webCam ? ( <WebCam setPreview={setPreview} preview={preview} setWebCam={setWebCam} webCam={Webcam} /> ) : null} </div> <div className="form_row"> {/* user info */} {preview ? ( <div className="form_group "> <label htmlFor="surname">Passport</label> <div className="uploaded_img"> <img src={image} alt="" /> </div> </div> ) : ( <div className="form_group"> <label htmlFor="surname">Upload Passport</label> <div> <label htmlFor="file" className="user_input upload" onClick={handlePreview} > Snap passport <span className="icon"> <FaArrowAltCircleUp /> </span> </label> <input type="file" hidden // id="file" name="profile_pic" className="file" /> </div> </div> )} </div> <div className="form_row"> {/* check if the fingerPrint box have been clicked */} {checkLeft ? ( <div className="form_group"> <label htmlFor="surname">Left Thumb</label> <div className="uploaded_bttom"> <div className="scanned"> <span> <FaTrashAlt /> </span> <FaFingerprint /> </div> </div> </div> ) : ( <div className="form_group"> <label htmlFor="left">Scan Right Thumb</label> <div> <button type="button" className="user_input upload" onClick={handleCheckLeft} > Scan finger <span className="icon"> <AiOutlineScan /> </span> </button> </div> </div> )} {/* check if the fingerPrint box have been clicked */} {checkRight ? ( <div className="form_group uploaded"> <label htmlFor=""> Right Thumb </label> <div className="uploaded_bttom"> <div className="scanned"> <span> <FaTrashAlt /> </span> <FaFingerprint /> </div> </div> </div> ) : ( <div className="form_group"> <label htmlFor="left">Scan Right Thumb</label> <div> <button type="button" className="user_input upload" onClick={handleCheckRight} > Scan finger <span className="icon"> <AiOutlineScan /> </span> </button> </div> </div> )} </div> <div className="save"> <div className=""> <button onClick={handleSubmit} type="button"> Save </button> </div> </div> </form> )} </div> ); }; export default Upload;
38.597156
80
0.337058
f13e0e8e4ac2e463d2e5c8f0dbca2e725218e7bd
6,370
js
JavaScript
App/Containers/ProfileScreen/ProfileScreen.js
sebastianoscarlopez/country-ingresos
c565f55d083691cabd5c3712d31493b4872acf1f
[ "MIT" ]
null
null
null
App/Containers/ProfileScreen/ProfileScreen.js
sebastianoscarlopez/country-ingresos
c565f55d083691cabd5c3712d31493b4872acf1f
[ "MIT" ]
null
null
null
App/Containers/ProfileScreen/ProfileScreen.js
sebastianoscarlopez/country-ingresos
c565f55d083691cabd5c3712d31493b4872acf1f
[ "MIT" ]
null
null
null
import React, { useState, useEffect } from 'react' import { TextInput, Text, View, ActivityIndicator } from 'react-native' import { shallowEqual, useSelector, useDispatch } from 'react-redux' import ContainerScreen from 'App/Containers/ContainerScreen/ContainerScreen' import { InputField, Label, Header, Button, Modal } from 'App/Components' import styles from '../ContainersStyle' import { Colors, Images } from 'App/Theme' import { nameLabel, lastNameLabel, phoneLabel, allotmentLabel, allotmentOthersLabel, eMailLabel, msgGenericError } from 'App/Assets/Strings' import { vh } from 'App/Helpers/DimensionsHelper' import UserActions from 'App/Stores/User/Actions' import GlobalActions from 'App/Stores/Global/Actions' import NavigationService from 'App/Services/NavigationService' import ImagePicker from 'react-native-image-crop-picker'; // More info on all the options is below in the API Reference... just some common use cases shown here const options = { width: 500, height: 500, cropping: true, cropperCircleOverlay: true, sortOrder: 'none', compressImageMaxWidth: 500, compressImageMaxHeight: 500, compressImageQuality: 0.8, includeBase64: true, includeExif: true, cropperStatusBarColor: 'white', cropperToolbarColor: 'white', cropperActiveWidgetColor: 'white', cropperToolbarWidgetColor: '#3498DB', } const ProfileScreen = (props) => { const user = useSelector(({ user }) => user, shallowEqual) const { idApp, isOwner, name: currentName, phone: currentphone, allotment: currentAllotment, allotmentOthers: currentAllotmentOthers, eMail: currentEMail, profileImage: currentProfileImage, lastProfile } = user const [name, setName] = useState() const [phone, setPhone] = useState() const [allotment, setAllotment] = useState() const [allotmentOthers, setAllotmentOthers] = useState() const [eMail, setEMail] = useState() const [profileImage, setProfileImage] = useState() const [isLoaded, setIsLoaded] = useState(false) const [isPickerVisible, setIsPickerVisible] = useState(false) const dispatch = useDispatch() const handlerEnviar = () => { setIsLoaded(false) dispatch(UserActions.updateProfile(idApp, isOwner, name, phone, eMail)) } useEffect(() => { if (!isLoaded) { dispatch(UserActions.getProfile(idApp, isOwner)) } }, [isLoaded, dispatch]) useEffect(() => { setIsLoaded(true) setName((currentName || '').toString()) setPhone((currentphone || '').toString()) setAllotment((currentAllotment || '').toString()) setAllotmentOthers((currentAllotmentOthers || '').toString()) setEMail((currentEMail || '').toString()) setProfileImage(currentProfileImage) }, [lastProfile]) useEffect(() => { setProfileImage(currentProfileImage) }, [currentProfileImage]) const isKeyboardVisible = useSelector(({ global: { isKeyboardVisible } }) => isKeyboardVisible) const requestPicture = () => { setIsPickerVisible(true) } const openCamera = () => { ImagePicker.openCamera(options) .then((response) => { handlerOnPickerClose(response) }) .catch((e) => { dispatch(GlobalActions.setMessage(msgGenericError, true)) }) } const openGallery = () => { ImagePicker.openPicker(options) .then((response) => { handlerOnPickerClose(response) }) .catch((e) => { dispatch(GlobalActions.setMessage(msgGenericError, true)) }) } const handlerOnPickerClose = (response) => { setIsPickerVisible(false) //const source = { uri: `file://${response.path}` } const source = { uri: 'data:image/jpeg;base64,' + response.data }; dispatch(UserActions.setProfileImage(idApp, source)) } return ( <> {isPickerVisible && ( <Modal> <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', alignSelf: 'center' }}> <View style={{ flex: 1, flexDirection: 'column', alignItems: 'center', alignSelf: 'center' }}> <Button style={{ backgroundColor: Colors.success }} onPress={openCamera}>📷 CAMARA</Button> <Button style={{ backgroundColor: Colors.success }} onPress={openGallery}>📁GALERIA</Button> <Button style={{ backgroundColor: Colors.error }} onPress={() => setIsPickerVisible(false)}>CANCELAR</Button> </View> </View> </Modal>) } {isLoaded && ( <View style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}> {!isKeyboardVisible && <Header onPressIcon={requestPicture} icon={profileImage} text={`${name}`} />} <View style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 10, paddingBottom: 0, height: vh(isKeyboardVisible ? 47 : 65) }}> <View style={{ flexDirection: 'row', marginVertical: isKeyboardVisible ? 0 : 4 }}> <InputField label={nameLabel} value={name} onChangeText={setName} /> </View> <View style={{ flexDirection: 'row', marginVertical: isKeyboardVisible ? 0 : 4 }}> <InputField label={phoneLabel} value={phone} onChangeText={setPhone} /> </View> <View style={{ flexDirection: 'row', marginVertical: isKeyboardVisible ? 0 : 4 }}> <InputField disabled label={allotmentLabel} value={allotment} /> </View> <View style={{ flexDirection: 'row', marginVertical: isKeyboardVisible ? 0 : 4 }}> <InputField disabled label={allotmentOthersLabel} value={allotmentOthers} /> </View> <View style={{ flexDirection: 'row', marginVertical: isKeyboardVisible ? 0 : 4 }}> <InputField autoCapitalize='none' label={eMailLabel} value={eMail} onChangeText={setEMail} /> </View> </View> <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'center' }}> <Button onPress={handlerEnviar} >GUARDAR</Button> <View style={{ width: 50 }} /> <Button onPress={() => NavigationService.navigateAndReset('OptionsScreen')} style={{ backgroundColor: Colors.error }}>CANCELAR</Button> </View> </View> )} {!isLoaded && ( <ActivityIndicator size='large' style={{ flex: 1, backgroundColor: Colors.black }} color={Colors.headerBottom} /> ) } </> ) } export default ProfileScreen
40.316456
212
0.654945
f13ed09c86d4c4985b148583e886909c09657265
112
js
JavaScript
index.js
distributed-systems/playr-webservice
c9e83b32c8531cd188d4745f6802a3c7c74f2474
[ "MIT" ]
null
null
null
index.js
distributed-systems/playr-webservice
c9e83b32c8531cd188d4745f6802a3c7c74f2474
[ "MIT" ]
null
null
null
index.js
distributed-systems/playr-webservice
c9e83b32c8531cd188d4745f6802a3c7c74f2474
[ "MIT" ]
null
null
null
(function() { 'use strict'; let Service = require('./src/PlayrWebservice'); new Service(); })();
12.444444
51
0.553571
f13ee026ec33913b99f13d418e05b77beb4bf086
4,218
js
JavaScript
src/templates/category.js
santuan/bqxn
4123e2e77dde3a1e723b5b38534b49129db1c00e
[ "RSA-MD" ]
null
null
null
src/templates/category.js
santuan/bqxn
4123e2e77dde3a1e723b5b38534b49129db1c00e
[ "RSA-MD" ]
null
null
null
src/templates/category.js
santuan/bqxn
4123e2e77dde3a1e723b5b38534b49129db1c00e
[ "RSA-MD" ]
null
null
null
//import { Link, FormattedMessage } from "gatsby-plugin-intl" import Layout from "../components/layout" import { graphql } from "gatsby" import { Link } from "gatsby" import SEO from "../components/seo" import Img from "gatsby-image" import React from "react" import { kebabCase } from "lodash" import tw from "twin.macro" import styled from "@emotion/styled" export const query = graphql` query($slug: String) { sanityCategory(slug: { current: { eq: $slug } }) { title image { asset { url fluid(maxWidth: 500) { ...GatsbySanityImageFluid } } } description } allSanityPost( filter: { categories: { elemMatch: { slug: { current: { eq: $slug } } } } } sort: { order: DESC, fields: publishedAt } ) { edges { node { title excerpt categories { title slug { current } _id } mainImage { asset { fluid(maxWidth: 500) { ...GatsbySanityImageFluid } } } publishedAt(locale: "es", formatString: "LL") slug { current } } } } } ` const CategoriesTemplatePage = ({ data }) => ( <Layout> <SEO title={data.sanityCategory.title} image={data.sanityCategory.image.asset.url} /> <div className="flex flex-col mt-24 "> <div className="mb-6 bg-blue-600"> <div className="relative z-10 flex flex-col items-center justify-center w-full max-w-6xl px-6 pt-12 mx-auto mb-6 text-center md:mb-0 md:py-12 md:px-2"> <Link to="/blog" className="inline-block mb-6 font-serif text-white border-b-2 border-gray-100" > Volver blog </Link> <h1 className="font-serif text-4xl text-white"> {data.sanityCategory.title} </h1> <div className="block mt-2 font-serif text-lg text-center text-white "> {data.sanityCategory.description && ( <>{data.sanityCategory.description}</> )} </div> </div> </div> <Section> <div className="grid w-full gap-4 px-6 mx-auto max-w-7xl sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3"> {data.allSanityPost.edges.map(({ node: article }) => ( <div to={`/blog/${kebabCase(article.slug.current)}`} className="relative flex flex-col items-start justify-start overflow-hidden transition-all duration-700 ease-in-out transform bg-gray-800 rounded-xl blog-item" > <Link to={`/blog/${kebabCase(article.slug.current)}`} className="w-full h-56 overflow-hidden shadow-xl opacity-90" > {article.mainImage && ( <Img fluid={article.mainImage.asset.fluid} className="object-cover w-full h-56" /> )} </Link> <div className="relative z-50 w-full px-6 mt-5"> <Link to={`/blog/${kebabCase(article.slug.current)}`} className="pr-6 mt-4 font-serif text-base font-bold tracking-wider text-left text-white transition-all duration-500 unerline transform-gpu md:text-xl hover:opacity-70" > {article.title} </Link> <p className="mt-3 text-base text-white">{article.excerpt}</p> <time className="block mb-5 mr-3 italic text-white opacity-80"> {article.publishedAt} </time> </div> </div> ))} </div> </Section> </div> </Layout> ) export default CategoriesTemplatePage const Section = styled.section` ${tw`relative w-full max-w-6xl mx-auto overflow-y-auto`} .blog-item { img { transition: all 700ms !important; transform: scale(1) !important; } &:hover { img { transform: scale(1.05) !important; } } } `
29.496503
185
0.516833
f1401a120e0924f08f4bbdc1d3709a97e0c8ba6d
3,619
js
JavaScript
lib/utils.js
chinnurtb/app-scraper
04ff9a2636a19db517788b6866ce088e124a6ecf
[ "MIT" ]
1
2019-03-04T02:22:18.000Z
2019-03-04T02:22:18.000Z
lib/utils.js
chinnurtb/app-scraper
04ff9a2636a19db517788b6866ce088e124a6ecf
[ "MIT" ]
null
null
null
lib/utils.js
chinnurtb/app-scraper
04ff9a2636a19db517788b6866ce088e124a6ecf
[ "MIT" ]
null
null
null
var path = require('path'), fs = require('fs'), program = require('commander'), AppInfo = require('./model/').AppInfo, query = require('./query/'); module.exports = exports = utils = {}; utils.endsWith = function(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } utils.startsWith = function(str, prefix) { return str.indexOf(prefix) === 0; } utils.getRelativePath = function(fileName) { return path.join(process.cwd(), fileName); } utils.contains = function(str, substring){ return str.indexOf(substring) !== -1; }; utils.extractNameFromUrl = function(url){ var str = url.match(new RegExp("http://(.*)"))[1]; var ind = str.lastIndexOf("."); return str.substring(0, ind); }; utils.loadFromJson = function(toArray, pathToJson){ var list = require(pathToJson); list.forEach(function(item){ toArray.push(item); }); } utils.loadFromTxt = function(toArray, pathToTxt){ var res = fs.readFileSync(pathToTxt, 'utf-8'); res.split('\n').filter(function(item){ return item.length > 0; }).forEach(function(item){ if(!utils.contains(item, "http://")) item = "http://"+item; toArray.push(item) }); } utils.getWebsiteName = function(websiteUrl, callback){ var names = new Array(); query.queryWebsiteForName(websiteUrl, function(results){ results.forEach(function(item){ if(!item.error){ names = names.concat(item.results); } }); //Look for links to home page, and copy text inside query.queryWebsiteForUrls(websiteUrl, function(results){ results.forEach(function(item) { if(websiteUrl === item.href){ names.push(item.text.replace(/\W/g, '')); } }); //Finally, just use the url as websiteName names.push(utils.extractNameFromUrl(websiteUrl)); //Filter the array one last time var res = names.filter(function(str){ return !!str; }); //For now, we return only first name found callback(res[0]); }); }); } utils.getWebsiteiOSAppUrl = function(websiteUrl, callback){ query.queryWebsiteForFilteredUrls(websiteUrl, function(item){ return utils.contains(item.href, "itunes.apple.com/us/app"); }, function(results){ if(!results.length) callback(null); else callback(results[0].href); }); }; utils.getWebsiteiOSAppId = function(websiteUrl, callback){ query.queryWebsiteForAppId(websiteUrl, function(id){ callback(id); }); }; utils.getWebsiteAndroidAppUrl = function(websiteUrl, callback){ query.queryWebsiteForFilteredUrls(websiteUrl, function(item){ return utils.contains(item.href, "play.google.com"); }, function(results){ if(!results.length) callback(null); else callback(results[0].href); }); }; utils.loadWebsites = function(){ var listApps = []; if(program.urls){ var listWebsites = []; process.argv.forEach(function(item, index){ if(index >= 3) { try{ if(utils.endsWith(item, '.txt')){ utils.loadFromTxt(listWebsites, utils.getRelativePath(item)); } else if (utils.endsWith(item, '.json')){ utils.loadFromJson(listWebsites, utils.getRelativePath(item)); } } catch(err){ console.log( "Could not open file "+item+" with error "+err ); } } }); listWebsites.forEach(function(website){ listApps.push(new AppInfo(website)); }); } return listApps; }; utils.writeResultsToFile = function(str){ try{ fs.writeFileSync(path.join(process.cwd(), 'results.json'), str); } catch(err){ console.log( "Could not write results to external file because "+err ); } };
24.787671
72
0.651009
f140d93b0838024c5b0500692d544dab30589d9c
967
js
JavaScript
api/handlers/recipeTypesValidate.js
mheppner/scale-ui
ae2c9a8414331638b64a7437292f488828571725
[ "Apache-2.0" ]
8
2018-09-24T11:09:05.000Z
2022-03-10T05:00:08.000Z
api/handlers/recipeTypesValidate.js
mheppner/scale-ui
ae2c9a8414331638b64a7437292f488828571725
[ "Apache-2.0" ]
348
2018-08-11T20:11:57.000Z
2022-03-02T02:48:31.000Z
api/handlers/recipeTypesValidate.js
mheppner/scale-ui
ae2c9a8414331638b64a7437292f488828571725
[ "Apache-2.0" ]
6
2019-03-13T17:31:41.000Z
2020-08-19T15:32:56.000Z
const _ = require('lodash'); module.exports = function (request) { var warnings = []; var errors = []; var nodes = {}; if (!request.payload.definition) { warnings.push({ id: 'Missing Definition', details: 'Recipe type definition is undefined' }); } _.forEach(_.keys(request.payload.definition.nodes), function (key) { nodes[key] = { status: 'UNCHANGED', changes: [], reprocess_new_node: false, force_reprocess: false, dependencies: request.payload.definition.nodes[key].dependencies, node_type: request.payload.definition.nodes[key].node_type } }); return { is_valid: errors.length === 0, warnings: warnings, errors: errors, diff: { can_be_reprocessed: true, reasons: [], nodes: nodes } }; };
28.441176
78
0.517063
f14203edd89893a95cf1b030c539fe6f4c86b5d3
248
js
JavaScript
src/website/app/demos/Form/FormFieldDivider/description.js
avetisk/mineral-ui
5abbc4b7fd4937a85322e11f4bd0def194dfe7cc
[ "Apache-2.0" ]
562
2017-04-21T19:37:27.000Z
2022-02-13T03:27:24.000Z
src/website/app/demos/Form/FormFieldDivider/description.js
avetisk/mineral-ui
5abbc4b7fd4937a85322e11f4bd0def194dfe7cc
[ "Apache-2.0" ]
590
2017-04-25T19:38:34.000Z
2020-10-07T14:53:04.000Z
src/website/app/demos/Form/FormFieldDivider/description.js
targetx/fork-mineral-ui
f47073b76443dcd895b218e43d510df0616870ec
[ "Apache-2.0" ]
68
2017-04-25T21:11:10.000Z
2022-01-21T12:25:59.000Z
/* @flow */ export default `FormFieldDivider separates [FormFields](/components/form-field) to group form inputs. FormFieldDividers help your users grok forms with several inputs by hinting at related fields, without explicitly adding a legend.`;
35.428571
79
0.798387
f1435cfd83438b73ec742f2d4cf996bdc76c79b9
5,033
js
JavaScript
test/bcdbuilder.js
jpmedley/mdn-helper
297c7f1b4967572440fc60f542f06d944c53fcc8
[ "Apache-2.0" ]
4
2021-02-17T03:21:33.000Z
2022-01-30T16:00:21.000Z
test/bcdbuilder.js
jpmedley/mdn-helper
297c7f1b4967572440fc60f542f06d944c53fcc8
[ "Apache-2.0" ]
57
2019-01-22T20:50:04.000Z
2021-12-13T19:30:49.000Z
test/bcdbuilder.js
jpmedley/mdn-helper
297c7f1b4967572440fc60f542f06d944c53fcc8
[ "Apache-2.0" ]
2
2019-02-27T15:54:07.000Z
2019-04-09T19:23:47.000Z
// Copyright 2019 Google LLC // // 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 // // https://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. 'use strict'; const assert = require('assert'); const fs = require('fs'); const Validator = require('jsonschema').Validator; const { BCDBuilder } = require('../bcdbuilder.js'); const { FileProcessor } = require('../fileprocessor.js'); const utils = require('../utils.js'); const EXPECTED_UAS = ["chrome", "chrome_android", "edge", "edge_mobile", "firefox", "firefox_android", "ie", "nodejs", "opera", "opera_android", "qq_android", "safari", "safari_ios", "samsunginternet_android", "uc_android", "uc_chinese_android", "webview_android"]; const BURNABLE = './test/files/burnable.idl'; const tempFolder = 'tmp/'; const jsonPath = `${tempFolder}test-bcd.json`; global.__Flags = require('../flags.js').FlagStatus('./test/files/exp_flags.json5'); describe('BCDBuilder', () => { describe('write()', () => { beforeEach(() => { utils.deleteUnemptyFolder(tempFolder); utils.makeFolder(tempFolder); }); it('Confirms that a BCD file is written', () => { let id; const fp = new FileProcessor(BURNABLE); fp.process((result) => { id = result; }, true) const bcdManager = new BCDBuilder(id, 'api', {verbose: false}); bcdManager.getBCDObject(jsonPath); bcdManager.write(jsonPath); assert.ok(fs.existsSync(jsonPath)); }); it('Confirms that the written BCD file is valid', () => { // Write a BCD file let id; const fp = new FileProcessor(BURNABLE); fp.process((result) => { id = result; }, true) const bcdManager = new BCDBuilder(id, 'api', {verbose: false}); bcdManager.getBCDObject(jsonPath); bcdManager.write(jsonPath); // Load the schema let buffer = fs.readFileSync('test/files/compat-data.schema.json'); const schema = [buffer.toString()]; // Load the new BCD file buffer = fs.readFileSync(jsonPath); const burnableBCD = JSON.parse(buffer.toString()).api; const validator = new Validator(); // Compare const result = validator.validate(burnableBCD, schema); assert.ok(result.errors.length === 0); }); it('Confirms that the written BCD file is correctly nested', () => { // Write and load a BCD file let id; const fp = new FileProcessor(BURNABLE); fp.process((result) => { id = result }, true) const bcdManager = new BCDBuilder(id, 'api', {verbose: false}); bcdManager.getBCDObject(jsonPath); bcdManager.write(jsonPath); const resultString = fs.readFileSync(jsonPath).toString(); // Load a correctly-nested version of what was written and compare const comparisonString = fs.readFileSync('test/files/properly-nested-bcd.json').toString(); assert.strictEqual(resultString, comparisonString); }); it('Confirms that browsers are in the correct order in a written BCD file', () => { // Write and load a BCD file let id; const fp = new FileProcessor(BURNABLE); fp.process((result) => { id = result; }, true) const bcdManager = new BCDBuilder(id, 'api', {verbose: false}); bcdManager.getBCDObject(jsonPath); bcdManager.write(jsonPath); const resultString = fs.readFileSync(jsonPath).toString(); // Cut BCD file into lines and extract user agent names const bcdLines = resultString.split('\n'); const regex = /"(\w+)":\s{/; let fileIncludes = []; for (let b of bcdLines) { // Record UA names as they are found let matches = b.match(regex); if (!matches) { continue; } let possibleUA = matches[1]; if (EXPECTED_UAS.includes(possibleUA)) { if (fileIncludes.includes(possibleUA)) { continue; } fileIncludes.push(possibleUA); } } // Test that UA names are alphabetical const alphabetical = [...fileIncludes]; alphabetical.sort(); assert.deepStrictEqual(fileIncludes, alphabetical); }); afterEach(() => { utils.deleteUnemptyFolder('tmp/'); }); }); describe('getBCDObject()', () => { it('Confirms that it returns a structure', () => { let id; const fp = new FileProcessor(BURNABLE); fp.process((result) => { id = result; }, true) const bcdManager = new BCDBuilder(id, 'api', {verbose: false}); const bcd = bcdManager.getBCDObject(jsonPath); assert.notEqual(bcd, null); }); }); });
35.95
265
0.633618
f14428d9186fe3de7559b4f499cf51c23bdfb322
219
js
JavaScript
examples/js/defaultStyling.js
magplus/intl-tel-input
4fb04b2f6c14881c5fd1f4a608268e0e4987ba82
[ "MIT" ]
1
2017-07-08T12:47:12.000Z
2017-07-08T12:47:12.000Z
examples/js/defaultStyling.js
denizhacisalihoglu/intl-tel-input
afa3e4df4531ba37201936f8de8d590ecb3d7fd3
[ "MIT" ]
null
null
null
examples/js/defaultStyling.js
denizhacisalihoglu/intl-tel-input
afa3e4df4531ba37201936f8de8d590ecb3d7fd3
[ "MIT" ]
null
null
null
$("#phone1").intlTelInput({defaultStyling: "inside"}); $("#phone2").intlTelInput({defaultStyling: "outside"}); $("#phone3").intlTelInput({defaultStyling: "outside"}); $("#phone4").intlTelInput({defaultStyling: "none"});
54.75
55
0.694064
f1442f9e12d2a8c78b400ab08f6695252e4a651b
494
js
JavaScript
main.js
warbelt/dicemaster
a922d184aace3ab3259e8189e24988cb05a48fa9
[ "MIT" ]
null
null
null
main.js
warbelt/dicemaster
a922d184aace3ab3259e8189e24988cb05a48fa9
[ "MIT" ]
2
2021-01-28T19:48:52.000Z
2022-03-25T18:41:16.000Z
main.js
warbelt/dicemaster
a922d184aace3ab3259e8189e24988cb05a48fa9
[ "MIT" ]
1
2019-06-10T16:13:51.000Z
2019-06-10T16:13:51.000Z
const { app, BrowserWindow } = require('electron'); let win; // Global reference to the window so the GC does not close it function createWindow () { win = new BrowserWindow({ width: 1280, height: 720, frame: false, }); win.loadURL('file://' + __dirname + '/app/www/index.html'); } app.on('ready', createWindow); app.on('window-all-closed', () => { app.quit(); }); app.on('closed', () => { win.removeAllListeners('close'); win = null; });
19.76
70
0.580972
f1446d3c31b85f84ae712cb11e941788bd3298e8
96
js
JavaScript
km_dev/nodejs_experiments/print_to_console/console_output.js
KyleMahan/MarshallSt_code
5bc514ff01aa6cc600e18718afe2a25e7f7a9cab
[ "MIT" ]
null
null
null
km_dev/nodejs_experiments/print_to_console/console_output.js
KyleMahan/MarshallSt_code
5bc514ff01aa6cc600e18718afe2a25e7f7a9cab
[ "MIT" ]
1
2020-12-01T23:18:39.000Z
2020-12-01T23:18:39.000Z
km_dev/nodejs_experiments/print_to_console/console_output.js
KyleMahan/MarshallSt_code
5bc514ff01aa6cc600e18718afe2a25e7f7a9cab
[ "MIT" ]
null
null
null
// This will output to the console console.log('Trying to output to the console') console.log(0)
32
46
0.760417
f144ba329dfd70225c30b0c30ea58f94df6cd78e
581
js
JavaScript
cheat/index.js
cursorweb/Wordle-Guess-Engine
fae297a4e6dc6ef3021ae82c99fc27f668514a1b
[ "MIT" ]
null
null
null
cheat/index.js
cursorweb/Wordle-Guess-Engine
fae297a4e6dc6ef3021ae82c99fc27f668514a1b
[ "MIT" ]
null
null
null
cheat/index.js
cursorweb/Wordle-Guess-Engine
fae297a4e6dc6ef3021ae82c99fc27f668514a1b
[ "MIT" ]
null
null
null
// cheaty method! import { wordList } from "./la.js"; import { question as prompt } from "readline-sync"; const epox = new Date(2021, 5, 19, 0, 0, 0, 0); // generates date (Na) function makeDate(e, a) { let s = new Date(e); let t = new Date(a).setHours(0, 0, 0, 0) - s.setHours(0, 0, 0, 0); return Math.floor(t / 864e5); } // creates index (Ga) function makeIndex(e) { return makeDate(epox, e); } // creates answer (Da) export function makeAns(e, tweak = -1) { let a; let s = makeIndex(e); a = s % wordList.length; return wordList[a + tweak]; }
22.346154
70
0.60241
f1451a7695c1c11eb31301b299b32551bbc1710b
1,781
js
JavaScript
index.js
ReklatsMasters/win-ps
ea5f7e5978b3a8620556a0d898000429e5baeb4f
[ "MIT" ]
1
2017-04-03T07:41:46.000Z
2017-04-03T07:41:46.000Z
index.js
ReklatsMasters/win-ps
ea5f7e5978b3a8620556a0d898000429e5baeb4f
[ "MIT" ]
null
null
null
index.js
ReklatsMasters/win-ps
ea5f7e5978b3a8620556a0d898000429e5baeb4f
[ "MIT" ]
null
null
null
'use strict'; const shell = require('child_process').spawn; const command = { shell: "powershell.exe", shell_arg: "-NoProfile -ExecutionPolicy Bypass -Command", ps: "get-wmiobject win32_process", select: "select", convert: "convertto-json -compress", alias: (from, to) => `@{ Name = '${to}'; Expression = { $_.${ from } }}` } const isAlias = field => field && (typeof field === 'object') && Object.keys(field).length >= 1; function toAlias(map) { var fields = []; for (let from of Object.keys(map)) { fields.push(command.alias(from, map[from])); } return fields; } function normalizeFields(fields) { var normalFields = []; for (let field of fields) { if (isAlias(field)) { var keys = toAlias(field); normalFields = normalFields.concat(keys); } else { normalFields.push(field); } } return normalFields; } /** * Build shell command * @param {Array} fields * @return {Object} child_process instance */ function build_shell(fields) { var $fields = Array.isArray(fields) ? normalizeFields(fields) : ['ProcessId','Name','Path','ParentProcessId','Priority']; var args = command.shell_arg.split(' '); args.push(`${command.ps} | ${command.select} ${ $fields.join(',') } | ${command.convert}`); return shell(command.shell, args); } /** * Main function to receive the list of the launched processes * @param {Array} fields fields to select * @return {Promise} resolved to array of processes */ exports.snapshot = function snapshot(fields) { var ps = build_shell(fields); var data = []; ps.stdout.on('data', (chunk) => { data.push(chunk); }) return new Promise((resolve) => { ps.on('close', () => { var json = JSON.parse( Buffer.concat(data).toString() ); data.length = 0; resolve(json); }) }) }
23.434211
122
0.645143